:root {
  color-scheme: dark;
  --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: #8d8a83;
  --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: 12.5px; }
.warn { color: #e0a85a; margin: 0; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.18em; font-size: 11px; 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: 12px; font-family: var(--serif); font-size: 26px; font-weight: 600; padding: 0 10px; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3dca0, var(--gold) 40%, #5b4518 100%);
  box-shadow: 0 0 18px var(--gold-glow);
}
#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-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;
  backdrop-filter: blur(6px);
}
.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: 24px 24px 18px; }
.stage { display: flex; flex-direction: column; align-items: center; min-height: 0; gap: 8px; }
.stage > .intro, .stage > .feed, .stage > .summary-box { flex: 1 1 auto; min-height: 0; }
.orb { --level: 0; 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; align-self: start; 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: 11px; 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 { 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: 12px 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: .45; }
.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; }
.login-tabs { justify-content: center; }
.login-form { display: grid; gap: 12px; }
.login-form .btn { width: 100%; }
.login-google { display: grid; gap: 12px; justify-items: center; }
.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); }
/* Phones: the visible height changes with the browser bars, so use the dynamic viewport unit. */
@supports (height: 100dvh) {
  #view, .tutor { height: 100dvh; }
  body.login-page { min-height: 100dvh; }
  @media (max-width: 760px) {
    #view, .tutor { height: calc(100dvh - 64px - env(safe-area-inset-bottom)); }
  }
}
