/* main.css — Not Today · Light Theme Redesign */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Syne:wght@700;800&family=Inter:wght@500;600;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Base */
  --bg:        #F5F4EF;
  --surface:   #FFFFFF;
  --surface-2: #F0EDE6;
  --border:    #E5E0D6;
  --border-2:  #D5CEBF;

  /* Text */
  --text-1: #1C1917;
  --text-2: #6B6460;
  --text-3: #A09890;

  /* Category */
  --hy:       #D85C30;
  --hy-light: #FFF0EA;
  --ho:       #C85070;
  --ho-light: #FFF0F4;
  --hi:       #3A6090;
  --hi-light: #EEF3FF;

  /* Feedback */
  --ok:   #3A9E6A;
  --ok-bg: #EDF7F2;
  --err:  #C84040;
  --err-bg: #FDF0F0;

  /* Inclusive note */
  --teal: #3A8E7A;
  --teal-bg: #EEF8F5;

  /* Fonts */
  --display: 'Syne', sans-serif;
  --body:    'Space Grotesk', sans-serif;

  /* Radii */
  --r-sm:   10px;
  --r-md:   16px;
  --r-lg:   24px;
  --r-xl:   32px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.11), 0 3px 8px rgba(0,0,0,0.06);

  /* Motion */
  --fast: 160ms ease;
  --med:  300ms ease;
  --slow: 480ms cubic-bezier(0.22, 1, 0.36, 1);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #E8E5DC;
  color: var(--text-1);
  font-family: var(--body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* ─── MUTE BUTTON ─────────────────────────────────────────── */

#mute-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1000;
  width: 38px;
  height: 38px;
  background: var(--text-1);
  border: none;
  border-radius: var(--r-pill);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: opacity var(--fast), transform var(--fast);
}
#mute-btn:active { transform: scale(0.92); }

/* ─── SCREEN SYSTEM ──────────────────────────────────────── */

.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Transitions */
.enter-fade        { opacity: 0; }
.enter-slide-left  { transform: translateX(100%); opacity: 0; }
.enter-slide-right { transform: translateX(-100%); opacity: 0; }
.enter-slide-up    { transform: translateY(100%); opacity: 0; }
.enter-crossfade   { opacity: 0; }

.screen.active {
  opacity: 1;
  transform: translate(0,0);
  transition: transform var(--slow), opacity var(--med);
}

.exit-fade        { opacity: 0;                   transition: opacity var(--med); pointer-events:none; }
.exit-slide-left  { transform: translateX(-30%); opacity: 0; transition: transform var(--slow), opacity var(--med); pointer-events:none; }
.exit-slide-right { transform: translateX(30%);  opacity: 0; transition: transform var(--slow), opacity var(--med); pointer-events:none; }
.exit-slide-up    { transform: translateY(-30%); opacity: 0; transition: transform var(--slow), opacity var(--med); pointer-events:none; }
.exit-crossfade   { opacity: 0; transition: opacity 400ms ease; pointer-events:none; }

/* ─── GLOBAL BUTTONS ─────────────────────────────────────── */

.btn-primary {
  width: 100%;
  padding: 15px 24px;
  background: var(--text-1);
  color: #fff;
  font-family: var(--body);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter var(--fast), transform var(--fast), box-shadow var(--fast);
  box-shadow: var(--shadow-md);
}
.btn-primary:active { filter: brightness(0.88); transform: scale(0.98); }

.btn-secondary {
  width: 100%;
  padding: 13px 24px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--body);
  font-size: 15px;
  font-weight: 600;
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color var(--fast), color var(--fast);
}
.btn-secondary:hover { border-color: var(--text-2); color: var(--text-1); }

.btn-back {
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: color var(--fast), background var(--fast);
}
.btn-back:hover { color: var(--text-1); }

.invisible { visibility: hidden; pointer-events: none; }

/* ─── TEXT ANIMATIONS ────────────────────────────────────── */

.anim-fade-up {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.anim-word span {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px);
  animation: wordIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes wordIn {
  to { opacity: 1; transform: translateY(0); }
}

.anim-pop {
  animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes pop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.anim-slide-right {
  opacity: 0;
  transform: translateX(-16px);
  animation: slideRight 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes slideRight {
  to { opacity: 1; transform: translateX(0); }
}

/* ─── SCREEN: SIGN IN ────────────────────────────────────── */

.screen-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.signin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 48px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.signin-logo {
  font-family: var(--display);
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-1);
  line-height: 1;
}

.signin-tagline {
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.5;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-pill);
  color: var(--text-1);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--fast), transform var(--fast);
}
.btn-google:active { transform: scale(0.98); }

.signin-note { font-size: 13px; color: var(--text-3); }

/* ─── SCREEN: SPLASH ─────────────────────────────────────── */

.screen-splash {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1C1917 0%, #2C2420 35%, #3A2218 65%, #1C1917 100%);
  overflow: hidden;
}

/* Subtle radial glow behind the logo */
.screen-splash::before {
  content: '';
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216,92,48,0.15) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}

.splash-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.splash-logo {
  font-family: var(--display);
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  user-select: none;
  position: relative;
  z-index: 2;
}

.splash-line {
  display: block;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
}

.splash-line-not {
  font-size: clamp(52px, 16vw, 88px);
  letter-spacing: 0.18em;
  color: #F5F4EF;
}

.splash-line-today {
  font-size: clamp(40px, 12vw, 68px);
  letter-spacing: -0.03em;
  color: #D85C30;
}

.splash-letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px) scale(0.85);
}
.splash-letter.in {
  animation: letterIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes letterIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.splash-logo.pulse {
  animation: logoPulse 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes logoPulse {
  0%  { transform: scale(1); }
  35% { transform: scale(1.06); }
  65% { transform: scale(0.97); }
  100%{ transform: scale(1); }
}

/* Decorative accent line under TODAY */
.splash-accent-line {
  width: 60px;
  height: 3px;
  background: #D85C30;
  border-radius: 2px;
  margin-top: 14px;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.splash-accent-line.visible {
  opacity: 0.7;
}

/* ─── SCREEN: ONBOARDING ─────────────────────────────────── */

.screen-onboarding {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, #FFE8D9 0%, #FFF2EC 30%, #F5F4EF 55%, #E8EEFF 85%, #DDE4FF 100%);
  overflow: hidden;
}

/* Subtle floating accent shapes */
.screen-onboarding::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216,92,48,0.08) 0%, transparent 70%);
  top: -40px;
  right: -40px;
  pointer-events: none;
}
.screen-onboarding::after {
  content: '';
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(58,96,144,0.07) 0%, transparent 70%);
  bottom: -30px;
  left: -30px;
  pointer-events: none;
}

.onboarding-logo {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #1C1917 0%, #2C2420 100%);
  padding: 7px 16px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2), 0 0 0 1px rgba(216,92,48,0.15);
  margin-bottom: 8px;
}
.onboarding-logo::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FF7B4A;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(255,123,74,0.5);
}

.onboarding-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 44px 24px;
  max-width: 440px;
  width: 100%;
}

.onboarding-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.onboarding-headline {
  font-family: var(--display);
  font-size: clamp(28px, 7.5vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-1);
}

.onboarding-subline {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.65;
  letter-spacing: -0.005em;
}

.onboarding-wrap .btn-primary {
  margin-top: 8px;
  max-width: 100%;
}

.onboarding-disclaimer {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  text-align: center;
  width: 100%;
}

/* ─── SCREEN: HOME ───────────────────────────────────────── */

.screen-home {
  background: linear-gradient(170deg, #14101F 0%, #0E0B18 40%, #110E1A 100%);
}

.home-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 56px 20px 32px;
  min-height: 100%;
  position: relative;
  z-index: 1;
}

/* ── Ambient glow ──────────────────────────────────── */

.home-glow {
  position: fixed;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(227,25,207,0.14) 0%,
    rgba(227,25,207,0.06) 30%,
    rgba(227,25,207,0.02) 55%,
    transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: glowPulse 8s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.85; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.04); }
}

/* ── Floating particles ────────────────────────────── */

.home-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.home-particles::before,
.home-particles::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  top: 0; left: 0;
}

/* Layer 1 — soft, slow drift */
.home-particles::before {
  box-shadow:
    8vw 10vh 0 1.5px rgba(227,25,207,0.38),
    22vw 26vh 0 1px rgba(227,25,207,0.30),
    44vw 7vh 0 2px rgba(227,25,207,0.26),
    66vw 20vh 0 1.5px rgba(227,25,207,0.33),
    87vw 14vh 0 1px rgba(227,25,207,0.38),
    11vw 40vh 0 1.5px rgba(227,25,207,0.28),
    34vw 53vh 0 2px rgba(227,25,207,0.33),
    57vw 36vh 0 1px rgba(227,25,207,0.26),
    77vw 46vh 0 1.5px rgba(227,25,207,0.30),
    91vw 33vh 0 1px rgba(227,25,207,0.36),
    4vw 60vh 0 2px rgba(227,25,207,0.28),
    27vw 70vh 0 1.5px rgba(227,25,207,0.33),
    49vw 63vh 0 1px rgba(227,25,207,0.26),
    71vw 56vh 0 1.5px rgba(227,25,207,0.30),
    94vw 68vh 0 2px rgba(227,25,207,0.28),
    17vw 83vh 0 1.5px rgba(227,25,207,0.33),
    41vw 90vh 0 1px rgba(227,25,207,0.26),
    64vw 80vh 0 1.5px rgba(227,25,207,0.36),
    84vw 86vh 0 2px rgba(227,25,207,0.28),
    37vw 76vh 0 1px rgba(227,25,207,0.30);
  animation: particleDrift1 28s ease-in-out infinite;
}

/* Layer 2 — smaller, offset timing */
.home-particles::after {
  box-shadow:
    14vw 4vh 0 1px rgba(227,25,207,0.28),
    31vw 16vh 0 1.5px rgba(227,25,207,0.24),
    54vw 11vh 0 1px rgba(227,25,207,0.26),
    77vw 6vh 0 1px rgba(227,25,207,0.22),
    4vw 30vh 0 1.5px rgba(227,25,207,0.28),
    41vw 26vh 0 1px rgba(227,25,207,0.24),
    61vw 33vh 0 1px rgba(227,25,207,0.26),
    84vw 23vh 0 1.5px rgba(227,25,207,0.22),
    19vw 50vh 0 1px rgba(227,25,207,0.28),
    47vw 46vh 0 1.5px rgba(227,25,207,0.24),
    69vw 53vh 0 1px rgba(227,25,207,0.26),
    94vw 40vh 0 1px rgba(227,25,207,0.22),
    7vw 73vh 0 1.5px rgba(227,25,207,0.28),
    34vw 66vh 0 1px rgba(227,25,207,0.24),
    57vw 76vh 0 1px rgba(227,25,207,0.26),
    79vw 70vh 0 1.5px rgba(227,25,207,0.22),
    24vw 90vh 0 1px rgba(227,25,207,0.28),
    51vw 83vh 0 1.5px rgba(227,25,207,0.24),
    74vw 93vh 0 1px rgba(227,25,207,0.26),
    87vw 80vh 0 1px rgba(227,25,207,0.22);
  animation: particleDrift2 20s ease-in-out infinite;
}

@keyframes particleDrift1 {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.7; }
  25% { transform: translateY(-14px) translateX(10px); opacity: 1; }
  50% { transform: translateY(6px) translateX(-10px); opacity: 0.6; }
  75% { transform: translateY(-8px) translateX(-4px); opacity: 0.9; }
}

@keyframes particleDrift2 {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.6; }
  33% { transform: translateY(10px) translateX(-7px); opacity: 0.9; }
  66% { transform: translateY(-12px) translateX(12px); opacity: 0.5; }
}

/* ── Header & Logo ─────────────────────────────────── */

.home-header {
  text-align: center;
  padding: 10px 0 16px;
}

.home-logo {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 30px rgba(227,25,207,0.2);
}

.home-tagline {
  font-size: 14px;
  color: rgba(255,255,255,0.45);
  margin-top: 8px;
  letter-spacing: 0.02em;
  font-weight: 500;
}

/* ── Category Tiles ────────────────────────────────── */

.category-tiles { display: flex; flex-direction: column; gap: 14px; }

.category-tile {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(227,25,207,0.18);
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  box-shadow:
    0 2px 12px rgba(0,0,0,0.2),
    0 0 0 0.5px rgba(227,25,207,0.05);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}
.category-tile:active {
  transform: scale(0.975);
  background: rgba(227,25,207,0.06);
  border-color: rgba(227,25,207,0.4);
  box-shadow:
    0 4px 24px rgba(227,25,207,0.12),
    0 2px 8px rgba(0,0,0,0.3);
}

.tile-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: rgba(227,25,207,0.1);
  border: 1px solid rgba(227,25,207,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e319cf;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(227,25,207,0.08);
}
.tile-icon-wrap svg { width: 26px; height: 26px; }

.tile-content { flex: 1; min-width: 0; }

.tile-name {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.tile-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.45);
  margin-top: 3px;
}

.tile-progress-bar {
  margin-top: 12px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}

.tile-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #e319cf, #f06deb);
  box-shadow: 0 0 10px rgba(227,25,207,0.3);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 0;
}

.tile-arrow {
  color: rgba(255,255,255,0.2);
  flex-shrink: 0;
  transition: color 0.2s ease, transform 0.2s ease;
}
.category-tile:active .tile-arrow {
  color: #e319cf;
  transform: translateX(3px);
}

/* ── Stats Card ────────────────────────────────────── */

.stats-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 20px;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.stats-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.stats-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(227,25,207,0.25);
}

.stats-avatar-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(227,25,207,0.08);
  border: 1px solid rgba(227,25,207,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e319cf;
}

.stats-name {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

.stats-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 1px;
}

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

.stat-item { text-align: center; padding: 10px 4px; }

.stat-value {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  color: #e319cf;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-signout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.25);
  font-family: var(--body);
  font-size: 13px;
  cursor: pointer;
  align-self: center;
  padding: 8px 16px;
  margin-top: 4px;
  border-radius: var(--r-pill);
  transition: color 0.2s ease;
}
.btn-signout:hover { color: rgba(227,25,207,0.5); }

/* ─── SCREEN: LEVEL SELECT ───────────────────────────────── */

/* ─── SCREEN: LEVEL SELECT ───────────────────────────────── */

.screen-levelselect {
  background: linear-gradient(170deg, #FFF8FC 0%, #FAF0F7 30%, #F5EBF3 60%, #FDF6FB 100%);
}

.levelselect-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 32px;
  position: relative;
}

.levelselect-hero {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 52px 22px 16px;
  position: relative;
}

.levelselect-back {
  position: absolute;
  top: 14px;
  left: 14px;
  color: rgba(60,40,60,0.5);
  transition: color 0.15s;
}
.levelselect-back:active { color: #c010a8; }
.levelselect-back svg { stroke: currentColor; }

.levelselect-title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #1A0E1A;
}

.levelselect-sub {
  font-size: 14px;
  color: rgba(80,50,75,0.55);
  margin-top: 4px;
}

/* ── Level Cards Grid ─────────────────────────────────── */

.level-cards {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px 20px;
}

.level-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(227,25,207,0.12);
  box-shadow:
    0 4px 20px rgba(227,25,207,0.08),
    0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.level-card:active {
  transform: scale(0.975);
  border-color: rgba(227,25,207,0.35);
  box-shadow:
    0 6px 28px rgba(227,25,207,0.16),
    0 2px 6px rgba(0,0,0,0.06);
}

/* Image container — 1:1 aspect */
.level-card-img {
  aspect-ratio: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0A0A0A;
  overflow: hidden;
  position: relative;
}

.level-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Fallback icon when image fails to load */
.level-card-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  color: #e319cf;
  background: radial-gradient(circle at center, rgba(227,25,207,0.08) 0%, #0A0A0A 70%);
}
.level-card-fallback svg { width: 72px; height: 72px; opacity: 0.5; }

/* Info bar below image */
.level-card-info {
  padding: 16px 20px 18px;
  background: #fff;
  border-top: 1px solid rgba(227,25,207,0.06);
}

.level-card-name {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: #1A0E1A;
  letter-spacing: -0.01em;
}

.level-card-meta {
  font-size: 13px;
  color: rgba(80,50,75,0.55);
  margin-top: 4px;
  font-weight: 500;
}

/* ── Status states ──────────────────────────────────── */

/* Perfect — strong pink glow, unmistakable */
.level-card.status-perfect {
  border-color: #e319cf;
  border-width: 2px;
  box-shadow:
    0 0 0 3px rgba(227,25,207,0.15),
    0 8px 32px rgba(227,25,207,0.25),
    0 2px 8px rgba(227,25,207,0.1);
}
.level-card.status-perfect .level-card-meta {
  color: #c010a8;
  font-weight: 700;
}
.level-card.status-perfect .level-card-info {
  border-top-color: rgba(227,25,207,0.15);
  background: linear-gradient(180deg, #FFF5FD 0%, #FBEAF8 100%);
}
.level-card.status-perfect .level-card-name {
  color: #8B0A78;
}

/* Completed (not perfect) — visible but softer than perfect */
.level-card.status-recovered {
  border-color: rgba(227,25,207,0.5);
  border-width: 1.5px;
  box-shadow:
    0 0 0 2px rgba(227,25,207,0.08),
    0 6px 24px rgba(227,25,207,0.15),
    0 2px 6px rgba(0,0,0,0.04);
}
.level-card.status-recovered .level-card-meta {
  color: #c010a8;
  font-weight: 600;
}
.level-card.status-recovered .level-card-info {
  background: linear-gradient(180deg, #FFF 0%, #FEF8FD 100%);
}

/* Completion badge — larger, stronger glow */
.level-card-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e319cf, #c010a8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.9),
    0 4px 16px rgba(227,25,207,0.45);
  z-index: 2;
}

/* ── Test section ──────────────────────────────────── */

.test-section {
  padding: 12px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.btn-test {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border: none;
  border-radius: var(--r-pill);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: filter 0.15s, transform 0.15s;
}
.btn-test:active { filter: brightness(0.9); transform: scale(0.98); }

.btn-test--active {
  background: linear-gradient(135deg, #e319cf, #c010a8);
  color: #fff;
  box-shadow: 0 4px 20px rgba(227,25,207,0.25);
}

.btn-test--locked {
  background: #fff;
  color: rgba(80,50,75,0.4);
  border: 1.5px solid rgba(227,25,207,0.12);
}

.test-locked-msg { font-size: 13px; color: rgba(80,50,75,0.45); text-align: center; }
.test-locked-msg.flash { color: #c010a8; }

/* ─── SCREEN: LEARN ──────────────────────────────────────── */

.screen-learn { background: var(--surface); }

.learn-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100dvh;
}

.learn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  flex-shrink: 0;
}

.learn-progress-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.learn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-2);
  transition: background var(--med), transform var(--med), width var(--med);
}
.learn-dot.active {
  background: var(--accent, #D85C30);
  transform: scale(1.25);
}

/* Illustration card */
.learn-card {
  flex: 0 0 44%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  position: relative;
  overflow: hidden;
}

.illustration-wrap {
  width: 100%;
  max-width: 260px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-illustration {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
}

/* Content section */
.learn-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.learn-step-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent, #D85C30);
}

.learn-step-name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--text-1);
}

.learn-body {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.58;
}

.learn-cue {
  background: color-mix(in srgb, var(--accent, #D85C30) 8%, var(--surface));
  border-left: 3px solid var(--accent, #D85C30);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cue-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent, #D85C30);
}
.cue-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  font-style: italic;
  line-height: 1.4;
}

.learn-inclusive {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--teal-bg);
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--teal) 25%, transparent);
}
.inclusive-icon { color: var(--teal); flex-shrink: 0; margin-top: 1px; }
.inclusive-text { font-size: 13px; color: var(--teal); line-height: 1.55; }

/* Learn nav */
.learn-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.btn-learn-prev {
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-learn-next {
  flex: 1;
  height: 44px;
  border-radius: var(--r-pill);
  background: var(--accent, #D85C30);
  color: #fff;
  border: none;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: filter var(--fast);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent, #D85C30) 35%, transparent);
}
.btn-learn-next:active { filter: brightness(0.9); }

/* ─── SCREEN: SEQUENCE ───────────────────────────────────── */

.screen-sequence { background: var(--bg); }

.sequence-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100dvh;
}

.sequence-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sequence-level-name {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}

.sequence-lives { display: flex; align-items: center; gap: 5px; }

.life-icon       { color: var(--accent, #D85C30); display: inline-flex; }
.life-icon.lost  { color: var(--border-2); opacity: 0.5; }

.life-icon.animate-life-lost {
  animation: lifeLost 0.45s ease forwards;
}
@keyframes lifeLost {
  0%  { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.5); }
  100%{ transform: scale(0); opacity: 0; }
}

.sequence-feedback {
  text-align: center;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  min-height: 36px;
  opacity: 0;
  transition: opacity var(--fast);
  flex-shrink: 0;
}
.sequence-feedback.visible { opacity: 1; }
.feedback-correct  { color: var(--ok); }
.feedback-wrong    { color: var(--err); }
.feedback-life-lost{ color: var(--err); }
.feedback-failure  { color: var(--text-2); }

/* Slots */
.sequence-slots {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sequence-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 2px dashed var(--border-2);
  border-radius: var(--r-md);
  min-height: 58px;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
  box-shadow: var(--shadow-sm);
}
.sequence-slot.drag-over {
  border-color: var(--accent, #D85C30);
  border-style: solid;
  background: color-mix(in srgb, var(--accent, #D85C30) 5%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #D85C30) 18%, transparent);
}
.sequence-slot.filled {
  border-style: solid;
  border-color: var(--accent, #D85C30);
  background: color-mix(in srgb, var(--accent, #D85C30) 5%, var(--surface));
}

.slot-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  flex-shrink: 0;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.filled .slot-num {
  background: var(--accent, #D85C30);
  color: #fff;
  border-color: var(--accent, #D85C30);
}

.slot-empty-hint {
  font-size: 13px;
  color: var(--text-3);
  font-style: italic;
}

.slot-filled-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  animation: snapIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes snapIn {
  from { transform: scale(0.88) translateY(4px); opacity: 0.5; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.slot-check {
  margin-left: auto;
  color: var(--accent, #D85C30);
  opacity: 0;
  transition: opacity var(--fast);
  flex-shrink: 0;
}
.filled .slot-check { opacity: 1; }

/* Drag card zone */
.sequence-cards {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 120px;
}

.drag-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--fast), transform var(--fast), opacity var(--fast);
}
.drag-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent, #D85C30);
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.drag-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
}

.drag-card-dots {
  font-size: 12px;
  color: var(--border-2);
  letter-spacing: 2px;
  margin-top: auto;
}

.drag-card.dragging, .drag-card:active {
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
  transform: scale(1.03) rotate(1deg);
  z-index: 100;
  border-color: var(--accent, #D85C30);
}

.drag-card.drag-source { opacity: 0.3; }

.drag-card.flash-wrong {
  animation: flashWrong 0.32s ease;
}
@keyframes flashWrong {
  0%, 100%{ border-color: var(--border); background: var(--surface); }
  40%     { border-color: var(--err);    background: var(--err-bg); }
}

.drag-card.card-placed {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.failure-retry-msg {
  grid-column: 1/-1;
  font-size: 14px;
  color: var(--text-2);
  font-style: italic;
  text-align: center;
  padding: 12px;
}

.failure-mode-label {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
}

/* ─── SCREEN: PAYOFF ─────────────────────────────────────── */

.screen-payoff {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.payoff-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 48px 20px;
  width: 100%;
  max-width: 420px;
}

.payoff-message {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-1);
  text-align: center;
  letter-spacing: -0.015em;
}

.payoff-sequence {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.payoff-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
  box-shadow: var(--shadow-sm);
}
.payoff-card.payoff-active {
  opacity: 1;
  transform: translateX(0);
  border-color: var(--accent, #D85C30);
  background: color-mix(in srgb, var(--accent, #D85C30) 5%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #D85C30) 14%, transparent);
}

.payoff-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent, #D85C30);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.payoff-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  flex: 1;
}

/* ─── SCREEN: LEVEL COMPLETE ─────────────────────────────── */

.screen-levelcomplete {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.levelcomplete-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.levelcomplete-badge {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent, #D85C30) 12%, transparent);
  color: var(--accent, #D85C30);
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.levelcomplete-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent, #D85C30);
}

.levelcomplete-title {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.levelcomplete-msg {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.6;
}

.levelcomplete-category-msg {
  font-size: 14px;
  color: var(--text-2);
  font-style: italic;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  line-height: 1.5;
}

.levelcomplete-lives {
  display: flex;
  gap: 10px;
}

.levelcomplete-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

/* ─── SCREEN: TEST ───────────────────────────────────────── */

.screen-test { background: var(--surface); }

.test-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
}

.test-counter {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent, #D85C30);
}

.test-progress-track {
  height: 3px;
  background: var(--border);
  margin: 0 18px 4px;
}
.test-progress-fill {
  height: 100%;
  background: var(--accent, #D85C30);
  border-radius: var(--r-pill);
  transition: width var(--med);
}

.test-scenario-wrap {
  padding: 16px 20px 14px;
  flex: 1;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.test-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent, #D85C30);
  margin-bottom: 8px;
}

.test-prompt {
  font-family: var(--body);
  font-size: clamp(17px, 4vw, 21px);
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.55;
  letter-spacing: -0.008em;
}

.test-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 18px;
}

.test-option {
  padding: 13px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  line-height: 1.5;
  letter-spacing: -0.004em;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}
.test-option:hover:not(:disabled) {
  border-color: var(--text-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.test-option:disabled { cursor: default; }

.test-option.option-correct {
  border-color: var(--ok);
  background: var(--ok-bg);
  color: var(--ok);
  font-weight: 700;
}
.test-option.option-wrong {
  border-color: var(--err);
  background: var(--err-bg);
  color: var(--err);
  font-weight: 700;
}

.test-feedback {
  margin: 14px 18px 0;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--fast);
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.4;
}
.test-feedback.visible { opacity: 1; }
.test-feedback.feedback-correct { background: var(--ok-bg); color: var(--ok); }
.test-feedback.feedback-wrong   { background: var(--err-bg); color: var(--err); }
.test-explanation { font-size: 13px; font-weight: 400; font-style: italic; }

/* ─── SCREEN: TEST RESULTS ───────────────────────────────── */

.screen-testresults {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.testresults-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 48px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.testresults-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent, #D85C30) 10%, transparent);
  border: 3px solid var(--accent, #D85C30);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.testresults-num {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 800;
  color: var(--accent, #D85C30);
  line-height: 1;
}
.testresults-label {
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.testresults-msg {
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.6;
}

.testresults-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */

@media (min-width: 540px) {
  #app {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 60px rgba(0,0,0,0.08);
  }
  #mute-btn { right: calc(50% - 226px); }
}

@media (min-width: 900px) {
  html { background: #DDDAD0; }
}

/* ─── KEYWORD HIGHLIGHT ──────────────────────────────────── */

.kw {
  background: color-mix(in srgb, var(--accent, #D85C30) 11%, transparent);
  color: var(--text-1);
  font-weight: 700;
  border-radius: 3px;
  padding: 0 3px 1px;
}
