/* ============ Матемагия — тетрадная тема ============ */
:root {
  --bg: #f6f0df;
  --grid: #e7dec3;
  --card: #fffdf6;
  --card2: #f1e9d2;
  --ink: #1c2340;
  --muted: #6b6d80;
  --bd: #1c2340;
  --sh: #1c2340;
  --track: #e4dab9;
  --blue: #2c5bff;
  --blue-d: #1a3fc2;
  --green: #0e9464;
  --green-l: #dcf3e6;
  --red: #e03a1e;
  --red-l: #ffe3db;
  --yellow: #ffc531;
  --yellow-d: #d99a00;
  --orange: #e8710a;
  --pink: #d6336c;
  --teal: #0b8fa0;
  --soft: rgba(28, 35, 64, .12);
  --r: 16px;
  --font: 'Onest', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --head: 'Unbounded', 'Onest', 'Segoe UI', system-ui, sans-serif;
}
[data-theme="dark"] {
  --bg: #111e1b;
  --grid: #172a26;
  --card: #1a2b27;
  --card2: #223732;
  --ink: #f0ecda;
  --muted: #a3ad9f;
  --bd: #3a544d;
  --sh: #050d0b;
  --track: #2b423c;
  --blue: #5b82ff;
  --blue-d: #3558d8;
  --green: #2fc98a;
  --green-l: #163c2f;
  --red: #ff6a4d;
  --red-l: #442219;
  --yellow: #ffcf4a;
  --soft: rgba(240, 236, 218, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); font-size: 16px; line-height: 1.5; min-height: 100vh; overflow-x: hidden;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
body.noscroll { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2 { font-family: var(--head); letter-spacing: -.02em; line-height: 1.2; }
b { font-weight: 700; }
small { font-size: .8rem; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
input { font-family: inherit; }

.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.2em; }
.avatar { display: inline-block; border-radius: 30%; overflow: hidden; border: 2px solid var(--bd); flex: none; line-height: 0; background: var(--card2); }
.avatar img, .avatar svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.gly { font-family: var(--head); font-weight: 700; font-size: calc(1.15em * var(--gs, 1)); letter-spacing: -.04em; line-height: 1; white-space: nowrap; }
.mascot { display: block; }

/* ---------- формулы ---------- */
i.v { font-style: italic; font-family: 'Cambria Math', 'STIX Two Math', Georgia, 'Times New Roman', serif; font-weight: 500; padding-right: .04em; }
.fn { font-style: normal; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .16em; line-height: 1.15; font-size: .92em; }
.frac .n { padding: 0 .2em; border-bottom: .09em solid currentColor; }
.frac .d { padding: 0 .2em; }
.sqrt { display: inline-flex; align-items: baseline; }
.sqrt .rad { line-height: 1.1; margin-right: -.06em; font-weight: 600; }
.sqrt .rt { border-top: .085em solid currentColor; line-height: 1.02; padding: .06em .14em 0 .08em; }
.cases { display: inline-flex; align-items: center; margin: 0 .2em; vertical-align: middle; }
.cases .brace { font-size: 3.2em; font-weight: 200; line-height: .9; transform: scaleX(.6); margin-right: .05em; }
.cases .rows { display: flex; flex-direction: column; text-align: left; line-height: 1.5; }
.tx { font-style: normal; }
sup, sub { line-height: 0; font-size: .7em; }

/* ---------- кнопки ---------- */
.btn {
  --c: var(--blue); --t: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 12px 22px; border-radius: 14px; font-weight: 700; font-size: .98rem;
  background: var(--c); color: var(--t); border: 2px solid var(--bd); box-shadow: 0 4px 0 var(--sh);
  transition: transform .08s, box-shadow .08s, background .15s; user-select: none;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 0 var(--sh); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--sh); }
.btn:disabled { background: var(--card2); color: var(--muted); border-color: var(--soft); box-shadow: none; }
.btn.primary { --c: var(--blue); }
.btn.green { --c: var(--green); }
.btn.red { --c: var(--red); }
.btn.amber { --c: var(--yellow); --t: #1c2340; }
.btn.dark { --c: #1c2340; --t: #fff8e6; }
[data-theme="dark"] .btn.dark { --c: #f0ecda; --t: #111e1b; }
.btn.danger { --c: var(--red); }
.btn.light { --c: var(--card); --t: var(--ink); }
.btn.ghost { --c: transparent; --t: var(--ink); border-color: var(--soft); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: var(--card2); transform: none; box-shadow: none; }
.btn.ghost:active:not(:disabled) { transform: none; }
.btn.small { padding: 8px 14px; font-size: .82rem; border-radius: 11px; box-shadow: 0 3px 0 var(--sh); }
.btn.big { padding: 15px 30px; font-size: 1.05rem; min-width: 170px; }
.btn.wide { width: 100%; }
.btn .ic { width: 1.15em; height: 1.15em; }
.linkb { color: var(--blue); font-weight: 700; }
.back { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 4px; margin-bottom: 12px; color: var(--muted); font-weight: 700; border-radius: 10px; }
.back:hover { color: var(--ink); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 250px minmax(0, 700px) 330px; gap: 28px; justify-content: center; max-width: 1380px; margin: 0 auto; padding: 0 20px; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 0; display: flex; flex-direction: column; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; padding: 0 6px; }
.logo.sm { font-size: 1rem; padding: 0; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.nav { position: relative; display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 14px; border: 2px solid transparent; font-weight: 700; color: var(--muted); text-align: left; transition: background .15s, color .15s; }
.nav span { display: grid; place-items: center; width: 30px; }
.nav .ic { width: 1.5rem; height: 1.5rem; }
.nav:hover { background: var(--card2); color: var(--ink); }
.nav.on { background: var(--card); border-color: var(--bd); color: var(--ink); box-shadow: 0 3px 0 var(--sh); }
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-style: normal; font-size: .75rem; font-weight: 800; display: grid; place-items: center; }
.side-me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; border: 2px solid var(--bd); background: var(--card); text-align: left; box-shadow: 0 3px 0 var(--sh); }
.side-me b { display: block; line-height: 1.2; }
.side-me small { color: var(--muted); }
.mid { min-width: 0; padding: 22px 0 60px; }
.rpanel { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow: auto; padding: 22px 0; display: flex; flex-direction: column; gap: 16px; scrollbar-width: none; }
.topbar, .bottomnav { display: none; }
.vt { font-size: 1.7rem; font-weight: 800; margin: 4px 0 14px; }
.lead { color: var(--muted); margin-bottom: 16px; max-width: 60ch; }
.sec-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 26px 0 14px; }
.sec-h h2 { font-size: 1.15rem; }

.view.enter > * { animation: rise .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.card { background: var(--card); border: 2px solid var(--bd); border-radius: var(--r); padding: 18px; box-shadow: 0 4px 0 var(--sh); }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.view .card { margin-bottom: 16px; }
.pbar { height: 12px; background: var(--track); border-radius: 99px; overflow: hidden; border: 2px solid var(--bd); }
.pbar i { display: block; height: 100%; background: var(--blue); transition: width .6s; }
.pbar.big { height: 18px; }
.pbar.big i { background: var(--yellow); }

.statcard { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-flame, .stat-xp { display: flex; align-items: center; gap: 10px; }
.stat-flame b, .stat-xp b { font-family: var(--head); font-size: 1.5rem; display: block; line-height: 1.1; }
.stat-flame small, .stat-xp small { color: var(--muted); }
.ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; border: 2px solid var(--bd); background: var(--card2); }
.ico .ic { width: 1.5rem; height: 1.5rem; }
.ico.flame { color: var(--muted); }
.ico.flame.on { background: #ffd9c2; color: #d8391b; }
.ico.flame.on .ic { fill: #ff8a3c; animation: flick 1.6s infinite; }
.ico.star { background: #fff1b8; color: #b98000; }
.ico.star .ic { fill: var(--yellow); }
[data-theme="dark"] .ico.flame.on, [data-theme="dark"] .ico.star { background: var(--card2); }
@keyframes flick { 50% { transform: scale(1.14) rotate(-5deg); } }
.goal { display: flex; gap: 16px; align-items: center; }
.ring { position: relative; flex: none; }
.ring-in { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--head); font-size: 1rem; }
.goal-t { font-weight: 700; color: var(--muted); }
.rank b { font-family: var(--head); font-size: 1.15rem; display: block; margin-bottom: 8px; }
.rank small { display: block; margin-top: 6px; }
.quest { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.quest + .quest { border-top: 1px dashed var(--soft); }
.qi { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--card2); border: 2px solid var(--bd); }
.qb { flex: 1; min-width: 0; }
.qb b { display: block; font-size: .9rem; margin-bottom: 5px; }
.qb .pbar { height: 9px; border-width: 1.5px; }
.qv { font-weight: 700; color: var(--muted); font-size: .85rem; }
.quest.done .pbar i { background: var(--green); }
.quest.done .qi { background: var(--green-l); color: var(--green); }

/* ---------- учиться ---------- */
.coursebar { position: sticky; top: 0; z-index: 20; padding: 10px 0 12px; display: flex; gap: 12px; align-items: center; background: var(--bg); }
.course-chip { display: flex; align-items: center; gap: 12px; padding: 9px 14px 9px 10px; border-radius: 16px; background: var(--card); border: 2px solid var(--bd); box-shadow: 0 4px 0 var(--sh); text-align: left; flex: 1; min-width: 0; transition: transform .1s, box-shadow .1s; }
.course-chip:active { transform: translateY(4px); box-shadow: 0 0 0 var(--sh); }
.ci { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--u, var(--blue)); color: #fff; border: 2px solid var(--bd); flex: none; }
.ct { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.ct small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { color: var(--muted); }
.cprog { position: relative; width: 84px; height: 40px; border-radius: 12px; background: var(--card); border: 2px solid var(--bd); overflow: hidden; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: .8rem; flex: none; }
.cprog i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--yellow); opacity: .6; }
.cprog span { position: relative; }

.unit { margin-top: 22px; }
.ubanner { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 18px; color: #fff; background: var(--u); border: 2px solid var(--bd); box-shadow: 0 5px 0 var(--sh); position: relative; overflow: hidden; }
.ubanner::after { content: '∑ π √ ∫ ∞ ≠ ±'; position: absolute; right: -8px; bottom: -18px; font-family: var(--head); font-size: 3.6rem; font-weight: 800; opacity: .12; letter-spacing: .25em; white-space: nowrap; pointer-events: none; }
.ub-gly { width: 58px; height: 58px; border-radius: 16px; background: rgba(255, 255, 255, .95); color: var(--u); display: grid; place-items: center; border: 2px solid var(--bd); flex: none; font-size: 1.2rem; }
.ub-t { flex: 1; min-width: 0; position: relative; z-index: 1; }
.ub-t small { opacity: .9; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; font-size: .7rem; }
.ub-t h2 { font-size: 1.1rem; margin: 2px 0; }
.ub-t p { opacity: .95; font-size: .9rem; }
.ub-r { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; position: relative; z-index: 1; }
.ub-count { font-weight: 700; background: rgba(0, 0, 0, .22); padding: 2px 11px; border-radius: 99px; font-size: .82rem; }

.path { display: flex; flex-direction: column; align-items: center; gap: 30px; padding: 30px 0 6px; }
.nwrap { position: relative; display: flex; flex-direction: column; align-items: center; transform: translateX(var(--x)); width: 110px; }
.node { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; color: #fff; position: relative; transition: transform .12s, box-shadow .12s; background: var(--u); border: 3px solid var(--bd); box-shadow: 0 6px 0 var(--sh); }
.node:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--sh); }
.node:active { transform: translateY(6px); box-shadow: 0 0 0 var(--sh); }
.node .ni { display: grid; place-items: center; }
.node .ni .ic { width: 1.9rem; height: 1.9rem; stroke-width: 2.4; }
.node.done { background: var(--yellow); color: #1c2340; }
.node.lock { background: var(--card2); color: var(--muted); }
.node.lock .ic { width: 1.6rem; height: 1.6rem; }
.node.test { width: 92px; height: 92px; background: var(--card); color: var(--u); }
.node.test .ic { width: 2.3rem; height: 2.3rem; }
.node.test.done { background: var(--yellow); color: #1c2340; }
.node.test.lock { background: var(--card2); color: var(--muted); }
.node.cur::before { content: ''; position: absolute; inset: -11px; border-radius: 50%; border: 3px dashed var(--u); animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nlabel { margin-top: 12px; font-size: .76rem; font-weight: 700; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .06em; }
.nstars { display: flex; gap: 2px; color: var(--muted); }
.nstars .ic { width: 1rem; height: 1rem; }
.nstars span.on { color: var(--yellow-d); }
.nstars span.on .ic { fill: var(--yellow); }
.bubble { position: absolute; top: -38px; background: var(--ink); color: var(--bg); font-weight: 700; padding: 5px 14px; border-radius: 10px; text-transform: uppercase; font-size: .78rem; letter-spacing: .06em; animation: bob 1.3s ease-in-out infinite; white-space: nowrap; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: var(--ink); transform: translateX(-50%) rotate(45deg); }
@keyframes bob { 50% { transform: translateY(-6px); } }
.finish { text-align: center; margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.finish p { color: var(--muted); max-width: 420px; }

/* ---------- темы ---------- */
.grade-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; margin: 0 -2px 8px; scrollbar-width: thin; }
.gchip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; border: 2px solid var(--bd); background: var(--card); font-weight: 700; white-space: nowrap; flex: none; box-shadow: 0 3px 0 var(--sh); transition: transform .1s; }
.gchip:hover { transform: translateY(-1px); }
.gchip .gc-g { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--u); color: #fff; font-size: .8rem; }
.gchip.on { background: var(--ink); color: var(--bg); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 8px; }
.tcard { display: flex; align-items: center; gap: 14px; padding: 14px; text-align: left; border-radius: 16px; background: var(--card); border: 2px solid var(--bd); box-shadow: 0 4px 0 var(--sh); position: relative; transition: transform .1s, box-shadow .1s; }
.tcard:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--sh); }
.tcard:active { transform: translateY(4px); box-shadow: 0 0 0 var(--sh); }
.tc-g { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; background: var(--u); color: #fff; border: 2px solid var(--bd); flex: none; font-size: 1.1rem; }
.tcard b { display: block; line-height: 1.25; }
.tcard small { color: var(--muted); display: block; line-height: 1.3; margin-top: 2px; }
.tc-dots { display: flex; gap: 5px; margin-top: 8px; }
.tc-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--bd); background: transparent; }
.tc-dots i.on { background: var(--green); }

.thead { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: 18px; background: var(--u); color: #fff; border: 2px solid var(--bd); box-shadow: 0 5px 0 var(--sh); margin-bottom: 8px; }
.th-g { width: 66px; height: 66px; border-radius: 18px; background: #fff; color: var(--u); display: grid; place-items: center; border: 2px solid var(--bd); flex: none; font-size: 1.4rem; }
.thead small { opacity: .9; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; }
.thead h1 { font-size: 1.35rem; margin: 2px 0; }
.thead p { opacity: .95; }
.tsec { margin-top: 26px; }
.tsec > h2 { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; margin-bottom: 12px; }
.num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); color: #1c2340; border: 2px solid var(--bd); font-size: .95rem; flex: none; }
.theory p { font-size: 1.08rem; line-height: 1.7; }
.theory p + p { margin-top: 12px; }
.sub-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 18px 0 8px; }
.rules { display: grid; gap: 10px; }
.rule { background: var(--card); border: 2px solid var(--bd); border-left-width: 8px; border-left-color: var(--blue); border-radius: 12px; padding: 12px 14px; }
.rule b { display: block; margin-bottom: 4px; }
.rule p { line-height: 1.7; }
.rule .warn, .rv-sec.warn p, .warn { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #fff1b8; color: #5a4300; font-size: .92rem; line-height: 1.5; }
[data-theme="dark"] .rule .warn, [data-theme="dark"] .warn { background: #3d3512; color: #ffe38a; }
.warn .ic { margin-top: 2px; }
.exq { padding: 0; overflow: hidden; }
.ex-n { padding: 8px 16px; background: var(--card2); border-bottom: 2px solid var(--bd); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ex-q { padding: 16px; font-size: 1.35rem; font-weight: 600; line-height: 1.8; }
.ex-a { padding: 0 16px 10px; display: flex; gap: 10px; align-items: baseline; }
.ex-a span, .ex-s > span { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.ex-a b { color: var(--green); font-size: 1.15rem; }
.ex-s { padding: 0 16px 14px; }
.ex-r { padding: 12px 16px 14px; border-top: 2px dashed var(--soft); background: var(--card2); }
.ex-r span { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.ex-r p { margin-top: 4px; line-height: 1.65; font-size: .95rem; }
.steps { margin: 6px 0 0; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 6px; }
.steps li { counter-increment: st; display: flex; gap: 10px; align-items: flex-start; line-height: 1.6; }
.steps li::before { content: counter(st); flex: none; width: 24px; height: 24px; margin-top: 2px; border-radius: 50%; background: var(--blue); color: #fff; font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.solv { margin-top: 6px; line-height: 1.6; }
.setrow { display: grid; gap: 12px; }
.setc { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.setc > span { min-width: 108px; font-weight: 700; font-size: .9rem; color: var(--muted); }
.mact { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.mact.left { justify-content: flex-start; }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--card2); border: 2px solid var(--bd); gap: 2px; flex-wrap: wrap; }
.seg button { padding: 6px 13px; border-radius: 8px; font-weight: 700; font-size: .84rem; color: var(--muted); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg.light { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .8); }
.seg.light button { color: #fff; }
.seg.light button.on { background: #fff; color: var(--ink); }

/* ---------- тренировка / блиц ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px; border-radius: 22px; color: #fff; background: var(--blue); border: 2px solid var(--bd); box-shadow: 0 6px 0 var(--sh); position: relative; overflow: hidden; }
.hero.daily { background: var(--yellow); color: #1c2340; }
.hero.daily.done { background: var(--green); color: #fff; }
.hero.blitz { background: var(--teal); }
.hero::after { content: '+ − × ÷ = %'; position: absolute; right: 8px; bottom: -20px; font-family: var(--head); font-size: 4.2rem; font-weight: 800; opacity: .1; letter-spacing: .2em; white-space: nowrap; pointer-events: none; }
.hero-t { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; position: relative; z-index: 1; }
.hero-t small { text-transform: uppercase; letter-spacing: .1em; font-weight: 700; opacity: .9; font-size: .72rem; }
.hero-t h2 { font-size: 1.35rem; }
.hero-t p { opacity: .92; max-width: 400px; margin-bottom: 6px; }
.hero-m { position: relative; z-index: 1; animation: float 3.4s ease-in-out infinite; flex: none; }
@keyframes float { 50% { transform: translateY(-8px) rotate(2deg); } }
.row3 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.view .row3 .card { margin: 0; }
.card.action { display: flex; align-items: center; gap: 14px; text-align: left; transition: transform .1s, box-shadow .1s; }
.card.action:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--sh); }
.card.action:active { transform: translateY(4px); box-shadow: 0 0 0 var(--sh); }
.card.action .ai { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; background: var(--card2); border: 2px solid var(--bd); flex: none; }
.card.action .ai .ic { width: 1.5rem; height: 1.5rem; }
.card.action b { display: block; }
.card.action small { color: var(--muted); }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.topic { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; text-align: left; border-radius: 16px; background: var(--card); border: 2px solid var(--bd); box-shadow: 0 4px 0 var(--sh); transition: transform .1s, box-shadow .1s; min-height: 108px; }
.topic:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--sh); }
.topic:active { transform: translateY(4px); box-shadow: 0 0 0 var(--sh); }
.topic .ti { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--yellow); color: #1c2340; border: 2px solid var(--bd); font-size: .95rem; }
.topic:nth-child(4n+2) .ti { background: #bcd0ff; }
.topic:nth-child(4n+3) .ti { background: #b6ebd2; }
.topic:nth-child(4n+4) .ti { background: #ffc6d9; }
.topic b { font-size: .92rem; line-height: 1.25; }
.modes { display: grid; gap: 12px; }
.mode { display: flex; align-items: center; gap: 14px; padding: 14px; text-align: left; border-radius: 16px; background: var(--card); border: 2px solid var(--bd); box-shadow: 0 4px 0 var(--sh); transition: transform .1s, box-shadow .1s; }
.mode:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--sh); }
.mode:active { transform: translateY(4px); box-shadow: 0 0 0 var(--sh); }
.mode .mi { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; background: var(--u); color: #fff; border: 2px solid var(--bd); flex: none; }
.mode > div { flex: 1; min-width: 0; }
.mode b { display: block; }
.mode small { color: var(--muted); }
.mbest { text-align: center; padding: 4px 14px; border-radius: 12px; background: var(--card2); border: 2px solid var(--bd); }
.mbest small { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mbest b { font-family: var(--head); font-size: 1.2rem; }

/* ---------- разбор ошибок ---------- */
.empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 20px; }
.empty p { color: var(--muted); max-width: 440px; }
.rv-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rv-top .lead { margin: 0; flex: 1; min-width: 220px; }
.rv-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.rv-list { display: grid; gap: 12px; }
.rv { background: var(--card); border: 2px solid var(--bd); border-radius: 16px; box-shadow: 0 4px 0 var(--sh); overflow: hidden; }
.rv-h { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; }
.rv-tag { flex: none; padding: 3px 10px; border-radius: 99px; background: var(--red-l); color: var(--red); font-weight: 700; font-size: .74rem; border: 1.5px solid var(--red); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-q { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv.open .rv-q { white-space: normal; }
.rv-c { transition: transform .25s; color: var(--muted); }
.rv.open .rv-c { transform: rotate(180deg); }
.rv-b { display: none; padding: 0 16px 16px; }
.rv.open .rv-b { display: block; animation: rise .35s both; }
.rv-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rv-cmp > div { padding: 10px 12px; border-radius: 12px; border: 2px solid; }
.rv-cmp span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.rv-cmp b { font-size: 1.1rem; overflow-wrap: anywhere; }
.rv-cmp .bad { background: var(--red-l); border-color: var(--red); color: var(--red); }
.rv-cmp .bad b { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.rv-cmp .good { background: var(--green-l); border-color: var(--green); color: var(--green); }
.rv-sec { margin-top: 14px; }
.rv-sec h4 { display: flex; align-items: center; gap: 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.rv-sec p { line-height: 1.7; }
.rv-sec.warn { background: none; padding: 0; display: block; margin-top: 14px; color: inherit; }
.rv-sec.warn p { margin-top: 0; }
.rv-do { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- награды ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ach { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 18px 12px; border-radius: 16px; background: var(--card2); border: 2px dashed var(--soft); color: var(--muted); }
.ach .ai { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--card); border: 2px solid var(--soft); margin-bottom: 4px; }
.ach .ai .ic { width: 1.7rem; height: 1.7rem; }
.ach small { line-height: 1.3; }
.ach em { font-size: .72rem; font-style: normal; margin-top: 4px; }
.ach.got { background: var(--card); border: 2px solid var(--bd); color: var(--ink); box-shadow: 0 4px 0 var(--sh); }
.ach.got .ai { background: var(--c); color: #fff; border-color: var(--bd); animation: pop .5s; }
.ach.got small, .ach.got em { color: var(--muted); }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* ---------- профиль ---------- */
.prof { display: flex; gap: 18px; align-items: center; }
.p-av { position: relative; flex: none; border-radius: 30%; }
.p-cam { position: absolute; right: -6px; bottom: -6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); color: #1c2340; border: 2px solid var(--bd); }
.p-cam .ic { width: 1rem; height: 1rem; }
.p-t { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.p-t small .ic { width: 1rem; height: 1rem; margin-right: 6px; }
.pname { font: inherit; font-family: var(--head); font-weight: 700; font-size: 1.3rem; border: 2px solid transparent; background: transparent; color: var(--ink); padding: 2px 8px; margin-left: -8px; border-radius: 10px; width: 100%; }
.pname:hover, .pname:focus { border-color: var(--soft); outline: none; background: var(--card2); }
.p-lv { display: flex; gap: 10px; align-items: baseline; margin-top: 4px; }
.p-lv span { color: var(--muted); font-size: .85rem; }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: #fff1b8; }
[data-theme="dark"] .cta { background: #3d3512; }
.cta p { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.view .stats .card { margin: 0; text-align: center; padding: 14px 8px; }
.st b { display: block; font-family: var(--head); font-size: 1.5rem; }
.st small { color: var(--muted); }
.wk { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 150px; }
.wk-c { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.wk-v { font-size: .72rem; font-weight: 700; color: var(--muted); height: 14px; }
.wk-b { flex: 1; width: 100%; display: flex; align-items: flex-end; background: var(--card2); border: 2px solid var(--bd); border-radius: 10px; overflow: hidden; }
.wk-b i { display: block; width: 100%; background: var(--blue); border-top: 2px solid var(--bd); }
.wk-b i.ok { background: var(--green); }
.wk-c small { color: var(--muted); font-weight: 700; }
.wk-c small.today { color: var(--ink); text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--yellow); }
.mini-ach { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-ach span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--c); color: #fff; border: 2px solid var(--bd); }
.mini-ach span.muted { width: auto; height: auto; background: none; border: 0; color: var(--muted); }
.cp-row { display: grid; grid-template-columns: 44px 1fr 90px 44px; align-items: center; gap: 10px; width: 100%; padding: 8px 0; text-align: left; }
.cp-row + .cp-row { border-top: 1px dashed var(--soft); }
.cp-row .ci { width: 38px; height: 38px; font-size: .8rem; }
.board { display: grid; gap: 8px; }
.brow { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; border: 2px solid transparent; }
.brow.me { background: #fff1b8; border-color: var(--bd); }
[data-theme="dark"] .brow.me { background: #3d3512; }
.bn { width: 24px; text-align: center; font-family: var(--head); font-weight: 700; color: var(--muted); }
.bt { flex: 1; min-width: 0; line-height: 1.25; }
.bt b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt small { color: var(--muted); }
.bx { font-family: var(--head); font-weight: 700; text-align: right; }
.bx small { font-family: var(--font); color: var(--muted); margin-left: 3px; }
.set { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.set + .set { border-top: 1px dashed var(--soft); }
.set > span { font-weight: 700; }
.switch { width: 54px; height: 30px; border-radius: 99px; background: var(--card2); border: 2px solid var(--bd); position: relative; transition: background .2s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: left .2s; }
.switch.on { background: var(--green); }
.switch.on i { left: 26px; background: #fff; }

/* ---------- поля ввода ---------- */
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-weight: 700; font-size: .85rem; }
.fld input { padding: 13px 14px; border-radius: 12px; border: 2px solid var(--bd); background: var(--card); color: var(--ink); font-size: 1rem; width: 100%; }
.fld input:focus { outline: none; box-shadow: 0 0 0 3px var(--yellow); }
.pw { position: relative; }
.pw input { padding-right: 46px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; }
.fldset { display: grid; gap: 14px; }
.auth-err { min-height: 20px; color: var(--red); font-weight: 700; font-size: .9rem; }
.av-pick, .av-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.av-grid { justify-content: center; gap: 10px; }
.avb { border-radius: 30%; padding: 2px; border: 2px solid transparent; transition: transform .12s; }
.avb:hover { transform: scale(1.08); }
.avb.on { border-color: var(--blue); box-shadow: 0 0 0 3px var(--yellow); }
.filebtn { cursor: pointer; }

/* ---------- вход ---------- */
.auth { position: fixed; inset: 0; z-index: 300; display: none; background-color: var(--bg); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 28px 28px; overflow: auto; }
.auth.open { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); animation: fade .3s; }
.auth-l { display: grid; place-items: center; padding: 30px; background: var(--yellow); border-right: 2px solid var(--bd); color: #1c2340; }
.auth-brand { max-width: 420px; }
.auth-brand .mascot { margin-bottom: 8px; animation: float 3.4s ease-in-out infinite; }
.auth-brand h1 { font-size: 2.6rem; margin-bottom: 10px; }
.auth-brand p { font-size: 1.1rem; line-height: 1.6; margin-bottom: 18px; }
.auth-brand ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.auth-brand li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.auth-brand li .ic { width: 1.6rem; height: 1.6rem; padding: 6px; box-sizing: content-box; background: #fff; border: 2px solid #1c2340; border-radius: 10px; }
.auth-r { display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); background: var(--card); border: 2px solid var(--bd); border-radius: 22px; padding: 26px; box-shadow: 0 6px 0 var(--sh); display: grid; gap: 14px; }
.auth-card h2 { font-size: 1.4rem; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: var(--card2); border: 2px solid var(--bd); }
.auth-tabs button { padding: 8px; border-radius: 8px; font-weight: 700; color: var(--muted); }
.auth-tabs button.on { background: var(--ink); color: var(--bg); }
.auth-note { display: flex; gap: 10px; align-items: flex-start; font-size: .8rem; color: var(--muted); line-height: 1.45; }
.auth-note .ic { margin-top: 2px; }

/* ---------- модалки ---------- */
#modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 16px; }
#modal.open { display: flex; }
.mback { position: absolute; inset: 0; background: rgba(15, 20, 40, .6); animation: fade .2s; }
.mcard { position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border: 2px solid var(--bd); border-radius: 22px; padding: 24px; box-shadow: 0 8px 0 var(--sh); animation: pop-in .3s cubic-bezier(.2, .9, .3, 1.15); }
.mcard.wide { width: min(560px, 100%); }
.mcard.obcard { width: min(520px, 100%); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop-in { from { transform: translateY(24px) scale(.95); opacity: 0; } }
.m-t { font-size: 1.3rem; margin-bottom: 8px; text-align: center; }
.mcard > .muted { text-align: center; }
.m-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.m-ic { width: 62px; height: 62px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: var(--u); border: 2px solid var(--bd); box-shadow: 0 3px 0 var(--sh); font-size: 1.2rem; }
.m-ic .ic { width: 1.8rem; height: 1.8rem; }
.m-head small { color: var(--muted); font-weight: 700; }
.m-head h2 { font-size: 1.3rem; }
.m-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.m-meta span { display: inline-flex; gap: 6px; align-items: center; padding: 5px 12px; border-radius: 99px; background: var(--card2); border: 2px solid var(--bd); font-weight: 700; font-size: .85rem; }
.m-stars { display: flex; justify-content: center; gap: 4px; margin-top: 14px; color: var(--muted); align-items: center; }
.m-stars .on { color: var(--yellow-d); }
.m-stars .on .ic { fill: var(--yellow); }
.m-stars .ic { width: 1.6rem; height: 1.6rem; }
.th-h { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.th-i { width: 54px; height: 54px; border-radius: 14px; background: var(--yellow); display: grid; place-items: center; border: 2px solid var(--bd); color: #1c2340; }
.th-i .ic { width: 1.6rem; height: 1.6rem; }
.th-h small { color: var(--muted); font-weight: 700; }
.th-h h2 { font-size: 1.2rem; }
.th-b p { padding: 10px 14px; background: var(--card2); border-left: 6px solid var(--blue); border-radius: 10px; margin-top: 10px; line-height: 1.65; }
.th-b .rule { margin-top: 10px; }
.picker h3 { margin: 16px 0 8px; font-family: var(--font); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.pc { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 14px; border: 2px solid var(--soft); text-align: left; margin-bottom: 8px; transition: border-color .15s, background .15s; }
.pc:hover { border-color: var(--bd); }
.pc.on { border-color: var(--bd); background: var(--card2); box-shadow: 0 3px 0 var(--sh); }
.pc > div { flex: 1; min-width: 0; }
.pc small { display: block; color: var(--muted); margin-bottom: 6px; }
.pc .pbar { height: 8px; border-width: 1.5px; }
.pc em { font-style: normal; font-weight: 700; color: var(--muted); }
.ob { text-align: center; }
.ob-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.ob-dots i { width: 34px; height: 8px; border-radius: 99px; background: var(--track); }
.ob-dots i.on { background: var(--blue); }
.ob-m { display: flex; justify-content: center; margin: 6px 0; animation: float 3.4s ease-in-out infinite; }
.ob h2 { font-size: 1.4rem; margin-bottom: 8px; }
.ob p { color: var(--muted); }
.ob-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; text-align: left; }
.ob-o { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 14px; border: 2px solid var(--soft); transition: border-color .15s, background .15s; }
.ob-o > span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--card2); border: 2px solid var(--bd); flex: none; }
.ob-o > span .ic { width: 1.5rem; height: 1.5rem; }
.ob-n { font-family: var(--head); font-weight: 700; }
.ob-o b { display: block; }
.ob-o small { color: var(--muted); }
.ob-o:hover { border-color: var(--bd); }
.ob-o.on { border-color: var(--bd); background: var(--card2); box-shadow: 0 3px 0 var(--sh); }
.ob-o.on > span { background: var(--yellow); color: #1c2340; }
.gr-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.gr { padding: 14px 6px; border-radius: 14px; border: 2px solid var(--soft); font-family: var(--head); font-size: 1.5rem; font-weight: 700; display: flex; flex-direction: column; align-items: center; }
.gr small { font-family: var(--font); font-size: .72rem; color: var(--muted); font-weight: 600; }
.gr.on { border-color: var(--bd); background: var(--yellow); color: #1c2340; box-shadow: 0 3px 0 var(--sh); }
.gr.on small { color: #1c2340; }

/* ---------- уведомления ---------- */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; align-self: stretch; text-align: left; line-height: 1.3; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; border: 2px solid var(--bd); box-shadow: 0 5px 0 var(--sh); opacity: 0; transform: translateY(-16px) scale(.96); transition: opacity .3s, transform .3s; }
.toast.in { opacity: 1; transform: none; }
.toast.ach { background: var(--yellow); color: #1c2340; }
.toast.ok { background: var(--green); color: #fff; }
.toast.warn { background: var(--red); color: #fff; }
.t-i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--c, #1c2340); color: #fff; border: 2px solid #1c2340; flex: none; }
.t-i .ic { width: 1.4rem; height: 1.4rem; }

/* ---------- урок (полноэкранный) ---------- */
.ov { position: fixed; inset: 0; z-index: 100; display: none; background-color: var(--bg); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 28px 28px; }
.ov.open { display: block; }
.lesson, .blitzov { position: absolute; inset: 0; display: flex; flex-direction: column; }
.lhead { display: flex; align-items: center; gap: 12px; padding: 14px 20px; max-width: 1100px; width: 100%; margin: 0 auto; position: relative; z-index: 2; }
.lx { width: 40px; height: 40px; border-radius: 12px; color: var(--muted); display: grid; place-items: center; flex: none; }
.lx:hover { background: var(--card2); color: var(--ink); }
.lbar { flex: 1; height: 20px; background: var(--track); border-radius: 99px; overflow: hidden; border: 2px solid var(--bd); }
.lbar i { display: block; height: 100%; background: var(--u, var(--blue)); transition: width .5s cubic-bezier(.3, 1.3, .5, 1); min-width: 0; }
.hearts { display: flex; align-items: center; gap: 6px; font-family: var(--head); font-weight: 700; color: var(--red); }
.hearts .ic { fill: var(--red); }
.lbtn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--bd); background: var(--card); font-weight: 700; font-size: .85rem; box-shadow: 0 3px 0 var(--sh); flex: none; }
.lbtn:active { transform: translateY(3px); box-shadow: none; }
.lbtn.on { background: var(--yellow); color: #1c2340; }
.lbody { flex: 1; display: flex; min-height: 0; max-width: 1400px; width: 100%; margin: 0 auto; }
.lmain { flex: 1; min-width: 0; overflow: auto; padding: 8px 20px 30px; display: flex; justify-content: center; }
.padwrap { display: none; flex-direction: column; padding: 0 20px 16px 0; min-width: 0; }
.lesson.padopen .padwrap { display: flex; width: 46%; animation: slidein .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }
.qwrap { width: 100%; max-width: 640px; margin: auto 0; display: flex; flex-direction: column; gap: 16px; padding: 10px 0; }
.qh { font-family: var(--head); font-size: 1.25rem; font-weight: 700; }
.qbox { font-size: 1.85rem; font-weight: 600; padding: 20px 22px; border-radius: 16px; background: var(--card); border: 2px solid var(--bd); box-shadow: 0 4px 0 var(--sh); line-height: 1.7; overflow-wrap: anywhere; }
.qbox.sm { font-size: 1.05rem; padding: 12px 16px; }
.qbox.big { font-size: 2.6rem; text-align: center; padding: 30px 20px; }
.qnote { color: var(--muted); font-weight: 600; margin-top: -6px; }
.ans { display: flex; }
.ansin { width: 100%; font: inherit; font-size: 1.6rem; font-weight: 700; padding: 15px 20px; border-radius: 14px; border: 2px solid var(--bd); background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--sh); text-align: center; caret-color: var(--blue); }
.ansin:focus { outline: none; box-shadow: 0 4px 0 var(--blue), 0 0 0 3px var(--yellow); }
.ansin.right { background: var(--green-l); border-color: var(--green); box-shadow: 0 4px 0 var(--green); }
.ansin.wrong { background: var(--red-l); border-color: var(--red); box-shadow: 0 4px 0 var(--red); }
.ansin.big { font-size: 2.2rem; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opts.row { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.opt { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--card); border: 2px solid var(--bd); box-shadow: 0 4px 0 var(--sh); text-align: left; font-size: 1.35rem; font-weight: 600; transition: transform .08s, background .15s; min-height: 66px; }
.opts.row .opt { justify-content: center; }
.opts.row .k { display: none; }
.opt:hover:not(:disabled) { background: var(--card2); }
.opt:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--sh); }
.opt .k { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--soft); display: grid; place-items: center; font-size: .82rem; font-weight: 700; color: var(--muted); }
.opt.sel { background: #dfe7ff; border-color: var(--blue); box-shadow: 0 4px 0 var(--blue); }
[data-theme="dark"] .opt.sel { background: #1e2c5a; }
.opt.sel .k { background: var(--blue); color: #fff; border-color: var(--blue); }
.opt.right { background: var(--green-l); border-color: var(--green); box-shadow: 0 4px 0 var(--green); }
.opt.wrong { background: var(--red-l); border-color: var(--red); box-shadow: 0 4px 0 var(--red); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mcol { display: flex; flex-direction: column; gap: 10px; }
.mt { padding: 15px 12px; border-radius: 14px; border: 2px solid var(--bd); background: var(--card); box-shadow: 0 4px 0 var(--sh); font-size: 1.3rem; font-weight: 600; transition: transform .08s, opacity .25s; }
.mt:hover:not(.done) { background: var(--card2); }
.mt.sel { background: #dfe7ff; border-color: var(--blue); box-shadow: 0 4px 0 var(--blue); }
[data-theme="dark"] .mt.sel { background: #1e2c5a; }
.mt.bad { background: var(--red-l); border-color: var(--red); box-shadow: 0 4px 0 var(--red); }
.mt.done { background: var(--green-l); border-color: var(--green); box-shadow: 0 4px 0 var(--green); opacity: .55; pointer-events: none; }
.oline { min-height: 78px; display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; border-radius: 16px; border: 2px dashed var(--bd); align-items: center; }
.ohint { color: var(--muted); font-weight: 600; padding: 0 6px; }
.obank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.tile { padding: 13px 20px; border-radius: 14px; border: 2px solid var(--bd); background: var(--card); box-shadow: 0 4px 0 var(--sh); font-size: 1.4rem; font-weight: 600; transition: transform .08s; }
.tile:hover { background: var(--card2); }
.tile:active { transform: translateY(4px); box-shadow: none; }
.kp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 380px; width: 100%; margin: 4px auto 0; }
.kp .k { padding: 13px 0; border-radius: 12px; background: var(--card); border: 2px solid var(--bd); box-shadow: 0 3px 0 var(--sh); font-size: 1.35rem; font-weight: 700; display: grid; place-items: center; }
.kp .k:active { transform: translateY(3px); box-shadow: none; }
.kp .k.go { background: var(--blue); color: #fff; }
.kp .k .ic { width: 1.4rem; height: 1.4rem; }

.lfoot { border-top: 2px solid var(--bd); background: var(--card); padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); position: relative; z-index: 2; }
.lfoot.ok { background: var(--green-l); }
.lfoot.bad { background: var(--red-l); }
.fb-row { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fb-row.center { justify-content: center; margin-top: 20px; }
.fb-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--bd); flex: none; }
.fb-icon .ic { width: 1.8rem; height: 1.8rem; stroke-width: 3; }
.lfoot.ok .fb-icon { color: var(--green); }
.lfoot.bad .fb-icon { color: var(--red); }
.fb-body { flex: 1; min-width: 0; }
.fb-body > b { font-family: var(--head); font-size: 1.15rem; display: block; }
.lfoot.ok .fb-body > b, .lfoot.ok .fb-ex { color: var(--green); }
.lfoot.bad .fb-body > b, .lfoot.bad .fb-ans { color: var(--red); }
.fb-ans { font-weight: 700; margin-top: 2px; }
.fb-ex { font-weight: 500; font-size: .95rem; margin-top: 4px; line-height: 1.5; }
.lfoot.bad .fb-ex { color: var(--ink); }
.fb-more { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.intro { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 640px; margin: auto 0; }
.speech { background: var(--card); border: 2px solid var(--bd); border-radius: 18px; padding: 18px 22px; box-shadow: 0 4px 0 var(--sh); position: relative; width: 100%; }
.speech::before { content: ''; position: absolute; top: -9px; left: 50%; width: 16px; height: 16px; background: var(--card); border-left: 2px solid var(--bd); border-top: 2px solid var(--bd); transform: translateX(-50%) rotate(45deg); }
.speech b { font-family: var(--head); font-size: 1.15rem; display: block; }
.speech small { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; display: block; }
.speech p { margin-top: 10px; font-size: 1.08rem; line-height: 1.65; }
.res { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; width: 100%; max-width: 560px; margin: auto 0; }
.res h1 { font-size: 1.9rem; }
.res p { color: var(--muted); }
.res .mascot { animation: float 2.6s ease-in-out infinite; }
.stars.big { display: flex; gap: 8px; color: var(--track); }
.stars.big span { display: inline-flex; }
.stars.big .ic { width: 3.4rem; height: 3.4rem; stroke: var(--bd); stroke-width: 1.6; }
.stars.big span.on { color: var(--yellow); animation: starIn .6s both cubic-bezier(.2, 1.6, .4, 1); }
.stars.big span.on .ic { fill: var(--yellow); }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.rs { border-radius: 14px; padding: 10px 6px 12px; border: 2px solid var(--bd); background: var(--card); box-shadow: 0 4px 0 var(--sh); }
.rs small { display: block; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; font-size: .66rem; margin-bottom: 4px; color: var(--muted); }
.rs b { font-family: var(--head); font-size: 1.2rem; }
.rs.xp { background: var(--yellow); color: #1c2340; }
.rs.xp small { color: #1c2340; }
.res-streak { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; padding: 8px 18px; border-radius: 99px; background: #ffd9c2; color: #b23514; border: 2px solid var(--bd); }
.res-streak .ic { fill: #ff8a3c; }
[data-theme="dark"] .res-streak { background: #4a2b1a; color: #ffb28a; }
.res-note { font-weight: 600; }
.bigscore { font-family: var(--head); font-size: 6rem; font-weight: 800; line-height: 1; color: var(--blue); }
.res.fail h1 { color: var(--red); }

/* блиц */
.timebar i { background: var(--blue); transition: width .1s linear; }
.timebar i.low { background: var(--red); }
.tnum { font-family: var(--head); font-weight: 700; font-size: 1.4rem; min-width: 54px; text-align: right; font-variant-numeric: tabular-nums; }
.bmain { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 10px 20px 30px; max-width: 640px; width: 100%; margin: 0 auto; overflow: auto; justify-content: center; }
.cd { font-family: var(--head); font-size: 8rem; font-weight: 800; color: var(--blue); animation: pop .6s infinite; }
.bscore { display: flex; justify-content: space-between; align-items: center; width: 100%; font-weight: 700; font-size: 1.1rem; color: var(--muted); }
.bscore b { font-family: var(--head); font-size: 2rem; color: var(--blue); }
.bcombo { color: #c2410c; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.bmain .qbox, .bmain .ans { width: 100%; }
.bfx { min-height: 30px; font-weight: 700; font-size: 1.15rem; opacity: 0; transition: opacity .15s; text-align: center; }
.bfx.show { opacity: 1; }
.bfx.ok { color: var(--green); }
.bfx.ok .ic { width: 1.8rem; height: 1.8rem; stroke-width: 3; }
.bfx.bad { color: var(--red); }

/* ---------- черновик ---------- */
.padhost { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--card); border: 2px solid var(--bd); border-radius: 16px; box-shadow: 0 4px 0 var(--sh); overflow: hidden; }
.padhost.big { height: min(68vh, 640px); min-height: 360px; }
.padwrap .padhost { height: 100%; }
.pad-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 2px solid var(--bd); background: var(--card2); flex-wrap: wrap; }
.pad-sw { display: flex; gap: 6px; }
.pad-c { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid var(--bd); transition: transform .1s; }
.pad-c.on { transform: scale(1.18); box-shadow: 0 0 0 3px var(--yellow); }
.pad-sep { width: 2px; height: 22px; background: var(--soft); margin: 0 6px; }
.pad-sp { flex: 1; }
.pad-b { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--ink); }
.pad-b:hover { background: var(--card); }
.pad-b.on { background: var(--ink); color: var(--bg); }
.pad-dot { width: var(--d, 4px); height: var(--d, 4px); border-radius: 50%; background: currentColor; display: block; }
.pad-board { position: relative; flex: 1; min-height: 0; background-color: var(--card); }
.pad-board.grid { background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; }
.pad-board canvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.pad-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--muted); font-weight: 600; text-align: center; padding: 0 20px; pointer-events: none; opacity: .8; }
.pad-board.used .pad-hint { display: none; }
.nbwrap { margin-top: 6px; }

/* анимации */
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
#confetti { position: fixed; inset: 0; z-index: 500; pointer-events: none; }

/* ---------- адаптив ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 96px minmax(0, 720px); gap: 22px; }
  .rpanel { display: none; }
  .nav { justify-content: center; padding: 11px 6px; }
  .nav b, .side-me div, .logo span { display: none; }
  .nav .badge { position: absolute; top: 2px; right: 6px; margin: 0; min-width: 18px; height: 18px; font-size: .68rem; }
  .side-me { justify-content: center; padding: 8px; }
  .logo { justify-content: center; padding: 0; }
  .topbar { display: flex; }
}
@media (max-width: 900px) {
  .lesson.padopen .lbody { flex-direction: column; }
  .lesson.padopen .lmain { flex: 1 1 50%; }
  .lesson.padopen .padwrap { width: 100%; height: 38%; padding: 0 12px 8px; flex: none; }
  .lesson.padopen .qh { display: none; }
  .lesson.padopen .qbox { font-size: 1.25rem; padding: 10px 14px; }
  .lesson.padopen .qwrap { gap: 10px; margin: 0; }
  .lesson.padopen .ansin { font-size: 1.3rem; padding: 10px 14px; }
  .lesson.padopen .kp { gap: 6px; }
  .lesson.padopen .kp .k { padding: 7px 0; font-size: 1.1rem; }
  .lesson.padopen .opt { min-height: 50px; padding: 8px 12px; font-size: 1.1rem; }
  .pad-bar { gap: 2px; padding: 4px 6px; flex-wrap: nowrap; }
  .pad-c { width: 22px; height: 22px; }
  .pad-sw { gap: 6px; }
  .pad-sep { margin: 0 4px; }
  .pad-b { width: 32px; height: 32px; }
  .auth.open { grid-template-columns: 1fr; }
  .auth-l { display: none; }
}
@media (max-width: 820px) {
  .shell { display: block; padding: 0 14px; }
  .side { display: none; }
  .mid { padding: 0 0 96px; }
  .topbar { position: sticky; top: 0; z-index: 30; padding: 10px 0; align-items: center; justify-content: space-between; background: var(--bg); }
  .chips { display: flex; gap: 8px; align-items: center; }
  .chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 4px 10px; border-radius: 99px; border: 2px solid var(--bd); background: var(--card); }
  .chip.fire.on .ic { fill: #ff8a3c; color: #d8391b; }
  .chip.av-chip { padding: 0; border: 0; background: none; }
  .coursebar { top: 58px; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--card); border-top: 2px solid var(--bd); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; border-radius: 12px; color: var(--muted); font-weight: 700; }
  .bottomnav button .ic { width: 1.5rem; height: 1.5rem; }
  .bottomnav button small { font-size: .68rem; }
  .bottomnav button.on { background: var(--yellow); color: #1c2340; }
  .bottomnav .badge { position: absolute; top: 0; right: 14px; min-width: 18px; height: 18px; font-size: .66rem; }
  .vt { font-size: 1.4rem; }
  .hero { padding: 20px; }
  .hero-t h2 { font-size: 1.15rem; }
  .hero-m .mascot { width: 84px; height: 84px; }
  .row3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ubanner { padding: 14px; gap: 12px; }
  .ub-gly { width: 48px; height: 48px; }
  .ub-t h2 { font-size: 1rem; }
  .qbox { font-size: 1.45rem; padding: 16px; }
  .qbox.big { font-size: 2rem; }
  .opts { grid-template-columns: 1fr; }
  .opts.row { grid-template-columns: repeat(3, 1fr); }
  .lfoot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .fb-icon { display: none; }
  .btn.big { min-width: 0; padding: 14px 22px; }
  .fb-row { gap: 10px; }
  .lmain { padding: 4px 14px 20px; }
  .lhead { padding: 10px 12px; gap: 8px; }
  .lbtn span { display: none; }
  .lbtn { padding: 8px 10px; }
  .cd { font-size: 6rem; }
  .rv-cmp { grid-template-columns: 1fr; }
  .thead { padding: 14px; gap: 12px; }
  .th-g { width: 52px; height: 52px; }
  .thead h1 { font-size: 1.1rem; }
  .prof { gap: 14px; }
  .setc > span { min-width: 100%; }
}
@media (max-width: 420px) {
  .fb-row { flex-wrap: wrap; }
  .fb-row .btn { flex: 1; }
  .fb-body { flex-basis: 100%; }
  .cp-row { grid-template-columns: 38px 1fr 60px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- сервер: вход, письма ---------- */
.auth-ok { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--green-l); border: 2px solid var(--green); color: var(--green); font-weight: 600; font-size: .92rem; }
.auth-ok .ic { margin-top: 2px; stroke-width: 3; }
.auth-card.center { text-align: center; justify-items: center; }
.auth-card.center .mascot { margin: 0 auto; }
.auth-card.center p { max-width: 36ch; }
.auth-card .small { font-size: .82rem; }
.hint { color: var(--muted); font-weight: 500; }
.forgot { align-self: flex-start; font-size: .85rem; padding: 2px 0; }
.linkb.small { font-size: .85rem; }
#authresend { margin-top: -6px; }
#authresend .linkb { font-size: .88rem; text-decoration: underline; }
.ok-t { color: var(--green); font-weight: 700; }
.bad-t { color: var(--red); font-weight: 700; }
.p-t small { display: block; }
.auth-home { position: absolute; top: 18px; left: 22px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; padding: 8px 14px 8px 10px; border-radius: 12px; border: 2px solid #1c2340; background: #fff; color: #1c2340; box-shadow: 0 3px 0 #1c2340; }
.auth-l { position: relative; }

/* ---------- рейтинг ---------- */
.rk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rk-head .vt { margin-bottom: 6px; }
.rk-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; margin: 0 -2px 6px; scrollbar-width: none; }
.rk-tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 99px; border: 2px solid var(--bd); background: var(--card); font-weight: 700; white-space: nowrap; box-shadow: 0 3px 0 var(--sh); flex: none; transition: transform .1s; }
.rk-tabs button .ic { width: 1.05rem; height: 1.05rem; }
.rk-tabs button.on { background: var(--ink); color: var(--bg); }
.rk-me { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--bd); background: #fff1b8; box-shadow: 0 4px 0 var(--sh); margin-bottom: 18px; }
[data-theme="dark"] .rk-me { background: #3d3512; }
.rk-me > div { flex: 1; min-width: 0; }
.rk-me b { display: block; }
.rk-me small { color: var(--muted); }
.rk-me.warn { background: var(--red-l); }
.rk-me.cta { background: var(--card); }
.rk-me.note { background: var(--card2); box-shadow: none; }
.rk-mrank { font-family: var(--head); font-weight: 800; font-size: 1.4rem; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; margin: 10px 0 18px; }
.pod { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.pod.empty { visibility: hidden; }
.pod-av { position: relative; margin-bottom: 8px; }
.pod-av .avatar { border-width: 3px; }
.crown { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); color: #b98000; animation: bob 1.6s ease-in-out infinite; }
.crown .ic { width: 1.7rem; height: 1.7rem; fill: var(--yellow); stroke-width: 2.2; }
.pod-n { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod small { color: var(--muted); line-height: 1.25; }
.pod-s { font-family: var(--head); font-weight: 700; font-size: .95rem; margin: 4px 0 8px; }
.pod-b { width: 100%; border: 2px solid var(--bd); border-bottom: 0; border-radius: 14px 14px 0 0; display: grid; place-items: center; font-family: var(--head); font-weight: 800; font-size: 1.8rem; box-shadow: 0 4px 0 var(--sh); color: #1c2340; }
.p1 .pod-b { height: 118px; background: var(--yellow); } .p2 .pod-b { height: 86px; background: #bcd0ff; } .p3 .pod-b { height: 64px; background: #ffc9a0; }
.pod.me .pod-n { text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--yellow); }
.rk-list { display: grid; gap: 8px; }
.rk-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--bd); background: var(--card); box-shadow: 0 3px 0 var(--sh); }
.rk-row.me { background: #fff1b8; }
[data-theme="dark"] .rk-row.me { background: #3d3512; }
.rk-n { width: 28px; text-align: center; font-family: var(--head); font-weight: 700; color: var(--muted); }
.rk-t { flex: 1; min-width: 0; }
.rk-t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-t b em { font-style: normal; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; background: var(--ink); color: var(--bg); padding: 1px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; }
.rk-tags { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.rk-tags .ic { width: .95rem; height: .95rem; margin-right: 3px; fill: #ff8a3c; color: #d8391b; }
.rk-lv { color: var(--ink); background: var(--yellow); padding: 0 8px; border-radius: 99px; border: 1.5px solid var(--bd); }
.rk-score { font-family: var(--head); font-weight: 700; white-space: nowrap; }
.rk-vis { margin-top: 16px; padding: 12px 14px; border: 2px dashed var(--soft); border-radius: 14px; }
.rk-vis span small { display: block; font-weight: 500; }
.rk-foot { text-align: center; margin-top: 12px; font-size: .85rem; }
.rk-skel { height: 64px; border-radius: 14px; margin-bottom: 8px; background: linear-gradient(90deg, var(--card2) 25%, var(--card) 50%, var(--card2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border: 2px solid var(--soft); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 820px) {
  .bottomnav { grid-template-columns: repeat(6, 1fr) !important; padding-left: 2px; padding-right: 2px; }
  .bottomnav button small { font-size: .6rem; }
  .bottomnav button .ic { width: 1.35rem; height: 1.35rem; }
  .bottomnav .badge { right: 4px; }
  .rk-tags span:nth-child(4) { display: none; }
  .podium { gap: 6px; }
  .pod small { font-size: .7rem; }
  .pod-s { font-size: .8rem; }
}
