/* BlitzCount - Cheerful, Modern Kid-Friendly Theme */

:root {
  --safe-top: 58px;
  --safe-bottom: 16px;
  --safe-left: 0px;
  --safe-right: 0px;
  --bg-gradient: linear-gradient(135deg, #FFFDF8 0%, #FFF3E0 100%);
  --primary-color: #FF6B6B;
  --secondary-color: #4D96FF;
  --accent-yellow: #FFD93D;
  --accent-green: #6BCB77;
  --accent-purple: #9D4EDD;
  --text-dark: #2C3E50;
  --card-bg: #FFFFFF;
  --card-shadow: 0 12px 28px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
  --btn-shadow: 0 5px 0 rgba(0, 0, 0, 0.12);
  --btn-active-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 30px;
  --radius-full: 9999px;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding-top: 58px;
  padding-top: var(--safe-top, 58px);
  padding-bottom: 16px;
  padding-bottom: var(--safe-bottom, 16px);
  padding-left: 14px;
  padding-left: max(14px, var(--safe-left, 0px));
  padding-right: 14px;
  padding-right: max(14px, var(--safe-right, 0px));
  box-sizing: border-box;
}

#main-mount {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ==================== HEADER ==================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  margin-bottom: 8px;
}

.profile-badge-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 224, 178, 0.95);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-badge-btn:hover {
  background: #FFF8E1;
  transform: scale(1.04);
}

.avatar-icon {
  font-size: 1.4rem;
}

.profile-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #5D4037;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.header-logo:hover {
  transform: scale(1.05);
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-action-btn {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: transform 0.15s, background-color 0.15s;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.icon-action-btn:hover {
  background: #F8FAFC;
  transform: scale(1.08);
}

.icon-action-btn.is-muted {
  opacity: 0.7;
  border-color: #CBD5E1;
}

/* Settings Hold Lock Ring */
.settings-lock-wrapper {
  position: relative;
}

.lock-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  pointer-events: none;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: transparent;
  stroke-width: 3.5;
}

.ring-fill {
  fill: none;
  stroke: #4D96FF;
  stroke-width: 3.5;
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  stroke-linecap: round;
}

.child-lock-toast {
  position: absolute;
  top: 48px;
  right: 0;
  background: #2D3748;
  color: #FFF;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.child-lock-toast.visible {
  opacity: 1;
}

/* ==================== HOME SCREEN ==================== */
.home-screen-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: clamp(6px, 1.4vh, 14px);
  min-height: 0;
  padding-bottom: 2px;
}

.hero-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 2px 2px 4px 2px;
  border-bottom: none;
}

.mascot-hero-card {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 10px 16px 12px 16px;
  box-shadow: var(--card-shadow);
  border: 3px solid #FFF3E0;
  gap: 0;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.mascot-large-wrap {
  flex-shrink: 0;
}

.game-headline {
  font-size: 1.85rem;
  font-weight: 900;
  color: #37474F;
  line-height: 1.1;
}

.game-tagline {
  font-size: 0.95rem;
  font-weight: 600;
  color: #78909C;
  margin-top: 4px;
}

/* Category Tabs */
.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.cat-tab-btn {
  background: #FFFFFF;
  border: 3px solid #ECEFF1;
  border-radius: var(--radius-md);
  padding: 8px 4px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.cat-tab-btn:hover {
  transform: translateY(-2px);
}

.cat-tab-btn.is-active {
  border-color: #FF6B6B;
  background: #FFF5F5;
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.2);
}

.tab-emoji {
  font-size: 1.75rem;
}

.tab-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: #455A64;
}

.tab-subbadge {
  background: #FFE082;
  color: #6D4C41;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* Speed Cards Grid */
.speed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.speed-card-btn {
  background: #FFFFFF;
  border: 3px solid #ECEFF1;
  border-radius: var(--radius-md);
  padding: 8px 4px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.speed-card-btn:hover {
  transform: translateY(-2px);
}

.speed-card-btn.is-active {
  border-color: #4D96FF;
  background: #F0F6FF;
  box-shadow: 0 6px 16px rgba(77, 150, 255, 0.2);
}

.animal-avatar {
  font-size: 1.85rem;
}

.speed-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #37474F;
  text-align: center;
}

/* Highscore Ribbon & Bottom Play Dock */
.home-play-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.highscore-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 217, 61, 0.25);
  border: 2px solid #FFD54F;
  border-radius: var(--radius-full);
  padding: 5px 16px;
  align-self: center;
}

.star-icon {
  font-size: 1.1rem;
}

.best-score-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #5D4037;
}

/* Huge Play Button */
.play-action-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 2px 0 6px 0;
}

.huge-play-btn {
  background: linear-gradient(135deg, #6BCB77, #4EBA5B);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-full);
  padding: 15px 44px;
  font-size: 1.55rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 7px 0 #388E3C, 0 12px 24px rgba(78, 186, 91, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.huge-play-btn:hover {
  transform: translateY(-2px);
}

.huge-play-btn:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #388E3C;
}

/* ==================== GAME SCREEN ==================== */
.game-screen-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.game-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.game-exit-btn {
  background: #FFF;
  border: 2px solid #CFD8DC;
  border-radius: var(--radius-full);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}

.progress-bubble-track {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  flex: 1;
}

.progress-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.25s ease;
}

.bubble-pending {
  background: #ECEFF1;
  border: 2px dashed #CFD8DC;
}

.bubble-current {
  background: #FFF9C4;
  border: 3px solid #FBC02D;
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(251, 192, 45, 0.6);
}

.bubble-correct {
  background: #E8F5E9;
  border: 2px solid #81C784;
  animation: starPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bubble-wrong {
  background: #FFEBEE;
  border: 2px solid #EF9A9A;
}

.round-counter-pill {
  font-weight: 800;
  font-size: 0.85rem;
  color: #78909C;
  background: #ECEFF1;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Timer bar */
.timer-bar-track {
  width: 100%;
  height: 7px;
  background: #ECEFF1;
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #4D96FF, #00E676);
  border-radius: 4px;
}

/* Flash Stage: Fixed, constant height across all states (ready, flashing, choose, right, wrong) */
.flash-stage-wrapper {
  position: relative;
  height: 224px;
  min-height: 224px;
  max-height: 224px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  border: 4px solid #FFF8E1;
  overflow: hidden;
  margin-bottom: 4px;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.flash-card-stage {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  box-sizing: border-box;
  transition: background 0.2s ease;
}


.blank-curtain {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.shutter-curtain {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
}

.shutter-slats {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 160px;
  opacity: 0.35;
}

.shutter-slats .slat {
  display: block;
  height: 4px;
  background: #90A4AE;
  border-radius: var(--radius-full);
}

.input-prompt-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.input-prompt-arrow {
  font-size: 2.5rem;
  line-height: 1;
  animation: promptArrowBounce 0.65s infinite alternate ease-in-out;
}

@keyframes promptArrowBounce {
  0% { transform: translateY(-3px); }
  100% { transform: translateY(5px); }
}

.input-prompt-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: #455A64;
  background: #ECEFF1;
  padding: 5px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.ready-countdown-pulse {
  font-size: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  animation: popReady 0.35s ease-out;
}

/* Feedback halos */
.feedback-correct {
  background: #E8F5E9 !important;
}

.flash-stage-wrapper.stage-correct,
.flash-stage-wrapper:has(.feedback-correct) {
  border-color: #81C784 !important;
}

.feedback-wrong {
  background: #FFF5F5 !important;
}

.flash-stage-wrapper.stage-wrong,
.flash-stage-wrapper:has(.feedback-wrong) {
  border-color: #EF5350 !important;
  animation: cardShake 0.4s ease;
}

@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.feedback-wrong-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

.feedback-wrong-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #FFFFFF;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(239, 83, 80, 0.15);
  border: 2px solid #FFCDD2;
  flex-shrink: 0;
}

.wrong-choice-badge {
  color: #C62828;
  font-weight: 900;
  font-size: 1.05rem;
}

.wrong-arrow {
  color: #90A4AE;
  font-weight: 900;
  font-size: 1rem;
}

.correct-choice-badge {
  color: #2E7D32;
  font-weight: 900;
  font-size: 1.05rem;
}

.feedback-reveal-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: calc(100% - 40px);
  box-sizing: border-box;
}

.feedback-reveal-wrap .stimulus-fruits.single-die-pattern .fruit-dice-grid {
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
}

.feedback-reveal-wrap .stimulus-fruits.single-die-pattern .fruit-pip {
  width: 44px;
  height: 44px;
}

.feedback-reveal-wrap .stimulus-fruits.single-die-pattern .fruit-emoji {
  font-size: 2.5rem;
}

.feedback-badge-correct {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
}

.feedback-badge-correct .feedback-star {
  font-size: 3.8rem;
  line-height: 1;
  animation: starCelebration 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  filter: drop-shadow(0 4px 12px rgba(255, 193, 7, 0.5));
}

.feedback-badge-correct .feedback-number {
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 900;
  color: #2E7D32;
  animation: numPop 0.45s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  text-shadow: 0 2px 4px rgba(46, 125, 50, 0.2);
}

.flash-card-stage.feedback-correct,
.flash-card-stage.feedback-wrong {
  cursor: pointer;
}

/* Top bar mascot reaction pill */
.game-mascot-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

/* ==================== STIMULI RENDERING ==================== */
/* Fruits in 3x3 Dice Pattern (Floating, perfectly proportioned, no box) */
.stimulus-fruits {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
}

/* Single die pattern (1-6 fruits): Large, cozy, and prominent */
.stimulus-fruits.single-die-pattern .fruit-dice-grid {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.stimulus-fruits.single-die-pattern .fruit-pip {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stimulus-fruits.single-die-pattern .fruit-emoji {
  font-size: 3.1rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
  line-height: 1;
}

/* Double die pattern (7-10 fruits): Compact pair side-by-side */
.stimulus-fruits.double-die-pattern .fruit-dice-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.stimulus-fruits.double-die-pattern .fruit-pip {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stimulus-fruits.double-die-pattern .fruit-emoji {
  font-size: 2.5rem;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.1));
  line-height: 1;
}

.fruit-pip .count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #2E7D32;
  color: #FFF;
  font-size: 0.8rem;
  font-weight: 900;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 2px solid #FFF;
  z-index: 2;
}

/* 3x3 Grid mappings for fruit pips */
.fruit-pip.r1.c1 { grid-area: 1 / 1; }
.fruit-pip.r1.c2 { grid-area: 1 / 2; }
.fruit-pip.r1.c3 { grid-area: 1 / 3; }
.fruit-pip.r2.c1 { grid-area: 2 / 1; }
.fruit-pip.r2.c2 { grid-area: 2 / 2; }
.fruit-pip.r2.c3 { grid-area: 2 / 3; }
.fruit-pip.r3.c1 { grid-area: 3 / 1; }
.fruit-pip.r3.c2 { grid-area: 3 / 2; }
.fruit-pip.r3.c3 { grid-area: 3 / 3; }

.fruits-plus, .dice-plus, .hand-plus {
  font-size: 2.2rem;
  font-weight: 900;
  color: #78909C;
}

.stimulus-fruits.show-badges,
.stimulus-dice.show-badges,
.stimulus-hands.show-badges {
  padding-bottom: 24px;
}

.fruits-sum-formula, .dice-sum-formula, .finger-sum-formula {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.05rem;
  font-weight: 900;
  color: #1565C0;
  background: #E3F2FD;
  padding: 2px 14px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* High-Contrast Dice Cards */
.stimulus-dice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
}

.dice-card {
  width: 120px;
  height: 120px;
  background: #FFFFFF;
  border: 4px solid #37474F;
  border-radius: 22px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
}

.dice-pip {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  align-self: center;
  justify-self: center;
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice-pip .pip-num {
  display: none;
  font-size: 0.75rem;
  color: #FFF;
  font-weight: 800;
}

.show-badges .dice-pip .pip-num {
  display: flex;
}

.dice-pip.r1.c1 { grid-area: 1 / 1; }
.dice-pip.r1.c2 { grid-area: 1 / 2; }
.dice-pip.r1.c3 { grid-area: 1 / 3; }
.dice-pip.r2.c1 { grid-area: 2 / 1; }
.dice-pip.r2.c2 { grid-area: 2 / 2; }
.dice-pip.r2.c3 { grid-area: 2 / 3; }
.dice-pip.r3.c1 { grid-area: 3 / 1; }
.dice-pip.r3.c2 { grid-area: 3 / 2; }
.dice-pip.r3.c3 { grid-area: 3 / 3; }

/* Fingers (Accurate Cartoon Hands) */
.stimulus-fingers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
}

.cartoon-hand-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.hand-svg {
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
  width: 100px;
  height: 115px;
}

.finger-number-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: #2E7D32;
  color: #FFF;
  font-size: 1.1rem;
  font-weight: 900;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ==================== NUMPAD KEYPAD ==================== */
.game-keypad-section {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.keypad-container {
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s ease;
}

.keypad-container.is-disabled {
  opacity: 0.9;
  pointer-events: none;
}

/* Prompt Pulse when Flash Ends */
.keypad-container.keypad-prompt-pulse {
  animation: keypadPulse 1.1s infinite alternate ease-in-out;
}

@keyframes keypadPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(77, 150, 255, 0)); }
  100% { transform: scale(1.02); filter: drop-shadow(0 0 10px rgba(77, 150, 255, 0.45)); }
}

/* Keypad button feedback: correct / wrong / hint */
.keypad-num-btn.key-correct {
  background: #E8F5E9 !important;
  border-color: #43A047 !important;
  color: #1B5E20 !important;
  transform: scale(1.04);
}

.keypad-num-btn.key-wrong {
  background: #FFEBEE !important;
  border-color: #E53E3E !important;
  color: #C53030 !important;
  box-shadow: 0 0 10px rgba(229, 62, 62, 0.4) !important;
  animation: keyShake 0.4s ease;
}

@keyframes keyShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.keypad-num-btn.key-hint-correct {
  background: #E8F5E9 !important;
  border-color: #43A047 !important;
  box-shadow: 0 0 14px rgba(76, 175, 80, 0.6) !important;
  animation: hintPulse 0.7s infinite alternate ease-in-out;
}

@keyframes hintPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

.keypad-numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.keypad-num-btn {
  background: #FFFFFF;
  border: 3px solid #E2E8F0;
  border-radius: var(--radius-md);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--btn-shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.keypad-num-btn:active, .keypad-num-btn.key-pressed {
  transform: translateY(4px);
  box-shadow: var(--btn-active-shadow);
}

.keypad-num-btn.span-3 {
  grid-column: 1 / span 3;
}

.num-text {
  font-size: 1.8rem;
  font-weight: 900;
  color: #2D3748;
}

.zero-fists-icon {
  font-size: 1.3rem;
  margin-right: 10px;
}

/* Easy Keypad (3 chunky rows) */
.keypad-easy .keypad-num-btn {
  height: 62px;
}

.keypad-easy .num-text {
  font-size: 2.1rem;
}

/* Row-by-row Numpad Colors */
.num-10 {
  border-color: #F06292;
  background: #FCE4EC;
  color: #C2185B;
}

.num-11 {
  border-color: #BA68C8;
  background: #F3E5F5;
  color: #7B1FA2;
}

.num-12 {
  border-color: #9575CD;
  background: #EDE7F6;
  color: #512DA8;
}

.num-7, .num-8, .num-9 {
  border-color: #64B5F6;
  background: #E3F2FD;
}

.num-4, .num-5, .num-6 {
  border-color: #81C784;
  background: #F1F8E9;
}

.num-1, .num-2, .num-3 {
  border-color: #FFB74D;
  background: #FFF8E1;
}

.num-0 {
  border-color: #B0BEC5;
  background: #ECEFF1;
}

/* ==================== RESULT SCREEN ==================== */
.result-screen-view {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex: 1;
  padding: 14px 10px;
}

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

.result-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--card-shadow);
  border: 4px solid #FFF3E0;
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.medal-badge-giant {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  animation: popMedal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.medal-gold { background: linear-gradient(135deg, #FFE082, #FFD54F); border: 4px solid #FFA000; }
.medal-silver { background: linear-gradient(135deg, #ECEFF1, #CFD8DC); border: 4px solid #90A4AE; }
.medal-bronze { background: linear-gradient(135deg, #FFCCBC, #D7CCC8); border: 4px solid #8D6E63; }
.medal-star { background: linear-gradient(135deg, #FFF9C4, #FFF59D); border: 4px solid #FBC02D; }

.result-headline {
  font-size: 1.6rem;
  font-weight: 900;
  color: #37474F;
}

.score-stars-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 2rem;
  font-weight: 900;
  color: #2E7D32;
}

.new-highscore-badge {
  background: #FFF9C4;
  border: 2px solid #FBC02D;
  color: #795548;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
}

.result-actions-row {
  display: flex;
  gap: 14px;
  width: 100%;
  max-width: 400px;
  justify-content: center;
}

.result-btn {
  flex: 1;
  height: 58px;
  border-radius: var(--radius-full);
  border: none;
  font-size: 1.25rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-replay {
  background: #6BCB77;
  color: #FFF;
  box-shadow: 0 5px 0 #388E3C, 0 10px 20px rgba(107, 203, 119, 0.4);
}

.btn-home {
  background: #4D96FF;
  color: #FFF;
  box-shadow: 0 5px 0 #1976D2, 0 10px 20px rgba(77, 150, 255, 0.4);
}

.result-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 248, 238, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  box-sizing: border-box;
}

.modal-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 44px rgba(90, 60, 30, 0.16), 0 4px 14px rgba(90, 60, 30, 0.08);
  border: 3px solid #FFE0B2;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 2px solid #F0F4F8;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #2D3748;
}

.modal-title-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: #EDF2F7;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #718096;
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Profile Modal Styles */
.profiles-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.profile-select-tile {
  background: #F8FAFC;
  border: 3px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.profile-select-tile:hover {
  transform: translateY(-2px);
}

.profile-select-tile.is-active-profile {
  border-color: #4D96FF;
  background: #F0F7FF;
}

.profile-tile-card {
  position: relative;
  background: #F8FAFC;
  border: 3px solid #E2E8F0;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-tile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.profile-tile-card.is-active-profile {
  border-color: #4D96FF;
  background: #F0F7FF;
}

.profile-select-btn {
  background: transparent;
  border: none;
  padding: 12px 8px 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  width: 100%;
}

.profile-edit-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #CBD5E0;
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.profile-edit-btn:hover {
  transform: scale(1.15);
  background: #FFF;
  border-color: #4D96FF;
}

/* Edit Player View */
.edit-player-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.avatar-preview-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0;
}

.avatar-preview-display {
  font-size: 3.5rem;
  background: #FFF3E0;
  border: 3px solid #FFE0B2;
  border-radius: var(--radius-full);
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.edit-section-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edit-player-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.save-changes-btn {
  width: 100%;
  padding: 12px;
  background: #6BCB77;
  color: #FFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #4CAF50;
  transition: transform 0.1s ease;
}

.save-changes-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #4CAF50;
}

.delete-player-btn {
  width: 100%;
  padding: 10px;
  background: #FFF5F5;
  color: #E53E3E;
  border: 2px solid #FEB2B2;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease;
}

.delete-player-btn:hover {
  background: #FED7D7;
}

.cancel-edit-btn {
  width: 100%;
  padding: 8px;
  background: transparent;
  color: #718096;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

/* Confirmation Dialog Overlay & Card */
.confirm-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 248, 238, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.confirm-dialog-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 16px 44px rgba(90, 60, 30, 0.16), 0 4px 14px rgba(90, 60, 30, 0.08);
  border: 3px solid #FFE0B2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirm-icon {
  font-size: 2.8rem;
}

.confirm-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #2D3748;
  margin: 0;
}

.confirm-desc {
  font-size: 0.95rem;
  font-weight: 600;
  color: #718096;
  line-height: 1.4;
  margin: 0;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.confirm-btn-cancel {
  flex: 1;
  padding: 10px 14px;
  background: #FFFFFF;
  color: #4A5568;
  border: 2px solid #CBD5E0;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease;
}

.confirm-btn-cancel:hover {
  background: #F7FAFC;
}

.confirm-btn-action {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  color: #FFF;
}

.btn-danger {
  background: #E53E3E;
  box-shadow: 0 4px 0 #C53030;
}

.btn-success {
  background: #48BB78;
  box-shadow: 0 4px 0 #38A169;
}

.btn-exit {
  background: #FF6B6B;
  box-shadow: 0 4px 0 #E55050;
}

.confirm-mascot {
  margin-bottom: -6px;
}

.tile-avatar {
  font-size: 2.2rem;
}

.tile-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: #2D3748;
}

.tile-medals-summary {
  display: flex;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.add-new-player-btn {
  width: 100%;
  padding: 10px;
  background: #EDF2F7;
  border: 2px dashed #CBD5E0;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.95rem;
  color: #4A5568;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.new-player-form.is-hidden {
  display: none;
}

.avatar-picker-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
}

.avatar-option-btn {
  background: #F7FAFC;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-sm);
  font-size: 1.6rem;
  padding: 4px 8px;
  cursor: pointer;
}

.avatar-option-btn.is-selected {
  border-color: #FF6B6B;
  background: #FFF5F5;
}

.form-input-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.player-name-input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #CBD5E0;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
}

.save-player-btn {
  background: #6BCB77;
  color: #FFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

/* Trophy Room Showcase */
.trophy-hero-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #FFFDF8;
  border-radius: var(--radius-md);
  padding: 14px;
  border: 2px solid #FFE0B2;
}

.player-headline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-avatar-large {
  font-size: 2rem;
}

.player-name-large {
  font-size: 1.3rem;
  font-weight: 900;
  color: #37474F;
}

.medals-trio-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.medal-tally-box {
  background: #FFFFFF;
  border-radius: var(--radius-sm);
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.gold-box { border: 2px solid #FFD54F; }
.silver-box { border: 2px solid #CFD8DC; }
.bronze-box { border: 2px solid #D7CCC8; }

.medal-tally-box .medal-emoji { font-size: 1.8rem; }
.medal-tally-box .medal-count { font-size: 1.5rem; font-weight: 900; color: #2D3748; }
.medal-tally-box .medal-label { font-size: 0.75rem; font-weight: 700; color: #78909C; }

.section-subtitle {
  font-size: 1rem;
  font-weight: 800;
  color: #4A5568;
  margin-bottom: 6px;
}

.players-leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #F8FAFC;
  border-radius: var(--radius-sm);
}

.leaderboard-player-row.is-current-active {
  border: 2px solid #4D96FF;
  background: #F0F7FF;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.lb-avatar { font-size: 1.3rem; }
.lb-medals { display: flex; gap: 8px; font-weight: 800; font-size: 0.9rem; }

/* Settings Modal */
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-label {
  font-weight: 800;
  font-size: 0.9rem;
  color: #4A5568;
}

.setting-button-row {
  display: flex;
  gap: 8px;
}

.toggle-pill-btn {
  flex: 1;
  padding: 8px;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-pill-btn.is-active {
  background: #4D96FF;
  color: #FFF;
  border-color: #2B6CB0;
}

.duration-slider-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-icon {
  font-size: 1.3rem;
  width: 28px;
}

.duration-slider {
  flex: 1;
  accent-color: #4D96FF;
}

.slider-val {
  font-weight: 800;
  width: 44px;
  text-align: right;
  font-size: 0.85rem;
  color: #4A5568;
}

.reset-scores-btn {
  background: #FFF5F5;
  border: 2px solid #FEB2B2;
  color: #C53030;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  cursor: pointer;
  width: 100%;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 2px solid #F0F4F8;
  display: flex;
  justify-content: flex-end;
}

.modal-done-btn {
  background: #4D96FF;
  color: #FFF;
  border: none;
  border-radius: var(--radius-full);
  padding: 8px 20px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
}

/* Game Modes Selector (Home Screen) */
.mode-tabs {
  display: flex;
  background: #EDF2F7;
  padding: 4px;
  border-radius: var(--radius-full);
  gap: 4px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.mode-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.9rem;
  color: #718096;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mode-tab-btn:hover {
  color: #2D3748;
}

.mode-tab-btn.is-active {
  background: #FFFFFF;
  color: #2B6CB0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  transform: scale(1.02);
}

.mode-caption {
  font-size: 0.85rem;
  font-weight: 700;
  color: #718096;
  text-align: center;
  min-height: 1.3rem;
  margin-top: 2px;
}

/* Number Range Selector (Home Screen) */
.range-tabs {
  display: flex;
  background: #EDF2F7;
  padding: 4px;
  border-radius: var(--radius-full);
  gap: 4px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.range-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.9rem;
  color: #718096;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.range-tab-btn:hover {
  color: #2D3748;
}

.range-tab-btn.is-active {
  background: #FFFFFF;
  color: #2E7D32;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  transform: scale(1.02);
}

/* Blitz HUD */
.blitz-hud-track {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blitz-clock-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #EBF8FF;
  border: 2px solid #90CDF4;
  color: #2B6CB0;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 900;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.blitz-clock-pill.is-urgent {
  background: #FFF5F5;
  border-color: #FEB2B2;
  color: #E53E3E;
  animation: urgentPulse 0.6s infinite alternate;
}

.blitz-clock-pill.is-paused {
  opacity: 0.85;
  border-style: dashed;
}

@keyframes urgentPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.blitz-score-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FEFCBF;
  border: 2px solid #F6E05E;
  color: #B7791F;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 900;
  font-size: 1.1rem;
}

/* Streak HUD */
.streak-hud-track {
  display: flex;
  align-items: center;
  justify-content: center;
}

.streak-flame-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFF5EB;
  border: 2px solid #FBD38D;
  color: #DD6B20;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-weight: 900;
  font-size: 1.05rem;
}

.streak-count-text {
  font-size: 1.25rem;
  color: #C05621;
}

/* Result Screen Score Captions */
.score-blitz-summary,
.score-streak-summary {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
}

.score-mode-caption {
  font-size: 1.1rem;
  font-weight: 800;
  color: #718096;
}

/* Settings Modal Header Actions & About View */
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-info-btn {
  background: #EDF2F7;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4A5568;
  transition: background 0.15s ease, transform 0.15s ease;
}

.modal-info-btn:hover {
  background: #E2E8F0;
  transform: scale(1.05);
}

.about-card-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #F0F7FF;
  border: 2px dashed #90CDF4;
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  width: 100%;
  font-weight: 800;
  font-size: 0.9rem;
  color: #2B6CB0;
  transition: all 0.15s ease;
}

.about-card-link-btn:hover {
  background: #EBF8FF;
  border-color: #4D96FF;
}

/* About Modal Content */
.about-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0 16px;
  border-bottom: 2px solid #EDF2F7;
}

.about-mascot {
  margin-bottom: 4px;
}

.about-app-name {
  font-size: 1.5rem;
  font-weight: 900;
  color: #2D3748;
}

.about-version-tag {
  background: #EDF2F7;
  color: #4A5568;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
}

.about-details-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 4px;
}

.about-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: #4A5568;
}

.about-row .about-icon {
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
}

.about-source-link {
  color: #3182CE;
  font-weight: 800;
  text-decoration: none;
  padding: 4px 10px;
  background: #EBF8FF;
  border-radius: var(--radius-sm);
  border: 1px solid #BEE3F8;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s ease;
}

.about-source-link:hover {
  background: #BEE3F8;
  text-decoration: underline;
}

.about-privacy-row {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed #E2E8F0;
}

.about-privacy-note {
  font-size: 0.85rem;
  font-weight: 700;
  color: #718096;
}

/* ==================== ANIMATIONS ==================== */
@keyframes starPop {
  0% { transform: scale(0.4) rotate(-30deg); }
  70% { transform: scale(1.3) rotate(15deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes popMedal {
  0% { transform: scale(0.2) rotate(-20deg); }
  60% { transform: scale(1.15) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes pulseQ {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

@keyframes popReady {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1.2); opacity: 1; }
}

@keyframes bounceCorrect {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes starCelebration {
  0% { transform: scale(0.2) rotate(-15deg); opacity: 0; }
  50% { transform: scale(1.25) rotate(6deg); opacity: 1; }
  75% { transform: scale(0.95) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes numPop {
  0% { transform: scale(0.4) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Counti Mascot Animations */
.counti-idle {
  animation: countiFloat 3s ease-in-out infinite;
}

@keyframes countiFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.counti-bounce {
  animation: countiJump 0.6s ease-in-out infinite alternate;
}

@keyframes countiJump {
  0% { transform: translateY(0) scale(1, 0.95); }
  100% { transform: translateY(-10px) scale(0.95, 1.05); }
}

.counti-triumph {
  animation: countiVictory 0.8s ease-in-out infinite alternate;
}

@keyframes countiVictory {
  0% { transform: rotate(-4deg) translateY(0); }
  100% { transform: rotate(4deg) translateY(-6px); }
}

.sparkle-float {
  animation: sparkleFloat 1.2s ease-in-out infinite alternate;
}

.sparkle-float-delay {
  animation: sparkleFloat 1.2s ease-in-out 0.6s infinite alternate;
}

@keyframes sparkleFloat {
  0% { transform: translateY(0) scale(0.8); opacity: 0.6; }
  100% { transform: translateY(-5px) scale(1.2); opacity: 1; }
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */
@media (max-width: 600px) {
  #app {
    padding-top: var(--safe-top, 58px);
    padding-bottom: var(--safe-bottom, 16px);
    padding-left: 10px;
    padding-right: 10px;
  }

  .game-headline {
    font-size: 1.5rem;
  }

  .cat-tab-btn {
    padding: 6px 3px;
  }

  .tab-emoji {
    font-size: 1.5rem;
  }

  .tab-label {
    font-size: 0.7rem;
  }

  .animal-avatar {
    font-size: 1.7rem;
  }

  .speed-title {
    font-size: 0.65rem;
  }

  .huge-play-btn {
    font-size: 1.4rem;
    padding: 12px 36px;
  }

  .mode-tab-btn,
  .range-tab-btn {
    padding: 6px 4px;
    font-size: 0.8rem;
    gap: 4px;
  }

  .keypad-num-btn {
    height: 48px;
  }

  .keypad-easy .keypad-num-btn {
    height: 56px;
  }

  .num-text {
    font-size: 1.6rem;
  }

  .fruit-dice-grid {
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: repeat(3, 38px);
    gap: 4px;
  }

  .fruit-pip {
    width: 38px;
    height: 38px;
  }

  .fruit-pip .fruit-emoji {
    font-size: 2rem;
  }

  .dice-card {
    width: 96px;
    height: 96px;
  }

  .dice-pip {
    width: 16px;
    height: 16px;
  }

  .hand-svg {
    width: 85px;
    height: 98px;
  }

  .flash-stage-wrapper {
    height: 196px;
    min-height: 196px;
    max-height: 196px;
  }

  .flash-card-stage {
    padding: 6px 8px;
  }
}
