:root, [data-theme="dark"] {
  --bg: #0e1016; --bg2: #151823; --card: #1b1f2c; --card2: #232838; --line: #2b3144;
  --text: #eef0f7; --muted: #9aa1b8; --accent: #7c6cff; --accent2: #4f9dff;
  --grad: linear-gradient(135deg, #7c6cff 0%, #4f9dff 100%);
  --good: #2fd27a; --good-bg: rgba(47, 210, 122, .14); --bad: #ff5d6c; --bad-bg: rgba(255, 93, 108, .14);
  --warn: #ffb547; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --l0: #3ecf8e; --l1: #2fb7c9; --l2: #4f9dff; --l3: #7c6cff; --l4: #d46cff; --l5: #ff6c9a;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f5f6fb; --bg2: #eceef6; --card: #ffffff; --card2: #f1f3fa; --line: #e0e3ee;
  --text: #171a26; --muted: #6a7088; --shadow: 0 8px 24px rgba(30, 40, 80, .10);
  --good-bg: rgba(47, 180, 110, .12); --bad-bg: rgba(230, 70, 90, .10);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; min-height: 100dvh; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { opacity: .55; cursor: default; }
input, textarea { font: inherit; color: inherit; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 20px; margin: 0; }
h3 { font-size: 16px; margin: 0 0 10px; }
p { margin: 8px 0; }
.muted { color: var(--muted); } .small { font-size: 14px; } .hint { color: var(--muted); font-size: 13px; }
.center { text-align: center; } .grow { flex: 1; min-width: 0; } .left { text-align: left; }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.gap { gap: 10px; } .gap-s { gap: 6px; } .col { display: flex; flex-direction: column; }
.hidden { display: none !important; }
.good-t { color: var(--good); } .bad-t { color: var(--bad); }

#app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(92px + env(safe-area-inset-bottom)); }
.splash { min-height: 90dvh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--grad); color: #fff; font-weight: 800; font-size: 17px; }
.logo.big { width: 64px; height: 64px; border-radius: 18px; font-size: 34px; margin: 0 auto 10px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 0 10px; background: linear-gradient(var(--bg) 70%, transparent); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; max-width: 560px; margin: 0 auto;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg2) 88%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); border-radius: 14px; }
.nav button small { font-size: 11px; font-weight: 600; }
.nav button.on { color: var(--text); }
.nav button.on span { background: var(--grad); color: #fff; border-radius: 12px; padding: 3px 14px; }
.nav button span { display: grid; place-items: center; padding: 3px 14px; transition: background .2s; }

.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--muted); }
.icon-btn:active { background: var(--card2); }
.icon-btn.inline { width: 32px; height: 32px; vertical-align: middle; }
.icon-btn svg { width: 22px; height: 22px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 14px; background: var(--card2); font-weight: 600; border: 1px solid var(--line); min-height: 46px; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 8px 20px rgba(124, 108, 255, .3); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.btn.big { width: 100%; padding: 15px; font-size: 17px; margin: 8px 0; }
.btn.sm { padding: 7px 12px; min-height: 36px; font-size: 14px; border-radius: 11px; }
.btn:active { transform: scale(.98); }
.link-btn { color: var(--accent2); font-size: 14px; font-weight: 600; padding: 6px 0; }
.know-btn { background: var(--good-bg); color: var(--good); border-color: transparent; }
.learn-btn { background: rgba(255, 181, 71, .14); color: var(--warn); border-color: transparent; }
.file-btn input { display: none; }
.input, .tr-area, .essay-area { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); outline: none; margin: 6px 0; }
.input:focus, .tr-area:focus, .essay-area:focus { border-color: var(--accent); }
textarea { resize: vertical; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; align-items: center; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.static { cursor: default; color: var(--text); font-weight: 500; }
.chip small { color: var(--muted); font-weight: 400; }
.seg { display: flex; background: var(--card2); border-radius: 12px; padding: 3px; gap: 3px; margin: 6px 0; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.switch { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 12px 0; }
.panel summary { cursor: pointer; }
.section-head { margin: 6px 0 12px; }
.sub-h { margin: 22px 0 6px; font-size: 18px; }
.tag { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--card2); color: var(--muted); font-weight: 600; }
.tag.new { color: var(--accent2); } .tag.rev { color: var(--warn); }
.lvl-badge { display: inline-block; font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 8px; background: var(--grad); color: #fff; }
.lvl-badge.big { font-size: 22px; padding: 6px 14px; border-radius: 12px; }
.lvl-badge.xs { font-size: 10px; padding: 1px 6px; border-radius: 6px; }
.l0 { background: var(--l0) !important; } .l1 { background: var(--l1) !important; } .l2 { background: var(--l2) !important; }
.l3 { background: var(--l3) !important; } .l4 { background: var(--l4) !important; } .l5 { background: var(--l5) !important; }
.progress { height: 6px; background: var(--card2); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--grad); border-radius: 99px; transition: width .3s; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 20px; }
.empty-ic { font-size: 46px; }

/* ---- Слова ---- */
.words-top { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; }
.stat-ring { position: relative; width: 64px; height: 64px; flex: none; display: grid; place-items: center; }
.stat-ring > span { position: absolute; inset: 0; }
.stat-ring svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--card2); stroke-width: 6; }
.ring-fg { fill: none; stroke: url(#g) var(--accent); stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .4s; }
.stat-ring b { position: relative; font-size: 17px; line-height: 1; margin-top: 8px; }
.stat-ring small { position: relative; font-size: 10px; color: var(--muted); margin-top: -12px; }
.stat-main { flex: 1; text-align: left; min-width: 0; }
.stat-main .big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat-main .big small { font-size: 14px; font-weight: 500; color: var(--muted); }
.stat-main .sub { font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck { position: relative; height: min(50dvh, 420px); margin: 8px 0 14px; }
.card { position: absolute; inset: 0; border-radius: 26px; touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform .25s ease, opacity .25s; perspective: 1200px; }
.card.behind { pointer-events: none; }
.card.d1 { transform: translateY(12px) scale(.96); opacity: .7; }
.card.d2 { transform: translateY(24px) scale(.92); opacity: .4; }
.card-inner { position: absolute; inset: 0; transition: transform .45s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 26px; padding: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.face.front::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--grad); }
.face.back { transform: rotateY(180deg); justify-content: flex-start; padding-top: 34px; overflow-y: auto; }
.card-tags { position: absolute; top: 18px; left: 18px; right: 18px; display: flex; gap: 6px; flex-wrap: wrap; }
.card-word { font-size: clamp(30px, 9vw, 44px); font-weight: 800; letter-spacing: -.02em; word-break: break-word; }
.card-word.sm { font-size: 28px; display: flex; align-items: center; gap: 4px; }
.card-ru-big { font-size: 30px; font-weight: 700; }
.card-ipa { color: var(--muted); font-size: 17px; margin-top: 6px; }
.card-tap { position: absolute; bottom: 18px; font-size: 13px; color: var(--muted); opacity: .7; }
.card-ru { font-size: 24px; font-weight: 700; margin: 16px 0 6px; color: var(--accent2); }
.card-ex { margin-top: 14px; background: var(--card2); border-radius: 16px; padding: 12px 14px; width: 100%; }
.ex-text { font-size: 16px; text-align: left; width: 100%; font-style: italic; }
.ex-ru { color: var(--muted); font-size: 15px; margin-top: 6px; text-align: left; }
.card-meta { margin-top: auto; padding-top: 12px; color: var(--muted); font-size: 12px; }
.stamp { position: absolute; top: 40%; font-size: 30px; font-weight: 900; padding: 6px 16px; border: 4px solid; border-radius: 14px; opacity: 0; transition: opacity .15s; pointer-events: none; z-index: 3; }
.stamp.know { left: 24px; color: var(--good); transform: rotate(-14deg); }
.stamp.learn { right: 24px; color: var(--warn); transform: rotate(14deg); }
.card.going-know .stamp.know, .card.going-learn .stamp.learn { opacity: 1; }
.card.going-know .face { border-color: var(--good); } .card.going-learn .face { border-color: var(--warn); }
.deck-actions { display: flex; justify-content: center; align-items: center; gap: 18px; }
.round-btn { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.round-btn svg { width: 30px; height: 30px; stroke-width: 2.6; }
.round-btn.small { width: 48px; height: 48px; color: var(--muted); }
.round-btn.small svg { width: 22px; height: 22px; stroke-width: 2; }
.round-btn.know { color: var(--good); } .round-btn.learn { color: var(--warn); }
.round-btn:active { transform: scale(.92); }
.welcome { text-align: center; padding: 30px 6px; }
.welcome-ic { font-size: 60px; }
.welcome h1 { margin: 10px 0; }
.placement { max-width: 460px; margin: 0 auto; }
.pt-word { font-size: 40px; font-weight: 800; text-align: center; margin: 40px 0 6px; word-break: break-word; }
.pt-result { text-align: center; }
.pt-big { font-size: 42px; font-weight: 800; letter-spacing: -.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lv-bars { margin: 14px 0; display: flex; flex-direction: column; gap: 8px; }
.lv-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.bar { height: 10px; background: var(--card2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--grad); border-radius: 99px; }
.stat-hero { display: flex; justify-content: space-between; align-items: center; }
.days-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 6px 0; }
.day-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.day-bar { flex: 1; width: 100%; display: flex; flex-direction: column-reverse; background: var(--card2); border-radius: 6px; overflow: hidden; }
.seg.n, .seg.r { display: block; padding: 0; margin: 0; border-radius: 0; }
.day-bar .seg.n { background: var(--accent); } .day-bar .seg.r { background: var(--warn); }
.day-col small { font-size: 10px; color: var(--muted); }
.legend { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.n { background: var(--accent); } .dot.r { background: var(--warn); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat-box { background: var(--card2); border-radius: 14px; padding: 12px 6px; text-align: center; display: flex; flex-direction: column; }
.stat-box .ic { font-size: 20px; } .stat-box b { font-size: 20px; } .stat-box small { color: var(--muted); font-size: 11px; }
.word-list { margin-top: 8px; }
.word-row { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pill { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--card2); }
.pill.new { color: var(--accent2); } .pill.learn { color: var(--warn); background: rgba(255, 181, 71, .14); } .pill.known { color: var(--good); background: var(--good-bg); }
.add-box { margin: 8px 0; } .add-box summary { color: var(--accent2); font-weight: 600; cursor: pointer; padding: 6px 0; }

/* ---- Шторка ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .2s; }
.sheet-wrap.open { background: rgba(0, 0, 0, .5); }
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; background: var(--bg2); border-radius: 24px 24px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.sheet.full { height: 94dvh; max-height: 94dvh; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px 20px; }
.sheet-body { overflow-y: auto; padding: 6px 20px calc(24px + env(safe-area-inset-bottom)); flex: 1; overscroll-behavior: contain; }
.settings section { padding: 14px 0; border-bottom: 1px solid var(--line); }
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 200; background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; max-width: 90vw; transition: all .25s; pointer-events: none; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.good { background: var(--good); color: #062; } #toast.bad { background: var(--bad); color: #fff; }

/* ---- Грамматика ---- */
.tense-grid { display: grid; grid-template-columns: 74px repeat(3, 1fr); gap: 6px; }
.tg-head { text-align: center; padding: 6px 0; } .tg-head b { display: block; } .tg-head small { color: var(--muted); font-size: 11px; }
.tg-side { font-size: 11px; font-weight: 700; color: var(--muted); display: flex; align-items: center; line-height: 1.2; }
.tg-cell { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; min-height: 70px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 6px; }
.tg-cell:active { transform: scale(.97); }
.tg-name { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.2; }
.tg-pct { font-size: 11px; color: var(--muted); width: 100%; height: 18px; border-radius: 6px; display: grid; place-items: center;
  background: linear-gradient(90deg, rgba(124, 108, 255, .35) var(--p), var(--card2) var(--p)); }
.action-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.action { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; text-align: left; }
.action b { display: block; } .action small { color: var(--muted); font-size: 13px; }
.action-ic { font-size: 24px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--card2); border-radius: 12px; }
.chev { color: var(--muted); transform: rotate(180deg); display: grid; }
.chev svg { width: 18px; height: 18px; }
.back-bar { display: flex; align-items: center; gap: 4px; margin: 4px 0 6px -8px; }
.back-bar h1 { font-size: 22px; }
.tense-ru { margin: 0 0 8px; }
.idea { background: linear-gradient(135deg, rgba(124, 108, 255, .16), rgba(79, 157, 255, .12)); border: 1px solid rgba(124, 108, 255, .3); border-radius: 16px; padding: 14px; margin: 10px 0; font-weight: 500; }
.timeline { width: 100%; height: auto; }
.tl-axis { stroke: var(--muted); stroke-width: 2; } .tl-arrow { fill: var(--muted); }
.tl-now { stroke: var(--accent2); stroke-width: 3; } .tl-ref { stroke: var(--warn); stroke-width: 2; stroke-dasharray: 3 3; }
.tl-lbl { fill: var(--muted); font-size: 11px; text-anchor: middle; } .tl-lbl.sm { font-size: 10px; fill: var(--warn); }
.tl-dot { fill: var(--accent); } .tl-x { fill: var(--accent); font-size: 18px; font-weight: 800; text-anchor: middle; }
.tl-wave { fill: none; stroke: var(--accent); stroke-width: 2.5; } .tl-span { stroke: transparent; }
.tl-res { stroke: var(--good); stroke-width: 2.5; } .tl-resh { fill: var(--good); }
.formula div { padding: 8px 0; border-bottom: 1px dashed var(--line); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; display: flex; gap: 10px; align-items: baseline; }
.formula div:last-child { border: 0; }
.f-sign { flex: none; width: 24px; height: 24px; border-radius: 7px; display: inline-grid; place-items: center; font-weight: 800; font-family: system-ui; }
.f-sign.pos { background: var(--good-bg); color: var(--good); } .f-sign.neg { background: var(--bad-bg); color: var(--bad); } .f-sign.q { background: rgba(79, 157, 255, .15); color: var(--accent2); }
table.forms { width: 100%; border-collapse: collapse; font-size: 13px; }
table.forms th { color: var(--muted); text-align: left; padding: 4px; }
table.forms td { padding: 8px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.usage { padding: 10px 0; border-bottom: 1px solid var(--line); } .usage:last-child { border: 0; }
.ex-line { display: flex; align-items: center; gap: 4px; font-style: italic; margin-left: -6px; }
.mistake, .err { padding: 10px 0; border-bottom: 1px solid var(--line); } .mistake:last-child, .err:last-child { border: 0; }
.wrong { color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(255, 93, 108, .5); }
.right { color: var(--good); font-weight: 600; }
.sticky-cta { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); padding-top: 18px; }
.exercise { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin: 10px 0; display: flex; flex-direction: column; gap: 10px; }
.q { font-size: 19px; font-weight: 600; line-height: 1.6; }
.q.big { font-size: 21px; }
.q.fill { line-height: 2.2; }
.blank { display: inline-block; min-width: 120px; width: auto; max-width: 100%; padding: 4px 10px; margin: 0 4px; border: 0; border-bottom: 2px solid var(--accent); background: var(--card2); border-radius: 8px 8px 0 0; font-size: 18px; outline: none; }
.blank.ok { border-color: var(--good); color: var(--good); } .blank.bad { border-color: var(--bad); color: var(--bad); }
.options { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--card2); border: 2px solid transparent; font-weight: 600; font-size: 16px; }
.opt.ok { border-color: var(--good); background: var(--good-bg); } .opt.bad { border-color: var(--bad); background: var(--bad-bg); }
.feedback:empty { display: none; }
.feedback { border-radius: 14px; padding: 12px 14px; }
.feedback.good { background: var(--good-bg); } .feedback.good > b { color: var(--good); }
.feedback.bad { background: var(--bad-bg); } .feedback.bad > b { color: var(--bad); }
.right-ans { margin-top: 4px; }
.hint-box summary { color: var(--muted); font-size: 14px; cursor: pointer; }
.input.fix { font-size: 17px; }
.result-card { text-align: center; padding: 30px 10px; display: flex; flex-direction: column; gap: 10px; }
.dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.rdot { width: 14px; height: 14px; border-radius: 50%; } .rdot.ok { background: var(--good); } .rdot.bad { background: var(--bad); }
.irr-list { margin-top: 6px; }
.irr-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; width: 100%; text-align: left; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.irr-row.head { font-size: 12px; color: var(--muted); font-weight: 700; }
.irr-row small { display: block; color: var(--muted); font-size: 12px; }
.cheat-row { display: block; width: 100%; text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cheat-row:last-child { border: 0; }

/* ---- Эссе ---- */
.topic-box { background: var(--card2); border-radius: 14px; padding: 12px 14px; margin: 6px 0; }
.topic-text { font-weight: 600; }
.topic-item { display: block; width: 100%; text-align: left; padding: 14px 0; border-bottom: 1px solid var(--line); }
.topic-item .tag { margin: 0 6px 6px 0; }
.editor-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.editor-wrap:focus-within { border-color: var(--accent); }
.essay-area, .tr-area { border: 0; margin: 0; border-radius: 0; background: transparent; min-height: 260px; font-size: 17px; line-height: 1.55; }
.tr-area { min-height: 120px; }
.editor-foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-top: 1px solid var(--line); gap: 8px; }
.counter { font-size: 13px; font-weight: 700; color: var(--muted); } .counter.ok { color: var(--good); }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-hero { display: flex; gap: 16px; align-items: flex-start; margin: 10px 0; }
.lvl-circle { width: 84px; height: 84px; border-radius: 26px; flex: none; display: grid; place-items: center; font-size: 34px; font-weight: 900; color: #fff; box-shadow: var(--shadow); }
.scale { display: flex; gap: 4px; margin-bottom: 6px; }
.scale span { flex: 1; text-align: center; font-size: 11px; font-weight: 700; padding: 4px 0; border-radius: 6px; background: var(--card2); color: var(--muted); }
.scale span.on { background: var(--grad); color: #fff; }
.crit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crit { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.crit b { font-size: 13px; }
.essay-text { line-height: 1.7; font-size: 16px; }
.essay-text mark { background: var(--bad-bg); color: inherit; border-bottom: 2px solid var(--bad); border-radius: 3px; padding: 0 2px; cursor: pointer; }
.trend { display: flex; gap: 6px; align-items: flex-end; height: 110px; margin-bottom: 10px; }
.trend-bar { flex: 1; border-radius: 8px 8px 4px 4px; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: start center; padding-top: 4px; }

/* ---- Перевод ---- */
.dir-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); margin-bottom: 10px; }
.dir-btn span { color: var(--accent2); display: grid; }
.tr-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 10px 0; }
.tr-res { font-size: 20px; font-weight: 600; white-space: pre-wrap; user-select: text; margin-bottom: 10px; }
.alts { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.hist-row { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hist-row > button.grow { font-size: 15px; }

/* ---- Гайды ---- */
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.guide-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 14px; text-align: left; display: flex; flex-direction: column; gap: 10px; min-height: 110px; }
.g-emoji { font-size: 30px; }
.guide { line-height: 1.6; }
.guide h3 { margin: 20px 0 8px; font-size: 18px; }
.guide li { margin: 4px 0; }
.guide blockquote { margin: 10px 0; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 12px 12px 0; }
.guide table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.guide th, .guide td { border-bottom: 1px solid var(--line); padding: 7px 5px; text-align: left; vertical-align: top; }
.guide th { color: var(--muted); font-size: 12px; }

@media (min-width: 600px) { #app { padding-top: 10px; } .deck { height: 460px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
