/* css/style.css */
@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@500;700;900&family=Outfit:wght@600;800&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --accent-color: #f59e0b;
  --accent-hover: #d97706;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --text-main: #f8fafc;
  --text-sub: #94a3b8;
  --card-bg-upper: linear-gradient(145deg, #ffffff, #f1f5f9);
  --card-bg-lower: linear-gradient(145deg, #fef3c7, #fde68a);
  --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15);
  --card-selected-glow: 0 0 15px rgba(59, 130, 246, 0.8), 0 0 5px rgba(59, 130, 246, 0.5);
  --font-family: 'M PLUS Rounded 1c', 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow-x: hidden;
  padding: 12px;
}

/* ヘッダー・ステータスバー */
.app-header {
  width: 100%;
  max-width: 800px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(10px);
  padding: 10px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  margin-bottom: 12px;
}

.game-title {
  font-size: 1.2rem;
  font-weight: 900;
  background: linear-gradient(to right, #60a5fa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-bar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.status-badge {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge .value {
  color: var(--accent-color);
  font-size: 1.05rem;
  font-family: 'Outfit', sans-serif;
}

/* メインゲームエリア */
.game-container {
  width: 100%;
  max-width: 800px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 単語作成エリア */
.word-builder-section {
  background: rgba(15, 23, 42, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 16px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  transition: border-color 0.3s;
}

.word-builder-section.drag-over {
  border-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.1);
}

.section-label {
  font-size: 0.8rem;
  color: var(--text-sub);
  font-weight: 700;
  letter-spacing: 1px;
}

.build-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  min-height: 60px;
  width: 100%;
}

.placeholder-text {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.9rem;
  font-weight: 700;
  pointer-events: none;
}

/* コントロールボタン群 */
.action-controls {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.btn {
  font-family: var(--font-family);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* フィードバックメッセージ */
.toast-message {
  height: 24px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  transition: opacity 0.3s;
}

.toast-message.error {
  color: #f87171;
}

.toast-message.success {
  color: #34d399;
}

/* 手札エリア */
.hand-section {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hand-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 90px;
  padding: 4px;
}

/* カードスタイル（トランプ・ボードゲーム風） */
.card {
  width: 52px;
  height: 72px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  border: 2px solid #ffffff;
}

.card:hover {
  transform: translateY(-6px) scale(1.05);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.35);
}

.card.selected {
  transform: translateY(-8px) scale(1.08);
  box-shadow: var(--card-selected-glow);
  border-color: #60a5fa;
}

.card.is-uppercase {
  background: var(--card-bg-upper);
  color: #1e293b;
}

.card.is-lowercase {
  background: var(--card-bg-lower);
  color: #78350f;
}

.card .badge {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 0.55rem;
  font-weight: 700;
  opacity: 0.6;
}

/* 完成単語リストエリア */
.completed-section {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.word-list-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-height: 100px;
  overflow-y: auto;
}

.word-chip {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.word-chip .en {
  font-weight: 800;
  color: #6ee7b7;
  font-family: 'Outfit', sans-serif;
}

.word-chip .ja {
  color: var(--text-main);
  font-size: 0.8rem;
}

/* モーダル（ゲームクリア） */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 32px 24px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.8);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent-color);
  margin-bottom: 12px;
}

.modal-score {
  font-size: 1.1rem;
  color: var(--text-sub);
  margin-bottom: 24px;
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* キーフレームアニメーション */
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* レスポンシブ調整 */
@media (max-width: 480px) {
  .card {
    width: 44px;
    height: 62px;
    font-size: 1.4rem;
    border-radius: 10px;
  }
  .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
  .game-title {
    font-size: 1rem;
  }
}
