/* ==========================================================================
   Math Magic Sprint - Playful Theme & Animations
   ========================================================================== */

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #31104b 100%);
  --card-bg: rgba(30, 41, 59, 0.75);
  --card-border: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  /* Vibrant Theme Colors */
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --accent-yellow: #fbbf24;
  --accent-green: #10b981;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-orange: #f97316;

  --easy-color: #10b981;
  --medium-color: #f59e0b;
  --hard-color: #ef4444;
  --blitz-color: #06b6d4;

  --font-family: 'Fredoka', 'Outfit', sans-serif;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-glow: 0 10px 30px -10px rgba(139, 92, 246, 0.5);
}

* {
  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;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Background floating bubbles */
.bg-decorations {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.float-bubble {
  position: absolute;
  font-size: 2.5rem;
  opacity: 0.15;
  animation: floatUp 12s infinite linear;
}

.b1 { left: 10%; animation-delay: 0s; font-size: 3rem; }
.b2 { left: 25%; animation-delay: 3s; font-size: 2rem; }
.b3 { left: 55%; animation-delay: 6s; font-size: 2.8rem; }
.b4 { left: 75%; animation-delay: 1.5s; font-size: 3.5rem; }
.b5 { left: 88%; animation-delay: 8s; font-size: 2.2rem; }
.b6 { left: 40%; animation-delay: 10s; font-size: 2.5rem; }

@keyframes floatUp {
  0% { transform: translateY(105vh) rotate(0deg); }
  100% { transform: translateY(-15vh) rotate(360deg); }
}

/* Confetti Overlay */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 960px;
  min-height: 90vh;
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  padding: 0 16px;
}

/* Header Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.brand:hover {
  transform: scale(1.05);
}
.brand-icon {
  font-size: 1.8rem;
}
.brand-name {
  font-weight: 700;
  font-size: 1.3rem;
  background: linear-gradient(90deg, #a78bfa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Stats Pills */
.stats-pills {
  display: flex;
  gap: 12px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.1rem;
}

.coins-pill .pill-val { color: var(--accent-yellow); }
.score-pill .pill-val { color: var(--accent-cyan); }
.streak-pill .pill-val { color: var(--accent-orange); }

.header-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-weight: 700;
  border: none;
  outline: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active {
  transform: scale(0.95) !important;
}

.btn-pill {
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.95rem;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.22);
}

.btn-install {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  animation: pulseInstall 2.5s infinite ease-in-out;
}
.btn-install:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.6);
}

@keyframes pulseInstall {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.hidden {
  display: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.6);
}

.btn-outline {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-large {
  padding: 14px 28px;
  font-size: 1.2rem;
  border-radius: var(--radius-md);
  width: 100%;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

/* Screens */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.screen {
  display: none;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
  opacity: 1;
  transform: scale(1);
}

/* Hero Section */
.hero-banner {
  text-align: center;
  margin-bottom: 10px;
}

.mascot-hero-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 15px;
  position: relative;
}

.mascot {
  font-size: 4.5rem;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mascot-interactive {
  cursor: pointer;
  user-select: none;
}
.mascot-interactive:hover {
  transform: scale(1.15) rotate(5deg);
}
.mascot-interactive:active {
  transform: scale(0.9) rotate(-10deg);
}

.mascot-pop {
  animation: mascotPopAnim 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes mascotPopAnim {
  0% { transform: scale(0.7) rotate(-15deg); }
  50% { transform: scale(1.25) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.mascot-small {
  font-size: 3rem;
}

.speech-bubble {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #1e293b;
  padding: 14px 22px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(139, 92, 246, 0.2);
  margin-top: 12px;
  max-width: 480px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.speech-bubble:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 25px rgba(139, 92, 246, 0.35);
}

.speech-bubble:active {
  transform: scale(0.98);
}

.speech-bubble::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent #ffffff transparent;
}

.bubble-tap-hint {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6366f1;
  margin-top: 4px;
  opacity: 0.85;
  letter-spacing: 0.3px;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #f472b6, #fbbf24, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 5px;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* Difficulty Cards Grid */
.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

.diff-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
}

.diff-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.tables-card:hover { border-color: #ec4899; box-shadow: 0 10px 30px rgba(236, 72, 153, 0.4); }
.blitz-card:hover { border-color: var(--blitz-color); box-shadow: 0 10px 30px rgba(6, 182, 212, 0.35); }
.easy-card:hover { border-color: var(--easy-color); }
.medium-card:hover { border-color: var(--medium-color); }
.hard-card:hover { border-color: var(--hard-color); }

.card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
}
.tables-card .card-badge { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.4); }
.blitz-card .card-badge { background: rgba(6, 182, 212, 0.2); color: var(--blitz-color); border: 1px solid rgba(6, 182, 212, 0.4); }
.easy-card .card-badge { background: rgba(16, 185, 129, 0.2); color: var(--easy-color); }
.medium-card .card-badge { background: rgba(245, 158, 11, 0.2); color: var(--medium-color); }
.hard-card .card-badge { background: rgba(239, 68, 68, 0.2); color: var(--hard-color); }

.card-icon {
  font-size: 3.5rem;
  margin: 15px 0 10px 0;
}

.diff-card h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 15px;
  flex: 1;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  width: 100%;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.btn-start {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  color: white;
}
.btn-tables { background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%); box-shadow: 0 4px 15px rgba(236, 72, 153, 0.35); }
.btn-blitz { background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%); box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3); }
.btn-easy { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.btn-medium { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.btn-hard { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

/* Silly Fact Card */
.silly-fact-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.silly-fact-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--accent-yellow);
  transform: translateY(-2px);
}

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

/* Gameplay Screen */
.game-hud {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(15, 23, 42, 0.5);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.progress-bar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
}

.mode-badge-pill {
  background: var(--primary);
  padding: 2px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
}

.progress-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #3b82f6);
  border-radius: 50px;
  transition: width 0.3s ease;
}

/* SVG Timer Widget */
.timer-widget {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 8;
}

.timer-circle {
  fill: none;
  stroke: var(--accent-green);
  stroke-width: 8;
  stroke-dasharray: 264;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
}

.timer-text {
  position: absolute;
  font-weight: 800;
  font-size: 1.1rem;
}

/* Game Mascot Row */
.game-mascot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 5px 0;
}

.game-bubble {
  max-width: 320px;
  font-size: 1rem;
  padding: 8px 16px;
}

.game-bubble::before {
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
  border-width: 8px 10px 8px 0;
  border-color: transparent #ffffff transparent transparent;
}

/* Question Card */
.question-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  position: relative;
}

.type-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-yellow);
}

.math-expression {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 3.5rem;
  font-weight: 800;
  margin-top: 15px;
  font-family: 'Fredoka', sans-serif;
  letter-spacing: 2px;
}

.math-expression #operator {
  color: var(--accent-pink);
}

.answer-slot {
  display: inline-block;
  min-width: clamp(70px, 14vw, 120px);
  border-bottom: 4px dashed var(--accent-yellow);
  color: var(--accent-yellow);
  padding: 0 8px;
}

.result-val {
  display: inline-block;
  color: #fff;
  padding: 0 4px;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.option-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 20px;
  font-size: 2rem;
  font-weight: 800;
  color: white;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-4px);
  border-color: var(--primary);
}

.option-btn.correct {
  background: #10b981 !important;
  border-color: #34d399 !important;
  animation: popSuccess 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.option-btn.wrong {
  background: #ef4444 !important;
  border-color: #f87171 !important;
  animation: wobble 0.4s ease;
}

/* Numpad Container */
.numpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;

  /* default display when shown */
}

.numpad-container.hidden {
  display: none !important;
}

.numpad-display {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 10px 24px;
  min-width: 220px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.cursor-blink {
  animation: blink 1s infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.num-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.1s ease;
}

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

.num-btn.btn-action {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.btn-submit-numpad {
  width: 100%;
  max-width: 320px;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

/* Summary Screen */
.summary-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.star-rating {
  font-size: 2.5rem;
  margin-top: 5px;
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-icon { font-size: 1.8rem; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: white; margin: 4px 0; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; }

.silly-title-box {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
  border: 2px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 15px;
}

.title-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-yellow);
  letter-spacing: 1px;
}

.silly-title-box h3 {
  font-size: 1.3rem;
  margin-top: 4px;
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-content {
  background: #1e293b;
  border: 2px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  text-align: center;
}

.appreciation-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.appreciation-emoji {
  font-size: 5rem;
}

.silly-dancer {
  display: flex;
  gap: 20px;
  font-size: 3rem;
  margin: 10px 0;
}

.dancer {
  animation: danceBounce 0.6s infinite alternate;
}
.d2 { animation-delay: 0.2s; }
.d3 { animation-delay: 0.4s; }

@keyframes danceBounce {
  0% { transform: translateY(0) rotate(-10deg); }
  100% { transform: translateY(-20px) rotate(10deg); }
}

.reward-pill {
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid var(--accent-yellow);
  color: var(--accent-yellow);
  padding: 8px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.1rem;
}

/* Sticker Album */
.sticker-card {
  max-width: 650px;
  text-align: left;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.btn-close {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

.sticker-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 15px;
}

.sticker-balance-bar {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 20px;
}

.coins-badge {
  color: var(--accent-yellow);
  font-size: 1.2rem;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 15px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 5px;
}

.sticker-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 15px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: transform 0.2s ease;
}

.sticker-item:hover {
  transform: scale(1.05);
}

.sticker-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}

.sticker-name {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.btn-buy-sticker {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 50px;
  width: 100%;
}

.sticker-item.locked .sticker-emoji {
  filter: grayscale(1) opacity(0.4);
}

.sticker-item.unlocked {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--accent-green);
}

.unlocked-tag {
  color: var(--accent-green);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Animations */
.float-anim {
  animation: floatMascot 3s infinite ease-in-out;
}

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

.pulse-anim {
  animation: pulseMascot 2s infinite ease-in-out;
}

@keyframes pulseMascot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.bounce-in {
  animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1); }
}

.pop-in {
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes popSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Sticker Modal & Tabs */
.sticker-card {
  max-width: 700px;
  text-align: left;
}

.sticker-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.tab-btn {
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--accent-pink);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Master Artwork Poster Canvas */
.artwork-header {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 15px;
}

.artwork-header h3 {
  font-size: 1.2rem;
  color: var(--accent-yellow);
}

.artwork-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.artwork-progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  overflow: hidden;
}

.artwork-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #10b981);
  border-radius: 50px;
  transition: width 0.4s ease;
}

.master-poster-canvas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.9), rgba(49, 16, 75, 0.9));
  border: 3px dashed var(--accent-yellow);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-height: 380px;
  overflow-y: auto;
  position: relative;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
}

.poster-slot {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
}

.poster-slot.locked {
  filter: grayscale(1);
  opacity: 0.35;
}

.poster-slot.unlocked {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(251, 191, 36, 0.2));
  border: 2px solid var(--accent-yellow);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
  animation: popIn 0.4s ease;
}

.slot-emoji {
  font-size: 2.8rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.slot-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 4px;
  text-align: center;
}

.slot-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Master Artwork Complete Glow */
.master-poster-canvas.complete {
  border-style: solid;
  border-color: #34d399;
  box-shadow: 0 0 40px rgba(52, 211, 153, 0.6);
  animation: pulseGlow 2s infinite alternate;
  display: block;
  padding: 10px;
}

.master-artwork-completed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.master-artwork-img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 3px solid var(--accent-yellow);
}

.master-artwork-banner {
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #3b82f6);
  color: #fff;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Master Artworks 20-Card Gallery Styles */
.artwork-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 6px;
}

.artwork-card {
  background: rgba(15, 23, 42, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.3s ease;
}

.artwork-card.status-color {
  border-color: var(--accent-yellow);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.8), rgba(49, 16, 75, 0.8));
}

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

.artwork-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
}

.artwork-icon {
  font-size: 1.2rem;
}

.artwork-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artwork-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.artwork-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.4s ease, transform 0.4s ease;
}

.artwork-img.locked {
  filter: grayscale(100%) blur(4px) brightness(0.3);
}

.artwork-img.greyscale {
  filter: grayscale(100%) contrast(110%);
}

.artwork-img.color {
  filter: none;
}

.artwork-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  gap: 4px;
}

.lock-icon { font-size: 1.8rem; }
.lock-text { font-size: 0.75rem; font-weight: 800; letter-spacing: 1px; }

.artwork-preview-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
}

.greyscale-tag { background: rgba(0, 0, 0, 0.7); color: #fbbf24; border: 1px solid #fbbf24; }
.color-tag { background: #10b981; color: #fff; }

.artwork-card-footer {
  margin-top: auto;
}

.btn-unlock-art {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 800;
}

.artwork-complete-badge {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #34d399;
  padding: 6px;
  background: rgba(52, 211, 153, 0.15);
  border-radius: var(--radius-sm);
  border: 1px dashed #34d399;
}

/* Mental Math Explanation Modal Styles */
.explanation-card {
  max-width: 600px;
  width: 92%;
  background: linear-gradient(135deg, #1e1b4b, #31104b);
  border: 3px solid var(--accent-yellow);
  padding: 24px;
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.explanation-header h2 {
  font-size: 1.5rem;
  color: var(--accent-yellow);
  margin: 0;
}

.explanation-problem-box {
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  text-align: center;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.exp-eq {
  font-size: 2.2rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
}

.exp-op {
  color: var(--accent-pink);
}

.exp-ans {
  color: var(--accent-green);
  text-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.exp-sublabel {
  margin-top: 8px;
  font-size: 0.95rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  display: inline-block;
}

.retention-tip-box {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(139, 92, 246, 0.15));
  border: 1.5px dashed #f472b6;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 10px;
}

.retention-tip-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.retention-tip-text {
  font-size: 0.92rem;
  color: #fce7f3;
  line-height: 1.4;
}

.retention-tip-text strong {
  color: #fbbf24;
}

.explanation-steps-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
  max-height: 340px;
  overflow-y: auto;
}

.exp-step-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.exp-step-badge {
  display: inline-block;
  background: var(--accent-yellow);
  color: #0f172a;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}

.exp-step-desc {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 10px;
}

.split-tree {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  width: fit-content;
}

.tree-root {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.tree-arrow {
  color: var(--text-muted);
}

.tree-branches {
  display: flex;
  gap: 8px;
}

.branch {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
}

.b-hundreds { color: #60a5fa; border: 1px solid #3b82f6; }
.b-tens { color: #f59e0b; border: 1px solid #d97706; }
.b-ones { color: #34d399; border: 1px solid #059669; }

.calc-strip {
  background: rgba(15, 23, 42, 0.6);
  border-left: 4px solid var(--accent-cyan);
  padding: 8px 14px;
  font-size: 1.1rem;
  font-family: monospace;
  font-weight: 700;
  border-radius: 4px;
  color: #e2e8f0;
}

.calc-strip.highlight {
  border-left-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.15);
}

.final-val {
  color: var(--accent-green);
  font-size: 1.3rem;
}

/* Custom Alert Notification Card Styles */
.alert-card {
  max-width: 420px;
  background: linear-gradient(135deg, #1e1b4b, #450a0a);
  border: 3px solid #f59e0b;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.4);
  padding: 24px;
}

.alert-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  animation: float 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 20px rgba(52, 211, 153, 0.4); }
  100% { box-shadow: 0 0 50px rgba(251, 191, 36, 0.8); }
}

/* Version Badge in Brand Header */
.version-badge {
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(139, 92, 246, 0.25);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.5);
  padding: 2px 7px;
  border-radius: 50px;
  letter-spacing: 0.5px;
}

/* PWA Auto-Update Notification Toast */
.pwa-update-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 420px;
  width: calc(100vw - 48px);
  background: linear-gradient(135deg, #1e1b4b 0%, #31104b 100%);
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.4), 0 0 20px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUpFade 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUpFade {
  0% { transform: translateY(50px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.update-toast-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.update-toast-icon {
  font-size: 2.2rem;
  animation: floatMascot 2s infinite ease-in-out;
}

.update-toast-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.update-toast-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.update-toast-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.update-toast-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-close-toast {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 6px;
  transition: color 0.2s ease;
}
.btn-close-toast:hover {
  color: #fff;
}

/* PWA Install Offer Modal */
.install-offer-card {
  max-width: 480px;
  background: linear-gradient(135deg, #1e1b4b 0%, #31104b 100%);
  border: 3px solid var(--accent-cyan);
  box-shadow: 0 0 40px rgba(6, 182, 212, 0.4), 0 20px 50px rgba(0, 0, 0, 0.8);
  padding: 26px 24px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.install-offer-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.install-offer-title {
  font-size: 1.4rem;
  color: #fff;
  background: linear-gradient(90deg, #38bdf8, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.install-offer-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.install-perks-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.perk-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.perk-icon {
  font-size: 1.4rem;
  line-height: 1.2;
}

.perk-text strong {
  display: block;
  font-size: 0.9rem;
  color: #f8fafc;
}

.perk-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.ios-install-guide {
  background: rgba(56, 189, 248, 0.15);
  border: 1px dashed var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #e0f2fe;
}

.install-offer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* Footer version tag */
.app-footer {
  text-align: center;
  padding: 24px 0 12px 0;
  margin-top: 10px;
}

.footer-version {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .app-container {
    padding: 0 12px;
    margin: 8px auto;
  }

  .top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    gap: 8px;
    margin-bottom: 14px;
  }

  .stats-pills {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }

  .header-actions .btn-pill {
    padding: 6px 12px;
    font-size: 0.85rem;
    gap: 4px;
  }

  .header-actions .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 1.05rem;
    min-width: 36px;
  }

  .pill {
    padding: 5px 10px;
    font-size: 0.9rem;
    gap: 4px;
  }

  .pill .pill-icon {
    font-size: 1rem;
  }

  .pill .pill-val {
    font-size: 0.9rem;
  }
}

@media (max-width: 540px) {
  .app-container {
    padding: 0 8px;
  }

  .top-bar {
    padding: 6px 10px;
    gap: 6px;
  }

  .header-actions {
    gap: 4px;
  }

  .header-actions .btn-pill {
    padding: 5px 9px;
    font-size: 0.78rem;
  }

  .header-actions .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    min-width: 32px;
  }

  .stats-pills {
    gap: 4px;
  }

  .pill {
    padding: 4px 7px;
    font-size: 0.8rem;
    gap: 3px;
  }

  .pill .pill-icon {
    font-size: 0.85rem;
  }

  .pill .pill-val {
    font-size: 0.82rem;
  }

  .hero-title { font-size: 2rem; }
  .math-expression { font-size: 2.2rem; }
  .options-grid { grid-template-columns: 1fr; }
  .master-poster-canvas { grid-template-columns: repeat(2, 1fr); }
  .pwa-update-toast {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}
