﻿/* ==========================================================================
   11+ BLITZ · MIA'S 11+ PREP — HIGH-END MOBILE GAME UI (v8)
   Specular Glass · Floating Spatial Layers · Biome Lighting · Zero CLS
   ========================================================================== */

:root {
  --primary:        #2979ff;
  --primary-light:  #5c9bff;
  --primary-dark:   #0050d0;
  --secondary:      #00b4d8;
  --secondary-dark: #0090b0;
  --accent:         #f5b700;
  --accent-dark:    #b88400;
  --mia-rose:       #ff6ea8;
  --mia-rose-soft:  rgba(255, 110, 168, 0.22);

  --success:        #5de61e;
  --warning:        #f5b700;
  --error:          #ff4757;

  --surface-0:         #05070e;
  --surface:           #0c1020;
  --surface-secondary: #141b30;
  --surface-elevated:  #1b243f;
  --border-subtle:     rgba(255, 255, 255, 0.08);
  --border-medium:     rgba(255, 255, 255, 0.14);
  --border-bright:     rgba(255, 255, 255, 0.26);

  --text-primary:   #eef2ff;
  --text-secondary: #98add4;
  --text-tertiary:  #64779c;

  --font-display: 'Fredoka', 'Nunito', sans-serif;
  --font-primary: 'Nunito', system-ui, -apple-system, sans-serif;

  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  22px;
  --r-2xl: 28px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 54px rgba(0, 0, 0, 0.85);
  --glow-blue: 0 0 22px rgba(41, 121, 255, 0.42);
  --glow-gold: 0 0 24px rgba(245, 183, 0, 0.48);
  --glow-red:  0 0 26px rgba(255, 71, 87, 0.58);
  --glow-rose: 0 0 22px rgba(255, 110, 168, 0.5);

  --ease-fast: 120ms cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --combo-color-mega: #ff4757;
}

/* ==========================================================================
   BASE, BIOMES & ATMOSPHERIC STAGE
   ========================================================================== */

*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  font-family: var(--font-primary); -webkit-font-smoothing: antialiased;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background-color: var(--surface-0);
  background-image:
    radial-gradient(ellipse 110% 50% at 75% -10%, rgba(41, 121, 255, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse 90% 45% at 0% 105%, rgba(0, 180, 216, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 65% 35% at 95% 80%, rgba(255, 110, 168, 0.08) 0%, transparent 60%);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh; min-height: 100dvh;
  display: flex; justify-content: center; align-items: center;
  overscroll-behavior: none; touch-action: manipulation;
  transition: background-image 0.55s ease;
}

body.biome-math {
  background-image:
    radial-gradient(ellipse 110% 50% at 75% -10%, rgba(41, 121, 255, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 90% 45% at 5% 100%, rgba(0, 180, 216, 0.14) 0%, transparent 60%);
}
body.biome-english {
  background-image:
    radial-gradient(ellipse 110% 50% at 25% -10%, rgba(255, 110, 168, 0.16) 0%, transparent 60%),
    radial-gradient(ellipse 90% 45% at 90% 100%, rgba(245, 183, 0, 0.12) 0%, transparent 60%);
}
body.biome-blitz {
  background-image:
    radial-gradient(ellipse 110% 55% at 50% -10%, rgba(245, 183, 0, 0.19) 0%, transparent 60%),
    radial-gradient(ellipse 90% 45% at 85% 100%, rgba(255, 71, 87, 0.14) 0%, transparent 60%);
}

body.has-bottom-nav { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
body.in-game { padding-bottom: 0 !important; }
body.in-game #bottom-nav { display: none !important; }

body.streak-active {
  background-image:
    radial-gradient(ellipse 110% 55% at 50% -5%, rgba(93, 230, 30, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 90% 90%, rgba(0, 180, 216, 0.12) 0%, transparent 50%);
}
body.mega-streak-active { animation: mega-streak-pulse 1.5s infinite alternate; }
@keyframes mega-streak-pulse {
  0%   { box-shadow: inset 0 0 36px rgba(245, 183, 0, 0.18); }
  100% { box-shadow: inset 0 0 96px rgba(245, 183, 0, 0.34), inset 0 0 44px rgba(255, 71, 87, 0.22); }
}

body.time-critical-pulse { animation: time-pulse-body 0.65s infinite alternate; }
@keyframes time-pulse-body {
  0%   { box-shadow: inset 0 0 20px rgba(255, 71, 87, 0.18); }
  100% { box-shadow: inset 0 0 82px rgba(255, 71, 87, 0.44); }
}

#body-particles { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
#body-particles span { position: absolute; width: 3px; height: 3px; border-radius: 50%; opacity: 0; animation: particle-drift linear infinite; }
#body-particles span:nth-child(3n+1) { background: var(--secondary); }
#body-particles span:nth-child(3n+2) { background: var(--accent); }
#body-particles span:nth-child(3n)   { background: var(--mia-rose); }
#body-particles span:nth-child(1) { left: 8%;  animation-duration: 15s; }
#body-particles span:nth-child(2) { left: 22%; animation-duration: 20s; animation-delay: 2s; }
#body-particles span:nth-child(3) { left: 36%; animation-duration: 17s; animation-delay: 4s; }
#body-particles span:nth-child(4) { left: 50%; animation-duration: 22s; animation-delay: 1s; }
#body-particles span:nth-child(5) { left: 64%; animation-duration: 16s; animation-delay: 5s; }
#body-particles span:nth-child(6) { left: 76%; animation-duration: 19s; animation-delay: 3s; }
#body-particles span:nth-child(7) { left: 87%; animation-duration: 21s; animation-delay: 6s; }
#body-particles span:nth-child(8) { left: 94%; animation-duration: 18s; animation-delay: 2.5s; }
@keyframes particle-drift {
  0%   { opacity: 0; transform: translateY(104vh) scale(0.8); }
  14%  { opacity: 0.6; }
  85%  { opacity: 0.25; }
  100% { opacity: 0; transform: translateY(-8vh) scale(1.15); }
}

.container {
  width: 100%; display: flex; justify-content: center; align-items: center;
  padding: var(--space-3); min-height: 100dvh;
  padding-top: max(var(--space-3), env(safe-area-inset-top));
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  position: relative; z-index: 1;
}
body.has-bottom-nav .container { min-height: calc(100dvh - 84px - env(safe-area-inset-bottom)); padding-bottom: 0; }
body.in-game .container { min-height: 100dvh !important; }

.container.screen-flash-correct   { animation: screen-flash-correct 0.38s ease; }
.container.screen-flash-incorrect { animation: screen-flash-incorrect 0.38s ease; }
@keyframes screen-flash-correct   { 25% { background-color: rgba(93, 230, 30, 0.13); } }
@keyframes screen-flash-incorrect { 25% { background-color: rgba(255, 71, 87, 0.17); } }

#landing-screen, #game-screen, #paywall, #end-screen, #loading-screen, #progress-screen {
  display: flex; flex-direction: column; width: 100%; max-width: 500px;
  height: calc(100dvh - 24px); max-height: 900px;
  padding: var(--space-4);
  background: linear-gradient(180deg, rgba(14, 20, 40, 0.94) 0%, rgba(8, 11, 22, 0.98) 100%);
  border-radius: var(--r-2xl); border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), var(--shadow-xl);
  position: relative; overflow-x: hidden; overflow-y: auto;
}
#game-screen, #paywall, #end-screen, #loading-screen, #progress-screen { display: none; }
#landing-screen > *, #end-screen > *, #progress-screen > * { flex-shrink: 0; }

.screen-enter { animation: screen-enter 0.24s var(--ease-expo) both; }
@keyframes screen-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 768px) {
  #landing-screen, #game-screen, #paywall, #end-screen, #loading-screen, #progress-screen { max-width: 540px; }
}

@media (max-width: 600px) {
  .container { padding: 0; }
  #landing-screen, #game-screen, #paywall, #end-screen, #loading-screen, #progress-screen {
    max-width: 100%;
    height: calc(100dvh - 84px - env(safe-area-inset-bottom));
    max-height: none; border-radius: 0; border: none;
  }
  #landing-screen, #game-screen { height: 100dvh; }
  #game-screen { padding: 0 0 max(10px, env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   TYPOGRAPHY & SPECULAR 3D BUTTONS
   ========================================================================== */

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; color: var(--text-primary); }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.15rem; }
p  { color: var(--text-secondary); font-size: 0.94rem; }
strong { font-weight: 800; color: var(--text-primary); }
a { color: var(--secondary); text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  background: var(--primary); color: #fff; border: none; border-radius: var(--r-xl);
  padding: 13px 18px; font-size: 15.5px; font-weight: 900; cursor: pointer;
  width: 100%; margin: 3px 0; position: relative; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 5px 0 var(--primary-dark), 0 6px 18px rgba(41, 121, 255, 0.25);
  transition: transform var(--ease-fast), box-shadow var(--ease-fast), filter var(--ease-fast);
}
.btn:hover:not(:disabled)  { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(4px) scale(0.985); box-shadow: 0 1px 0 var(--primary-dark); }
.btn:focus-visible         { outline: 2.5px solid var(--secondary); outline-offset: 2px; }
.btn:disabled              { opacity: 0.36; cursor: not-allowed; filter: grayscale(50%); }

.btn-shimmer::after {
  content: ''; position: absolute; top: -20%; left: -60%; width: 45%; height: 140%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-22deg); animation: btn-sheen 4s ease-in-out infinite; pointer-events: none;
}
@keyframes btn-sheen { 0%, 62% { left: -60%; } 100% { left: 145%; } }

.btn-play-hero {
  background: linear-gradient(135deg, #00d4aa 0%, #2979ff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 5px 0 #0046a6, 0 10px 26px rgba(0, 212, 170, 0.32);
  font-size: 16.5px; padding: 14px 18px;
}
.btn-secondary        { background: var(--surface-elevated); color: var(--text-primary); border: 1px solid var(--border-medium); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5); }
.btn-primary-action   { background: linear-gradient(135deg, var(--primary-light), var(--primary)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 5px 0 var(--primary-dark); }
.btn-secondary-action { background: rgba(245, 183, 0, 0.14); color: var(--accent); border: 1px solid rgba(245, 183, 0, 0.42); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45); }
.btn-social-action    { background: rgba(0, 180, 216, 0.14); color: #7ef3ff; border: 1px solid rgba(0, 180, 216, 0.4); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45); }
.btn-utility-action   { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); border: 1px solid var(--border-subtle); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4); }
.btn-premium          { background: linear-gradient(170deg, #ffe54d, #f5b700, #cc8a00); color: #1a1000; font-size: 15.5px; padding: 14px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 5px 0 #7a5000, var(--glow-gold); }

.btn-icon {
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border-medium); border-radius: 50%;
  width: 34px; height: 34px; font-size: 15px; cursor: pointer;
  display: grid; place-items: center; color: var(--text-secondary); flex-shrink: 0;
  transition: transform var(--ease-fast);
}
.btn-icon:active { transform: scale(0.92); }
.btn-spinner { width: 16px; height: 16px; border: 2.5px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   TOAST & MODALS (Including Rescue Modal)
   ========================================================================== */

.toast {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--surface-elevated); color: var(--text-primary);
  padding: 10px 18px; border-radius: var(--r-lg); font-weight: 800; font-size: 13.5px;
  z-index: 999999; pointer-events: none; max-width: 90vw; text-align: center;
  box-shadow: var(--shadow-xl); border: 1px solid var(--border-medium); opacity: 0;
  transition: transform 0.25s var(--ease-expo), opacity 0.25s ease;
}
.toast.toast-visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.toast-success { background: #143628; border-color: rgba(93, 230, 30, 0.55); }
.toast.toast-error   { background: #3b141c; border-color: rgba(255, 71, 87, 0.6); }
.toast.toast-info    { background: #102a45; border-color: rgba(0, 180, 216, 0.55); }

.app-dialog-backdrop { position: fixed; inset: 0; z-index: 999995; background: rgba(4, 6, 12, 0.84); display: flex; align-items: center; justify-content: center; padding: var(--space-5); }
.app-dialog-card { width: 100%; max-width: 340px; padding: 20px; background: var(--surface-elevated); border: 1px solid var(--border-bright); border-radius: var(--r-xl); text-align: center; animation: screen-enter 0.2s var(--ease-expo); }
.app-dialog-card h3 { margin-bottom: 6px; } .app-dialog-card p { margin-bottom: 12px; font-size: 0.9rem; }
.app-dialog-input { width: 100%; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--r-md); border: 1px solid var(--border-medium); background: rgba(255, 255, 255, 0.06); color: var(--text-primary); font-weight: 800; font-size: 15px; }
.app-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.rescue-card {
  position: relative; width: 100%; max-width: 350px; padding: 38px 20px 20px;
  background: linear-gradient(180deg, var(--surface-elevated), var(--surface));
  border: 1.5px solid rgba(255, 71, 87, 0.55); border-radius: var(--r-2xl);
  text-align: center; box-shadow: var(--shadow-xl), var(--glow-red);
  animation: screen-enter 0.24s var(--ease-expo);
}
.rescue-avatar-float {
  position: absolute; top: -32px; left: 50%; transform: translateX(-50%);
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--error); background: var(--surface); box-shadow: var(--glow-red);
}
.rescue-avatar-float img { width: 100%; height: 100%; object-fit: cover; }
.rescue-card h3 { margin-bottom: 4px; color: #ff99a5; }
.rescue-card p  { margin-bottom: 14px; font-size: 0.9rem; }
.rescue-actions { display: flex; flex-direction: column; gap: 8px; }

#daily-reward-modal { position: fixed; inset: 0; z-index: 99998; background: rgba(4, 6, 12, 0.9); display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.reward-content { background: var(--surface-elevated); border: 1.5px solid rgba(245, 183, 0, 0.5); border-radius: var(--r-2xl); padding: var(--space-5); text-align: center; max-width: 340px; width: 100%; box-shadow: var(--shadow-xl), var(--glow-gold); display: flex; flex-direction: column; gap: 12px; align-items: center; animation: screen-enter 0.28s var(--ease-expo); }
.reward-stars { font-size: 1.8rem; } .reward-content h2 { color: var(--accent); margin: 0; } #reward-icon { font-size: 3rem; }
.reward-description { color: var(--text-primary); font-weight: 800; margin: 0; }
.reward-streak-track { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; width: 100%; }
.reward-day-pip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-subtle); font-size: 13px; }
.reward-day-pip small { font-size: 9px; font-weight: 900; color: var(--text-tertiary); }
.reward-day-pip.done  { background: rgba(93, 230, 30, 0.14); border-color: rgba(93, 230, 30, 0.35); }
.reward-day-pip.today { background: rgba(245, 183, 0, 0.22); border-color: var(--accent); transform: scale(1.06); }

#unit-transition-overlay { display: none; position: fixed; inset: 0; z-index: 99997; background: rgba(5, 7, 14, 0.94); align-items: center; justify-content: center; flex-direction: column; gap: 8px; }
#unit-transition-overlay.visible { display: flex; }
#unit-transition-text { font-family: var(--font-display); font-size: 2rem; }
.unit-transition-sub { font-size: 1rem; font-weight: 800; color: var(--accent); }

/* ==========================================================================
   LANDING / PLAY-FIRST SCREEN
   ========================================================================== */

#landing-screen { align-items: center; gap: 10px; padding: var(--space-4); }
.landing-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; width: 100%; }
.landing-mia-container { position: relative; margin-bottom: 4px; }
.landing-mia-img {
  width: 82px; height: 82px; border-radius: 50%; object-fit: cover; cursor: pointer;
  box-shadow: 0 0 0 3px var(--surface-elevated), 0 0 0 5px rgba(255, 110, 168, 0.55), var(--glow-rose);
  animation: mia-breathe 3.2s ease-in-out infinite;
}
@keyframes mia-breathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.03); } }
.mia-boop { animation: mia-boop 0.36s var(--ease-expo) !important; }
@keyframes mia-boop { 0% { transform: scale(1); } 35% { transform: scale(1.16, 0.88); } 70% { transform: scale(0.95, 1.07); } 100% { transform: scale(1); } }

.landing-mia-badge {
  position: absolute; bottom: -2px; right: -4px;
  background: linear-gradient(135deg, var(--accent), #ff9f0a);
  color: #1a1000; font-size: 11px; font-weight: 900; width: 28px; height: 28px;
  border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--surface);
}
#landing-screen h1 {
  background: linear-gradient(135deg, #fff0f7, var(--primary-light), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.landing-subtitle { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; margin: 0; }
.landing-mia-bubble {
  margin-top: 4px; padding: 7px 14px; border-radius: 99px;
  background: rgba(255, 110, 168, 0.12); border: 1px solid rgba(255, 110, 168, 0.35);
  color: #ffd6e8; font-size: 0.8rem; font-weight: 800; max-width: 100%;
}
.bubble-pop { animation: bubble-pop 0.28s var(--ease-expo); }
@keyframes bubble-pop { 0% { transform: scale(0.94); opacity: 0.7; } 65% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

.landing-challenge-card {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 14px; border-radius: var(--r-xl); text-align: center;
  background: linear-gradient(135deg, rgba(245, 183, 0, 0.2), rgba(255, 71, 87, 0.14));
  border: 1.5px solid rgba(245, 183, 0, 0.65); box-shadow: var(--glow-gold);
}
.chal-badge { font-size: 10px; font-weight: 900; letter-spacing: 0.1em; color: #1a1000; background: var(--accent); padding: 2px 10px; border-radius: 99px; }
.landing-challenge-card p { margin: 0; font-size: 0.92rem; font-weight: 900; color: #fff; }

.usp-banner { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border-radius: var(--r-lg); background: rgba(41, 121, 255, 0.1); border: 1px solid rgba(41, 121, 255, 0.26); }
.usp-banner p { margin: 0; font-size: 0.82rem; font-weight: 700; }

.auth-container { width: 100%; background: var(--surface-secondary); border-radius: var(--r-xl); border: 1px solid var(--border-medium); padding: 14px; }
.auth-tabs { display: flex; background: var(--surface); border-radius: var(--r-md); padding: 3px; gap: 3px; margin-bottom: 10px; }
.auth-tab { flex: 1; padding: 7px; border: none; border-radius: 9px; font-size: 13px; font-weight: 800; color: var(--text-tertiary); background: none; cursor: pointer; }
.auth-tab.active { background: rgba(41, 121, 255, 0.2); color: var(--primary-light); }
.auth-form { display: flex; flex-direction: column; gap: 7px; }
.input-group { display: flex; flex-direction: column; gap: 3px; }
.input-label { font-size: 10.5px; font-weight: 900; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; }
.auth-container input { width: 100%; padding: 9px 12px; border: 1px solid var(--border-medium); border-radius: var(--r-md); font-size: 14.5px; background: rgba(255, 255, 255, 0.04); color: var(--text-primary); font-weight: 600; }
.auth-container input:focus { outline: none; border-color: var(--secondary); }
.password-wrapper { position: relative; } .password-wrapper input { padding-right: 40px; }
.toggle-password { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; color: var(--text-tertiary); }
.password-strength { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.strength-bar { flex: 1; height: 4px; background: var(--surface-elevated); border-radius: 2px; overflow: hidden; }
.strength-fill { height: 100%; transition: width 0.25s; }
.strength-fill.weak { background: var(--error); } .strength-fill.fair { background: var(--warning); } .strength-fill.strong { background: var(--success); }
#strength-label { font-size: 11px; font-weight: 800; }
.auth-error { background: rgba(255, 71, 87, 0.12); color: #ff8a96; border: 1px solid rgba(255, 71, 87, 0.4); border-radius: var(--r-sm); padding: 6px 10px; font-size: 12px; font-weight: 700; }
.btn-auth { background: linear-gradient(135deg, var(--primary-light), var(--primary)); box-shadow: 0 4px 0 var(--primary-dark); padding: 11px; font-size: 14.5px; }
.auth-divider { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-subtle); }
.auth-divider span { font-size: 10.5px; color: var(--text-tertiary); font-weight: 800; text-transform: uppercase; }
.social-auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.btn-social-auth { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); border: 1px solid var(--border-medium); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4); font-size: 13px; padding: 9px; border-radius: var(--r-lg); }
.social-icon { width: 17px; height: 17px; display: inline-block; }
.google-icon { background: linear-gradient(45deg, #4285F4 25%, #34A853 25%, #34A853 50%, #FBBC05 50%, #FBBC05 75%, #EA4335 75%); border-radius: 50%; }
.microsoft-icon { background: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><path fill="%23f25022" d="M0 0h5.7v5.7H0z"/><path fill="%2300a4ef" d="M0 6.3h5.7V12H0z"/><path fill="%237fba00" d="M6.3 0H12v5.7H6.3z"/><path fill="%23ffb900" d="M6.3 6.3H12V12H6.3z"/></svg>') center/15px no-repeat; }
.btn-install { background: rgba(0, 180, 216, 0.15); border: 1px solid rgba(0, 180, 216, 0.4); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4); font-size: 13.5px; }

#support-email { font-size: 11.5px; color: var(--text-tertiary); font-weight: 700; text-align: center; margin-top: 2px; }
.app-parent-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; margin-top: 8px; font-size: 0.76rem; }
.app-parent-links a { color: var(--text-secondary); text-decoration: none; border-bottom: 1px dotted rgba(152, 173, 212, 0.5); }
.app-parent-links a:hover { color: var(--secondary); }

#loading-screen { justify-content: center; align-items: center; }
.loading-content { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.loading-mia-img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; animation: mia-breathe 1.1s ease-in-out infinite; box-shadow: var(--glow-rose); }
.loading-dots { display: flex; gap: 8px; margin-top: 6px; justify-content: center; }
.loading-dots span { width: 9px; height: 9px; border-radius: 50%; animation: dot-bounce 1s ease-in-out infinite; }
.loading-dots span:nth-child(1) { background: var(--mia-rose); } .loading-dots span:nth-child(2) { background: var(--secondary); animation-delay: 0.15s; } .loading-dots span:nth-child(3) { background: var(--accent); animation-delay: 0.3s; }
@keyframes dot-bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1.2); opacity: 1; } }
#loading-tip { font-size: 14px; font-weight: 700; padding: 12px 16px; border-radius: var(--r-lg); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-subtle); }

/* ==========================================================================
   GAME SCREEN — FLOATING ORBS, EMBEDDED STARS & OVERLAPPING MIA
   ========================================================================== */

#game-screen { justify-content: space-between; gap: 8px; padding: 0 0 12px; overflow: hidden; }
#game-screen.time-critical {
  border-color: rgba(255, 71, 87, 0.85) !important;
  box-shadow: inset 0 0 40px rgba(255, 71, 87, 0.3), var(--glow-red) !important;
}

#game-topbar {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 10px 8px;
  background: rgba(14, 20, 38, 0.96);
  border-bottom: 1px solid var(--border-medium); flex-shrink: 0;
}
.game-exit-btn {
  width: 32px; height: 32px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-subtle);
  color: var(--text-secondary); font-size: 0.95rem; font-weight: 900;
  cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
}
.game-exit-btn:active { transform: scale(0.92); }

#progress-wrap { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 48px; }
.progress-track-shell { position: relative; display: flex; align-items: center; height: 14px; }
#progress-bar { width: 100%; height: 7px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
#progress { height: 100%; width: 10%; border-radius: 4px; background: linear-gradient(90deg, var(--primary-dark), var(--secondary), var(--primary-light)); transition: width 0.35s var(--ease-expo); }
#game-screen.time-critical #progress { background: linear-gradient(90deg, #c9184a, #ff4757); }

.progress-milestones { position: absolute; inset: 0; pointer-events: none; }
.progress-milestones .live-star {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  font-size: 11px; width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.25); transition: transform 0.25s var(--ease-expo), color 0.2s, border-color 0.2s;
}
.progress-milestones .m-star-1 { left: 40%; }
.progress-milestones .m-star-2 { left: 70%; }
.progress-milestones .m-star-3 { left: 92%; }
.progress-milestones .live-star.lit {
  color: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 10px rgba(245, 183, 0, 0.78);
  transform: translate(-50%, -50%) scale(1.22);
}

#question-counter { font-size: 9.5px; font-weight: 900; color: var(--text-tertiary); text-align: center; }

#game-stats-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.gs-pill {
  display: flex; align-items: center; gap: 3px; padding: 4px 6px;
  border-radius: 10px; font-size: 11.5px; font-weight: 900;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-subtle);
}
.hearts-pill { color: #ff7a88; border-color: rgba(255, 71, 87, 0.35); position: relative; }
.xp-pill     { color: var(--accent); border-color: rgba(245, 183, 0, 0.35); }
.score-pop   { animation: bounce-big 0.35s ease; }
#timer-indicator.timer-ok     { color: var(--secondary); border-color: rgba(0, 180, 216, 0.35); }
#timer-indicator.timer-warn   { color: var(--warning);   border-color: rgba(245, 183, 0, 0.55); }
#timer-indicator.timer-frozen { color: #99f6ff; border-color: rgba(0, 220, 255, 0.75); background: rgba(0, 180, 216, 0.22); }
#timer-indicator.timer-danger { color: #fff; background: rgba(255, 71, 87, 0.85); border-color: #ff8a96; animation: pulse-danger 0.4s ease-in-out infinite alternate; }
@keyframes pulse-danger { 0% { transform: scale(1); } 100% { transform: scale(1.1); } }

.hearts-pips { display: inline-flex; gap: 2px; margin-left: 2px; }
.hearts-pips .pip { width: 4.5px; height: 4.5px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.hearts-pips .pip.pip-on { background: #ff4757; box-shadow: 0 0 5px rgba(255, 71, 87, 0.8); }
@media (max-width: 390px) {
  .hearts-pips { display: none; }
  .game-exit-btn { width: 29px; height: 29px; font-size: 0.88rem; }
}

.gain-heart { animation: bounce-big 0.45s; } .lose-heart { animation: shake 0.35s ease-in-out; }
.plus-one-heart { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 0.7rem; font-weight: 900; color: #ff7070; animation: floatUp 1s ease-out forwards; pointer-events: none; }
@keyframes floatUp { 0% { opacity: 1; transform: translateX(-50%) translateY(0); } 100% { opacity: 0; transform: translateX(-50%) translateY(-22px); } }
@keyframes bounce-big { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.18); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

#game-companion-wrap {
  position: relative; padding: 2px 14px 0; min-height: 54px;
  display: flex; align-items: center; flex-shrink: 0; z-index: 6;
}
.time-alert-banner {
  position: absolute; inset: 2px 14px; z-index: 9; display: none;
  align-items: center; justify-content: center; border-radius: var(--r-lg);
  background: linear-gradient(90deg, #c9184a, #ff4757, #c9184a); color: #fff;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; box-shadow: var(--glow-red);
}
.time-alert-banner.active { animation: alert-flash 0.42s ease-in-out infinite alternate; }
@keyframes alert-flash { 0% { filter: brightness(1); } 100% { filter: brightness(1.18); transform: scale(1.015); } }

.game-companion-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.unit-left-col { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.unit-title-pill { font-size: 11px; font-weight: 900; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 155px; }
.challenge-target-pill {
  font-size: 10px; font-weight: 900; color: #ffe380;
  background: rgba(245, 183, 0, 0.16); border: 1px solid rgba(245, 183, 0, 0.45);
  padding: 1px 8px; border-radius: 99px;
}

.mia-stage { position: relative; display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-bottom: -14px; }
.mia-game-emote {
  position: absolute; right: calc(100% + 6px); top: 40%;
  transform: translateY(-50%) scale(0.88); opacity: 0; pointer-events: none; white-space: nowrap;
  font-size: 10.5px; font-weight: 900; padding: 4px 9px; border-radius: 99px;
  background: rgba(24, 32, 58, 0.96); border: 1px solid var(--border-medium); color: var(--text-primary);
  box-shadow: var(--shadow-sm); transition: opacity 0.2s, transform 0.2s var(--ease-expo); z-index: 6;
}
.mia-game-emote.visible { opacity: 1; transform: translateY(-50%) scale(1); }
.mia-game-emote.emote-gold { border-color: rgba(245, 183, 0, 0.6); color: #ffe57a; }
.mia-game-emote.emote-cyan { border-color: rgba(0, 180, 216, 0.6); color: #8af3ff; }
.mia-game-emote.emote-pink { border-color: rgba(255, 110, 168, 0.65); color: #ffc6df; }
@media (max-width: 400px) { .mia-game-emote { display: none; } }

.mia-avatar-btn { background: none; border: none; padding: 0; cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent; }
.char-avatar {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  position: relative; background: var(--surface-elevated); box-shadow: var(--shadow-md);
  animation: mia-idle-bob 3.4s ease-in-out infinite;
}
@keyframes mia-idle-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
.char-avatar img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; display: block; z-index: 1; }
.mia-bond-svg { position: absolute; inset: 0; width: 56px; height: 56px; transform: rotate(-90deg); z-index: 2; pointer-events: none; }
.mia-bond-track { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 3; }
.mia-bond-fill  { fill: none; stroke: var(--mia-rose); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }

.char-avatar.mia-comfort { box-shadow: 0 0 16px rgba(176, 106, 255, 0.5); }
.char-avatar.mia-fever   { box-shadow: 0 0 22px rgba(245, 183, 0, 0.78); }
.char-avatar.mia-urgent  { animation: shake 0.35s ease-in-out infinite !important; box-shadow: var(--glow-red); }
.char-avatar.bounce-big  { animation: bounce-big 0.45s !important; }

#character-aura { position: absolute; inset: -5px; border-radius: 50%; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
#character-aura.on-fire { opacity: 1; box-shadow: 0 0 20px var(--accent), 0 0 36px #ff4757; }
.mia-shield-ring, .mia-frost-ring { position: absolute; inset: -4px; border-radius: 50%; border: 2.5px solid transparent; pointer-events: none; z-index: 3; }
.mia-shield-ring.active { border-color: #38e8ff; box-shadow: 0 0 14px rgba(56, 232, 255, 0.8); }
.mia-frost-ring.active  { border-color: #a5f3fc; box-shadow: 0 0 14px rgba(165, 243, 252, 0.85); }

.mia-shades, .mia-sweat, .mia-crown { position: absolute; z-index: 4; font-size: 14px; line-height: 1; transform: scale(0); opacity: 0; pointer-events: none; transition: transform 0.25s var(--ease-expo), opacity 0.2s; }
.mia-shades { top: -3px; right: -5px; background: var(--surface); border-radius: 50%; padding: 2px; border: 1.5px solid var(--accent); }
.mia-sweat  { bottom: 1px; right: -6px; }
.mia-crown  { top: -10px; left: 50%; transform: translateX(-50%) scale(0); }
.mia-shades.visible, .mia-sweat.visible { opacity: 1; transform: scale(1); }
.mia-crown.visible  { opacity: 1; transform: translateX(-50%) scale(1); }

.mia-hud-graphics {
  display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 99px;
  background: rgba(16, 22, 42, 0.9); border: 1px solid var(--border-subtle); margin-bottom: 10px;
}
.mia-mood-badge { font-size: 1.1rem; line-height: 1; }
.mia-mood-badge.glyph-pop { animation: glyph-pop 0.28s var(--ease-expo); }
@keyframes glyph-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.22); } 100% { transform: scale(1); } }

.mia-combo-bars { display: flex; align-items: flex-end; gap: 2.5px; height: 16px; }
.mia-combo-bars .cbar { width: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); transition: background 0.2s; }
.mia-combo-bars .cbar:nth-child(1) { height: 5px; } .mia-combo-bars .cbar:nth-child(2) { height: 8px; }
.mia-combo-bars .cbar:nth-child(3) { height: 11px; } .mia-combo-bars .cbar:nth-child(4) { height: 13px; }
.mia-combo-bars .cbar:nth-child(5) { height: 16px; }
.mia-combo-bars .cbar.on    { background: var(--secondary); box-shadow: 0 0 6px rgba(0, 180, 216, 0.6); }
.mia-combo-bars .cbar.fever { background: linear-gradient(180deg, #ffe54d, #ff4757); box-shadow: 0 0 8px rgba(255, 71, 87, 0.8); }

.mia-combo-tag { font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 12px; background: rgba(245, 183, 0, 0.2); color: var(--accent); }
.mia-combo-tag.fever { background: linear-gradient(135deg, #ff8c00, #ff4757); color: #fff; }
.mia-pet-particle { position: fixed; font-size: 1.25rem; pointer-events: none; z-index: 99999; animation: xp-float-up 0.9s ease-out forwards; }

/* Question Card Shell + Floating Ability Orbs */
.question-card-shell {
  position: relative; flex: 1 1 auto; min-height: 120px; margin: 0 14px 10px;
  display: flex; flex-direction: column;
}
#question-container {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  background: linear-gradient(165deg, #172242 0%, #0f1529 100%);
  border-radius: var(--r-xl); border: 1px solid var(--border-medium);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 0 rgba(0, 0, 0, 0.5), var(--shadow-md);
  overflow-y: auto; transition: border-color 0.2s, box-shadow 0.2s;
}
#question-container.boss-card-glow {
  border-color: rgba(245, 183, 0, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 232, 128, 0.35), 0 6px 0 rgba(0, 0, 0, 0.5), 0 0 32px rgba(245, 183, 0, 0.28);
}
#question-container.slide-out { animation: q-slide-out 0.15s ease forwards; }
#question-container.slide-in  { animation: q-slide-in 0.18s var(--ease-expo) forwards; }
#question-container.question-enter { animation: q-enter 0.25s var(--ease-expo) forwards; }
@keyframes q-slide-out { to { opacity: 0; transform: translateX(-34px) scale(0.97); } }
@keyframes q-slide-in  { from { opacity: 0; transform: translateX(30px) scale(0.97); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes q-enter     { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
#question-container.flash-correct { border-color: var(--success); box-shadow: 0 0 26px rgba(93, 230, 30, 0.45); }
#question-container.flash-wrong   { border-color: var(--error);   box-shadow: 0 0 26px rgba(255, 71, 87, 0.45); }

#question-meta-header {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 62px 8px 14px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.topic-chip { font-size: 11px; font-weight: 900; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-subtle); padding: 3px 10px; border-radius: 20px; }
.boss-pill { font-size: 10.5px; font-weight: 900; color: #1a1000; background: linear-gradient(135deg, #ffe54d, #f5b700); padding: 2px 8px; border-radius: 20px; }
.redemption-pill { font-size: 10.5px; font-weight: 900; color: #7ef9ff; background: rgba(0, 180, 216, 0.2); border: 1px solid rgba(0, 180, 216, 0.5); padding: 2px 8px; border-radius: 20px; }
.difficulty-stars { margin-left: auto; font-size: 12px; color: var(--warning); }

#question-text {
  font-size: clamp(1.12rem, 4.3vw, 1.38rem);
  font-weight: 800; color: var(--text-primary);
  line-height: 1.5; padding: 16px 18px 34px; margin: auto 0;
}

.powerups-floating-orbs {
  position: absolute; right: 12px; bottom: -14px; z-index: 8;
  display: flex; align-items: center; gap: 10px;
}
.powerup-orb {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(160deg, #273766, #11182e);
  border: 1.5px solid rgba(92, 155, 255, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 5px 0 rgba(0, 0, 0, 0.65), 0 6px 16px rgba(0, 0, 0, 0.6);
  display: grid; place-items: center; cursor: pointer;
  transition: transform var(--ease-fast), border-color 0.2s, box-shadow 0.2s;
}
.powerup-orb:active:not(:disabled) { transform: translateY(3px) scale(0.95); }
.powerup-orb:disabled { opacity: 0.35; cursor: not-allowed; filter: grayscale(65%); }
.powerup-orb.powerup-active { border-color: #38e8ff; box-shadow: 0 0 18px rgba(56, 232, 255, 0.78); }
.orb-icon { font-size: 1.25rem; line-height: 1; }
.orb-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 99px; background: var(--accent); color: #1a1000;
  font-size: 10.5px; font-weight: 900; display: grid; place-items: center;
  border: 2px solid var(--surface);
}

#bottom-action-zone { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 6px 14px 0; }
#answer-buttons.tf-grid,
#answer-buttons.mcq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer-btn { font-size: 1.15rem; padding: 15px 10px; border-radius: var(--r-xl); font-weight: 900; font-family: var(--font-display); min-height: 60px; margin: 0; }
.choice-stagger { animation: choice-in 0.2s var(--ease-expo) backwards; }
@keyframes choice-in { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.btn-wrong-shake { animation: shake 0.34s ease; }

.answer-btn.powered-up { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 5px 0 var(--primary-dark), 0 0 18px rgba(0, 180, 216, 0.28); }
.answer-yes { background: linear-gradient(170deg, #82eb42 0%, #5de61e 50%, #37a800 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 5px 0 #164c00; }
.answer-no  { background: linear-gradient(170deg, #ff7a88 0%, #ff4757 50%, #b81424 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 5px 0 #59000a; }
.answer-choice {
  background: linear-gradient(170deg, #243356 0%, #17213b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 5px 0 #090e1c;
  border: 1.5px solid rgba(92, 155, 255, 0.35); font-family: var(--font-primary);
  font-size: 0.96rem; min-height: 54px; padding: 10px 12px; justify-content: flex-start; text-align: left;
}
.choice-key { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: rgba(41, 121, 255, 0.26); color: #a8cbff; font-size: 0.78rem; font-weight: 900; flex-shrink: 0; }
.choice-text { line-height: 1.25; }
.correct-answer-highlight { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5.5px var(--success), 0 0 30px rgba(93, 230, 30, 0.65) !important; transform: scale(1.03) !important; }
.wrong-answer-dim { opacity: 0.28 !important; filter: grayscale(50%); }

.xp-fly-spark { position: fixed; font-size: 1rem; pointer-events: none; z-index: 99999; animation: xp-fly 0.68s var(--ease-expo) forwards; }
@keyframes xp-fly { 0% { opacity: 1; transform: translate(0, 0) scale(0.9); } 100% { opacity: 0; transform: translate(var(--tx, 0px), var(--ty, -220px)) scale(0.5); } }

/* ==========================================================================
   WRONG ANSWER CURTAIN (Floating Mia Coach Portrait)
   ========================================================================== */

#wrong-answer-curtain {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%) translateY(115%);
  width: 100%; max-width: 540px; z-index: 999990; pointer-events: none;
  transition: transform 0.26s var(--ease-expo); padding-bottom: env(safe-area-inset-bottom);
}
#wrong-answer-curtain.curtain-visible { transform: translateX(-50%) translateY(0); pointer-events: auto; }
.curtain-inner {
  position: relative; background: linear-gradient(180deg, #1b2238 0%, #101524 100%);
  border: 1px solid rgba(255, 255, 255, 0.14); border-bottom: none;
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  box-shadow: 0 -2px 0 rgba(255, 110, 168, 0.55), 0 -18px 46px rgba(0, 0, 0, 0.75);
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.curtain-header { display: flex; align-items: center; gap: 12px; }
.curtain-avatar-wrap {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  border: 2.5px solid var(--mia-rose); box-shadow: var(--glow-rose); margin-top: -22px; background: var(--surface);
}
.curtain-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.curtain-header-text { flex: 1; min-width: 0; }
.curtain-encouragement { font-family: var(--font-display); font-size: 1.02rem; color: #ffd9e8; line-height: 1.25; margin-bottom: 4px; }
.curtain-topic-pill { display: inline-block; font-size: 11px; font-weight: 900; color: #a5f3fc; background: rgba(0, 180, 216, 0.16); border: 1px solid rgba(0, 180, 216, 0.4); border-radius: 20px; padding: 2px 10px; }
.curtain-answer-box { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-medium); border-radius: var(--r-lg); padding: 12px 14px; }
.curtain-correct-label { font-size: 0.65rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-tertiary); margin-bottom: 4px; }
.curtain-correct-answer { font-size: 1.08rem; font-weight: 900; color: #fff; background: rgba(93, 230, 30, 0.14); border: 1.5px solid rgba(93, 230, 30, 0.48); border-radius: var(--r-md); padding: 6px 12px; display: inline-block; }
.curtain-answer-note { margin: 8px 0 0; font-size: 0.86rem; font-weight: 700; color: var(--text-secondary); line-height: 1.4; }
.coach-continue-btn { width: 100%; padding: 13px; border: none; border-radius: var(--r-lg); font-size: 1rem; font-weight: 900; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--primary-light), var(--primary)); box-shadow: 0 4px 0 var(--primary-dark); }

/* ==========================================================================
   PAYWALL (Plans + Parent Pay + Referral Unlock)
   ========================================================================== */

#paywall { justify-content: flex-start; align-items: center; text-align: center; gap: 10px; padding: var(--space-4); }
.paywall-badge { font-size: 10px; font-weight: 900; letter-spacing: 0.12em; color: #1a1000; background: var(--accent); padding: 3px 12px; border-radius: 99px; margin-top: 4px; }
.paywall-icon { font-size: 52px; animation: mia-breathe 2.6s ease-in-out infinite; }
.paywall-subtitle { margin: 0; font-size: 0.88rem; }

.paywall-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin: 4px 0; }
.plan-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 14px 8px 11px; border-radius: var(--r-xl); cursor: pointer;
  background: var(--surface-elevated); border: 1.5px solid var(--border-medium); color: var(--text-primary);
  transition: transform var(--ease-fast), border-color 0.2s, box-shadow 0.2s;
}
.plan-card strong { font-family: var(--font-display); font-size: 1.15rem; }
.plan-card small  { font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.plan-card.plan-selected { border-color: var(--accent); background: rgba(245, 183, 0, 0.14); box-shadow: var(--glow-gold); transform: translateY(-2px); }
.plan-save-tag, .plan-trial-tag { position: absolute; top: -9px; font-size: 9px; font-weight: 900; padding: 2px 8px; border-radius: 99px; letter-spacing: 0.05em; }
.plan-save-tag  { background: var(--accent); color: #1a1000; }
.plan-trial-tag { background: var(--secondary); color: #041820; }

.paywall-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; list-style: none; width: 100%; }
.paywall-grid li { display: flex; align-items: center; gap: 8px; text-align: left; background: var(--surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: 9px 10px; font-size: 12px; font-weight: 700; }
.feature-emoji { font-size: 1.2rem; }

.paywall-referral-card {
  width: 100%; display: flex; flex-direction: column; gap: 8px;
  padding: 11px 12px; border-radius: var(--r-xl);
  background: rgba(93, 230, 30, 0.1); border: 1.5px solid rgba(93, 230, 30, 0.45);
  text-align: left;
}
.ref-card-text { display: flex; flex-direction: column; gap: 2px; }
.ref-card-text strong { font-size: 13.5px; color: #a7ff83; }
.ref-card-text small  { font-size: 11.5px; color: var(--text-secondary); }
.ref-card-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.btn-ref-share { padding: 9px 12px; border-radius: var(--r-md); border: none; cursor: pointer; background: #5de61e; color: #0d2b00; font-weight: 900; font-size: 13px; }
.btn-ref-check { padding: 9px 12px; border-radius: var(--r-md); border: 1px solid rgba(93, 230, 30, 0.45); background: rgba(255, 255, 255, 0.06); color: #fff; font-weight: 800; font-size: 12.5px; cursor: pointer; }
.paywall-disclaimer { font-size: 11.5px; color: var(--text-tertiary); margin: 0; }

/* ==========================================================================
   END SCREEN
   ========================================================================== */

#end-screen { text-align: center; gap: 10px; padding: var(--space-4); }
.subject-toggle-bar { display: flex; width: calc(100% + var(--space-4) * 2); margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) 6px; border-bottom: 1px solid var(--border-subtle); background: rgba(255, 255, 255, 0.03); }
.subject-toggle-bar .tab-btn { flex: 1; padding: 12px 8px; background: none; border: none; font-size: 14px; font-weight: 900; color: var(--text-tertiary); cursor: pointer; border-bottom: 2px solid transparent; }
.subject-toggle-bar .tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); background: rgba(41, 121, 255, 0.08); }

.end-challenge-banner { padding: 10px 12px; border-radius: var(--r-lg); font-size: 13px; font-weight: 800; }
.end-challenge-banner.chal-won  { background: rgba(93, 230, 30, 0.16); border: 1.5px solid rgba(93, 230, 30, 0.6); color: #b5ff94; }
.end-challenge-banner.chal-lost { background: rgba(245, 183, 0, 0.15); border: 1.5px solid rgba(245, 183, 0, 0.55); color: #ffe380; }

.end-stars-showcase { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 4px 0; }
.end-stars-row { display: flex; align-items: flex-end; gap: 10px; }
.end-star { font-size: 2.2rem; color: rgba(255, 255, 255, 0.14); } .end-star-center { font-size: 2.9rem; }
.end-star.star-earned { color: var(--accent); text-shadow: 0 0 18px rgba(245, 183, 0, 0.8); }
.end-star.star-pop { animation: star-pop-in 0.45s var(--ease-expo) forwards; }
@keyframes star-pop-in { 0% { transform: scale(0.3) rotate(-20deg); } 65% { transform: scale(1.22); } 100% { transform: scale(1); } }
.end-star-caption { font-size: 12px; font-weight: 800; color: var(--accent); margin: 0; }
.end-nearmiss-banner { padding: 9px 12px; border-radius: var(--r-lg); background: rgba(245, 183, 0, 0.15); border: 1.5px solid rgba(245, 183, 0, 0.55); color: #ffe380; font-size: 13px; font-weight: 900; }

.end-mia-debrief { display: flex; align-items: center; gap: 12px; text-align: left; background: rgba(255, 110, 168, 0.09); border: 1px solid rgba(255, 110, 168, 0.32); border-radius: var(--r-xl); padding: 11px 14px; }
.debrief-mia { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; cursor: pointer; border: 2px solid var(--mia-rose); animation: mia-idle-bob 3s ease-in-out infinite; }
.debrief-opener { font-family: var(--font-display); font-size: 15px; color: #ffd4e7; }
.debrief-body   { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); }
.debrief-cta    { font-size: 12px; font-weight: 800; color: var(--accent); margin-top: 2px; }

.btn-container { display: flex; flex-direction: column; gap: 6px; }
.end-share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 14px; }
#unit-summary-container, .end-perf-combo, #achievements-container { background: var(--surface-elevated); border: 1px solid var(--border-medium); padding: var(--space-4); border-radius: var(--r-xl); text-align: left; }
#unit-summary-container h3, .end-perf-combo h3, #achievements-container h3 { text-align: center; font-size: 0.78rem; font-weight: 900; margin-bottom: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--font-primary); }
.xp-ring { width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; position: relative; margin: 0 auto 10px; }
.xp-ring-inner { position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
#final-xp-value { font-size: 2.2rem; font-weight: 900; font-family: var(--font-display); color: var(--accent); line-height: 1; }
.xp-label { font-size: 10px; font-weight: 900; color: var(--text-tertiary); text-transform: uppercase; }
#xp-buildup-list { list-style: none; font-size: 0.84rem; font-weight: 700; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; }
#xp-buildup-list li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--border-subtle); }
#xp-buildup-list li:last-child { color: var(--accent); font-weight: 900; border: none; }
#personal-best-container p { text-align: center; margin: 8px 0 0; font-size: 0.85rem; }
.new-high-score { color: var(--accent); text-align: center; margin: 4px 0 0; }
#gauge-and-difficulty-container { display: flex; gap: 10px; margin-top: 10px; }
#accuracy-gauge-container, #difficulty-meter-container { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.03); padding: 8px; border-radius: var(--r-lg); }
#accuracy-gauge-container p, #difficulty-meter-container p { font-size: 0.68rem; font-weight: 800; color: var(--text-tertiary); margin: 4px 0 0; text-transform: uppercase; }
#accuracy-gauge { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; position: relative; background: conic-gradient(var(--gauge-color, var(--success)) calc(var(--value, 0) * 1%), rgba(255, 255, 255, 0.06) 0); }
#accuracy-gauge::before { content: ""; position: absolute; width: 50px; height: 50px; background: var(--surface-secondary); border-radius: 50%; }
#accuracy-gauge-value { position: relative; font-weight: 900; font-size: 0.92rem; }
#difficulty-meter { font-size: 1.3rem; }
#topic-performance-chart { width: 100%; }
.ps-mini-focus-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.ps-mini-topic { width: 120px; font-size: 11px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-mini-bar { flex: 1; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ps-mini-fill { height: 100%; background: var(--primary); }
.ps-mini-pct { width: 34px; font-size: 11px; font-weight: 900; text-align: right; }

#trophy-wall { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.achievement-medal { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; background: var(--surface-secondary); padding: 8px 6px; border-radius: var(--r-lg); width: 90px; border: 1px solid var(--border-medium); }
.achievement-medal.newly-unlocked { width: 100%; flex-direction: row; text-align: left; gap: 10px; border-color: var(--accent); background: rgba(245, 183, 0, 0.1); }
.achievement-medal.not-yet-unlocked { opacity: 0.4; filter: grayscale(80%); }
.achievement-medal-icon { font-size: 1.9rem; }
.achievement-medal-text h4 { font-size: 0.74rem; margin: 0; } .achievement-medal-text p { font-size: 0.62rem; margin: 0; }

/* ==========================================================================
   FLOATING GAME-FIRST HUB / DASHBOARD
   ========================================================================== */

#progress-screen { padding: 12px 0 24px; gap: 8px; }
#progress-screen.celebratory { border-color: rgba(245, 183, 0, 0.42); }

.ps-top-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; gap: 8px; }
.ps-name-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 99px; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-medium);
}
#ps-name { font-family: var(--font-display); font-size: 1.05rem; color: var(--text-primary); }
.ps-edit-pencil { font-size: 11px; opacity: 0.7; }
.ps-top-right { display: flex; align-items: center; gap: 6px; }
.ps-save-status { font-size: 10px; font-weight: 900; padding: 5px 9px; border-radius: 20px; border: 1px solid var(--border-subtle); background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); cursor: pointer; }
.ps-save-status.saved  { border-color: rgba(93, 230, 30, 0.35); color: #8ff56a; }
.ps-save-status.local  { border-color: rgba(0, 180, 216, 0.35); color: #6ae2ff; }
.ps-save-status.saving { border-color: rgba(245, 183, 0, 0.45); color: var(--accent); }
.ps-save-status.error  { border-color: rgba(255, 71, 87, 0.45); color: #ff8090; }

.ps-mia-hero { display: flex; align-items: center; gap: 14px; padding: 6px 16px 2px; }
.ps-mia-stage-wrap { position: relative; width: 96px; height: 96px; flex-shrink: 0; display: grid; place-items: center; }
.ps-hero-bond-svg { position: absolute; inset: 0; width: 96px; height: 96px; transform: rotate(-90deg); pointer-events: none; z-index: 2; }
#ps-mia {
  width: 78px; height: 78px; border-radius: 50%; object-fit: cover; cursor: pointer;
  z-index: 1; box-shadow: var(--glow-rose);
  animation: mia-breathe 3.2s ease-in-out infinite;
}
.ps-mia-hero.bond-halo #ps-mia  { box-shadow: 0 0 24px rgba(255, 110, 168, 0.75); }
.ps-mia-hero.bond-royal #ps-mia { box-shadow: 0 0 28px rgba(245, 183, 0, 0.8); }
.ps-mia-pedestal {
  position: absolute; bottom: 2px; width: 58px; height: 10px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 110, 168, 0.45), transparent 72%);
  pointer-events: none;
}
.ps-bond-badge {
  position: absolute; bottom: -5px; z-index: 3;
  font-size: 9.5px; font-weight: 900; color: #ffe6f2;
  background: #231838; border: 1px solid rgba(255, 110, 168, 0.55);
  padding: 1px 8px; border-radius: 99px; white-space: nowrap;
}

.ps-mia-speech-card {
  position: relative; flex: 1; text-align: left; cursor: pointer;
  background: linear-gradient(145deg, rgba(255, 110, 168, 0.14), rgba(41, 121, 255, 0.12));
  border: 1px solid rgba(255, 110, 168, 0.38); border-radius: var(--r-xl);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--shadow-sm);
}
.ps-mia-speech-card::before {
  content: ''; position: absolute; left: -7px; top: 28px;
  width: 12px; height: 12px; transform: rotate(45deg);
  background: #201b36; border-left: 1px solid rgba(255, 110, 168, 0.38); border-bottom: 1px solid rgba(255, 110, 168, 0.38);
}
.ps-greeting { font-size: 0.65rem; font-weight: 900; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.09em; margin: 0; }
.ps-mia-speech { margin: 0; font-size: 0.85rem; font-weight: 800; color: var(--text-primary); line-height: 1.35; }
.ps-speech-hint { font-size: 9.5px; font-weight: 800; color: #ffb7d5; opacity: 0.85; }

.ps-hud-strip { padding: 0 16px; display: flex; flex-direction: column; gap: 6px; }
#ps-level-row { display: flex; align-items: center; gap: 8px; }
#ps-level-badge { font-size: 0.7rem; font-weight: 900; color: var(--accent); background: rgba(245, 183, 0, 0.15); border: 1px solid rgba(245, 183, 0, 0.45); padding: 2px 9px; border-radius: 20px; flex-shrink: 0; }
#ps-level-bar-wrap { flex: 1; min-width: 60px; height: 7px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
#ps-level-bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width 0.5s ease; }
#ps-xp-to-next { font-size: 0.66rem; font-weight: 800; color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }

#ps-pulse-row {
  display: flex; align-items: center; background: rgba(255, 255, 255, 0.035);
  border-radius: var(--r-lg); border: 1px solid var(--border-subtle); padding: 7px 6px;
}
.ps-pulse-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.ps-pulse-acc-item { flex-direction: row; justify-content: center; gap: 6px; }
.ps-pulse-acc-item > div { display: flex; flex-direction: column; align-items: flex-start; }
.ps-pulse-val { font-size: 1.05rem; font-weight: 900; font-family: var(--font-display); line-height: 1.05; }
.ps-pulse-label { font-size: 0.55rem; font-weight: 900; color: var(--text-tertiary); text-transform: uppercase; }
.ps-pulse-divider { width: 1px; height: 22px; background: var(--border-subtle); }
.ps-pulse-fire .ps-pulse-val  { color: var(--warning); }
.ps-pulse-great .ps-pulse-val { color: var(--success); }
.ps-pulse-warn .ps-pulse-val  { color: var(--error); }

.ps-ring {
  display: block; width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--ring-color, #00b4d8) calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.08) 0);
  -webkit-mask: radial-gradient(circle, transparent 6.5px, #000 7.5px);
          mask: radial-gradient(circle, transparent 6.5px, #000 7.5px);
}

.ps-guest-banner { margin: 0 16px; padding: 9px 12px; border-radius: var(--r-lg); background: rgba(0, 180, 216, 0.14); border: 1px solid rgba(0, 180, 216, 0.38); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ps-guest-text { display: flex; flex-direction: column; } .ps-guest-text strong { font-size: 12.5px; } .ps-guest-text small { font-size: 11px; color: var(--text-secondary); }
.ps-guest-btn { padding: 6px 14px; border-radius: var(--r-md); border: none; background: var(--secondary); color: #041820; font-weight: 900; font-size: 12px; cursor: pointer; }

.ps-event-strip {
  margin: 0 16px; padding: 6px 12px; border-radius: 99px;
  background: rgba(245, 183, 0, 0.08); border: 1px solid rgba(245, 183, 0, 0.25);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10.5px; font-weight: 800; color: var(--text-secondary);
}
.event-season-pill b, .event-reset-pill b { color: var(--accent); font-variant-numeric: tabular-nums; }

.ps-quest-stage { padding: 4px 16px; display: flex; flex-direction: column; gap: 8px; }
.hub-subject-pills {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px;
  background: var(--surface-secondary); border-radius: var(--r-lg); border: 1px solid var(--border-subtle);
}
.hub-subj-pill {
  padding: 8px; border: none; border-radius: var(--r-md); background: none;
  color: var(--text-tertiary); font-size: 13.5px; font-weight: 900; cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.hub-subj-pill.active {
  background: linear-gradient(135deg, rgba(41, 121, 255, 0.32), rgba(0, 180, 216, 0.22));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(92, 155, 255, 0.45);
}

.ut-header-row { display: flex; justify-content: space-between; align-items: center; padding: 0 2px; }
.ut-theme-label { font-family: var(--font-display); font-size: 0.92rem; color: var(--text-primary); }
.ut-star-tally  { font-size: 11px; font-weight: 900; color: var(--accent); background: rgba(245, 183, 0, 0.14); padding: 2px 8px; border-radius: 99px; }

.ps-unit-track {
  display: flex; align-items: center; gap: 10px;
  overflow-x: auto; scroll-snap-type: x proximity; padding: 14px 4px 6px;
  scrollbar-width: none;
}
.ps-unit-track::-webkit-scrollbar { display: none; }

.ut-node {
  position: relative; flex: 0 0 auto; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer; padding: 2px;
}
.ut-mia-pin { position: absolute; top: -15px; font-size: 13px; animation: mia-idle-bob 2s ease-in-out infinite; }
.ut-circle {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-display); font-size: 1.05rem;
  background: var(--surface-elevated); color: var(--text-secondary);
  border: 2px solid var(--border-medium); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
  transition: transform var(--ease-fast), border-color 0.2s;
}
.ut-node:active .ut-circle { transform: translateY(2px); }
.ut-node.ut-current .ut-circle {
  background: linear-gradient(155deg, var(--primary-light), var(--primary));
  color: #fff; border-color: #fff; box-shadow: 0 4px 0 var(--primary-dark), var(--glow-blue);
  transform: scale(1.08);
}
.ut-node.ut-mastered .ut-circle { border-color: var(--accent); }
.ut-node.ut-locked .ut-circle   { opacity: 0.72; font-size: 0.95rem; }
.ut-stars { font-size: 9px; letter-spacing: 1px; }
.ut-star-on  { color: var(--accent); }
.ut-star-off { color: rgba(255, 255, 255, 0.16); }

.ps-play-dock { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.hub-play-btn { margin: 0; font-size: 16px; padding: 14px 16px; }
.hub-blitz-btn { margin: 0; width: auto; min-width: 88px; flex-direction: column; gap: 0; padding: 8px 14px; font-size: 14px; }
.hub-blitz-btn small { font-size: 10px; font-weight: 800; opacity: 0.9; }

.ps-bounties-row { display: flex; flex-wrap: wrap; gap: 6px; }
.bounty-pill { flex: 1 1 auto; padding: 8px 12px; border-radius: var(--r-lg); font-size: 12px; font-weight: 900; cursor: pointer; text-align: center; border: 1.5px solid; }
.bounty-mistakes { background: rgba(255, 71, 87, 0.14); border-color: rgba(255, 71, 87, 0.5); color: #ffb8c2; }
.bounty-referral { background: rgba(93, 230, 30, 0.12); border-color: rgba(93, 230, 30, 0.48); color: #a7ff83; }

.ps-hub-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin: 4px 16px; padding: 4px;
  border-radius: var(--r-lg); background: var(--surface-secondary); border: 1px solid var(--border-subtle);
}
.hub-tab-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 6px; border: none; border-radius: var(--r-md);
  background: none; color: var(--text-tertiary); font-size: 12.5px; font-weight: 900; cursor: pointer;
}
.hub-tab-btn.hub-tab-active {
  background: rgba(41, 121, 255, 0.22); color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(92, 155, 255, 0.35);
}
.tab-claim-badge {
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--accent); color: #1a1000; font-size: 10px; font-weight: 900;
  display: inline-grid; place-items: center; animation: bounce-big 1.4s infinite;
}

.hub-tab-panel { display: flex; flex-direction: column; gap: 8px; }
.tab-panel-enter { animation: tab-in 0.2s var(--ease-expo); }
@keyframes tab-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.ps-section { padding: 4px 16px; }
.ps-section-label { font-size: 0.65rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-tertiary); margin-bottom: 6px; }
.ps-card { background: var(--surface-elevated); border: 1px solid var(--border-medium); border-radius: var(--r-xl); margin-bottom: 8px; overflow: hidden; }

.ps-improve-topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.improve-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 8px 9px; border-radius: var(--r-md); cursor: pointer; border: 1px solid;
  background: rgba(255, 255, 255, 0.04); color: var(--text-primary); text-align: left;
}
.improve-chip:active { transform: scale(0.96); }
.improve-chip .chip-top  { display: flex; width: 100%; align-items: center; justify-content: space-between; font-size: 11px; }
.improve-chip .chip-name { font-size: 11px; font-weight: 800; line-height: 1.25; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.improve-chip .chip-pct  { font-size: 11px; font-weight: 900; }
.chip-red   { border-color: rgba(255, 71, 87, 0.5);  background: rgba(255, 71, 87, 0.12); }  .chip-red .chip-pct   { color: #ff8a96; }
.chip-amber { border-color: rgba(245, 183, 0, 0.5);  background: rgba(245, 183, 0, 0.12); }  .chip-amber .chip-pct { color: var(--accent); }
.chip-green { border-color: rgba(93, 230, 30, 0.45); background: rgba(93, 230, 30, 0.1); }   .chip-green .chip-pct { color: var(--success); }
.chip-new   { border-color: rgba(0, 180, 216, 0.5);  background: rgba(0, 180, 216, 0.12); }  .chip-new .chip-pct   { color: var(--secondary); }

.ps-quests-card { padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.dq-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-subtle); }
.dq-row.dq-ready { border-color: rgba(245, 183, 0, 0.55); background: rgba(245, 183, 0, 0.1); }
.dq-icon { font-size: 1.25rem; } .dq-body { flex: 1; min-width: 0; }
.dq-top { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.dq-label { font-size: 12px; font-weight: 800; } .dq-reward { font-size: 10.5px; font-weight: 900; color: var(--accent); white-space: nowrap; }
.dq-bar-wrap { display: flex; align-items: center; gap: 6px; }
.dq-bar { flex: 1; height: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.dq-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); }
.dq-cnt { font-size: 10px; font-weight: 900; color: var(--text-tertiary); }
.dq-claim-btn { padding: 6px 11px; border-radius: 10px; border: none; background: var(--accent); color: #1a1000; font-weight: 900; font-size: 12px; cursor: pointer; box-shadow: 0 3px 0 var(--accent-dark); }
.dq-lock-pill { font-size: 10.5px; font-weight: 900; color: var(--text-tertiary); }
.dq-all-done { font-size: 12.5px; font-weight: 800; color: #8ff56a; text-align: center; padding: 6px 4px; }

.ps-heatmap-card { padding: 11px; display: flex; flex-direction: column; gap: 8px; }
.hm-subject-toggle { display: flex; gap: 6px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 3px; }
.hm-tab { flex: 1; padding: 6px 8px; background: none; border: none; border-radius: 8px; font-size: 12px; font-weight: 800; color: var(--text-tertiary); cursor: pointer; }
.hm-tab.hm-tab-active { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); }
.ps-heatmap-grid { display: flex; flex-direction: column; gap: 4px; }
.hm-row { display: flex; align-items: center; gap: 8px; width: 100%; background: rgba(255, 255, 255, 0.025); border: 1px solid transparent; border-radius: 9px; padding: 5px 6px; text-align: left; color: inherit; cursor: pointer; }
.hm-row.hm-clickable:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--border-medium); }
.hm-row-label { display: flex; align-items: center; gap: 5px; width: 146px; flex-shrink: 0; min-width: 0; }
.hm-topic-name { font-size: 11px; font-weight: 800; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-rank-pill { font-size: 8.5px; font-weight: 900; text-transform: uppercase; padding: 1px 5px; border-radius: 6px; flex-shrink: 0; }
.rank-gold   { background: rgba(245, 183, 0, 0.22); color: #ffe380; }
.rank-silver { background: rgba(0, 180, 216, 0.2);  color: #8af3ff; }
.rank-bronze { background: rgba(255, 159, 67, 0.2); color: #ffbe76; }
.rank-rookie { background: rgba(255, 71, 87, 0.2);  color: #ff8a96; }

.hm-row-bar-wrap { flex: 1; height: 17px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.hm-row-bar { height: 100%; border-radius: 4px; display: flex; align-items: center; justify-content: flex-end; padding-right: 5px; font-size: 9px; font-weight: 900; min-width: 18px; }
.hm-row-bar.hbar-weak   { background: #d63042; color: #fff; }
.hm-row-bar.hbar-fair   { background: #e0a800; color: #1a1000; }
.hm-row-bar.hbar-good   { background: #009fc2; color: #fff; }
.hm-row-bar.hbar-strong { background: #2979ff; color: #fff; }
.hm-row-pct { font-size: 11px; font-weight: 900; width: 32px; text-align: right; }
.hm-row-pct.pct-weak { color: #ff8090; } .hm-row-pct.pct-fair { color: var(--accent); } .hm-row-pct.pct-good { color: var(--secondary); } .hm-row-pct.pct-strong { color: var(--primary-light); }
.hm-row-go { font-size: 14px; font-weight: 900; color: var(--text-tertiary); }
.hm-empty { text-align: center; padding: 12px; font-size: 12.5px; color: var(--text-tertiary); }

.hm-explore-wrap { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-subtle); }
.hm-explore-title { font-size: 10.5px; font-weight: 900; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.hm-explore-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hm-explore-chip { padding: 5px 10px; border-radius: 99px; cursor: pointer; background: rgba(0, 180, 216, 0.12); border: 1px solid rgba(0, 180, 216, 0.35); color: #9ff0ff; font-size: 11px; font-weight: 800; }
.ps-subject-compare-sub { font-size: 0.74rem; font-weight: 700; color: var(--text-tertiary); margin: 6px 0 0; text-align: center; }

.ps-stats-compact { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.ps-sc-item { background: var(--surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: 8px 4px; text-align: center; display: flex; flex-direction: column; gap: 1px; }
.ps-sc-item strong { font-family: var(--font-display); font-size: 1.12rem; color: var(--text-primary); line-height: 1.1; }
.ps-sc-item span   { font-size: 0.58rem; font-weight: 800; text-transform: uppercase; color: var(--text-tertiary); }

#ps-calendar-container { padding: 12px; margin-bottom: 10px; }
.ps-cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-subtle); }
.ps-cal-month { font-family: var(--font-display); font-size: 0.94rem; }
.ps-cal-count { font-size: 0.74rem; font-weight: 800; color: var(--accent); background: rgba(245, 183, 0, 0.12); padding: 2px 8px; border-radius: 14px; }
.ps-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.ps-cal-dname { font-size: 0.6rem; font-weight: 900; color: var(--text-tertiary); }
.ps-cal-day { aspect-ratio: 1; display: grid; place-items: center; font-size: 0.74rem; font-weight: 700; color: var(--text-secondary); border-radius: 7px; background: rgba(255, 255, 255, 0.02); }
.ps-cal-day.ps-cal-active { background: var(--primary); color: #ffffff; font-weight: 900; }
.ps-cal-day.ps-cal-today  { border: 2px solid var(--accent); color: var(--accent); font-weight: 900; }
.ps-cal-day.ps-cal-active.ps-cal-today { background: var(--primary); color: #ffffff; border: 2px solid #ffe54d; box-shadow: 0 0 10px rgba(245, 183, 0, 0.45); }

.ps-badges-card { padding: 12px; }
.ps-badges-header { font-family: var(--font-display); font-size: 0.95rem; margin-bottom: 8px; color: var(--text-primary); }
.ps-badges-grid { display: flex; flex-direction: column; gap: 7px; }
.ps-badge-pill { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: rgba(255, 255, 255, 0.025); }
.ps-badge-pill.ps-badge-unlocked { background: rgba(245, 183, 0, 0.08); border-color: rgba(245, 183, 0, 0.32); }
.ps-badge-pill.ps-badge-locked { opacity: 0.72; }
.ps-badge-icon { font-size: 1.3rem; } .ps-badge-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ps-badge-label { font-size: 0.84rem; font-weight: 900; color: var(--accent); }
.ps-badge-locked .ps-badge-label { color: var(--text-secondary); }
.ps-badge-desc { font-size: 0.7rem; color: var(--text-secondary); }
.ps-badge-prog { width: 100%; height: 4px; background: rgba(255, 255, 255, 0.07); border-radius: 3px; overflow: hidden; margin-top: 2px; }
.ps-badge-prog > div { height: 100%; background: var(--primary-light); }

/* ==========================================================================
   SETTINGS & FLOATING GLASS BOTTOM NAV DOCK
   ========================================================================== */

#settings-panel { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); z-index: 99998; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity 0.2s; }
#settings-panel.settings-panel-visible { opacity: 1; }
.settings-content { width: 100%; max-width: 540px; background: var(--surface); border-top: 1px solid var(--border-medium); border-radius: var(--r-2xl) var(--r-2xl) 0 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.settings-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }
.settings-close-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-subtle); background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); cursor: pointer; }
.settings-section-label { font-size: 0.64rem; font-weight: 900; letter-spacing: 0.1em; color: var(--text-tertiary); margin: 12px 0 4px; }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-subtle); gap: 10px; }
.settings-item-info { display: flex; align-items: center; gap: 10px; } .settings-item-title { font-size: 0.9rem; font-weight: 800; }
.settings-name-input { width: 130px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border-medium); background: rgba(255, 255, 255, 0.06); color: var(--text-primary); font-weight: 800; text-align: right; }
.settings-sync-btn { padding: 6px 12px; border-radius: 10px; border: 1px solid rgba(93, 230, 30, 0.45); background: rgba(93, 230, 30, 0.14); color: #8ff56a; font-weight: 900; font-size: 12px; cursor: pointer; }
.settings-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; } .switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255, 255, 255, 0.12); transition: 0.2s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
input:checked + .slider { background: var(--primary); } input:checked + .slider:before { transform: translateX(20px); }

#bottom-nav {
  position: fixed; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 516px; height: 64px; z-index: 9990;
  display: flex; justify-content: center; padding: 4px 10px;
  background: rgba(16, 22, 42, 0.88);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-medium); border-radius: 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 32px rgba(0, 0, 0, 0.72);
}
.bottom-nav-inner { width: 100%; display: flex; justify-content: space-around; align-items: center; }
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer; flex: 1; max-width: 110px;
  position: relative; padding: 4px; border-radius: var(--r-md); outline: none;
}
.nav-btn:focus-visible { outline: 2px solid var(--secondary); }
.nav-icon { font-size: 1.32rem; line-height: 1; }
.nav-label { font-size: 9.5px; font-weight: 800; color: var(--text-tertiary); text-transform: uppercase; }
.nav-btn.active .nav-label { color: var(--primary-light); }
.nav-active-bar { position: absolute; bottom: 0; width: 22px; height: 3px; border-radius: 3px; background: var(--primary-light); transform: scaleX(0); transition: transform 0.2s; }
.nav-btn.active .nav-active-bar { transform: scaleX(1); }

/* Micro Animations & Floats */
.emoji-3d { display: inline-block; line-height: 1; }
.emoji-xl { font-size: 54px; }
.emoji-pop { display: inline-block; animation: star-pop-in 0.5s ease backwards; }
.emoji-pop-d1 { animation-delay: 0.1s; } .emoji-pop-d2 { animation-delay: 0.2s; }
.hud-beat { animation: hud-beat 2.5s infinite; }
@keyframes hud-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } }

.xp-float { position: fixed; font-size: 1.15rem; font-weight: 900; font-family: var(--font-display); pointer-events: none; z-index: 99999; animation: xp-float-up 1s ease-out forwards; }
@keyframes xp-float-up { 0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.8); } 30% { opacity: 1; transform: translateX(-50%) translateY(-18px) scale(1.18); } 100% { opacity: 0; transform: translateX(-50%) translateY(-56px) scale(0.9); } }
.quick-praise-message { position: fixed; top: 26%; left: 50%; transform: translateX(-50%); font-family: var(--font-display); font-size: 1.7rem; font-weight: 900; color: var(--success); pointer-events: none; z-index: 99998; animation: quick-praise-pop 0.75s ease-out forwards; }
@keyframes quick-praise-pop { 0% { opacity: 0; transform: translateX(-50%) scale(0.5); } 35% { opacity: 1; transform: translateX(-50%) scale(1.15); } 100% { opacity: 0; transform: translateX(-50%) translateY(-28px); } }
@keyframes float-up { 0% { opacity: 1; transform: translateY(0) scale(0.85); } 100% { opacity: 0; transform: translateY(-60px) scale(1.1); } }

@media (max-height: 680px) {
  .landing-mia-img { width: 68px; height: 68px; }
  .char-avatar { width: 48px; height: 48px; }
  .char-avatar img { width: 38px; height: 38px; }
  .mia-bond-svg { width: 48px; height: 48px; }
  .answer-btn { min-height: 50px; padding: 11px 8px; }
  #question-text { font-size: 1.04rem; padding: 12px 14px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}