/* ENTRY LAB — «прилад».
   Авторське: графітова основа, тепле біле, один сигнальний колір, точкова матриця 5×7 як єдиний
   дисплейний голос, композиція «рейка / бриф / інструменти» і стан, що читається формою.
   Від Apple — матеріали й типографіка: нейтральний гротеск з оптичним розміром, звичайний регістр,
   заливки замість рамок, заокруглення за шкалою, розмиття лише там, де під елементом щось є.
   Моноширинний шрифт — тільки для коду, термінала, даних і кодів доступу. */

/* ================================================================== токени */
:root {
  color-scheme: dark;

  /* поверхні: вікно → піднята панель → картка → поповер; «екран» — для термінала й коду */
  --bg: #0c0d0f;
  --bg-1: #121316;
  --bg-2: #18191d;
  --bg-3: #222328;
  --screen: #0b0c0e;
  --screen-text: #dcd8cf;
  --seg-on: #2c2d33;
  --card: #121316;
  --field: rgb(236 232 223 / .055);
  --field-line: rgb(236 232 223 / .08);
  --material: rgb(26 27 31 / .78);
  --material-thick: rgb(30 31 35 / .92);
  --hud: rgb(30 31 35 / .92);

  /* заливки й роздільники прозорі, тож однаково лягають на будь-яку поверхню */
  --fill-1: rgb(236 232 223 / .055);
  --fill-2: rgb(236 232 223 / .085);
  --fill-3: rgb(236 232 223 / .13);
  --sep: rgb(236 232 223 / .08);
  --sep-2: rgb(236 232 223 / .14);

  /* текст: основний, вторинний, третинний (≥ 4.5:1), четвертинний — лише вимкнене й декор */
  --text: #ece8df;
  --text-2: #b9b5ac;
  --text-3: #8a8780;
  --text-4: #66645e;

  /* сигнал: оранжевий = активне, увага, зміна */
  --signal: #ff5a2a;
  --signal-text: #ff6a3d;
  --signal-ink: #170703;
  --signal-fill: rgb(255 90 42 / .13);
  --signal-ring: rgb(255 90 42 / .42);

  /* літеральні кольори: їх читає JS (canvas на вході, згаслі точки матриці) */
  --line: #24262b;
  --faint: #46453f;
  --dot-off: #1f2024;

  /* гарнітури */
  --font: 'Inter Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  --font-display: var(--font);
  --ui: var(--font);
  --sans: var(--font);
  --heading: var(--font-display);
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* радіуси: 4 — чипи коду й позначки; 6 — малі кнопки, сегменти; 8 — кнопки, поля, доріжки;
     12 — картки й панелі; 16 — діалоги й шухляда; 22 — великі «дисплеї» */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --r-4: 12px;
  --r-5: 16px;
  --r-6: 22px;
  --r-full: 999px;

  /* тіні: 1 — обраний сегмент; 2 — тости й поповери; 3 — діалоги й шухляда */
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4), 0 0 0 .5px rgb(0 0 0 / .3);
  --shadow-2: 0 8px 24px rgb(0 0 0 / .38), 0 1px 3px rgb(0 0 0 / .3);
  --shadow-3: 0 28px 80px rgb(0 0 0 / .55), 0 6px 18px rgb(0 0 0 / .3);
  --edge: inset 0 0 0 1px var(--sep);
  --edge-2: inset 0 0 0 1px var(--sep-2);

  /* рух */
  --t-1: 120ms;
  --t-2: 180ms;
  --t-3: 240ms;
  --t-4: 320ms;
  --t-5: 400ms;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);
  --ease-std: cubic-bezier(.2, 0, 0, 1);

  /* шеврон і позначка для власних контролів */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.25 8 9.75l3.5-3.5' fill='none' stroke='%238a8780' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.3 6.7 11 12 5.2' fill='none' stroke='%23170703' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2ed;
  --bg-1: #ebe8e2;
  --bg-2: #fbfaf8;
  --bg-3: #ffffff;
  --screen: #0b0c0e;
  --seg-on: #ffffff;
  --card: #fdfcfa;
  --field: #ffffff;
  --field-line: rgb(28 25 20 / .14);
  --material: rgb(252 251 249 / .9);
  --material-thick: rgb(252 251 249 / .94);
  --fill-1: rgb(28 25 20 / .045);
  --fill-2: rgb(28 25 20 / .07);
  --fill-3: rgb(28 25 20 / .11);
  --sep: rgb(28 25 20 / .09);
  --sep-2: rgb(28 25 20 / .16);
  --text: #15140f;
  --text-2: #3d3a34;
  --text-3: #66625a;
  --text-4: #8f8a80;
  --signal: #ff5a2a;
  --signal-text: #bf360e;
  --signal-fill: rgb(255 90 42 / .08);
  --signal-ring: rgb(255 90 42 / .4);
  --line: #d6d1c7;
  --faint: #bdb6aa;
  --dot-off: #dcd7cd;
  --shadow-1: 0 1px 2px rgb(40 30 10 / .14), 0 0 0 .5px rgb(40 30 10 / .1);
  --shadow-2: 0 8px 24px rgb(40 30 10 / .12), 0 1px 3px rgb(40 30 10 / .08);
  --shadow-3: 0 28px 70px rgb(40 30 10 / .2), 0 6px 16px rgb(40 30 10 / .08);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.25 8 9.75l3.5-3.5' fill='none' stroke='%2366625a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Варіанти гарнітур для порівняння (?type=...). Моноширинний — лише код і термінал. */
:root[data-type="wix"] { --font: 'Wix Madefor Text', 'Segoe UI', system-ui, sans-serif; --font-display: 'Wix Madefor Display', 'Wix Madefor Text', system-ui, sans-serif; }
:root[data-type="geist"] { --font: 'Geist', system-ui, sans-serif; }
:root[data-type="manrope"] { --font: 'Manrope', system-ui, sans-serif; }
:root[data-type="plex"] { --font: 'IBM Plex Sans', system-ui, sans-serif; --mono: 'IBM Plex Mono', Consolas, monospace; }
:root[data-type="before"] { --font: 'IBM Plex Sans', system-ui, sans-serif; --ui: 'IBM Plex Mono', Consolas, monospace; --mono: 'IBM Plex Mono', Consolas, monospace; }

/* Безперервні кути, як в Apple, там, де браузер уміє (corner-shape). Радіуси трохи більші,
   бо суперелипс того самого радіуса виглядає менш заокругленим. */
@supports (corner-shape: squircle) {
  :root { --r-2: 8px; --r-3: 11px; --r-4: 17px; --r-5: 24px; --r-6: 34px; }
  .btn, input[type="text"], input[type="password"], input[type="search"], input[type="date"], textarea, select,
  .seg, .seg span, .seg-tabs, .seg-tabs [role="tab"], .rv-nav, .rv-nav a, .rail-item, .tree button, .tile, .answer, .result,
  .notice, .aside-note, .hint-block, .demo, .panes, .spec, dialog, .drawer, .entry-side, .box, .grouped, .codes,
  .resume-code, pre, .ev, .msg, .kbd, input[type="checkbox"], .likert, .pick-list, .checklist, .option-btn, .tbl, .tasks, .rv-card, .rv-decision, .cond-bar, .ev-list { corner-shape: squircle; }
}

/* ================================================================== база */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.5 var(--font); letter-spacing: -.003em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.25; letter-spacing: -.012em; }
p { margin: 0 0 .85em; }
a { color: inherit; text-decoration-color: var(--sep-2); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color var(--t-1); }
a:hover { text-decoration-color: var(--signal); }
code, kbd, pre, samp { font-family: var(--mono); }
code { font-size: .875em; font-weight: 400; color: var(--text); background: var(--fill-2); padding: .12em .4em; border-radius: var(--r-1); overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
pre { margin: 0 0 1em; padding: 12px 14px; overflow: auto; font-size: 13px; line-height: 1.6; color: var(--screen-text); background: var(--screen); border-radius: var(--r-3); box-shadow: var(--edge); }
pre code { background: none; padding: 0; color: inherit; font-size: inherit; font-weight: 400; }
strong { font-weight: 600; color: var(--text); }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: .3em; }
li::marker { color: var(--text-3); }
hr { border: 0; height: 1px; background: var(--sep); margin: 22px 0; }
::selection { background: rgb(255 90 42 / .32); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--signal); color: var(--signal-ink); padding: 8px 12px; border-radius: var(--r-3); font: 600 13px var(--ui); text-decoration: none; }
.skip:focus { top: 12px; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.small { font-size: 13px; line-height: 1.45; }
.label { font: 500 13px/1.3 var(--ui); color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
svg.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ================================================================== точкова матриця */
svg.dots { display: block; overflow: visible; }
svg.dots .on { fill: currentColor; animation: dot-in var(--t-4) var(--ease-out) both; animation-delay: var(--d, 0ms); }
svg.dots .off { fill: var(--dot-off); }
@keyframes dot-in { from { opacity: 0; transform: scale(.3); transform-box: fill-box; transform-origin: center; } to { opacity: 1; transform: none; } }

/* ================================================================== кнопки */
.btn {
  --h: 34px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--h); min-width: 0; padding: 0 14px;
  font: 500 13px/1 var(--ui); letter-spacing: -.005em; color: var(--text);
  background: var(--fill-2); border: 0; border-radius: var(--r-3);
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-1) var(--ease-std), color var(--t-1) var(--ease-std), opacity var(--t-1), box-shadow var(--t-2);
}
.btn:hover { background: var(--fill-3); }
.btn:active { opacity: .78; }
.btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .38; cursor: default; pointer-events: none; }
.btn.primary { background: var(--signal); color: var(--signal-ink); font-weight: 600; }
.btn.primary:hover { background: #ff6c40; }
.btn.large { --h: 40px; padding: 0 18px; font-size: 15px; border-radius: var(--r-3); }
.btn.quiet { --h: 30px; padding: 0 10px; background: transparent; color: var(--text-2); border-radius: var(--r-2); font-weight: 500; }
.btn.quiet:hover { background: var(--fill-2); color: var(--text); }
.btn.quiet[aria-pressed="true"] { color: var(--signal-text); background: var(--signal-fill); }
.btn.icon { width: var(--h); padding: 0; }
.btn.danger { background: transparent; color: var(--signal-text); }
.btn.danger:hover { background: var(--signal-fill); }
.btn .ico { width: 15px; height: 15px; }
.btn.primary .ico { stroke-width: 2; }
.link { all: unset; display: inline; color: var(--text); cursor: pointer; text-decoration: underline; text-decoration-color: var(--sep-2); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color var(--t-1); }
.link:hover { text-decoration-color: var(--signal); }
.link:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 2px; }
.kbd { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; font: 500 11px/1 var(--ui); color: var(--text-3); background: var(--fill-1); border-radius: var(--r-2); box-shadow: inset 0 -1px 0 var(--sep-2), var(--edge); white-space: nowrap; }
.dot-badge { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }

/* ================================================================== поля */
.field { margin: 0 0 18px; }
.field > label, .fieldset-label, legend { display: block; font: 500 13px/1.3 var(--ui); color: var(--text-2); margin: 0 0 8px; padding: 0; }
.field .help, fieldset .help { font: 400 13px/1.45 var(--ui); color: var(--text-3); margin-top: 7px; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], textarea, select {
  width: 100%; height: 40px; padding: 0 12px; margin: 0;
  font: 400 15px/20px var(--font); color: var(--text);
  background: var(--field); border: 1px solid var(--field-line); border-radius: var(--r-3);
  transition: border-color var(--t-1) var(--ease-std), box-shadow var(--t-2) var(--ease-std), background-color var(--t-1);
}
input:hover, textarea:hover, select:hover { border-color: var(--sep-2); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3.5px var(--signal-ring); }
input:disabled, textarea:disabled, select:disabled { opacity: .5; }
textarea { display: block; height: auto; min-height: 92px; max-height: 440px; padding: 10px 12px; line-height: 1.5; resize: vertical; field-sizing: content; }
textarea.code, input.mono { font: 400 13px/1.55 var(--mono); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); opacity: .5; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; cursor: pointer; }
select option { background: var(--bg-2); color: var(--text); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.narrow { max-width: 240px; }

input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 18px; height: 18px; margin: 2px 0 0; border: 0; border-radius: 5px;
  background: var(--fill-2) center / 14px no-repeat; box-shadow: inset 0 0 0 1px var(--sep-2);
  cursor: pointer; transition: background-color var(--t-1) var(--ease-std), box-shadow var(--t-1);
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { background-color: var(--fill-3); }
input[type="checkbox"]:checked { background-color: var(--signal); background-image: var(--check); box-shadow: none; }
input[type="radio"]:checked { background: radial-gradient(circle, var(--signal-ink) 0 3.2px, var(--signal) 3.7px); box-shadow: none; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .4; cursor: default; }
.choice { display: flex; gap: 11px; align-items: flex-start; margin: 0 -10px; padding: 8px 10px; border-radius: var(--r-3); cursor: pointer; color: var(--text-2); font: 400 15px/22px var(--font); transition: background-color var(--t-1), color var(--t-1); }
.choice:hover { background: var(--fill-1); color: var(--text); }
.choice:has(input:checked) { color: var(--text); }
.choice:has(input:disabled) { cursor: default; background: none; }

/* сегментований перемикач (радіо-група або вкладки) */
.seg, .seg-tabs { display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: var(--fill-1); border-radius: var(--r-3); box-shadow: var(--edge); }
.seg label { position: relative; display: block; cursor: pointer; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span, .seg-tabs [role="tab"] {
  display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
  font: 500 13px/1 var(--ui); color: var(--text-2); white-space: nowrap;
  background: transparent; border: 0; border-radius: var(--r-2); cursor: pointer;
  transition: background-color var(--t-2) var(--ease-std), color var(--t-1), box-shadow var(--t-2);
}
.seg label:hover span, .seg-tabs [role="tab"]:hover { color: var(--text); }
.seg input:checked + span, .seg-tabs [role="tab"][aria-selected="true"] { background: var(--seg-on); color: var(--text); box-shadow: var(--shadow-1); }
.seg input:focus-visible + span, .seg-tabs [role="tab"]:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.seg-tabs [role="tab"] .dot-badge { margin-left: 2px; }
.seg-tabs.single { background: none; box-shadow: none; padding: 0; }
.seg-tabs.single [role="tab"] { background: none; box-shadow: none; padding: 0 6px; font-weight: 600; color: var(--text); cursor: default; }

/* ================================================================== позначки стану (форма, а не лише колір) */
.g {
  --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2.25' y='2.25' width='11.5' height='11.5' rx='3.25' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E");
  display: inline-block; flex: none; width: 13px; height: 13px; vertical-align: -2px;
  background: currentColor; -webkit-mask: var(--g) center / contain no-repeat; mask: var(--g) center / contain no-repeat;
}
.g[data-s="correct"] { --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cdefs%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='white'/%3E%3Cpath d='M4.7 8.3l2.2 2.2 4.4-4.8' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/mask%3E%3C/defs%3E%3Crect x='1.5' y='1.5' width='13' height='13' rx='3.5' mask='url(%23m)'/%3E%3C/svg%3E"); }
.g[data-s="partial"] { --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cdefs%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='white'/%3E%3Cpath d='M5 8h6' stroke='black' stroke-width='1.9' stroke-linecap='round'/%3E%3C/mask%3E%3C/defs%3E%3Crect x='1.5' y='1.5' width='13' height='13' rx='3.5' mask='url(%23m)'/%3E%3C/svg%3E"); }
.g[data-s="incorrect"] { --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2.25' y='2.25' width='11.5' height='11.5' rx='3.25' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M5.7 5.7l4.6 4.6M10.3 5.7l-4.6 4.6' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
.g[data-s="pending_review"] { --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2.25' y='2.25' width='11.5' height='11.5' rx='3.25' fill='none' stroke='black' stroke-width='1.5'/%3E%3Ccircle cx='5.5' cy='8' r='1.05'/%3E%3Ccircle cx='8' cy='8' r='1.05'/%3E%3Ccircle cx='10.5' cy='8' r='1.05'/%3E%3C/svg%3E"); }
.g[data-s="skipped"] { --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2.25' y='2.25' width='11.5' height='11.5' rx='3.25' fill='none' stroke='black' stroke-width='1.5' stroke-dasharray='2.4 2.1'/%3E%3Cpath d='M5.5 8h5' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); color: var(--text-3); }
.g[data-s="technical_issue"] { --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2.25' y='2.25' width='11.5' height='11.5' rx='3.25' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M8 4.9v3.5' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11' r='1'/%3E%3C/svg%3E"); color: var(--text-3); }
.g[data-s="active"] { --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='5'/%3E%3C/svg%3E"); color: var(--signal); }
.g[data-s="todo"] { color: var(--text-4); }

/* пігулки-мітки */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; font: 500 12px/1 var(--ui); color: var(--text-2); background: var(--fill-2); border-radius: var(--r-full); white-space: nowrap; vertical-align: middle; }
.tag.sig { color: var(--signal-text); background: var(--signal-fill); }
.tag.soft { color: var(--text-3); background: var(--fill-1); }
.tag.line { background: transparent; box-shadow: var(--edge-2); }

/* ================================================================== вікна, тости, пауза */
dialog:focus, .drawer:focus { outline: none; }
dialog {
  width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; color: var(--text);
  background: var(--material-thick); -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
  border-radius: var(--r-5); box-shadow: var(--shadow-3), var(--edge-2);
}
dialog[open] { animation: dlg-in var(--t-4) var(--ease-out) both; }
dialog::backdrop { background: rgb(5 6 7 / .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade-in var(--t-3) var(--ease-std) both; }
:root[data-theme="light"] dialog::backdrop { background: rgb(40 34 24 / .22); }
dialog .dhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 10px 0 20px; }
dialog .dhead h2 { font: 500 13px/1.3 var(--ui); color: var(--text-3); letter-spacing: 0; }
dialog .dbody { padding: 2px 20px 4px; max-height: min(66vh, 640px); overflow: auto; }
dialog .dbody > h3, dialog .dbody > div > h3 { font: 600 20px/1.3 var(--font-display); letter-spacing: -.014em; margin: 0 0 8px; }
dialog .dbody p { color: var(--text-2); }
dialog .dfoot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 20px; flex-wrap: wrap; }
dialog .dfoot .btn { min-width: 92px; }
dialog .dfoot .btn.danger { margin-right: auto; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.option-list { display: grid; gap: 6px; margin: 4px 0 18px; }
.option-btn { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; font: 400 15px/1.4 var(--font); color: var(--text); background: var(--fill-1); border-radius: var(--r-3); box-shadow: var(--edge); cursor: pointer; transition: background-color var(--t-1); }
.option-btn:hover { background: var(--fill-2); }
.option-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.option-btn .ico { margin-left: auto; color: var(--text-3); }

.ws ~ .toasts { left: calc(var(--rail-w, 0px) + clamp(24px, 3vw, 46px)); transform: none; justify-items: start; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px 10px 14px; max-width: min(560px, calc(100vw - 32px));
  font: 500 13px/1.35 var(--ui); color: #f2efe8; background: var(--hud);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  border-radius: var(--r-full); box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(255 255 255 / .09);
  animation: toast-in var(--t-4) var(--ease-out) both;
}
.toast::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #8a8780; flex: none; }
.toast.bad::before { background: var(--signal); box-shadow: 0 0 0 3px rgb(255 90 42 / .25); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); animation: fade-in var(--t-3) var(--ease-std) both; }
.overlay .box { text-align: center; max-width: 420px; padding: 32px; background: none; box-shadow: none; }
.overlay .dots { margin: 0 auto 26px; color: var(--signal); }
.overlay h2 { font: 600 24px/1.25 var(--font-display); margin: 0 0 8px; }
.overlay p { color: var(--text-2); margin-bottom: 22px; }

/* ================================================================== ВХІД */
.entry { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); }
.entry-main { display: flex; flex-direction: column; padding: 22px clamp(24px, 5vw, 84px) 26px; min-height: 100vh; }
.entry-top { display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
@media (min-width: 901px) { .entry-top #theme { position: fixed; top: 24px; right: 24px; z-index: 5; } }
.entry-mark { color: var(--text); margin: auto 0 0; padding-top: 48px; }
.entry-mark .dots { max-width: 100%; height: auto; }
.entry-mark .dots + .dots { margin-top: 12px; color: var(--signal); }
.entry-lede { margin: 34px 0 16px; font: 400 clamp(18px, 1.55vw, 21px)/1.5 var(--font); letter-spacing: -.012em; color: var(--text-2); max-width: 34ch; }
.entry-facts { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 34px; }
.entry-facts span { font: 500 13px/1 var(--ui); color: var(--text-2); background: var(--fill-1); box-shadow: var(--edge); padding: 9px 13px; border-radius: var(--r-full); }
.entry-form { max-width: 420px; }
.entry-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.entry-form .code { font: 500 16px/20px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.entry-form .code::placeholder { letter-spacing: .04em; }
.entry-form .choice { margin-top: -4px; font-size: 15px; }
.entry-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.entry-foot { margin-top: auto; padding-top: 40px; display: flex; gap: 22px; flex-wrap: wrap; align-items: center; font: 400 13px var(--ui); color: var(--text-3); }
.entry-foot a, .entry-foot .link { color: var(--text-3); }
.entry-foot a:hover, .entry-foot .link:hover { color: var(--text); }
.entry-side { position: sticky; top: 12px; height: calc(100vh - 24px); min-height: 560px; margin: 12px 12px 12px 0; border-radius: var(--r-6); background: var(--bg-1); box-shadow: var(--edge); overflow: hidden; isolation: isolate; }
.entry-side canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.route { position: absolute; left: 0; right: 0; bottom: 0; padding: 120px clamp(22px, 3.4vw, 44px) 30px; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--bg-1) 88%, transparent) 38%, var(--bg-1) 70%); }
.route ol { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.route li::before { transition: color var(--t-2); }
.route li b { transition: color var(--t-2); }
.route li:not(.lit)::before { color: var(--text-3) !important; }
.route li:not(.lit) b { color: var(--text-2); }
.route li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 14px; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--sep); counter-increment: r; margin: 0; }
.route li::before { content: counter(r, decimal-leading-zero); font: 500 12px/1 var(--mono); color: var(--signal-text); }
.route b { font: 600 15px/1.3 var(--font-display); letter-spacing: -.01em; }
.route span { font: 400 13px/1.3 var(--ui); color: var(--text-3); text-align: right; }
.route .cap { font: 500 13px var(--ui); color: var(--text-3); margin-bottom: 12px; }
.started { max-width: 440px; }
.started h2 { font: 600 24px/1.25 var(--font-display); margin-bottom: 10px; }
.resume-code { margin: 20px 0; padding: 18px; font: 500 22px/1.2 var(--mono); letter-spacing: .08em; color: var(--text); background: var(--signal-fill); border-radius: var(--r-4); box-shadow: inset 0 0 0 1px rgb(255 90 42 / .5); text-align: center; user-select: all; overflow-wrap: anywhere; }
.form-msg { min-height: 1.4em; font: 500 13px/1.4 var(--ui); color: var(--signal-text); margin: 12px 0 0; }
.form-msg:empty { min-height: 0; margin: 0; }
.rules { font-size: 15px; color: var(--text-2); }
.rules h3 { font: 600 20px/1.3 var(--font-display); color: var(--text); margin-bottom: 10px; }
.rules h4 { font: 600 13px var(--ui); color: var(--text); margin: 18px 0 4px; letter-spacing: 0; }
.rules ul { padding-left: 1.1em; }

/* ================================================================== РОБОЧИЙ ПРОСТІР */
body.ws-body { height: 100vh; overflow: hidden; }
.ws { display: grid; grid-template-rows: 52px minmax(0, 1fr); height: 100vh; }

/* верхня панель */
.top { display: flex; align-items: center; gap: 16px; padding: 0 10px 0 18px; border-bottom: 1px solid var(--sep); min-width: 0; }
.wordmark { display: inline-flex; align-items: center; gap: 7px; color: var(--text); text-decoration: none; flex: none; padding: 6px 4px; margin: 0 -4px; border-radius: var(--r-2); }
.wordmark .dots + .dots { color: var(--signal); }
.wordmark .dots .off { display: none; }
.wordmark:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 16px; border-left: 1px solid var(--sep); height: 20px; font: 500 13px/1 var(--ui); color: var(--text-3); white-space: nowrap; }
.crumbs b { color: var(--text-2); font-weight: 500; }
.crumbs .ttl { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.crumbs .ttl .c { font-variant-numeric: tabular-nums; }
.crumbs .ico { width: 13px; height: 13px; color: var(--text-4); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.stages { display: flex; align-items: center; gap: 10px; margin-right: 12px; font: 500 12px/1 var(--ui); color: var(--text-3); white-space: nowrap; }
.stages ol { display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; }
.stages li { width: 6px; height: 6px; margin: 0; border-radius: 50%; background: var(--fill-3); }
.stages li.done { background: var(--text-3); }
.stages li.now { background: var(--signal); box-shadow: 0 0 0 3px var(--signal-fill); }

.body { display: grid; grid-template-columns: 212px minmax(420px, .9fr) minmax(0, 1.22fr); min-height: 0; }
.body.solo { grid-template-columns: 212px minmax(0, 1fr); }

/* рейка */
.rail { border-right: 1px solid var(--sep); overflow: auto; padding: 12px 10px 24px; }
.rail-stage { display: block; padding: 18px 10px 8px; }
.rail-stage:first-child { padding-top: 6px; }
.rail-stage .nm { display: flex; align-items: center; gap: 8px; font: 600 12px/1.2 var(--ui); color: var(--text-3); }
.rail-stage.here .nm { color: var(--text); }
.rail-stage.here .nm::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--signal); }
.rail-stage .note { display: block; margin-top: 4px; font: 400 12px/1.4 var(--ui); color: var(--text-3); }
.rail-sub { padding: 8px 10px 4px; font: 500 12px/1.3 var(--ui); color: var(--text-2); }
.rail-item { display: grid; grid-template-columns: 10px 16px minmax(0, 1fr); align-items: center; gap: 9px; width: 100%; height: 30px; padding: 0 10px; margin: 1px 0; font: 500 13px/1 var(--ui); color: var(--text-2); background: none; border: 0; border-radius: var(--r-2); text-align: left; cursor: pointer; transition: background-color var(--t-1), color var(--t-1); }
.rail-item .n { font-variant-numeric: tabular-nums; text-align: right; color: var(--text-3); }
.rail-item[aria-current="true"] .n { color: var(--text-2); }
.rail-item .ttl { font-weight: 400; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item.todo .ttl { color: var(--text-3); }
.rail-item:hover { background: var(--fill-1); color: var(--text); }
.rail-item:hover .ttl { color: var(--text-2); }
.rail-item[aria-current="true"] { background: var(--fill-2); color: var(--text); }
.rail-item[aria-current="true"] .ttl { color: var(--text-2); }
.rail-item.todo { color: var(--text-3); cursor: default; background: none; }
.rail-item.todo .g { color: var(--text-4); }
.rail-item:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.rail-note { font: 400 12px/1.45 var(--ui); color: var(--text-3); padding: 16px 10px 0; }

/* бриф */
.brief { overflow: auto; min-height: 0; padding: 34px clamp(24px, 3vw, 46px) 0; }
.brief:focus { outline: none; }
.brief-in { max-width: 680px; padding-bottom: 64px; animation: rise var(--t-4) var(--ease-out) both; }
.body.solo .brief-in { max-width: 780px; margin: 0 auto; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.task-code { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; color: var(--text); }
.task-code .tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.brief h1, .screen h1 { font: 640 28px/1.2 var(--font-display); letter-spacing: -.021em; margin-bottom: 16px; text-wrap: balance; }
.prompt { font: 400 16px/1.65 var(--font); color: var(--text-2); }
.prompt p { margin-bottom: .8em; }
.prompt strong { color: var(--text); }
.prompt ul, .prompt ol { padding-left: 1.3em; }
.prompt pre { font-size: 13px; }

.notice { margin: 0 0 22px; padding: 14px 16px 12px; color: var(--text); background: var(--signal-fill); border-radius: var(--r-4); box-shadow: inset 0 0 0 1px rgb(255 90 42 / .28); }
.notice > :last-child { margin-bottom: 0; }
.notice .label { display: flex; align-items: center; gap: 8px; color: var(--signal-text); font-weight: 600; margin-bottom: 6px; }
.notice .label::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }
.aside-note, .hint-block { margin: 18px 0; padding: 13px 16px 12px; color: var(--text-2); font-size: 15px; background: var(--fill-1); border-radius: var(--r-4); }
.aside-note > :last-child, .hint-block > :last-child { margin-bottom: 0; }
.aside-note .label, .hint-block .label { display: block; margin-bottom: 5px; }
.hint-block { box-shadow: var(--edge); }
.demo { margin: 22px 0; padding: 16px 18px 8px; border-radius: var(--r-4); background: var(--card); box-shadow: var(--edge); }
.demo > .label { display: block; margin-bottom: 10px; color: var(--signal-text); font-weight: 600; }
.demo-actions { margin: 6px 0 10px; }

.answer { margin-top: 30px; padding: 20px 20px 18px; background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); }
.answer-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.answer-head .label:first-child { font: 600 15px/1.2 var(--ui); color: var(--text); }
.answer-head .label:last-child { font-size: 12px; font-variant-numeric: tabular-nums; }
.answer .fields > :last-child { margin-bottom: 14px; }
.declared { margin: 0 0 18px; }
.declared summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font: 500 13px var(--ui); color: var(--text-3); list-style: none; padding: 4px 0; border-radius: var(--r-1); }
.declared summary::-webkit-details-marker { display: none; }
.declared summary:hover { color: var(--text-2); }
.declared summary .ico { width: 13px; height: 13px; transition: transform var(--t-2) var(--ease-std); }
.declared[open] summary .ico { transform: rotate(90deg); }
.declared .opts { display: flex; flex-wrap: wrap; gap: 0 14px; margin-top: 6px; }
.declared .opts .choice { margin: 0; padding: 6px 4px; font-size: 13px; }
.submit-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--sep); }
.submit-row .kbd { margin-left: -2px; }
.submit-row .ev-count { margin-left: auto; }
.task-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 14px 0 0; padding: 0 0 0 2px; }
.task-actions .label { margin-right: 8px; }
.task-actions .btn.quiet .ico { color: var(--text-3); }
.task-actions .btn.quiet:hover .ico { color: inherit; }
.top .divider { width: 1px; height: 18px; background: var(--sep); margin: 0 6px; flex: none; }
.result:focus { outline: none; }
.result { margin: 0 0 24px; padding: 18px 20px 6px; background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); }
.result-head { display: flex; align-items: center; gap: 11px; font: 600 20px/1.25 var(--font-display); letter-spacing: -.014em; margin-bottom: 8px; }
.result-head .g { width: 20px; height: 20px; }
.result p { color: var(--text-2); }
.result .aside-note { background: var(--fill-1); margin: 12px 0 14px; }
.fb-checks { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: -2px 0 14px; }
.fb-checks li { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 11px 0 10px; margin: 0; font: 500 13px var(--ui); color: var(--text-2); background: var(--fill-1); border-radius: var(--r-full); }
.fb-checks li .g { width: 13px; height: 13px; }
.fb-checks li.no { color: var(--text); background: var(--fill-2); }
.next-row { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; }
.cond-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 22px; padding: 12px 10px 14px 16px; background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); }
.cond-bar .timer { flex: 1 1 auto; display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--signal-text); font: 500 13px var(--ui); }
.cond-bar .timer span { color: var(--text-3); white-space: nowrap; }
.cond-bar .track { order: 3; flex: 1 0 100%; height: 4px; margin-right: 6px; border-radius: 2px; background: var(--fill-3); overflow: hidden; }
.cond-bar .track i { display: block; height: 100%; background: var(--text-3); border-radius: inherit; transition: width 1s linear, background-color var(--t-3); }
.cond-bar.late .track i { background: var(--signal); }
.cond-bar .timer-tools { margin-left: auto; display: flex; gap: 2px; }
.cond-bar.over .timer, .cond-bar.over .timer span { color: var(--text-2); }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0 6px; margin: -6px 0 2px; }
.matrix th, .matrix td { padding: 0 8px 0 0; vertical-align: top; text-align: left; }
.matrix th { font: 500 13px/1.3 var(--ui); color: var(--text-3); padding-bottom: 2px; }
.matrix tbody th { color: var(--text-2); padding-top: 10px; }
.matrix textarea { min-height: 44px; font-size: 15px; }
dl.answers { margin: 0; }
dl.answers dt { font: 500 13px var(--ui); color: var(--text-3); }
dl.answers dd { margin: 3px 0 14px; white-space: pre-wrap; color: var(--text); overflow-wrap: anywhere; }

/* ================================================================== інструменти */
.bench { display: grid; grid-template-rows: 52px minmax(0, 1fr); background: var(--bg-1); border-left: 1px solid var(--sep); min-width: 0; min-height: 0; container-type: inline-size; }
.bench-bar { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; min-width: 0; }
.bench-bar .tools-right { margin-left: auto; display: flex; align-items: center; gap: 2px; min-width: 0; }
.panes { position: relative; min-height: 0; min-width: 0; margin: 0 10px 10px; overflow: hidden; border-radius: var(--r-4); background: var(--bg); }
.panes::after { content: ''; position: absolute; inset: 0; z-index: 5; border-radius: inherit; box-shadow: var(--edge); pointer-events: none; }
.pane { position: absolute; inset: 0; display: none; overflow: hidden; }
.pane.active { display: block; animation: fade-in var(--t-2) var(--ease-std) both; }
.pane .pad { padding: 18px 20px; height: 100%; overflow: auto; }
.empty { color: var(--text-3); font: 400 15px/1.5 var(--ui); padding: 24px 20px; margin: 0; max-width: 46ch; }
.empty b { display: block; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
@container (max-width: 600px) { .bench-bar .tools-right .lbl { display: none; } }

/* термінал */
.term { height: 100%; width: 100%; overflow: hidden; background: var(--screen); }
.xterm-host { width: 100%; height: 100%; overflow: hidden; padding: 14px 6px 8px 18px; }
.xterm .xterm-viewport { background: transparent !important; }
.xterm .xterm-viewport::-webkit-scrollbar { width: 10px; }
.xterm .xterm-viewport::-webkit-scrollbar-thumb { background: rgb(236 232 223 / .14); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
.plain { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; background: var(--screen); color: var(--screen-text); }
.plain pre { margin: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 14px 18px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.plain pre .err { color: #ff8a63; }
.plain pre .cmd { color: #ece8df; }
.plain pre .info { color: #77746d; }
.plain form { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid rgb(236 232 223 / .08); }
.plain form label { margin: 0; font: 500 13px var(--mono); color: #8f8b84; white-space: nowrap; }
.plain input { background: rgb(236 232 223 / .06); border-color: rgb(236 232 223 / .12); color: #ece8df; font-family: var(--mono); font-size: 13px; height: 34px; }

/* файли */
.mat { display: grid; grid-template-columns: minmax(170px, 216px) minmax(0, 1fr); height: 100%; }
.tree { border-right: 1px solid var(--sep); overflow: auto; padding: 10px 8px; font: 400 13px/1 var(--ui); background: var(--bg); }
.tree ul { list-style: none; margin: 0; padding-left: 14px; }
.tree > ul { padding-left: 0; }
.tree li { margin: 0; }
.tree button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 6px; width: 100%; height: 28px; padding: 0 8px; color: var(--text-2); border-radius: var(--r-2); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color var(--t-1), color var(--t-1); }
.tree button:hover { color: var(--text); background: var(--fill-1); }
.tree button:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.tree button[aria-current="true"] { color: var(--text); background: var(--fill-2); }
.tree button[aria-current="true"]::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--signal); flex: none; margin-left: -2px; }
.tree .dir > button { color: var(--text-3); font-weight: 500; }
.tree .dir > button .ico { width: 12px; height: 12px; transition: transform var(--t-2) var(--ease-std); }
.tree .dir > button[aria-expanded="false"] .ico { transform: rotate(-90deg); }
.viewer { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; background: var(--bg); }
.viewer-bar { display: flex; align-items: center; gap: 4px; padding: 7px 8px 7px 16px; border-bottom: 1px solid var(--sep); font: 400 12px var(--ui); color: var(--text-3); min-height: 46px; flex-wrap: wrap; }
.viewer-bar .path { font: 500 12px var(--mono); color: var(--text); margin-right: auto; overflow-wrap: anywhere; }
.viewer-bar .path.muted { font-family: var(--ui); color: var(--text-3); font-weight: 400; }
.viewer-bar .meta { padding: 0 8px; font-variant-numeric: tabular-nums; }
.code-view { overflow: auto; font: 400 13px/1.7 var(--mono); padding: 10px 0 24px; background: var(--bg); }
.code-view .ln { display: grid; grid-template-columns: 3.6em minmax(0, 1fr); }
.code-view .ln > button { all: unset; cursor: pointer; text-align: right; padding-right: 14px; color: var(--text-4); user-select: none; font-variant-numeric: tabular-nums; }
.code-view .ln > button:hover { color: var(--text-2); }
.code-view .ln > button:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.code-view .ln > span { white-space: pre-wrap; overflow-wrap: anywhere; padding-right: 16px; color: var(--text-2); }
.code-view .ln.sel { background: var(--signal-fill); }
.code-view .ln.sel > button { color: var(--signal-text); }
.code-view .ln.sel > span { color: var(--text); }

/* дані й мережа */
.data-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.mini { height: 30px !important; font-size: 13px !important; padding: 0 10px !important; border-radius: var(--r-2) !important; }
select.mini { width: auto; padding-right: 30px !important; background-position: right 7px center; }
input.mini[type="search"] { width: 200px; }
.dwrap { overflow: auto; height: 100%; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font: 400 12px/1.45 var(--mono); }
table.grid th, table.grid td { border-bottom: 1px solid var(--sep); padding: 7px 12px; text-align: left; white-space: nowrap; color: var(--text-2); }
table.grid th { position: sticky; top: 0; z-index: 1; font: 500 12px var(--ui); color: var(--text-3); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
table.grid th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; border-radius: var(--r-1); }
table.grid th button:hover { color: var(--text); }
table.grid th button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
table.grid td:first-child { color: var(--text-4); font-variant-numeric: tabular-nums; }
table.grid tbody tr:hover td { color: var(--text); background: var(--fill-1); }
table.grid tr[aria-selected="true"] td { color: var(--text); background: var(--signal-fill); }
.netlog { display: grid; grid-template-rows: minmax(110px, 42%) minmax(0, 1fr); height: 100%; }
.netlog .list { overflow: auto; border-bottom: 1px solid var(--sep); }
.netlog .list tr { cursor: pointer; }
.netlog .list tr:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.netlog .detail { overflow: auto; padding: 16px 18px 24px; }
.netlog .detail h4 { font: 600 12px var(--ui); color: var(--text-3); margin: 18px 0 6px; letter-spacing: 0; }
.netlog .detail table.grid { font-size: 12px; }
.netlog-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.netlog-head .req { font: 500 13px var(--mono); color: var(--text); }
.netlog-head .btn { margin-left: auto; }
.json { font: 400 12px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--screen); color: #cfcac0; }
.json .k { color: #ece8df; }
.json .s { color: #ff9d7a; }
.json .n { color: #9fd0c9; }
.st-4, .st-5 { color: var(--signal-text) !important; }
.site { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.site-bar { display: flex; align-items: center; gap: 4px; padding: 7px 8px 7px 14px; border-bottom: 1px solid var(--sep); font: 400 12px var(--ui); color: var(--text-3); min-height: 46px; overflow: hidden; white-space: nowrap; }
.site-bar .site-name { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-weight: 500; margin-right: 4px; }
.site-bar .site-name::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.site-bar .spacer { flex: 1; }
.site-frame { min-height: 0; height: 100%; background: #fff; }
.site iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

/* журнал (куратор, докази, нотатки) — аркуш з матеріалом */
.drawer {
  position: fixed; top: 60px; right: 10px; bottom: 10px; width: min(400px, calc(100vw - 20px)); z-index: 40;
  display: grid; grid-template-rows: 54px minmax(0, 1fr);
  background: var(--material); -webkit-backdrop-filter: blur(28px) saturate(1.7); backdrop-filter: blur(28px) saturate(1.7);
  border-radius: var(--r-5); box-shadow: var(--shadow-3), var(--edge-2);
  transform: translateX(calc(100% + 24px)); opacity: 0; visibility: hidden;
  transition: transform var(--t-5) var(--ease-sheet), opacity var(--t-3) var(--ease-std), visibility 0s linear var(--t-5);
}
.drawer.open { transform: none; opacity: 1; visibility: visible; transition: transform var(--t-5) var(--ease-sheet), opacity var(--t-2) var(--ease-std), visibility 0s; }
.drawer-bar { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; }
.drawer-bar .seg-tabs { margin-right: auto; }
.drawer-body { overflow: auto; padding: 6px 18px 24px; min-height: 0; }
.msg { margin: 0 0 10px; padding: 11px 14px 9px; font-size: 15px; line-height: 1.55; color: var(--text-2); background: var(--fill-1); border-radius: var(--r-4); }
.msg > :last-child { margin-bottom: 0; }
.msg .from { display: block; font: 500 12px var(--ui); color: var(--text-3); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.msg.candidate { margin-left: 28px; background: var(--fill-2); }
.msg.change { background: var(--signal-fill); color: var(--text); box-shadow: inset 0 0 0 1px rgb(255 90 42 / .26); }
.msg.change .from { color: var(--signal-text); }
.drawer-note { font: 400 12px/1.45 var(--ui); color: var(--text-3); margin: 14px 2px 0; }
.ev { margin: 0 0 8px; padding: 10px 10px 10px 14px; background: var(--fill-1); border-radius: var(--r-4); }
.ev-h { display: flex; align-items: center; gap: 10px; font: 500 12px var(--ui); color: var(--text-3); }
.ev-h .ref { color: var(--text); font-family: var(--mono); font-weight: 400; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev pre { margin: 8px 4px 2px 0; max-height: 140px; font-size: 12px; }
.notes { width: 100%; height: calc(100% - 30px); min-height: 240px; max-height: none; resize: none; field-sizing: fixed; font-size: 15px; line-height: 1.55; }

/* ================================================================== екрани поза задачами */
.lead { font: 400 17px/1.55 var(--font); letter-spacing: -.008em; color: var(--text-2); max-width: 60ch; }
.section-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font: 600 13px var(--ui); color: var(--text); margin: 34px 0 12px; }
.section-label > :last-child:not(:first-child) { font-weight: 400; color: var(--text-3); font-variant-numeric: tabular-nums; }
.grouped { background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); overflow: hidden; }
.checklist { list-style: none; padding: 4px 16px; margin: 22px 0 26px; background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); }
.checklist li { display: flex; gap: 12px; align-items: baseline; padding: 13px 0; margin: 0; color: var(--text-2); }
.checklist li + li { border-top: 1px solid var(--sep); }
.checklist li .g { width: 15px; height: 15px; transform: translateY(2px); }
.checklist li.done { color: var(--text); }
.checklist li.done .g { color: var(--signal); }
/* шкала Лайкерта: підписи рівнів один раз, у рядках — лише перемикачі */
.likert { margin: 22px 0 0; padding: 2px 6px 2px 18px; background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); }
.lk-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, 104px); align-items: center; min-height: 46px; }
.lk-row + .lk-row:not(.lk-head) { border-top: 1px solid var(--sep); }
.lk-head { min-height: 40px; align-items: end; padding-bottom: 6px; }
.lk-head span { font: 500 12px/1.25 var(--ui); color: var(--text-3); text-align: center; }
.lk-row .name { color: var(--text); font-size: 15px; line-height: 1.4; padding: 10px 12px 10px 0; }
.lk-cell { display: grid; place-items: center; align-self: stretch; cursor: pointer; border-radius: var(--r-2); transition: background-color var(--t-1); }
.lk-cell:hover { background: var(--fill-1); }
.lk-cell input { margin: 0; }
.lk-row:has(input:checked) .name { color: var(--text); }

/* згрупований список вибору (гілки, інтереси, добровільні місії) */
.pick-list { background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); overflow: hidden; }
.pick { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 16px 16px 18px; cursor: pointer; transition: background-color var(--t-1); }
.pick + .pick::before { content: ''; position: absolute; top: 0; left: 56px; right: 0; height: 1px; background: var(--sep); }
.pick:hover { background: var(--fill-1); }
.pick > input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pick .dots { color: var(--text-4); transition: color var(--t-2); }
.pick .pick-text { min-width: 0; }
.pick b { display: block; font: 600 15px/1.3 var(--font-display); letter-spacing: -.01em; color: var(--text); }
.pick .about { display: block; margin-top: 3px; font-size: 15px; line-height: 1.45; color: var(--text-2); }
.pick .why { display: block; margin-top: 6px; font: 400 12px/1.45 var(--ui); color: var(--text-3); }
.pick .end { display: flex; align-items: center; gap: 12px; }
.pick .mark { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--sep-2); transition: background-color var(--t-1), box-shadow var(--t-1); }
.pick:has(input:checked) { background: var(--signal-fill); }
.pick:has(input:checked) .dots { color: var(--signal); }
.pick:has(input:checked) .mark { background: var(--signal) var(--check) center / 14px no-repeat; box-shadow: none; }
.pick:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: -2px; }
.pick:has(input:disabled) { cursor: default; }
.pick:has(input:disabled) .pick-text { color: var(--text-3); }
.pick:has(input:disabled) b { color: var(--text-2); }
.pick:has(input:disabled) .mark { opacity: .5; }
.pick:has(input:checked) .tag.sig { background: transparent; box-shadow: inset 0 0 0 1px rgb(255 90 42 / .55); }
.pick.static { cursor: default; }
.pick.static:hover { background: none; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.stats .tag { height: 28px; padding: 0 11px 0 9px; font-size: 13px; }
.stats .tag .g { width: 13px; height: 13px; }
.done-list { list-style: none; margin: 0 0 18px; padding: 2px 16px; background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); }
.done-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; margin: 0; }
.done-list li + li { border-top: 1px solid var(--sep); }
.done-list .n { font-variant-numeric: tabular-nums; color: var(--text-3); text-align: right; font-size: 13px; }
.done-list .t { color: var(--text); min-width: 0; }
.done-list .r { display: inline-flex; align-items: center; gap: 7px; font: 500 13px var(--ui); color: var(--text-2); white-space: nowrap; }
.inbox:empty { display: none; }
.inbox-card { margin: 0 0 24px; padding: 14px 16px 12px; background: var(--card); border-radius: var(--r-4); box-shadow: inset 0 0 0 1px rgb(255 90 42 / .35), var(--shadow-2); animation: rise var(--t-4) var(--ease-out) both; }
.inbox-head { display: flex; align-items: center; gap: 8px; font: 600 13px var(--ui); color: var(--signal-text); margin-bottom: 8px; }
.inbox-msg { font-size: 15px; line-height: 1.55; color: var(--text); }
.inbox-msg + .inbox-msg { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sep); }
.inbox-msg > :last-child { margin-bottom: 0; }
.inbox-msg .q { color: var(--text-3); font-size: 13px; margin-bottom: 4px; }
.inbox-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 12px; }
.spec { margin: 8px 0 24px; padding: 2px 18px; background: var(--card); border-radius: var(--r-4); box-shadow: var(--edge); }
.spec-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; padding: 13px 0; }
.spec-row + .spec-row { border-top: 1px solid var(--sep); }
.spec-row .k { font: 500 13px/1.6 var(--ui); color: var(--text-3); }
.spec-row .v { color: var(--text); white-space: pre-line; }
.spec-row .v .g { margin-right: 8px; }
.cta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.sticky-cta { position: sticky; bottom: 16px; z-index: 3; margin: 24px 0 0; padding: 10px; background: var(--material); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6); border-radius: var(--r-5); box-shadow: var(--shadow-2), var(--edge-2); }
.sticky-cta .cta-row { margin: 0; }
.sticky-cta .form-msg { margin: 0; }

.mobile-only { display: none; }
.mobile-note { align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 22px; padding: 12px 12px 12px 16px; font-size: 13px; line-height: 1.45; color: var(--text-2); background: var(--fill-1); border-radius: var(--r-4); }
.mobile-note .btn { flex: none; }
body.ws-body { --rail-w: 212px; }

@media (max-width: 1280px) {
  body.ws-body { --rail-w: 180px; }
  .body { grid-template-columns: 180px minmax(380px, 1fr) minmax(0, 1.1fr); }
  .body.solo { grid-template-columns: 180px minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  body.ws-body { --rail-w: 64px; }
  .body { grid-template-columns: 64px minmax(360px, 1fr) minmax(0, 1.05fr); }
  .body.solo { grid-template-columns: 64px minmax(0, 1fr); }
  .rail { padding: 10px 6px; }
  .rail-stage { display: flex; justify-content: center; padding: 12px 0 6px; }
  .rail-stage .nm, .rail-stage .note, .rail-sub { display: none; }
  .rail-stage::before { content: ''; width: 16px; height: 1px; background: var(--sep-2); }
  .rail-stage.here::before { background: var(--signal); }
  .rail-item { grid-template-columns: 10px auto; padding: 0 8px; gap: 6px; }
  .rail-item .ttl { display: none; }
  .rail-note { display: none; }
  .stages > span { display: none; }
}
@media (max-width: 900px) {
  body.ws-body { --rail-w: 0px; }
  body.ws-body { height: auto; overflow: auto; }
  .ws { height: auto; min-height: 100vh; grid-template-rows: 52px auto; }
  .body, .body.solo { grid-template-columns: 1fr; }
  .rail, .bench, .drawer { display: none; }
  .top .desk, .stages { display: none; }
  .mobile-only { display: block; }
  .mobile-note { display: flex; }
  .entry { grid-template-columns: 1fr; }
  .entry-side { display: none; }
  .spec-row { grid-template-columns: 1fr; gap: 2px; }
  .crumbs { border-left: 0; padding-left: 0; }
  .crumbs > :not(.ttl), .crumbs .ttl .t { display: none; }
  .top { gap: 10px; padding: 0 8px 0 14px; }
  .brief { padding: 26px 18px 48px; }
  .sticky-cta { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
    transition-duration: var(--t-1) !important; transition-delay: 0ms !important;
    transition-property: opacity, color, background-color, border-color, box-shadow, text-decoration-color !important;
    scroll-behavior: auto !important;
  }
}
