:root {
  /* ── Core Brand Colors ─────────────────────────── */
  --bg-primary:    #121A16;
  --bg-secondary:  #19241E;
  --bg-card:       rgba(31, 45, 37, 0.75);
  --bg-card-hover: rgba(31, 45, 37, 0.95);
  --bg-elevated:   #1F2D25;
  --surface-light: rgba(255,255,255,0.04);
  --border-subtle: rgba(255,255,255,0.06);

  --accent-primary:       #D2F54B;
  --accent-primary-hover: #E2FF66;
  --accent-secondary:     #CCA8FF;
  --accent-secondary-hover: #DDBEFF;

  --green:    #15D275;
  --green-bg: rgba(21, 210, 117, 0.12);
  --red:      #FF4A5A;
  --red-bg:   rgba(255, 74, 90, 0.12);

  --text-primary:   #FFFFFF;
  --text-secondary: rgba(255,255,255,0.65);
  --text-muted:     rgba(255,255,255,0.38);
  --text-inverted:  #000000;

  --border:        rgba(255,255,255,0.07);
  --border-active: var(--accent-primary);

  --glass-bg:   rgba(18, 26, 22, 0.72);
  --glass-blur: blur(28px);

  --shadow-sm:   0 4px 16px rgba(0,0,0,0.35);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.45);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px rgba(210,245,75,0.22);
  --shadow-glow-purple: 0 0 24px rgba(204,168,255,0.22);

  /* ── Typography ────────────────────────────────── */
  --font-display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* ── Layout ────────────────────────────────────── */
  --max-width:         480px;
  --max-width-desktop: 1200px;
  --nav-height:        76px;
  --safe-bottom:       env(safe-area-inset-bottom, 20px);

  /* ── Transitions ───────────────────────────────── */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out:    cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Spacing Scale ─────────────────────────────── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* ── Border Radius ─────────────────────────────── */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;
}

/* ── Light Mode ──────────────────────────────────── */
[data-theme="light"] {
  --bg-primary:    #F0F4F2;
  --bg-secondary:  #FFFFFF;
  --bg-card:       rgba(255,255,255,0.85);
  --bg-card-hover: rgba(255,255,255,1);
  --bg-elevated:   #E5EBE8;
  --surface-light: rgba(0,0,0,0.03);
  --border-subtle: rgba(0,0,0,0.05);

  --accent-primary:       #809C0B;
  --accent-primary-hover: #90AE10;
  --accent-secondary:     #8B52D4;
  --accent-secondary-hover: #9B60E4;

  --text-primary:   #0E1812;
  --text-secondary: #3D5046;
  --text-muted:     #8E9F96;
  --text-inverted:  #FFFFFF;

  --border:        rgba(0,0,0,0.07);
  --glass-bg:      rgba(255,255,255,0.8);
  --shadow-sm:     0 4px 16px rgba(0,0,0,0.07);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.10);
  --shadow-lg:     0 16px 48px rgba(0,0,0,0.13);
  --shadow-glow:   0 0 24px rgba(128,156,11,0.22);
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s, color 0.3s;
}

body {
  display: flex;
  justify-content: center;
}

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

/* ═══════════════════════════════════════════════════
   SCREEN / LAYOUT
═══════════════════════════════════════════════════ */
.screen {
  height: 100%;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + 24px + var(--safe-bottom));
  position: relative;
  scrollbar-width: none;
  background: var(--bg-primary);
  animation: screenFadeIn 0.35s var(--ease-smooth) both;
}
.screen::-webkit-scrollbar { display: none; }

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s var(--ease-smooth);
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}
.btn:hover::after  { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.965); }

.btn-primary  { background: var(--accent-primary); color: #000; box-shadow: var(--shadow-glow); }
.btn-primary:hover { box-shadow: 0 0 32px rgba(210,245,75,0.35); }
.btn-secondary { background: var(--accent-secondary); color: #000; box-shadow: var(--shadow-glow-purple); }
.btn-full { width: 100%; }
.btn-ghost {
  background: var(--surface-light);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ═══════════════════════════════════════════════════
   INPUTS
═══════════════════════════════════════════════════ */
.input-group  { margin-bottom: 20px; }
.input-label  {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 8px;
}
.input {
  width: 100%;
  padding: 15px 18px;
  background: var(--surface-light);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--accent-secondary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 4px rgba(204,168,255,0.1);
}
.input::placeholder { color: var(--text-muted); }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface-light);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
}
.icon-btn:hover  { background: var(--bg-elevated); }
.icon-btn:active { transform: scale(0.92); }

/* ═══════════════════════════════════════════════════
   BOTTOM NAV — Floating Pill
═══════════════════════════════════════════════════ */
.bottom-nav {
  position: absolute;
  bottom: max(var(--safe-bottom), 24px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 380px;
  padding: 8px 12px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  animation: navSlideUp 0.5s var(--ease-spring) both;
}
body.in-ai-chat .bottom-nav { display: none !important; }

@keyframes navSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(24px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: color 0.25s var(--ease-smooth), transform 0.2s var(--ease-spring);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  min-width: 56px;
  position: relative;
}
.nav-item svg {
  width: 22px; height: 22px;
  stroke-width: 1.8;
  transition: transform 0.25s var(--ease-spring), filter 0.25s;
}
.nav-item .nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
}

.nav-item:hover  { color: var(--text-secondary); }
.nav-item:active { transform: scale(0.88); }

.nav-item.active {
  color: var(--accent-primary);
  background: rgba(210,245,75,0.1);
}
.nav-item.active svg {
  filter: drop-shadow(0 0 7px rgba(210,245,75,0.5));
  transform: scale(1.12) translateY(-1px);
}

/* ═══════════════════════════════════════════════════
   HOME SCREEN / DASHBOARD
═══════════════════════════════════════════════════ */
.home-screen { padding: 0; }

.screen-header {
  padding: 20px 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 40;
  will-change: background, padding;
}
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  will-change: margin;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.screen-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
  will-change: opacity, transform, max-height, margin;
  transform-origin: left bottom;
  font-family: var(--font-display);
}
.screen-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  transform-origin: left center;
  will-change: transform;
  font-family: var(--font-display);
}
.screen-title .accent {
  color: var(--accent-primary);
}

/* Mini Stats (compact on scroll) */
.mini-stats-panel {
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(16px);
  will-change: opacity, transform;
}
.mini-stats-panel .stat-box {
  flex: none;
  padding: 5px 10px;
  border-radius: 12px;
  gap: 6px;
}
.mini-stats-panel .stat-icon { width: 18px; height: 18px; border-radius: 6px; }
.mini-stats-panel .stat-value { font-size: 13px; font-weight: 800; margin-bottom: 0; }

/* Large Stats */
.stats-panel-large {
  display: flex;
  gap: 12px;
  transform-origin: top center;
  will-change: transform, opacity;
}
.stat-box {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-box.primary   { background: var(--accent-primary); color: #000; }
.stat-box.secondary { background: var(--accent-secondary); color: #000; }

.stat-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: rgba(0,0,0,0.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 19px; height: 19px; }
.stat-info { min-width: 0; }
.stat-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
  margin-bottom: 3px;
  font-family: var(--font-display);
}
.stat-label { font-size: 11px; font-weight: 600; opacity: 0.75; }

/* Blocks */
.blocks-container { padding: 16px 16px; }
.block-section    { margin-bottom: 36px; }
.block-header     { margin-bottom: 20px; }
.block-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1.2px;
  margin-bottom: 5px;
}
.block-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-family: var(--font-display);
}

/* Timeline */
.timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 10px 8px;
  position: relative;
  z-index: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  gap: 0;
}
.timeline::-webkit-scrollbar { display: none; }
.timeline-line {
  flex: 1;
  min-width: 8px;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 -3px;
  z-index: 1;
}
.timeline-line.completed { background: var(--accent-primary); }

.timeline-dot-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
  flex-shrink: 0;
}
.timeline-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-light);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  transition: background 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.timeline-dot.completed {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #000;
  box-shadow: 0 0 12px rgba(210,245,75,0.45);
}
.timeline-dot.active {
  border-color: var(--accent-secondary);
  background: var(--accent-secondary);
  color: #fff;
  box-shadow: 0 0 12px rgba(204,168,255,0.45);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(204,168,255,0.45); }
  50%      { box-shadow: 0 0 20px rgba(204,168,255,0.7); }
}
.timeline-dot-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

/* Day Cards */
.day-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.day-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 20px;
  padding: 20px;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.day-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  border-radius: 0 2px 2px 0;
}
.day-card.completed { border-color: rgba(21,210,117,0.2); }
.day-card.completed::before { background: var(--green); }
.day-card.current {
  border-color: rgba(204,168,255,0.35);
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.day-card.current::before { background: var(--accent-secondary); }
.day-card.current:hover  { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.day-card.current:active { transform: scale(0.97); }
.day-card.locked  { opacity: 0.45; }

.day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.day-card-number {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.25;
  letter-spacing: -1px;
  font-family: var(--font-display);
}
.day-card-tags { display: flex; gap: 5px; flex-wrap: wrap; }

.tag {
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tag-accent { background: rgba(204,168,255,0.14); color: var(--accent-secondary); }
.tag-locked { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.tag-green  { background: var(--green-bg); color: var(--green); }

.day-card-body { flex: 1; margin-bottom: 12px; }
.day-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 5px;
  line-height: 1.25;
  letter-spacing: -0.2px;
}
.day-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.day-card-footer {
  padding-top: 12px;
  border-top: 1px dashed var(--border-subtle);
}
.status-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}
.status-indicator.completed { color: var(--green); }
.status-indicator.active    { color: var(--accent-secondary); }
.status-indicator.locked    { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════
   LESSON / CHAT WINDOW
═══════════════════════════════════════════════════ */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(var(--vh, 1vh) * 100);
  background: var(--bg-primary);
}

.chat-header {
  padding: 14px 20px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 10;
  flex-shrink: 0;
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-title  {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-display);
}
.chat-header-status { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.chat-messages::-webkit-scrollbar { display: none; }

.message-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 88%;
  animation: msgSlideIn 0.35s var(--ease-smooth) both;
}
.message-wrapper.you      { align-self: flex-end; flex-direction: row-reverse; }
.message-wrapper.coach    { align-self: center; max-width: 97%; flex-direction: column; align-items: stretch; margin: 12px 0; }
.message-wrapper.ai-msg-left { align-self: flex-start; flex-direction: row; max-width: 82%; }

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-bubble {
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.55;
  position: relative;
  border-radius: var(--radius-lg);
}
.msg-bubble.you {
  background: var(--accent-primary);
  color: #000;
  border-bottom-right-radius: 5px;
  font-weight: 500;
}
.msg-bubble.coach {
  background: var(--bg-card);
  border: 1.5px solid rgba(204,168,255,0.2);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
}
/* Messenger-style AI bubble (left side) */
.msg-bubble.ai-bubble-left {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 5px;
  font-weight: 400;
  line-height: 1.55;
  font-size: 15px;
  padding: 11px 15px;
}
.coach-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-secondary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  font-size: 11px;
}

.chat-controls-area {
  padding: 14px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-choices  { display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
  background: var(--surface-light);
  border: 1.5px solid var(--border-subtle);
  padding: 16px;
  border-radius: 18px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.choice-btn:hover           { border-color: var(--accent-secondary); background: var(--bg-card); transform: translateX(3px); }
.choice-btn.selected-correct { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.choice-btn.selected-wrong   { border-color: var(--red);   background: var(--red-bg);   color: var(--red); }

/* ═══════════════════════════════════════════════════
   TOASTS
═══════════════════════════════════════════════════ */
.toast {
  position: fixed;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  padding: 13px 22px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-subtle);
  z-index: 10001;
  transition: top 0.4s var(--ease-spring), opacity 0.3s;
  text-align: center;
  max-width: 88%;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: normal;
  word-break: break-word;
}
.toast.show  { top: max(20px, env(safe-area-inset-top, 20px)); }
.toast.error   { border-color: rgba(255,74,90,0.4);  background: rgba(255,74,90,0.12); }
.toast.success { border-color: rgba(21,210,117,0.4); background: rgba(21,210,117,0.1); }

/* ═══════════════════════════════════════════════════
   AUTH
═══════════════════════════════════════════════════ */
.auth-screen {
  height: calc(var(--vh, 1vh) * 100);
  width: 100%;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg-primary);
  overflow-y: auto;
  animation: screenFadeIn 0.35s var(--ease-smooth) both;
}
.auth-logo-wrapper {
  width: 80px; height: 80px;
  border-radius: 26px;
  background: var(--surface-light);
  border: 1.5px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
  color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
  animation: logoPopIn 0.5s var(--ease-spring) 0.1s both;
}
@keyframes logoPopIn {
  from { transform: scale(0.7) rotate(-8deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
.auth-title {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -1px;
  text-align: center;
  font-family: var(--font-display);
}
.auth-subtitle { color: var(--text-secondary); font-size: 15px; margin-bottom: 40px; text-align: center; max-width: 260px; line-height: 1.5; }
.auth-form     { width: 100%; max-width: 360px; }
.auth-switch   { margin-top: 24px; font-size: 14px; color: var(--text-muted); text-align: center; }
.auth-switch a { color: var(--accent-secondary); cursor: pointer; font-weight: 700; text-decoration: none; margin-left: 4px; }
.auth-error    {
  background: var(--red-bg);
  color: var(--red);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  border: 1px solid rgba(255,74,90,0.2);
  animation: shake 0.4s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}

/* ═══════════════════════════════════════════════════
   UTILITIES & KEYFRAMES
═══════════════════════════════════════════════════ */
.loading-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes slideUp     { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideIn     { from { opacity:0; transform:translateX(24px); } to { opacity:1; transform:translateX(0); } }
@keyframes fadeIn      { from { opacity:0; } to { opacity:1; } }
@keyframes scaleIn     { from { transform:scale(0.92); opacity:0; } to { transform:scale(1); opacity:1; } }
@keyframes bounceIn    { 
  from { transform:scale(0.3); opacity:0; } 
  50%  { transform:scale(1.05); } 
  70%  { transform:scale(0.95); } 
  to   { transform:scale(1); opacity:1; } 
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(210,245,75,0.2); }
  50%       { box-shadow: 0 0 24px rgba(210,245,75,0.5); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Staggered card reveal animation */
.day-card { animation: cardReveal 0.4s var(--ease-smooth) both; }
.day-card:nth-child(1)  { animation-delay: 0.05s; }
.day-card:nth-child(2)  { animation-delay: 0.1s; }
.day-card:nth-child(3)  { animation-delay: 0.15s; }
.day-card:nth-child(4)  { animation-delay: 0.2s; }
.day-card:nth-child(5)  { animation-delay: 0.25s; }
.day-card:nth-child(6)  { animation-delay: 0.3s; }
.day-card:nth-child(7)  { animation-delay: 0.35s; }
.day-card:nth-child(8)  { animation-delay: 0.4s; }
.day-card:nth-child(9)  { animation-delay: 0.45s; }
.day-card:nth-child(10) { animation-delay: 0.5s; }
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 16px;
  animation: fadeIn 0.4s var(--ease-smooth);
}
.empty-state-icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-lg);
  background: var(--surface-light);
  border: 1.5px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.empty-state-text {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
  max-width: 280px;
}

/* ═══════════════════════════════════════════════════
   LESSON (Duolingo Style)
═══════════════════════════════════════════════════ */
body.in-lesson .bottom-nav { display: none !important; }

.lesson-container {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  animation: lessonSlideIn 0.3s var(--ease-smooth) both;
}
@keyframes lessonSlideIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

.lesson-top-bar {
  padding: 14px 20px;
  padding-top: max(14px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.lesson-back {
  border: none;
  background: transparent;
  padding: 8px;
  box-shadow: none;
  display: flex;
  cursor: pointer;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.lesson-back:hover { background: var(--surface-light); }

.progress-container {
  flex: 1;
  height: 8px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.progress-segment {
  flex: 1;
  height: 7px;
  background: var(--surface-light);
  border-radius: var(--radius-full);
  transition: background 0.35s var(--ease-smooth);
}
.progress-segment.completed,
.progress-segment.active {
  background: var(--accent-primary);
}
.progress-segment.active { animation: pulseGlow 2s ease-in-out infinite; }

.lesson-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scrollbar-width: none;
}
.lesson-content::-webkit-scrollbar { display: none; }

.step-card {
  max-width: 500px;
  width: 100%;
  animation: slideIn 0.35s var(--ease-smooth) both;
}

.step-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  font-family: var(--font-display);
}
.step-text {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 20px;
  white-space: pre-wrap;
}

.situation-box {
  background: rgba(204,168,255,0.07);
  border: 1.5px solid rgba(204,168,255,0.18);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.situation-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent-secondary);
  border-radius: 2px;
}

.theory-block {
  background: var(--surface-light);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
}
.theory-block.example-good { border-color: rgba(210,245,75,0.3);  background: rgba(210,245,75,0.05); }
.theory-block.example-bad  { border-color: rgba(255,74,90,0.3);   background: rgba(255,74,90,0.05); }

.choices-grid { display: grid; gap: 10px; width: 100%; }

.choice-option {
  background: var(--surface-light);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.15s var(--ease-spring), box-shadow 0.18s;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-bottom: 6px;
}
.choice-index {
  min-width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--bg-primary);
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  font-family: var(--font-display);
}

.choice-option:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(210,245,75,0.25);
}
.choice-option:hover .choice-index { border-color: var(--accent-primary); color: var(--accent-primary); }

.choice-option:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--border-subtle);
}
.choice-option.selected {
  border-color: var(--accent-primary);
  background: rgba(210,245,75,0.09);
  box-shadow: 0 3px 0 rgba(210,245,75,0.3);
}
.choice-option.selected .choice-index {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #000;
}

.lesson-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  padding: 14px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  z-index: 1050;
}
.lesson-footer .btn {
  max-width: 400px;
  width: 100%;
  height: 54px;
  font-size: 16px;
  border-radius: 18px;
}

/* Result Panel (Correct / Wrong) */
.result-panel {
  position: fixed;
  bottom: -100%;
  left: 0; right: 0;
  padding: 22px 20px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  transition: bottom 0.35s var(--ease-spring);
  z-index: 1100;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.result-panel.show { bottom: 0; }
.result-panel.success { background: var(--accent-primary); color: #000; }
.result-panel.error   { background: #FF4B4B; color: #fff; }

.result-panel .btn-full { height: 50px; font-size: 15px; border-radius: var(--radius-md); }

.result-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
  font-family: var(--font-display);
}
.result-explanation {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════
   PROFILE SCREEN
═══════════════════════════════════════════════════ */
.profile-screen {
  display: flex;
  flex-direction: column;
}
.profile-header {
  text-align: center;
  padding: 48px 20px 32px;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}
.profile-avatar-frame {
  position: relative;
  width: 100px; height: 100px;
  margin: 0 auto 20px;
}
.profile-avatar {
  width: 100%; height: 100%;
  border-radius: 36px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.profile-avatar-badge {
  position: absolute;
  bottom: -6px; right: -6px;
  width: 34px; height: 34px;
  border-radius: 12px;
  background: var(--accent-primary);
  border: 4px solid var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  color: #000;
  animation: bounceIn 0.5s var(--ease-spring) 0.2s both;
}
.profile-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  font-family: var(--font-display);
}
.profile-email {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.profile-body { padding: 0 20px; }
.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.profile-stat-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: cardReveal 0.4s var(--ease-smooth) both;
}
.profile-stat-card:nth-child(2) { animation-delay: 0.08s; }
.profile-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.profile-stat-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-display);
}
.profile-stat-value.primary   { color: var(--accent-primary); }
.profile-stat-value.secondary { color: var(--accent-secondary); }

.profile-sub-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 24px;
  animation: cardReveal 0.4s var(--ease-smooth) 0.15s both;
}
.profile-sub-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.profile-sub-icon {
  width: 44px; min-width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.profile-sub-info { flex: 1; min-width: 0; }
.profile-sub-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 2px;
}
.profile-sub-status {
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font-display);
}
.profile-sub-btn {
  width: 100%;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, opacity 0.15s;
}
.profile-sub-btn:active { transform: scale(0.97); }

.profile-settings-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
}
.profile-settings-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 32px;
  animation: cardReveal 0.4s var(--ease-smooth) 0.25s both;
}
.profile-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.profile-settings-row + .profile-settings-row {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}
.profile-settings-label { font-weight: 700; }

.profile-toggle-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.profile-toggle-btn:active { transform: scale(0.95); }
.profile-toggle-btn .theme-icon-light,
.profile-toggle-btn .theme-icon-dark {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-lang-switcher {
  display: flex;
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--border);
}
.profile-lang-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.profile-lang-btn.active {
  background: var(--accent-secondary);
  color: #000;
}
.profile-lang-btn:not(.active) {
  background: transparent;
  color: var(--text-secondary);
}

.profile-logout-btn {
  background: var(--red-bg);
  border: none;
  color: var(--red);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-logout-btn:active { transform: scale(0.95); }

.profile-footer {
  text-align: center;
  padding: 20px 0;
  opacity: 0.5;
}
.profile-footer a {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 8px;
}
.profile-footer p {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ═══════════════════════════════════════════════════
   PROGRESS SCREEN
═══════════════════════════════════════════════════ */
.progress-screen {
  padding: 0;
}
.progress-screen .screen-header {
  padding-bottom: 12px;
}
.progress-screen .blocks-container {
  padding: 0 20px 20px;
}

/* Card base */
.card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: 20px;
}
.card-glow {
  border-color: rgba(210,245,75,0.2);
  box-shadow: 0 0 32px rgba(210,245,75,0.08);
}

/* Streak */
.streak-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}
.streak-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  background: rgba(255,120,30,0.12);
  display: flex; align-items: center; justify-content: center;
  animation: float 3s ease-in-out infinite;
}
.streak-icon svg { width: 28px; height: 28px; }
.streak-count {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -2px;
  font-family: var(--font-display);
  color: var(--accent-primary);
  animation: countUp 0.5s var(--ease-smooth) both;
}
.streak-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Progress Ring */
.progress-ring {
  position: relative;
  width: 200px; height: 200px;
  margin: 0 auto 16px;
}
.progress-ring svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.progress-ring-bg {
  fill: none;
  stroke: var(--surface-light);
  stroke-width: 10;
}
.progress-ring-fill {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease-smooth);
  filter: drop-shadow(0 0 8px rgba(210,245,75,0.4));
}
.progress-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.progress-ring-value {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -2px;
  font-family: var(--font-display);
  color: var(--accent-primary);
  animation: countUp 0.6s var(--ease-smooth) 0.3s both;
}
.progress-ring-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Stat Cards Grid */
.stat-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: 16px;
  text-align: center;
  animation: cardReveal 0.4s var(--ease-smooth) both;
}
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  font-family: var(--font-display);
  color: var(--accent-primary);
  margin-bottom: 4px;
}
.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tip / Motivation Card */
.tip-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  animation: cardReveal 0.4s var(--ease-smooth) 0.3s both;
}
.tip-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent-secondary);
  border-radius: 2px;
}
.tip-card-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(204,168,255,0.1);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  color: var(--accent-secondary);
}
.tip-card-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-secondary);
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.tip-card-main {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════
   WHEEL SCREEN
═══════════════════════════════════════════════════ */
.wheel-screen .screen-header { padding-bottom: 10px; }
.wheel-screen .screen-title { font-size: 28px; }

.wheel-main-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}
.wheel-visual-wrapper {
  position: relative;
  width: 240px; height: 240px;
  margin: 10px 0 30px;
}
.wheel-pointer {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 20px solid var(--accent-primary);
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(210,245,75,0.3));
}
.wheel-canvas {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    var(--bg-card) 0deg 60deg,
    var(--bg-elevated) 60deg 120deg,
    var(--bg-card) 120deg 180deg,
    var(--bg-elevated) 180deg 240deg,
    var(--bg-card) 240deg 300deg,
    var(--bg-elevated) 300deg 360deg
  );
  border: 4px solid var(--accent-secondary);
  box-shadow: var(--shadow-glow-purple), inset 0 0 40px rgba(204,168,255,0.05);
  transition: transform 4s cubic-bezier(0.15, 0, 0.15, 1);
  position: relative;
}
.wheel-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 40px; height: 40px;
  background: var(--bg-primary);
  border-radius: 50%;
  border: 4px solid var(--accent-secondary);
  z-index: 5;
}
.wheel-action-area {
  width: 100%; max-width: 300px;
  text-align: center;
}
.wheel-repeat-btn {
  margin-top: 10px;
}
.wheel-task-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 10px;
}
.wheel-task-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-secondary);
  font-family: var(--font-display);
}
.wheel-dialogue-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.wheel-result {
  margin-top: 24px;
  border-top: 1px dashed var(--border);
  padding-top: 20px;
}
.wheel-timer {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 12px;
}

/* How it works steps */
.how-it-works { margin-top: 24px; }
.how-it-works h3 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  opacity: 0.8;
  font-family: var(--font-display);
}
.how-steps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.how-step-card {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  min-height: auto;
}
.how-step-number {
  min-width: 28px; width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  font-family: var(--font-display);
  color: #000;
}
.how-step-title {
  font-weight: 700; font-size: 14px;
}
.how-step-desc {
  font-size: 12px; color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════
   AI CHAT SCREEN
═══════════════════════════════════════════════════ */
.ai-screen {
  display: flex;
  flex-direction: column;
}
.ai-screen .blocks-container { flex: 1; padding: 0 20px 20px; }
.ai-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 10px;
}
.ai-mode-card {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  min-height: auto;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s, border-color 0.2s;
}
.ai-mode-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.ai-mode-card:active { transform: scale(0.98); }
.ai-mode-icon {
  width: 48px; min-width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #000;
}
.ai-mode-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 16px;
  font-family: var(--font-display);
}
.ai-mode-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ai-chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-primary);
}
.ai-chat-header {
  flex-shrink: 0;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-primary);
}
.ai-chat-title {
  font-weight: 700;
  font-size: 17px;
  font-family: var(--font-display);
}
.ai-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: none;
}
.ai-chat-messages::-webkit-scrollbar { display: none; }
.ai-chat-controls {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 12px 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.ai-chat-input-row {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 8px;
}
.ai-chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 16px;
  outline: none;
  font-family: var(--font-body);
}
.ai-chat-media-input { display: none; }
.ai-chat-media-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  box-shadow: none;
}
.ai-chat-media-btn:hover {
  color: var(--accent-primary);
  border-color: rgba(210,245,75,0.45);
}
.ai-chat-send {
  padding: 0;
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  min-width: 44px;
  display: flex; align-items: center; justify-content: center;
}
.ai-chat-send:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* System message pill */
.ai-system-msg {
  align-self: center;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  margin: 8px auto;
  max-width: 80%;
  letter-spacing: 0.1px;
}

/* Sessions list */
.ai-sessions-section {
  margin-top: 28px;
}
.ai-sessions-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  padding: 0 2px;
}
.ai-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ai-session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  animation: msgSlideIn 0.3s var(--ease-smooth) both;
}
.ai-session-item:hover { background: var(--bg-card-hover); border-color: var(--border); }
.ai-session-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-light);
  border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.ai-session-body {
  flex: 1;
  min-width: 0;
}
.ai-session-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.ai-session-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-session-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.ai-session-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.ai-session-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  transition: color 0.15s, background 0.15s;
  box-shadow: none;
}
.ai-session-del:hover { color: var(--red); background: var(--red-bg); }
.typing-bubble {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 40px;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.35;
  animation: aiTypingPulse 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes aiTypingPulse {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-2px); opacity: 0.95; }
}

/* ═══════════════════════════════════════════════════
   PAYWALL
═══════════════════════════════════════════════════ */
.paywall-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}
.paywall-icon {
  width: 80px; height: 80px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--green) 100%);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 0 40px rgba(210,245,75,0.3);
  animation: bounceIn 0.6s var(--ease-spring) both;
}
.paywall-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 12px;
  line-height: 1.2;
  font-family: var(--font-display);
}
.paywall-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 320px;
}
.paywall-card {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  margin-bottom: 16px;
  text-align: left;
  min-height: auto;
}
.paywall-plan-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 4px;
}
.paywall-price {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent-primary);
  font-family: var(--font-display);
}
.paywall-period {
  font-size: 13px;
  color: var(--text-muted);
}
.paywall-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}
.paywall-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}
.paywall-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.3px;
}
.paywall-divider::before,
.paywall-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.paywall-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 12px;
  transition: color 0.15s;
}
.paywall-back-btn:hover { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════
   COMPLETION SCREEN
═══════════════════════════════════════════════════ */
.completion-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  min-height: 100%;
}
.completion-icon {
  color: var(--accent-primary);
  margin-bottom: 24px;
  animation: bounceIn 0.6s var(--ease-spring) both;
}
.completion-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.completion-desc {
  color: var(--text-secondary);
  margin-bottom: 40px;
}

/* ═══════════════════════════════════════════════════
   DESKTOP (≥ 768px)
═══════════════════════════════════════════════════ */
@media (min-width: 768px) {
  body {
    padding: 28px;
    align-items: flex-start;
    background: var(--bg-primary);
    gap: 28px;
  }

  #app {
    max-width: var(--max-width-desktop);
    background: var(--bg-card);
    border-radius: 36px;
    margin-left: 0;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
    z-index: 1;
    min-height: calc(100vh - 56px);
  }

  .bottom-nav {
    position: sticky;
    top: 28px;
    order: -1;
    bottom: auto;
    left: auto;
    transform: none;
    width: 270px;
    height: auto;
    min-height: calc(100vh - 56px);
    max-width: unset;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 28px 0;
    gap: 4px;
    border-radius: 36px;
    background: var(--surface-light);
    border: 1px solid rgba(255,255,255,0.05);
    animation: none;
    box-shadow: none;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 14px 22px;
    margin: 2px 16px;
    font-size: 15px;
    font-weight: 600;
    width: auto;
    height: auto;
    border-radius: 18px;
    color: var(--text-secondary);
    min-width: unset;
  }
  .nav-item .nav-label {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.1px;
    display: flex;
    align-items: center;
    margin-left: 14px;
  }
  .nav-item svg { width: 20px; height: 20px; }
  .nav-item:hover           { color: var(--text-primary); background: var(--surface-light); }
  .nav-item.active          { background: var(--accent-primary); color: #000; box-shadow: 0 6px 20px rgba(210,245,75,0.28); }
  .nav-item.active svg      { color: #000; filter: none; transform: scale(1); }
  .nav-item.active .nav-label { color: #000; }

  .screen          { padding-bottom: 0; border-radius: inherit; }
  .day-cards       { flex-direction: row; flex-wrap: wrap; }
  .day-card        { width: calc(50% - 7px); }
  .chat-container  { max-width: 800px; margin: 0 auto; border-left: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); }
}

/* ═══════════════════════════════════════════════════
   PLATFORM: ALL MOBILE — dvh fix (Safari address bar)
═══════════════════════════════════════════════════ */
html, body { height: calc(var(--vh, 1vh) * 100); }

#app {
  height: calc(var(--vh, 1vh) * 100);
}

.auth-screen,
.chat-container,
.lesson-container {
  height: calc(var(--vh, 1vh) * 100);
}

/* ═══════════════════════════════════════════════════
   PLATFORM: TELEGRAM MINI APP
═══════════════════════════════════════════════════ */
[data-platform="telegram"] #app {
  height: var(--tg-viewport-stable-height, calc(var(--vh, 1vh) * 100));
  max-width: 100%;
}

[data-platform="telegram"] .screen {
  height: var(--tg-viewport-stable-height, calc(var(--vh, 1vh) * 100));
  padding-bottom: calc(var(--nav-height) + 16px);
}

/* AI chat should use dynamic viewport so input follows keyboard */
body.in-ai-chat .screen {
  padding-bottom: 0 !important;
  overflow: hidden;
}
[data-platform="telegram"] body.in-ai-chat #app,
[data-platform="telegram"] body.in-ai-chat .screen {
  height: var(--tg-viewport-height, calc(var(--vh, 1vh) * 100));
}

[data-platform="telegram"] .bottom-nav {
  bottom: 18px;
}

[data-platform="telegram"] .nav-label {
  display: none;
}
[data-platform="telegram"] .nav-item {
  padding: 10px 16px;
  min-width: 48px;
}

[data-platform="telegram"] body {
  overscroll-behavior: none;
}

/* ═══════════════════════════════════════════════════
   PLATFORM: iOS NATIVE WEB VIEW
═══════════════════════════════════════════════════ */
[data-platform="ios-native"] .screen-header {
  padding-top: max(20px, env(safe-area-inset-top));
}

[data-platform="ios-native"] .bottom-nav {
  bottom: max(16px, env(safe-area-inset-bottom));
}

[data-platform="ios-native"] .chat-header {
  padding-top: max(14px, env(safe-area-inset-top));
}

[data-platform="ios-native"] .lesson-top-bar {
  padding-top: max(14px, env(safe-area-inset-top));
}

/* ═══════════════════════════════════════════════════
   PLATFORM: iOS / ANDROID MOBILE WEB
═══════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
  .day-card.current:hover { transform: none; box-shadow: none; }
  .choice-option:hover    { transform: none; box-shadow: 0 3px 0 var(--border-subtle); }
  .choice-btn:hover       { transform: none; }
  .btn:hover::after       { background: transparent; }
  .ai-mode-card:hover     { transform: none; box-shadow: none; }

  .day-card.current:active { transform: scale(0.96); box-shadow: none; }
  .choice-option:active    { transform: scale(0.97); }
  .btn:active              { transform: scale(0.95); }

  .screen, .chat-messages, .lesson-content, .ai-chat-messages {
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
  }

  .nav-item, .btn, .choice-option, .choice-btn, .day-card, .ai-mode-card {
    -webkit-user-select: none;
    user-select: none;
  }

  .input, .ai-chat-input { font-size: max(16px, 1em); }
}

/* ═══════════════════════════════════════════════════
   PLATFORM: DESKTOP/WEB ONLY
═══════════════════════════════════════════════════ */
@media (hover: hover) and (pointer: fine) {
  .screen::-webkit-scrollbar { display: block; width: 4px; }
  .screen::-webkit-scrollbar-track { background: transparent; }
  .screen::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }
  .screen::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

  .choice-btn:hover { border-color: var(--accent-secondary); transform: translateX(4px); }
  .nav-item { cursor: pointer; }
}

/* ═══════════════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
