/* «Зелёная волна» — визуальный язык российских дорожных знаков:
   синий информационных знаков, жёлтый «главной дороги», красный запрещающих, серый бетон и асфальт. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #18212d;
  --muted: #5b6676;
  --line: #d5dbe3;
  --blue: #1e5aa8;
  --blue-ink: #ffffff;
  --blue-soft: #e3ecf8;
  --yellow: #f5c518;
  --yellow-soft: #fdf3c8;
  --red: #c62828;
  --red-soft: #fbe5e5;
  --green: #1d8a4e;
  --green-soft: #e0f3e8;
  --asphalt: #3a4049;
  --ground: #cfd8c6;
  --radius-s: 8px;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(24, 33, 45, .06), 0 6px 18px -10px rgba(24, 33, 45, .25);
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sign: "PT Sans Narrow", "Arial Narrow", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c2026; --surface: #252a32; --surface-2: #2c323b; --ink: #e8ecf1; --muted: #9aa5b4; --line: #39414c;
    --blue: #4a8be0; --blue-soft: #233650; --yellow-soft: #3d3516; --red: #f05252; --red-soft: #4a2526;
    --green: #34c77b; --green-soft: #1f3d2c; --ground: #2a3328; --asphalt: #454c56; --bar: #1d3a63; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c2026; --surface: #252a32; --surface-2: #2c323b; --ink: #e8ecf1; --muted: #9aa5b4; --line: #39414c;
  --blue: #4a8be0; --blue-soft: #233650; --yellow-soft: #3d3516; --red: #f05252; --red-soft: #4a2526;
  --green: #34c77b; --green-soft: #1f3d2c; --ground: #2a3328; --asphalt: #454c56; --bar: #1d3a63; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
img { max-width: 100%; display: block; }
a { color: var(--blue); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-sign); font-weight: 700; line-height: 1.1; margin: 0 0 .5em; letter-spacing: .005em; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

/* ---------- Шапка ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bar, #1e5aa8); color: var(--blue-ink); }
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 58px; }
.logo { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-family: var(--font-sign); font-weight: 700; font-size: 1.4rem; white-space: nowrap; }
.logo-mark { width: 22px; height: 22px; transform: rotate(45deg); background: #fff; display: grid; place-items: center; border-radius: 2px; flex: none; }
.logo-mark::after { content: ""; width: 13px; height: 13px; background: var(--yellow); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: rgba(255,255,255,.85); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.14); }
.top-right { display: flex; align-items: center; gap: 10px; }
.chip-xp { white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; background: rgba(255,255,255,.16); padding: 5px 10px; border-radius: 999px; font-weight: 600; font-size: .9rem; color: #fff; text-decoration: none; }
.icon-btn { background: transparent; border: 0; color: inherit; width: 38px; height: 38px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.14); }
.tabbar { display: none; }

@media (max-width: 820px) {
  .nav { display: none; }
  .topbar .wrap { justify-content: space-between; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: .72rem; color: var(--muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--blue); font-weight: 600; }
  .tabbar svg { width: 22px; height: 22px; }
  main { padding-bottom: 76px; }
}

main { padding: 28px 0 56px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }

/* ---------- Кнопки, формы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--blue); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--blue) 86%, #000); }
.btn-yellow { background: var(--yellow); border-color: var(--yellow); color: #1b1b1b; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1.05rem; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.errorlist { color: var(--red); margin: 6px 0 0; padding: 0; list-style: none; font-size: .9rem; }
.helptext { color: var(--muted); font-size: .85rem; }
.radio-row ul, .radio-row > div { display: flex; gap: 10px; padding: 0; margin: 0; list-style: none; flex-wrap: wrap; }
.radio-row label { font-weight: 500; display: flex; gap: 6px; align-items: center; border: 1.5px solid var(--line); padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li { padding: 12px 16px; border-radius: 10px; background: var(--green-soft); border-left: 4px solid var(--green); }
.messages li.error { background: var(--red-soft); border-color: var(--red); }

/* ---------- Поверхности ---------- */
.panel { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.grid > .panel { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Плитки режимов — как таблички-указатели: цветная полоса слева */
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.mode { display: grid; grid-template-columns: 44px 1fr; gap: 4px 12px; align-items: center; padding: 14px 16px; background: var(--surface); border-radius: 12px; text-decoration: none; color: var(--ink); border: 1.5px solid var(--line); transition: border-color .15s; }
.mode:hover { border-color: var(--blue); }
.mode .sym { grid-row: span 2; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--blue); color: #fff; font: 700 1.2rem var(--font-sign); }
.mode .sym.y { background: var(--yellow); color: #1b1b1b; }
.mode .sym.r { background: var(--red); }
.mode .sym.g { background: var(--green); }
.mode strong { font-size: 1rem; }
.mode span.muted { font-size: .85rem; line-height: 1.3; }

/* Готовность — дорожная полоса с разметкой */
.ready { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.ready-num { font: 700 4.4rem/1 var(--font-sign); color: var(--blue); }
.ready-num small { font-size: 1.6rem; }
.road-meter { position: relative; height: 26px; background: var(--asphalt); border-radius: 6px; overflow: hidden; margin: 10px 0; }
.road-meter::before { content: ""; position: absolute; inset: 12px 8px auto; height: 2px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.7) 0 18px, transparent 18px 32px); }
.road-meter i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--green), color-mix(in srgb, var(--green) 70%, var(--yellow))); opacity: .9; border-radius: 6px; }
.road-meter b { position: absolute; top: 3px; width: 34px; height: 20px; margin-left: -34px; border-radius: 5px; background: var(--yellow); box-shadow: inset -6px 0 0 rgba(0,0,0,.18); }
.kv { display: flex; gap: 22px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.kv b { color: var(--ink); font-size: 1.05rem; display: block; }
@media (max-width: 520px) { .ready { grid-template-columns: 1fr; gap: 6px; } .ready-num { font-size: 3.4rem; } }

/* Список строк */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.warn { background: var(--yellow-soft); color: color-mix(in srgb, var(--yellow) 40%, var(--ink)); }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--blue); }

/* ---------- Сетка билетов: как экзаменационный терминал ---------- */
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.ticket { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); position: relative; }
.ticket b { font: 700 1.8rem/1 var(--font-sign); }
.ticket span { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.ticket:hover { border-color: var(--blue); }
.ticket.ok { background: var(--green-soft); border-color: var(--green); }
.ticket.ok span { color: var(--green); }
.ticket.mid { background: var(--yellow-soft); border-color: var(--yellow); }
.ticket.bad { background: var(--red-soft); border-color: var(--red); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 14px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Тренажёр ---------- */
.quiz { max-width: 820px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.quiz-top h1 { font-size: 1.6rem; margin: 0; flex: 1; }
.timer { font: 700 1.4rem var(--font-sign); padding: 4px 12px; border-radius: 8px; background: var(--surface); font-variant-numeric: tabular-nums; }
.timer.low { background: var(--red); color: #fff; }
.strip { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.strip button { flex: 1 0 30px; min-width: 30px; height: 30px; border-radius: 6px; border: 0; background: var(--surface); color: var(--muted); font: 600 .8rem var(--font); cursor: pointer; }
.strip button.cur { background: var(--blue); color: #fff; }
.strip button.ok { background: var(--green); color: #fff; }
.strip button.bad { background: var(--red); color: #fff; }
.strip button.done { background: var(--asphalt); color: #fff; }
.strip button.block-start { margin-left: 8px; }
.strip.compact button { flex: 0 0 30px; }
.q-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.q-img { background: #11161c; aspect-ratio: 2 / 1; display: grid; place-items: center; }
.q-img img { width: 100%; height: 100%; object-fit: contain; }
.q-noimg { display: none; place-items: center; background: var(--surface-2); color: var(--muted); font-family: var(--font-sign); font-size: 1.1rem; }
.q-body { padding: 20px 22px 22px; }
.q-meta { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.q-text { font-size: 1.18rem; font-weight: 600; line-height: 1.4; margin-bottom: 16px; }
.answers { display: grid; gap: 8px; }
.answer { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; text-align: left; width: 100%; padding: 13px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .12s, background .12s; }
.answer:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-soft); }
.answer .n { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: .9rem; }
.answer:disabled { cursor: default; }
.answer.right { border-color: var(--green); background: var(--green-soft); }
.answer.right .n { background: var(--green); color: #fff; }
.answer.wrong { border-color: var(--red); background: var(--red-soft); }
.answer.wrong .n { background: var(--red); color: #fff; }
.answer.chosen { border-color: var(--blue); background: var(--blue-soft); }
.tip { margin-top: 16px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--blue); font-size: .95rem; }
.tip.bad { border-left-color: var(--red); }
.tip.ok { border-left-color: var(--green); }
.tip-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ai-box { margin-top: 12px; padding: 14px 16px; border-radius: 10px; background: var(--blue-soft); white-space: pre-line; }
.q-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.kbd-hint { text-align: center; font-size: .8rem; color: var(--muted); margin-top: 10px; }
@media (max-width: 820px) { .kbd-hint { display: none; } .q-body { padding: 16px; } .q-text { font-size: 1.05rem; } }
.toast-extra { padding: 12px 16px; border-radius: 10px; background: var(--yellow-soft); border-left: 4px solid var(--yellow); margin-bottom: 14px; }

/* Итог */
.result { text-align: center; padding: 36px 22px; }
.result .sign-big { width: 96px; height: 96px; margin: 0 auto 16px; }
.result h2 { font-size: 2.2rem; }
.result .score { font: 700 3.2rem/1 var(--font-sign); margin: 6px 0 12px; }
.ach-pop { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.ach-pop span { padding: 8px 14px; border-radius: 999px; background: var(--yellow-soft); font-weight: 600; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.review { text-align: left; margin-top: 26px; }
.review li { align-items: flex-start; }

/* ---------- Анимированные сцены ---------- */
.scene { display: grid; gap: 14px; }
.scene-stage { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--ground); aspect-ratio: 1; max-height: 70vh; margin: 0 auto; width: 100%; }
.scene-svg { width: 100%; height: 100%; display: block; }
.sc-ground { fill: var(--ground); }
.sc-asphalt { fill: var(--asphalt); }
.sc-main-edge { fill: none; stroke: #f5c518; stroke-width: 106; stroke-linejoin: round; }
.sc-main { fill: none; stroke: color-mix(in srgb, var(--asphalt) 88%, #fff); stroke-width: 98; stroke-linejoin: round; }
.sc-center { stroke: #fff; stroke-width: 2; stroke-dasharray: 16 12; opacity: .85; }
.sc-edge { stroke: rgba(255,255,255,.55); stroke-width: 2; }
.sc-stopline { stroke: #fff; stroke-width: 5; }
.sc-island { fill: var(--ground); stroke: #fff; stroke-width: 3; }
.sc-island-inner { fill: color-mix(in srgb, var(--ground) 80%, #2f6b2f); }
.sc-ring-guide { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 2; stroke-dasharray: 10 12; }
.sc-tram line { stroke: #9aa3ad; stroke-width: 2; }
.sc-pole { stroke: #7b8490; stroke-width: 3; }
.sc-trace { fill: none; stroke: rgba(255,255,255,.18); stroke-width: 3; stroke-dasharray: 4 8; }
.sc-trace-you { stroke: rgba(245,197,24,.55); }
.sc-veh { cursor: default; transition: opacity .3s; }
.sc-veh.sc-gone { opacity: 0; }
.sc-you-ring { fill: none; stroke: var(--yellow); stroke-width: 3; stroke-dasharray: 6 4; }
.sc-tag-bg { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.sc-tag-text { font: 700 14px var(--font); fill: var(--ink); }
.sc-badge circle { fill: var(--yellow); stroke: #1b1b1b; stroke-width: 1.5; }
.sc-badge text { font: 700 14px var(--font); fill: #1b1b1b; }
.sc-badge { transition: opacity .25s; }
.sc-blink circle { fill: #ff9f1a; opacity: 0; }
.sc-blink.on circle { animation: blink .7s steps(1) infinite; }
@keyframes blink { 50% { opacity: 1; } }
.sc-beacon-a { fill: #2f7bff; animation: beacon .5s steps(1) infinite; }
.sc-beacon-b { fill: #ff3b3b; animation: beacon .5s steps(1) infinite reverse; }
@keyframes beacon { 50% { opacity: .15; } }
.sc-lamp-on { filter: drop-shadow(0 0 4px currentColor); }
.scene.guessing .sc-veh { cursor: pointer; }
.scene.guessing .sc-veh:hover .sc-tag-bg, .scene.guessing .sc-veh:focus .sc-tag-bg { fill: var(--yellow); }
.sc-picked .sc-tag-bg { fill: var(--yellow); }
.scene.guess-ok .scene-stage { box-shadow: 0 0 0 4px var(--green); }
.scene.guess-bad .scene-stage { box-shadow: 0 0 0 4px var(--red); }
.scene-panel { display: grid; gap: 12px; }
.scene-caption { min-height: 3.2em; margin: 0; font-size: 1.02rem; }
.scene-controls { display: flex; flex-wrap: wrap; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .sc-blink.on circle, .sc-beacon-a, .sc-beacon-b { animation: none; opacity: 1; } }
.scene-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .scene-layout { grid-template-columns: 1fr; } }
.scene-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.scene-item { display: grid; grid-template-rows: auto 1fr; background: var(--surface); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); border: 1.5px solid var(--line); }
.scene-item:hover { border-color: var(--blue); }
.scene-thumb { aspect-ratio: 16/10; overflow: hidden; background: var(--ground); pointer-events: none; }
.scene-thumb .scene-panel { display: none; }
.scene-thumb .scene-stage { border-radius: 0; aspect-ratio: auto; height: 100%; }
.scene-thumb .scene-svg { transform: scale(1.5); }
.scene-item div.txt { padding: 14px 16px; }
.rule-ref { font-size: .82rem; color: var(--blue); font-weight: 600; }
.modal { position: fixed; inset: 0; background: rgba(10, 14, 20, .6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 18px; width: min(560px, 100%); max-height: 94vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal-head h3 { margin: 0; }

/* ---------- Лендинг ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 20px 0 40px; }
.hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.5rem); line-height: 1.02; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 24px; } }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; padding: 0; margin: 0; list-style: none; }
.feature-list li { padding: 18px 0; border-top: 2px solid var(--line); display: grid; grid-template-columns: 36px 1fr; gap: 14px; }
.feature-list .ic { width: 32px; height: 32px; }
.feature-list h3 { margin-bottom: 4px; }
.feature-list p { color: var(--muted); margin: 0; }
@media (max-width: 720px) { .feature-list { grid-template-columns: 1fr; } }
.band { background: var(--blue); color: #fff; border-radius: var(--radius); padding: 28px; display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 40px; }
.band h2 { margin: 0; }
footer.site { padding: 26px 0 40px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

/* ---------- Справочник ---------- */
.ref-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.ref-tabs a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; }
.ref-tabs a[aria-current="page"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.ref-item { display: grid; grid-template-columns: 72px 1fr; gap: 14px; background: var(--surface); border-radius: 12px; padding: 14px; }
.ref-item.noimg { grid-template-columns: 1fr; }
.ref-item img { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.ref-item .num { font: 700 1.1rem var(--font-sign); color: var(--blue); }
.ref-item p { font-size: .88rem; color: var(--muted); margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ref-item details p { -webkit-line-clamp: unset; display: block; }
.ref-item summary { cursor: pointer; font-size: .85rem; color: var(--blue); }

/* ---------- Профиль ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach { padding: 14px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.ach .ic { font-size: 1.9rem; line-height: 1; filter: grayscale(1); opacity: .4; }
.ach.got { background: var(--yellow-soft); }
.ach.got .ic { filter: none; opacity: 1; }
.ach b { display: block; margin-top: 6px; font-size: .92rem; }
.ach span { font-size: .78rem; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 10px; }
.chart div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; font-size: .68rem; color: var(--muted); }
.chart i { width: 100%; max-width: 26px; border-radius: 4px 4px 0 0; background: var(--blue); min-height: 2px; position: relative; }
.chart i b { position: absolute; bottom: 0; left: 0; right: 0; background: var(--green); border-radius: 4px 4px 0 0; }
.level-ring { display: flex; align-items: center; gap: 14px; }
.level-num { width: 64px; height: 64px; transform: rotate(45deg); background: var(--yellow); border: 4px solid #fff; outline: 1.5px solid var(--line); display: grid; place-items: center; border-radius: 6px; flex: none; }
.level-num span { transform: rotate(-45deg); font: 700 1.6rem var(--font-sign); color: #1b1b1b; }

/* Таблицы */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; }
.table-wrap { overflow-x: auto; }
.rank { font: 700 1.2rem var(--font-sign); width: 36px; }
.me-row { background: var(--yellow-soft); }
.code { font: 700 1.6rem var(--font-sign); letter-spacing: .12em; background: var(--yellow); color: #1b1b1b; padding: 4px 14px; border-radius: 8px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); }
.offline-banner { display: none; background: var(--red); color: #fff; text-align: center; padding: 6px; font-size: .9rem; }
body.is-offline .offline-banner { display: block; }

/* Расширения сцен */
.sc-yard { fill: color-mix(in srgb, var(--asphalt) 55%, #9aa1a8); }
.sc-yard-edge { stroke: #fff; stroke-width: 3; stroke-dasharray: 6 5; }
.sc-zebra { fill: #fff; opacity: .92; }
.sc-ballast { fill: #6b6258; }
.sc-sleeper { fill: #4a3a2c; }
.sc-railline { stroke: #c7ccd1; stroke-width: 3; }
.sc-rail-a { fill: #ff4d4d; animation: beacon .8s steps(1) infinite; }
.sc-rail-b { fill: #ff4d4d; animation: beacon .8s steps(1) infinite reverse; }
.sc-lamp-blink { animation: beacon 1s steps(1) infinite; }
.sc-reg-spot { fill: rgba(255,255,255,.12); stroke: rgba(255,255,255,.5); stroke-dasharray: 4 4; }
.sc-reg-arm { stroke: #1b2a4a; stroke-width: 6; stroke-linecap: round; }
.sc-reg-body { fill: #1b2a4a; stroke: #b8f15a; stroke-width: 2.5; }
.sc-reg-head { fill: #fff; stroke: #333; }
.sc-reg-nose { fill: #b8f15a; }
.sc-reg-baton { fill: #fff; stroke: #333; }
.sc-stays .sc-tag-bg { stroke-dasharray: 3 2; }
.scene.guessing .sc-stays { cursor: not-allowed; opacity: .75; }
@media (prefers-reduced-motion: reduce) { .sc-rail-a, .sc-rail-b, .sc-lamp-blink { animation: none; } }

.invite-grid { display: grid; grid-template-columns: auto 1fr; gap: 28px; }
@media (max-width: 820px) { .invite-grid { grid-template-columns: 1fr; } }
.radio-row > label { display: block; border: 0; padding: 0; font-weight: 600; cursor: default; }
