/* GoQuizzle - Game page styles */

.game-shell {
  max-width: 720px; margin: 32px auto; padding: 0 16px;
}
.game-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-weight: 700; font-size: 14px;
  margin-bottom: 16px;
}
.game-back:hover { color: var(--orange-dark); }

.game-header {
  background: var(--white); border: 2px solid var(--line);
  border-radius: 24px; padding: 24px 28px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.game-header .icon { font-size: 44px; }
.game-header h1 { font-size: 28px; margin: 0; }
.game-header p { color: var(--muted); font-size: 14px; margin: 0; }
.game-header .score-block { margin-left: auto; display: flex; gap: 20px; align-items: center; }
.game-header .score-num { font-family: 'Fredoka', sans-serif; font-size: 32px; color: var(--orange-dark); font-weight: 700; }
.game-header .score-lbl { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

.game-board {
  background: var(--white); border: 2px solid var(--line);
  border-radius: 24px; padding: 32px;
  min-height: 320px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
@media (max-width: 600px) { .game-board { padding: 20px; } }

.game-info {
  background: var(--orange-bg); border-radius: 18px; padding: 20px 24px;
  margin-top: 24px; color: var(--ink-soft); font-size: 15px; line-height: 1.6;
}
.game-info h3 { color: var(--orange-dark); font-size: 18px; margin-bottom: 8px; }
.game-info ul { margin-left: 20px; }

/* Game UI primitives */
.q-input {
  background: var(--white); border: 2px solid var(--line);
  border-radius: 12px; padding: 12px 18px;
  font-family: 'Nunito', sans-serif; font-size: 18px;
  outline: none; transition: border-color 0.2s;
  text-align: center; width: 100%; max-width: 280px;
}
.q-input:focus { border-color: var(--orange); }

.q-display {
  font-family: 'Fredoka', sans-serif; font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: 6px; color: var(--orange-dark); font-weight: 600;
  margin-bottom: 24px; text-align: center; min-height: 60px;
  word-break: break-all;
}

.q-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

.q-message { text-align: center; font-weight: 700; min-height: 24px; margin: 8px 0; }
.q-message.success { color: var(--teal); }
.q-message.error { color: #e74c3c; }

.shake { animation: shake 0.4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
.pop { animation: pop 0.3s; }
@keyframes pop { 0%{transform:scale(1)} 50%{transform:scale(1.1)} 100%{transform:scale(1)} }

/* Hangman */
.hangman-letters { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 20px 0; }
.hangman-letters .slot {
  width: 36px; height: 48px; border-bottom: 3px solid var(--orange);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 4px;
}
.hangman-letters .slot span { font-family: 'Fredoka', sans-serif; font-size: 26px; color: var(--ink); }
.hangman-keys { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 480px; margin: 0 auto; }
.hangman-keys .key {
  width: 36px; height: 36px; border-radius: 8px; border: 2px solid var(--line);
  background: var(--white); cursor: pointer; font-weight: 700; transition: all 0.15s;
  font-family: 'Nunito', sans-serif; font-size: 14px; color: var(--ink);
}
.hangman-keys .key:hover { border-color: var(--orange); }
.hangman-keys .key.hit { background: var(--teal); color: var(--white); border-color: var(--teal); cursor: default; }
.hangman-keys .key.miss { background: #f4f4f4; color: var(--muted); border-color: var(--line); cursor: default; opacity: 0.5; }
.hangman-figure { font-size: 28px; min-height: 48px; letter-spacing: 4px; }

/* Memory match */
.memory-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  width: 100%; max-width: 380px; margin: 0 auto;
}
.memory-card {
  aspect-ratio: 1; perspective: 600px; cursor: pointer;
}
.memory-card-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform 0.5s; transform-style: preserve-3d;
}
.memory-card.flipped .memory-card-inner { transform: rotateY(180deg); }
.memory-card-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.memory-card-front { background: var(--orange); color: var(--white); }
.memory-card-back { background: var(--white); border: 3px solid var(--orange); transform: rotateY(180deg); }
.memory-card.matched .memory-card-back { background: var(--teal); border-color: var(--teal); color: var(--white); }

/* Pattern / Color buttons */
.pattern-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pattern-btn {
  width: 70px; height: 70px; border-radius: 16px; border: 2px solid transparent;
  background: var(--orange-bg); font-size: 32px; cursor: pointer; transition: all 0.2s;
}
.pattern-btn:hover { border-color: var(--orange); transform: scale(1.05); }
.pattern-btn.correct { background: rgba(6, 214, 160, 0.2); border-color: var(--teal); }
.pattern-btn.wrong { background: rgba(231, 76, 60, 0.2); border-color: #e74c3c; }

/* Sequence (Simon) */
.simon-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  width: 100%; max-width: 280px; margin: 0 auto;
}
.simon-pad {
  height: 100px; border-radius: 16px; cursor: pointer;
  transition: filter 0.1s, transform 0.1s;
  border: 4px solid transparent;
}
.simon-pad:active, .simon-pad.flash { filter: brightness(1.4); transform: scale(0.98); }
.simon-pad.p0 { background: var(--orange); }
.simon-pad.p1 { background: var(--teal); }
.simon-pad.p2 { background: var(--yellow); }
.simon-pad.p3 { background: var(--purple); }

/* Trivia */
.trivia-question {
  background: var(--orange-bg); border-radius: 14px; padding: 20px;
  font-weight: 700; font-size: 18px; margin-bottom: 18px;
  color: var(--ink); text-align: left; width: 100%;
}
.trivia-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
@media (max-width: 500px) { .trivia-options { grid-template-columns: 1fr; } }
.trivia-opt {
  padding: 14px 16px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--white); cursor: pointer; text-align: left;
  font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 600; color: var(--ink);
  transition: all 0.2s;
}
.trivia-opt:hover { border-color: var(--orange); }
.trivia-opt.correct { background: rgba(6, 214, 160, 0.15); border-color: var(--teal); color: #047a5b; }
.trivia-opt.wrong { background: rgba(231, 76, 60, 0.15); border-color: #e74c3c; color: #c0392b; }

/* Word search */
.word-search-grid { display: grid; gap: 2px; user-select: none; }
.word-search-cell {
  width: 32px; height: 32px; background: var(--white); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; cursor: pointer; transition: background 0.15s;
  border-radius: 4px;
}
.word-search-cell.selecting { background: var(--orange-light); }
.word-search-cell.found { background: var(--teal); color: var(--white); }
.word-search-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.word-search-list .w {
  background: var(--orange-bg); padding: 6px 14px; border-radius: 99px;
  font-weight: 700; font-size: 13px; color: var(--ink);
}
.word-search-list .w.found { background: var(--teal); color: var(--white); text-decoration: line-through; }

/* Sudoku */
.sudoku-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  width: 100%; max-width: 280px; margin: 0 auto;
  background: var(--orange); padding: 4px; border-radius: 12px;
}
.sudoku-cell {
  aspect-ratio: 1; background: var(--white); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif; font-size: 24px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.sudoku-cell.fixed { background: var(--orange-bg); cursor: default; color: var(--orange-dark); }
.sudoku-cell.selected { background: var(--yellow); }
.sudoku-cell.error { background: rgba(231, 76, 60, 0.2); }
.sudoku-pad { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.sudoku-pad button {
  width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--orange);
  background: var(--white); cursor: pointer; font-weight: 700; font-size: 18px;
  font-family: 'Nunito', sans-serif; color: var(--orange-dark);
}
.sudoku-pad button:hover { background: var(--orange); color: var(--white); }

/* Tic Tac Toe */
.ttt-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: 100%; max-width: 280px; margin: 0 auto;
}
.ttt-cell {
  aspect-ratio: 1; background: var(--orange-bg); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif; font-size: 48px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.ttt-cell:hover { background: var(--orange-light); }
.ttt-cell.x { color: var(--orange-dark); }
.ttt-cell.o { color: var(--teal); }

/* Stroop / Color match */
.stroop-word {
  font-family: 'Fredoka', sans-serif; font-size: 56px; font-weight: 700;
  margin-bottom: 24px; text-align: center;
}
.stroop-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 320px; }
.stroop-btn {
  padding: 14px; border-radius: 12px; border: none;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 15px;
  cursor: pointer; color: var(--white); transition: transform 0.1s;
}
.stroop-btn:hover { transform: scale(1.03); }

/* Reaction time */
.reaction-pad {
  width: 100%; min-height: 280px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif; font-size: 28px; color: var(--white);
  cursor: pointer; transition: background 0.2s;
  text-align: center; padding: 24px;
}
.reaction-pad.idle { background: var(--ink-soft); }
.reaction-pad.wait { background: #e74c3c; }
.reaction-pad.go { background: var(--teal); }
.reaction-pad.done { background: var(--orange); }

/* Aim trainer */
.aim-board {
  position: relative; width: 100%; height: 360px;
  background: var(--orange-bg); border-radius: 16px; overflow: hidden; cursor: crosshair;
}
.aim-target {
  position: absolute; width: 50px; height: 50px; border-radius: 50%;
  background: var(--orange); border: 4px solid var(--white);
  cursor: pointer; box-shadow: 0 4px 12px var(--orange-glow);
  transition: transform 0.1s;
}
.aim-target:hover { transform: scale(1.1); }

/* 2048 */
.g2048-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  width: 100%; max-width: 320px; margin: 0 auto;
  background: var(--orange-bg); padding: 8px; border-radius: 12px;
}
.g2048-cell {
  aspect-ratio: 1; background: var(--white); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 20px;
  color: var(--ink); transition: background 0.15s;
}
.g2048-cell[data-v="2"] { background: #FFE5D0; }
.g2048-cell[data-v="4"] { background: #FFCCAA; }
.g2048-cell[data-v="8"] { background: #FFB68A; color: var(--white); }
.g2048-cell[data-v="16"] { background: #FF9966; color: var(--white); }
.g2048-cell[data-v="32"] { background: #FF8047; color: var(--white); }
.g2048-cell[data-v="64"] { background: var(--orange); color: var(--white); }
.g2048-cell[data-v="128"] { background: var(--orange-dark); color: var(--white); font-size: 22px; }
.g2048-cell[data-v="256"] { background: var(--pink); color: var(--white); font-size: 22px; }
.g2048-cell[data-v="512"] { background: var(--purple); color: var(--white); font-size: 20px; }
.g2048-cell[data-v="1024"] { background: var(--teal); color: var(--white); font-size: 18px; }
.g2048-cell[data-v="2048"] { background: var(--yellow); color: var(--ink); font-size: 18px; }

/* Photo memory grid */
.photo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: 100%; max-width: 320px; margin: 0 auto;
}
.photo-cell {
  aspect-ratio: 1; background: var(--orange-bg); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; cursor: pointer; transition: all 0.2s;
  border: 3px solid transparent;
}
.photo-cell.lit { background: var(--orange); border-color: var(--orange-dark); }
.photo-cell.selected { border-color: var(--orange); background: var(--orange-light); }
.photo-cell.correct { background: var(--teal); }
.photo-cell.wrong { background: #e74c3c; }
