/* Тесты: один файл стилей. Сначала телефон, потом широкие экраны. Тёмная тема по умолчанию. */

:root {
  color-scheme: dark;
  --bg: #150a1e;
  --surface: #211230;
  --surface-2: #2b1840;
  --surface-3: #37214f;
  --outline: #4b3068;
  --text: #f6ecfa;
  --muted: #b9a5c9;
  --primary: #e00092;
  --on-primary: #fff;
  --primary-hover: #f21aa4;
  --container: #550b73;
  --on-container: #f9dcf1;
  --link: #ff6fd0;
  --ok: #5fd38d;
  --warn: #f2b84b;
  --bad: #ff6b81;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  /* цвета вариантов ответа: тон считается из номера и количества, см. .opt */
  --o-bg-l: .31; --o-bg-c: .075;
  --o-bd-l: .56; --o-bd-c: .15;
  --o-on-l: .5;  --o-on-c: .17;
  --o-text: #fff;
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --nav-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Тёмная тема: варианты фона 2 и 3 (вариант 1 это :root) */
:root[data-theme="dark"][data-bg="2"] {
  --bg: #0e0b1f; --surface: #181430; --surface-2: #221c42; --surface-3: #2d2556; --outline: #41387a;
  --container: #3b1a7a; --on-container: #e6dcff; --link: #c79bff;
}
:root[data-theme="dark"][data-bg="3"] {
  --bg: #121114; --surface: #1c1a20; --surface-2: #27242d; --surface-3: #332f3b; --outline: #47424f;
  --container: #5a1a63; --on-container: #f6dcf2; --text: #f3eef6; --muted: #aaa3b3;
}

/* Светлая тема: фон заметно темнее карточек, чтобы они не сливались с ним */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ece1f5;
  --surface: #ffffff;
  --surface-2: #f6effb;
  --surface-3: #e6d6f1;
  --outline: #c3a8d8;
  --text: #1f0d2b;
  --muted: #5d466f;
  --primary: #c8008a;
  --on-primary: #fff;
  --primary-hover: #a90074;
  --container: #e4c9f3;
  --on-container: #3f1657;
  --link: #a3006e;
  --ok: #0f7a3f;
  --warn: #8a5400;
  --bad: #c01c3b;
  --shadow: 0 2px 4px rgba(63, 22, 87, .10), 0 8px 24px rgba(63, 22, 87, .14);
  --o-bg-l: .9; --o-bg-c: .055;
  --o-bd-l: .66;  --o-bd-c: .15;
  --o-on-l: .78;   --o-on-c: .15;
  --o-text: #1f0d2b;
}
:root[data-theme="light"][data-bg="2"] {
  --bg: #e1e6f5; --surface: #ffffff; --surface-2: #eff1fa; --surface-3: #dde1f3; --outline: #b2bbdc;
  --container: #d3d9f6; --on-container: #1f2a5c; --link: #8a0063; --muted: #4f5a82; --text: #151a33;
}
:root[data-theme="light"][data-bg="3"] {
  --bg: #f0e4e1; --surface: #fffdfc; --surface-2: #f8eeeb; --surface-3: #eedcd7; --outline: #d4b9b2;
  --container: #f2d2e4; --on-container: #4a1738; --muted: #6a5253; --text: #2a1519;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font);
  min-height: 100vh; min-height: 100dvh;
  background-image: radial-gradient(1200px 500px at 50% -200px, color-mix(in oklab, var(--container) 55%, transparent), transparent);
  background-repeat: no-repeat;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 650; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in oklab, var(--primary) 70%, #fff); outline-offset: 2px; border-radius: 10px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- каркас ---------- */
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.boot { margin: auto; padding: 40px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary);
  animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 32px; height: 32px; border-radius: 10px; background: var(--container); display: grid; place-items: center; color: #fff; }
.topbar .spacer { flex: 1; }

main#view { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
body.focus main#view { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
main#view > .page { animation: page-in .28s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 18px; }
.page-head h1 { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--surface);
  border-top: 1px solid var(--outline);
}
.nav a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px;
  color: var(--muted); font-size: .72rem; text-decoration: none; border-radius: 16px;
}
.nav a .pill { width: 58px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background .2s, color .2s; }
.nav a.active { color: var(--text); font-weight: 600; }
.nav a.active .pill { background: var(--container); color: var(--on-container); }
body.focus .nav { display: none; }

@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  .nav { bottom: auto; top: calc(8px + env(safe-area-inset-top)); left: 200px; right: auto; z-index: 21; border: 0; background: none; justify-content: flex-start; gap: 4px; padding: 0; }
  .nav a { flex: none; flex-direction: row; gap: 8px; padding: 8px 14px; font-size: .95rem; max-width: none; }
  .nav a .pill { width: auto; height: auto; background: none !important; }
  .nav a.active { background: var(--container); color: var(--on-container); }
  main#view { padding-top: 20px; }
}

/* ---------- карточки, кнопки, поля ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; border: 1px solid color-mix(in oklab, var(--outline) 55%, transparent); }
.card.flat { background: var(--surface-2); border-color: transparent; }
.card + .card, .stack > .card { margin: 0; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 26px 4px 12px; color: var(--muted); font-size: .85rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.section-title::before, .section-title::after { content: ""; flex: 1; height: 1px; background: var(--outline); opacity: .6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .12s, background .15s, box-shadow .15s, opacity .15s; user-select: none;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.tonal { background: var(--container); color: var(--on-container); }
.btn.tonal:hover { background: color-mix(in oklab, var(--container) 85%, #fff); }
.btn.ghost { background: transparent; color: var(--link); padding: 0 14px; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn.danger:hover { background: color-mix(in oklab, var(--bad) 14%, transparent); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 0; background: transparent; color: var(--text); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.92); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--r-md); border: 1.5px solid var(--outline);
  background: var(--surface-2); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input::placeholder { color: color-mix(in oklab, var(--muted) 70%, transparent); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 28%, transparent); }
.input.invalid { border-color: var(--bad); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; color: var(--text); }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; flex: none; width: 52px; height: 32px; border-radius: 16px; background: var(--surface-3); border: 2px solid var(--outline); transition: background .2s, border-color .2s; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s, width .2s; }
.check input:checked + .switch { background: var(--primary); border-color: var(--primary); }
.check input:checked + .switch::after { transform: translateX(20px); background: #fff; }
.check input:focus-visible + .switch { outline: 3px solid color-mix(in oklab, var(--primary) 70%, #fff); outline-offset: 2px; }
.error-text { color: var(--bad); font-size: .9rem; min-height: 1.2em; }
.hint { color: var(--muted); font-size: .85rem; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-3); color: var(--text); white-space: nowrap; }
.chip.ok { background: color-mix(in oklab, var(--ok) 20%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in oklab, var(--warn) 20%, transparent); color: var(--warn); }
.chip.bad { background: color-mix(in oklab, var(--bad) 20%, transparent); color: var(--bad); }
.chip.accent { background: var(--container); color: var(--on-container); }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border-radius: var(--r-md); border: 1px solid color-mix(in oklab, var(--outline) 45%, transparent); color: var(--text); text-decoration: none; }
a.item:hover { background: var(--surface-2); text-decoration: none; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 2rem; margin-bottom: 8px; }

.tabs { display: flex; gap: 6px; padding: 4px; background: var(--surface); border-radius: 999px; overflow-x: auto; }
.tabs button { flex: 1; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; white-space: nowrap; }
.tabs button.on { background: var(--container); color: var(--on-container); }

/* ---------- диалоги, уведомления ---------- */
dialog { border: 0; border-radius: 26px; padding: 22px; max-width: min(92vw, 440px); width: 100%; background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 3, 16, .6); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .22s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
dialog h2 { margin-bottom: 10px; }

.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
body.focus .toasts { bottom: calc(100px + env(safe-area-inset-bottom)); }
.toast { pointer-events: auto; max-width: 520px; padding: 12px 18px; border-radius: 16px; background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); animation: toast-in .25s cubic-bezier(.2, .8, .2, 1) both; }
.toast.bad { background: color-mix(in oklab, var(--bad) 28%, var(--surface-2)); }
.toast.ok { background: color-mix(in oklab, var(--ok) 24%, var(--surface-2)); }
.toast.out { animation: toast-out .2s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

.netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 70; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--warn); color: #231400; text-align: center; font-weight: 600; font-size: .9rem; transform: translateY(-110%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); display: flex; gap: 8px; justify-content: center; align-items: center; }
.netbar.on { transform: none; }
.netbar.back { background: var(--ok); color: #04210f; }

/* ---------- вход ---------- */
.auth { max-width: 440px; margin: 6vh auto 0; }
.auth h1 { margin-bottom: 6px; }
.id-badge { font-size: 2rem; letter-spacing: .12em; font-weight: 700; text-align: center; padding: 18px; border-radius: var(--r-md); background: var(--container); color: var(--on-container); user-select: all; font-variant-numeric: tabular-nums; }

/* ---------- главная ---------- */
.hero { padding: 22px; border-radius: var(--r-lg); background: linear-gradient(140deg, var(--container), color-mix(in oklab, var(--container) 55%, var(--primary))); color: #fff; }
:root[data-theme="light"] .hero { color: var(--on-container); background: linear-gradient(140deg, #f1d6fa, #fbd0ec); }
.hero h2 { margin-bottom: 14px; }
.hero .input { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); color: inherit; }
:root[data-theme="light"] .hero .input { background: rgba(255, 255, 255, .8); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); flex: 1; min-width: 110px; }
.stat b { font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .8rem; }

/* ---------- прохождение теста ---------- */
.att-top { position: sticky; top: 0; z-index: 20; margin: 0 -16px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.att-bar { display: flex; align-items: center; gap: 10px; }
.att-bar .count { font-weight: 700; }
.timer { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.timer.low { background: color-mix(in oklab, var(--bad) 24%, transparent); color: var(--bad); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .55; } }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--container), var(--primary)); transition: width .45s cubic-bezier(.3, .8, .3, 1); }

.sync { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); min-width: 0; }
.sync .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.sync.saving .dot { background: var(--warn); animation: blink .8s ease-in-out infinite; }
.sync.offline { color: var(--warn); font-weight: 600; }
.sync.offline .dot { background: var(--warn); animation: blink 1.2s ease-in-out infinite; }
.sync.ack .dot { animation: ack .6s ease-out; }
@keyframes ack { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--ok) 70%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }

.dots { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.dots::-webkit-scrollbar { display: none; }
.dots button {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--outline); background: transparent; color: var(--muted); font-size: .8rem; font-weight: 700;
  cursor: pointer; transition: all .2s; scroll-snap-align: center; position: relative;
}
.dots button.done { background: var(--container); border-color: var(--container); color: var(--on-container); }
.dots button.cur { border-color: var(--primary); color: var(--text); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 30%, transparent); transform: scale(1.1); }
.dots button.done.cur { background: var(--primary); border-color: var(--primary); color: #fff; }
.dots button.pend::after { content: ""; position: absolute; right: -2px; top: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); border: 2px solid var(--bg); }

.stage { display: grid; overflow-x: clip; margin-top: 14px; }
.stage > .qcard { grid-area: 1 / 1; }
.qcard { background: var(--surface); border-radius: var(--r-lg); padding: 20px 18px; border: 1px solid color-mix(in oklab, var(--outline) 55%, transparent); }
.qcard.in-next { animation: in-next .36s cubic-bezier(.2, .8, .2, 1) both; }
.qcard.in-prev { animation: in-prev .36s cubic-bezier(.2, .8, .2, 1) both; }
.qcard.out-next { animation: out-next .26s ease-in both; pointer-events: none; }
.qcard.out-prev { animation: out-prev .26s ease-in both; pointer-events: none; }
@keyframes in-next { from { opacity: 0; transform: translateX(46px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes in-prev { from { opacity: 0; transform: translateX(-46px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes out-next { to { opacity: 0; transform: translateX(-46px) scale(.98); } }
@keyframes out-prev { to { opacity: 0; transform: translateX(46px) scale(.98); } }
.qmeta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.qtext { font-size: 1.15rem; font-weight: 600; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 6px; }
.qhint { color: var(--muted); font-size: .88rem; margin-bottom: 16px; }

.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--outline); }
.actionbar .in { max-width: 728px; margin: 0 auto; display: flex; gap: 12px; }
.actionbar .btn { flex: 1; }
.actionbar .btn.prev { flex: 0 0 auto; }

/* варианты: у каждого свой тон, от красного по кругу обратно к красному. --i номер, --n количество */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  --hue: calc(20 + 360 * var(--i, 0) / var(--n, 1));
  --c-bg: oklch(var(--o-bg-l) var(--o-bg-c) var(--hue));
  --c-bd: oklch(var(--o-bd-l) var(--o-bd-c) var(--hue));
  --c-on: oklch(var(--o-on-l) var(--o-on-c) var(--hue));
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 10px 14px; text-align: left;
  background: var(--surface-2); background: var(--c-bg); border: 2px solid transparent; border-radius: var(--r-md); color: var(--text); cursor: pointer;
  transition: transform .12s, background .2s, border-color .2s, box-shadow .2s; overflow-wrap: anywhere;
}
.opt:hover { border-color: var(--c-bd); }
.opt:active { transform: scale(.985); }
.opt .badge { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem; background: var(--c-bd); color: var(--o-text); transition: transform .2s, background .2s; }
.opt .txt { flex: 1; min-width: 0; }
.opt .tick { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--c-bd); color: transparent; transition: all .2s; }
.opt.multi .tick { border-radius: 8px; }
.opt.on { background: var(--c-on); border-color: var(--c-bd); box-shadow: 0 4px 18px color-mix(in oklab, var(--c-bd) 35%, transparent); color: var(--o-text); }
.opt.on .badge { background: #fff; color: #26112f; transform: scale(1.06); }
.opt.on .tick { background: #fff; border-color: #fff; color: #26112f; animation: tick .3s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tick { from { transform: scale(.4); } to { transform: scale(1); } }
.opt[disabled] { cursor: default; }

/* сопоставление */
.match-left { display: flex; flex-direction: column; gap: 10px; }
.mrow { --hue: calc(20 + 360 * var(--i, 0) / var(--n, 1)); --c-bg: oklch(var(--o-bg-l) var(--o-bg-c) var(--hue)); --c-bd: oklch(var(--o-bd-l) var(--o-bd-c) var(--hue)); --c-on: oklch(var(--o-on-l) var(--o-on-c) var(--hue)); }
.mrow .slot { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px; text-align: left; border-radius: var(--r-md); border: 2px dashed var(--c-bd); background: var(--c-bg); cursor: pointer; transition: all .2s; color: var(--text); }
.mrow .slot .badge { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--c-bd); color: var(--o-text); }
.mrow .slot .arrow { color: var(--muted); flex: none; }
.mrow .slot .target { flex: 1; min-width: 0; text-align: right; color: var(--muted); font-size: .9rem; }
.mrow .slot.paired { border-style: solid; background: var(--c-on); color: var(--o-text); }
.mrow .slot.paired .target { color: inherit; font-weight: 600; }
.mrow .slot.active { border-style: solid; box-shadow: 0 0 0 4px color-mix(in oklab, var(--c-bd) 40%, transparent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in oklab, var(--c-bd) 15%, transparent); } }
.pool { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--outline); }
.pchip { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--outline); background: var(--surface-2); color: var(--text); cursor: pointer; transition: all .2s; overflow-wrap: anywhere; text-align: left; }
.pchip:hover { border-color: var(--primary); }
.pchip.used { color: var(--o-text); border-color: transparent; background: var(--c-on); }
.pchip.used .tag { opacity: .85; font-weight: 700; margin-right: 6px; }
.pchip[disabled] { cursor: default; }

/* порядок */
.order { display: flex; flex-direction: column; gap: 10px; position: relative; }
.oitem { --hue: calc(20 + 360 * var(--i, 0) / var(--n, 1)); --c-bg: oklch(var(--o-bg-l) var(--o-bg-c) var(--hue)); --c-bd: oklch(var(--o-bd-l) var(--o-bd-c) var(--hue)); display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 8px 8px 12px; border-radius: var(--r-md); background: var(--surface-2); background: var(--c-bg); border: 2px solid transparent; transition: box-shadow .2s, border-color .2s; }
.oitem .num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--c-bd); color: var(--o-text); }
.oitem .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.oitem .grip { flex: none; width: 34px; height: 44px; display: grid; place-items: center; color: var(--muted); cursor: grab; touch-action: none; border-radius: 12px; }
.oitem .mv { flex: none; width: 36px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; }
.oitem .mv:hover { background: color-mix(in oklab, var(--c-bd) 30%, transparent); }
.oitem .mv[disabled] { opacity: .25; cursor: default; }
.oitem.drag { z-index: 5; box-shadow: var(--shadow); border-color: var(--c-bd); transition: none; cursor: grabbing; }
.oitem.moved { animation: moved .45s ease-out; }
@keyframes moved { from { box-shadow: 0 0 0 4px color-mix(in oklab, var(--c-bd) 55%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }

/* ---------- результат ---------- */
.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 26px 16px; }
.ring { position: relative; width: 190px; height: 190px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: url(#ringgrad); transition: stroke-dashoffset 1.2s cubic-bezier(.2, .8, .2, 1); }
.ring .mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .mid b { font-size: 2.3rem; line-height: 1; }
.ring .mid span { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.review { display: flex; flex-direction: column; gap: 14px; }
.rcard { background: var(--surface); border-radius: var(--r-lg); padding: 16px; border: 1px solid color-mix(in oklab, var(--outline) 55%, transparent); border-left: 5px solid var(--outline); animation: page-in .35s both; }
.rcard.v-correct { border-left-color: var(--ok); }
.rcard.v-partial { border-left-color: var(--warn); }
.rcard.v-wrong { border-left-color: var(--bad); }
.rcard .qt { font-weight: 600; margin: 8px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ans-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 6px; font-weight: 700; }
.ans { display: flex; flex-direction: column; gap: 6px; }
.ans .a { padding: 9px 12px; border-radius: 12px; background: var(--surface-2); overflow-wrap: anywhere; display: flex; gap: 8px; align-items: baseline; }
.ans .a.ok { background: color-mix(in oklab, var(--ok) 20%, transparent); }
.ans .a.no { background: color-mix(in oklab, var(--bad) 20%, transparent); }
.ans .a .sym { flex: none; font-weight: 700; }
.ans .a.ok .sym { color: var(--ok); } .ans .a.no .sym { color: var(--bad); }
.ans .none { color: var(--muted); font-style: italic; }

/* ---------- преподаватель, аккаунты ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; white-space: nowrap; }
table.t td { padding: 10px; border-top: 1px solid var(--outline); vertical-align: middle; }
table.t tr:hover td { background: var(--surface); }
.bar { height: 10px; border-radius: 5px; overflow: hidden; display: flex; background: var(--surface-3); min-width: 90px; }
.bar i { display: block; height: 100%; }
.bar .c { background: var(--ok); } .bar .p { background: var(--warn); } .bar .w { background: var(--bad); }
.qedit { border: 1px solid var(--outline); border-radius: var(--r-md); padding: 14px; background: var(--surface); }
.qedit + .qedit { margin-top: 10px; }
.optrow { display: flex; gap: 8px; align-items: center; }
.optrow .input { min-height: 44px; }
.optrow .pick { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--outline); background: transparent; color: transparent; cursor: pointer; display: grid; place-items: center; }
.optrow .pick.on { background: var(--ok); border-color: var(--ok); color: #04210f; }
.codes { font-variant-numeric: tabular-nums; }
.codebox { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.codebox code { flex: 1; font-size: .95rem; letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body.focus .topbar { display: none; }
.att-title { margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* настройки оформления */
.seg { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--outline); }
.seg-btn { flex: 1; min-height: 40px; padding: 6px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; transition: all .2s; }
.seg-btn.on { background: var(--primary); color: var(--on-primary); }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.swatch { position: relative; height: 84px; border-radius: var(--r-md); border: 2px solid var(--outline); cursor: pointer; display: flex; align-items: flex-end; padding: 8px 10px; color: var(--text); font-weight: 600; font-size: .85rem; transition: transform .15s, border-color .2s; overflow: hidden; }
.swatch:hover { transform: translateY(-2px); }
.swatch.on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 35%, transparent); }
.swatch::before { content: ""; position: absolute; left: 10px; right: 10px; top: 10px; height: 26px; border-radius: 8px; background: var(--sw-surface); border: 1px solid var(--sw-line); }
.swatch .sw-name { position: relative; background: color-mix(in oklab, var(--sw-bg) 80%, transparent); padding: 2px 8px; border-radius: 999px; color: var(--sw-text); }
.swatch[data-pick="dark-1"] { --sw-bg: #150a1e; --sw-surface: #211230; --sw-line: #4b3068; --sw-text: #f6ecfa; background: #150a1e; }
.swatch[data-pick="dark-2"] { --sw-bg: #0e0b1f; --sw-surface: #181430; --sw-line: #41387a; --sw-text: #f6ecfa; background: #0e0b1f; }
.swatch[data-pick="dark-3"] { --sw-bg: #121114; --sw-surface: #1c1a20; --sw-line: #47424f; --sw-text: #f3eef6; background: #121114; }
.swatch[data-pick="light-1"] { --sw-bg: #ece1f5; --sw-surface: #fff; --sw-line: #c3a8d8; --sw-text: #1f0d2b; background: #ece1f5; }
.swatch[data-pick="light-2"] { --sw-bg: #e1e6f5; --sw-surface: #fff; --sw-line: #b2bbdc; --sw-text: #151a33; background: #e1e6f5; }
.swatch[data-pick="light-3"] { --sw-bg: #f0e4e1; --sw-surface: #fffdfc; --sw-line: #d4b9b2; --sw-text: #2a1519; background: #f0e4e1; }
.optrow.wrap { flex-wrap: wrap; }
.optrow .basis-full { flex: 0 0 100%; }
.optrow .idx { flex: none; width: 24px; text-align: center; color: var(--muted); font-weight: 700; }
:root[data-theme="light"] .card, :root[data-theme="light"] .item { box-shadow: var(--shadow); }

/* пары в вопросе «сопоставить»: метка и текст одним шрифтом */
.pchip { font: inherit; display: inline-flex; align-items: baseline; gap: 8px; }
.pchip .tag, .pchip .lbl { font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; opacity: .9; white-space: nowrap; }
.pchip .lbl { color: var(--muted); }
.pchip.used { font-weight: 600; }
.pchip.used .lbl { color: inherit; }

/* блокировка при выходе из полного экрана */
.fs-guard { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: rgba(12, 5, 20, .94); backdrop-filter: blur(8px); }
.fs-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.fs-card .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
