/* Основа: токены, фон, типографика, кнопки, поля, оболочки «сайт» и «приложение». */
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
:root {
  color-scheme: dark;
  /* тёплый графит, четыре уровня глубины */
  --ground: #161513;
  --panel: #1e1d1a;
  --raised: #272521;
  --lift: #33302a;
  --edge: rgba(244, 239, 230, .1);
  --edge-strong: rgba(244, 239, 230, .2);
  --text: #f4efe6;
  --muted: #aaa397;
  /* действие — хурма, статус «применён» — мята. Градиентов и свечения у кнопок нет */
  --cta: #ff6b3d;
  --cta-deep: #c8441c;
  --cta-ink: #1b1612;
  --route: #8fe3bf;
  --signal: var(--route);
  --ink: #12231b;
  --wait: #ffd666;
  --fail: #ff7a9a;
  --idle: #8b867c;
  --display: "Bahnschrift", "DIN Alternate", "DIN Condensed", "Roboto Condensed", sans-serif-condensed, "Arial Narrow", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, "SF Mono", monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --r-lg: 20px;
  --r-md: 12px;
  --r-sm: 8px;
  --out: cubic-bezier(.22, 1, .36, 1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 48px -24px rgba(0, 0, 0, .7);
  font: 16px/1.5 var(--body);
  background: var(--ground);
  color: var(--text);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 96px; overflow-x: clip; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; }
/* Фон: мягкое свечение и точечная сетка, закреплённые за экраном */
body::before { content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(70% 46% at 50% -8%, rgba(255, 107, 61, .09), transparent 70%); }

.wrap, body[data-shell=site] main, body[data-shell=site] footer { width: min(1200px, 100% - 2 * var(--gutter)); margin-inline: auto; }
main { flex: 1; padding: clamp(28px, 5vw, 56px) 0 80px; }
main:focus { outline: none; }
footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--edge); padding: 24px 0 36px; color: var(--muted); font-size: .875rem; }
footer span:last-child { margin-left: auto; }
footer .site-check { margin-left: 12px; font-family: var(--mono); font-size: .75rem; opacity: .7; }

h1, h2, h3, p, dl, dd, ol, ul, fieldset { margin: 0; }
h1, h2, h3, .status-title { font-family: var(--display); font-stretch: 88%; font-weight: 600; line-height: 1.06; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 3.2vw, 2.75rem); }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; letter-spacing: 0; }
p { max-width: 68ch; text-wrap: pretty; }
.lead { color: var(--muted); font-size: 1.0625rem; }
small { font-size: .8125rem; }
a { color: var(--text); text-decoration-color: var(--edge-strong); text-underline-offset: .22em; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--route); text-decoration-color: currentColor; }
code, .mono { font-family: var(--mono); font-size: .9em; }
code { padding: .1em .45em; background: var(--lift); border-radius: 5px; }
.empty { color: var(--muted); font-style: italic; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
.ic { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--route); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: 12px; transform: translateY(-200%); background: var(--route); color: var(--ink); padding: 10px 14px; border-radius: 8px; z-index: 50; font-weight: 600; }
.skip:focus { transform: none; }

/* ---------- Кнопки: плотные, с «ходом» при нажатии ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 48px; padding: .6rem 1.35rem; border: 0; border-radius: 999px; background: var(--cta); color: var(--cta-ink); font: 700 .9375rem/1.2 var(--body); text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: 0 4px 0 var(--cta-deep); transition: transform .15s var(--out), box-shadow .15s var(--out), background-color .2s; }
.btn:hover { color: var(--cta-ink); background: #ff8259; transform: translateY(-1px); box-shadow: 0 5px 0 var(--cta-deep); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--cta-deep); }
.btn .ic { transition: transform .2s var(--out); }
.btn:hover .ic:last-child { transform: translateX(4px); }
.btn-ghost, .btn-quiet { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--edge-strong); }
.btn-ghost:hover { color: var(--text); background: rgba(244, 239, 230, .08); box-shadow: inset 0 0 0 2px var(--text); transform: none; }
.btn-ghost:active { transform: scale(.98); box-shadow: inset 0 0 0 2px var(--text); }
.btn-quiet { min-height: 38px; padding: .4rem .9rem; font-size: .875rem; box-shadow: none; }
.btn-quiet:hover { color: var(--text); background: rgba(244, 239, 230, .08); box-shadow: none; transform: none; }
.btn-ink { background: var(--cta-ink); color: var(--text); box-shadow: 0 4px 0 rgba(27, 22, 18, .35); min-height: 58px; padding-inline: 1.8rem; font-size: 1.0625rem; }
.btn-ink:hover { background: #2b241e; color: var(--text); box-shadow: 0 5px 0 rgba(27, 22, 18, .35); }
.btn-small { min-height: 40px; padding: .4rem 1.1rem; font-size: .875rem; box-shadow: 0 3px 0 var(--cta-deep); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- Поля ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-size: .875rem; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 46px; padding: .6rem .8rem; background: rgba(6, 9, 12, .6); color: var(--text); border: 1px solid var(--edge-strong); border-radius: 10px; font: inherit; font-size: 1rem; transition: border-color .15s, box-shadow .15s; }
input:hover, textarea:hover { border-color: rgba(226, 238, 248, .32); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--route); box-shadow: 0 0 0 4px rgba(110, 240, 205, .16); }
textarea { min-height: 6.5rem; resize: vertical; }
input::placeholder { color: #6f7a86; }
input[readonly] { background: var(--raised); }
input[type=radio], input[type=checkbox] { width: 18px; height: 18px; min-height: 0; flex: none; margin: 0; padding: 0; accent-color: var(--route); box-shadow: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: .875rem; color: var(--muted); }

/* ---------- Знак и оболочка сайта ---------- */
.brand { display: inline-flex; align-items: center; gap: .55em; font: 600 1.3rem/1 var(--display); letter-spacing: .01em; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-sub { color: var(--muted); font-weight: 400; }
.brand-mark { flex: none; width: 28px; height: 28px; }
.bm-bg { fill: var(--cta); }
.bm-ring { fill: none; stroke: var(--cta-ink); stroke-width: 3.6; }
.bm-dot { fill: var(--text); }
.site-top { position: sticky; top: 0; z-index: 30; background: rgba(22, 21, 19, .72); backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--edge); }
.site-top .wrap { display: flex; align-items: center; gap: 8px 24px; min-height: 64px; }
.site-nav { display: none; gap: 2px; margin-inline: auto; }
.site-account { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.jump { padding: .5rem .8rem; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-size: .9375rem; cursor: pointer; transition: color .15s, background-color .15s; }
.jump:hover { color: var(--text); background: rgba(226, 238, 248, .07); }
@media (min-width: 900px) { .site-nav { display: flex; } .site-account { margin-left: 0; } }
@media (max-width: 480px) { .site-top .brand-sub, .site-account .btn-quiet { display: none; } }

/* ---------- Оболочка приложения: боковая панель и нижняя навигация ---------- */
body[data-shell=app] main, body[data-shell=app] footer { width: auto; margin-inline: var(--gutter); }
.side { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--gutter); background: rgba(22, 21, 19, .94); border-bottom: 1px solid var(--edge); }
.side-nav { position: fixed; z-index: 40; left: 10px; right: 10px; bottom: 10px; display: flex; padding: 6px; border: 1px solid var(--edge-strong); border-radius: 18px; background: rgba(30, 29, 26, .86); backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .8); }
.side-nav a { flex: 1; display: grid; justify-items: center; gap: 3px; min-width: 0; padding: 7px 2px 6px; border-radius: 12px; color: var(--muted); font-size: .6875rem; text-decoration: none; transition: color .15s, background-color .15s; }
.side-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav .ic { width: 22px; height: 22px; }
.side-nav a:hover { color: var(--text); }
.side-nav a[aria-current] { color: var(--route); background: rgba(110, 240, 205, .1); }
.side-nav a:focus-visible { outline-offset: -2px; }
.side-foot { display: flex; align-items: center; }
.side-card { display: none; }
.side-link { display: inline-flex; align-items: center; gap: 8px; padding: .45rem .6rem; border-radius: 9px; color: var(--muted); font-size: .875rem; text-decoration: none; }
.side-link:hover { color: var(--text); background: rgba(226, 238, 248, .07); }
body[data-shell=app] main { padding-bottom: 120px; }
body[data-shell=app] footer { padding-bottom: 110px; }
@media (max-width: 999px) { .side-link span { display: none; } }
@media (min-width: 1000px) {
  body[data-shell=app] { display: grid; grid-template-columns: 272px minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  body[data-shell=app] > header { display: contents; }
  body[data-shell=app] .preview-bar { grid-column: 1 / -1; grid-row: 1; }
  .side { grid-column: 1; grid-row: 2 / 4; align-self: start; height: 100vh; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 28px; padding: 22px 16px; border-bottom: 0; border-right: 1px solid var(--edge); background: rgba(26, 25, 22, .7); }
  .side .brand { padding: 0 4px; font-size: 1.15rem; min-width: 0; }
  .side-nav { position: static; flex-direction: column; gap: 2px; padding: 0; border: 0; border-radius: 0; background: none; backdrop-filter: none; box-shadow: none; }
  .side-nav a { position: relative; flex: none; display: flex; align-items: center; justify-items: start; gap: 12px; padding: .65rem .75rem; border-radius: 10px; font-size: .9375rem; }
  .side-nav .ic { width: 20px; height: 20px; }
  .side-nav a:hover { background: rgba(226, 238, 248, .06); }
  .side-nav a[aria-current] { color: var(--text); background: linear-gradient(90deg, rgba(110, 240, 205, .14), rgba(110, 240, 205, .02)); }
  .side-nav a[aria-current] .ic { color: var(--route); }
  .side-nav a[aria-current]::before { content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal); box-shadow: 0 0 12px var(--route); }
  .side-foot { flex-direction: column; align-items: stretch; gap: 10px; margin-top: auto; }
  .side-card { display: grid; gap: 6px; justify-items: start; padding: 14px; border: 1px solid var(--edge); border-radius: 14px; background: rgba(226, 238, 248, .03); color: var(--muted); font-size: .8125rem; }
  .side-label { font-size: .75rem; }
  .side-card b { color: var(--text); font: 600 1.0625rem var(--display); }
  body[data-shell=app] main { grid-column: 2; grid-row: 2; max-width: 1180px; width: 100%; margin: 0; padding: 40px clamp(24px, 3.4vw, 48px) 72px; justify-self: center; }
  body[data-shell=app] footer { grid-column: 2; grid-row: 3; margin-inline: clamp(24px, 3.4vw, 48px); padding-bottom: 32px; }
}

/* Переход между экранами */
::view-transition-old(root) { animation: fade-out .18s ease both; }
::view-transition-new(root) { animation: fade-in .32s var(--out) both; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } }

/* Движение. data-reduce повторяет системную настройку: всё крупное выключается, маленькие петли с классом m-keep
   остаются, но идут медленнее. data-paused ставится кнопкой паузы и останавливает петли (класс loop). */
html[data-reduce] *:not(.m-keep), html[data-reduce] *:not(.m-keep)::before, html[data-reduce] *:not(.m-keep)::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html[data-reduce] :is(.bp-runner, .bp-lift, .bp-tilt, .bp-shadow, .bp-arc-trail) { animation-duration: 10s; }
html[data-reduce] .ticker-track { animation-duration: 84s; }
html[data-reduce] .bp[data-state=pending] .bp-scan { animation-duration: 1.8s; }
html[data-reduce] .bp-sheen { animation: none; opacity: 0; }
html[data-reduce] .bp-wrap { animation-name: fade-in-only; }
@keyframes fade-in-only { from { opacity: 0; } }
html[data-paused] .loop, html[data-paused] .loop::before, html[data-paused] .loop::after,
[data-offscreen] .loop, [data-offscreen] .loop::before, [data-offscreen] .loop::after { animation-play-state: paused !important; }
html[data-paused] :is(.bp-runner, .bp-lift, .bp-tilt, .bp-shadow, .bp-arc-trail) { animation-delay: -2.75s; }
