:root {
  --primary: #f97316;
  --primary-dark: #ea580c;
  --secondary: #4c1d95;
  --secondary-2: #6d28d9;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --bg: #fff7ed;
  --surface: #ffffff;
  --text: #111827;
  --muted: #7c6f63;
  --line: #f1e4d3;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(124, 45, 18, 0.08);
  --shadow-lg: 0 20px 50px rgba(124, 45, 18, 0.16);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: #ede4d8;
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 0;
}

/* Phone frame */
.phone {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  max-height: 932px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 480px) {
  .phone {
    border-radius: 40px;
    height: 92vh;
    border: 10px solid #0f172a;
  }
}

.screen {
  flex: 1;
  overflow-y: auto;
  padding: 28px 22px 110px;
  display: none;
  animation: fade 0.35s ease;
}

.screen.active {
  display: block;
}

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

/* Typography */
h1 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--secondary);
}
h2 {
  font-size: 20px;
  letter-spacing: -0.01em;
}
.muted {
  color: var(--muted);
}
.center {
  text-align: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 17px 22px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-family: inherit;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.38);
}
.btn-primary:hover {
  background: var(--primary-dark);
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--line);
}
.btn-soft {
  background: rgba(76, 29, 149, 0.1);
  color: var(--secondary);
}
.btn-row {
  display: flex;
  gap: 12px;
}
.btn-row .btn {
  flex: 1;
}

.stack > * + * {
  margin-top: 14px;
}

/* Brand mark */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand .dot {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  box-shadow: 0 6px 14px rgba(249, 115, 22, 0.4);
}

/* Onboarding / Splash */
.splash {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.splash-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.splash-logo {
  display: grid;
  place-items: center;
  width: 100%;
}
.splash-logo img {
  width: 320px;
  max-width: 86%;
  height: auto;
  /* Blend any near-white logo background into the cream page so the mark reads
     as part of the screen, not a pasted rectangle (works even if the canvas
     white-key fails on a tainted image). */
  mix-blend-mode: multiply;
  animation: logoIn 0.85s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.splash-tagline {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
  margin-top: -6px;
  animation: fadeUp 0.7s ease 0.4s both;
}
.splash-actions {
  padding-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeUp 0.6s ease 0.6s both;
}
@keyframes logoIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Goal cards */
.goal-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.12s;
}
.goal-card:active {
  transform: scale(0.99);
}
.goal-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
}
.goal-card .time {
  font-size: 20px;
  font-weight: 800;
  min-width: 56px;
}
.goal-card .time-unit {
  font-size: 12px;
  color: var(--muted);
}
.goal-card .desc {
  flex: 1;
  min-width: 0; /* allow the desc to shrink instead of forcing wraps */
}
/* Each line tries to stay on a single line on mobile */
.goal-card .gc-new {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
}
.goal-card .gc-rev {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  margin-top: 1px;
}
.goal-card .gc-rec {
  color: #16a34a;
  font-weight: 700;
  font-size: 11.5px;
  margin-top: 2px;
}
.goal-card .check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
}
.goal-card.selected .check {
  background: var(--primary);
  border-color: var(--primary);
}
.pill-reco {
  display: inline-block;
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  margin: 4px 0 18px;
}

/* Dashboard */
.dash-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.level-chip {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.streak-chip {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 14px;
}
/* Header row: main content on the left, streak indicator pushed to the right.
   (Used by the Home dash-head — title/level left, streak badge right.) */
.header-row {
  display: flex;
  align-items: flex-end; /* drop the streak badge down to the level-badge row */
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.header-main { min-width: 0; }                 /* allow the left side to shrink */
.header-main .badge-level { margin-top: 8px; } /* space below the welcome line */
.header-streak {
  margin-left: auto;                            /* sit on the right edge of the row */
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
/* Shared pill/badge shape — every badge has the same height, radius, padding,
   font-size, line-height and vertical alignment; only colours differ. */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.badge-level {
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--text);
}
.badge-streak {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-weight: 800;
}
/* Fire icon in the streak badge — a subtle one-shot pulse when the badge renders
   (or the streak updates). The whole card never moves; only the icon scales. */
.streak-fire {
  display: inline-flex;
  align-items: center;
  transform-origin: center;
}
.streak-badge.is-active .streak-fire {
  animation: streakPulse 700ms ease-out 1;
}
@keyframes streakPulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.18); }
  70%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .streak-badge.is-active .streak-fire { animation: none; }
}
/* Big flame at the top of the session-complete modal (one-shot pulse on open). */
.done-fire {
  font-size: 56px;
  line-height: 1;
  animation: streakPulse 700ms ease-out 1;
}
@media (prefers-reduced-motion: reduce) {
  .done-fire { animation: none; }
}
/* Streak highlight in the session-complete modal (centred pill above the summary). */
.session-streak-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 10px auto 14px;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(239, 68, 68, 0.12));
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #b45309;
  font-weight: 800;
  font-size: 15.5px;
}
.session-streak-line .streak-days {
  font-size: 19px;
  font-weight: 900;
  color: #92400e;
}
.session-streak-fire {
  display: inline-flex;
  transform-origin: center;
  animation: streakPulse 700ms ease-out 1; /* one-shot when the modal appears */
}
@media (prefers-reduced-motion: reduce) {
  .session-streak-fire { animation: none; }
}
/* Compact unlock-progress bar on Home (green), below the level chip — kept lean:
   small "X / 5" + green bar on one row, short one-line helper underneath. */
.home-unlock {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 9px 13px;
  margin-bottom: 13px;
}
.hu-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hu-points {
  font-size: 13px;
  font-weight: 800;
  color: var(--secondary);
  white-space: nowrap;
}
.hu-bar {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.hu-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--success);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.hu-helper {
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-card {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-2));
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 13px;
  box-shadow: 0 14px 30px rgba(76, 29, 149, 0.32);
}
.progress-card .label {
  opacity: 0.85;
  font-size: 13px;
  font-weight: 600;
}
.progress-card .due {
  font-size: 31px;
  font-weight: 800;
  line-height: 1.1;
  margin: 2px 0 9px;
}
.progress-card .due-prog {
  font-size: 23px;
  font-weight: 800;
  line-height: 1.15;
  margin: 3px 0 4px;
}
.lvl-card-bar {
  height: 9px;
  background: rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.lvl-card-bar span {
  display: block;
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.week-strip {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.week-title {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 9px;
}
.week-days {
  display: flex;
  justify-content: space-between;
}
.week-days .wd {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.week-days .wd-l {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.7;
}
.week-days .wd-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-sizing: border-box;
}
.week-days .wd-dot.on {
  background: #fff;
  border-color: #fff;
}
.week-days .wd-today .wd-l {
  opacity: 1;
}
.week-days .wd-today .wd-dot {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.report-link {
  display: block;
  margin: 16px auto 2px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  opacity: 0.65;
}
.report-link:hover { opacity: 1; }
.report-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rep-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
}
.rep-chip.on {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}
.bar {
  height: 9px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: #fff;
  border-radius: 999px;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-bottom: 14px;
}
.stat {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
}
.stat .n {
  font-size: 24px;
  font-weight: 800;
}
.stat .t {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.stat .n.green {
  color: var(--success);
}

/* Flashcard */
.session-head {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 6px;
}
/* Minimal back arrow (replaces the big circular ✕) — small, top-left, no border */
.back-btn {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px 2px 0;
  font-family: inherit;
}
.back-btn:active {
  transform: scale(0.92);
}
/* Unlock progress is the primary, full-width element on top */
.session-top {
  margin-bottom: 12px;
}
.session-top .bar {
  background: var(--line);
}
.session-top .bar > span {
  background: var(--primary);
}
/* Unlock progress — alone on top */
.unlock-track {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
}
.unlock-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.unlock-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 13px;
  color: var(--secondary);
}
.unlock-title i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--success);
}
.unlock-points {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}
.unlock-track .bar {
  height: 10px;
}
#bar-unlock {
  background: var(--success);
}
.unlock-helper {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
/* Base + Combo — current expression only, kept apart from Unlock */
.bc-row {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  transition: opacity 0.2s ease;
}
/* On a Review card the expression is already learned, so Base/Combo recede
   and Unlock progress stays the main signal. */
.bc-row.dim {
  opacity: 0.45;
}
.bc-col {
  flex: 1;
}
.bc-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.bc-head i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.card {
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 16px 14px 22px;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  text-align: center;
}
/* type tag sits in the flow at the top-left, then the prompt is vertically
   centered in the remaining space so the card never feels top-heavy or empty */
/* BASE = purple, COMBO = orange, Review = green. */
.card .type-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
  background: rgba(76, 29, 149, 0.1);
  padding: 5px 11px;
  border-radius: 999px;
}
.card .type-tag.is-review {
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
}
.card .type-tag.is-combo {
  color: var(--primary);
  background: rgba(249, 115, 22, 0.1);
}
/* the answerable content, centered in the space under the tag */
.card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.card .why-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
}
/* Front (question) + back (answer). Font-size comes from the responsive .tx-*
   classes; here we set weight/colour and natural, non-breaking wrapping so long
   phrases flow over several clean lines instead of being squashed onto one. */
.card .front-text {
  font-weight: 800;
  letter-spacing: -0.02em;
  width: 100%;
  word-break: normal;
  overflow-wrap: anywhere;
}
.card .front-text.is-q {
  color: var(--muted);
}
.card .back-text {
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.02em;
  width: 100%;
  word-break: normal;
  overflow-wrap: anywhere;
  animation: fade 0.3s ease;
}
/* Responsive text size by length (set in app.js textSizeClass). Short phrases
   read big and bold; long ones stay legible and never break the layout. */
.card .tx-lg {
  font-size: 29px;
  line-height: 1.2;
}
.card .tx-md {
  font-size: 23px;
  line-height: 1.28;
}
.card .tx-sm {
  font-size: 18px;
  line-height: 1.38;
}
.card .tx-xs {
  font-size: 15.5px;
  line-height: 1.5;
  max-height: 34vh;
  overflow-y: auto;
}
.card .prompt {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  max-width: 240px;
}
.card .divider {
  width: 42px;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  margin: 16px 0;
}
/* MULTI cards: several source/answer pairs stacked inside ONE flashcard. */
.card .multi-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.card .multi-stack.revealed {
  gap: 0;
}
.card .multi-pair {
  width: 100%;
  padding: 14px 0;
}
.card .multi-pair + .multi-pair {
  border-top: 1.5px solid var(--line);
}
.card .multi-pair .back-text {
  margin-top: 4px;
}
.audio-btn {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
}

/* Profile study-streak card */
.streak-card {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.streak-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.streak-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}
.streak-row b { font-size: 18px; font-weight: 800; color: var(--text); }
.streak-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.streak-status.done { color: var(--secondary-2); }

/* Play button + audio speed chip, side by side under the answer. */
.audio-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.audio-row .audio-btn { margin-top: 0; }
.audio-speed { position: relative; }
.speed-chip {
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 14px;
  min-width: 52px;
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--secondary-2);
}
.speed-chip[aria-expanded="true"] { border-color: var(--secondary-2); }
/* Popover menu opens ABOVE the chip so it never sits under the action bar. */
.speed-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
  z-index: 30;
}
.speed-menu[hidden] { display: none; }
.speed-opt {
  border: none;
  background: transparent;
  border-radius: 9px;
  padding: 9px 22px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.speed-opt:hover { background: var(--bg); }
.speed-opt.active { background: var(--secondary-2); color: #fff; }

.feedback-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}
.fb {
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 6px;
  font-weight: 800;
  font-size: 13.5px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap; /* keep each label on a single line */
  transition: transform 0.12s;
}
.fb:active {
  transform: scale(0.96);
}
.fb small {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
}
.fb.red {
  background: var(--error);
}
.fb.yellow {
  background: var(--warning);
}
.fb.green {
  background: var(--success);
}

/* Session screen becomes a flex column so the primary actions pin to the bottom
   (thumb zone) while the card stays up top/centre. Layout only — no restyle. */
#screen-session.active {
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px; /* more compact than the default screen padding */
}
.session-actions {
  margin-top: auto; /* push the action bar to the bottom of the screen */
  padding-top: 16px;
}
.session-actions .feedback-row {
  margin-top: 0;
}
/* "Learn new expression" — sits in the bottom action bar, above Show answer /
   the rating buttons. Filled secondary (purple), important and thumb-reachable. */
.pending-btn {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  border: none;
  background: var(--secondary);
  color: #fff;
  border-radius: 999px;
  padding: 16px 22px;
  font-weight: 800;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(76, 29, 149, 0.32);
}
.pending-btn:active {
  transform: scale(0.97);
}

/* Level list */
.level-row {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.level-row .lv-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(249, 115, 22, 0.1);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.level-row .bars-icon {
  width: 60px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  background: rgba(76, 29, 149, 0.06);
  border-radius: 12px;
  padding: 8px 7px;
}
.level-row.current .bars-icon {
  background: rgba(249, 115, 22, 0.12);
}
.level-row .bars-icon > i {
  flex: 1;
  min-height: 3px;
  border-radius: 2px;
}
.level-row.current {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}
.level-row.current .lv-icon {
  background: var(--primary);
}
.level-row .lv-body {
  flex: 1;
}
.level-row .lv-name {
  font-weight: 800;
  font-size: 15px;
}
.level-row .lv-goal {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.level-row .lv-state {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.level-row.current .lv-state {
  color: var(--primary);
}

/* Bottom nav */
.tabbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 76px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: 8px;
}
.tab {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}
.tab .ic {
  font-size: 20px;
}
.tab.active {
  color: var(--primary);
}
.tabbar.hidden {
  display: none;
}
/* "Add" tab: keep the + icon black so it reads cleanly next to the emojis */
.tab[data-go="add"] .ic {
  color: #111827;
  font-weight: 600;
}
/* Add-vocabulary placeholder screen */
.add-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}
.add-card:active { transform: scale(0.99); }
.add-card-ic { font-size: 30px; flex-shrink: 0; }
.add-card-body { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.add-card-title { font-size: 16px; font-weight: 700; color: var(--text); }
.add-card-desc { font-size: 13px; color: var(--muted); line-height: 1.35; }
.add-card-chev { font-size: 22px; color: var(--muted); flex-shrink: 0; }
/* Sayings collection */
.sayings-filter {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  box-sizing: border-box;
}
.saying-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.saying-row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.saying-row-main b { font-size: 15px; color: var(--text); }
.saying-row-eq { font-size: 13px; color: var(--muted); }
.sd-refran { font-size: 21px; font-weight: 800; color: var(--secondary); }
.sd-eq { font-size: 16px; font-weight: 600; margin-top: 2px; }
.sd-lit { font-size: 13px; color: var(--muted); margin-top: 4px; font-style: italic; }
.sd-note { background: #f6f1fb; border-radius: 10px; padding: 9px 11px; font-size: 13.5px; margin-top: 10px; line-height: 1.4; }
.sd-ex { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; font-size: 14px; }
.sd-ex b { font-weight: 700; }
.sd-ex span { color: var(--muted); }
.saying-row.added { border-color: var(--primary); background: #FFF3E8; }
.saying-chk { font-size: 18px; color: var(--muted); flex-shrink: 0; }
.saying-row.added .saying-chk { color: var(--primary); font-weight: 700; }
.sd-disclaimer { font-size: 12px; color: var(--muted); margin-top: 14px; text-align: center; line-height: 1.4; }
.confirm-add { text-align: center; padding: 8px 4px; }
.confirm-ic { font-size: 46px; margin-bottom: 2px; }
.confirm-disc { font-size: 15px; color: var(--text); line-height: 1.5; margin: 10px 8px 0; }
.mem-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.mem-card .mem-lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.mem-card .mem-n {
  font-size: 20px;
  font-weight: 800;
  color: var(--secondary);
}

/* Modal */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: flex-end;
  z-index: 50;
  animation: fade 0.2s ease;
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  background: var(--surface);
  width: 100%;
  border-radius: 28px 28px 0 0;
  padding: 26px 22px 30px;
  animation: slideup 0.3s ease;
}
@keyframes slideup {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal .ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.modal .ai-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--secondary), var(--secondary-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.modal .q {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 8px;
}
.modal .a {
  color: #334155;
  line-height: 1.55;
  font-size: 15px;
  background: var(--bg);
  border-radius: 16px;
  padding: 16px;
}

/* Session complete */
.done-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.done-emoji {
  font-size: 64px;
  margin-bottom: 12px;
}
.toast {
  position: absolute;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: normal;
  max-width: min(340px, calc(100% - 40px));
  text-align: center;
  line-height: 1.35;
  z-index: 60;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

.section-title {
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 4px 0 12px;
}

/* Language setup */
.lang-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
}
.lang-pair {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  justify-content: center;
}
.lang-tile {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 14px;
  flex: 1;
  max-width: 140px;
  text-align: center;
  box-shadow: var(--shadow);
}
.lang-tile .flag {
  font-size: 40px;
  line-height: 1;
}
.lang-tile .lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 10px;
}
.lang-tile .lang-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
}
.lang-arrow {
  font-size: 26px;
  color: var(--primary);
  font-weight: 800;
}
.lang-headline {
  font-size: 22px;
  font-weight: 800;
  color: var(--secondary);
  text-align: center;
  margin-top: 6px;
}

/* Travel pack */
.travel-hero {
  background: linear-gradient(135deg, var(--primary), #fb923c);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 14px 30px rgba(249, 115, 22, 0.35);
  margin-bottom: 20px;
}
.travel-hero .eyebrow {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
}
.travel-hero h2 {
  font-size: 24px;
  margin-top: 6px;
}
.travel-hero p {
  margin-top: 8px;
  opacity: 0.92;
  font-size: 14px;
}
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.cat-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s;
}
.cat-card:active {
  transform: scale(0.98);
}
.cat-card .cat-ic {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(76, 29, 149, 0.1);
  display: grid;
  place-items: center;
  font-size: 20px;
}
.cat-card .cat-name {
  font-weight: 800;
  font-size: 15px;
}
.cat-card .cat-n {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.travel-foot {
  background: rgba(76, 29, 149, 0.07);
  border: 1.5px dashed rgba(76, 29, 149, 0.25);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 14px;
}
.screen-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* ===== Rebuild: session bars, chips, progress panels ===== */

/* Home progress card extras */
.progress-card .sublabel {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 2px;
}
.progress-card .helper {
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
  opacity: 0.95;
}

/* Session 3-bar progress header */
.sess-bars {
  flex: 1;
  display: flex;
  gap: 8px;
}
.mini-bar {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.mini-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.35s ease;
}
#bar-base {
  background: var(--secondary);
}
#bar-combo {
  background: var(--primary);
}
#bar-unlock {
  background: var(--success);
}
.bars-legend {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin: -10px 0 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.bars-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bars-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}
.dot-purple {
  background: var(--secondary);
}
.dot-orange {
  background: var(--primary);
}
.dot-green {
  background: var(--success);
}

/* Info chip (Route) + note row (Goal) */
.info-chip {
  background: rgba(76, 29, 149, 0.07);
  color: var(--secondary);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
}
.note-row {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Progress panels */
.panel {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}

/* Card-state distribution */
.dist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
}
.dist-row:last-child {
  margin-bottom: 0;
}
.dist-lbl {
  width: 96px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
}
.dist-bar {
  flex: 1;
  height: 9px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.dist-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
}
.dist-n {
  width: 24px;
  text-align: right;
  font-weight: 800;
  font-size: 13px;
}

/* Response-quality donut */
.donut {
  width: 144px;
  height: 144px;
  border-radius: 50%;
  margin: 4px auto 18px;
  display: grid;
  place-items: center;
}
.donut-hole {
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  text-align: center;
}
.donut-hole b {
  font-size: 24px;
  font-weight: 800;
}
.donut-hole small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.q-legend {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.q-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
}
.q-row i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}
.q-row b {
  margin-left: auto;
  font-weight: 800;
}

/* Level-progress rows */
.lvl-prog-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.lvl-prog-row:last-child {
  margin-bottom: 0;
}
.lvl-prog-code {
  width: 44px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
}
.lvl-prog-row .bar {
  flex: 1;
  background: var(--line);
}
.lvl-prog-pct {
  width: 42px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* ===== Iteration 7: language setup, route cards, level detail modal ===== */

/* Language setup — flexible, scalable selectors */
.lang-select {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}
.lang-select-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, transform 0.12s, box-shadow 0.2s;
}
.lang-select-card.open {
  border-color: var(--primary);
}
.lang-select-card.open .lang-chev {
  transform: rotate(180deg);
}
.lang-chev {
  transition: transform 0.2s;
}
/* Language picker dropdown (flag + name; scalable to more pairs) */
.lang-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 38px rgba(17, 24, 39, 0.16);
  padding: 6px;
  z-index: 120;
  animation: fadeUp 0.1s ease both;
}
.lang-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px; /* zona táctil mínima iOS */
  padding: 12px 12px;
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.lang-menu-item:hover {
  background: var(--bg);
}
.lang-menu-item.sel {
  color: var(--primary);
}
.lang-menu-item .lm-flag {
  font-size: 22px;
  line-height: 1;
}
.lang-menu-item .lm-check {
  margin-left: auto;
  color: var(--primary);
  font-weight: 800;
}
.lang-select-card:active {
  transform: scale(0.99);
}
.lang-select-card:hover {
  border-color: var(--primary);
}
.lang-flag {
  font-size: 32px;
  line-height: 1;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.lang-info {
  flex: 1;
}
.lang-role {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.lang-lang {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
}
.lang-chev {
  font-size: 22px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

/* Add Course selectors — two clean dropdown-style cards (I speak / I want to
   speak). White rounded card, label above, value + chevron chip inside; calm
   purple (not orange) hover/press. No flags in the closed selector. */
.add-field { margin-bottom: 16px; }
.add-field-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 2px 7px;
}
.select-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, transform 0.1s, background 0.15s;
}
.select-card:hover { border-color: rgba(76, 29, 149, 0.4); }
.select-card:active { transform: scale(0.99); background: var(--bg); }
.select-value { font-size: 18px; font-weight: 800; color: var(--text); }
.select-value.placeholder { color: var(--muted); font-weight: 700; }
.select-chev {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--secondary);
}

/* Add Course — direction summary + Add button (shown after a target is picked) */
.add-summary {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 4px 0 16px;
  text-align: center;
}
.add-summary-dir { font-size: 18px; font-weight: 800; color: var(--secondary); }
.add-summary-meta { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 4px; }

/* Source-language picker modal (Add Course → "I speak") */
.src-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.src-modal-close {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.src-modal-close:hover { background: var(--line); }
.src-modal-title {
  font-weight: 800;
  font-size: 18px;
  color: var(--secondary);
}
.src-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.src-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 15px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.src-row:hover {
  border-color: var(--secondary);
}
.src-row:active {
  transform: scale(0.99);
}
.src-row.sel {
  border-color: var(--secondary);
  background: rgba(76, 29, 149, 0.06);
}
.src-flag {
  font-size: 26px;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.src-name {
  flex: 1;
}
.src-check {
  margin-left: auto;
  color: var(--secondary);
  font-weight: 800;
}

/* Route cards — simplified + tappable */
.level-row.tappable {
  cursor: pointer;
  transition: border-color 0.2s, transform 0.12s, box-shadow 0.2s;
}
.level-row.tappable:active {
  transform: scale(0.99);
}
.level-row .lv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.level-row .lv-name {
  line-height: 1.25;
}
.lv-status {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.lv-status.cur {
  color: var(--primary);
  background: rgba(249, 115, 22, 0.12);
}
.lv-status.locked {
  color: var(--muted);
  background: rgba(124, 111, 99, 0.1);
}
.lv-status.done {
  color: #15803d;
  background: rgba(34, 197, 94, 0.14);
}
.level-row .lv-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.level-row .lv-meta b {
  color: var(--text);
  font-weight: 800;
}
.level-row .lv-meta .dot-sep {
  color: var(--line);
  font-weight: 800;
}
.level-row .lv-prog {
  margin-top: 10px;
}
.level-row .lv-prog .bar {
  background: var(--line);
}
.level-row .lv-prog .bar > span {
  background: var(--primary);
}
.level-row .lv-chev {
  font-size: 24px;
  color: var(--muted);
  font-weight: 400;
  flex-shrink: 0;
  align-self: center;
}

/* Level detail modal */
.lvm-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.lvm-titles {
  flex: 1;
}
.lvm-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 8px;
}
.lvm-desc {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 16px;
}
.lvm-goal {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(76, 29, 149, 0.06);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.lvm-goal-ic {
  font-size: 18px;
  line-height: 1.3;
}
.lvm-goal-lbl {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.lvm-goal-txt {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--secondary);
  margin-top: 2px;
}
.lvm-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.lvm-stat {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
}
.lvm-stat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.lvm-stat span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.lvm-bar {
  background: var(--line);
  height: 10px;
}
.lvm-bar > span {
  background: var(--primary);
}

/* ============================================================
   Welcome / Profile / My Languages  (added — iteration 20)
   Remove this block + the matching HTML/JS to revert this feature.
   ============================================================ */

/* --- Welcome screen --- */
/* Don't set `display` on .welcome — it would override `.screen{display:none}` and
   keep this screen always visible. Visibility stays controlled by `.screen.active`. */
.welcome { text-align: center; }
/* Three-part column: header (top) · decorative preview (flexes to fill the middle)
   · actions (pinned lower) — so the login block sits lower and the screen isn't empty. */
/* Full padding (not the .screen default 110px bottom — there's no tab bar here):
   content starts a little lower and the actions sit closer to the bottom edge so
   the lower half feels used, not empty. */
/* One tightly-grouped stack, centred and biased slightly lower (more top padding
   than bottom). Fixed, modest gaps between hero → card → login keep everything
   connected instead of floating apart — no flex:1 spreader. */
#screen-onboarding.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px 22px 30px; /* more bottom than top → logo + hero sit a little higher */
}
.welcome-head { margin-top: 0; }
/* Negative bottom margin absorbs the empty space inside the logo image so the
   hero text sits higher, just under the wordmark. */
.welcome-logo { margin: 0 auto 8px; }
.welcome-logo img { width: min(320px, 82%); height: auto; }
.welcome-title { font-size: 26px; line-height: 1.2; text-align: center; }
.welcome-sub { text-align: center; font-size: 14px; margin: 9px 10px 0; line-height: 1.45; }
/* Clear breathing room between the hero text and the flashcard (the main change). */
.welcome-preview { flex: 0 0 auto; display: flex; justify-content: center; margin-top: 22px; }
.welcome-actions { flex: 0 0 auto; margin-top: 18px; }
/* Login: línea que aclara "crear cuenta o entrar" + enlace compacto de email. */
.auth-hint { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; margin: 0 0 2px; }
/* Banner de consentimiento de analítica (RGPD) — barra flotante inferior. */
.consent-banner {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 9999;
  width: min(440px, calc(100% - 24px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(17, 24, 39, 0.18); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.consent-txt { font-size: 13px; color: var(--text); line-height: 1.4; }
.consent-btns { display: flex; gap: 8px; justify-content: flex-end; }
.consent-btns .btn { padding: 8px 16px; font-size: 13.5px; flex: 0 0 auto; }
.email-reveal { background: none; border: 0; color: var(--secondary); font-weight: 600; font-size: 13.5px; cursor: pointer; padding: 4px; text-align: center; }
.email-reveal:active { transform: scale(0.99); }
/* En pantallas bajas, la tarjeta decorativa se oculta para que todo quepa sin scroll. */
@media (max-height: 720px) { .welcome-preview { display: none; } .welcome-sub { display: none; } }
.welcome-foot { font-size: 11.5px; text-align: center; margin-top: 12px; line-height: 1.4; }
.welcome-terms { margin-top: 4px; }

/* Decorative mini flashcard on the Welcome screen */
.preview-card {
  width: 100%;
  max-width: 304px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(17, 24, 39, 0.13);
  padding: 26px 22px 26px;
  text-align: center;
  transform: rotate(-1.5deg);
}
.preview-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: rgba(249, 115, 22, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
}
.preview-front { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-top: 18px; color: var(--text); }
.preview-divider { width: 42px; height: 3px; background: var(--line); border-radius: 999px; margin: 14px auto; }
.preview-back { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--secondary); }
.btn-text { background: none; border: none; color: var(--secondary); font-weight: 800; font-size: 15px; cursor: pointer; font-family: inherit; }
.btn-text:active { transform: scale(0.98); }

/* --- Profile header --- */
.profile-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.profile-top { display: flex; align-items: center; gap: 14px; }
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; background: rgba(76,29,149,0.1); display: grid; place-items: center; font-size: 28px; flex: none; }
.profile-name { font-size: 20px; font-weight: 800; color: var(--text); }
.profile-email { font-size: 13px; margin-top: 2px; }
.profile-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(76,29,149,0.08); color: var(--secondary); border-radius: 999px; padding: 7px 12px; font-size: 12.5px; font-weight: 700; }
.pill .pill-ic { font-size: 13px; }

/* --- Profile menu list --- */
.menu-list { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.menu-row { display: flex; align-items: center; gap: 14px; width: 100%; background: none; border: none; border-bottom: 1px solid var(--line); padding: 14px 16px; font-family: inherit; font-size: 16px; font-weight: 700; color: var(--text); cursor: pointer; }
.menu-row:last-child { border-bottom: none; }
.menu-row:active { background: rgba(0,0,0,0.03); }
.menu-ic { width: 34px; height: 34px; border-radius: 12px; background: rgba(76,29,149,0.08); display: grid; place-items: center; font-size: 17px; flex: none; }
.menu-label { flex: 1; text-align: left; }
.menu-chev { color: var(--muted); font-size: 20px; }
.menu-row.danger { color: var(--primary); }
.menu-row.danger .menu-ic { background: rgba(249,115,22,0.1); }

/* --- Profile "active courses" rows --- */
.courses-card { padding: 14px 16px; text-align: left; }
.course-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.course-row.bordered { border-top: 1px solid var(--line); }
.course-code { width: 38px; height: 38px; border-radius: 50%; background: var(--secondary); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; letter-spacing: .02em; }
.course-row-main { flex: 1; min-width: 0; }
.course-row-title { font-weight: 800; font-size: 15px; }
.course-row-sub { font-size: 12.5px; margin-top: 1px; }
.pill.cur { background: rgba(76,29,149,0.1); }
.course-chev { color: var(--muted); font-size: 20px; }

/* --- My Languages: course cards + add course --- */
.course-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.course-card-ic { width: 46px; height: 46px; border-radius: 14px; background: rgba(76,29,149,0.08); display: grid; place-items: center; font-size: 22px; flex: none; }
.course-card-main { flex: 1; min-width: 0; }
.course-card-title { font-weight: 800; font-size: 16px; }
.course-card-sub { font-size: 13px; margin-top: 3px; }
.status-badge.is-cur { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; background: rgba(76,29,149,0.1); color: var(--secondary); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; font-weight: 800; }
.course-card-prog { text-align: center; flex: none; }
.course-prog-n { font-weight: 800; font-size: 14px; color: var(--secondary); white-space: nowrap; }
.course-prog-lbl { font-size: 11px; }
.add-course-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; background: none; border: 2px dashed var(--primary); color: var(--primary); border-radius: var(--radius); padding: 14px; font-family: inherit; font-weight: 800; font-size: 15px; cursor: pointer; margin-top: 2px; }
.add-course-btn:active { transform: scale(0.99); }

/* ============================================================
   Login / Course setup / My courses  (added — iteration 21)
   ============================================================ */

/* --- Welcome / Login buttons --- */
.login-stack { gap: 11px; }
.social-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 14px 18px;
  font-family: inherit; font-weight: 700; font-size: 15px;
  color: var(--text); cursor: pointer;
  box-shadow: 0 4px 12px rgba(124, 45, 18, 0.05);
}
.social-btn:active { transform: scale(0.99); }
.social-ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; display: grid; place-items: center; }

/* --- Profile: guest "create account" mini button --- */
.profile-id { min-width: 0; }
.mini-btn { margin-top: 7px; background: var(--primary); color: #fff; border: none; border-radius: 999px; padding: 6px 14px; font-family: inherit; font-weight: 800; font-size: 12.5px; cursor: pointer; }
.mini-btn:active { transform: scale(0.98); }

/* --- My courses: balanced course cards (left icon · centre info · right action) --- */
.course-card2 { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; cursor: pointer; }
.course-card2.current { border-color: rgba(76, 29, 149, 0.35); cursor: default; }
.course-card2 .course-card-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--secondary); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; letter-spacing: .02em; }
.course-card2 .course-card-flag { background: rgba(76, 29, 149, 0.08); font-size: 23px; }
.course-card2 .course-card-main { flex: 1; min-width: 0; text-align: left; }
.cc-title { font-weight: 800; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.cc-status { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; }
.cc-status.cur { color: var(--secondary); background: rgba(76, 29, 149, 0.1); }
.cc-status.new { color: var(--primary); background: rgba(249, 115, 22, 0.12); }
.cc-status.active { color: #16a34a; background: rgba(34, 197, 94, 0.12); }
.cc-lvl { font-size: 12px; color: var(--muted); font-weight: 600; }
.cc-count { font-size: 12px; color: var(--secondary); font-weight: 700; margin-top: 5px; }
.courses-note { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin: 2px 2px 14px; }
.course-card-bar { height: 6px; margin-top: 6px; background: var(--line); }
.course-card-bar > span { background: var(--success); }
.switch-btn { flex: none; align-self: center; background: rgba(249, 115, 22, 0.12); color: var(--primary); border: none; border-radius: 999px; padding: 7px 12px; font-family: inherit; font-weight: 800; font-size: 12.5px; cursor: pointer; }
.switch-btn:active { transform: scale(0.97); }
/* Small "⋯" options button on each My-Courses card (reset / remove). */
.cc-manage {
  flex: none;
  align-self: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.cc-manage:hover { background: var(--line); }
.cc-manage:active { transform: scale(0.95); }
/* Danger action button (reset / remove) — uses the design's error red. */
.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover { filter: brightness(0.95); }
/* Confirm/manage modal text. */
.cm-title { font-weight: 800; font-size: 18px; color: var(--secondary); text-align: center; }
.cm-msg { color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; margin: 8px 4px 18px; }
#course-confirm-body .stack { gap: 10px; }

/* ---- Nota pedagógica "i" (chip discreto junto a la velocidad de audio) ---- */
.card-note { margin: 0; text-align: left; }
.card-note summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center;
  justify-content: center; width: 38px; height: 38px; border-radius: 999px;
  border: 1.5px solid var(--line, #ddd); background: var(--surface, #fff);
  user-select: none;
}
.card-note .note-i {
  font-family: Georgia, "Times New Roman", serif; font-style: italic;
  font-weight: 700; font-size: 16px; line-height: 1; color: #1f2937;
}
.card-note summary::-webkit-details-marker { display: none; }
.card-note[open] summary { border-color: #1f2937; }
/* Abierta: el párrafo salta a una línea propia a lo ancho (la audio-row hace wrap). */
.audio-row .card-note[open] { flex-basis: 100%; }
.audio-row .card-note[open] summary { margin: 0 auto; }
.card-note p {
  margin: 8px 0 0; padding: 12px 14px; border-radius: 12px; font-size: .92rem;
  line-height: 1.45; background: var(--bg, #f7f7f8);
  border: 1px solid var(--line, #ddd); color: var(--text, #1f2937);
}
/* Add screen: locked / coming-soon states */
.add-card.add-locked { opacity: .6; }
.add-badge { display: block; margin-top: 6px; font-size: 12px; font-weight: 700;
  color: var(--primary); background: #FFF3E8; padding: 6px 10px; border-radius: 10px; }
/* Teacher note: titled box, one idea per line (overrides the old single-p box) */
.note-box {
  margin: 8px 0 0; padding: 12px 14px; border-radius: 12px;
  background: var(--bg, #f7f7f8); border: 1px solid var(--line, #ddd);
  text-align: left;
}
.note-box .note-title {
  font-size: .72rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted, #6b7280); margin-bottom: 4px;
}
.card-note .note-box p {
  margin: 6px 0 0; padding: 0; border: 0; background: none;
  font-size: .92rem; line-height: 1.5; color: var(--text, #1f2937);
}
.card-note .note-box p:first-of-type { margin-top: 0; }
/* Coach marks: one-time contextual tips during the first session */
#coach-bubble {
  position: fixed; z-index: 400; background: var(--secondary, #4C1D95); color: #fff;
  padding: 12px 14px; border-radius: 14px; font-size: .92rem; line-height: 1.45;
  box-shadow: 0 12px 30px rgba(76, 29, 149, .38); cursor: pointer;
  animation: coachIn .25s ease; overflow: visible;
}
/* La mascota va DE PIE sobre el borde superior de la burbuja: su base solapa solo
   el padding (10px), nunca el texto, y el cuerpo queda por encima de la burbuja. */
#coach-bubble .coach-masc {
  position: absolute; left: 10px; bottom: calc(100% - 10px); top: auto;
  width: 50px; height: auto; z-index: 1;
  filter: drop-shadow(0 5px 9px rgba(28, 20, 40, .28)); pointer-events: none;
}
#coach-bubble .coach-ok { margin-top: 8px; font-weight: 800; font-size: .8rem; opacity: .85; text-align: right; }
@keyframes coachIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* "How does it work?" recap steps */
.howto-step {
  margin: 10px 0; padding: 10px 12px; background: var(--bg, #f7f7f8);
  border: 1px solid var(--line, #ddd); border-radius: 12px; font-size: .95rem; line-height: 1.5;
}
/* "Cómo funciona" visual (mascota + pasos + curva) */
.hiw-head { text-align: center; margin: 2px 0 14px; }
.hiw-head img { width: 78px; height: auto; filter: drop-shadow(0 6px 12px rgba(0,0,0,.14)); }
.hiw-head h2 { font-size: 1.35rem; margin-top: 4px; color: var(--secondary, #4C1D95); }
.hiw-step { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line, #eee); }
.hiw-step:last-of-type { border-bottom: 0; }
.hiw-step > img { flex: 0 0 auto; width: 46px; height: auto; }
.hiw-step > div { font-size: .95rem; line-height: 1.5; }
.hiw-step b { color: var(--secondary, #4C1D95); }
.hiw-curve { margin-top: 10px; background: var(--bg, #FBF3EA); border: 1px solid var(--line, #eee); border-radius: 14px; padding: 12px 10px 6px; }
.hiw-curve svg { width: 100%; height: auto; display: block; }
/* Soft-gate (invitación a crear cuenta al terminar la sesión) */
#done-softgate { margin: 2px 0 16px; padding: 16px 16px 12px; background: var(--bg, #FBF3EA); border: 1px solid var(--line, #eee); border-radius: 16px; text-align: center; }
#done-softgate .softgate-masc { width: 56px; height: auto; margin-bottom: 2px; }
#done-softgate .softgate-title { font-weight: 800; color: var(--secondary, #4C1D95); font-size: 1.06rem; }
#done-softgate .softgate-text { color: var(--muted, #7C7168); font-size: .9rem; line-height: 1.5; margin: 5px 0 12px; }
/* Interruptor de Ajustes */
.ll-toggle { flex: none; width: 46px; height: 27px; border-radius: 999px; background: #d8cfc2; border: 0; position: relative; cursor: pointer; transition: background .16s; padding: 0; }
.ll-toggle.on { background: #22C55E; }
.ll-toggle .ll-knob { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 999px; background: #fff; transition: left .16s; box-shadow: 0 1px 3px rgba(0,0,0,.28); }
.ll-toggle.on .ll-knob { left: 22px; }
