/* static/css/games.css */

/* ── Layout ── */
.game-page { min-height: 100vh; background: linear-gradient(180deg, #f0fdf7 0%, #f6fbff 60%, #f4fdf9 100%); font-family: 'Baloo 2', 'Poppins', sans-serif; }

/* ── XP Header Bar ── */
.xp-bar { background: linear-gradient(135deg, #173e3e, #0d2b2b); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
.xp-bar__level { color: #67e0a6; font-weight: 700; font-size: 14px; }
.xp-bar__progress-wrap { width: 140px; }
.xp-bar__track { background: rgba(255,255,255,0.15); border-radius: 20px; height: 8px; overflow: hidden; }
.xp-bar__fill { background: #67e0a6; height: 100%; border-radius: 20px; transition: width 0.4s ease; }
.xp-bar__label { color: rgba(255,255,255,0.5); font-size: 10px; margin-top: 3px; }
.xp-bar__badges { background: rgba(103,224,166,0.2); border-radius: 12px; padding: 6px 12px; text-align: center; cursor: pointer; }

/* ── Game Card ── */
.game-card { background: #fff; border-radius: 24px; border: 1px solid rgba(23,62,62,0.06); box-shadow: 0 2px 6px rgba(23,62,62,0.05), 0 12px 32px rgba(23,62,62,0.09); overflow: hidden; max-width: 480px; margin: 24px auto; }
.game-card__header { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; }
.game-card__round { font-size: 12px; font-weight: 700; }
.game-card__streak { font-size: 13px; font-weight: 700; }
.game-card__body { padding: 24px 20px; text-align: center; }

/* ── Progress segments ── */
.round-progress { display: flex; gap: 4px; }
.round-progress__seg { height: 6px; border-radius: 3px; flex: 1; background: rgba(0,0,0,0.15); }
.round-progress__seg--done { background: rgba(0,0,0,0.5); }

/* ── Word display ── */
.word-display { font-size: clamp(32px, 9vw, 48px); font-weight: 700; color: #2c2f35; letter-spacing: 2px; margin-bottom: 8px; }
.word-display--split { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.word-chunk { background: #e9fef4; border: 2px solid #67e0a6; border-radius: 10px; padding: 6px 14px; font-size: 28px; font-weight: 700; color: #173e3e; }
.word-chunk--error { background: #fee2e2; border-color: #ef4444; color: #991b1b; }

/* ── Definition box ── */
.definition-box { border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; text-align: left; }
.definition-box__label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.definition-box__text { font-size: 13px; color: #32353e; font-style: italic; }

/* ── Tap button ── */
.tap-btn { border-radius: 50%; width: 90px; height: 90px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto 16px; box-shadow: 0 6px 20px rgba(103,224,166,0.5); cursor: pointer; border: none; background: linear-gradient(135deg, #67e0a6, #38df95); transition: transform 0.1s; }
.tap-btn:active { transform: scale(0.93); animation: none; }
.tap-btn { animation: tapPulse 2.2s ease-in-out infinite; }
@keyframes tapPulse { 0%,100% { box-shadow: 0 6px 20px rgba(103,224,166,0.5); } 50% { box-shadow: 0 6px 30px rgba(103,224,166,0.85); } }
.tap-btn__icon { font-size: 28px; line-height: 1; }
.tap-btn__label { font-size: 10px; font-weight: 700; color: #0d3d3d; }

/* ── Dot counter ── */
.dot-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #e5e7eb; background: #fff; transition: background 0.15s, border-color 0.15s; }
.dot--filled { background: #67e0a6; border-color: #38df95; }
.dot--error { background: #ef4444; border-color: #dc2626; }

/* ── Timer bar ── */
.timer-bar { height: 6px; width: 100%; transition: width 1s linear; }

/* ── Letter slots (Spell Blast) ── */
.letter-slots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.letter-slot { width: 34px; height: 40px; border-bottom: 3px solid #e5e7eb; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: #2c2f35; transition: border-color 0.2s; }
.letter-slot--active { border-color: #3b81fd; box-shadow: 0 0 0 2px #3b81fd; border-radius: 4px; }
.letter-slot--correct { border-color: #67e0a6; background: #e9fef4; border-radius: 4px 4px 0 0; }
.letter-slot--filled { border-bottom-color: #67e0a6; }
.letter-slot--wrong { border-color: #ef4444; background: #fee2e2; border-radius: 4px 4px 0 0; animation: slotShake 0.35s ease; }

/* ── Letter tiles (Spell Blast) ── */
.letter-tiles { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-bottom: 16px; }
.letter-tile { border-radius: 10px; width: 38px; height: 42px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; cursor: pointer; transition: transform 0.1s, opacity 0.2s; user-select: none; }
.letter-tile:hover { transform: translateY(-2px); }
.letter-tile:active { transform: scale(0.9); }
.letter-tile--used { opacity: 0.35; pointer-events: none; }
.letter-tile--shake { animation: shake 0.3s ease; background: #fee2e2 !important; border-color: #ef4444 !important; color: #991b1b !important; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.word-display--shake { animation: shake 0.3s ease; }

/* ── Sound Snap cards ── */
.snap-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.snap-card { border: 2px solid #e5e7eb; border-radius: 14px; padding: 16px; cursor: pointer; transition: border-color 0.15s, background 0.15s; text-align: center; }
.snap-card:hover { border-color: #f59e0b; transform: translateY(-2px); transition: all 0.15s ease; }
.snap-card--selected { border-color: #f59e0b; background: #fff5e0; box-shadow: 0 0 0 3px rgba(245,158,11,0.25); transform: scale(1.03); }
.snap-card--correct { border-color: #67e0a6; background: #e9fef4; pointer-events: none; }
.snap-card--wrong { border-color: #ef4444; background: #fee2e2; pointer-events: none; }
.snap-card__word { font-size: 20px; font-weight: 700; color: #2c2f35; }
.snap-card__result { font-size: 20px; margin-top: 4px; }

/* ── Syllable tiles (Word Puzzle) ── */
.syllable-tiles { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.syllable-tile { border-radius: 14px; padding: 12px 18px; font-size: 20px; font-weight: 700; color: #fff; cursor: pointer; transition: opacity 0.2s, transform 0.1s; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.syllable-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.2); }
.syllable-tile:active { transform: scale(0.93); }
.syllable-tile--used { opacity: 0.35; pointer-events: none; }
.syllable-tile--shake { animation: shake 0.3s ease; background: #fee2e2 !important; color: #991b1b !important; }

/* ── Syllable slots (Word Puzzle) ── */
.syllable-slots { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; align-items: center; }
.syllable-slot { min-width: 64px; height: 50px; border: 2px dashed #c4b5fd; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: #ede9fe; background: #faf5ff; transition: all 0.2s; }
.syllable-slot--active { border: 3px dashed #8b5cf6; animation: pulse-border 1s infinite; }
.syllable-slot--filled { border-color: #8b5cf6; background: linear-gradient(135deg, #a78bfa, #8b5cf6); color: #fff; }
.syllable-slot--correct { border-color: #67e0a6; background: linear-gradient(135deg, #67e0a6, #38df95); color: #fff; }
.syllable-slot--wrong { border-color: #ef4444; background: linear-gradient(135deg, #fca5a5, #ef4444); color: #fff; animation: slotShake 0.35s ease; }
@keyframes slotShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.syllable-sep { color: #c4b5fd; font-size: 20px; font-weight: 700; }
@keyframes pulse-border { 0%,100%{border-color:#8b5cf6} 50%{border-color:#c4b5fd} }

/* ── XP popup ── */
.xp-popup { position: fixed; font-size: 18px; font-weight: 700; color: #173e3e; background: #67e0a6; border-radius: 20px; padding: 6px 16px; pointer-events: none; animation: float-up 1.2s ease forwards; z-index: 999; }
@keyframes float-up { 0%{opacity:1;transform:translateY(0)} 100%{opacity:0;transform:translateY(-60px)} }

/* ── Result XP box ── */
.xp-result { background: #e9fef4; border-radius: 12px; padding: 12px; margin: 12px 0; }
.xp-result--blue { background: #eef3ff; }
.xp-result__row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.xp-result__label { font-size: 13px; font-weight: 700; }
.xp-result__track { background: rgba(0,0,0,0.1); border-radius: 20px; height: 6px; overflow: hidden; }
.xp-result__fill { height: 100%; border-radius: 20px; transition: width 0.6s ease; }

/* ── Buttons ── */
.btn-primary { border: none; border-radius: 50px; padding: 12px 32px; font-weight: 700; font-size: 15px; cursor: pointer; font-family: 'Baloo 2', 'Poppins', sans-serif; box-shadow: 0 4px 12px rgba(23,62,62,0.15); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(23,62,62,0.2); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 2px 6px rgba(23,62,62,0.15); }
.btn-primary:focus-visible, .btn-secondary:focus-visible, .btn-hint:focus-visible, .btn-hear:focus-visible, .letter-tile:focus-visible, .syllable-tile:focus-visible, .snap-card:focus-visible { outline: 3px solid #37a8ff; outline-offset: 2px; }
.btn-secondary { background: #fff; border: 2px solid #e5e7eb; border-radius: 20px; padding: 7px 14px; font-size: 12px; color: #73767e; cursor: pointer; font-family: 'Baloo 2', 'Poppins', sans-serif; }
.btn-hint { background: #fff; border: 2px solid #f59e0b; border-radius: 20px; padding: 7px 14px; font-size: 12px; color: #d97706; font-weight: 600; cursor: pointer; font-family: 'Baloo 2', 'Poppins', sans-serif; }
.btn-hear { background: transparent; border: 2px solid currentColor; border-radius: 50px; padding: 5px 14px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: 'Baloo 2', 'Poppins', sans-serif; }

/* ── Lightning Round (dark) ── */
.lightning-page { background: #1a1a2e; min-height: 100vh; font-family: 'Baloo 2', 'Poppins', sans-serif; }
.lightning-header { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.08); }
.lightning-score { text-align: center; }
.lightning-score__count { font-size: 28px; font-weight: 800; color: #fff; }
.lightning-score__label { font-size: 10px; color: rgba(255,255,255,0.5); }
.lightning-multiplier { border-radius: 12px; padding: 8px 14px; text-align: center; }
.lightning-multiplier__value { font-size: 18px; font-weight: 800; color: #fff; }
.lightning-multiplier__label { font-size: 10px; font-weight: 600; }
.lightning-body { padding: 20px 18px; text-align: center; }
.lightning-type-badge { border-radius: 20px; display: inline-block; padding: 4px 14px; margin-bottom: 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.lightning-word { font-size: 40px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.lightning-sub { font-size: 12px; color: rgba(255,255,255,0.4); margin-bottom: 20px; }
.lightning-num-btns { display: flex; gap: 10px; justify-content: center; }
.lightning-num-btn { background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.15); border-radius: 14px; width: 58px; height: 58px; font-size: 22px; font-weight: 700; color: #fff; cursor: pointer; font-family: 'Baloo 2', 'Poppins', sans-serif; transition: background 0.1s; }
.lightning-num-btn:hover { background: rgba(255,255,255,0.15); }
.lightning-flash-correct { animation: flash-green 0.3s ease; }
.lightning-flash-wrong { animation: flash-red 0.3s ease; }
@keyframes flash-green { 0%,100%{background:#1a1a2e} 50%{background:rgba(103,224,166,0.2)} }
@keyframes flash-red { 0%,100%{background:#1a1a2e} 50%{background:rgba(239,68,68,0.2)} }
.lightning-type-strip { display: flex; gap: 6px; justify-content: center; padding: 10px 0; }
.lightning-type-strip__seg { width: 30px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.15); }
.lightning-type-strip__seg--active { background: #67e0a6; }

/* ── Hub page ── */
.hub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px; max-width: 720px; margin: 0 auto; }
@media (max-width: 520px) { .hub-grid { grid-template-columns: 1fr; } .lock-prereqs { grid-template-columns: 1fr 1fr; } }
.hub-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.08); cursor: pointer; text-decoration: none; display: block; }
.hub-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); transition: all 0.2s; }
.hub-card--locked { opacity: 0.7; cursor: default; }
.hub-card--full { grid-column: 1 / -1; }
.hub-card__header { padding: 16px 16px 12px; }
.hub-card__tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.hub-card__name { font-size: 18px; font-weight: 700; margin-top: 2px; }
.hub-card__body { padding: 12px 16px; }
.hub-card__desc { font-size: 12px; color: #73767e; margin-bottom: 8px; }
.hub-card__footer { display: flex; justify-content: space-between; align-items: center; }
.hub-dots { display: flex; gap: 4px; }
.hub-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5e7eb; }
.hub-dot--filled { background: currentColor; }
.hub-play-btn { border: none; border-radius: 20px; padding: 4px 14px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: 'Baloo 2', 'Poppins', sans-serif; }
.lock-prereqs { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; padding: 10px 16px 14px; background: #f9fafb; }
.lock-prereq { border-radius: 8px; padding: 8px; text-align: center; }
.lock-prereq__name { font-size: 10px; font-weight: 700; }
.lock-prereq__status { font-size: 11px; margin-top: 2px; }

/* ── Shared juice: badge toast, confetti, error card ── */
.badge-toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: #173e3e; color: #fff; border-radius: 16px;
  padding: 12px 20px; z-index: 9999; font-size: 14px; line-height: 1.35;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  animation: badgeToastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Baloo 2', 'Poppins', sans-serif;
}
.badge-toast__emoji { font-size: 30px; }
.badge-toast--out { transition: opacity 0.4s ease, transform 0.4s ease; opacity: 0; transform: translateX(-50%) translateY(-12px); }
@keyframes badgeToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.9); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.confetti-bit {
  position: fixed; top: -12px; width: 10px; height: 14px; border-radius: 3px;
  z-index: 9998; pointer-events: none; opacity: 0.95;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(540deg); opacity: 0.7; }
}

.game-error-card { text-align: center; padding: 48px 20px; color: #4b5563; }
.game-error-card__emoji { font-size: 44px; margin-bottom: 10px; }
.game-error-card__retry {
  margin-top: 14px; background: linear-gradient(135deg, #67e0a6, #38df95); color: #0d3d3d;
}

@media (prefers-reduced-motion: reduce) {
  .badge-toast { animation: none; }
  .confetti-bit { display: none; }
}


/* ── Difficulty picker ── */
.difficulty-card {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: #fff; border: 2px solid rgba(23,62,62,0.08); border-radius: 18px;
  padding: 14px 18px; text-decoration: none; color: #173e3e;
  box-shadow: 0 3px 10px rgba(23,62,62,0.07);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.difficulty-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(23,62,62,0.13); }
.difficulty-card:active { transform: translateY(0); }
.difficulty-card--easy:hover   { border-color: #38df95; }
.difficulty-card--medium:hover { border-color: #37a8ff; }
.difficulty-card--hard:hover   { border-color: #f97316; }
.difficulty-card__emoji {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.difficulty-card--easy .difficulty-card__emoji   { background: #e9fef4; }
.difficulty-card--medium .difficulty-card__emoji { background: #eaf5ff; }
.difficulty-card--hard .difficulty-card__emoji   { background: #fff1e6; }
.difficulty-card__title { font-size: 17px; font-weight: 700; line-height: 1.2; }
.difficulty-card__desc { font-size: 12.5px; color: #73767e; margin-top: 2px; }

/* ── Touch ergonomics: bigger targets when the pointer is a finger ── */
@media (pointer: coarse) {
  .letter-tile { width: 44px; height: 48px; font-size: 20px; }
  .letter-slot { width: 38px; height: 44px; }
  .syllable-tile { padding: 14px 20px; }
  .lightning-num-btn { width: 64px; height: 64px; }
  .btn-hint, .btn-secondary, .btn-hear { padding: 10px 16px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .tap-btn { animation: none; }
  .btn-primary, .difficulty-card, .letter-tile, .syllable-tile, .snap-card { transition: none; }
}
