:root {
  --ink: #12263a;
  --ink-2: #31465e;
  --muted: #738297;
  --bg: #f4f0e8;
  --card: #ffffff;
  --line: #e7e0d5;
  --soft: #f2ede4;
  --navy: #123a6b;
  --navy-2: #1d4f8a;
  --coral: #e26d5a;
  --coral-2: #f08a78;
  --mint: #2f9e7e;
  --sun: #e9a83b;
  --violet: #7c6bc4;
  --shadow: 0 8px 24px rgba(18, 38, 58, 0.06);
  --radius: 20px;
  --tabbar-h: 74px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 50% -10%, #fdfbf6 0%, #edf1f5 48%, #dfe7ef 100%);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
svg { display: block; }
:focus-visible { outline: 3px solid rgba(226, 109, 90, 0.55); outline-offset: 2px; }

.app-shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  background: var(--bg);
  overflow: hidden;
}

.proto-note { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  background: rgba(244, 240, 232, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(145deg, var(--navy), var(--navy-2));
  box-shadow: 0 6px 14px rgba(18, 58, 107, 0.25);
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-sub {
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 9px;
  border: 1px solid #f0d9c1;
  border-radius: 11px;
  background: #fff7ec;
  font-size: 12px;
  color: #8a5a12;
}

.streak-pill b { font-size: 12px; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-2);
  font-weight: 800;
  cursor: pointer;
}

.screen {
  padding: 8px 18px 26px;
  animation: fade 0.18s ease;
}

@keyframes fade { from { opacity: 0.55; transform: translateY(3px); } to { opacity: 1; transform: none; } }

h1, h2, h3, p { margin-top: 0; }

.page-head { padding: 8px 2px 4px; }
.page-head h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.045em; line-height: 1.08; }
.page-head p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

.welcome {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 12px;
}
.welcome h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.045em; line-height: 1.1; }
.welcome p { margin: 0; font-size: 12px; color: var(--muted); }
.avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  border: none;
  color: #fff;
  background: linear-gradient(135deg, #10345f 0%, #1d4f8a 58%, #2b6ba8 100%);
  box-shadow: 0 16px 34px rgba(18, 58, 107, 0.24);
}
.hero::before {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -90px;
  top: -110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
}
.hero::after {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  right: 30px;
  bottom: -90px;
  border-radius: 50%;
  background: rgba(240, 138, 120, 0.18);
}
.hero-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.eyebrow {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero .eyebrow { color: #b9d2ee; }
.hero h1 { margin: 5px 0 7px; font-size: 25px; line-height: 1.08; letter-spacing: -0.04em; }
.hero p { margin: 0 0 14px; max-width: 250px; font-size: 12px; line-height: 1.5; color: #d8e6f6; }
.hero-meta { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.hero .btn { position: relative; z-index: 1; }

.ring {
  --p: 20;
  position: relative;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#f4b860 calc(var(--p) * 1%), rgba(255, 255, 255, 0.2) 0);
}
.ring::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #15406f;
}
.ring span { position: relative; z-index: 1; font-size: 12px; font-weight: 800; color: #fff; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.chip.light { background: rgba(255, 255, 255, 0.13); color: #eaf3fd; }
.chip.coral { background: #fde9e5; color: #a63d2c; }
.chip.mint { background: #e2f4ee; color: #1f6f59; }
.chip.navy { background: #e7eef8; color: var(--navy); }
.chip.amber { background: #fdf1d8; color: #8a5a12; }
.chip.violet { background: #eeeafb; color: #5a4aa5; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:active { transform: scale(0.985); }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.coral { background: var(--coral); box-shadow: 0 8px 18px rgba(226, 109, 90, 0.28); }
.btn.coral:hover { background: #d95e4b; }
.btn.soft { background: var(--soft); color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); box-shadow: none; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 8px 11px; border-radius: 10px; font-size: 11px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 2px 10px;
}
.section-title h2 { margin: 0; font-size: 15px; letter-spacing: -0.02em; }
.section-title span, .section-title a { font-size: 10px; color: var(--muted); font-weight: 700; text-decoration: none; }
.section-title a { color: var(--coral); }

.stack { display: grid; gap: 10px; }
.stack-sm { display: grid; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 11px; line-height: 1.45; }
.tiny { font-size: 10px; line-height: 1.4; }
.center { text-align: center; }

/* Routine */
.routine-card { padding: 14px 16px 8px; }
.routine-bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-bottom: 8px; }
.routine-bar > i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--coral), #f2a45a); transition: width 0.28s ease; }
.task {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border: none;
  border-bottom: 1px dashed var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.task:last-child { border-bottom: none; }
.task-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #eef3f9;
  color: var(--navy);
}
.task-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.task-copy { min-width: 0; flex: 1; }
.task-copy b { display: block; font-size: 12px; }
.task-copy small { display: block; margin-top: 2px; font-size: 10px; color: var(--muted); }
.check {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid #d7cfc2;
  border-radius: 50%;
  color: transparent;
  font-size: 12px;
  font-weight: 900;
  transition: 0.15s ease;
}
.task.done .check { border-color: var(--mint); background: var(--mint); color: #fff; }
.task.done .task-copy b { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }

/* Phrase */
.phrase-card { position: relative; overflow: hidden; background: linear-gradient(180deg, #fff 0%, #fbf7ef 100%); }
.phrase-en { margin: 7px 0 4px; font-size: 18px; line-height: 1.25; font-weight: 800; letter-spacing: -0.03em; }
.phrase-es { font-size: 11px; line-height: 1.45; color: var(--muted); }
.phrase-card .row { margin-top: 12px; }

/* Path */
.path { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.path-step { text-align: center; min-width: 0; }
.path-dot {
  width: 26px;
  height: 26px;
  margin: 0 auto 5px;
  display: grid;
  place-items: center;
  border: 2px solid #d9d1c4;
  border-radius: 50%;
  background: #fff;
  color: #a99f91;
  font-size: 10px;
  font-weight: 900;
}
.path-step span { display: block; font-size: 8px; line-height: 1.15; color: var(--muted); font-weight: 700; }
.path-step.done .path-dot { border-color: var(--mint); background: var(--mint); color: #fff; }
.path-step.active .path-dot { border-color: var(--coral); background: var(--coral); color: #fff; box-shadow: 0 0 0 4px #fde9e5; }
.path-step.active span { color: var(--coral); }
.week-focus { margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 11px; line-height: 1.45; color: var(--ink-2); }

/* Weeks */
.week {
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(18, 38, 58, 0.035);
}
.week-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.wk {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--soft);
  color: var(--navy);
  font-size: 10px;
  font-weight: 900;
}
.week.current .wk { background: #e7eef8; color: var(--navy); }
.wk-copy { flex: 1; min-width: 0; }
.wk-copy b { display: block; font-size: 12px; letter-spacing: -0.01em; }
.wk-copy small { display: block; margin-top: 2px; font-size: 9px; color: var(--muted); }
.chev { color: var(--muted); font-size: 18px; line-height: 1; transition: transform 0.2s ease; }
.week.open .chev { transform: rotate(90deg); }
.week-body { display: none; padding: 0 10px 10px; }
.week.open .week-body { display: grid; gap: 7px; }
.week-note {
  margin: 0 2px 4px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #fbf8f2;
  font-size: 9px;
  line-height: 1.4;
  color: var(--muted);
}

.class-card {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.class-card:hover { border-color: #d9cfc0; }
.class-card:active { transform: scale(0.995); }
.class-num {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #f5f0e8;
  color: var(--navy);
  font-size: 11px;
  font-weight: 900;
}
.class-copy { flex: 1; min-width: 0; }
.class-copy b { display: block; margin-top: 3px; font-size: 11px; line-height: 1.25; }
.class-copy small { display: block; margin-top: 2px; font-size: 9px; line-height: 1.35; color: var(--muted); }
.class-copy .stage { display: inline-block; }

.stage {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.stage.learn { background: #e7eef8; color: var(--navy); }
.stage.understand { background: #e2f4ee; color: #1f6f59; }
.stage.communicate { background: #fde9e5; color: #a63d2c; }
.stage.apply { background: #fdf1d8; color: #8a5a12; }
.stage.evaluate { background: #eeeafb; color: #5a4aa5; }

/* Class detail */
.detail-top { display: flex; align-items: center; gap: 8px; padding: 6px 0 12px; }
.detail-top .chip { margin-left: auto; }
.detail-head h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.05; letter-spacing: -0.045em; }
.detail-head p { margin: 0 0 14px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.target-card { background: linear-gradient(180deg, #fff, #fbf7ef); }
.target {
  margin: 7px 0 10px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.formula {
  margin: 8px 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef3f9;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}
.example { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 12px; line-height: 1.4; }
.example:last-child { border-bottom: none; }
.example b { color: var(--navy); }
.tip { margin-top: 9px; padding: 9px 10px; border-radius: 10px; background: #fff7ec; font-size: 10px; line-height: 1.45; color: #7a5312; }

.vocab-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.vocab-item:last-child { border-bottom: none; }
.vocab-copy { flex: 1; min-width: 0; }
.vocab-en { font-size: 12px; font-weight: 800; }
.vocab-es { margin-top: 1px; font-size: 10px; color: var(--muted); }
.vocab-ex { margin-top: 2px; font-size: 9px; color: #8b7c6b; font-style: italic; }
.speak-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: #e7eef8;
  color: var(--navy);
  cursor: pointer;
}
.speak-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.quiz-opt {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
}
.quiz-opt:last-child { margin-bottom: 0; }
.quiz-opt.correct { border-color: #8fd1bc; background: #e2f4ee; }
.quiz-opt.incorrect { border-color: #f1b3a7; background: #fde9e5; }

textarea, input[type="text"] {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}
textarea:focus, input[type="text"]:focus { border-color: #c9bfae; outline: none; box-shadow: 0 0 0 3px rgba(226, 109, 90, 0.12); }
textarea { min-height: 78px; }

.word-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.word-chips span { padding: 5px 8px; border-radius: 7px; background: var(--soft); font-size: 9px; font-weight: 700; }

.self-rate { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.self-rate button {
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.self-rate button:hover { border-color: var(--coral); }

.banner {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ec;
  border: 1px solid #f0dfc4;
  font-size: 10px;
  line-height: 1.45;
  color: #7a5312;
}

/* Practice */
.practice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.practice-card {
  position: relative;
  min-height: 118px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(18, 38, 58, 0.035);
}
.practice-card:hover { border-color: #d9cfc0; }
.practice-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--soft); color: var(--navy); margin-bottom: 10px; }
.practice-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.practice-card b { display: block; font-size: 12px; }
.practice-card small { display: block; margin-top: 3px; font-size: 9px; line-height: 1.35; color: var(--muted); }
.practice-card .badge { position: absolute; top: 10px; right: 10px; padding: 3px 6px; border-radius: 6px; background: #fdf1d8; color: #8a5a12; font-size: 8px; font-weight: 900; }

.flashcard { text-align: center; padding: 22px 16px; }
.flash-en { margin: 8px 0 5px; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -0.035em; }
.flash-es { font-size: 11px; color: var(--muted); }
.flash-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.flash-actions .btn { min-height: 38px; padding: 8px 4px; font-size: 10px; }

/* Progress */
.skill-card { padding: 14px 16px; }
.skill-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.skill-row:last-child { border-bottom: none; }
.skill-name { width: 104px; flex: 0 0 auto; font-size: 10px; font-weight: 800; }
.segs { display: flex; gap: 3px; flex: 1; }
.seg { height: 7px; flex: 1; border-radius: 99px; background: #ece6dc; }
.seg.on { background: var(--c, var(--coral)); }
.skill-level { width: 38px; flex: 0 0 auto; text-align: right; font-size: 9px; font-weight: 800; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.stat { padding: 11px 6px; border: 1px solid var(--line); border-radius: 13px; background: #fff; text-align: center; }
.stat b { display: block; font-size: 18px; letter-spacing: -0.03em; }
.stat span { display: block; margin-top: 1px; font-size: 8px; color: var(--muted); font-weight: 700; }

.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heat-day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 7px; background: #ece6dc; color: #a99f91; font-size: 8px; font-weight: 800; }
.heat-day.on { background: #cdeee3; color: #1f6f59; }
.heat-day.today { box-shadow: 0 0 0 2px var(--coral); }

.report-card { background: linear-gradient(135deg, #fff 0%, #fbf3e7 100%); }

/* More */
.survival-card { background: linear-gradient(135deg, #123a6b 0%, #1d4f8a 100%); color: #fff; border: none; }
.survival-card .eyebrow { color: #b9d2ee; }
.survival-phrase { margin: 7px 0 4px; font-size: 18px; line-height: 1.25; font-weight: 800; letter-spacing: -0.03em; }
.survival-es { font-size: 11px; line-height: 1.45; color: #d8e6f6; }
.survival-card .btn { margin-top: 12px; }

.list { display: grid; gap: 7px; }
.list-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(18, 38, 58, 0.03);
}
.list-item:hover { border-color: #d9cfc0; }
.li-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; background: var(--soft); color: var(--navy); }
.li-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.li-copy { flex: 1; min-width: 0; }
.li-copy b { display: block; font-size: 11px; }
.li-copy small { display: block; margin-top: 2px; font-size: 9px; color: var(--muted); }
.li-chev { color: var(--muted); font-size: 17px; }

.install-card { margin-top: 14px; padding: 16px; border-radius: 16px; background: #fff; border: 1px dashed #d9cfc0; text-align: center; }
.install-card b { font-size: 12px; }
.install-card p { margin: 4px 0 10px; font-size: 10px; line-height: 1.45; color: var(--muted); }

/* Tabbar */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(18, 38, 58, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 2px 5px;
  border: none;
  border-radius: 11px;
  background: none;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}
.tab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--navy); }
.tab.active svg { stroke: var(--coral); }
.tab.active::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--coral); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  z-index: 70;
  max-width: 88vw;
  padding: 10px 14px;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Sheet */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(18, 38, 58, 0.46);
  padding: 0;
}
.sheet[hidden] { display: none; }
.sheet-card {
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  overflow: auto;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  animation: sheet-up 0.22s ease;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.65; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.sheet-close { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-2); font-size: 16px; cursor: pointer; }

.recorder { display: flex; flex-direction: column; align-items: center; gap: 13px; padding: 10px 0 4px; }
.rec-prompt { margin: 0; font-size: 13px; line-height: 1.5; text-align: center; color: var(--ink-2); }
.mic-big {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--coral), #d95e4b);
  color: #fff;
  box-shadow: 0 12px 28px rgba(226, 109, 90, 0.35);
  cursor: pointer;
}
.mic-big svg { width: 32px; height: 32px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mic-big.recording { animation: pulse 1.15s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(226, 109, 90, 0.42); }
  70% { box-shadow: 0 0 0 20px rgba(226, 109, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(226, 109, 90, 0); }
}
.rec-time { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 28px; }
.wave span { width: 3px; height: 7px; border-radius: 99px; background: var(--coral); opacity: 0.45; }
.wave.live span { animation: wave 0.8s infinite ease-in-out; opacity: 1; }
.wave span:nth-child(2n) { animation-delay: 0.12s; }
.wave span:nth-child(3n) { animation-delay: 0.24s; }
@keyframes wave { 0%, 100% { height: 7px; } 50% { height: 24px; } }

/* Self rating */
.rate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.rate-row:last-of-type { border-bottom: none; }
.rate-name {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.rate-btns { display: flex; gap: 4px; flex: 0 0 auto; }
.rate-btns button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.rate-btns button:hover { border-color: #d9cfc0; color: var(--ink-2); }
.rate-btns button.on {
  border-color: var(--coral);
  background: #fde9e5;
  color: #a63d2c;
}

/* Agenda */
.agenda-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.agenda-row:last-child { border-bottom: none; }
.agenda-copy { flex: 1; min-width: 0; font-size: 11px; line-height: 1.35; }
.agenda-time { flex: 0 0 auto; font-size: 10px; font-weight: 800; color: var(--muted); }

/* Print */
@media print {
  body { background: #fff; }
  .topbar, .tabbar, .proto-note, .sheet-close, .toast, .btn { display: none !important; }
  .app-shell { max-width: none; box-shadow: none; padding: 0; }
  .sheet { position: static; display: block; background: #fff; padding: 0; }
  .sheet-card { max-width: none; max-height: none; border-radius: 0; box-shadow: none; }
}

/* Desktop preview */
@media (min-width: 860px) {
  body { padding: 22px 0; }
  .app-shell {
    min-height: calc(100dvh - 44px);
    border-radius: 30px;
    box-shadow: 0 0 0 1px rgba(18, 38, 58, 0.06), 0 30px 80px rgba(18, 38, 58, 0.2);
  }
  .tabbar { max-width: 480px; border-radius: 0 0 30px 30px; }
  .proto-note {
    position: fixed;
    left: 24px;
    top: 24px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid rgba(18, 38, 58, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--muted);
    font-size: 10px;
    backdrop-filter: blur(10px);
  }
  .proto-note b { color: var(--ink-2); }
  .proto-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }
}

@media (max-width: 359px) {
  .screen { padding-left: 14px; padding-right: 14px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .hero h1 { font-size: 22px; }
  .detail-head h1 { font-size: 24px; }
  .practice-grid { grid-template-columns: 1fr; }
  .practice-card { min-height: 96px; }
  .focus-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- v0.2 · gramática + escritura ---------- */
.focus-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.focus-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, #fff, #fbf7ef);
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.focus-card:hover { border-color: #d9cfc0; }
.focus-card b { font-size: 12px; line-height: 1.2; letter-spacing: -0.02em; }
.focus-card small { font-size: 9px; line-height: 1.3; color: var(--muted); }
.focus-card .eyebrow { font-size: 8px; }
.focus-icon {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 9px; background: var(--soft); color: var(--navy); margin-bottom: 2px;
}
.focus-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.focus-go { margin-top: auto; padding-top: 6px; font-size: 9px; font-weight: 900; color: var(--coral); }

.grammar-hero { background: linear-gradient(170deg, #fff 0%, #f6f9f7 100%); }
.grammar-title { margin: 5px 0 0; font-size: 19px; line-height: 1.15; letter-spacing: -0.035em; }
.grammar-rule {
  margin: 10px 0;
  padding: 10px 11px;
  border-left: 3px solid var(--mint);
  border-radius: 0 10px 10px 0;
  background: #eef8f4;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-2);
}
.grammar-rule b { color: #1f6f59; }
.grammar-examples { display: grid; gap: 2px; }
.grammar-example {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 0; border-bottom: 1px dashed var(--line);
  font-size: 12px; line-height: 1.35; font-weight: 600;
}
.grammar-example:last-child { border-bottom: none; }
.grammar-practice { padding-top: 4px; }

.week-chips {
  display: flex; gap: 5px; overflow-x: auto; padding: 2px 2px 8px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.week-chips::-webkit-scrollbar { display: none; }
.week-chip {
  flex: 0 0 auto; min-width: 42px; padding: 6px 7px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  text-align: center; cursor: pointer; color: var(--ink);
}
.week-chip b { display: block; font-size: 10px; }
.week-chip small { display: block; margin-top: 1px; font-size: 8px; color: var(--muted); font-weight: 700; }
.week-chip.on { border-color: var(--coral); background: #fde9e5; color: #a63d2c; }
.week-chip.on small { color: #a63d2c; }
.week-chip.complete { border-color: #8fd1bc; background: #e2f4ee; }
.week-chip.complete small { color: #1f6f59; }
.week-chip.on.complete { border-color: var(--mint); background: #d6f0e8; }

.gex { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.gex:last-of-type { border-bottom: none; }
.gex-q { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; line-height: 1.4; margin-bottom: 7px; }
.gex-num {
  width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; background: var(--navy); color: #fff; font-size: 9px; font-weight: 900;
}
.gex-opts .quiz-opt { font-size: 11px; }
.gex-why {
  margin-top: 7px; padding: 8px 9px; border-radius: 8px;
  background: #f2ede4; font-size: 10px; line-height: 1.45; color: var(--ink-2);
}
.gex-why[hidden] { display: none; }
.grammar-map { padding: 6px 14px; }
.gmap-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 0; border: none; border-bottom: 1px dashed var(--line);
  background: transparent; text-align: left; cursor: pointer; color: var(--ink);
}
.gmap-row:last-child { border-bottom: none; }
.gmap-copy { flex: 1; min-width: 0; }
.gmap-copy b { display: block; font-size: 10px; line-height: 1.2; }
.gmap-copy small { display: block; margin-top: 1px; font-size: 8px; color: var(--muted); line-height: 1.25; }

.write-card { background: linear-gradient(170deg, #fff 0%, #fdf8f0 100%); }
.write-title { margin: 5px 0 0; font-size: 19px; line-height: 1.15; letter-spacing: -0.035em; }
.word-bank { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.word-chip {
  padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--soft); color: var(--ink-2); font-size: 9px; font-weight: 700; cursor: pointer;
}
.word-chip:hover { border-color: #d9cfc0; background: #fff; }
.write-card textarea { min-height: 150px; font-size: 13px; line-height: 1.65; }
.write-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.wordcount { font-size: 9px; font-weight: 800; color: var(--muted); }
.wordcount.met { color: #1f6f59; }
.saved-note { font-size: 8px; color: var(--muted); text-align: right; }
.write-check { margin-top: 9px; padding: 8px 10px; border-radius: 9px; background: #f7f3eb; }
.write-check summary { font-size: 10px; font-weight: 800; cursor: pointer; color: var(--ink-2); }
.write-check ul { margin: 6px 0 0; padding-left: 16px; }
.write-check li { font-size: 9px; line-height: 1.5; color: var(--ink-2); }
.write-model { margin-top: 10px; padding: 10px; border: 1px dashed #d9cfc0; border-radius: 10px; background: #fff; }
.write-model[hidden] { display: none; }
.w-saved-list { padding: 6px 14px; }
.w-saved {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 0; border: none; border-bottom: 1px dashed var(--line);
  background: transparent; text-align: left; cursor: pointer; color: var(--ink);
}
.w-saved:last-child { border-bottom: none; }
.w-saved-n {
  width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 8px; background: #e7eef8; color: var(--navy); font-size: 9px; font-weight: 900;
}
.w-saved-copy { flex: 1; min-width: 0; }
.w-saved-copy b { display: block; font-size: 10px; }
.w-saved-copy small { display: block; margin-top: 1px; font-size: 8px; color: var(--muted); }
.rubric-row { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.rubric-row:last-of-type { border-bottom: none; }
.rubric-row b { display: block; font-size: 10px; }
.rubric-row span { display: block; margin-top: 1px; font-size: 9px; line-height: 1.4; color: var(--muted); }

.evidence-card { padding: 6px 14px; }
.ev-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ev-row:last-child { border-bottom: none; }
.ev-icon {
  width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: #fff;
  font-size: 9px; font-weight: 900; color: var(--muted);
}
.ev-icon.on { border-color: var(--mint); background: var(--mint); color: #fff; }
.ev-row b { display: block; font-size: 10px; }
.ev-row small { display: block; font-size: 9px; color: var(--muted); }

@media (max-width: 359px) {
  .focus-grid { grid-template-columns: 1fr; }
}
