/* Эфир — основа: шрифты, токены, типографика, кнопки, формы, состояния. Ламповый приёмник 70-х в ночном космосе. */

@font-face { font-family: 'Unbounded Variable'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(../fonts/unbounded-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded Variable'; font-style: normal; font-display: swap; font-weight: 200 900; src: url(../fonts/unbounded-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 400; src: url(../fonts/ibm-plex-sans-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 500; src: url(../fonts/ibm-plex-sans-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 600; src: url(../fonts/ibm-plex-sans-cyrillic-600-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 400; src: url(../fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 500; src: url(../fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 600; src: url(../fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url(../fonts/ibm-plex-mono-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url(../fonts/ibm-plex-mono-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url(../fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url(../fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: dark;
  --ink: #0d0906;
  --wood: #17100a;
  --wood-2: #22170e;
  --walnut: #34210f;
  --brass: #c8a15a;
  --brass-hi: #f3dca4;
  --brass-lo: #6f5324;
  --brass-deep: #3d2d12;
  --amber: #ffb347;
  --amber-hot: #ffd89a;
  --amber-dim: #8a5413;
  --paper: #f2e6cf;
  --mute: #bdac8c;
  --faint: #9b8b6c;
  --needle: #ff4b2b;
  --eye: #8dffb0;
  --line: rgba(200, 161, 90, .24);
  --line-soft: rgba(200, 161, 90, .12);
  --glass: rgba(23, 16, 10, .72);
  --f-display: 'Unbounded Variable', 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --f-text: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --spring: cubic-bezier(.2, 1.45, .4, 1);
  --header-h: 64px;
  --tabbar-h: 0px;
  --mini-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0; min-height: 100dvh; background: var(--ink); color: var(--paper);
  font: 400 15px/1.55 var(--f-text); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--amber-hot); text-decoration-color: rgba(255, 216, 154, .4); text-underline-offset: 3px; }
a:hover { color: var(--amber); text-decoration-color: currentColor; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 600; line-height: 1.12; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: rgba(255, 179, 71, .35); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 6px; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 200; padding: 12px 18px; border-radius: 12px; background: var(--amber); color: #1c1005; font-weight: 600; text-decoration: none; transition: top .2s; }
.skip:focus { top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

* { scrollbar-width: thin; scrollbar-color: var(--brass-lo) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--brass-lo); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

/* иконки */
.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.fill { fill: currentColor; stroke: none; }

/* зерно плёнки и общий фон */
.grain { position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .08; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.1s steps(6) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 17% { transform: translate(-3%, 2%); } 34% { transform: translate(2%, -4%); } 51% { transform: translate(-4%, -1%); } 68% { transform: translate(3%, 3%); } 85% { transform: translate(-1%, 4%); } 100% { transform: translate(0, 0); } }

/* кнопки: «клавиши» приёмника */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: var(--h); padding: 0 1.15em;
  border-radius: 12px; border: 1px solid var(--brass-lo); color: var(--paper); text-decoration: none; white-space: nowrap;
  background: linear-gradient(180deg, #3a2a16 0%, #261a0d 100%); box-shadow: inset 0 1px 0 rgba(255, 226, 160, .22), inset 0 -2px 0 rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .45);
  font: 500 .9375rem/1 var(--f-text); transition: transform .12s var(--ease), box-shadow .2s, border-color .2s, background .2s, color .2s;
}
.btn:hover { border-color: var(--brass); color: var(--brass-hi); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.lamp { color: #1c1005; border-color: #ffd89a; font-weight: 600;
  background: linear-gradient(180deg, #ffd089 0%, #ffb347 55%, #e79520 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(120, 60, 0, .35), 0 0 0 0 rgba(255, 179, 71, 0), 0 4px 16px rgba(255, 179, 71, .28); }
.btn.lamp:hover { color: #1c1005; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -2px 0 rgba(120, 60, 0, .35), 0 0 22px rgba(255, 179, 71, .55); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.ghost:hover { background: rgba(255, 179, 71, .08); }
.btn.sm { --h: 36px; padding: 0 .9em; font-size: .875rem; border-radius: 10px; }
.btn.icon { width: var(--h); padding: 0; }
.btn.danger:hover { border-color: var(--needle); color: #ff9a85; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--mute);
  transition: color .2s, background .2s, border-color .2s, transform .12s;
}
.icon-btn:hover { color: var(--amber-hot); background: rgba(255, 179, 71, .1); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.on { color: var(--needle); }
.icon-btn.on .i { filter: drop-shadow(0 0 6px rgba(255, 75, 43, .6)); }
.icon-btn.sm { width: 36px; height: 36px; }

/* фишки-фильтры */
.chip {
  display: inline-flex; align-items: center; gap: .45em; min-height: 36px; padding: 0 .95em; border-radius: 999px; border: 1px solid var(--line); background: rgba(34, 23, 14, .6);
  color: var(--mute); font: 500 .875rem/1 var(--f-text); transition: color .2s, background .2s, border-color .2s, box-shadow .2s; white-space: nowrap;
}
.chip:hover { color: var(--paper); border-color: var(--brass-lo); }
.chip[aria-pressed='true'], .chip.on { color: var(--amber-hot); border-color: var(--amber); background: rgba(255, 179, 71, .13); box-shadow: 0 0 14px rgba(255, 179, 71, .22); }
.chip .n { font: 400 .75rem var(--f-mono); color: var(--faint); }

/* поля */
.field { display: grid; gap: 6px; }
.field > span { font-size: .8125rem; color: var(--mute); }
.input, select.input {
  width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(13, 9, 6, .75); color: var(--paper);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5); transition: border-color .2s, box-shadow .2s; font-size: 16px;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--brass-lo); }
.input:focus-visible { border-color: var(--amber); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(255, 179, 71, .22); outline: none; }
select.input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' fill='none' stroke='%23c8a15a' stroke-width='1.6' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; }
select.input option { background: #22170e; color: var(--paper); }
.err { color: #ff9a85; font-size: .875rem; min-height: 1.3em; }

/* типографика */
.display { font-family: var(--f-display); font-weight: 700; letter-spacing: .02em; }
.mono { font-family: var(--f-mono); }
.mute { color: var(--mute); }
.nowrap { white-space: nowrap; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* состояния */
.skel { position: relative; overflow: hidden; background: rgba(200, 161, 90, .08); border-radius: 10px; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 216, 154, .1), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.state {
  display: grid; place-items: center; gap: 12px; text-align: center; padding: 40px 20px; border: 1px dashed var(--line); border-radius: 18px; background: rgba(23, 16, 10, .5); color: var(--mute);
}
.state h3 { font-size: 1.05rem; color: var(--paper); }
.state p { max-width: 42ch; }
.state .i-big { width: 40px; height: 40px; color: var(--brass); opacity: .85; }
.state.err-state .i-big { color: var(--needle); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255, 179, 71, .25); border-top-color: var(--amber); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* тосты */
.toasts { position: fixed; left: 50%; bottom: calc(var(--mini-h) + var(--tabbar-h) + var(--safe-b) + 16px); transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 14px; border: 1px solid var(--brass-lo);
  background: rgba(28, 19, 11, .96); box-shadow: 0 10px 30px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .4); animation: toast-in .35s var(--spring);
}
.toast.out { animation: toast-out .25s var(--ease) forwards; }
.toast .t { flex: 1; font-size: .9rem; }
.toast.err { border-color: var(--needle); }
.toast.ok .i-st { color: var(--eye); }
.toast.err .i-st { color: var(--needle); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* модальные окна */
.modal-back { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 16px; background: rgba(8, 5, 3, .78); backdrop-filter: blur(6px); animation: fade .2s var(--ease); overflow-y: auto; }
.modal { position: relative; width: min(100%, 480px); max-height: calc(100dvh - 32px); overflow: auto; border-radius: 22px; border: 1px solid var(--brass-lo); background: linear-gradient(180deg, #261a0e, #17100a); box-shadow: 0 30px 80px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 226, 160, .15); animation: pop .35s var(--spring); }
.modal-x { position: absolute; top: 10px; right: 10px; z-index: 2; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .grain { animation: none; }
  .skel::after { display: none; }
}
