:root {
  color-scheme: dark;
  --bg: #111412;
  --side: #151915;
  --panel: #1a1f1b;
  --control: #131713;
  --line: #2b342c;
  --ink: #edf2e8;
  --muted: #a3afa1;
  --soft: #bac6b7;
  --accent: #c9ef9c;
  --accent-strong: #ddf7bf;
  --accent-ink: #192612;
  --active: #2c3829;
  --danger: #ffc0ad;
  --danger-bg: #412c27;
  --shadow: #0008;
  font: 15px/1.5 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5ef;
  --side: #e9eee4;
  --panel: #fcfdf9;
  --control: #f1f4ec;
  --line: #d7dfd1;
  --ink: #202a1e;
  --muted: #526250;
  --soft: #445341;
  --accent: #c9ef9c;
  --accent-strong: #b6e980;
  --accent-ink: #192612;
  --active: #dce8d3;
  --danger: #8d321f;
  --danger-bg: #ffebe3;
  --shadow: #15250a24;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, .segments input:focus-visible + span {
  outline: 2px solid #82aa5b;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
svg { flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.35rem, 5vw, 4.12rem); line-height: 1.04; letter-spacing: -.065em; font-weight: 680; overflow-wrap: anywhere; }
h2 { font-size: 1.22rem; letter-spacing: -.028em; line-height: 1.25; }
h3 { font-size: 1.03rem; margin-top: 1.4rem; }
.skip { position: fixed; z-index: 20; left: 12px; top: -100px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; background: var(--side); border-right: 1px solid var(--line); padding: 28px 17px; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 0 45px 5px; }
.brand-logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); flex: 0 0 auto; }
.brand-text { display: grid; line-height: 1.22; gap: 3px; white-space: nowrap; }
.brand-text strong { font-size: .99rem; font-weight: 680; letter-spacing: -.03em; }
.brand-text small { font-size: .73rem; color: var(--muted); }
.navigation { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-weight: 550; }
.nav-link:hover { background: var(--control); color: var(--ink); }
.nav-link[aria-current="page"] { color: var(--ink); background: var(--active); }
.nav-link[aria-current="page"] svg { color: #8cbd65; }
.content { min-width: 0; outline: none; }
.topbar { height: 74px; padding: 0 clamp(22px, 4vw, 56px); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.breadcrumb { color: var(--soft); font-size: .88rem; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.mode-badge { border: 1px solid var(--line); color: var(--soft); border-radius: 30px; padding: 4px 11px; display: inline-flex; gap: 7px; align-items: center; font-size: .77rem; }
.mode-badge i { width: 6px; height: 6px; background: #89b969; border-radius: 50%; }
.utility { min-width: 36px; min-height: 36px; display: inline-grid; place-items: center; padding: 0 7px; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; color: var(--soft); }
.utility:hover:not(:disabled), .secondary:hover:not(:disabled) { background: var(--active); color: var(--ink); }
.language { font-size: .77rem; font-weight: 650; }
#page { max-width: 1380px; margin: 0 auto; padding: 39px clamp(22px, 4vw, 56px) 48px; }
.page-heading { margin-bottom: 29px; }
.page-heading p { color: var(--muted); font-size: 1.04rem; margin-top: 12px; line-height: 1.45; }
.heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lesson-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(290px, 1fr); gap: 18px; align-items: stretch; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 21px; min-width: 0; }
.practice-card { min-height: 474px; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 23px 23px 25px; }
.hero-visual { position: relative; width: 100%; display: grid; place-items: center; min-height: 265px; }
.orb-scene { display: grid; place-items: center; position: relative; width: min(96%, 385px); aspect-ratio: 1.35; isolation: isolate; }
.orbit { position: absolute; z-index: -1; width: 90%; border: 1px solid #82997b44; border-radius: 50%; aspect-ratio: 1; transform: rotate(-24deg) scaleY(.40); }
.orbit-two { width: 96%; transform: rotate(20deg) scaleY(.55); border-color: #82997b37; }
.orb { width: 57%; aspect-ratio: 1; position: relative; overflow: hidden; border-radius: 50%;
  box-shadow: inset 0 0 16px #f4ffe18c, inset -12px -18px 34px #162b1445, 0 0 70px #99db5d32, 0 21px 34px var(--shadow);
  background: radial-gradient(ellipse at 38% 34%, #faffb8 0%, transparent 36%), radial-gradient(ellipse at 58% 64%, #adde71, transparent 63%),
    radial-gradient(ellipse at 22% 64%, #66a361, transparent 48%), radial-gradient(ellipse at 79% 36%, #d2f98e, #466e44 53%, #172a1a 100%);
}
.orb div { position: absolute; inset: -18%; border-radius: 45%; opacity: .72; mix-blend-mode: soft-light;
  background: repeating-radial-gradient(ellipse at 51% 17%, transparent 0 5px, #f8ffe33a 6px 6.6px, #1427145e 7px 8px, transparent 9px 13px),
  conic-gradient(from 25deg at 52% 47%, #c4ee8480, #263b368f 54deg, #f0ff95 110deg, #6ea174 154deg, #284540 205deg, #ddfea9 265deg, #a4d16e 325deg, #c4ee8480);
  transform: rotate(-22deg);
}
.orb::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(ellipse at 33% 24%, #fffed372, transparent 42%, #14201800 65%, #142018a6); }
.orb-shadow { position: absolute; z-index: -2; bottom: 1%; width: 54%; height: 13%; border-radius: 50%; background: #6ea24678; filter: blur(21px); transform: scaleY(.65); }
[data-state="speaking"] .orb, [data-state="listening"] .orb, [data-state="thinking"] .orb { animation: pulse 2s ease-in-out infinite alternate; }
[data-state="speaking"] .orb div { animation: rotate 13s linear infinite; }
[data-state="listening"] .orb { filter: hue-rotate(27deg); }
@keyframes pulse { to { transform: scale(1.06); filter: brightness(1.12); } }
@keyframes rotate { to { transform: rotate(338deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; } }
.practice-actions { display: grid; justify-items: center; gap: 10px; margin-top: 5px; }
.primary, .secondary, .danger, .text-button, .send { display: inline-flex; gap: 8px; align-items: center; justify-content: center; border-radius: 12px; padding: 9px 15px; border: 1px solid transparent; font-weight: 650; text-align: center; min-height: 40px; }
.primary { color: var(--accent-ink); background: var(--accent); padding-inline: 21px; min-height: 47px; }
.primary:hover { background: var(--accent-strong); }
.secondary { border-color: var(--line); background: var(--control); color: var(--ink); }
.danger { background: var(--danger-bg); color: var(--danger); }
.danger:hover { filter: brightness(1.12); }
.text-button { background: transparent; color: var(--soft); font-size: .87rem; }
.text-button:hover { color: var(--ink); text-decoration: underline; }
.note { max-width: 36ch; text-align: center; color: var(--muted); font-size: .81rem; margin-top: 10px; }
.setup-card, .result-card, .transcript-panel { padding: clamp(17px, 2.2vw, 27px); }
.options { display: grid; gap: 16px; margin-top: 22px; }
.voice-comparison { display: grid; gap: 12px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.voice-comparison p { color: var(--soft); font-size: .9rem; }
.voice-comparison button { justify-self: start; }
.voice-samples { display: grid; gap: 12px; }
.voice-samples > div { display: grid; gap: 5px; font-size: .85rem; }
.voice-samples audio { display: block; width: 100%; height: 36px; }
.field { min-width: 0; display: grid; gap: 7px; }
.field > span:first-child, .levels legend { font-weight: 630; font-size: .82rem; color: var(--soft); }
input:not([type="checkbox"]):not([type="radio"]), select { display: block; min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 10px; min-height: 41px; background: var(--control); padding: 7px 11px; color: var(--ink); font-size: .9rem; }
input::placeholder { color: var(--muted); opacity: 1; }
.select-wrap { position: relative; display: block; min-width: 0; }
.select-wrap select { appearance: none; padding-right: 28px; text-overflow: ellipsis; }
.select-wrap svg { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.levels { padding: 0; margin: 0; border: 0; min-width: 0; }
.levels legend { margin-bottom: 7px; padding: 0; }
.segments { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 3px; border-radius: 10px; border: 1px solid var(--line); background: var(--control); }
.segments label { display: grid; position: relative; cursor: pointer; }
.segments input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segments span { display: grid; place-items: center; min-height: 32px; border-radius: 7px; font-size: .85rem; font-weight: 620; color: var(--muted); }
.segments input:checked + span { background: var(--accent); color: var(--accent-ink); }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.mode-tile { position: relative; display: grid; text-align: left; gap: 7px; padding: 20px; min-height: 154px; }
.mode-tile:hover { border-color: #82aa5b; }
.mode-tile > strong { color: var(--ink); font-size: 1.08rem; line-height: 1.2; }
.mode-tile > span:not(.tile-icon) { color: var(--muted); font-size: .82rem; }
.mode-tile > svg { position: absolute; right: 17px; top: 21px; color: var(--muted); }
.tile-icon, .turn-icon { background: var(--active); color: var(--ink); width: 35px; height: 35px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.in-lesson { min-height: 452px; }
.in-lesson .hero-visual { min-height: 240px; }
.timer { position: absolute; top: 18px; left: 23px; z-index: 2; color: var(--soft); font-variant-numeric: tabular-nums; }
.voice-status { font-weight: 650; margin-top: -3px; }
.lesson-notice:empty { display: none; }
.call-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.call-actions button { min-height: 37px; font-size: .81rem; padding: 7px 10px; }
.transcript-panel { display: flex; flex-direction: column; max-height: 525px; min-height: 300px; }
.turns { flex: 1; overflow: auto; margin: 15px 0 12px; }
.turn { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 5px 0; min-width: 0; }
.turn-icon { width: 30px; height: 30px; }
.turn-icon.learner { background: var(--control); }
.turn strong, .turn small { font-size: .75rem; color: var(--soft); }
.turn small { color: var(--muted); }
.turn p { margin-top: 2px; overflow-wrap: anywhere; font-size: .96rem; }
.reply { display: flex; gap: 8px; }
.send { background: var(--accent); color: var(--accent-ink); width: 43px; padding: 0; flex: 0 0 auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { display: grid; gap: 6px; padding: 17px 19px; }
.stat span { color: var(--muted); font-size: .81rem; }
.stat strong { font-size: 1.55rem; line-height: 1.06; }
.results-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; min-width: 0; }
.result-card h2 { margin-bottom: 13px; }
.result-card p + p { margin-top: 6px; }
.revision { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.revision:last-child { padding-bottom: 0; border-bottom: none; }
.original { color: var(--muted); }
.revision-target { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.revision-target svg { color: #80ae56; }
.muted, .empty { color: var(--muted); }
.small { font-size: .82rem; }
.next-topic { text-align: left; padding-left: 0; font-size: .95rem; }
.word-row, .history-row { display: flex; justify-content: space-between; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.word-row:last-child, .history-row:last-child { border-bottom: none; }
.word-row p { color: var(--muted); font-size: .87rem; }
.history-row a { display: grid; gap: 4px; flex: 1; }
.history-row a:hover { text-decoration: underline; }
.vocabulary-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.check input { accent-color: #82aa5b; }
.cost { margin: 0; }
.cost div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; }
.cost dt { color: var(--muted); }
.cost dd { margin: 0; font-variant-numeric: tabular-nums; }
.toast { position: fixed; z-index: 30; bottom: 16px; right: 16px; max-width: min(390px, calc(100vw - 32px)); padding: 12px 16px; background: var(--active); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 28px var(--shadow); }
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding: 21px 10px; }
  .brand { margin: 0 0 34px 0; display: grid; justify-content: center; }
  .brand-text, .nav-link span { display: none; }
  .nav-link { justify-content: center; padding-inline: 6px; }
}
@media (max-width: 780px) {
  .topbar { height: 60px; }
  #page { padding-top: 25px; }
  .lesson-grid { grid-template-columns: 1fr; }
  .practice-card { min-height: 385px; }
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .transcript-panel { height: 330px; }
}
@media (max-width: 580px) {
  .app-shell { display: block; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 10; height: auto; padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); }
  .brand { display: none; }
  .navigation { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .nav-link { display: grid; gap: 0; padding: 5px 2px; justify-items: center; font-size: .62rem; }
  .nav-link span { display: block; }
  .nav-link svg { width: 17px; height: 17px; }
  .topbar { padding: 0 16px; }
  #page { padding: 23px 14px 24px; }
  .page-heading { margin-bottom: 18px; }
  .page-heading p { margin-top: 7px; font-size: .9rem; }
  .panel { border-radius: 17px; }
  .practice-card { min-height: 355px; padding: 14px 12px 20px; }
  .hero-visual { min-height: 213px; }
  .orb-scene { width: min(100%, 305px); }
  .in-lesson .hero-visual { min-height: 205px; }
  .results-grid { grid-template-columns: 1fr; }
  .stat { border-radius: 13px; padding: 11px 9px; }
  .stat span { font-size: .68rem; }
  .heading-row { align-items: flex-start; flex-wrap: wrap; }
  .vocabulary-form { grid-template-columns: 1fr; }
  .toast { bottom: 70px; }
}

:root[data-brand="eugene"] { --accent: #ffab4a; --accent-strong: #ffc47f; --accent-ink: #22180e; }
:root[data-brand="eugene"][data-theme="light"] {
  --bg: #f1ede7; --side: #e8e2d9; --panel: #fffbf6; --control: #f5f0e8;
  --line: #dbd1c5; --ink: #1a1a1a; --muted: #514841; --soft: #463e35; --active: #eee0cf;
}
[data-brand="eugene"] .orb { filter: hue-rotate(-46deg); }
.beta-panel { max-width: 660px; padding: 26px; margin-bottom: 18px; }
.beta-panel p { color: var(--muted); max-width: 52ch; margin: 10px 0 17px; }
.beta-panel form { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.beta-panel form .field { flex: 1; }
.beta-panel form button { min-height: 41px; }
.beta-panel .text-button { min-height: auto; padding: 3px 0; text-decoration: underline; }
