/* app.css — база и компоненты. Стили дизайна A, разложенные по блокам. */

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

body {
  font-family: -apple-system, "SF Pro Text", "Inter", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 80% at 70% -10%, #3a2a6e 0%, var(--bg0) 38%, var(--bg2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* звёзды (декор, не привязка к теме сна — просто «премиум-небо») */
.stars { position: fixed; inset: 0; pointer-events: none; opacity: 0.45; z-index: 0; }
.star { position: absolute; background: #fff; border-radius: 50%; animation: tw 4s infinite ease-in-out; }
@keyframes tw { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.9; } }

.wrap {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--pad) calc(var(--tabbar-h) + 26px);
}

/* ── шапка ─────────────────────────────────────────────── */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 2px 8px; }
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, #fff4e6, #ffe1cd);
  box-shadow: 0 6px 18px -7px rgba(255, 184, 120, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.logo img { width: 35px; height: 35px; object-fit: contain; display: block; }
.brand b { font-size: 20px; letter-spacing: 0.3px; font-weight: 700; }
.brand span { display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 1px; }

/* ── баланс-капсула ────────────────────────────────────── */
.bal {
  display: flex; align-items: center; gap: 7px; background: var(--card);
  border: 1px solid var(--card-br); border-radius: var(--r-pill); padding: 6px 6px 6px 13px;
}
.bal .note { width: 15px; height: 15px; flex: none; }
.bal .note path { fill: var(--accent); }
.bal b { font-weight: 750; font-size: 15px; line-height: 1; }
.bal small { color: var(--muted); font-weight: 500; font-size: 11.5px; line-height: 1; margin-left: -3px; }
.bal .plus {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-d)); margin-left: 1px;
}
.bal .plus svg { width: 15px; height: 15px; }
.bal .plus path { stroke: var(--ink-on-accent); }

/* подсказка под шапкой */
.balhint { display: flex; align-items: center; gap: 7px; margin: 9px 4px 0; color: var(--muted); font-size: 12.5px; }
.balhint b { color: var(--accent); font-weight: 700; }
/* инлайн-нотка в микрокопии (замена символа ♪) */
.inote { width: 12px; height: 12px; vertical-align: -1px; }
.inote path { fill: var(--accent); }
.balhint .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); opacity: 0.6; }

/* ── hero ──────────────────────────────────────────────── */
.hero {
  margin-top: 14px; border-radius: var(--r-lg); padding: 22px 20px 20px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.32), rgba(255, 212, 121, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.hero h1 { font-size: 23px; line-height: 1.15; font-weight: 750; letter-spacing: 0.2px; }
.hero p { color: var(--muted); font-size: 13.5px; margin-top: 7px; max-width: 80%; }
.hero .cta {
  margin-top: 18px; display: inline-flex; align-items: center; gap: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: var(--ink-on-accent);
  font-weight: 750; padding: 14px 22px; border-radius: 18px; font-size: 15.5px; border: none;
  box-shadow: var(--sh-accent);
}
.hero .cta svg { width: 18px; height: 18px; }
.hero .cta path { stroke: var(--ink-on-accent); }
.hero .zzz { position: absolute; right: 18px; top: 16px; font-size: 40px; opacity: 0.18; }

/* ── чипы направлений ──────────────────────────────────── */
.chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip {
  background: var(--card); border: 1px solid var(--card-br); color: var(--ink);
  padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.chip.on { background: rgba(255, 212, 121, 0.18); border-color: rgba(255, 212, 121, 0.5); color: var(--accent); }

/* ── секция-заголовок ──────────────────────────────────── */
.shead { display: flex; align-items: center; justify-content: space-between; margin: 26px 4px 12px; }
.shead h2 { font-size: 16px; font-weight: 700; }
.shead a { color: var(--accent2); font-size: 13px; font-weight: 600; text-decoration: none; }

/* ── строка песни ──────────────────────────────────────── */
.song {
  display: flex; align-items: center; gap: 13px; background: var(--card); border: 1px solid var(--card-br);
  border-radius: var(--r-md); padding: 12px 13px; margin-bottom: 11px;
}
.cover { width: 52px; height: 52px; border-radius: 15px; flex: none; position: relative; overflow: hidden; display: grid; place-items: center; }
.cover.c1 { background: var(--c1); } .cover.c2 { background: var(--c2); } .cover.c3 { background: var(--c3); }
.cover svg { width: 22px; height: 22px; opacity: 0.95; }
.cover path { fill: #fff; }
.song .meta { flex: 1; min-width: 0; }
.song .meta b { font-size: 14.5px; font-weight: 650; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .meta span { font-size: 12px; color: var(--muted); }
.wf { display: flex; align-items: center; gap: 2px; height: 18px; margin-top: 5px; }
.wf i { width: 2px; background: var(--accent2); border-radius: 2px; opacity: 0.55; }
.song .act { display: flex; gap: 6px; flex: none; }
.iconbtn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--card-br); background: var(--card-2); display: grid; place-items: center; }
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn path, .iconbtn circle { fill: none; stroke: var(--ink); stroke-width: 2; }
.iconbtn.play { background: linear-gradient(135deg, var(--accent), var(--accent-d)); border: none; }
.iconbtn.play path { fill: var(--ink-on-accent); stroke: none; }

/* статус генерации */
.song.pending { opacity: 0.75; }
.badge { font-size: 11px; font-weight: 700; color: var(--accent); border: 1px solid rgba(255,212,121,.4);
  background: rgba(255,212,121,.1); border-radius: 10px; padding: 3px 8px; }

/* ── таб-бар ───────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: var(--maxw); margin: 0 auto; z-index: 30;
  background: rgba(15, 11, 43, 0.82); backdrop-filter: blur(18px); border-top: 1px solid var(--card-br);
  display: flex; justify-content: space-around; padding: 10px 0 26px;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 600; background: none; border: none; }
.tab svg { width: 23px; height: 23px; }
.tab path, .tab circle { fill: none; stroke: currentColor; stroke-width: 1.9; }
.tab.on { color: var(--accent); }

/* focus-режим (визард): прячем таб-бар — низом владеет .actionbar */
body.focus .tabbar { display: none; }

/* ── bottom-sheet (пополнение) ─────────────────────────── */
.backdrop { position: fixed; inset: 0; background: rgba(8, 6, 22, 0.6); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: 0.25s; z-index: 40; }
.backdrop.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: var(--maxw); margin: 0 auto; z-index: 50;
  background: linear-gradient(180deg, #241a52, #16102f); border: 1px solid var(--card-br); border-bottom: none;
  border-radius: 28px 28px 0 0; padding: 8px var(--pad) calc(26px + env(safe-area-inset-bottom));
  transform: translateY(110%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.on { transform: translateY(0); }
.grip { width: 40px; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); margin: 6px auto 14px; }
.sheet h3 { font-size: 19px; font-weight: 750; text-align: center; }
.sheet .lead { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 18px; }
.pack { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--card-br); border-radius: 18px; padding: 15px 16px; margin-bottom: 11px; position: relative; width: 100%; text-align: left; color: var(--ink); }
.pack.best { border-color: rgba(255, 212, 121, 0.55); background: rgba(255, 212, 121, 0.08); }
.pack .q { width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent2), var(--accent2-d)); }
.pack .q svg { width: 22px; height: 22px; }
.pack .q path { fill: #fff; }
.pack .pinfo { flex: 1; }
.pack .pinfo b { font-size: 15.5px; font-weight: 700; display: block; }
.pack .pinfo span { font-size: 12.5px; color: var(--muted); }
.pack .price { font-weight: 800; font-size: 17px; color: var(--accent); }
.pack .tagbest { position: absolute; top: -9px; right: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: var(--ink-on-accent); font-size: 10.5px; font-weight: 800; padding: 3px 10px; border-radius: 20px; letter-spacing: 0.3px; }
.sheet .note-txt { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 8px; opacity: 0.8; }

/* ── визард «Создать песню» ────────────────────────────── */
.scr-head { display: flex; align-items: center; gap: 12px; padding: 16px 2px 6px; }
.scr-head .ttl { font-size: 21px; font-weight: 750; }
.scr-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.steps { display: flex; gap: 6px; margin: 14px 2px 20px; }
.steps i { flex: 1; height: 4px; border-radius: 3px; background: var(--card-br); }
.steps i.done { background: var(--accent); }
.steps i.cur { background: var(--accent2); }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 650; margin-bottom: 9px; }
.field .hint { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.input, .textarea {
  width: 100%; background: var(--card); border: 1px solid var(--card-br); border-radius: var(--r-sm);
  color: var(--ink); font-size: 16px; padding: 14px 15px; outline: none;
}
.input:focus, .textarea:focus { border-color: var(--accent2); }
.textarea { min-height: 92px; resize: none; line-height: 1.4; }
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice button {
  flex: 1; min-width: 110px; background: var(--card); border: 1px solid var(--card-br); color: var(--ink);
  border-radius: var(--r-sm); padding: 14px; font-size: 15px; font-weight: 600;
}
.choice button.on { background: rgba(255, 212, 121, 0.16); border-color: var(--accent); color: var(--accent); }

/* нижняя закреплённая кнопка действия */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: var(--maxw); margin: 0 auto; z-index: 35;
  padding: 12px var(--pad) calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(15,11,43,0), rgba(15,11,43,.92) 38%);
}
.btn-primary {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: var(--ink-on-accent);
  font-weight: 750; padding: 16px; border-radius: 18px; font-size: 16px; border: none; box-shadow: var(--sh-accent);
}
.btn-primary:disabled { opacity: 0.45; box-shadow: none; }
.btn-primary .cost { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
.btn-primary .cost svg { width: 15px; height: 15px; }
.btn-primary .cost path { fill: var(--ink-on-accent); }
.btn-ghost { width: 100%; background: var(--card); border: 1px solid var(--card-br); color: var(--ink);
  border-radius: 16px; padding: 14px; font-size: 15px; font-weight: 650; }

/* ── карточка песни ────────────────────────────────────── */
.bigcover { width: 100%; aspect-ratio: 1; border-radius: var(--r-lg); margin-top: 10px; display: grid; place-items: center; position: relative; overflow: hidden; }
.bigcover svg { width: 64px; height: 64px; opacity: 0.9; }
.bigcover path { fill: #fff; }
.song-title { font-size: 22px; font-weight: 750; margin-top: 18px; text-align: center; }
.song-sub { text-align: center; color: var(--muted); font-size: 13px; margin-top: 4px; }
.player { display: flex; align-items: center; gap: 14px; margin: 20px 0 6px; }
.player .big-play { width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-d)); border: none; }
.player .big-play svg { width: 24px; height: 24px; }
.player .big-play path { fill: var(--ink-on-accent); }
.player .bar { flex: 1; }
.player .track { height: 5px; background: var(--card-br); border-radius: 3px; overflow: hidden; }
.player .track i { display: block; height: 100%; width: 32%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.player .time { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.variants { display: flex; gap: 10px; margin: 16px 0; }
.variant { flex: 1; background: var(--card); border: 1px solid var(--card-br); border-radius: var(--r-sm); padding: 13px; text-align: center; }
.variant.on { border-color: var(--accent); background: rgba(255, 212, 121, 0.1); }
.variant b { font-size: 13.5px; font-weight: 700; display: block; }
.variant span { font-size: 11.5px; color: var(--muted); }

.row-actions { display: flex; gap: 10px; margin: 8px 0 18px; }
.row-actions button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--card); border: 1px solid var(--card-br); color: var(--ink); border-radius: 14px; padding: 13px; font-size: 14px; font-weight: 650; }
.row-actions svg { width: 17px; height: 17px; }
.row-actions path { fill: none; stroke: var(--ink); stroke-width: 2; }

.lyrics { background: var(--card); border: 1px solid var(--card-br); border-radius: var(--r-md); padding: 16px 18px; }
.lyrics h4 { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 10px; }
.lyrics pre { font-family: inherit; white-space: pre-wrap; line-height: 1.6; font-size: 14.5px; color: var(--ink); }

/* правки за нотку */
.edit-card { margin-top: 14px; background: var(--card); border: 1px solid var(--card-br); border-radius: var(--r-md); padding: 14px 16px; }
.edit-card .ehead { display: flex; align-items: center; justify-content: space-between; }
.edit-card .ehead b { font-size: 14.5px; font-weight: 700; }
.edit-opts { display: flex; gap: 8px; margin-top: 12px; }
.edit-opts button { flex: 1; background: var(--card-2); border: 1px solid var(--card-br); color: var(--ink); border-radius: 12px; padding: 11px; font-size: 13px; font-weight: 600; }

/* ── общие состояния ───────────────────────────────────── */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .em { opacity: 0.5; }
.empty .em svg { width: 46px; height: 46px; }
.empty .em path, .empty .em circle { fill: currentColor; }
.empty.err .em path, .empty.err .em circle { fill: none; stroke: currentColor; stroke-width: 1.7; }
.empty p { margin-top: 12px; font-size: 14px; white-space: pre-line; }

/* профиль-аватар и прочие «контурные» иконки в обложке */
.cover.outline path, .cover.outline circle { fill: none; stroke: #fff; stroke-width: 2; }

/* hero — декоративная нота */
.hero .zzz svg { width: 40px; height: 40px; }
.hero .zzz path { fill: #fff; }

/* подсказка над кнопкой «Сгенерировать текст» */
.create-note { font-size: 12px; color: var(--muted); text-align: center; margin: 0 6px 10px; }

/* профиль — строки прайса с SVG-ноткой */
.noteline { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13.5px; color: var(--ink); }
.noteline .n { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-weight: 800; min-width: 34px; }
.noteline .note { width: 14px; height: 14px; }
.noteline .note path { fill: var(--accent); }

/* ── экран ревью текста (lyrics) ────────────────────────── */
.lyr-note { display: flex; gap: 9px; align-items: flex-start; background: rgba(167,139,250,.12);
  border: 1px solid rgba(167,139,250,.28); border-radius: var(--r-sm); padding: 11px 13px; margin: 6px 0 16px; }
.lyr-note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.lyr-note path { fill: var(--accent2); }
.lyr-note span { font-size: 12.5px; color: var(--ink); line-height: 1.4; }

.lyr-head2 { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; }
.lyr-cap { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.lyr-toggle { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--card-br);
  color: var(--ink); border-radius: 11px; padding: 7px 12px; font-size: 12.5px; font-weight: 650; }
.lyr-toggle svg { width: 15px; height: 15px; }
.lyr-toggle path { fill: none; stroke: var(--ink); stroke-width: 2; }

.lyr-doc { background: var(--card); border: 1px solid var(--card-br); border-radius: var(--r-md); padding: 6px 18px 18px; }
.lyr-sec { margin-top: 16px; }
.lyr-tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  color: var(--accent); background: rgba(255,212,121,.12); border: 1px solid rgba(255,212,121,.3);
  border-radius: 8px; padding: 3px 9px; margin-bottom: 8px; }
.lyr-lines p { font-size: 15px; line-height: 1.62; color: var(--ink); }
.lyr-lines p.gap { height: 7px; }

.lyr-edit { width: 100%; background: var(--card); border: 1px solid var(--card-br); border-radius: var(--r-md);
  color: var(--ink); font-size: 15px; line-height: 1.6; padding: 16px 18px; outline: none; resize: none;
  min-height: 280px; font-family: inherit; }
.lyr-edit:focus { border-color: var(--accent2); }
.lyr-hint { font-size: 11.5px; color: var(--muted); margin: 9px 4px 0; line-height: 1.45; }
.lyr-empty { color: var(--muted); text-align: center; padding: 30px; font-size: 14px; }

.lyr-actions { display: flex; flex-direction: column; gap: 9px; }
.lyr-redo { display: flex; align-items: center; justify-content: center; gap: 8px; }
.lyr-redo svg { width: 16px; height: 16px; }
.lyr-redo path { fill: none; stroke: var(--ink); stroke-width: 2; }
.skeleton { background: linear-gradient(90deg, var(--card-2), var(--card), var(--card-2)); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--r-md); }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spinner { width: 28px; height: 28px; border: 3px solid var(--card-br); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px); transform: translateX(-50%) translateY(20px);
  background: rgba(20, 14, 48, 0.96); border: 1px solid var(--card-br); color: var(--ink); padding: 12px 18px;
  border-radius: 14px; font-size: 13.5px; font-weight: 600; z-index: 60; opacity: 0; transition: 0.25s; max-width: 86%; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
