/* ── MusicaAI — Classical / Gold theme (ported from Figma) ─── */

:root {
  --bg: #0C0E14;
  --bg-2: #0f1119;
  --card: #14161f;
  --card-2: #191b26;
  --border: rgba(237,232,220,.10);
  --border-2: rgba(237,232,220,.16);

  --fg: #EDE8DC;
  --muted: rgba(237,232,220,.56);
  --muted-2: rgba(237,232,220,.36);

  --gold: #C8A86B;
  --gold-2: #d8bd85;
  --gold-08: rgba(200,168,107,.08);
  --gold-12: rgba(200,168,107,.12);
  --gold-20: rgba(200,168,107,.20);
  --gold-40: rgba(200,168,107,.40);

  --green: #7fbf8f;
  --red: #d98a7a;
  --yellow: #d4b878;
  --blue: #86a5c8;

  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 100px;

  --display: 'Playfair Display', Georgia, serif;
  --body: 'Crimson Pro', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--body);
  background: var(--bg); color: var(--fg);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(200,168,107,.06), transparent 70%);
  background-attachment: fixed;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(237,232,220,.14); border-radius: 3px; }
button { font-family: inherit; }

/* Атрибут hidden обязан скрывать. Иначе любое наше display: flex его молча
   перебивает — и элемент, помеченный «спрятан», продолжает висеть на экране:
   так кнопка входа через Яндекс показывалась, когда ключей ещё нет, и вела в 503. */
[hidden] { display: none !important; }

/* ── Header ──────────────────────────────────────────────── */
.hdr {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--border);
  background: rgba(12,14,20,.85);
  backdrop-filter: blur(14px) saturate(1.3);
}
.hdr-inner {
  max-width: 900px; margin: 0 auto;
  height: 56px; padding: 0 24px;
  display: flex; align-items: center; gap: 8px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--fg); transition: opacity .2s;
}
.brand:hover { opacity: .8; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--gold-12);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
}
.brand-name {
  font-family: var(--display); font-weight: 500;
  font-size: 17px; letter-spacing: .01em;
}
.brand-ai { color: var(--gold); font-style: italic; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: 28px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 9px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-family: var(--body);
  font-size: 15px; white-space: nowrap;
  transition: color .2s, background .2s;
}
.nav-link:hover { color: var(--fg); }
.nav-link.active { color: var(--fg); background: rgba(237,232,220,.05); }
.nav-badge {
  min-width: 17px; text-align: center;
  padding: 1px 5px; border-radius: 10px;
  background: var(--gold); color: #0C0E14;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
}

.hdr-status {
  margin-left: auto;
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .06em;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); transition: all .3s; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(127,191,143,.5); }
.dot.err { background: var(--red); }

/* На телефоне три пункта меню и статус вместе в строку не влезают: статус
   API-шки — самое необязательное из них, его и убираем. */
@media (max-width: 620px) {
  .hdr-inner { padding: 0 14px; gap: 4px; }
  .nav { margin-left: 10px; gap: 0; }
  .nav-link { padding: 7px 9px; font-size: 14px; }
  .hdr-status { display: none; }
}

/* ── App layout ──────────────────────────────────────────── */
.app { max-width: 900px; margin: 0 auto; padding: 0 24px; }
.view { display: none; animation: fadeUp .35s var(--ease); }
.view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── Hero ────────────────────────────────────────────────── */
.hero { max-width: 720px; margin: 0 auto; text-align: center; padding: 76px 0 40px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; margin-bottom: 30px;
  border: 1px solid var(--border); border-radius: var(--r-pill);
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.eyebrow svg { color: var(--gold); }
.hero-title {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(34px, 6vw, 58px); line-height: 1.08;
  letter-spacing: -.01em; margin-bottom: 22px;
}
.hero-title em { color: var(--gold); font-style: italic; }
.hero-sub {
  font-size: 18px; font-weight: 300; color: var(--muted);
  max-width: 560px; margin: 0 auto 44px; line-height: 1.55;
}

/* ── Prompt box ──────────────────────────────────────────── */
.prompt-card {
  max-width: 640px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 4px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  transition: border-color .2s, box-shadow .2s;
}
.prompt-card:focus-within { border-color: var(--gold-40); }
.prompt-card textarea {
  width: 100%; background: none; border: none; outline: none; resize: none;
  padding: 18px 20px 8px; color: var(--fg);
  font-family: var(--body); font-size: 17px; line-height: 1.5;
  caret-color: var(--gold);
}
.prompt-card textarea::placeholder { color: var(--muted-2); }
.prompt-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 12px 8px;
}
.prompt-hint { font-family: var(--mono); font-size: 11px; color: var(--muted-2); }
.btn-create {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border: none; border-radius: 10px;
  background: var(--gold); color: #0C0E14;
  font-family: var(--body); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: opacity .2s, transform .12s;
}
.btn-create:hover { opacity: .9; }
.btn-create:active { transform: scale(.97); }
.btn-create:disabled { opacity: .4; cursor: default; }
.btn-create .ic-load { display: none; animation: spin 1s linear infinite; }
.btn-create.loading .ic-spark { display: none; }
.btn-create.loading .ic-load { display: inline; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Спиннер загрузки музыки — в кнопке плеера и в кнопках строк */
svg.spin { animation: spin .8s linear infinite; }

/* ── Generation progress ─────────────────────────────────── */
.gen-progress {
  max-width: 560px; margin: 0 auto 40px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.phase { display: flex; align-items: center; gap: 12px; transition: opacity .3s; }
.phase.pending { opacity: .22; }
.phase.active { opacity: 1; }
.phase.done { opacity: 1; }
.phase-ic { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.phase-dot { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--border-2); }
.phase-check { width: 16px; height: 16px; border-radius: 50%; background: var(--gold-20); display: flex; align-items: center; justify-content: center; color: var(--gold); }
.phase-spin { color: var(--gold); animation: spin 1s linear infinite; }
.phase-label { font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* ── Result ──────────────────────────────────────────────── */
.result { max-width: 760px; margin: 0 auto 64px; display: flex; flex-direction: column; gap: 16px; }

.result-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 0 2px; }
.meta-facts { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.meta-facts b { color: var(--gold); font-weight: 500; }
.meta-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: 1px solid var(--border); border-radius: 9px;
  background: none; color: var(--muted);
  font-family: var(--mono); font-size: 12px; cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.chip-btn:hover { color: var(--fg); border-color: var(--gold-40); }
.chip-btn.danger:hover { color: var(--red); border-color: rgba(217,138,122,.4); }

/* result cards */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.card-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 5px; }
.card-title { font-family: var(--display); font-size: 19px; font-weight: 500; }

/* ── Player ──────────────────────────────────────────────── */
.player-vol { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.player-vol input[type=range] { width: 78px; }
input[type=range] {
  -webkit-appearance: none; appearance: none;
  height: 3px; background: rgba(237,232,220,.15); border-radius: 3px; outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); cursor: pointer;
}
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: none; border-radius: 50%; background: var(--gold); cursor: pointer; }

.waveform { display: flex; align-items: center; gap: 2px; height: 48px; margin-bottom: 12px; }
.wave-bar { flex: 1; border-radius: 4px; background: rgba(237,232,220,.15); transition: background .1s, transform .1s; }

/* Форма волны: реальная огибающая трека, клик в любое место = перемотка */
.wave-wrap {
  position: relative;
  height: 90px;
  margin-bottom: 10px;
  cursor: pointer;
  border-radius: 8px;
  background: rgba(0,0,0,.18);
  overflow: hidden;
  touch-action: none;          /* иначе на тач-экране перетаскивание скроллит страницу */
}
.wave-canvas { display: block; width: 100%; height: 100%; }
.wave-wrap:hover .wave-canvas { filter: brightness(1.08); }

.wave-hover {
  display: none;
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(237,232,220,.45);
  pointer-events: none;
}
.wave-hover-time {
  position: absolute;
  top: 4px; left: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  background: rgba(0,0,0,.65);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}
.wave-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.pl-rate, .pl-rew, .pl-ff {
  font-family: var(--mono);
  font-size: 12px;
  min-width: 38px;
}

.player-times { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.player-seek { width: 100%; margin-bottom: 16px; display: block; }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 18px; }
.player-controls button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 6px; display: flex; transition: color .2s;
}
.player-controls button:hover { color: var(--fg); }
.pl-play {
  width: 48px; height: 48px; border-radius: 50% !important;
  background: var(--gold) !important; color: #0C0E14 !important;
  align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(200,168,107,.3);
}
.pl-play:hover { color: #0C0E14 !important; opacity: .92; }

/* ── Inline score ────────────────────────────────────────── */
.score-inline {
  border-radius: 10px; padding: 16px;
  background: #f6f3ec;
  max-height: 340px; overflow: hidden;
  display: flex; justify-content: center;
}
.score-inline svg { max-width: 100%; height: auto; }
.score-inline.empty {
  background: rgba(237,232,220,.03);
  color: var(--muted-2); font-family: var(--mono); font-size: 12px; padding: 30px;
}
.score-caption { margin-top: 12px; text-align: center; font-family: var(--mono); font-size: 11px; color: var(--muted-2); }
.btn-open-score {
  width: 100%; margin-top: 14px; padding: 11px;
  border: 1px solid var(--gold-20); border-radius: 10px;
  background: var(--gold-08); color: var(--gold-2);
  font-family: var(--body); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.btn-open-score:hover { background: var(--gold-12); border-color: var(--gold-40); }

/* ── Error box ───────────────────────────────────────────── */
.error-box {
  background: rgba(217,138,122,.06); border: 1px solid rgba(217,138,122,.2);
  border-radius: var(--r); padding: 14px 16px;
  font-family: var(--mono); font-size: 12px; color: var(--red);
  word-break: break-word; line-height: 1.6;
}

/* ── Features ────────────────────────────────────────────── */
.features {
  max-width: 760px; margin: 0 auto; padding-bottom: 80px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.feature {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px;
  transition: border-color .2s;
}
.feature:hover { border-color: var(--gold-20); }
.feature-ic { color: var(--gold); margin-bottom: 14px; }
.feature h4 { font-family: var(--display); font-size: 17px; font-weight: 500; margin-bottom: 6px; }
.feature p { font-size: 15px; font-weight: 300; color: var(--muted); line-height: 1.5; }

/* ── Library ─────────────────────────────────────────────── */
.lib-head { padding: 44px 0 24px; }
.lib-title { font-family: var(--display); font-size: 34px; font-weight: 500; }
.lib-stats { display: flex; gap: 30px; margin-top: 14px; }
.lib-stat b { display: block; font-family: var(--display); font-size: 24px; color: var(--gold); font-weight: 500; }
.lib-stat span { font-family: var(--mono); font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; }

.lib-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 80px; }
.lib-empty { text-align: center; padding: 72px 0; color: var(--muted-2); }
.lib-empty svg { opacity: .5; margin-bottom: 14px; }
.lib-empty p { font-size: 16px; margin-bottom: 10px; }
.btn-link { background: none; border: none; color: var(--gold); font-family: var(--body); font-size: 15px; cursor: pointer; }

.lib-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  transition: border-color .2s;
}
.lib-item:hover { border-color: var(--gold-20); }
.lib-item-row { display: flex; align-items: center; gap: 14px; padding: 15px 16px; cursor: pointer; }
.lib-play {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-12); color: var(--gold); border: none; cursor: pointer;
  transition: background .2s;
}
.lib-play.done { background: var(--gold-12); color: var(--gold); }
.lib-play.running { background: rgba(134,165,200,.12); color: var(--blue); animation: pulse 1.8s infinite; }
.lib-play.queued { background: rgba(212,184,120,.12); color: var(--yellow); }
.lib-play.failed { background: rgba(217,138,122,.12); color: var(--red); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.lib-info { flex: 1; min-width: 0; }
.lib-name { font-family: var(--display); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub { font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-meta { display: flex; align-items: center; gap: 16px; font-family: var(--mono); font-size: 11px; color: var(--muted); flex-shrink: 0; }
.lib-meta .hide-sm { }
.lib-actions { display: flex; gap: 2px; flex-shrink: 0; }
.lib-actions button { background: none; border: none; color: var(--muted-2); cursor: pointer; padding: 7px; display: flex; transition: color .2s; }
.lib-actions button:hover { color: var(--fg); }
.lib-actions button.del:hover { color: var(--red); }
.lib-expand { border-top: 1px solid var(--border); padding: 18px 16px; display: none; flex-direction: column; gap: 14px; }
.lib-item.open .lib-expand { display: flex; }
.lib-expand audio { width: 100%; height: 38px; }

/* ── Score Modal (fullscreen) ────────────────────────────── */
.score-modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.72); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
}
.score-modal-overlay.open { opacity: 1; pointer-events: all; }
.score-modal {
  width: calc(100vw - 48px); height: calc(100vh - 48px); max-width: 1400px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden;
  transform: scale(.96); opacity: 0;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.score-modal-overlay.open .score-modal { transform: none; opacity: 1; }
.score-modal-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; background: var(--card-2);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.score-modal-title { font-family: var(--display); font-size: 16px; }
.score-part-select {
  margin-left: 8px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  font-family: var(--mono); font-size: 12px; cursor: pointer; outline: none;
}
.score-part-select:hover { border-color: var(--gold-40); }
.score-toolbar { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.score-btn {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 32px; height: 32px; padding: 6px 11px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border); color: var(--muted);
  font-family: var(--mono); font-size: 12px; cursor: pointer; transition: all .2s var(--ease);
}
.score-btn:hover:not(:disabled) { border-color: var(--gold-40); color: var(--fg); }
.score-btn:disabled { opacity: .3; cursor: default; }
.score-btn.score-dl { background: var(--gold-08); border-color: var(--gold-20); color: var(--gold-2); }
.score-btn.score-dl:hover { background: var(--gold-12); border-color: var(--gold-40); }
.score-btn.score-close { background: rgba(217,138,122,.08); border-color: rgba(217,138,122,.2); color: var(--red); min-width: 34px; }
.score-btn.score-close:hover { background: rgba(217,138,122,.18); }
.score-toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 5px; }
.score-page-label { font-family: var(--mono); font-size: 12px; color: var(--muted-2); min-width: 48px; text-align: center; }
.score-zoom-label { font-family: var(--mono); font-size: 11px; color: var(--muted-2); min-width: 38px; text-align: center; }
.score-modal-body { flex: 1; background: #f6f3ec; overflow: auto; padding: 24px; display: flex; justify-content: center; align-items: flex-start; }
.score-canvas { transition: transform .15s var(--ease); transform-origin: top center; }
.score-canvas svg { max-width: 100%; height: auto; display: block; }
.score-loading { text-align: center; padding: 60px; color: #999; font-style: italic; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 22px; right: 22px; z-index: 600; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 11px 18px; font-size: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45); animation: toastIn .3s var(--ease);
}
.toast.success { border-color: var(--gold-40); }
.toast.error { border-color: rgba(217,138,122,.4); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 720px) {
  .hdr-inner { padding: 0 16px; }
  .nav { margin-left: 12px; }
  .nav-link span, .hdr-status .status-text { display: none; }
  .app { padding: 0 16px; }
  .features { grid-template-columns: 1fr; }
  .lib-meta .hide-sm { display: none; }
}
@media (max-width: 400px) {
  .nav-link { padding: 7px 9px; }
}

/* Плеер внутри карточки библиотеки («Мои произведения») */
.lib-player { margin: 6px 0 12px; }
.lib-player .wave-wrap { height: 70px; }
.player-vol-compact { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

/* ── Радио: приёмник «Пюпитр FM» ───────────────────────────────────────── */

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* Живая точка у пункта меню: эфир слышно с любой вкладки, пусть будет видно. */
.nav-live {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(237,232,220,.25);
  transition: background .3s, box-shadow .3s;
}
.nav-live.on {
  background: var(--gold);
  box-shadow: 0 0 5px var(--gold);
  animation: live-pulse 2s ease-in-out infinite;
}

/* Секция лежит вне .app — приёмнику там тесно, поэтому центруем сами и пошире. */
#view-radio { max-width: 1100px; margin: 0 auto; padding: 44px 24px 80px; }

.rx-head { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.rx-head-mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: var(--gold-12); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
}
.rx-head-title { font-family: var(--display); font-size: 26px; font-weight: 500; line-height: 1; }
.rx-head-sub {
  font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-top: 5px;
}

.rx-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 22px; align-items: start; }
/* min-width: 0 — обязательно: у элементов грида ширина по умолчанию не меньше
   содержимого, и одна длинная строка в истории раздвинула бы всю страницу. */
.rx-col-main, .rx-col-side { min-width: 0; }
.rx-col-main { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 940px) { .rx-grid { grid-template-columns: 1fr; } }

.rx-panel {
  background: linear-gradient(145deg, #141622 0%, #0F1119 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
}
.rx-receiver {
  display: flex; flex-direction: column; gap: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.rx-receiver audio { display: none; }

/* ── Верхняя планка ── */
.rx-strip {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 11px;
}
.rx-strip-l { display: flex; align-items: center; gap: 8px; color: var(--muted-2); }
.rx-strip-l svg { color: var(--gold); flex-shrink: 0; }
.rx-strip-r {
  display: flex; align-items: center; gap: 7px;
  color: var(--gold); letter-spacing: .08em;
}
.rx-led {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold-40);
  transition: background .3s, box-shadow .3s;
}
.rx-led.on {
  background: var(--gold); box-shadow: 0 0 6px var(--gold);
  animation: live-pulse 2s ease-in-out infinite;
}

/* ── Шкала настройки ── */
.rx-dial { display: flex; flex-direction: column; align-items: center; }
.rx-freq {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 34px; border-radius: 14px;
  background: rgba(0,0,0,.5);
  border: 1px solid var(--gold-12);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.6);
}
.rx-freq-fm {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .3em; color: var(--gold-40); margin-bottom: 4px;
}
.rx-freq-val {
  font-family: var(--mono); font-size: 42px; font-weight: 700; line-height: 1;
  color: var(--gold); letter-spacing: .05em;
  text-shadow: 0 0 20px rgba(200,168,107,.4);
}
.rx-freq-unit {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .2em; color: var(--gold-40); margin-top: 5px;
}

.rx-signal { display: flex; align-items: center; gap: 10px; margin-top: 13px; }
.rx-signal-bars { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
/* Столбики «уровня сигнала» — на деле глубина буфера эфира. */
.rx-signal-bars i {
  width: 5px; border-radius: 3px;
  background: rgba(200,168,107,.2);
  transition: background .4s;
}
.rx-signal-bars i.on { background: rgba(200,168,107,.7); }
.rx-onair { display: flex; align-items: center; gap: 6px; }
.rx-onair-led {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold-20); transition: all .3s;
}
.rx-onair-led.on {
  background: var(--gold); box-shadow: 0 0 8px var(--gold);
  animation: live-pulse 2s ease-in-out infinite;
}
.rx-onair span {
  font-family: var(--mono); font-size: 11px;
  color: rgba(200,168,107,.6); letter-spacing: .06em;
}

/* ── Волна ── */
.rx-wave { display: block; width: 100%; height: 64px; }

/* ── Сейчас играет ── */
.rx-now { text-align: center; animation: fadeUp .5s var(--ease); }
.rx-now-style {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted-2); min-height: 14px;
}
.rx-now-title {
  font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: 22px; line-height: 1.25; color: var(--fg); margin-top: 5px;
}
.rx-now-meta {
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
  margin-top: 6px; min-height: 14px;
}

/* ── Прогресс пьесы ── */
.rx-progress-track {
  height: 4px; border-radius: 3px; overflow: hidden;
  background: var(--gold-08);
}
.rx-progress-fill {
  height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-40), var(--gold));
  transition: width .9s linear;
}
.rx-progress-times {
  display: flex; justify-content: space-between; margin-top: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
}

/* ── Кнопка эфира ── */
.rx-play-row { display: flex; justify-content: center; }
.rx-play {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--gold); color: #0C0E14; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s var(--ease), box-shadow .3s;
}
.rx-play:hover { transform: scale(1.05); }
.rx-play:active { transform: scale(.95); }
.rx-play.playing { box-shadow: 0 0 30px rgba(200,168,107,.3); }
.rx-play .ic-pause { display: none; }
.rx-play.playing .ic-play { display: none; }
.rx-play.playing .ic-pause { display: block; }
.rx-play.busy { opacity: .6; pointer-events: none; }

/* ── Крутилки ── */
.rx-panel-label {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted-2); text-align: center; margin-bottom: 22px;
}
.rx-knob-row { display: flex; align-items: flex-start; justify-content: space-around; }

.knob { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.knob-dial {
  width: 80px; height: 80px; cursor: ns-resize;
  border: none; background: none; padding: 0;
  border-radius: 50%; touch-action: none;
}
.knob-dial:focus-visible { outline: 2px solid var(--gold-40); outline-offset: 2px; }
.knob-label {
  font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2);
}
.knob-value {
  font-family: var(--mono); font-size: 11px; color: var(--gold); margin-top: 2px;
}
.knob.off .knob-dial { cursor: not-allowed; opacity: .35; }
.knob.off .knob-value { color: var(--muted-2); }

/* ── VU ── */
.rx-vu { display: flex; align-items: center; gap: 3px; height: 12px; margin-top: 24px; }
.rx-vu i {
  flex: 1; height: 100%; border-radius: 2px;
  background: rgba(237,232,220,.06);
  transition: background .08s linear;
}
.rx-vu i.on      { background: var(--gold); }
.rx-vu i.on.warn { background: #fbbf24; }
.rx-vu i.on.peak { background: #ef4444; }
.rx-vu-label {
  font-family: var(--mono); font-size: 10px; color: var(--muted-2);
  text-align: center; margin-top: 8px; opacity: .5;
  letter-spacing: .12em;
}

/* ── История эфира ── */
.rx-col-side { display: flex; flex-direction: column; gap: 10px; }
.rx-side-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2);
}
.rx-side-head svg { color: var(--gold); flex-shrink: 0; }
.rx-all {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .08em; color: var(--gold);
  opacity: .75; transition: opacity .2s;
}
.rx-all:hover { opacity: 1; }
.rx-buffer { font-family: var(--mono); font-size: 11px; color: var(--muted-2); opacity: .6; }
.rx-side-list {
  display: flex; flex-direction: column; gap: 7px;
  max-height: 620px; overflow-y: auto; padding-right: 4px;
  /* В Firefox системный скроллбар светлый и режет глаз на тёмной панели */
  scrollbar-width: thin;
  scrollbar-color: rgba(237,232,220,.14) transparent;
}
/* Список ограничен по высоте, и без этого карточки сплющивало бы друг об друга,
   вместо того чтобы прокручиваться. */
.rx-side-list > * { flex-shrink: 0; }

.rx-item {
  border: 1px solid var(--border); border-radius: 13px;
  background: var(--card); overflow: hidden;
  transition: border-color .2s;
}
.rx-item:hover { border-color: var(--gold-20); }
.rx-item.open { border-color: rgba(200,168,107,.25); }
.rx-item-row { display: flex; align-items: center; gap: 10px; padding: 13px 14px; }
.rx-item-body { min-width: 0; flex: 1; }
.rx-item-player:not(:empty) { padding: 0 14px 14px; }

/* Круглая кнопка пуска — она же пауза, когда пьеса звучит */
.rx-play-sm {
  flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-12); color: var(--gold); cursor: pointer;
  transition: background .2s, color .2s, transform .15s var(--ease);
}
.rx-play-sm:hover { transform: scale(1.06); }
.rx-play-sm svg { width: 12px; height: 12px; }
.open > .rx-item-row > .rx-play-sm,
.open > .hrow-row > .rx-play-sm { background: var(--gold); color: #0C0E14; }

/* Иконочные кнопки: лайк, скачать, «открыть в истории» */
.ic-btn {
  flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 8px; border: none;
  display: flex; align-items: center; justify-content: center;
  background: none; color: var(--muted-2); cursor: pointer;
  transition: color .2s, background .2s;
}
.ic-btn:hover { color: var(--fg); background: rgba(237,232,220,.05); }
.ic-btn.like:hover { color: #ef4444; }
/* Отмеченное сердце — залитое: контурное на беглый взгляд не отличить */
.ic-btn.like.on { color: #ef4444; }
.ic-btn.like.on svg { fill: #ef4444; }

.rx-show-all {
  width: 100%; padding: 11px;
  border: 1px solid var(--border); border-radius: 13px;
  background: none; cursor: pointer;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
  transition: color .2s, border-color .2s;
}
.rx-show-all:hover { color: var(--fg); border-color: var(--gold-20); }
.rx-item-now {
  border-color: rgba(200,168,107,.3);
  background: rgba(200,168,107,.05);
}
.rx-item-tag {
  display: flex; align-items: center; gap: 6px; margin-bottom: 3px;
  font-family: var(--mono); font-size: 10px;
  color: rgba(200,168,107,.7); letter-spacing: .08em; text-transform: uppercase;
}
.rx-item-tag::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 5px var(--gold);
  animation: live-pulse 2s ease-in-out infinite;
}
.rx-item-title {
  font-family: var(--display); font-size: 15px; line-height: 1.3; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rx-item-meta {
  font-family: var(--mono); font-size: 10px; color: var(--muted-2);
  margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rx-side-empty {
  border: 1px solid var(--border); border-radius: 13px;
  background: var(--card); padding: 30px 16px; text-align: center;
  font-family: var(--mono); font-size: 12px; color: var(--muted-2);
}

/* ── Страница «История радио» ──────────────────────────────────────────── */

#view-history { max-width: 820px; margin: 0 auto; padding: 40px 24px 90px; }

.hist-head { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.hist-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
  transition: color .2s;
}
.hist-back:hover { color: var(--fg); }
.hist-sep { width: 1px; height: 16px; background: var(--border-2); }
.hist-mark { color: var(--gold); display: flex; }
.hist-title { font-family: var(--display); font-size: 26px; font-weight: 500; line-height: 1; }
.hist-count {
  margin-left: auto;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
}

/* Переключатель «Все / Понравившиеся» */
.hist-tabs {
  display: flex; gap: 4px; max-width: 340px; margin-bottom: 22px;
  padding: 4px; border: 1px solid var(--border); border-radius: 13px;
  background: rgba(237,232,220,.02);
}
.hist-tab {
  flex: 1; padding: 8px 10px; border: none; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: none; color: var(--muted-2); cursor: pointer;
  font-family: var(--mono); font-size: 11px;
  transition: color .2s, background .2s;
}
.hist-tab:hover { color: var(--fg); }
.hist-tab.active { background: var(--card-2); color: var(--fg); }
.hist-tab .ic-heart { flex-shrink: 0; }
.hist-tab.active .ic-heart { color: #ef4444; fill: #ef4444; }
.hist-tab-num:not(:empty) { color: var(--gold); }

.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-empty {
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--card); padding: 64px 20px; text-align: center;
  color: var(--muted); font-size: 15px;
}

.hrow {
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--card); overflow: hidden;
  transition: border-color .2s;
}
.hrow:hover { border-color: var(--gold-20); }
.hrow.open { border-color: rgba(200,168,107,.3); }
.hrow-row { display: flex; align-items: center; gap: 12px; padding: 15px 16px; }
.hrow-num {
  width: 20px; flex-shrink: 0; text-align: right;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2); opacity: .5;
}
.hrow-body { flex: 1; min-width: 0; }
.hrow-title {
  font-family: var(--display); font-size: 15px; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hrow-meta {
  font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hrow-when {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
}
.hrow-clock { opacity: .6; }
@media (max-width: 640px) { .hrow-when { display: none; } }
.hrow-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.hrow-player:not(:empty) {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
}

/* ── Пульт плеера ──────────────────────────────────────────────────────── */

.player-bar { display: flex; align-items: center; }
/* Пульт по центру, лайк со скачиванием — справа, и одно другого не сдвигает */
.player-bar .player-controls { flex: 1; }
.player-side { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.player-controls.mini { gap: 10px; }
.player-controls.mini .pl-play { width: 34px; height: 34px; }

/* ── Пагинация ─────────────────────────────────────────────────────────── */

.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; }
.pg-nums { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; }
.pg-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 9px;
  background: none; color: var(--muted-2); cursor: pointer;
  font-family: var(--mono); font-size: 12px;
  transition: color .2s, border-color .2s, background .2s;
}
.pg-btn:hover:not(:disabled) { color: var(--fg); }
.pg-btn.cur {
  background: var(--gold-12); color: var(--gold);
  border-color: rgba(200,168,107,.3);
}
.pg-btn:disabled { opacity: .3; cursor: default; }
/* Стрелки — с рамкой, чтобы читались как отдельный шаг, а не как номер */
.pager > .pg-btn { border-color: var(--border); }
.pg-gap { color: var(--muted-2); font-family: var(--mono); padding: 0 2px; }

/* ── Вход ──────────────────────────────────────────────────────────────── */

.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.hdr-status { margin-left: 0; }
@media (max-width: 760px) { .hdr-right .hdr-status { display: none; } }

.btn-login {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 9px;
  border: 1px solid var(--border); background: none; cursor: pointer;
  color: var(--muted); font-family: var(--body); font-size: 14px;
  transition: color .2s, border-color .2s;
}
.btn-login:hover { color: var(--fg); border-color: var(--gold-40); }

.hdr-user { display: flex; align-items: center; gap: 4px; }
.hdr-account {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 9px;
  border: 1px solid var(--border); background: none; cursor: pointer;
  color: var(--muted); font-family: var(--body); font-size: 14px;
  transition: border-color .2s, color .2s;
}
.hdr-account:hover { color: var(--fg); border-color: var(--gold-20); }
.hdr-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-20); color: var(--gold);
  font-family: var(--display); font-size: 12px; font-weight: 600;
}
@media (max-width: 760px) { .hdr-name { display: none; } }
.btn-logout {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  border: none; background: none; cursor: pointer; color: var(--muted-2);
  transition: color .2s, background .2s;
}
.btn-logout:hover { color: var(--fg); background: rgba(237,232,220,.05); }

.auth-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  animation: fadeUp .2s var(--ease);
}
.auth-overlay[hidden] { display: none; }

.auth-modal {
  position: relative;
  width: min(380px, calc(100vw - 32px));
  padding: 34px 32px 28px;
  border: 1px solid var(--border); border-radius: var(--r-xl);
  background: var(--card);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  text-align: center;
}
.auth-close {
  position: absolute; top: 14px; right: 14px;
  display: flex; border: none; background: none; cursor: pointer;
  color: var(--muted-2); transition: color .2s;
}
.auth-close:hover { color: var(--fg); }

.auth-mark {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--gold-08); color: var(--gold);
}
.auth-title { font-family: var(--display); font-size: 24px; font-weight: 500; }
.auth-sub { font-size: 14px; color: var(--muted); margin-top: 5px; }

/* Фирменный жёлтый Яндекса — чтобы кнопку узнавали не читая */
.btn-yandex {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 20px; border: none; border-radius: 10px;
  background: #FFCC00; color: #000; cursor: pointer;
  font-family: var(--body); font-size: 15px; font-weight: 600;
  transition: opacity .2s;
}
.btn-yandex:hover { opacity: .9; }
.btn-yandex .ic-load { display: none; }
.btn-yandex.loading { opacity: .6; pointer-events: none; }
.btn-yandex.loading .ic-ya { display: none; }
.btn-yandex.loading .ic-load { display: block; animation: spin .8s linear infinite; }

.btn-devlogin {
  background: none; border: 1px dashed var(--border-2); border-radius: 10px;
  width: 100%; padding: 10px; cursor: pointer;
  color: var(--muted-2); font-family: var(--mono); font-size: 11px;
  transition: color .2s, border-color .2s;
}
.btn-devlogin:hover { color: var(--fg); border-color: var(--gold-40); }

.auth-note { font-size: 12px; color: var(--muted-2); }

/* Остаток дневного лимита генерации — тихой строкой под карточкой промпта */
.quota-hint {
  max-width: 640px; margin: 10px auto 0; text-align: center;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
  min-height: 14px;
}

/* ── Футер: правовое и контакты ─────────────────────────────── */
/* Прижат к низу ЭКРАНА на любой странице: контент занимает минимум
   высоту экрана без шапки и футера — на коротких страницах футер иначе
   всплывал под контент и выглядел плашкой. Без flex на body: там жёсткое
   height:100%, и флекс-сжатие ломало раскладку. Текст мелкий и
   приглушённый — это подвал, а не объявление; выделена только почта. */
main.app { min-height: calc(100vh - 130px); }
.site-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(237,232,220,.07);
}
.footer-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 4px 8px; text-align: center;
  font-family: var(--mono); font-size: 10px; color: var(--muted-2);
}
.footer-link {
  color: var(--gold); text-decoration: none;
  font-size: 11px; letter-spacing: .02em;
}
.footer-link:hover { color: var(--gold-2); text-decoration: underline; }
.footer-sep { color: var(--muted-2); }
@media (max-width: 560px) { .footer-sep { display: none; } }

/* Кнопки «скоро будет»: видимы, но неактивны — фича анонсируется, а не прячется */
.chip-btn.is-soon {
  opacity: .45;
  cursor: not-allowed;
}

/* ── Плашка «сайт на обновлении» ────────────────────────────── */
#maintenance-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  padding: 10px 16px; text-align: center;
  background: linear-gradient(180deg, rgba(200,168,107,.96), rgba(178,146,90,.96));
  color: #14110a; font-family: var(--mono); font-size: 13px; font-weight: 600;
  transform: translateY(-100%); transition: transform .35s ease;
}
#maintenance-bar.show { transform: translateY(0); }
