/* VIP Sound Club Radio — premium dark theme (v0.14.5) */

/* author display rules (e.g. .sheet { display:flex }) beat the UA [hidden]
   rule in the cascade — force-hide hidden nodes explicitly */
[hidden] { display: none !important; }

:root {
  --bg: #0f0f13;
  --bg-soft: #14141a;
  --card: rgba(255, 255, 255, .035);
  --card-strong: rgba(255, 255, 255, .06);
  --hairline: rgba(255, 255, 255, .07);
  --hairline-strong: rgba(255, 255, 255, .12);
  --rest: rgba(255, 255, 255, .1);
  --text: #ececf1;
  --muted: #8b8b96;
  --faint: #5d5d68;
  --gold-1: #f4c95d;
  --gold-2: #d99a2b;
  --gold-3: #8a5a13;
  --gold-foil: #f4d78d;
  --accent: var(--gold-1);
  --accent-2: var(--gold-2);
  --accent-dim: rgba(244, 201, 93, .14);
  --accent-glow: rgba(244, 201, 93, .35);
  --live: #ff5d5d;
  --ok: #62d992;
  --warn: #ffb454;
  --danger: #ff6b6b;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --fs-np: 19px;
  --fs-sheet: 18px;
  --fs-row: 15px;
  --fs-state: 14px;
  --fs-sub: 13px;
  --fs-about: 14px;
  --fs-stats: 15px;
  --shadow-card: 0 10px 34px rgba(0, 0, 0, .35);
  --ease-spring: cubic-bezier(.22, 1.4, .36, 1);
  --grad-accent: linear-gradient(135deg, var(--gold-1), var(--gold-2));
}

body.accent-ruby {
  --accent: #ff6d84;
  --accent-2: #d43a56;
  --accent-dim: rgba(255, 109, 132, .14);
  --accent-glow: rgba(255, 109, 132, .35);
  --grad-accent: linear-gradient(135deg, #ff8ba0, #d43a56);
}

body.accent-diamond {
  --accent: #9fd8e8;
  --accent-2: #58a6c3;
  --accent-dim: rgba(159, 216, 232, .14);
  --accent-glow: rgba(159, 216, 232, .35);
  --grad-accent: linear-gradient(135deg, #c8ecf7, #58a6c3);
}

body.theme-diamond {
  --gold-1: #bfe9f4;
  --gold-2: #6fb6d6;
  --gold-3: #2e6e8e;
  --gold-foil: #d9f4fb;
}

body.scale-lg {
  --fs-np: 21px; --fs-sheet: 20px; --fs-row: 17px; --fs-state: 16px;
  --fs-sub: 15px; --fs-about: 16px; --fs-stats: 17px;
}

body.scale-xl {
  --fs-np: 23px; --fs-sheet: 22px; --fs-row: 19px; --fs-state: 18px;
  --fs-sub: 16px; --fs-about: 18px; --fs-stats: 19px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  height: 100%;
  background: #0f0f13; /* overscroll reveal area — never the UA white */
  overscroll-behavior-y: none; /* kill rubber-band artifacts in the TWA shell */
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 520px at -10% -6%, rgba(212, 154, 43, .13), transparent 60%),
    radial-gradient(900px 500px at 108% 14%, rgba(120, 90, 20, .08), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 400 15px/1.45 -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .01em;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

body.theme-oled { --bg: #000; --bg-soft: #0a0a0d; --card: rgba(255,255,255,.028); }

/* ---------- light theme (v0.11.5) — тёплый крем + золото, ничего лишнего ---------- */
body.theme-light {
  --bg: #f6f3ec;
  --bg-soft: #ede9df;
  --card: rgba(30, 24, 10, .05);
  --card-strong: rgba(30, 24, 10, .08);
  --hairline: rgba(30, 24, 10, .1);
  --hairline-strong: rgba(30, 24, 10, .17);
  --rest: rgba(30, 24, 10, .1);
  --text: #241e12;
  --muted: #6f6753;
  --faint: #a49b85;
  --gold-1: #dca62f;
  --gold-2: #b07a12;
  --gold-3: #7a520e;
  --gold-foil: #a97712;
  --accent: #a97712;
  --accent-2: #b07a12;
  --accent-dim: rgba(169, 119, 18, .16);
  --accent-glow: rgba(169, 119, 18, .45);
  --live: #d84a4a;
  --ok: #1f9153;
  --warn: #c67c14;
  --danger: #cc4444;
  --shadow-card: 0 10px 30px rgba(88, 66, 18, .12);
  background:
    radial-gradient(1100px 520px at -10% -6%, rgba(220, 166, 47, .16), transparent 60%),
    radial-gradient(900px 500px at 108% 14%, rgba(150, 105, 25, .09), transparent 55%),
    var(--bg);
}
body.theme-light::after { opacity: .03; }
body.theme-light .topbar::before { background: linear-gradient(rgba(246, 243, 236, .94), rgba(246, 243, 236, .6) 70%, transparent); }
body.theme-light .sheet-backdrop { background: rgba(64, 50, 22, .32); }
body.theme-light .sheet {
  background: linear-gradient(rgba(255, 254, 250, .985), rgba(244, 241, 233, .985));
  box-shadow: 0 -18px 60px rgba(88, 66, 18, .2);
}
body.theme-light .sheet__grip { background: rgba(30, 24, 10, .28); }
body.theme-light .welcome {
  background:
    radial-gradient(700px 420px at 50% -8%, rgba(220, 166, 47, .28), transparent 62%),
    rgba(246, 243, 236, .97);
}
body.theme-light .welcome__disc { box-shadow: 0 14px 40px rgba(88, 66, 18, .25); }
body.theme-light .toast { background: rgba(255, 254, 250, .97); box-shadow: 0 14px 40px rgba(88, 66, 18, .18); }
body.theme-light .toast--gold {
  border-color: rgba(176, 122, 18, .5);
  background: linear-gradient(120deg, rgba(255, 243, 205, .95), rgba(255, 254, 250, .97) 55%);
  color: #7a520e;
}
body.theme-light .volbubble { background: #fffef9; }
body.theme-light .importarea { background: rgba(30, 24, 10, .05); }
body.theme-light .favsearch { background: rgba(30, 24, 10, .045); }
body.theme-light .favsortseg { background: rgba(30, 24, 10, .045); }
body.theme-light .favsortseg__thumb { box-shadow: 0 1px 6px rgba(30, 24, 10, .12), inset 0 1px 0 rgba(255, 255, 255, .5); }
body.theme-light .switch { background: rgba(30, 24, 10, .12); }
body.theme-light .switch:checked { background: var(--grad-accent); border-color: transparent; }
body.theme-light .segment button[aria-checked="true"] { box-shadow: inset 0 0 14px rgba(255, 255, 255, .55); }
/* background-image (NOT the shorthand): the shorthand resets background-clip
   to border-box and the shimmering gold text degenerates into a solid block */
body.theme-light .np__track { background-image: linear-gradient(100deg, var(--gold-3), var(--gold-1) 45%, var(--gold-3)); }
body.theme-light #veil { display: none; }
body.theme-light .eqreset { background: rgba(30, 24, 10, .05); }
body.theme-light .eqrow__slider {
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), rgba(30, 24, 10, .14) var(--fill, 50%));
}
body.theme-light .eqrow__slider::-webkit-slider-thumb { background: #fffef9; }
/* accents stay readable on cream */
body.theme-light.accent-ruby {
  --accent: #d43a56; --accent-2: #b02c46;
  --accent-dim: rgba(212, 58, 86, .14); --accent-glow: rgba(212, 58, 86, .4);
  --grad-accent: linear-gradient(135deg, #e86a80, #b02c46);
}
body.theme-light.accent-diamond {
  --accent: #3d8fb0; --accent-2: #2e6e8e;
  --accent-dim: rgba(61, 143, 176, .14); --accent-glow: rgba(61, 143, 176, .4);
  --grad-accent: linear-gradient(135deg, #6fb6d6, #2e6e8e);
}

/* film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
svg { fill: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
}

/* v0.14.2: фон+блюр вынесены в ::before с вертикальной mask-градиентом.
   Причина: backdrop-filter обрезается ЖЁСТКОЙ нижней кромкой topbar —
   в светлой теме размытое золотое пятно тонарма, зашедшего под шапку,
   обрывалось видимой горизонтальной линией (пиксельно: +26 канала B на
   стыке y=38/39). Маска заставляет блюр плавно затухать — шва нет,
   текст шапки (реальные дети, z выше ::before) не затрагивается. */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(15, 15, 19, .92), rgba(15, 15, 19, .55) 70%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
}

.wordmark {
  position: relative;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .34em;
  text-transform: uppercase;
}

/* solid accent, no background-clip:text — clipped gradient text is a known
   source of glyph-shaped rendering artifacts on Android WebView */
.wordmark b { color: var(--accent); }

.wordmark span { color: var(--muted); font-weight: 600; }

.topbar__right { display: flex; align-items: center; gap: 10px; }

/* v0.14.5: компактный лейбл «Sound Club» плавно сворачивается, когда в шапке
   появляется тикер now-playing — иначе на 390px обоим не хватает места.
   max-width-переход вместо display:none, чтобы смена выглядела намеренной. */
.wordmark span {
  display: inline-block;
  max-width: 140px;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  transition: max-width .45s cubic-bezier(.3, .7, .3, 1), opacity .3s ease;
}

.topbar.has-onair .wordmark span { max-width: 0; opacity: 0; }

/* v0.14.5: now-playing тикер в шапке. Зачем: большой заголовок трека уходит
   за экран при прокрутке, а шапка sticky — тикер держит контекст «что играет»
   в любой точке приложения. Тап открывает карточку трека из любого места. */
.onair {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--card);
  text-align: left;
  overflow: hidden;
  transition: border-color .3s, background .3s;
}

.onair:active { border-color: var(--accent-dim); background: var(--card-strong); }

.onair.is-fresh { animation: onairIn .55s cubic-bezier(.2, .9, .3, 1.15) both; }

.onair__dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px var(--accent-glow);
  animation: onairPulse 2.2s ease-in-out infinite;
}

.onair__tag {
  flex: none;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
}

.onair__title {
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* v0.15.0 — бегущая строка заголовка тикера: включается только когда текст
   реально не влезает (JS замеряет). Плавный ping-pong с паузой на краях,
   маска мягко гасит текст у границ пилюли — без «рези». */
.onair__title.is-flow {
  text-overflow: clip;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 12px), transparent 100%);
}

.onair__title.is-flow .onair__run {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  animation: onairRun var(--run-dur, 12s) cubic-bezier(.45, 0, .55, 1) 1.4s infinite alternate;
}

@keyframes onairRun {
  from { transform: translateX(0); }
  to { transform: translateX(var(--run-x, -40px)); }
}

body.theme-light .onair { background: rgba(255, 253, 247, .6); box-shadow: 0 2px 10px rgba(88, 66, 18, .07); }

@keyframes onairIn { from { opacity: 0; transform: translateY(-9px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes onairPulse { 50% { opacity: .35; transform: scale(.8); } }

.netdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(98, 217, 146, .7);
  transition: background .3s, box-shadow .3s;
}

.netdot.is-off { background: var(--danger); box-shadow: 0 0 8px rgba(255, 107, 107, .7); animation: netPulse 1.1s ease-in-out infinite; }
.netdot.is-flaky { background: var(--warn); box-shadow: 0 0 8px rgba(255, 180, 84, .75); animation: netPulse 1.1s ease-in-out infinite; }

@keyframes netPulse { 50% { opacity: .35; } }

.live {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 93, 93, .5);
  background: rgba(255, 93, 93, .12);
  color: #ffb0b0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  overflow: hidden;
}

.live::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .28) 50%, transparent 60%);
  background-size: 240% 100%;
  animation: liveSweep 4.8s linear infinite;
}

@keyframes liveSweep { from { background-position: 200% 0; } to { background-position: -140% 0; } }

.live__eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.live__eq::before, .live__eq::after { content: ""; width: 2.5px; background: currentColor; border-radius: 1px; animation: eqHop 0.9s ease-in-out infinite; }
.live__eq::before { height: 60%; }
.live__eq::after { height: 100%; animation-delay: .3s; }

@keyframes eqHop { 50% { transform: scaleY(.4); } }

/* ---------- shell ---------- */

.shell {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 6px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 0 auto;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.cardtitle {
  padding: 14px 18px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- stage / vinyl ---------- */

.stage { overflow-x: clip; }

.disczone {
  position: relative;
  display: grid;
  place-items: center;
  padding: 18px 0 8px;
}

/* v0.14.1: will-change убран — постоянный composited layer давал прямоугольный шов в светлой теме; слои создаются только на время parallax-скролла */
.discwrap { position: relative; transform: translateX(var(--par, 0)); }

.disc {
  position: relative;
  width: min(66vw, 240px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #26262e 0 6%, #17171d 7% 12%, #1d1d24 13% 19%, #16161c 20% 27%, #1c1c23 28% 35%, #15151b 36% 44%, #1b1b22 45% 55%, #14141a 56% 66%, #1a1a21 67% 78%, #131318 79% 100%);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, .6),
    inset 0 0 0 1px rgba(255, 255, 255, .04),
    inset 0 0 60px rgba(0, 0, 0, .55);
  display: grid;
  place-items: center;
}

body.playing .disc { animation: spin 9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.disc__grooves {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, transparent 0 5px, rgba(255, 255, 255, .016) 5px 6px);
  mask-image: radial-gradient(circle, transparent 0 26%, #000 27%);
  -webkit-mask-image: radial-gradient(circle, transparent 0 26%, #000 27%);
}

.disc__label {
  position: relative;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--grad-accent);
  display: grid;
  place-content: center;
  text-align: center;
  color: #17130a;
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, .18), 0 2px 10px rgba(0, 0, 0, .4);
}

.disc__label span { font-weight: 800; font-size: 21px; letter-spacing: .12em; }
.disc__label em { font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: .5em; text-transform: uppercase; opacity: .75; }

.disc__gleam {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 78%, rgba(255, 244, 214, .14) 86%, transparent 94%);
  animation: spin 13s linear infinite reverse;
  pointer-events: none;
}

.pool {
  position: absolute;
  left: 50%;
  bottom: -26px;
  width: 62%;
  height: 26px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(244, 201, 93, .12), transparent 70%);
  filter: blur(6px);
  animation: poolBreathe 5.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes poolBreathe { 50% { opacity: .45; transform: translateX(-50%) scaleX(.92); } }

.tonearm {
  position: absolute;
  top: -6px;
  right: max(4px, calc(50% - 208px));
  width: 128px;
  height: 128px;
  transform-origin: 88% 12%;
  transform: rotate(-22deg);
  transition: transform .9s var(--ease-spring);
  pointer-events: none;
  /* v0.14.1: drop-shadow(.5/14px) + will-change + translateZ создавали постоянный
     composited layer: тень обрезалась по границе слоя → прямоугольный шов вокруг
     тонарма в светлой теме. Теперь слой не постоянный, тень мягкая и только в тёмной. */
  filter: drop-shadow(0 6px 9px rgba(0, 0, 0, .3));
}

body.playing .tonearm { transform: rotate(9deg); }

body.theme-light .tonearm { filter: none; }

/* v0.14.1: тень диска в светлой теме — тёплая и мягче (чёрная 60% давала грязный ореол) */
body.theme-light .disc {
  box-shadow:
    0 16px 38px rgba(70, 52, 12, .24),
    inset 0 0 0 1px rgba(255, 255, 255, .05),
    inset 0 0 60px rgba(0, 0, 0, .55);
}

.tonearm__pivot {
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad-accent);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25);
}

.tonearm__arm {
  position: absolute;
  top: 22px;
  right: 30px;
  width: 96px;
  height: 7px;
  border-radius: 4px;
  transform: rotate(46deg);
  transform-origin: 100% 50%;
  background: linear-gradient(#3a3a44, #23232b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

.tonearm__head {
  position: absolute;
  bottom: 8px;
  left: 4px;
  width: 30px;
  height: 16px;
  border-radius: 5px;
  background: var(--grad-accent);
  transform: rotate(46deg);
}

/* ---------- now playing ---------- */

.nowrow { display: flex; align-items: center; gap: 10px; padding: 26px 2px 0; }

.nprow {
  flex: 1;
  min-width: 0;
  text-align: left;
  border-radius: var(--r-sm);
}

.nprow__title {
  display: block;
  font-size: var(--fs-np);
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.np__artist { color: var(--muted); font-weight: 600; }

.np__track {
  background: linear-gradient(100deg, var(--gold-foil), #fff 45%, var(--gold-foil));
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleSheen 5.5s linear infinite;
}

body:not(.playing) .np__track { animation: none; background: none; color: var(--text); -webkit-text-fill-color: currentColor; }

@keyframes titleSheen { from { background-position: 200% 0; } to { background-position: -120% 0; } }

.heart {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--hairline);
  background: var(--card);
  transition: transform .15s var(--ease-spring), color .2s, border-color .2s;
}

.heart svg { width: 20px; height: 20px; }
.heart:active { transform: scale(.88); }
.heart.is-liked { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-dim); }
.heart.is-liked svg { animation: heartPop .45s var(--ease-spring); }

@keyframes heartPop { 40% { transform: scale(1.35); } }

.metarow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 2px 0;
  min-height: 26px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--card-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  white-space: nowrap;
}

.chip--age {
  border-color: var(--accent-glow);
  background: var(--accent-dim);
  color: var(--accent);
  text-transform: lowercase;
}

.chip--age::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: netPulse 1.6s infinite; }

.welcome-line { color: var(--faint); font-size: var(--fs-sub); }

/* ---------- visualizer ---------- */

.vizcard { padding: 12px 14px 10px; min-height: 150px; display: flex; flex-direction: column; transition: transform .15s; }
.vizcard:active { transform: scale(.99); }

#viz { width: 100%; flex: 1; display: block; min-height: 108px; }

.vizmeta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--faint);
  text-transform: uppercase;
}

.vizmeta__dot { opacity: .5; }
.vizmeta__buf { color: var(--muted); letter-spacing: .08em; }

/* ---------- transport ---------- */

.transport { padding: 18px; }

.transport__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  gap: 12px;
}

.ghostbtn {
  justify-self: end;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--hairline);
  background: var(--card-strong);
  transition: color .2s, border-color .2s, background .2s, transform .15s;
}

.ghostbtn:first-child { justify-self: start; }
.ghostbtn svg { width: 21px; height: 21px; }
.ghostbtn:active { transform: scale(.9); }
.ghostbtn.is-on { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-dim); }
.ghostbtn .ic-mute { display: none; }
.ghostbtn.is-muted .ic-vol { display: none; }
.ghostbtn.is-muted .ic-mute { display: block; }

.playfab {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--grad-accent);
  color: #17130a;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 34px var(--accent-glow), inset 0 -3px 8px rgba(0, 0, 0, .25);
  transition: transform .18s var(--ease-spring);
  margin-top: -8px;
}

.playfab:active { transform: scale(.93); }
.playfab svg { width: 34px; height: 34px; position: relative; z-index: 1; }
.playfab .ic-pause, body.playing .playfab .ic-play { display: none; }
body.playing .playfab .ic-pause { display: block; }

.playfab__halo {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--accent-glow);
  opacity: 0;
  pointer-events: none;
}

body.playing .playfab__halo { animation: halo 2.6s ease-out infinite; }

@keyframes halo { 0% { transform: scale(.85); opacity: .55; } 70% { transform: scale(1.25); opacity: 0; } 100% { opacity: 0; } }

/* sleep ring on the FAB */
body.sleeping .playfab::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--sleeppct, 100) * 1%), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
}

.volrow { position: relative; display: flex; align-items: center; margin-top: 16px; }

.volslider {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 26px;
  background: transparent;
}

.volslider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 80%), var(--rest) var(--fill, 80%));
}

.volslider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8.5px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  transition: box-shadow .2s;
}

.volslider:active::-webkit-slider-thumb { box-shadow: 0 0 0 8px var(--accent-dim), 0 2px 8px rgba(0, 0, 0, .5); }

.volslider::-moz-range-track { height: 5px; border-radius: 3px; background: var(--rest); }
.volslider::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--accent); }
.volslider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.volslider:active::-moz-range-thumb { box-shadow: 0 0 0 8px var(--accent-dim); }

.volbubble {
  position: absolute;
  top: -34px;
  left: var(--bx, 50%);
  transform: translateX(-50%);
  padding: 3px 9px;
  border-radius: 8px;
  background: #26262e;
  border: 1px solid var(--hairline-strong);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  pointer-events: none;
}

/* ---------- pills ---------- */

.pillgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--text);
  font-size: var(--fs-state);
  font-weight: 600;
  transition: border-color .2s, background .2s, transform .12s;
}

/* v0.14.6: золотой счётчик лайков на пилоте «Избранное» */
.pill__badge {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}

.pill:has(.pill__badge:not([hidden])) { border-color: var(--accent-glow); }

.pill svg { width: 17px; height: 17px; color: var(--accent); }
.pill:hover { border-color: var(--accent-glow); background: var(--card-strong); }
.pill:active { transform: scale(.97); }

/* ---------- subscription card ---------- */

.subcard { padding: 16px 18px; }

.subcard__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.substatus { font-size: var(--fs-state); font-weight: 700; color: var(--text); }
.substatus.is-urgent { animation: urgentPulse 2.2s ease-in-out infinite; }

@keyframes urgentPulse { 50% { color: var(--warn); } }
.substatus.is-expired { color: var(--danger); }

.substatus .tag {
  display: inline-block;
  margin-right: 7px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.chip--streak { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-dim); }
.chip--streak svg { width: 13px; height: 13px; }

.weekcard {
  margin-top: 14px;
  padding: 12px 12px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--card);
  transition: border-color .2s, background .2s;
}

.weekcard:hover { border-color: var(--accent-glow); background: var(--card-strong); }
.weekcard:active { transform: scale(.99); }

.weekcard__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sub);
  font-weight: 700;
  color: var(--muted);
}

.weekcard__total { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }

.weekcard__chev { width: 16px; height: 16px; color: var(--faint); fill: none; stroke: currentColor; stroke-width: 2.4; transition: transform .2s; }
.weekcard:hover .weekcard__chev { transform: translateX(2px); color: var(--accent); }

.weekbars { display: flex; align-items: flex-end; gap: 6px; height: 44px; margin-top: 10px; }

.wb {
  flex: 1;
  min-height: 4px;
  border-radius: 4px 4px 2px 2px;
  background: var(--rest);
  position: relative;
  transform-origin: bottom;
}

.wb > i {
  position: absolute;
  inset: auto 0 0;
  height: calc(var(--h, 0) * 1%);
  min-height: 3px;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: .85;
}

.wb.is-today > i { opacity: 1; box-shadow: 0 0 12px var(--accent-glow); }
.wb.is-today::after {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- history ---------- */

.histcard { padding-bottom: 8px; }

/* «Далее» — upcoming track from the AutoDJ queue (v0.13.0) */
.histnext {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 2px 2px 0;
  padding: 9px 12px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-sm);
  background: var(--card);
  animation: rowIn .4s var(--ease-spring) backwards;
}

.histnext__label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.histnext b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.histlist { padding: 10px 6px 6px; max-height: 320px; overflow-y: auto; overscroll-behavior: contain; }

.hist-row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  animation: rowIn .4s var(--ease-spring) backwards;
}

@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }

.hist-row + .hist-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: var(--hairline);
}

.hist-bar {
  flex: 0 0 3px;
  align-self: stretch;
  border-radius: 2px;
  background: transparent;
}

.hist-row.is-now .hist-bar {
  background: linear-gradient(180deg, var(--gold-foil), var(--accent-2), var(--gold-foil));
  background-size: 100% 240%;
  animation: nowBarShimmer 2.4s linear infinite;
}

@keyframes nowBarShimmer { to { background-position: 0 -240%; } }

.hist-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: var(--fs-row);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 6px;
}

.hist-name:hover { color: var(--gold-foil); }
.hist-row.is-now .hist-name { color: var(--accent); }

.hist-time { flex: 0 0 auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* v0.14.3: лайк прямо из строки истории — правый край, hit-area 40px
   (touch-минимум), ghost по умолчанию, золото + heartPop в лайке */
.hist-like {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: -6px;   /* визуально у кромки, тап-зона шире глифа */
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color .2s, background .2s, transform .2s;
}
/* честная 40px тап-зона без изменения визуального размера глифа */
.hist-like::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
.hist-like svg { width: 17px; height: 17px; fill: currentColor; }
.hist-like:hover { color: var(--gold-foil); background: var(--accent-dim); transform: scale(1.08); }
.hist-like:active { transform: scale(.9); }
.hist-like.is-liked { color: var(--accent); background: var(--accent-dim); }
.hist-like.is-liked svg { animation: heartPop .45s var(--ease-spring); }
.hist-like:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* v0.14.6: пустое состояние истории — живой винил в тон избранного,
   текст по центру (текстовый узел — отдельный спан, JS обновляет только его) */
.histempty {
  padding: 24px 18px 16px;
  text-align: center;
  color: var(--faint);
  font-size: var(--fs-sub);
}

.histempty__vinyl {
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 2px dashed rgba(244, 201, 93, .28);
  background: radial-gradient(circle, var(--accent-dim) 0 27%, transparent 28%);
  animation: spin 9s linear infinite;
}

/* ---------- v0.14.0: live listeners gauge + CSV export ---------- */

.cardtitle--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* v0.14.6: группа инструментов в заголовке карточки (фильтр ♥ + CSV) */
.cardtitle__tools { display: flex; align-items: center; gap: 8px; }

/* mini CSV chip in the «Эфир» title row — quiet until hovered, then gold */
.histcsv {
  appearance: none;
  border: 1px solid var(--hairline-strong);
  background: var(--card);
  color: var(--faint);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, transform .12s ease;
}

.histcsv:hover { color: var(--accent); border-color: var(--accent); }
.histcsv:active { transform: scale(.94); }

/* v0.14.6: фильтр «♥ только любимые» — глиф крупнее CSV, активен = золото */
.histfav { font-size: 12px; letter-spacing: 0; padding: 4px 10px; color: var(--faint); }
.histfav[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent-glow);
  background: var(--accent-dim);
  box-shadow: inset 0 0 10px var(--accent-dim);
}
.histfav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* live gauge: breathing gold dot + count, peak as a quiet side-note */
.livelisteners {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 2px 0;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--card);
  animation: rowIn .4s var(--ease-spring) backwards;
}

.livelisteners__dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: livePulse 2.4s ease-out infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); opacity: 1; }
  70% { box-shadow: 0 0 0 9px transparent; opacity: .75; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

/* v0.14.4: живой bump при изменении числа слушателей (класс ставит
   renderListeners, перезапуск через reflow) */
.livelisteners__dot.bump { animation: livePulse 2.4s ease-out infinite, listenBump .8s var(--ease-spring); }

@keyframes listenBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.7); box-shadow: 0 0 0 12px var(--accent-glow); opacity: 1; }
  100% { transform: scale(1); }
}

/* v0.14.4: одноразовый стаггер-рост баров недели при открытии статистики —
   задержка по --i (индекс дня), рост от нулевой высоты */
#weekBars.is-anim .wb > i { animation: wbGrow .55s var(--ease-spring) backwards; animation-delay: calc(var(--i, 0) * 45ms); }

@keyframes wbGrow {
  from { height: 0; opacity: 0; }   /* только from — конец берётся из натуральных стилей бара */
}

.livelisteners__text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.livelisteners__peak {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

/* ---------- footer ---------- */

.foot {
  margin-top: auto;
  padding: 14px 4px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: .12em;
}

.foot__sep {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px dashed var(--hairline-strong);
  background:
    radial-gradient(circle, var(--accent) 0 26%, transparent 27%);
  opacity: .8;
  flex: 0 0 auto;
}

.foot__ver { text-transform: uppercase; }
.foot__today { color: var(--muted); }

/* ---------- sheets ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 5, 8, .6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .28s;
  pointer-events: none;
}

body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  z-index: 41;
  left: 50%;
  bottom: 0;
  width: min(100%, 520px);
  max-height: 82dvh;
  transform: translate(-50%, 8px);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border: 1px solid var(--hairline-strong);
  border-bottom: 0;
  background: linear-gradient(rgba(26, 26, 33, .98), rgba(19, 19, 25, .98));
  box-shadow: 0 -18px 60px rgba(0, 0, 0, .55);
  display: flex;
  flex-direction: column;
  animation: sheetIn .34s var(--ease-spring);
}

@keyframes sheetIn { from { transform: translate(-50%, 100%); opacity: .4; } }

.sheet.is-dragging { transition: none; animation: none; }

.sheet__grip {
  flex: 0 0 auto;
  width: 44px;
  height: 4px;
  margin: 10px auto 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .22);
}

.sheet__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 10px;
}

.sheet__title { font-size: var(--fs-sheet); font-weight: 800; letter-spacing: .01em; }

.sheet__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--hairline);
  background: var(--card-strong);
  font-size: 13px;
}

.sheet__close:active { transform: scale(.9); color: var(--text); }

.sheet__body {
  padding: 2px 18px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet__hint { color: var(--faint); font-size: var(--fs-sub); padding: 2px 2px 10px; }

.slabel {
  padding: 16px 2px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--faint);
}

.slabel--sub { padding-top: 10px; color: var(--muted); }

.trow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-row);
  font-weight: 600;
}

.trow small { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; font-weight: 400; }

/* trow as an actionable button (sleep timer entry) — inherits row anatomy */
button.trow {
  width: 100%;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 44px; /* touch target */
  transition: background .15s;
}
button.trow:hover { background: var(--card); }
button.trow:active { transform: scale(.995); }
.trow__chev {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s var(--ease-spring), stroke .2s;
}
button.trow:hover .trow__chev { stroke: var(--accent); transform: translateX(2px); }
.trow small.is-on { color: var(--accent); font-weight: 600; }

.switch {
  flex: 0 0 auto;
  appearance: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid var(--hairline-strong);
  position: relative;
  transition: background .2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  transition: transform .2s var(--ease-spring);
}

.switch:checked { background: var(--grad-accent); border-color: transparent; }
.switch:checked::after { transform: translateX(20px); }

.segment {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--card);
}

.segment button {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  transition: color .15s, background .15s, box-shadow .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.segment button:hover { color: var(--text); }
.segment button[aria-checked="true"] {
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .2);
}

/* EQ preset segment: 6 chips in a 3×2 grid */
.segment--eq { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }

/* ---------- 10-band EQ rack ---------- */

.eqrack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--card);
}

@media (min-width: 380px) {
  .eqrack { grid-template-columns: 1fr 1fr; }
}

.eqrow {
  display: grid;
  grid-template-columns: 30px 1fr 34px;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.eqrow__f {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.eqrow__db {
  font-size: 11px;
  font-weight: 800;
  color: var(--faint);
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  transition: color .18s ease;
}

/* v0.14.0: band touched by a non-zero gain lights up gold */
.eqrow__db.is-hot { color: var(--accent); }

.eqrow__slider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

.eqrow__slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--rest) var(--fill, 50%));
}

.eqrow__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}

.eqrow__slider:active::-webkit-slider-thumb { box-shadow: 0 0 0 7px var(--accent-dim), 0 2px 6px rgba(0, 0, 0, .45); }
.eqrow__slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--rest); }
.eqrow__slider::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.eqrow__slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

.eqrack__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.eqreset {
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-strong);
  background: var(--card-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: color .15s, border-color .15s;
}

.eqreset:hover { color: var(--accent); border-color: var(--accent-glow); }
.eqreset:active { transform: scale(.97); }

.eqrack__hint { color: var(--faint); font-size: 11px; letter-spacing: .08em; }

.optgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.optbtn {
  min-height: 48px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--card-strong);
  font-weight: 700;
  font-size: var(--fs-row);
  transition: border-color .15s, color .15s, background .15s, transform .12s;
}

.optbtn:hover { border-color: var(--accent-glow); color: var(--accent); }
.optbtn:active { transform: scale(.97); }
.optbtn[aria-pressed="true"] {
  border-color: var(--accent-glow);
  color: var(--accent);
  box-shadow: inset 0 0 12px var(--accent-dim);
}
.optbtn[aria-pressed="true"]::before {
  content: "✓ ";
  font-weight: 700;
}
.optbtn--danger { color: var(--danger); border-color: rgba(255, 107, 107, .4); }

.widebtn {
  display: block;
  width: 100%;
  min-height: 50px;
  margin-top: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-strong);
  background: var(--card-strong);
  font-weight: 700;
  font-size: var(--fs-row);
  transition: border-color .15s, transform .12s, background .15s;
}

.widebtn:hover { border-color: var(--accent-glow); }
.widebtn:active { transform: scale(.98); }

.widebtn--gold {
  background: var(--grad-accent);
  border-color: transparent;
  color: #17130a;
  box-shadow: 0 10px 26px var(--accent-glow);
}

.widebtn--quiet { background: transparent; color: var(--muted); }
.widebtn--danger { color: var(--danger); border-color: rgba(255, 107, 107, .35); }

.resetconfirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 107, 107, .35);
  background: rgba(255, 107, 107, .07);
  color: var(--danger);
  font-size: var(--fs-sub);
  animation: rowIn .25s var(--ease-spring);
}

.resetconfirm > div { display: flex; gap: 8px; }
.resetconfirm .optbtn { min-height: 40px; padding: 0 14px; font-size: 13px; }

.importarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-strong);
  background: rgba(0, 0, 0, .3);
  color: var(--text);
  padding: 12px 14px;
  font: 500 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  margin-bottom: 4px;
}

.importarea:focus { outline: none; border-color: var(--accent-glow); }

/* track sheet */

.tkside { display: flex; gap: 16px; align-items: center; padding: 6px 0 14px; }

.tkcover {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), 0 12px 30px rgba(0, 0, 0, .5);
}

.tkcover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, .55) 0 13%, transparent 14%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .05) 0 3px, transparent 3px 7px);
}

.tkmeta { min-width: 0; display: grid; gap: 4px; }

.tkmeta__artist { color: var(--muted); font-size: var(--fs-sub); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.tkmeta__title { font-size: var(--fs-sheet); font-weight: 800; line-height: 1.25; }

.tkmeta__chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

.tkactions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tkbtn {
  min-height: 48px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--card-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: var(--fs-row);
  transition: border-color .15s, color .15s, transform .12s;
}

.tkbtn svg { width: 17px; height: 17px; }
.tkbtn:hover { border-color: var(--accent-glow); }
.tkbtn:active { transform: scale(.97); }
.tkbtn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-dim); }

/* stats sheet */

.statslist { display: grid; gap: 2px; }

.statslist li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-stats);
}

.statslist li:last-child { border-bottom: 0; }
.statslist li > span:first-child { color: var(--muted); font-weight: 600; }
.statslist li > b { font-variant-numeric: tabular-nums; font-weight: 800; }
.statslist li.is-today > b { color: var(--accent); }

/* favorites sheet */

.favtools { display: flex; gap: 8px; margin: 4px 0 10px; }

.favsearch {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-strong);
  background: rgba(0, 0, 0, .25);
  padding: 0 14px;
  color: var(--text);
}

.favsearch:focus { outline: none; border-color: var(--accent-glow); }
.favsearch::placeholder { color: var(--faint); }

/* v0.14.8: сегмент-контрол сортировки «Новые / А-Я / Редкие» —
   бегунок едет transform'ом (CSS-only, позиция из data-sort контейнера) */
.favsortseg {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 42px;
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-strong);
  background: rgba(0, 0, 0, .25);
}

.favsortseg__thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  border-radius: calc(var(--r-sm) - 3px);
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  box-shadow: 0 0 12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .28s var(--ease-spring);
  will-change: transform;
}

.favsortseg[data-sort="alpha"] .favsortseg__thumb { transform: translateX(100%); }
.favsortseg[data-sort="plays"] .favsortseg__thumb { transform: translateX(200%); }

.favsortseg__btn {
  position: relative;
  z-index: 1;
  min-height: 34px;
  padding: 0 12px;
  border-radius: calc(var(--r-sm) - 3px);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: color .2s ease;
}

.favsortseg__btn:hover { color: var(--text); }
.favsortseg__btn[aria-checked="true"] { color: var(--accent); }
.favsortseg__btn:focus-visible { outline: 2px solid var(--accent-glow); outline-offset: -2px; }

.favlist { max-height: 46dvh; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 6px; }

.fav-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
  animation: favIn .35s var(--ease-spring) backwards;
}

@keyframes favIn { from { opacity: 0; transform: translateX(-10px); } }

.fav-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 10px 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-row);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-name:hover { background: var(--card-strong); }
.fav-name:active { background: var(--card-strong); }
.fav-name.is-now { color: var(--accent); }

.fav-act {
  flex: 0 0 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--faint);
  transition: color .15s, transform .12s;
}

.fav-act svg { width: 16px; height: 16px; }
.fav-act:hover { color: var(--text); }
.fav-act:active { transform: scale(.85); }
.fav-act--del:hover { color: var(--danger); }

/* v0.14.7: кросс-анализ «сколько раз звучал за 7 дней» — тихий чип между
   названием и действиями; is-hot = золото, «—» = данных о вращении нет */
.fav-plays {
  flex: 0 0 auto;
  min-width: 30px;
  text-align: center;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  cursor: default;
  transition: color .2s, border-color .2s, background .2s;
}

.fav-plays.is-hot {
  color: var(--accent);
  border-color: var(--accent-glow);
  background: var(--accent-dim);
}

/* сводка над списком: «3 трека · 2 звучали за неделю» — числа золотом */
.favsummary {
  padding: 2px 8px 8px;
  color: var(--faint);
  font-size: var(--fs-sub);
  animation: favSumIn .4s ease .08s backwards;
}

@keyframes favSumIn { from { opacity: 0; transform: translateY(4px); } }

.favsummary b {
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* v0.14.8: «N ждёт эфира» — мягкое свечение вокруг числа редких жемчужин */
.favsummary__pearl {
  padding: 0 5px;
  border-radius: 6px;
  background: var(--accent-dim);
  box-shadow: 0 0 10px var(--accent-glow);
}

.favempty { padding: 26px 10px 18px; text-align: center; color: var(--faint); font-size: var(--fs-sub); }

/* v0.14.6: экспорт избранного ФАЙЛОМ — пара тихих пунктирных кнопок под списком */
.favexport {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.favexport__btn {
  min-height: 44px;
  border-radius: var(--r-md);
  border: 1px dashed var(--hairline-strong);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-sub);
  font-weight: 600;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, transform .12s ease, background .18s ease;
}

.favexport__btn:hover { color: var(--accent); border-color: var(--accent); }
.favexport__btn:active { transform: scale(.97); }
.favexport__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.favexport__btn[disabled] { opacity: .45; pointer-events: none; }

.favempty__vinyl {
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px dashed rgba(244, 201, 93, .4);
  background: radial-gradient(circle, var(--accent-dim) 0 27%, transparent 28%);
  animation: spin 7s linear infinite;
}

/* about sheet */

.about__p { color: var(--muted); font-size: var(--fs-about); padding: 4px 2px 8px; }

.legend { display: grid; gap: 8px; padding: 2px; }
.legend li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-about); flex-wrap: wrap; }
.legend b { color: var(--accent); }

kbd {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  padding: 3px 7px;
  border-radius: 7px;
  border: 1px solid var(--hairline-strong);
  border-bottom-width: 2.5px;
  background: var(--card-strong);
  color: var(--text);
  font: 700 11.5px/1 ui-monospace, Menlo, Consolas, monospace;
}

/* ---------- welcome ---------- */

.welcome {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0;
  padding: 24px 22px calc(26px + env(safe-area-inset-bottom));
  background:
    radial-gradient(700px 420px at 50% -8%, rgba(212, 154, 43, .2), transparent 62%),
    rgba(10, 10, 14, .97);
  animation: sheetIn .4s var(--ease-spring);
}

.welcome__disc {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--gold-1) 0 24%, #1a1a21 25% 34%, #15151b 35% 44%, #1a1a21 45% 55%, #131318 56% 100%);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
  animation: spin 9s linear infinite;
}

.welcome__title {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome__sub { text-align: center; color: var(--muted); padding: 10px 8px 18px; }

.welcome__hints { display: grid; gap: 10px; padding: 0 4px 20px; }
.welcome__hints li { display: flex; gap: 10px; align-items: baseline; color: var(--muted); font-size: var(--fs-row); }
.welcome__hints b { color: var(--text); white-space: nowrap; }

/* welcome open: keep toasts visually clear of the gold CTA */
body.welcome-open .toasts { bottom: calc(104px + env(safe-area-inset-bottom)); }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(92vw, 430px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--hairline-strong);
  border-left: 3px solid var(--accent);
  background: rgba(30, 30, 38, .96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  animation: toastIn .3s var(--ease-spring);
  /* click-through: a toast may overlap a control (e.g. welcome CTA) for a few
     seconds — it must never swallow that tap. Swipe-dismiss stays in js but
     is inert while pointer-events is none (accepted tradeoff) */
  pointer-events: none;
}

.toast.is-out { animation: toastOut .25s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }

.toast--gold {
  border-color: rgba(244, 201, 93, .55);
  border-left-color: var(--gold-1);
  background: linear-gradient(120deg, rgba(90, 62, 12, .55), rgba(30, 30, 38, .97) 55%);
  color: var(--gold-foil);
}

.toast--err { border-left-color: var(--danger); }

/* ---------- night veil / battery / anim-off ---------- */

#veil {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 8%, rgba(255, 168, 76, .12), rgba(120, 60, 10, .18) 60%),
    linear-gradient(rgba(60, 30, 5, .22), rgba(40, 20, 4, .3));
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity .6s;
}

body.night #veil { opacity: 1; }

body.anim-off *, body.anim-off *::before, body.anim-off *::after {
  animation-duration: .001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001s !important;
}

body.anim-off .disc, body.anim-off .disc__gleam { animation: none !important; }
body.battery .pool, body.battery .playfab__halo, body.battery .disc__gleam { display: none; }
body.battery .live::after, body.battery .np__track { animation: none !important; }

/* system-wide sweep when pasted settings land */
.applyflash {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, rgba(244, 201, 93, .32), rgba(244, 201, 93, .08) 34%, transparent 62%);
  animation: applyFlash .95s ease-out forwards;
}

@keyframes applyFlash {
  0% { opacity: 0; transform: scale(.72); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.18); }
}

/* ---------- misc / responsive ---------- */

@media (hover: none) {
  .pill:hover, .optbtn:hover, .weekcard:hover { border-color: var(--hairline); background: var(--card); }
  .hist-name:hover { color: var(--text); }
  .fav-name:hover { background: transparent; }
}

@media (max-width: 360px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .pill { font-size: 12.5px; gap: 5px; }
  .pill svg { width: 15px; height: 15px; }
  .wordmark { letter-spacing: .26em; }
}

@media (min-width: 720px) {
  .shell { max-width: 480px; }
  .sheet { border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }
/* light theme: white thumbs are invisible on cream — warm ink instead */
body.theme-light::-webkit-scrollbar-thumb { background: rgba(30, 24, 10, .22); }
body.theme-light { scrollbar-color: rgba(30, 24, 10, .22) transparent; }
body:not(.theme-light) { scrollbar-color: rgba(255, 255, 255, .14) transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .disc, .disc__gleam { animation: none !important; }
}
