:root {
  --bg: #07070a;
  --bg-2: #0d0d12;
  --card: rgba(255, 255, 255, 0.028);
  --card-border: rgba(214, 178, 102, 0.12);
  --line: rgba(255, 255, 255, 0.07);
  --text: #ece8df;
  --muted: #a39f96;
  --gold: #d6b266;
  --gold-soft: rgba(214, 178, 102, 0.16);
  --gold-glow: rgba(214, 178, 102, 0.35);
  --danger: #c45a4e;
  --radius: 18px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 15px/1.6 var(--sans);
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(214, 178, 102, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(90, 70, 140, 0.08), transparent 60%),
    var(--bg);
  display: grid;
  grid-template-columns: 248px 1fr;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: 0.01em; margin: 0 0 12px; }
h1 { font-size: 40px; line-height: 1.1; }
h2 { font-size: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: #e0a85a; margin: 0; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.16em; font-size: 11.5px; color: var(--gold); margin: 0 0 8px; }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; gap: 28px;
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
}
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 26px; font-weight: 500; padding: 0 10px; }
/* The brand seal ("Ustoz muhri", symbol #tu-seal in index.html) and the TilUstoz wordmark. */
.logo-mark { width: 1.5em; height: 1.5em; flex: none; }
.logo-word em { font-style: normal; font-weight: 600; color: var(--gold); background: linear-gradient(180deg, #efd79e, #ad853f); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px; color: var(--muted);
  transition: color .2s, background .2s;
  position: relative;
}
#nav a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
#nav a.active { color: var(--text); background: var(--gold-soft); }
#nav a.active .icon { color: var(--gold); }
#nav .dot {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600;
  background: var(--gold); color: #1a1408; border-radius: 10px; padding: 0 7px;
}
.sidebar-account { display: grid; gap: 8px; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.sidebar-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account .btn { justify-content: flex-start; }
.linklike { background: none; border: 0; padding: 0; color: var(--gold); cursor: pointer; font: inherit; text-decoration: underline; }
.login-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--gold-soft); color: var(--text); font-size: 14px; text-align: center; }
.sidebar-foot { margin-top: auto; color: var(--muted); font-size: 12.5px; font-family: var(--serif); font-size: 16px; font-style: italic; padding: 0 10px; }
.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ---------- Common ---------- */
#view { overflow-y: auto; height: 100vh; }
.page { max-width: 980px; margin: 0 auto; padding: 44px 36px 60px; display: grid; gap: 18px; align-content: start; }
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 14.5px var(--sans); color: var(--text);
  padding: 11px 20px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--card-border); background: rgba(255,255,255,0.03);
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.btn:hover { border-color: var(--gold); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  color: #1a1408; border-color: transparent;
  background: linear-gradient(180deg, #e6c682, #b8933f);
  box-shadow: 0 6px 24px rgba(214, 178, 102, 0.22);
}
.btn.primary:hover { box-shadow: 0 8px 30px rgba(214, 178, 102, 0.38); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 14px; font-size: 13px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { color: var(--gold); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: 500 13.5px var(--sans); color: var(--muted); cursor: pointer;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
}
.chip.on { color: var(--text); border-color: var(--gold); background: var(--gold-soft); }
input, select {
  font: 14.5px var(--sans); color: var(--text);
  background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; outline: none; width: 100%;
}
input:focus, select:focus { border-color: var(--gold); }
select option { background: #121216; }
.badge { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.gold { color: var(--gold); border-color: var(--gold); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #17161a; border: 1px solid var(--card-border); border-radius: 14px;
  padding: 12px 18px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Home ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 34px 36px; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(214,178,102,0.12), transparent 65%); pointer-events: none;
}
.hero-text { display: grid; gap: 6px; justify-items: start; }
.hero-text .muted { margin: 0 0 14px; }
.ring { position: relative; width: 150px; height: 150px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: rgba(255,255,255,0.06); }
.ring-fg { stroke: var(--gold); stroke-linecap: round; filter: drop-shadow(0 0 6px var(--gold-glow)); transition: stroke-dashoffset .8s; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { font-family: var(--serif); font-size: 40px; line-height: 1; }
.ring-label span { color: var(--muted); font-size: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tile { display: grid; gap: 2px; }
.tile .icon { color: var(--gold); margin-bottom: 6px; }
.tile strong { font-family: var(--serif); font-size: 36px; line-height: 1.1; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.link:hover { border-color: var(--gold); }
.word-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 24px; }
.word-list li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 6px 0; }
.en { color: var(--gold); font-weight: 500; }

/* ---------- Tutor ---------- */
#view[data-page="ustoz"] { overflow: hidden; }
.tutor { height: 100vh; display: grid; grid-template-rows: 1fr auto auto; max-width: 860px; margin: 0 auto; padding: 0 24px 18px; }
/* The stage never spills into the mic dock: when space runs out, the feed (or intro) shrinks and scrolls.
   Its top padding (not the tutor's) leaves room for the orb's ring and glow inside the clip. */
.stage { display: flex; flex-direction: column; align-items: center; min-height: 0; gap: 8px; overflow: hidden; padding-top: 24px; }
.stage > :not(.intro, .feed, .summary-box) { flex-shrink: 0; }
.stage > .intro, .stage > .feed, .stage > .summary-box { flex: 1 1 auto; min-height: 0; }
.orb { --level: 0; flex: none; position: relative; width: 190px; height: 190px; margin-top: 18px; transition: width .4s, height .4s; }
.tutor:has(.feed:not([hidden])) .orb { width: 132px; height: 132px; margin-top: 4px; }
.orb-core {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 233, 180, 0.55), transparent 28%),
    radial-gradient(circle at 50% 55%, rgba(214, 178, 102, 0.28), rgba(40, 30, 12, 0.9) 62%, #08070a 78%);
  box-shadow:
    0 0 calc(30px + var(--level) * 90px) rgba(214, 178, 102, calc(0.18 + var(--level) * 0.5)),
    inset 0 0 30px rgba(214, 178, 102, 0.2);
  transform: scale(calc(1 + var(--level) * 0.14));
  transition: transform .08s linear, box-shadow .08s linear;
}
.orb-ring {
  position: absolute; inset: -16px; border-radius: 50%;
  border: 1px solid rgba(214, 178, 102, 0.18);
  border-top-color: rgba(214, 178, 102, 0.18);
}
.tutor[data-state="idle"] .orb-core { animation: breathe 5s ease-in-out infinite; }
.tutor[data-state="listening"] .orb-ring { border-color: rgba(214, 178, 102, 0.6); box-shadow: 0 0 24px rgba(214,178,102,0.15); }
.tutor[data-state="hearing"] .orb-ring,
.tutor[data-state="thinking"] .orb-ring { border-top-color: var(--gold); animation: spin 1.1s linear infinite; }
.tutor[data-state="speaking"] .orb-core { animation: speak 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04); filter: brightness(1.12); } }
@keyframes speak { 0%, 100% { transform: scale(1.02); filter: brightness(1.1); } 50% { transform: scale(1.1); filter: brightness(1.35); } }
@keyframes spin { to { transform: rotate(360deg); } }
.orb-status { min-height: 22px; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; margin-top: 10px; }
.intro { display: grid; justify-items: center; gap: 14px; text-align: center; max-width: 640px; width: 100%; align-self: center; margin-top: 6px; overflow-y: auto; min-height: 0; max-height: 100%; padding-bottom: 8px; }
.intro p { color: var(--muted); font-size: 16px; margin: 0; }
.feed {
  width: 100%; overflow-y: auto; min-height: 0; padding: 8px 4px 16px;
  display: flex; flex-direction: column; gap: 14px;
  mask-image: linear-gradient(to bottom, transparent, #000 24px);
}
.line { max-width: 88%; font-size: 17px; line-height: 1.55; animation: rise .35s ease-out; }
.line.ustoz { align-self: flex-start; }
.line.ustoz .en { color: var(--gold); font-weight: 500; }
.line.me {
  align-self: flex-end; color: var(--text); font-size: 15.5px;
  background: rgba(255,255,255,0.045); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 16px 16px 4px 16px;
}
.line.fix { align-self: flex-start; font-size: 15px; border-left: 2px solid var(--gold); padding: 2px 0 2px 12px; color: #e8dcc0; }
.line.fix b { color: var(--gold); font-weight: 500; }
.line.words { align-self: flex-start; font-size: 13px; color: var(--gold); display: flex; align-items: center; gap: 4px; opacity: .85; }
.line.words .icon { width: 15px; height: 15px; }
.line.note { align-self: center; font-size: 13px; color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.dock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 10px 0; }
.dock .btn { justify-self: end; }
.mic-btn {
  width: 76px; height: 76px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--gold);
  background: radial-gradient(circle at 50% 35%, #1d1a14, #0b0a0d);
  border: 1px solid rgba(214,178,102,0.45);
  box-shadow: 0 0 0 6px rgba(214,178,102,0.05), 0 10px 30px rgba(0,0,0,0.5);
  transition: transform .15s, box-shadow .2s;
}
.mic-btn .icon { width: 30px; height: 30px; }
.mic-btn:hover { box-shadow: 0 0 0 8px rgba(214,178,102,0.09), 0 10px 30px rgba(0,0,0,0.5); }
.mic-btn.active { color: #1a1408; background: linear-gradient(180deg, #e6c682, #b8933f); animation: pulse 1.4s infinite; }
.mic-btn:disabled { opacity: .5; cursor: default; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(214,178,102,0.12), 0 10px 30px rgba(0,0,0,0.5); } }
.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.toggle input { width: 34px; height: 20px; appearance: none; border-radius: 999px; background: rgba(255,255,255,0.1); position: relative; padding: 0; border: 0; cursor: pointer; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: .2s; }
.toggle input:checked { background: var(--gold-soft); }
.toggle input:checked::after { left: 17px; background: var(--gold); }
.type-form input { border-radius: 999px; background: rgba(255,255,255,0.03); text-align: center; }

/* ---------- Vocabulary ---------- */
.review { display: grid; justify-items: center; gap: 16px; }
.flash {
  width: min(520px, 100%); min-height: 240px; cursor: pointer;
  display: grid; place-content: center; text-align: center; gap: 8px;
  border-radius: 24px; padding: 30px;
  background: radial-gradient(circle at 50% 0%, rgba(214,178,102,0.1), transparent 60%), var(--card);
  border: 1px solid var(--card-border);
  transition: transform .3s, border-color .3s;
}
.flash:hover { border-color: var(--gold); }
.flash.flipped { animation: flip .35s ease-out; }
@keyframes flip { from { transform: rotateX(70deg); opacity: .3; } }
.flash-word { font-family: var(--serif); font-size: 44px; line-height: 1.15; }
.flash.flipped .flash-word { color: var(--gold); }
.grade { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.empty { text-align: center; padding: 48px 24px; }
.add-word { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-bottom: 18px; }
.word-table { list-style: none; margin: 0; padding: 0; }
.word-table li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.word-table .grow { flex: 1; }

/* ---------- Stats ---------- */
.chart { position: relative; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 8px; height: 180px; align-items: end; }
.bar-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; justify-items: center; }
.bar-track { width: 100%; max-width: 28px; display: flex; align-items: flex-end; height: 100%; }
.bar { width: 100%; min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, rgba(214,178,102,0.55), rgba(214,178,102,0.15)); }
.bar.full { background: linear-gradient(180deg, #ecd08f, #a8832f); box-shadow: 0 0 14px var(--gold-glow); }
.bar-label { font-size: 12px; color: var(--muted); }
.goal-line { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(214,178,102,0.35); pointer-events: none; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 0 0 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- Settings ---------- */
.form { display: grid; gap: 16px; }
.form h2 { margin-bottom: 0; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); }
.form .btn { justify-self: start; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .sidebar {
    order: 2; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); background: rgba(10,10,13,0.92);
  }
  .logo, .sidebar-foot, .sidebar-account { display: none; }
  #nav { flex-direction: row; width: 100%; justify-content: space-around; }
  #nav a { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 10px; white-space: nowrap; flex: 1; min-width: 0; align-items: center; }
  #nav .dot { position: absolute; top: 2px; right: 4px; margin: 0; }
  #view { height: calc(100vh - 64px); }
  .page { padding: 24px 16px 40px; }
  h1 { font-size: 32px; }
  .hero { flex-direction: column-reverse; align-items: flex-start; padding: 24px; }
  .ring { width: 120px; height: 120px; }
  .tutor { height: calc(100vh - 64px); padding: 0 16px 10px; }
  .line { font-size: 16px; max-width: 94%; }
  .add-word { grid-template-columns: 1fr 1fr; }
  .add-word .btn { grid-column: span 2; }
  .bars { gap: 4px; }
}

/* Cormorant's old-style figures make 0 and 1 look like O and I. */
h1, h2, .tile strong, .ring-label strong, .flash-word, .logo { font-variant-numeric: lining-nums; }

/* ---------- Lesson controls, topics, summary ---------- */
.dock .controls { justify-self: end; display: flex; gap: 8px; }
.summary-box { width: 100%; max-width: 640px; align-self: start; overflow-y: auto; min-height: 0; }
.summary { display: grid; gap: 14px; text-align: center; justify-items: center; animation: rise .4s ease-out; }
.summary h2 { margin: 0; }
.sum-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.sum-stat { display: grid; gap: 2px; padding: 12px 6px; border-radius: 14px; background: rgba(255,255,255,0.025); border: 1px solid var(--line); }
.sum-stat strong { font-family: var(--serif); font-size: 32px; line-height: 1.1; font-variant-numeric: lining-nums; color: var(--gold); }
.sum-stat span { font-size: 12.5px; color: var(--muted); }
.summary .word-list { width: 100%; text-align: left; }
.sum-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; }
.topic { font: 13.5px var(--sans); color: var(--muted); cursor: pointer; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); }
.topic:hover { color: var(--text); }
.topic.on { color: #1a1408; border-color: transparent; background: linear-gradient(180deg, #e6c682, #b8933f); }
.topic-own { max-width: 360px; text-align: center; border-radius: 999px; }
.topic-label { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.lesson-topic { font-size: 12.5px; color: var(--gold); letter-spacing: .04em; min-height: 18px; }
@media (max-width: 760px) {
  .sum-stats { grid-template-columns: repeat(2, 1fr); }
  .dock { grid-template-columns: auto auto auto; }
  .dock .toggle span { display: none; }
}
.line.memory { color: #b9b2a2; }
.line.memory:hover { color: var(--gold); }
.word-table li .icon { color: var(--muted); }
/* Before the lesson the choices need the room; the orb steps back. */
.tutor:has(.intro:not([hidden])) .orb { width: 112px; height: 112px; margin-top: 4px; }
.intro { scrollbar-width: thin; scrollbar-color: rgba(214,178,102,0.25) transparent; }
.intro .topic { padding: 6px 12px; font-size: 13px; }
.mic-btn.off { color: var(--muted); border-color: var(--line); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.mic-label { justify-self: start; font-size: 12.5px; color: var(--muted); letter-spacing: .04em; }

/* ---------- Lesson feedback ---------- */
.feedback { width: 100%; display: grid; gap: 14px; text-align: left; }
.fb-summary { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.45; text-align: center; color: #e8dfcb; }
.fb-section { display: grid; gap: 8px; }
.fb-section h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; }
.fb-section.good h3 { color: #9fc79a; }
.fb-section.work h3 { color: var(--gold); }
.fb-section.words h3 { color: var(--muted); }
.fb-item { display: grid; gap: 2px; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,0.025); border: 1px solid var(--line); }
.fb-item q { font-style: italic; }
.fb-item q.was { color: #c9a39a; text-decoration: line-through; text-decoration-color: rgba(201,163,154,0.5); }
.fb-item .better { color: var(--gold); font-weight: 500; }
.fb-item .muted { font-size: 13px; }
.fb-word { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fb-word .grow { flex: 1; }
.fb-loading { text-align: center; animation: breathe 2s ease-in-out infinite; }
.tutor:has(.summary-box:not([hidden])) .orb { width: 92px; height: 92px; margin-top: 2px; }

/* ---------- Lesson path ---------- */
.path-page h1 { margin: 0; }
.level { display: grid; gap: 14px; }
.level h2 { margin: 18px 0 0; color: var(--gold); }
.chapter h3 { margin: 0; font-family: var(--serif); font-size: 22px; }
.chapter .eyebrow { margin-bottom: 2px; }
.path { display: grid; gap: 8px; margin-top: 14px; position: relative; }
.node {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  padding: 10px 14px; border-radius: 14px; cursor: pointer; font: inherit; color: var(--text);
  background: rgba(255,255,255,0.02); border: 1px solid var(--line); transition: border-color .2s, background .2s;
}
.node:hover:not(:disabled) { border-color: var(--gold); }
.node:disabled { cursor: default; opacity: .6; }
.node-dot {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; border: 1px solid var(--line); color: var(--muted);
}
.node.done .node-dot { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.node.current { border-color: rgba(214,178,102,0.5); background: linear-gradient(90deg, rgba(214,178,102,0.1), transparent); }
.node.current .node-dot { background: linear-gradient(180deg, #e6c682, #b8933f); color: #1a1408; border-color: transparent; box-shadow: 0 0 16px var(--gold-glow); }
.node-text { display: grid; flex: 1; min-width: 0; }
.node-text strong { font-weight: 500; }
.node .btn { pointer-events: none; }
.stars { display: inline-flex; gap: 2px; font-style: normal; }
.stars i, .big-stars i { font-style: normal; color: rgba(255,255,255,0.12); }
.stars i.on, .big-stars i.on { color: var(--gold); text-shadow: 0 0 10px var(--gold-glow); }
.big-stars { display: flex; gap: 6px; font-size: 34px; }

/* ---------- Target phrases during a path lesson ---------- */
.phrases { width: 100%; max-width: 720px; flex: none; border: 1px solid var(--card-border); border-radius: 14px; background: var(--card); padding: 10px 14px; }
.phrases-head { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.phrases-head strong { color: var(--gold); font-variant-numeric: lining-nums; }
.phrase-list { display: flex; flex-wrap: wrap; gap: 6px; }
.phrase { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; }
.phrase-check { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: rgba(255,255,255,0.05); color: var(--muted); }
.phrase-uz { color: var(--muted); font-size: 12px; }
.phrase-uz::before { content: "· "; }
.phrase.said { border-color: rgba(214,178,102,0.45); color: var(--gold); }
.phrase.said .phrase-check { background: var(--gold); color: #1a1408; animation: rise .3s ease-out; }
@media (max-width: 760px) { .phrase { font-size: 12px; } }
.next-lesson { display: flex; align-items: center; justify-content: space-between; gap: 18px; text-align: left; font: inherit; color: var(--text); cursor: pointer; width: 100%; }
.next-lesson:hover { border-color: var(--gold); }
.next-lesson h2 { margin: 0 0 2px; }
.next-text { display: grid; }
.next-side { display: flex; align-items: center; gap: 14px; flex: none; }
.play-dot { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #1a1408; background: linear-gradient(180deg, #e6c682, #b8933f); box-shadow: 0 6px 22px rgba(214,178,102,0.25); }
.chips.personas { justify-content: center; max-width: 640px; }
.persona-hint { margin: -4px 0 0; min-height: 18px; }

/* ---------- IELTS ---------- */
.ielts h1 { margin: 0; }
.ielts-list { display: grid; gap: 16px; }
.q-list { display: grid; gap: 6px; margin-top: 12px; }
.q-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text);
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); cursor: pointer;
}
.q-item:hover { border-color: var(--gold); }
.q-text { flex: 1; min-width: 0; }
.band-chip { font-family: var(--serif); font-size: 18px; font-weight: 600; color: #1a1408; background: linear-gradient(180deg, #e6c682, #b8933f); border-radius: 10px; padding: 0 10px; font-variant-numeric: lining-nums; }
.writer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.question .q-body { white-space: pre-wrap; margin: 0 0 12px; line-height: 1.65; }
.chart-box { background: rgba(0,0,0,0.25); border-radius: 12px; padding: 8px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .ch-label { fill: #9a968e; font: 11px var(--sans); }
.chart-svg .ch-big { font-size: 12.5px; fill: #cfcac0; }
.chart-svg .ch-unit { font-style: italic; }
.chart-svg .ch-grid { stroke: rgba(255,255,255,0.07); }
.editor { display: grid; gap: 10px; position: sticky; top: 16px; }
.editor-bar { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.clock { color: var(--gold); font-weight: 600; }
.clock.over { color: var(--danger); }
.word-count { color: var(--muted); }
.word-count.ok { color: #9fc79a; }
.essay {
  width: 100%; min-height: 380px; resize: vertical; font: 15.5px/1.7 var(--sans); color: var(--text);
  background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; outline: none;
}
.essay:focus { border-color: var(--gold); }
.editor-actions { display: flex; justify-content: space-between; align-items: center; }
.result { display: grid; gap: 14px; }
.band-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.band-card h2 { margin: 0; font-size: 22px; }
.band-big { display: grid; justify-items: center; flex: none; }
.band-big strong { font-family: var(--serif); font-size: 64px; line-height: 1; color: var(--gold); font-variant-numeric: lining-nums; text-shadow: 0 0 24px var(--gold-glow); }
.band-big span { font-size: 12px; color: var(--muted); }
.crits { display: grid; gap: 16px; }
.crit-head { display: flex; justify-content: space-between; }
.crit-head strong { color: var(--gold); font-variant-numeric: lining-nums; }
.crit-bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.06); margin: 6px 0; overflow: hidden; }
.crit-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a6d2c, #e6c682); border-radius: 4px; }
.crit p { margin: 0; }
.good-title { color: #9fc79a; margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.work-title { color: var(--gold); margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.result .fb-item { margin-top: 8px; }
.plain { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.improved summary { cursor: pointer; color: var(--gold); padding: 6px 0; }
.improved p { white-space: pre-wrap; line-height: 1.7; margin: 8px 0 12px; }
.ielts-history { display: grid; gap: 14px; }
.ielts-history .card { display: grid; gap: 6px; }
@media (max-width: 900px) {
  .writer { grid-template-columns: 1fr; }
  .editor { position: static; }
  .band-big strong { font-size: 48px; }
}

/* ---------- IELTS Speaking ---------- */
.speaking-test { display: grid; gap: 12px; justify-items: center; text-align: center; }
.speaking-test .card-head { width: 100%; text-align: left; }
.speaking-test h2 { margin: 0; }
.sp-progress { width: 100%; height: 4px; border-radius: 4px; background: rgba(255,255,255,0.06); overflow: hidden; }
.sp-progress i { display: block; height: 100%; background: linear-gradient(90deg, #8a6d2c, #e6c682); transition: width .4s; }
.sp-orb {
  --level: 0; width: 96px; height: 96px; border-radius: 50%; margin-top: 6px;
  background: radial-gradient(circle at 36% 30%, rgba(255,233,180,0.5), transparent 28%), radial-gradient(circle at 50% 55%, rgba(214,178,102,0.28), rgba(40,30,12,0.9) 62%, #08070a 78%);
  box-shadow: 0 0 calc(24px + var(--level) * 70px) rgba(214,178,102, calc(0.18 + var(--level) * 0.5));
  transform: scale(calc(1 + var(--level) * 0.14)); transition: transform .08s linear;
}
.sp-orb[data-phase="asking"] { animation: speak 1.1s ease-in-out infinite; }
.sp-orb[data-phase="intro"], .sp-orb[data-phase="waiting"], .sp-orb[data-phase="prep"] { animation: breathe 5s ease-in-out infinite; }
.sp-question { font-family: var(--serif); font-size: 26px; line-height: 1.35; max-width: 620px; margin: 4px 0; }
.sp-intro { display: grid; gap: 14px; justify-items: center; max-width: 560px; }
.cue-card { text-align: left; width: 100%; max-width: 560px; padding: 16px 20px; border-radius: 14px; border: 1px dashed rgba(214,178,102,0.4); background: rgba(214,178,102,0.04); }
.cue-card h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.sp-prep { display: grid; gap: 10px; justify-items: center; width: 100%; max-width: 560px; }
.sp-prep .notes { min-height: 120px; }
.sp-prep-clock, .sp-talk-clock { font-size: 28px; font-variant-numeric: tabular-nums; }
.sp-heard { color: var(--muted); max-width: 620px; }
.sp-heard b { color: var(--gold); font-weight: 500; }
.sp-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; width: 100%; max-width: 560px; }
.sp-controls .btn { justify-self: start; }
.speaking-test > input { max-width: 560px; text-align: center; border-radius: 999px; }
.toggle.big { font-size: 14px; color: var(--text); }
.voice-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  display: grid; gap: 2px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.02);
}
.mode-card:hover { border-color: var(--gold); }
.mode-card.on { border-color: var(--gold); background: var(--gold-soft); }
.mode-card.on strong { color: var(--gold); }

/* ---------- IELTS Reading & Listening ---------- */
.ielts-intro { display: grid; gap: 10px; justify-items: start; }
.ielts-intro h2 { margin: 0; }
.objective { display: grid; gap: 12px; }
.obj-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 2; padding: 8px 0; background: linear-gradient(var(--bg) 70%, transparent); }
.obj-bar .chips { flex: 1; }
.obj-clock { font-variant-numeric: tabular-nums; }
.obj-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.obj-passage { max-height: calc(100vh - 170px); overflow-y: auto; position: sticky; top: 64px; }
.obj-passage h2 { font-size: 24px; }
.obj-passage p { line-height: 1.75; margin: 0 0 12px; }
.obj-questions { display: grid; gap: 18px; }
.obj-group { display: grid; gap: 10px; }
.obj-instruction { margin: 0; color: var(--gold); font-size: 13.5px; }
.obj-headings, .obj-mcq { font-size: 13.5px; color: var(--muted); margin: 4px 0 0; }
.obj-q { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.obj-options { display: flex; flex-wrap: wrap; gap: 6px; }
.obj-opt { font: 13px var(--sans); color: var(--text); cursor: pointer; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); }
.obj-opt.on { background: var(--gold); color: #1a1408; border-color: transparent; }
.obj-gap { max-width: 260px; padding: 7px 12px; }
.obj-listening { display: grid; gap: 14px; }
.obj-player { display: grid; gap: 8px; }
.obj-player .eyebrow, .obj-player p { margin: 0; }
.obj-player-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.obj-check { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.obj-mark { font-weight: 700; }
.obj-check.ok .obj-mark { color: #9fc79a; }
.obj-check.bad .obj-mark { color: var(--danger); }
@media (max-width: 900px) {
  .obj-split { grid-template-columns: 1fr; }
  .obj-passage { position: static; max-height: none; }
}

/* ---------- Sign-in page and account ---------- */
body.login-page { display: grid; place-items: center; grid-template-columns: 1fr; min-height: 100vh; overflow: auto; padding: 24px 16px; }
.login-card { width: min(420px, 100%); display: grid; gap: 16px; padding: 32px 28px; }
.login-logo { justify-content: center; font-size: 30px; padding: 0; }
/* The phone rule above hides the sidebar logo; the sign-in page keeps its own. */
body.login-page .login-logo { display: flex; }
.login-title { font-size: 30px; line-height: 1.15; text-align: center; margin: 0; }
.login-lead { margin: -6px 0 0; font-size: 14.5px; line-height: 1.5; }
.login-form { display: grid; gap: 12px; }
.login-form .btn { width: 100%; }
.login-form .btn:disabled { opacity: .6; cursor: default; }
/* Google draws its button in an iframe; keep the space so the page does not jump when it loads. */
.google-btn { min-height: 44px; display: flex; justify-content: center; }
.login-switch { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.login-switch .linklike { font-size: 14px; padding: 4px 2px; }
@media (max-width: 420px) {
  body.login-page { padding: 16px 12px; }
  .login-card { padding: 24px 20px; gap: 14px; }
}
.or { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.key-row { display: flex; gap: 8px; align-items: center; }
.key-row input { flex: 1; }

/* ---------- Installed app (PWA) ---------- */
.install-slot:empty { display: none; }
.install { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.install .logo-mark { flex: none; width: 34px; height: 34px; }
.install-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.install .btn.ghost { padding: 6px 10px; color: var(--muted); }

/* ---------- Phone shell: top bar with ☰ and the page name, bottom bar with 3 pages ---------- */
.topbar { display: none; }
@media (max-width: 760px) {
  /* A column that always fits the visible screen: page on top, bar below. No height math,
     so nothing ends up hidden under the bar or the browser's own toolbars. */
  body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
  #view { flex: 1; min-height: 0; height: auto; }
  .tutor { height: 100%; }
  .sidebar { flex: none; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
  #nav { gap: 2px; }
  #nav a.more { display: none; }
  #nav a {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 4px; font: 500 11px var(--sans); white-space: nowrap; color: var(--muted);
    border-radius: 12px; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar {
    display: flex; align-items: center; gap: 10px; flex: none;
    padding: calc(6px + env(safe-area-inset-top)) 12px 6px 6px;
    border-bottom: 1px solid var(--line); background: rgba(10,10,13,0.92);
  }
  .topbar-menu { width: 44px; height: 44px; justify-content: center; align-items: center; color: var(--text); }
  .topbar-menu .icon { width: 24px; height: 24px; }
  .topbar-title { flex: 1; min-width: 0; font: 600 20px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #nav .dot { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; }
  :root { color-scheme: dark; }
  /* Lesson dock: mic in the middle, label left, pause/finish as icon buttons on the right. */
  .dock { grid-template-columns: 1fr auto 1fr; gap: 10px; padding: 6px 0; }
  .mic-btn { width: 64px; height: 64px; }
  .mic-btn .icon { width: 26px; height: 26px; }
  .mic-label { font-size: 11px; line-height: 1.3; }
  .dock .controls { gap: 6px; }
  .dock .controls .btn { font-size: 0; gap: 0; width: 44px; height: 44px; padding: 0; }
  /* Long setup text scrolls and fades out above the mic instead of running under it. */
  .stage > .feed { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 20px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 20px, #000 calc(100% - 28px), transparent); padding-bottom: 24px; }
  /* iPhone zooms into any field with text under 16px and stays zoomed: the page looks cut off. */
  input, select, textarea { font-size: 16px; }
  .page { padding: 20px 16px 28px; }
}

.menu-sheet {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: stretch; justify-content: flex-start;
  background: rgba(0, 0, 0, 0); transition: background .2s;
}
.menu-sheet.open { background: rgba(0, 0, 0, 0.55); }
.menu-panel {
  width: min(320px, 84vw); display: flex; flex-direction: column; gap: 8px; overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  background: #101015; border-right: 1px solid var(--card-border); border-radius: 0 22px 22px 0;
  transform: translateX(-100%); transition: transform .22s ease-out;
}
.menu-sheet.open .menu-panel { transform: none; }
.menu-panel .menu-logo { display: flex; padding: 0 8px 10px; font-size: 24px; }
.menu-profile { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.avatar.small { width: 34px; height: 34px; font-size: 16px; }
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font: 600 20px var(--serif); color: #1a1408;
  background: radial-gradient(circle at 35% 30%, #f3dca0, var(--gold) 45%, #8a6a2a 100%);
}
.menu-who { display: grid; min-width: 0; }
.menu-who strong { font-size: 16px; }
.menu-who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-links { display: grid; gap: 2px; margin-top: 4px; }
.menu-link {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 12px;
  font: 500 15px var(--sans); color: var(--text); text-align: left;
  border: 0; border-radius: 12px; background: transparent; cursor: pointer;
}
.menu-link .icon { color: var(--muted); }
.menu-link.active { background: var(--gold-soft); }
.menu-link.active .icon { color: var(--gold); }
.menu-link .dot { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600; background: var(--gold); color: #1a1408; border-radius: 10px; padding: 0 7px; }
.menu-logout { color: var(--danger); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; margin-top: auto; }
.menu-logout .icon { color: var(--danger); }

/* ---------- Polish: keyboard focus, phone layouts of the content pages ---------- */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }
@media (max-width: 760px) {
  /* The top bar already names the page, so page headings are smaller. */
  .page h1 { font-size: 28px; }
  .home h1 { font-size: 32px; }
  /* Section tabs scroll sideways in one row instead of wrapping. */
  /* Every tab stays visible on a phone: the row wraps instead of hiding tabs off-screen. */
  .chips.tabs { flex-wrap: wrap; gap: 6px; }
  .chips.tabs > .chip { padding: 6px 11px; font-size: 13px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 16px; }
  .card { padding: 18px 16px; }
  /* Lesson path: the start button becomes a round icon so the title keeps its room. */
  .node { padding: 10px 12px; gap: 12px; }
  .node .btn { font-size: 0; gap: 0; width: 40px; height: 40px; padding: 0; flex: none; }
}

.setup-line { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 2px 0 6px; }
.setup-line a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Mock exam ---------- */
.mock-box { display: grid; gap: 14px; }
.mock-stage { display: grid; gap: 12px; }
.mock-steps { display: flex; gap: 6px; }
.mock-steps span { flex: 1; text-align: center; font-size: 12px; letter-spacing: .04em; padding: 6px 4px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.mock-steps .on { color: #1a1408; background: linear-gradient(180deg, #e6c682, #b8933f); border-color: transparent; font-weight: 600; }
.mock-steps .done { color: var(--gold); border-color: rgba(214,178,102,0.35); }
.mock-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 3; padding: 8px 0; background: linear-gradient(var(--bg) 75%, transparent); }
.mock-head h2 { margin: 0; }
.mock-head .eyebrow { margin-bottom: 2px; }
.mock-head-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mock-head .clock { font-size: 20px; font-variant-numeric: tabular-nums; }
.mock-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mock-status.live { color: var(--gold); }
.mock-status b { color: var(--gold); font-size: 16px; font-variant-numeric: tabular-nums; }
.mock-rules { display: grid; gap: 10px; margin: 6px 0 12px; }
.mock-rules li { line-height: 1.6; }
.mock-intro { display: grid; gap: 8px; }
.para-letter { color: var(--gold); font-family: var(--serif); font-size: 18px; }
.mock-panes { display: none; }
.mock-tiles .tile strong { color: var(--gold); }
.mock-quit { justify-self: start; }
@media (max-width: 760px) {
  /* Reading on a phone: the passage and the questions take turns instead of sitting side by side. */
  .mock-panes { display: flex; }
  .mock-stage .obj-split { grid-template-columns: 1fr; }
  .mock-stage .pane-hidden { display: none; }
  .mock-stage .obj-passage { max-height: none; position: static; }
  .mock-head { position: sticky; }
  .mock-head h2 { font-size: 20px; }
  .mock-steps span { font-size: 10.5px; padding: 5px 2px; }
}

/* ---------- Tayyorlanish (preparation guide and drills) ---------- */
.prep-box, .prep, .prep-drill { display: grid; gap: 14px; }
.prep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.prep-section { margin: 10px 0 0; }
.prep-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.6; }
.prep-type summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.prep-type summary::-webkit-details-marker { display: none; }
.prep-type summary::after { content: "+"; color: var(--gold); font-size: 20px; margin-left: 8px; }
.prep-type[open] summary::after { content: "–"; }
.prep-type[open] summary { margin-bottom: 12px; }
.prep-type-name { font-family: var(--serif); font-size: 21px; font-weight: 600; flex: 1; }
.prep-type .work-title { margin: 14px 0 6px; }
.prep-phrases { display: flex; flex-wrap: wrap; gap: 6px; }
.prep-phrases span { font-size: 13px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--card-border); background: var(--gold-soft); }
.prep-model { white-space: pre-line; line-height: 1.7; }
.prep-text p { line-height: 1.75; margin: 0 0 10px; }
.prep-fb { margin-top: 6px; font-size: 13px; line-height: 1.5; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.03); }
.prep-fb.ok b { color: #9fc79a; }
.prep-fb.bad b { color: var(--danger); }
.prep-score { text-align: center; display: grid; gap: 6px; justify-items: center; }
.obj-opt:disabled { cursor: default; opacity: .85; }
@media (max-width: 760px) {
  .prep-grid { grid-template-columns: 1fr; }
  .prep-type-name { font-size: 18px; }
}

/* ---------- Admin panel ---------- */
.adm-overview { display: grid; gap: 14px; }
.adm-tiles { grid-template-columns: repeat(3, 1fr); }
.adm-tiles .tile strong { color: var(--gold); }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.adm-chart { display: grid; gap: 6px; padding: 14px 16px; }
.adm-chart-head { display: flex; justify-content: space-between; align-items: baseline; }
.adm-chart-head strong { font-family: var(--serif); font-size: 22px; color: var(--gold); font-variant-numeric: lining-nums; }
.adm-bars { width: 100%; height: 70px; display: block; }
.adm-bars rect { fill: var(--gold); opacity: .75; }
.adm-bars rect:last-child { opacity: 1; }
.adm-axis { display: flex; justify-content: space-between; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.adm-table th, .adm-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
.adm-table th { color: var(--muted); font-weight: 500; }
.adm-users { display: grid; gap: 10px; }
.adm-user { display: grid; gap: 8px; padding: 14px 16px; }
.adm-user.blocked { opacity: .6; border-color: rgba(196,90,78,0.5); }
.adm-user-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.adm-user-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.adm-user-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.adm-limit { width: 90px; padding: 6px 10px; margin-left: 4px; }
.adm-danger { color: var(--danger); }
.adm-form { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 8px; align-items: center; }
.adm-code { font: 600 13px var(--sans); color: var(--gold); }
@media (max-width: 760px) {
  .adm-form { grid-template-columns: 1fr; }
  .adm-tiles { grid-template-columns: repeat(2, 1fr); }
}

.adm-status { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.adm-status.published { color: #9fc79a; border-color: rgba(159,199,154,0.4); }
.adm-status.draft, .adm-status.generating { color: var(--gold); border-color: var(--card-border); }
.adm-mock.hidden { opacity: .7; }
.adm-json { min-height: 60vh; font: 12.5px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre; overflow: auto; }
.adm-json.small-json { min-height: 140px; }
.adm-errors { display: grid; gap: 4px; max-height: 260px; overflow: auto; }

/* ---------- Announcements on the home page ---------- */
.announce-slot { display: grid; gap: 10px; }
.announce { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-left: 3px solid var(--gold); }
.announce.warn { border-left-color: #e0a85a; }
.announce.new { border-left-color: #9fc79a; }
.announce-text { flex: 1; display: grid; gap: 4px; }
.announce-text p { margin: 0; white-space: pre-line; }
.announce .btn.ghost { padding: 6px 10px; color: var(--muted); }
.essay.small-json { min-height: 110px; height: 110px; }

/* ---------- Placement test and daily plan ---------- */
.pl-card { display: grid; gap: 14px; max-width: 760px; }
.pl-q { font-size: 24px; line-height: 1.35; margin: 0; }
.pl-options { display: grid; gap: 8px; }
.pl-option { text-align: left; font: 15px var(--sans); color: var(--text); padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); cursor: pointer; }
.pl-option:hover { border-color: var(--card-border); }
.pl-option.on { border-color: var(--gold); background: var(--gold-soft); }
.pl-text { display: grid; gap: 8px; }
.pl-text h3 { margin: 0; font-family: var(--serif); font-size: 21px; }
.pl-text p { margin: 0; line-height: 1.7; }
.pl-q-block { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.pl-q-block p { margin: 0; }
.pl-essay { min-height: 180px; }
.pl-weak { color: #e0a85a; font-size: 12px; }
.pl-result { display: grid; gap: 14px; }
.pl-ielts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-cta { display: flex; justify-content: space-between; align-items: center; gap: 14px; border-color: rgba(214,178,102,0.4); }
.plan-cta h2 { margin: 2px 0 4px; }
.plan-card { display: grid; gap: 10px; }
.plan-list { display: grid; gap: 4px; }
.plan-list a { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-radius: 10px; }
.plan-list a:hover { background: rgba(255,255,255,0.03); }
.plan-check { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--card-border); display: grid; place-items: center; font-size: 13px; color: #1a1408; }
.plan-list li.done .plan-check { background: var(--gold); border-color: transparent; }
.plan-list li.done .plan-title { color: var(--muted); text-decoration: line-through; }
.plan-title { flex: 1; }
.plan-edit { justify-self: start; }
@media (max-width: 760px) {
  .pl-q { font-size: 20px; }
  .pl-ielts { grid-template-columns: 1fr; }
}
.setup-link { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.plan-list li { list-style: none; padding-left: 0; }
.plan-list li::before { content: none; display: none; }

.adm-level { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; margin-right: 8px; border-radius: 6px; background: var(--gold-soft); color: var(--gold); border: 1px solid var(--card-border); }
.adm-scroll { overflow-x: auto; }
.adm-scroll .adm-table { min-width: 640px; }
.verdict-text { margin: 6px 0 0; font-weight: 500; }
.band-card.verdict-pass .verdict-text { color: #9fc79a; }
.band-card.verdict-partial .verdict-text { color: var(--gold); }
.band-card.verdict-below .verdict-text { color: #e0a85a; }

/* ---------- Mock test form editor ---------- */
.me-parts { display: grid; gap: 12px; }
.me-part { display: grid; gap: 10px; }
.me-part > summary { cursor: pointer; font-size: 15px; }
.me-part[open] > summary { margin-bottom: 6px; }
.me-field { gap: 4px; }
.me-area { min-height: 0; font-size: 14px; line-height: 1.55; }
.me-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.me-row > input { flex: 1; min-width: 200px; }
.me-row-2 { display: grid; grid-template-columns: 1fr 2fr auto; align-items: end; }
.me-tools { margin-left: auto; display: inline-flex; gap: 2px; }
.me-num { min-width: 30px; color: var(--gold); }
.me-group { display: grid; gap: 10px; border-color: var(--card-border); }
.me-question { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.me-para { display: grid; gap: 4px; }
@media (max-width: 760px) {
  .me-row-2 { grid-template-columns: 1fr; }
}

/* ---------- Word sets and games ---------- */
.ws { display: grid; gap: 14px; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ws-card { display: grid; gap: 6px; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.ws-card h3 { margin: 0; }
.ws-card:hover:not(:disabled) { border-color: var(--gold); }
.ws-card:disabled { opacity: .55; cursor: default; }
.ws-card .badge { justify-self: start; }
.ws-bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ws-bar i { display: block; height: 100%; background: var(--gold); }
.ws-actions { justify-content: flex-start; }
.ws-words li { align-items: flex-start; }
.ws-ex { margin-top: 2px; font-style: italic; }
.ws-pick { max-width: 360px; }
.ws-play { display: grid; justify-items: center; gap: 16px; padding: 12px 0; text-align: center; }
.ws-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 520px; }
.ws-option { min-height: 52px; white-space: normal; }
.ws-option.right { border-color: #6fae6a; color: #9fc79a; }
.ws-option.wrong { border-color: #c96a5a; color: #e0a090; }
.ws-hint { letter-spacing: 2px; font-family: monospace; }
.ws-type { max-width: 360px; text-align: center; font-size: 18px; }
.ws-correct { margin: 0; color: #e0a090; }
.ws-correct.right { color: #9fc79a; }
.ws-match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ws-match > div { display: grid; gap: 8px; }
.ws-tile { padding: 12px; border-radius: 12px; border: 1px solid var(--card-border); background: transparent; color: inherit; font: inherit; cursor: pointer; min-height: 48px; }
.ws-tile.on { border-color: var(--gold); color: var(--gold); }
.ws-tile.wrong { border-color: #c96a5a; color: #e0a090; }
.ws-tile.solved { opacity: .3; cursor: default; }
.ws-result { display: grid; justify-items: center; gap: 6px; padding: 8px 0; }
@media (max-width: 760px) {
  .ws-options { grid-template-columns: 1fr; }
  .ws-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Reminders ---------- */
.check-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check-row input { flex: none; width: 18px; height: 18px; padding: 0; margin: 2px 0 0; accent-color: var(--gold); }
.check-row > span { flex: 1; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.remind-offer .row-actions { margin-top: 6px; }
.remind-time, .form input[type=time] { width: auto; max-width: 160px; padding: 6px 10px; }

/* ---------- IELTS module switch (Academic / General Training) ---------- */
.module-switch { margin: 0; flex-wrap: nowrap; }
.module-switch .chip { white-space: nowrap; }

/* ---------- Tutor start screen ---------- */
.topic.more { border-style: dashed; color: var(--gold); }
/* The start button stays in view while the choices above it scroll. */
.intro-start { position: sticky; bottom: 0; z-index: 1; box-shadow: 0 -10px 24px 10px var(--bg, #0b0a08); }
@media (max-width: 760px) {
  /* On a phone the choices need the height: the orb shrinks before the lesson starts. */
  .tutor:has(.intro:not([hidden])) .orb { width: 64px; height: 64px; margin-top: 0; }
  .tutor:has(.intro:not([hidden])) .orb-status { min-height: 0; margin-top: 4px; }
  .intro { gap: 10px; }
  .intro p { font-size: 14.5px; }
}

/* ---------- Tutor on a phone: conversation first ---------- */
@media (max-width: 760px) {
  /* During a conversation the orb is a small status light; the feed gets the height. */
  .stage { gap: 6px; padding-top: 12px; }
  .tutor:has(.feed:not([hidden])) .orb { width: 56px; height: 56px; margin-top: 0; }
  .orb-ring { inset: -8px; }
  .tutor:has(.feed:not([hidden])) .orb-status { min-height: 0; margin-top: 0; line-height: 1.4; }
  .lesson-topic { min-height: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lesson-topic:empty { display: none; }
  /* Target phrases: one row that scrolls sideways instead of a block that pushes the feed away. */
  .phrases { padding: 8px 0 8px 12px; }
  .phrases-head { gap: 10px; padding-right: 12px; margin-bottom: 6px; font-size: 11.5px; letter-spacing: .06em; }
  .phrases-head span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .phrases-head strong { flex: none; }
  .phrase-list {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding-right: 12px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .phrase-list::-webkit-scrollbar { display: none; }
  .phrase { flex: none; white-space: nowrap; min-height: 36px; font-size: 14px; }
  .phrase-uz { font-size: 13px; }
  .mic-label { font-size: 12px; }
  /* Typing (the on-screen keyboard is up): the bottom bar steps aside and the orb, status and
     phrase heading fold away, so the newest messages stay between the phrases and the input. */
  body:has(.tutor .type-form input:focus) .sidebar { display: none; }
  .tutor:has(.type-form input:focus) :is(.orb, .orb-status, .lesson-topic, .phrases-head) { display: none; }
  .tutor:has(.type-form input:focus) .dock { padding: 2px 0; }
  .tutor:has(.type-form input:focus) .mic-btn { width: 48px; height: 48px; }
  .tutor { padding-bottom: 8px; }
}

@media (max-width: 760px) {
  /* The top bar already names the page: the big page title would repeat it. */
  .page > h1:first-child, .page > .card-head:first-child > h1 { display: none; }
  .page > .card-head:first-child:not(:has(> :not(h1))) { display: none; }
  #nav a { font-size: 10.5px; }
}

/* ---------- Home: stats in the hero, plan rows that read as links ---------- */
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-stat { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.025); color: var(--muted); font-size: 13px; text-decoration: none; }
.hero-stat b { color: var(--text); font-weight: 600; }
.hero-stat .icon { width: 15px; height: 15px; color: var(--gold); }
a.hero-stat:hover { border-color: var(--card-border); color: var(--text); }
.hero-go { max-width: 100%; white-space: normal; text-align: left; }
.plan-list a { cursor: pointer; transition: background .15s; }
.plan-list a:hover { background: rgba(214,178,102,0.06); }
.plan-go { color: var(--gold); font-size: 22px; line-height: 1; opacity: .55; transition: opacity .15s, transform .15s; }
.plan-list a:hover .plan-go { opacity: 1; transform: translateX(2px); }
.plan-list li.done .plan-go { visibility: hidden; }
@media (max-width: 760px) {
  .plan-note { display: none; }
}
@media (max-width: 760px) {
  /* The daily ring moves to the corner, so the greeting and the next step are seen first. */
  .hero .ring { position: absolute; top: 18px; right: 18px; width: 74px; height: 74px; }
  .hero .ring-label strong { font-size: 22px; }
  .hero .ring-label span { font-size: 10px; }
  .hero-text { padding-right: 70px; }
  .hero-text .btn, .hero-stats { margin-right: -70px; }
}

/* ---------- Natijalar: skills and IELTS bands ---------- */
.skill-bars { display: grid; gap: 10px; }
.skill-row { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 12px; }
.skill-row b { text-align: right; color: var(--gold); }
.skill-track { height: 8px; border-radius: 8px; background: rgba(255,255,255,0.05); overflow: hidden; }
.skill-track i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, rgba(214,178,102,0.35), var(--gold)); }
.skill-row.weak .skill-name::after { content: " · zaif"; color: #e0a85a; font-size: 12px; }
.band-best { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-bottom: 16px; }
.band-best > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); }
.band-best strong { font-family: var(--serif); font-size: 28px; line-height: 1; color: var(--gold); font-variant-numeric: lining-nums; }
.band-trend { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 40px); gap: 8px; height: 150px; align-items: end; margin-bottom: 8px; }
.band-col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; justify-items: center; gap: 4px; }
.band-val { font-size: 11.5px; color: var(--text); }
.band-track { width: 100%; max-width: 26px; display: flex; align-items: flex-end; height: 100%; }
.band-track i { display: block; width: 100%; min-height: 3px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #ecd08f, rgba(214,178,102,0.25)); }
@media (max-width: 760px) {
  .skill-row { grid-template-columns: 90px 1fr 30px; gap: 8px; }
}

/* ---------- Review cards: bigger, with keyboard hints ---------- */
.flash { width: min(600px, 100%); min-height: 300px; }
.flash-word { font-size: 52px; }
.review .grade .btn { min-width: 116px; justify-content: center; }
.key-hint { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 8px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--line); font: 600 11px var(--sans); color: var(--muted); }
.btn.primary .key-hint { border-color: rgba(26,20,8,0.35); color: #1a1408; }
@media (max-width: 760px) {
  .flash { min-height: 240px; padding: 24px; }
  .flash-word { font-size: 40px; }
  .review .grade { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .review .grade .btn { min-width: 0; padding: 14px 6px; }
  .key-hint, .key-help { display: none; }
}

/* ---------- Balance and Pro ---------- */
.adm-balance { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.adm-plan { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.adm-plan.pro { color: #1a1408; background: linear-gradient(180deg, #e6c682, #b8933f); border-color: transparent; }
.adm-amount { width: 110px; }
.adm-payinfo { min-height: 0; }
.bill-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bill-usage { display: grid; gap: 6px; }
.bill-bar { height: 8px; border-radius: 8px; background: rgba(255,255,255,0.05); overflow: hidden; }
.bill-bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, rgba(214,178,102,0.4), var(--gold)); }
.bill-bar.full i { background: #c96a5a; }
.bill-info { white-space: pre-wrap; margin: 0; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--card-border); background: rgba(214,178,102,0.04); }
.bill-history { list-style: none; margin: 0; padding: 0; }
.bill-history li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bill-history .plus { color: #9fc79a; }
.bill-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bill-plan { display: grid; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.02); color: inherit; font: inherit; cursor: pointer; }
.bill-plan.on { border-color: var(--gold); background: var(--gold-soft); cursor: default; }
.bill-plan:hover:not(.on) { border-color: var(--card-border); }
@media (max-width: 760px) { .bill-plans { grid-template-columns: 1fr; } }

.price-table { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 8px 14px; font-size: 14px; }
.price-table > * { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.price-table .gold { color: var(--gold); font-weight: 600; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 760px) { .price-table { grid-template-columns: 1.3fr 1fr 1fr; font-size: 12.5px; } }
.price-grid .field { grid-template-rows: 2.8em auto auto; align-content: start; }
.price-grid .field-label { align-self: end; }
.bill-pro { cursor: default; }
.bill-pro .btn, .bill-pro .warn { justify-self: start; margin-top: 6px; }

/* Videolar: listening videos with questions */
.vd { display: grid; gap: 14px; }
.vd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.vd-card { display: grid; padding: 0; overflow: hidden; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.vd-card:hover { border-color: var(--gold); }
.vd-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--bg-2); }
.vd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.85) brightness(0.85); transition: filter .2s; }
.vd-card:hover .vd-thumb img { filter: none; }
.vd-play { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(7, 7, 10, 0.72); border: 1px solid var(--gold); color: var(--gold); }
.vd-play .icon svg { width: 18px; height: 18px; margin-left: 3px; }
.vd-time { position: absolute; right: 8px; bottom: 8px; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: rgba(7, 7, 10, 0.8); }
.vd-body { display: grid; gap: 4px; padding: 12px 14px 14px; }
.vd-title { line-height: 1.35; }
.vd-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.vd .card-head { align-items: center; }
.vd .card-head .eyebrow { margin: 0; }
.vd-player { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--card-border); background: #000; }
.vd-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vd-h { margin: 0 0 4px; }
.vd-quiz { display: grid; gap: 16px; }
.vd-quiz h3 { margin: 0; }
.vd-quiz > .muted { margin: -10px 0 0; }
.vd-q { display: grid; gap: 8px; }
.vd-q-text { margin: 0; }
.vd-opts { display: grid; gap: 8px; }
.vd-opt { justify-content: flex-start; text-align: left; white-space: normal; gap: 10px; border-radius: 12px; padding: 10px 14px; }
.vd-opt.picked { border-color: var(--gold); background: var(--gold-soft); }
.vd-opt.right { border-color: #6fae6a; color: #9fc79a; }
.vd-opt.wrong { border-color: #c96a5a; color: #e0a090; }
.vd-opt:disabled { cursor: default; opacity: 1; }
.vd-letter { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; border: 1px solid var(--line); }
.vd-why { margin: 0; font-size: 13.5px; }
.vd-why.ok b { color: #9fc79a; }
.vd-why.bad b { color: var(--danger); }
.vd-check { justify-self: start; }
.vd-result { display: grid; gap: 10px; }
@media (max-width: 760px) {
  .vd-grid { grid-template-columns: 1fr; }
  .vd-player { border-radius: 12px; margin: 0 -4px; }
  .vd-check { justify-self: stretch; }
}

/* Grammatika: topic list and the step chain of one topic */
.gr { display: grid; gap: 14px; }
.gr .card-head { align-items: center; }
.gr .card-head .eyebrow { margin: 0; }
.gr-list { display: grid; gap: 10px; }
.gr-row { display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer; color: inherit; font: inherit; padding: 14px 18px; }
.gr-row:hover { border-color: var(--gold); }
.gr-row.next { border-color: var(--gold); background: var(--gold-soft); }
.gr-row-body { display: grid; gap: 3px; flex: 1; min-width: 0; }
.gr-num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--card-border); font-size: 13.5px; color: var(--muted); }
.gr-row.done .gr-num { border-color: #6fae6a; color: #9fc79a; }
.gr-dots { display: flex; gap: 5px; margin-top: 4px; }
.gr-dots i { width: 18px; height: 4px; border-radius: 4px; background: var(--line); }
.gr-dots i.on { background: var(--gold); }
.gr-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.gr-stepbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.gr-stepbtn.on { border-color: var(--gold); color: var(--text); background: var(--gold-soft); }
.gr-stepbtn.done:not(.on) { color: #9fc79a; border-color: rgba(111, 174, 106, 0.4); }
.gr-stepbtn:disabled { opacity: 0.4; cursor: default; }
.gr-step { display: grid; gap: 14px; }
.gr-p { margin: 0; }
.gr-tip { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--gold-soft); }
.gr-formula { padding: 12px 16px; border-radius: 12px; border: 1px dashed var(--gold); font-family: ui-monospace, Consolas, monospace; font-size: 14px; color: var(--gold); white-space: pre-wrap; }
.gr-table-wrap { overflow-x: auto; }
.gr-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.gr-table th, .gr-table td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.gr-table th { color: var(--gold); font-weight: 500; }
.gr-examples, .gr-mistakes { display: grid; gap: 8px; }
.gr-examples .eyebrow, .gr-mistakes .eyebrow { margin: 0; }
.gr-ex { display: flex; align-items: center; gap: 10px; }
.gr-ex > span { display: grid; }
.gr-mis { display: grid; gap: 2px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); }
.gr-wrong { color: #e0a090; text-decoration: line-through; text-decoration-color: rgba(224, 160, 144, 0.5); }
.gr-right { color: #9fc79a; }
.gr-next { justify-self: start; }
.gr-type { margin: 0; }
.gr-input { width: 100%; max-width: 520px; font-size: 16px; }
.gr-input.ok { border-color: #6fae6a; }
.gr-input.bad { border-color: #c96a5a; }
.gr-order { display: grid; gap: 10px; }
.gr-built { min-height: 48px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border-radius: 12px; border: 1px dashed var(--card-border); }
.gr-built.ok { border-color: #6fae6a; }
.gr-built.bad { border-color: #c96a5a; }
.gr-pool { display: flex; flex-wrap: wrap; gap: 6px; }
.gr-chip { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.03); color: inherit; font: inherit; cursor: pointer; }
.gr-chip.on { border-color: var(--gold); }
.gr-chip:disabled { cursor: default; }
.gr-practice .btn { justify-self: start; }
.gr-finish { display: grid; gap: 10px; justify-items: start; padding-top: 6px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .gr-row { padding: 12px 14px; gap: 10px; }
  .gr-row .badge { display: none; }
  .gr-stepname { font-size: 11px; }
  .gr-next, .gr-practice .btn, .gr-check { justify-self: stretch; }
}
.gr-video { display: grid; gap: 6px; }
.gr-video a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.gr-video a:hover { color: var(--text, inherit); }
.gr-video-parts { display: flex; flex-wrap: wrap; gap: 6px; }

/* Grammatika: open tasks checked by the AI */
.gt { display: grid; gap: 10px; }
.gt.done { border-color: rgba(111, 174, 106, 0.35); }
.gt-task { margin: 0; font-weight: 500; }
.gt-text { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.03); color: var(--text); resize: vertical; }
.gt-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gt-mic.rec { box-shadow: 0 0 0 calc(var(--level, 0) * 14px) var(--gold-glow); }
.gt-example { margin: 0; }
.gt-result { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.gt-result.ok .vd-why b { color: #9fc79a; }
.gt-result.bad .vd-why b { color: #e0b070; }
/* Grammatika: 4-stage word trainer */
.wt-stages { display: flex; flex-wrap: wrap; gap: 6px; }
.wt-stages span { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.wt-stages span.on { border-color: var(--gold); color: var(--text); background: var(--gold-soft); }
.wt-stages span.done { color: #9fc79a; border-color: rgba(111, 174, 106, 0.4); }
.wt-card { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 12px 0; }
.wt-word { font-family: var(--serif); font-size: 34px; color: var(--gold); display: flex; align-items: center; gap: 8px; }
.wt-uz { font-size: 18px; }
.wt-uz.big { font-size: 24px; }
.wt-ex { margin: 0; font-style: italic; color: var(--muted); }
.wt-type { text-align: center; max-width: 360px; }
.ws-tile.on { border-color: var(--gold); background: var(--gold-soft); }
.ws-tile.bad { border-color: #c96a5a; }
.ws-tile.gone { opacity: 0.25; }

/* ---------- Path lesson in four steps (#/dars/<id>, views/lesson.js) ---------- */
.lesson-flow { max-width: 720px; gap: 16px; }
.ls-head { display: grid; gap: 2px; }
.ls-head h1 { margin: 0; font-size: 36px; }
.ls-head .eyebrow { margin: 6px 0 0; }
.ls-back { color: var(--muted); font-size: 13.5px; justify-self: start; padding: 6px 0; }
.ls-back:hover { color: var(--gold); }
.ls-scene { margin: 2px 0 0; }
.ls-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ls-steps li { display: grid; gap: 6px; min-width: 0; }
.ls-bar { display: block; height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.ls-bar i { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, #b8933f, #e6c682); transition: width .35s ease; }
.ls-step-name { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-steps li.on .ls-step-name { color: var(--gold); font-weight: 600; }
.ls-steps li.done .ls-step-name { color: var(--text); }
.ls-body { display: grid; gap: 14px; }
.ls-intro { margin: 0; }
.ls-card { display: grid; gap: 12px; animation: rise .3s ease-out; }
.ls-card .eyebrow { margin: 0; }
.ls-card h2 { margin: 0; }
.ls-card p { margin: 0; }
.ls-center { justify-items: center; text-align: center; }
.ls-en { font-family: var(--serif); font-size: 32px; line-height: 1.2; color: var(--text); font-weight: 600; }
.ls-uz { font-size: 17px; color: var(--muted); }
.ls-example { font-size: 15px; }
.ls-note { padding: 12px 14px; border-radius: 12px; background: var(--gold-soft); border-left: 3px solid var(--gold); font-size: 14.5px; }
.ls-play { display: flex; gap: 10px; flex-wrap: wrap; }
.ls-play .btn { min-height: 46px; flex: 1 1 130px; }
.ls-slow .icon { opacity: .6; }
.ls-dots { display: flex; justify-content: center; gap: 6px; }
.ls-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.ls-dots i.done { background: rgba(214, 178, 102, 0.45); }
.ls-dots i.on { background: var(--gold); box-shadow: 0 0 8px var(--gold-glow); }
.ls-nav { display: flex; justify-content: space-between; gap: 10px; }
.ls-nav .btn { min-height: 48px; min-width: 120px; }
.ls-gtext { line-height: 1.65; }
.ls-examples, .ls-learned, .ls-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ls-examples li, .ls-learned li, .ls-checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,0.025); border: 1px solid var(--line); text-align: left; }
.ls-examples .icon-btn, .ls-learned .icon-btn { padding: 8px; flex: none; }
.ls-ex-text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.ls-ex-text .en { color: var(--text); }
.ls-gram-link { justify-self: start; white-space: normal; text-align: left; }
.ls-ex-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13.5px; }
.ls-prompt { font-family: var(--serif); font-size: 26px; line-height: 1.25; font-weight: 600; }
.ls-prompt.small-prompt { font-family: var(--sans); font-size: 14px; font-weight: 400; color: var(--muted); }
.ls-sub { font-size: 14px; }
.ls-listen-box { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 8px 0; }
.ls-big-play { width: 76px; height: 76px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #1a1408; background: linear-gradient(180deg, #e6c682, #b8933f); box-shadow: 0 8px 28px rgba(214,178,102,0.3); }
.ls-big-play .icon { width: 32px; height: 32px; }
.ls-big-play:active { transform: scale(0.96); }
.ls-gap { font-family: var(--serif); font-size: 26px; line-height: 1.35; font-weight: 600; }
.ls-blank { display: inline-block; min-width: 64px; padding: 0 6px; border-bottom: 2px solid var(--gold); color: var(--gold); text-align: center; }
.ls-blank.right { color: #9fc79a; border-color: #6fae6a; }
.ls-blank.wrong { color: #e0a090; border-color: #c96a5a; }
.ls-options { display: grid; gap: 10px; }
.ls-opt { justify-content: flex-start; text-align: left; white-space: normal; border-radius: 14px; padding: 13px 16px; min-height: 52px; font-size: 15.5px; width: 100%; }
.ls-opt.right { border-color: #6fae6a; color: #9fc79a; background: rgba(111,174,106,0.08); }
.ls-opt.wrong { border-color: #c96a5a; color: #e0a090; background: rgba(201,106,90,0.08); }
.ls-opt:disabled { cursor: default; opacity: 1; }
.ls-opt:disabled:not(.right):not(.wrong) { opacity: .55; }
.ls-line { min-height: 60px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-radius: 14px; border: 1px dashed var(--card-border); background: rgba(0,0,0,0.2); }
.ls-line.right { border-style: solid; border-color: #6fae6a; }
.ls-line.wrong { border-style: solid; border-color: #c96a5a; }
.ls-end { font-family: var(--serif); font-size: 22px; color: var(--muted); margin-left: -4px; }
.ls-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ls-tile { font: 500 16px var(--sans); color: var(--text); cursor: pointer; padding: 10px 14px; min-height: 46px; min-width: 46px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(255,255,255,0.05); box-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.ls-tile:hover:not(:disabled) { border-color: var(--gold); }
.ls-tile.placed { background: var(--gold-soft); border-color: rgba(214,178,102,0.45); }
.ls-bank .ls-tile:disabled { color: transparent; background: transparent; border-style: dashed; border-color: var(--line); box-shadow: none; cursor: default; }
.ls-line .ls-tile:disabled { cursor: default; }
.ls-tile-actions { display: flex; justify-content: space-between; gap: 10px; }
.ls-tile-actions .btn.primary { min-height: 48px; flex: 1; max-width: 260px; margin-left: auto; }
.ls-tile-actions .btn:disabled { opacity: .4; cursor: default; box-shadow: none; transform: none; }
.ls-feedback { display: grid; gap: 8px; padding: 14px 16px; border-radius: 14px; border: 1px solid; animation: rise .25s ease-out; }
.ls-feedback.ok { border-color: rgba(111,174,106,0.5); background: rgba(111,174,106,0.07); }
.ls-feedback.bad { border-color: rgba(201,106,90,0.5); background: rgba(201,106,90,0.07); }
.ls-verdict { font-weight: 600; font-size: 16px; }
.ls-feedback.ok .ls-verdict { color: #9fc79a; }
.ls-feedback.bad .ls-verdict { color: #e0a090; }
.ls-right strong { color: var(--text); }
.ls-why { font-size: 14.5px; }
.ls-fb-actions { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-top: 4px; }
.ls-fb-actions .btn.primary { min-height: 48px; flex: 1; max-width: 280px; }
.ls-missed { display: grid; gap: 6px; width: 100%; text-align: left; }
.ls-missed ul { margin: 0; padding-left: 18px; }
.ls-checklist li.said { border-color: rgba(214,178,102,0.45); }
.ls-check { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: rgba(255,255,255,0.05); color: var(--muted); }
.ls-checklist li.said .ls-check { background: var(--gold); color: #1a1408; }
.ls-warn { color: #e0a85a; }
.ls-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ls-actions .btn.primary { min-height: 50px; }
.ls-skip { margin: 0; }
.ls-summary .sum-stats { width: 100%; }
.ls-level { display: grid; gap: 6px; width: 100%; text-align: left; }
.ls-level-head { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); }
.ls-level-head strong { color: var(--gold); font-variant-numeric: lining-nums; }
.ls-bar.wide { height: 8px; }
.ls-h3 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.ls-learned li.missed { border-color: rgba(214,178,102,0.4); }
.ls-ok { color: #9fc79a; flex: none; padding: 0 4px; }
.ls-final { justify-content: center; }
@media (max-width: 760px) {
  .lesson-flow { gap: 14px; }
  .ls-head h1 { font-size: 28px; }
  /* After the first step the header is compact, so answers stay above the fold. */
  .lesson-flow:not([data-step="learn"]) .ls-head h1 { font-size: 23px; }
  .lesson-flow:not([data-step="learn"]) .ls-scene, .lesson-flow:not([data-step="learn"]) .ls-head .eyebrow { display: none; }
  .lesson-flow:not([data-step="learn"]) .ls-back { padding: 0; }
  .ls-en { font-size: 27px; }
  .ls-prompt, .ls-gap { font-size: 22px; }
  .ls-step-name { font-size: 11px; }
  .ls-nav .btn { min-width: 0; flex: 1; }
  .ls-actions { flex-direction: column; align-items: stretch; }
  .ls-actions .btn { width: 100%; }
  .ls-fb-actions .btn.primary { max-width: none; }
  .ls-tile { font-size: 15.5px; padding: 9px 12px; }
}
@media (max-width: 380px) {
  .ls-step-name { font-size: 10px; letter-spacing: -0.01em; }
  .ls-summary .sum-stat strong { font-size: 26px; }
}
/* ---------- Phone: tap targets and legibility (mobile audit) ---------- */
@media (max-width: 760px) {
  /* Bottom bar labels were 10.5px. */
  #nav a { font-size: 12px; }
  /* Profile initial in the top bar: 34px to see, 44px to tap. */
  .topbar .avatar { position: relative; }
  .topbar .avatar::after { content: ""; position: absolute; inset: -5px; }
  /* Chips, topics and small buttons were 30-34px tall: at least 40px, with gaps that keep 44px apart. */
  .chip, .topic, .btn.small, .hero-stat { min-height: 40px; }
  .chips { row-gap: 8px; }
  .hero-stat { padding: 6px 12px; }
  .icon-btn:has(> .icon) { min-width: 44px; min-height: 44px; justify-content: center; align-items: center; }
  /* Text links that sit on their own: a taller hit area without moving anything. */
  .ls-back, .card-head > a { display: inline-flex; align-items: center; min-height: 44px; }
  /* Text buttons: padding grows the tap area, the negative margin keeps the line where it was. */
  .linklike, .login-switch .linklike, .setup-line a, .login-card a.small { padding-block: 11px; margin-block: -11px; }
  input:not([type=checkbox], [type=radio], [type=range]), select { min-height: 44px; }
  .chip { min-width: 44px; }
  .install .btn.ghost { min-width: 44px; min-height: 44px; }
  .page summary.small { padding-block: 12px; }
  .lesson-flow:not([data-step="learn"]) .ls-back { margin: -11px 0; }
  .card-head { align-items: center; }
  .ring-label span { font-size: 11px; }
  /* "Install the app" card: the text gets the full width, the buttons go under it. */
  .install { flex-wrap: wrap; row-gap: 10px; }
  .install-text { flex: 1 1 calc(100% - 48px); }
  .install .btn { flex: none; }
  .install .btn.primary { margin-left: 48px; }
  /* Landscape with a notch: the top and bottom bars keep clear of the side insets too. */
  .topbar { padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .sidebar { padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); }
  /* Toasts sit above the bottom bar, not on it. */
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
