/* Музоныч — приложение. Аудитория 30+: крупный шрифт, высокий контраст, большие кнопки. */
:root {
  --bg: #f7f4ef;
  --card: #ffffff;
  --ink: #2b2437;
  --muted: #6f6781;
  --brand: #7c3aed;
  --brand-dark: #6428cf;
  --brand-soft: #f1e9ff;
  --accent: #f59e0b;
  --accent-soft: #fef3d8;
  --ok: #16a34a;
  --danger: #dc2626;
  --vk: #0077ff;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(43, 36, 55, .08);
  /* панели студии (светлые значения; в тёмной теме переопределяются) */
  --panel-bg: #faf7ff;
  --panel-border: #e4dcf2;
  --pop-bg: #ffffff;
  --pop-border: #e4dcf2;
  --row-line: #eee6f8;
  --row-hover: rgba(124, 58, 237, .05);
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; }
a { color: var(--brand); }

.hidden { display: none !important; }

/* ── Шапка ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e9e3f5;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.logo { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.logo span { color: var(--brand); }
.topbar .spacer { flex: 1; }

.balance-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft); border: 1px solid #f3ce85;
  border-radius: 999px; padding: 6px 14px; font-weight: 700;
}
.balance-chip button {
  border: 0; background: var(--accent); color: #fff; border-radius: 999px;
  padding: 4px 12px; font-weight: 700; font-size: .9rem;
}
.userbox { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .95rem; }
.userbox img { width: 34px; height: 34px; border-radius: 50%; }
.userbox .out { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: .85rem; }

/* ── Переключатель режимов ── */
.mode-switch {
  display: flex; gap: 4px; background: #ece5f8; padding: 4px; border-radius: 999px;
}
.mode-switch button {
  border: 0; background: transparent; border-radius: 999px;
  padding: 8px 18px; font-weight: 700; color: var(--muted);
}
.mode-switch button.active { background: var(--brand); color: #fff; }

.container { max-width: 860px; margin: 0 auto; padding: 24px 16px 80px; }

/* ── Карточки/кнопки ── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px; margin-bottom: 20px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 14px; padding: 16px 28px;
  font-size: 1.1rem; font-weight: 700; transition: transform .1s, box-shadow .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(124,58,237,.35); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-dark); }
.btn-vk { background: var(--vk); color: #fff; box-shadow: 0 4px 14px rgba(0,119,255,.3); width: 100%; }
.btn-lg { width: 100%; padding: 18px; font-size: 1.2rem; }
.btn[disabled] { opacity: .5; cursor: default; }

h1 { font-size: 1.7rem; margin: 0 0 8px; }
h2 { font-size: 1.35rem; margin: 0 0 14px; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: 1.05rem; }

/* ── Мастер: шаги ── */
.steps-bar { display: flex; gap: 8px; margin-bottom: 22px; }
.steps-bar i {
  flex: 1; height: 8px; border-radius: 4px; background: #e4dcf2;
}
.steps-bar i.done { background: var(--brand); }
.step-label { color: var(--brand); font-weight: 700; letter-spacing: .04em; font-size: .85rem; text-transform: uppercase; }

.choice-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin: 18px 0;
}
.choice-grid button {
  background: #fff; border: 2px solid #e4dcf2; border-radius: 16px;
  padding: 18px 10px; font-size: 1.05rem; font-weight: 600; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .15s, background .15s;
}
.choice-grid button .em { font-size: 2rem; line-height: 1; }
.choice-grid button small { color: var(--muted); font-weight: 400; font-size: .8rem; line-height: 1.3; }
.choice-grid button:hover { border-color: #c9b4f2; }
.choice-grid button.selected { border-color: var(--brand); background: var(--brand-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chips button {
  border: 2px solid #e4dcf2; background: #fff; border-radius: 999px;
  padding: 9px 18px; font-size: 1rem;
}
.chips button.selected { border-color: var(--brand); background: var(--brand-soft); font-weight: 700; }

label.field { display: block; font-weight: 700; margin: 18px 0 6px; }
label.field small { display: block; font-weight: 400; color: var(--muted); }
input[type=text], textarea, select {
  width: 100%; border: 2px solid #e4dcf2; border-radius: 12px;
  padding: 14px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }

.hint {
  background: var(--brand-soft); border-radius: 12px; padding: 12px 16px;
  color: #4c3382; font-size: .95rem; margin: 12px 0;
}

.nav-row { display: flex; gap: 12px; margin-top: 22px; }
.nav-row .btn-back { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 1rem; }
.nav-row .btn-primary { flex: 1; }

/* ── Текст песни ── */
.lyrics-box {
  white-space: pre-wrap; background: #faf7ff; border: 1px solid #e4dcf2;
  border-radius: 12px; padding: 18px; font-size: 1.02rem; margin: 14px 0;
}
.ai-comment {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--accent-soft); border-radius: 12px; padding: 12px 16px; font-size: .98rem;
}
.mus-avatar {
  width: 44px; height: 44px; min-width: 44px; border-radius: 50%;
  object-fit: cover; object-position: 50% 22%; background: #cfe8fb;
}
.edits-left { color: var(--muted); font-size: .9rem; margin-top: 8px; }

/* ── Прогресс генерации ── */
.gen-progress { text-align: center; padding: 30px 10px; }
.gen-progress .disc {
  font-size: 4rem; display: inline-block; animation: spin 3.5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { background: #e4dcf2; height: 12px; border-radius: 6px; overflow: hidden; margin: 22px auto; max-width: 420px; }
.progress-fill { height: 100%; width: 3%; background: linear-gradient(90deg, var(--brand), #b07df5); border-radius: 6px; transition: width 1s linear; }

/* ── Результат ── */
.result-track { border: 2px solid #e4dcf2; border-radius: 16px; padding: 16px; margin: 12px 0; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.result-track img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.result-track audio { flex: 1; min-width: 220px; }
.result-track .dl {
  text-decoration: none; background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 10px; padding: 10px 16px; font-weight: 700; white-space: nowrap;
}
body.studio .result-track { border-color: rgba(255, 255, 255, .09); }

/* ── Фирменный плеер ── */
.mplayer {
  display: flex; align-items: center; gap: 14px;
  background: #faf7ff; border: 2px solid #e4dcf2; border-radius: 16px;
  padding: 12px 16px; margin: 10px 0;
}
body.studio .mplayer { background: #17102a; border-color: #342454; }
.mplayer .mp-cover { width: 58px; height: 58px; min-width: 58px; border-radius: 10px; object-fit: cover; }
.mplayer .mp-btn {
  width: 54px; height: 54px; min-width: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), #b07df5); color: #fff; font-size: 1.05rem;
  box-shadow: 0 4px 16px rgba(124, 58, 237, .35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.mplayer .mp-btn:hover { transform: scale(1.06); }
body.studio .mplayer .mp-btn { background: linear-gradient(93deg, #7c3aed, #c026d3 60%, #f59e0b); }
.mplayer .mp-body { flex: 1; min-width: 0; }
.mplayer .mp-title { font-weight: 700; font-size: .96rem; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mplayer .mp-track { height: 12px; border-radius: 6px; background: #e4dcf2; cursor: pointer; overflow: hidden; }
body.studio .mplayer .mp-track { background: #2b2145; }
.mplayer .mp-fill { height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), #f59e0b); transition: width .2s linear; }
.mplayer .mp-times { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-top: 5px; font-variant-numeric: tabular-nums; }
.mplayer .mp-dl {
  text-decoration: none; background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 10px; padding: 10px 14px; font-weight: 700; white-space: nowrap; font-size: .9rem;
}
body.studio .mplayer .mp-dl { color: #c9bbf0; }

/* ── Про-режим ── */
.pro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pro-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .pro-grid { grid-template-columns: 1fr; } }
.pro-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.pro-tabs button {
  border: 0; background: #ece5f8; color: var(--muted); border-radius: 10px 10px 0 0;
  padding: 10px 20px; font-weight: 700;
}
.pro-tabs button.active { background: var(--brand); color: #fff; }
.toggle-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.toggle-row input { width: auto; transform: scale(1.4); }
.slider-row { margin: 8px 0; }
.slider-row input[type=range] { width: 100%; }
.slider-row .val { color: var(--muted); font-size: .9rem; }

/* ── Мои песни ── */
.mytrack { border-bottom: 1px solid #eee6f8; padding: 14px 0; }
.mytrack:last-child { border-bottom: 0; }
.mytrack .t { font-weight: 700; }
.mytrack .s { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.mytrack audio { width: 100%; margin-top: 6px; }
.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: .8rem; font-weight: 700; }
.badge.pending { background: var(--accent-soft); color: #92600a; }
.badge.failed { background: #fde8e8; color: var(--danger); }

/* ── Варианты текста ── */
.variant-tabs { display: flex; gap: 8px; margin: 6px 0 0; }
.variant-tabs button {
  border: 2px solid #e4dcf2; background: #fff; border-radius: 12px 12px 0 0;
  padding: 10px 22px; font-weight: 700; color: var(--muted); border-bottom: 0;
}
.variant-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── Экран разблокировки ── */
.locked-track {
  border: 2px dashed #d3c4f0; border-radius: 16px; padding: 10px 18px; margin: 18px 0;
  background: #faf7ff;
}
.locked-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.locked-row + .locked-row { border-top: 1px solid #eee6f8; }
.locked-row .lock { font-size: 1.6rem; }
.locked-row > div { flex: 1; }
.fakebar {
  margin-top: 8px; height: 26px; border-radius: 8px; opacity: .55;
  background: repeating-linear-gradient(90deg, #c9b4f2 0 3px, transparent 3px 6px);
  -webkit-mask-image: linear-gradient(180deg, transparent 0 8px, #000 8px 18px, transparent 18px);
          mask-image: linear-gradient(180deg, transparent 0 8px, #000 8px 18px, transparent 18px);
}
.trust-row {
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  margin-top: 18px; color: var(--muted); font-size: .92rem;
}

/* ── Лента примеров ── */
.feed-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #eee6f8; }
.feed-item:last-child { border-bottom: 0; }
.feed-item img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.feed-item .fi-body { flex: 1; min-width: 0; }
.feed-item .fi-t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item .fi-s { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item audio { width: 100%; margin-top: 4px; height: 34px; }

/* ── Мой голос ── */
.rec-btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 16px 30px; font-size: 1.1rem; font-weight: 800;
  background: #dc2626; color: #fff; box-shadow: 0 4px 16px rgba(220,38,38,.4);
}
.rec-btn.recording { animation: pulse 1.2s infinite; background: #b91c1c; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(220,38,38,.15); } }
.phrase-box {
  background: var(--accent-soft); border: 2px solid #f3ce85; border-radius: 14px;
  padding: 18px; font-size: 1.25rem; font-weight: 700; text-align: center; margin: 14px 0;
}
.voice-badge {
  display: inline-flex; align-items: center; gap: 6px; background: #f2fbf4;
  border: 1px solid #b7e4c3; color: #14833b; border-radius: 999px; padding: 6px 14px; font-weight: 700;
}
.voice-option {
  border: 2px solid #e4dcf2; border-radius: 14px; padding: 14px 18px; margin: 14px 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.voice-option input { transform: scale(1.5); }

/* ── Менеджер голосов ── */
.voice-list { display: flex; flex-direction: column; }
.voice-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 6px;
  border-bottom: 1px solid var(--row-line);
}
.voice-row:last-child { border-bottom: 0; }
.voice-row.clickable { cursor: pointer; border-radius: 10px; transition: background .15s; }
.voice-row.clickable:hover { background: var(--row-hover); }
.voice-row .vr-body { flex: 1; min-width: 0; }
.voice-row .vr-body b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-row .vr-body small { color: var(--muted); }
.voice-row .vr-del {
  border: 0; background: none; font-size: 1.05rem; cursor: pointer; opacity: .65;
  padding: 6px 8px; border-radius: 8px;
}
.voice-row .vr-del:hover { opacity: 1; background: rgba(220, 38, 38, .1); }

/* живая волна записи с микрофона */
.rec-wave {
  display: block; width: 100%; height: 60px; margin: 10px 0;
  border-radius: 10px; background: var(--panel-bg); border: 1px solid var(--panel-border);
}

/* ── Студия ── */
.tools-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tools-row button {
  border: 1px solid #e4dcf2; background: #faf7ff; color: var(--brand-dark);
  border-radius: 10px; padding: 8px 14px; font-size: .9rem; font-weight: 700;
}
.tools-row button[disabled] { opacity: .55; }
.asset-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.asset-links a {
  background: var(--brand-soft); border-radius: 8px; padding: 6px 12px;
  font-size: .88rem; font-weight: 700; text-decoration: none;
}
.batch-select { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; flex-wrap: wrap; }
.batch-select select { width: auto; padding: 10px 14px; }

/* ── Редактор абзацев (про, «Свой текст») ── */
.para-card {
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 12px; margin: 10px 0;
}
.para-card .para-text { width: 100%; font-size: .95rem; min-height: 0; white-space: pre-wrap; }
.para-card .para-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.para-card .para-instr { flex: 1; min-width: 150px; padding: 9px 12px; font-size: .9rem; }
.para-card .para-regen { padding: 9px 14px; font-size: .85rem; white-space: nowrap; }

/* ── Референс-трек при создании ── */
.ref-block { margin-top: 4px; }
.ref-block summary { cursor: pointer; font-weight: 700; color: var(--brand-dark); padding: 6px 0; }

/* ── Кавер своим голосом ── */
.upload-zone {
  border: 2px dashed #c9b4f2; border-radius: 16px; padding: 26px; text-align: center;
  background: #faf7ff; cursor: pointer; transition: border-color .15s;
}
.upload-zone:hover { border-color: var(--brand); }
.upload-zone.has-file { border-style: solid; border-color: var(--ok); background: #f2fbf4; }
.upload-zone-sm { padding: 14px 16px; border-radius: 12px; }
.upload-zone-sm small { color: var(--muted); font-weight: 400; }

/* переключатель подрежимов — две равные кнопки в ряд */
.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.seg2 button {
  border: 2px solid var(--panel-border); background: var(--card); color: var(--muted);
  border-radius: 12px; padding: 10px 8px; font-weight: 700; font-size: .9rem; white-space: nowrap;
}
.seg2 button.selected { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

.hint-sm { font-size: .88rem; padding: 10px 14px; }

/* слайдеры — фирменный цвет и подписи краёв */
input[type=range] { accent-color: var(--brand); }
.range-hint {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: .78rem; margin: 2px 2px 6px;
}

/* ── Модалка оплаты ── */
.modal-back {
  position: fixed; inset: 0; background: rgba(30,20,50,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; border-radius: 20px; padding: 28px; max-width: 560px; width: 100%;
  max-height: 90vh; overflow: auto; position: relative;
}
.modal .close { position: absolute; top: 12px; right: 16px; border: 0; background: none; font-size: 1.6rem; color: var(--muted); }
.pack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
@media (max-width: 520px) { .pack-grid { grid-template-columns: 1fr; } }
.pack {
  border: 2px solid #e4dcf2; border-radius: 16px; padding: 18px; text-align: center;
  background: #fff; position: relative;
}
.pack.hit { border-color: var(--accent); }
.pack .hit-label {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: .75rem; font-weight: 800;
  border-radius: 999px; padding: 3px 12px; white-space: nowrap;
}
.pack .n { font-size: 1.25rem; font-weight: 800; }
.pack .p { font-size: 1.5rem; font-weight: 800; color: var(--brand); margin: 6px 0; }
.pack .d { color: var(--ok); font-weight: 700; font-size: .9rem; min-height: 1.2em; }
.pack button { width: 100%; margin-top: 10px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 12px; padding: 14px 22px;
  z-index: 100; box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}

/* ── Экран входа ── */
.auth-wrap { max-width: 480px; margin: 40px auto; text-align: center; }
.auth-wrap .note { color: var(--muted); font-size: .9rem; margin-top: 14px; }
.dev-login { margin-top: 22px; padding-top: 18px; border-top: 1px dashed #d8cff0; }

/* ══════════════════════════════════════════════════════════════════════════
   СТУДИЯ (про-режим) — тёмная DAW-тема, реф: Suno
   ══════════════════════════════════════════════════════════════════════════ */
body.studio {
  --bg: #0c0914;
  --card: #151022;
  --ink: #efeaf8;
  --muted: #9b90ba;
  --brand: #8b5cf6;
  --brand-dark: #a78bfa;
  --brand-soft: rgba(139, 92, 246, .16);
  --accent-soft: rgba(251, 191, 36, .14);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --panel-bg: #1c1430;
  --panel-border: #342454;
  --pop-bg: #1d1531;
  --pop-border: #372a58;
  --row-line: rgba(255, 255, 255, .05);
  --row-hover: rgba(255, 255, 255, .04);
  background:
    radial-gradient(60% 40% at 80% -5%, rgba(139, 92, 246, .16), transparent 70%),
    radial-gradient(40% 30% at 10% 10%, rgba(192, 38, 211, .08), transparent 70%),
    var(--bg);
}
body.studio .topbar { background: rgba(12, 9, 20, .85); border-color: rgba(255, 255, 255, .08); }
body.studio .mode-switch { background: rgba(255, 255, 255, .07); }
body.studio .card { border: 1px solid rgba(255, 255, 255, .07); }
body.studio input[type=text], body.studio input[type=number], body.studio textarea, body.studio select {
  background: #1c1430; border-color: #342454; color: var(--ink);
}
body.studio input:focus, body.studio textarea:focus, body.studio select:focus { border-color: var(--brand); }
body.studio .chips button, body.studio .choice-grid button {
  background: #1c1430; border-color: #342454; color: var(--ink);
}
body.studio .chips button.selected { background: var(--brand-soft); border-color: var(--brand); }
body.studio .pro-tabs button { background: rgba(255, 255, 255, .06); color: var(--muted); }
body.studio .pro-tabs button.active { background: var(--brand); color: #fff; }
body.studio .lyrics-box { background: #17102a; border-color: #342454; }
body.studio .mytrack { border-color: rgba(255, 255, 255, .07); }
body.studio .tools-row button { background: #1c1430; border-color: #342454; color: #c9bbf0; }
body.studio .asset-links a { background: var(--brand-soft); color: #c9bbf0; }
body.studio .modal { background: #171126; color: var(--ink); }
body.studio .hint { background: rgba(139, 92, 246, .12); color: #cbbdf3; }
body.studio .upload-zone { background: #17102a; border-color: #46337a; }
body.studio .balance-chip { background: var(--accent-soft); border-color: rgba(251, 191, 36, .35); color: var(--ink); }
body.studio .pack { background: #1c1430; border-color: #342454; }
body.studio .locked-track { background: #17102a; border-color: #46337a; }
body.studio .variant-tabs button { background: #1c1430; border-color: #342454; color: var(--muted); }
body.studio .variant-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Layout студии: панель создания слева, воркспейс справа (не зависит от темы).
   Без внутреннего скролла панели — страница скроллится целиком, скроллбар один. */
body.pro { overflow-x: clip; }
body.pro .container { max-width: 1240px; padding-bottom: 120px; }
.studio-layout { display: grid; grid-template-columns: 440px 1fr; gap: 22px; align-items: start; }
.studio-layout > .card { padding: 24px; }
#proWorkspace .card { min-height: 300px; }
@media (max-width: 1020px) {
  .studio-layout { grid-template-columns: 1fr; }
}

/* Компактные второстепенные кнопки студии — главная кнопка создания должна доминировать */
.btn-sm { padding: 9px 14px !important; font-size: .88rem !important; border-radius: 10px !important; }
#viewPro .pro-tabs button { padding: 8px 14px; font-size: .9rem; white-space: nowrap; }
#viewPro .chips button { padding: 6px 12px; font-size: .85rem; }
#viewPro .pro-grid { gap: 12px; }
#viewPro label.field { margin-top: 12px; font-size: .95rem; }

/* Строка трека в студии */
.strack {
  display: flex; align-items: center; gap: 12px; padding: 10px 8px;
  border-radius: 12px; transition: background .15s;
}
.strack:hover { background: var(--row-hover); }
.strack + .strack { border-top: 1px solid var(--row-line); }
.strack .st-cover { width: 46px; height: 46px; min-width: 46px; border-radius: 9px; object-fit: cover; background: var(--panel-bg); }
.strack .st-body { flex: 1; min-width: 0; }
.strack .st-title { font-weight: 700; font-size: .96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strack .st-tags { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strack .st-dur { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.strack .st-play {
  width: 40px; height: 40px; min-width: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(93deg, #7c3aed, #c026d3 60%, #f59e0b); color: #fff; font-size: .9rem;
  box-shadow: 0 3px 12px rgba(139, 92, 246, .35);
}
.strack .st-edit {
  border: 1px solid var(--panel-border); background: var(--panel-bg); color: var(--brand-dark);
  border-radius: 9px; padding: 7px 11px; font-weight: 700; font-size: .8rem; cursor: pointer;
}
.strack details.st-menu { position: relative; }
.strack details.st-menu summary {
  list-style: none; cursor: pointer; width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--panel-border); background: var(--panel-bg); color: var(--brand-dark); font-size: 1.05rem;
}
.strack details.st-menu summary::-webkit-details-marker { display: none; }
.strack details.st-menu[open] .st-pop {
  position: absolute; right: 0; top: 46px; z-index: 30; width: 250px;
  background: var(--pop-bg); border: 1px solid var(--pop-border); border-radius: 14px; padding: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; gap: 6px;
}
.st-pop button, .st-pop a {
  text-align: left; border: 0; background: transparent; color: var(--ink);
  border-radius: 8px; padding: 9px 10px; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none;
}
.st-pop button:hover, .st-pop a:hover { background: var(--brand-soft); }
.st-pop .sep { border-top: 1px solid var(--pop-border); margin: 4px 0; }
.st-badge { font-size: .75rem; border-radius: 6px; padding: 2px 8px; font-weight: 700; }
.st-badge.pending { background: var(--accent-soft); color: #fbbf24; }
.st-badge.failed { background: rgba(220, 38, 38, .18); color: #f87171; }

/* Нижний плеер (цвета через переменные — работает в обеих темах) */
#playerBar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(18px);
  border-top: 1px solid var(--panel-border);
  padding: 12px 22px;
  box-shadow: 0 -8px 30px rgba(43, 36, 55, .12);
}
#playerBar img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--panel-bg); }
#playerBar .pb-title { font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; color: var(--ink); }
#playerBar .pb-play {
  width: 46px; height: 46px; min-width: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(93deg, #7c3aed, #c026d3 60%, #f59e0b); color: #fff; font-size: 1rem;
}
#playerBar input[type=range] {
  flex: 1; accent-color: var(--brand); height: 4px; cursor: pointer;
}
#playerBar .pb-time { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Переключатель темы студии ── */
.theme-toggle {
  border: 1px solid var(--panel-border); background: var(--panel-bg); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font-size: .95rem; cursor: pointer; font-weight: 700;
}

/* ── Редактор трека (страница-проект) ── */
.editor-modal { max-width: 860px !important; }
body.pro #viewEditor .container, .ed-page { max-width: 1400px; }
.ed-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 16px; flex-wrap: wrap; }
.ed-head .btn-back { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 1rem; cursor: pointer; padding-top: 8px; }
.ed-head-title { flex: 1; min-width: 0; }
.ed-head-title h1 { margin: 0 0 8px; }
.ed-versions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-versions button {
  border: 1px solid var(--panel-border); background: var(--panel-bg); color: var(--muted);
  border-radius: 999px; padding: 5px 14px; font-size: .82rem; font-weight: 700; cursor: pointer;
}
.ed-versions button.active { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.ed-versions button.pending { opacity: .6; }

#waveWrap { position: relative; user-select: none; }
#waveCanvas { width: 100%; height: 150px; display: block; border-radius: 12px; background: var(--panel-bg); cursor: crosshair; border: 1px solid var(--panel-border); }

.ed-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; margin-top: 18px; align-items: start; }
@media (max-width: 960px) { .ed-grid { grid-template-columns: 1fr; } }
.ed-lyrics {
  background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 18px 20px; font-size: 1.02rem; line-height: 1.9;
  max-height: 56vh; overflow: auto; white-space: pre-wrap; user-select: none; cursor: text;
}
.ed-lyrics .w { border-radius: 4px; padding: 1px 2px; cursor: pointer; }
.ed-lyrics .w:hover { background: var(--brand-soft); }
.ed-lyrics .w.insel { background: var(--accent-soft); color: inherit; font-weight: 700; }
.ed-lyrics .w.playing { background: var(--brand-soft); font-weight: 800; }
.ed-lyrics .tag { color: var(--muted); font-size: .82rem; letter-spacing: .05em; }
.ed-side { position: sticky; top: 84px; }
.ed-actions-card {
  background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 14px; padding: 18px;
}
.ed-actions-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.ed-actions-card .ea-sub { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.ea-list { display: flex; flex-direction: column; gap: 8px; }
.ea-list button {
  text-align: left; border: 1px solid var(--panel-border); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 12px 14px; font: inherit; font-size: .95rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ea-list button:hover { border-color: var(--brand); background: var(--brand-soft); }
.ea-list button b { display: block; }
.ea-list button small { color: var(--muted); }
.ea-list button .cost { color: #b45309; font-weight: 700; font-size: .8rem; }
body.studio .ea-list button .cost { color: #fbbf24; }
#edForm .field { margin-top: 12px; }
.ed-transport { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.ed-transport .sel-chip {
  background: var(--accent-soft); border-radius: 999px; padding: 4px 14px; font-size: .88rem; font-weight: 700; color: #92600a;
}
body.studio .ed-transport .sel-chip { color: #fcd34d; }
.ed-frag-preview {
  background: var(--accent-soft); border: 1px dashed rgba(245, 158, 11, .5); border-radius: 10px;
  padding: 10px 14px; font-size: .9rem; margin: 10px 0; max-height: 120px; overflow: auto; white-space: pre-wrap;
}
.wave-hint { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.ed-sel-info {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 14px 0;
  font-variant-numeric: tabular-nums;
}
.ed-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ed-words {
  background: var(--accent-soft); border: 1px solid rgba(245, 158, 11, .35);
  border-radius: 10px; padding: 10px 14px; font-size: .92rem; margin: 12px 0; color: #92600a;
}
body.studio .ed-words { color: #fcd34d; }
.ed-sel-info b { color: #b45309; }
body.studio .ed-sel-info b { color: #fbbf24; }
