/* IELTS — «экзаменационная бумага»: тёплая бумага, чернила, один сигнальный цвет. */
:root {
  --paper: #F2EFE7; --paper-2: #EAE6DB; --card: #FBFAF6; --ink: #16150F; --ink-2: #3A3830;
  --muted: #7A766B; --line: #D9D3C4; --line-2: #E6E1D5;
  --accent: #E5482B; --accent-ink: #fff; --accent-soft: #FBE3DC;
  --ok: #2F7D52; --ok-soft: #DDEEE3; --bad: #C8372D; --bad-soft: #F7DEDA; --warn: #B7791F; --warn-soft: #F6EBD3;
  --hl: #FFE58A;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Geologica', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 14px; --r-sm: 9px;
  --shadow: 0 1px 0 rgba(22,21,15,.04), 0 10px 30px -18px rgba(22,21,15,.25);
  --side: 248px;
  --read-font: var(--sans); --read-size: 17px; --read-lh: 1.75;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #121210; --paper-2: #191916; --card: #1C1C19; --ink: #EDEAE0; --ink-2: #CFCBBF;
  --muted: #8E8A7E; --line: #2F2E29; --line-2: #26251F;
  --accent: #FF6A4A; --accent-soft: #3A1E17; --ok: #5CC28A; --ok-soft: #17301F; --bad: #FF7A6B; --bad-soft: #3A1C18;
  --warn: #E0A84A; --warn-soft: #33281A; --hl: rgba(255, 216, 77, .28);
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 12px 30px -18px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--sans); font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; font-weight: 400; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--hl); color: var(--ink); }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hidden { display: none !important; }

.boot { height: 100vh; display: grid; place-items: center; }
.boot-mark { font-family: var(--serif); font-style: italic; font-size: 56px; opacity: .25; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }

/* ---------- Каркас ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 4px 10px 22px; text-decoration: none; }
.brand b { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 34px; line-height: 1; }
.brand i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; transform: translateY(-2px); }
.nav-group { margin: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink-2); transition: background .15s, color .15s; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a.on { background: var(--ink); color: var(--paper); }
.nav a .n { font-family: var(--mono); font-size: 11px; opacity: .55; width: 18px; }
.nav a .t { flex: 1; }
.nav a .badge { font-family: var(--mono); font-size: 10.5px; background: var(--accent); color: #fff; border-radius: 20px; padding: 1px 7px; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-weight: 600; overflow: hidden; flex: none; border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.main { min-width: 0; padding: 34px clamp(18px, 4vw, 56px) 80px; max-width: 1240px; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 16px calc(96px + var(--safe-b)); }
  .tabbar { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 50;
    background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line); border-radius: 18px; padding: 6px; box-shadow: var(--shadow); }
  .tabbar a { text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 4px; border-radius: 12px; color: var(--muted); font-size: 10.5px; }
  .tabbar a .ic { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1; color: var(--ink-2); }
  .tabbar a.on { background: var(--ink); color: var(--paper); }
  .tabbar a.on .ic { color: var(--paper); }
}

/* ---------- Типографика страниц ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head .kicker { margin-bottom: 6px; }
h1.title { font-family: var(--serif); font-weight: 400; font-size: clamp(42px, 6vw, 72px); line-height: .95; margin: 0; letter-spacing: -.02em; }
h1.title em { color: var(--accent); }
h2 { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.05; margin: 34px 0 14px; letter-spacing: -.01em; }
h3 { font-size: 17px; font-weight: 600; margin: 22px 0 8px; }
p { margin: 0 0 12px; }
.lead { font-size: 17px; color: var(--ink-2); max-width: 62ch; }
hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

/* ---------- Кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  padding: 11px 18px; border-radius: 999px; cursor: pointer; font-weight: 500; text-decoration: none; transition: transform .12s, background .15s, opacity .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { padding: 7px 13px; font-size: 13.5px; }
.btn.lg { padding: 15px 26px; font-size: 16.5px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; height: 40px; padding: 0; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); cursor: pointer; }
.link:hover { text-decoration-color: var(--accent); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }
input.inp, textarea.inp, select.inp { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
input.inp:focus, textarea.inp:focus, select.inp:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
label.fld { display: flex; flex-direction: column; gap: 6px; }
label.fld > span { font-size: 13px; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 20px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(16px); }

/* ---------- Карточки ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.flat { box-shadow: none; }
.card.pad-lg { padding: 28px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
@media (max-width: 1000px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .grid.c2, .grid.c3 { grid-template-columns: 1fr; } .grid.c4 { grid-template-columns: 1fr 1fr; } }

.tile { position: relative; display: flex; flex-direction: column; gap: 10px; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; cursor: pointer; transition: transform .18s, border-color .18s, box-shadow .18s; min-height: 140px; }
.tile:hover { transform: translateY(-2px); border-color: var(--ink); box-shadow: var(--shadow); }
.tile .t { font-weight: 600; font-size: 16px; line-height: 1.3; }
.tile .d { color: var(--muted); font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .foot { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tile .thumb { height: 130px; border-radius: 9px; overflow: hidden; background: var(--paper-2); border: 1px solid var(--line-2); }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tile .thumb svg { width: 100%; height: 100%; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.exam { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag.class { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tag.ai { border-style: dashed; }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-soft); }
.score-chip { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: var(--paper-2); }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 10px 14px 12px; cursor: pointer; color: var(--muted); position: relative; white-space: nowrap; font-weight: 500; }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.seg { display: inline-flex; padding: 3px; background: var(--paper-2); border-radius: 999px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 999px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { text-decoration: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; transition: border-color .15s; }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Главная ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero-main { padding: 28px; border-radius: 20px; background: var(--ink); color: var(--paper); position: relative; overflow: hidden; min-height: 230px; display: flex; flex-direction: column; }
.hero-main .label { color: color-mix(in srgb, var(--paper) 55%, transparent); }
.hero-main .big { font-family: var(--serif); font-size: clamp(64px, 9vw, 110px); line-height: .85; letter-spacing: -.03em; }
.hero-main .big small { font-size: .35em; font-style: italic; margin-left: 8px; letter-spacing: 0; }
.hero-main .ring { position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--paper) 15%, transparent); }
.hero-main .ring.r2 { width: 380px; height: 380px; right: -120px; top: -120px; }
.sec-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); transition: border-color .15s, transform .15s; position: relative; overflow: hidden; }
.sec-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.sec-card .num { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.sec-card .name { font-family: var(--serif); font-size: 30px; line-height: 1; font-style: italic; }
.sec-card .band { font-family: var(--mono); font-size: 26px; font-weight: 600; margin-top: 12px; }
.sec-card .band span { font-size: 12px; color: var(--muted); font-weight: 400; }
.sec-card .bar { height: 3px; background: var(--line-2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.sec-card .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.todo { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); text-decoration: none; }
.todo:last-child { border-bottom: 0; }
.todo .k { font-family: var(--serif); font-style: italic; font-size: 26px; width: 34px; color: var(--accent); }
.todo .x { flex: 1; }
.todo .x b { display: block; font-weight: 600; }
.todo .x span { color: var(--muted); font-size: 13.5px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; }
.heat i { width: 11px; height: 11px; border-radius: 3px; background: var(--line-2); }
.heat i.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--line-2)); }
.heat i.l2 { background: color-mix(in srgb, var(--accent) 60%, var(--line-2)); }
.heat i.l3 { background: var(--accent); }

/* ---------- Раннер (Reading/Listening) ---------- */
.runner-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 0 12px; margin: -10px 0 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.runner-bar .ttl { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { font-family: var(--mono); font-weight: 600; font-size: 15px; padding: 6px 12px; border-radius: 999px; background: var(--paper-2); cursor: pointer; user-select: none; min-width: 74px; text-align: center; }
.timer.warn { background: var(--warn-soft); color: var(--warn); }
.timer.over { background: var(--bad-soft); color: var(--bad); }
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.split > .pane { min-width: 0; }
.split > .pane.sticky { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; padding-right: 8px; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } .split > .pane.sticky { position: static; max-height: none; } .split.mtabs > .pane:not(.mshow) { display: none; } }
.mswitch { display: none; }
@media (max-width: 960px) { .mswitch { display: inline-flex; margin-bottom: 14px; } }
.passage { font-family: var(--read-font); font-size: var(--read-size); line-height: var(--read-lh); color: var(--ink); }
.passage .subtitle { font-style: italic; color: var(--muted); margin-bottom: 18px; }
.passage p { margin: 0 0 16px; display: flex; gap: 14px; }
.passage p .pl { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--accent); padding-top: 6px; width: 14px; flex: none; }
.passage mark.hlm, .transcript mark.hlm { background: var(--hl); color: inherit; border-radius: 3px; padding: .05em 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; cursor: pointer; }
.passage ::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.hl-bar { position: fixed; z-index: 120; display: flex; gap: 2px; padding: 4px; background: var(--ink); border-radius: 12px; box-shadow: 0 8px 24px -8px rgba(0,0,0,.45); }
.hl-bar button { border: 0; background: none; color: var(--paper); padding: 7px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.hl-bar button:hover { background: color-mix(in srgb, var(--paper) 14%, transparent); }
.hl-bar .sw { width: 12px; height: 12px; border-radius: 3px; background: #FFD84D; display: inline-block; }
.passage mark.qq, .transcript mark.qq { color: inherit; border-radius: 3px;  background: color-mix(in srgb, var(--ok) 25%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 40%, transparent); }
.qgroup { margin-bottom: 30px; }
.qgroup .instr { font-size: 14px; color: var(--ink-2); background: var(--paper-2); padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 14px; }
.qgroup .gtitle { font-weight: 600; margin: 0 0 10px; }
.optbox { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 14px; display: grid; gap: 4px; background: var(--card); }
.optbox b { font-family: var(--mono); display: inline-block; min-width: 34px; color: var(--accent); }
.q { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.q:last-child { border-bottom: 0; }
.qn { font-family: var(--mono); font-weight: 600; font-size: 13px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); flex: none; }
.q.ok .qn { background: var(--ok); color: #fff; }
.q.bad .qn { background: var(--bad); color: #fff; }
.qbody { flex: 1; min-width: 0; }
.qtext { margin-bottom: 8px; font-size: calc(var(--read-size) - 1px); }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--card); transition: border-color .12s, background .12s; font-size: 14.5px; }
.opt:hover { border-color: var(--ink-2); }
.opt.on { border-color: var(--ink); background: var(--paper-2); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt input { display: none; }
.tf { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tf button { border: 1px solid var(--line); background: var(--card); padding: 7px 12px; border-radius: 8px; cursor: pointer; font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.tf button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tf button.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.tf button.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.gapin { display: inline-block; width: 150px; max-width: 100%; border: 0; border-bottom: 1.5px solid var(--ink-2); background: color-mix(in srgb, var(--hl) 25%, transparent); padding: 2px 6px; font-family: var(--mono); font-size: 14px; outline: none; border-radius: 4px 4px 0 0; }
.gapin:focus { border-bottom-color: var(--accent); background: color-mix(in srgb, var(--hl) 50%, transparent); }
.gapin.correct { border-bottom-color: var(--ok); background: var(--ok-soft); }
.gapin.wrong { border-bottom-color: var(--bad); background: var(--bad-soft); text-decoration: line-through; }
select.gapin { width: auto; min-width: 70px; cursor: pointer; }
.gapnum { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--accent); margin-right: 3px; }
.template { white-space: pre-wrap; line-height: 2.1; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 16px 18px; font-size: 15px; }
.explain { margin-top: 8px; font-size: 13.5px; padding: 10px 12px; border-radius: 9px; background: var(--paper-2); }
.explain .ans { font-family: var(--mono); font-weight: 600; color: var(--ok); }
.explain .quote { font-family: var(--read-font); font-style: italic; font-size: 14px; color: var(--ink-2); display: block; margin-top: 4px; }
.result-banner { display: flex; align-items: center; gap: 24px; padding: 22px 26px; border-radius: 18px; background: var(--ink); color: var(--paper); margin-bottom: 22px; flex-wrap: wrap; }
.result-banner .b { font-family: var(--serif); font-size: 76px; line-height: .8; }
.result-banner .s { font-family: var(--mono); font-size: 13px; opacity: .7; }

/* ---------- Аудио ---------- */
.player { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); margin-bottom: 18px; }
.player .play { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; font-size: 18px; display: grid; place-items: center; flex: none; }
.player .track { flex: 1; height: 4px; background: var(--line); border-radius: 4px; position: relative; overflow: hidden; }
.player .track i { position: absolute; inset: 0 auto 0 0; background: var(--ink); width: 0; }
.player .tm { font-family: var(--mono); font-size: 12.5px; color: var(--muted); min-width: 90px; text-align: right; }
.transcript { font-size: var(--read-size); line-height: var(--read-lh); white-space: pre-wrap; font-family: var(--read-font); }
.transcript .sp { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-right: 6px; text-transform: uppercase; }

/* ---------- Writing ---------- */
.task-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.task-box .prompt { font-family: var(--read-font); font-size: calc(var(--read-size) + 1px); line-height: var(--read-lh); white-space: pre-wrap; font-weight: 500; }
.chart-wrap { margin-top: 16px; display: grid; gap: 14px; }
.chart-wrap img { border-radius: 10px; border: 1px solid var(--line-2); cursor: zoom-in; }
.chart { background: #fff; color: #222; border-radius: 10px; padding: 10px; border: 1px solid var(--line-2); }
:root[data-theme="dark"] .chart { background: #F7F5EF; }
.chart svg { width: 100%; height: auto; display: block; }
.editor { width: 100%; min-height: 460px; resize: vertical; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; font-size: var(--read-size); line-height: var(--read-lh); outline: none; font-family: var(--read-font); }
.editor:focus { border-color: var(--ink); }
.editor-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.wc { font-family: var(--mono); font-size: 13px; padding: 5px 10px; border-radius: 20px; background: var(--paper-2); }
.wc.ok { background: var(--ok-soft); color: var(--ok); }
.helper { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--card); margin-top: 14px; }
.helper summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.helper summary::after { content: '+'; font-family: var(--mono); color: var(--muted); }
.helper[open] summary::after { content: '–'; }
.phrase { display: inline-block; margin: 4px 4px 0 0; padding: 5px 10px; border-radius: 8px; border: 1px dashed var(--line); cursor: pointer; font-size: 13.5px; transition: border-color .12s, background .12s; }
.phrase:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Фидбек ИИ ---------- */
.crit { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
@media (max-width: 900px) { .crit { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .crit { grid-template-columns: 1fr; } }
.crit .c { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.crit .c .k { display: flex; justify-content: space-between; align-items: baseline; }
.crit .c .k b { font-family: var(--serif); font-size: 40px; line-height: 1; font-weight: 400; }
.crit .c .k span { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; text-align: right; max-width: 60%; }
.crit .c p { font-size: 13.5px; margin: 10px 0 0; color: var(--ink-2); }
.crit .c .do { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; }
.crit .c .do::before { content: '→ '; color: var(--accent); font-weight: 600; }
.mistake { display: grid; grid-template-columns: 1fr; gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.mistake .w { text-decoration: line-through; text-decoration-color: var(--bad); color: var(--muted); }
.mistake .r { font-weight: 600; color: var(--ok); }
.mistake .y { font-size: 13.5px; color: var(--ink-2); }
.mistake .tp { font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: var(--muted); }
.marked { white-space: pre-wrap; line-height: var(--read-lh); font-size: var(--read-size); font-family: var(--read-font); }
.marked .err { background: var(--bad-soft); border-bottom: 2px solid var(--bad); border-radius: 2px; cursor: help; position: relative; }
.improved { white-space: pre-wrap; font-family: var(--read-font); font-size: var(--read-size); line-height: var(--read-lh); }

/* ---------- Speaking ---------- */
.cue { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px 28px; position: relative; }
.cue .q { font-family: var(--read-font); font-weight: 600; font-size: clamp(22px, 2.6vw, 28px); line-height: 1.3; display: block; padding: 0; border: 0; }
.cue ul { margin: 16px 0 0; padding-left: 20px; font-size: 16px; }
.cue ul li { margin: 4px 0; }
.recorder { text-align: center; padding: 30px 20px; }
.rec-btn { width: 112px; height: 112px; border-radius: 50%; border: 0; cursor: pointer; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; position: relative; transition: transform .15s; }
.rec-btn:hover { transform: scale(1.03); }
.rec-btn.on { background: var(--ink); color: var(--paper); }
.rec-btn .pulse { position: absolute; inset: -10px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.rec-btn.on .pulse { animation: ring 1.6s ease-out infinite; }
@keyframes ring { from { opacity: .7; transform: scale(.9); } to { opacity: 0; transform: scale(1.35); } }
.rec-time { font-family: var(--mono); font-size: 44px; font-weight: 500; margin: 18px 0 4px; letter-spacing: -.02em; }
.meter { display: flex; align-items: center; justify-content: center; gap: 3px; height: 40px; margin: 10px 0; }
.meter i { width: 4px; border-radius: 3px; background: var(--ink-2); height: 4px; transition: height .08s; }
.prep { font-family: var(--serif); font-size: 96px; line-height: 1; }
.progress-line { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 12px auto; max-width: 420px; }
.progress-line i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .5s linear; }

/* ---------- Шпаргалки / markdown ---------- */
.md { max-width: 860px; font-size: calc(var(--read-size) - 1px); line-height: var(--read-lh); }
.md h1 { font-family: var(--serif); font-weight: 400; font-size: 46px; line-height: 1; margin: 0 0 20px; }
.md h2 { font-size: 28px; margin: 30px 0 10px; }
.md h3 { margin: 20px 0 6px; }
.md ul, .md ol { padding-left: 20px; margin: 0 0 14px; }
.md li { margin: 4px 0; }
.md table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; font-size: 14.5px; background: var(--card); border-radius: var(--r-sm); overflow: hidden; }
.md th, .md td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md th { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--paper-2); font-weight: 500; }
.md blockquote { margin: 12px 0; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.md code { font-family: var(--mono); font-size: .9em; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }
.md em { font-family: var(--serif); font-size: 1.12em; }
.md strong { font-weight: 600; }

/* ---------- Карточки (flashcards) ---------- */
.flash { perspective: 1200px; max-width: 560px; margin: 0 auto; }
.flash-in { position: relative; height: 300px; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.8,.2,1); cursor: pointer; }
.flash.flip .flash-in { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; border: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 30px; text-align: center; box-shadow: var(--shadow); }
.flash .face.back { transform: rotateY(180deg); background: var(--ink); color: var(--paper); }
.flash .en { font-family: var(--serif); font-size: 36px; line-height: 1.1; }
.flash .ru { font-size: 20px; }
.flash .ex { font-family: var(--read-font); font-style: italic; opacity: .7; margin-top: 14px; font-size: 17px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 560px; margin: 16px auto 0; }

/* ---------- Чат ---------- */
.chat { display: flex; flex-direction: column; gap: 14px; padding-bottom: 120px; max-width: 820px; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: 16px; line-height: 1.6; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.assistant .md h1 { font-size: 26px; }
.chat-input { position: fixed; bottom: 18px; left: calc(var(--side) + clamp(18px, 4vw, 56px)); right: clamp(18px, 4vw, 56px); max-width: 820px; display: flex; gap: 8px; padding: 8px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); z-index: 20; }
.chat-input textarea { flex: 1; border: 0; background: none; resize: none; outline: none; padding: 8px 10px; max-height: 160px; }
@media (max-width: 860px) { .chat-input { left: 12px; right: 12px; bottom: calc(86px + var(--safe-b)); } }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin-right: 4px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- Загрузка ИИ ---------- */
.thinking { text-align: center; padding: 60px 20px; }
.thinking .orb { width: 70px; height: 70px; margin: 0 auto 20px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.thinking .step { font-family: var(--serif); font-size: 24px; font-style: italic; min-height: 34px; }

/* ---------- Модалки и тосты ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,10,8,.45); backdrop-filter: blur(4px); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--paper); border-radius: 20px; max-width: 760px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 26px; border: 1px solid var(--line); position: relative; }
.modal .x { position: absolute; top: 14px; right: 14px; }
.modal.img { max-width: 1100px; padding: 10px; }
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; max-width: 90vw; animation: tin .25s ease; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .serif { font-size: 32px; color: var(--ink); display: block; margin-bottom: 6px; }

/* ---------- Лендинг / вход ---------- */
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
@media (max-width: 900px) { .landing { grid-template-columns: 1fr; } }
.landing .l { padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.landing .r { background: var(--ink); color: var(--paper); padding: clamp(28px, 5vw, 60px); display: flex; flex-direction: column; justify-content: center; gap: 0; position: relative; overflow: hidden; }
.landing .mega { font-family: var(--serif); font-style: italic; font-size: clamp(110px, 18vw, 240px); line-height: .8; letter-spacing: -.04em; margin: 0; }
.landing .mega i { color: var(--accent); font-style: normal; }
.landing .feat { display: grid; grid-template-columns: 50px 1fr; gap: 0 14px; padding: 18px 0; border-bottom: 1px solid color-mix(in srgb, var(--paper) 14%, transparent); }
.landing .feat .n { font-family: var(--mono); font-size: 12px; opacity: .5; padding-top: 7px; }
.landing .feat b { font-family: var(--serif); font-size: 30px; font-weight: 400; font-style: italic; }
.landing .feat p { grid-column: 2; margin: 2px 0 0; opacity: .7; font-size: 14.5px; }
.tg-btn { background: #2AABEE; border-color: #2AABEE; color: #fff; }

/* ---------- Админка ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; font-weight: 500; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.status { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.status.active { background: var(--ok-soft); color: var(--ok); }
.status.pending { background: var(--warn-soft); color: var(--warn); }
.status.rejected, .status.banned { background: var(--bad-soft); color: var(--bad); }
.status.new { background: var(--paper-2); color: var(--muted); }

/* ---------- Мелочи ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line-2); text-decoration: none; }
.list-row:hover { background: var(--paper-2); }
.list-row .band { font-family: var(--mono); font-weight: 600; width: 44px; }
.spark { width: 100%; height: 60px; }
.reveal { opacity: 0; transform: translateY(10px); }
.no-anim .reveal { opacity: 1; transform: none; }
.sticky-actions { position: sticky; bottom: 12px; z-index: 10; display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@media (max-width: 860px) { .sticky-actions { bottom: calc(88px + var(--safe-b)); } }

/* ---------- Печать шпаргалок ---------- */
@media print {
  :root { --paper: #fff; --card: #fff; --ink: #000; --muted: #555; --line: #bbb; --paper-2: #f2f2f2; --accent: #c0392b; --accent-soft: #fbeeee; }
  body { font-size: 11.5pt; }
  .side, .tabbar, .tabs, .no-print, #toasts, .page-head .row { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .md { max-width: none; }
  .md h1 { font-size: 30pt; }
  .md h2 { font-size: 18pt; margin-top: 16pt; break-after: avoid; }
  .md table, .md blockquote { break-inside: avoid; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Настройки чтения (кнопка Aa) ---------- */
.aa { position: relative; }
.aa-btn { font-family: var(--read-font); font-weight: 600; }
.aa-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 290px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.aa-pop .label { margin-bottom: 6px; }
.aa-pop .seg { display: flex; }
.aa-pop .seg button { flex: 1; }
.aa-size { display: flex; align-items: center; gap: 10px; }
.aa-size input { flex: 1; accent-color: var(--accent); }
.aa-size b { font-family: var(--mono); font-size: 13px; width: 38px; text-align: right; }
.aa-pop { width: 320px; }
.aa-pop .seg { flex-wrap: nowrap; border-radius: 12px; }
.aa-pop .seg button { padding: 7px 6px; font-size: 12.5px; border-radius: 10px; white-space: nowrap; }
@media (max-width: 500px) { .aa-pop { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; } }
