/* Hitmaker AI — конструктор-диалог.
   Один экран без прокрутки страницы: шапка и строка ввода закреплены,
   прокручивается только лента сообщений. */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Unbounded:wght@500;600&display=swap');

:root {
  --bg: #100d1f;
  --surface: rgba(255, 255, 255, .045);
  --surface-strong: rgba(255, 255, 255, .075);
  --text: #f8f6ff;
  --muted: #a9a2bd;
  --primary: #a57bff;
  --primary-strong: #8257e6;
  --accent: #ff6cae;
  --gold: #f6c86b;
  --border: rgba(255, 255, 255, .12);
  --success: #43c996;
  --danger: #ef6b78;
  --radius: 18px;
  --radius-sm: 13px;
  --bar: 68px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  min-width: 320px;
  display: grid;
  grid-template-rows: var(--bar) minmax(0, 1fr) auto;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;                 /* страница не прокручивается никогда */
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.glow { position: fixed; z-index: 0; width: 460px; height: 460px; border-radius: 50%; filter: blur(120px); opacity: .18; pointer-events: none; }
.glow-a { background: var(--primary); top: -220px; right: -160px; }
.glow-b { background: var(--accent); bottom: -260px; left: -200px; }

/* ---------- Шапка ---------- */
.bar {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 clamp(14px, 3vw, 28px);
  background: rgba(11, 9, 20, .82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.logo { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.logo img { width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; }
.logo-name { display: grid; font-size: 16px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.logo-name b { color: var(--primary); }
.logo-name small { color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0; }
.bar-actions { display: flex; align-items: center; gap: 10px; }
.lang { display: flex; flex-wrap: wrap; justify-content: center; padding: 3px; border: 1px solid var(--border); border-radius: 10px; }
.lang button { min-width: 36px; height: 30px; padding: 0 7px; color: var(--muted); border: 0; background: transparent; border-radius: 7px; font-size: 12px; font-weight: 800; transition: color .18s ease, background .18s ease; }
.lang button[aria-pressed="true"] { color: var(--text); background: rgba(255, 255, 255, .1); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border: 1px solid rgba(165, 123, 255, .5); border-radius: 999px;
  background: rgba(165, 123, 255, .12); color: var(--text);
  font-size: 14px; font-weight: 800; white-space: nowrap;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.3), background .2s ease, border-color .2s ease;
}
.pill:hover { transform: scale(1.06); background: rgba(165, 123, 255, .22); border-color: var(--primary); }
.pill:active { transform: scale(.97); }

/* Аккаунт — такая же подписанная кнопка, как «Новая песня»: одна иконка
   без подписи не читалась, особенно на телефоне */
.pill-account { border-color: var(--border); background: var(--surface); }
.pill-account:hover { border-color: var(--primary); background: rgba(165, 123, 255, .16); }
.pill-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.pill-credits { min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: linear-gradient(135deg, var(--primary-strong), var(--accent)); color: #fff; font-size: 11px; font-weight: 800; }

/* ---------- Лента ---------- */
.feed {
  position: relative; z-index: 1;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 22px clamp(14px, 3vw, 24px) 10px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.feed > * { width: min(100%, 720px); margin: 0 auto; }
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb { border-radius: 8px; background: rgba(255, 255, 255, .12); }

/* Серверный вводный блок уже находится в HTML для поисковиков и посетителей
   без JavaScript. После запуска конструктора он заменяется сообщениями чата. */
.initial-seo {
  padding: clamp(24px, 5vw, 46px);
  border: 1px solid var(--border); border-radius: 26px;
  background: linear-gradient(145deg, rgba(36, 26, 62, .96), rgba(20, 17, 37, .96));
}
.js .initial-seo {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.initial-seo-kicker { margin: 0 0 12px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.initial-seo h1 { margin: 0; font-family: Unbounded, Manrope, sans-serif; font-size: clamp(30px, 5vw, 52px); line-height: 1.12; letter-spacing: -.04em; }
.initial-seo > p:not(.initial-seo-kicker) { max-width: 640px; margin: 18px 0 0; color: #c6c0d3; font-size: 17px; }
.initial-seo nav { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 25px; }
.initial-seo nav a { padding: 8px 12px; border: 1px solid rgba(165,123,255,.32); border-radius: 999px; background: rgba(165,123,255,.08); color: #ddd5ef; font-size: 12px; font-weight: 700; text-decoration: none; }

.msg { display: flex; gap: 11px; align-items: flex-start; animation: rise .32s cubic-bezier(.2,.9,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.msg-avatar { flex: 0 0 auto; }
.msg-avatar img { width: 34px; height: 34px; border-radius: 50%; }
.bubble {
  max-width: 78%;
  padding: 13px 16px; border-radius: 4px 18px 18px 18px;
  background: var(--surface-strong); border: 1px solid var(--border);
  white-space: pre-wrap;
}
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  border-radius: 18px 18px 4px 18px;
  background: linear-gradient(135deg, rgba(130, 87, 230, .38), rgba(255, 108, 174, .24));
  border-color: rgba(165, 123, 255, .38);
  font-weight: 600;
}
.bubble b { color: var(--gold); }

/* «печатает…» */
.typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; } .typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Кнопки-варианты ---------- */
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-left: 45px; animation: rise .32s cubic-bezier(.2,.9,.3,1) .05s both; }
.options.one { grid-template-columns: 1fr; }
.option {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 12px 16px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-weight: 700;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.3), border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.option .sticker { font-size: 22px; line-height: 1; flex: 0 0 auto; transition: transform .25s cubic-bezier(.2,.9,.3,1.5); }
.option:hover { transform: scale(1.035); border-color: rgba(165, 123, 255, .65); background: rgba(165, 123, 255, .14); box-shadow: 0 12px 30px rgba(130, 87, 230, .18); }
.option:hover .sticker { transform: scale(1.22) rotate(-7deg); }
.option:active { transform: scale(.985); }
.option small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.option.primary { border-color: rgba(165, 123, 255, .55); background: linear-gradient(135deg, rgba(130, 87, 230, .3), rgba(255, 108, 174, .16)); }

/* ---------- Карточки в ленте ---------- */
.card {
  padding: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); animation: rise .32s cubic-bezier(.2,.9,.3,1) both;
  /* Отступ под аватаркой задаём рамкой, а не margin-left: он перебивал
     margin: 0 auto из .feed > * и утаскивал карточку к левому краю */
  border-left: 3px solid rgba(165, 123, 255, .45);
}
.card h3 { margin: 0 0 4px; font: 600 18px/1.25 Unbounded, Manrope, sans-serif; letter-spacing: -.03em; }
.card .card-note { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.lyrics { max-height: 32vh; overflow-y: auto; margin: 0; padding: 14px; border-radius: var(--radius-sm); background: rgba(0, 0, 0, .28); font: 400 14px/1.65 Manrope, sans-serif; white-space: pre-wrap; }
.lyrics::-webkit-scrollbar { width: 6px; }
.lyrics::-webkit-scrollbar-thumb { border-radius: 6px; background: rgba(255, 255, 255, .14); }

.button {
  width: 100%; min-height: 50px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 800; text-decoration: none; white-space: nowrap;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.3), background .2s ease, opacity .2s ease;
}
.button:hover { transform: scale(1.025); }
.button:active { transform: scale(.985); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--primary-strong), #b064e7); box-shadow: 0 14px 30px rgba(130, 87, 230, .3); }
.button-primary:hover { background: linear-gradient(135deg, #9168ea, #c16af0); }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--border); }
.button-ghost:hover { color: var(--text); border-color: var(--primary); }
.button + .button { margin-top: 10px; }

/* Карточка скидки за подписку — выделяем золотом, это подарок */
.card.bonus { border-color: rgba(246, 200, 107, .45); background: linear-gradient(150deg, rgba(246, 200, 107, .12), rgba(255, 108, 174, .07)); border-left-color: var(--gold); }
.card.bonus h3 { color: var(--gold); }
.checkout-trust { margin: 10px 0 16px; color: #f6c86b; font-weight: 700; }
.tg-widget { display: flex; justify-content: center; margin: 12px 0 0; min-height: 40px; }
.tier .tier-price-group { grid-column: 2; grid-row: 1 / 3; display: flex; align-items: baseline; justify-content: flex-end; gap: 9px; white-space: nowrap; }
.tier .tier-old { color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: line-through; text-decoration-thickness: 1.5px; }

/* Пакеты */
.tiers { display: grid; gap: 10px; margin-bottom: 14px; }
.tier {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 14px;
  width: 100%; padding: 14px 16px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text);
  transition: transform .18s cubic-bezier(.2,.9,.3,1.3), border-color .18s ease, background .18s ease;
}
.tier:hover { transform: scale(1.015); border-color: rgba(165, 123, 255, .5); }
.tier[aria-pressed="true"] { border-color: var(--primary); background: rgba(165, 123, 255, .15); }
.tier .tier-name { font-size: 15px; font-weight: 800; }
.tier .tier-per { grid-column: 1; color: var(--muted); font-size: 12px; }
.tier .tier-price { font: 600 19px/1 Unbounded, Manrope, sans-serif; letter-spacing: -.03em; }
.tier .tier-badge { position: absolute; top: -8px; left: 14px; padding: 2px 9px; border-radius: 999px; background: linear-gradient(135deg, var(--primary-strong), var(--accent)); color: #fff; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }

.providers { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.provider { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; text-align: left; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.provider:hover { transform: scale(1.02); }
.provider[aria-pressed="true"] { border-color: var(--primary); background: rgba(165, 123, 255, .15); }
.provider small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }

.fields { display: grid; gap: 9px; margin-bottom: 12px; }
.fields input, #loginEmail {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .25); color: var(--text); font-size: 15px;
}
.fields input:focus, #loginEmail:focus { outline: none; border-color: rgba(165, 123, 255, .6); }
.legal { margin: 10px 0 0; color: var(--muted); font-size: 11.5px; text-align: center; }

.player { width: 100%; margin: 12px 0; }
.spinner { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 34px; margin: 6px 0 14px; }
.spinner i { width: 5px; height: 9px; border-radius: 3px; background: linear-gradient(180deg, var(--primary), var(--accent)); animation: bounce 1.1s ease-in-out infinite; }
.spinner i:nth-child(2) { animation-delay: .12s; } .spinner i:nth-child(3) { animation-delay: .24s; }
.spinner i:nth-child(4) { animation-delay: .36s; } .spinner i:nth-child(5) { animation-delay: .48s; }
@keyframes bounce { 0%, 100% { height: 9px; } 50% { height: 32px; } }

.alert { padding: 12px 15px; border: 1px solid rgba(239, 107, 120, .42); border-radius: var(--radius-sm); background: rgba(239, 107, 120, .13); font-size: 13.5px; }
.alert.ok { border-color: rgba(67, 201, 150, .42); background: rgba(67, 201, 150, .13); }

/* ---------- Строка ввода ---------- */
.composer {
  position: relative; z-index: 3;
  padding: 10px clamp(14px, 3vw, 24px) max(12px, env(safe-area-inset-bottom));
  background: rgba(11, 9, 20, .86); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.composer-inner {
  width: min(100%, 720px); margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 7px 7px 7px 16px;
  border: 1px solid var(--border); border-radius: 22px;
  background: rgba(0, 0, 0, .3);
  transition: border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.composer-inner:focus-within { border-color: rgba(165, 123, 255, .6); box-shadow: 0 0 0 3px rgba(165, 123, 255, .12); }
.composer.locked .composer-inner { opacity: .55; }
#composerInput {
  flex: 1; min-width: 0; max-height: 120px; padding: 10px 0;
  border: 0; background: transparent; resize: none; font-size: 15px; line-height: 1.5;
}
#composerInput:focus { outline: none; }
#composerInput:disabled { cursor: not-allowed; }
#composerInput::placeholder { color: var(--muted); }
.icon-btn {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface);
  transition: transform .2s cubic-bezier(.2,.9,.3,1.3), background .2s ease, border-color .2s ease, opacity .2s ease;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover:not(:disabled) { transform: scale(1.1); border-color: var(--primary); background: rgba(165, 123, 255, .18); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.send:not(:disabled) { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary-strong), #b064e7); }
.icon-btn.mic.recording { color: #fff; border-color: transparent; background: var(--danger); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(239, 107, 120, .18); } }
.composer-hint { width: min(100%, 720px); margin: 7px auto 0; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- Модальные окна ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(6, 4, 12, .72); backdrop-filter: blur(5px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; width: min(100%, 430px); max-height: 86dvh; overflow-y: auto;
  padding: 26px; border: 1px solid var(--border); border-radius: 22px;
  background: #17132a; box-shadow: 0 30px 80px rgba(2, 0, 12, .5);
  animation: rise .28s cubic-bezier(.2,.9,.3,1);
}
.modal h2 { margin: 0 0 8px; padding-right: 28px; font: 600 21px/1.25 Unbounded, Manrope, sans-serif; letter-spacing: -.03em; }
.modal > p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.modal-close { position: absolute; right: 16px; top: 14px; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 19px; line-height: 1; transition: transform .2s ease, color .2s ease; }
.modal-close:hover { transform: scale(1.12); color: var(--text); }
.modal-note { margin: 12px 0 0; color: var(--muted); font-size: 12.5px; }
.modal-legal { margin: 16px 0 0; color: var(--muted); font-size: 11.5px; text-align: center; }
#loginEmail { margin-bottom: 10px; }
.telegram-login-card {
  display: grid; gap: 14px; padding: 16px; border: 1px solid rgba(75, 177, 255, .28);
  border-radius: var(--radius-sm); background: linear-gradient(145deg, rgba(42, 171, 238, .11), rgba(165, 123, 255, .06));
}
.telegram-login-copy { display: grid; gap: 3px; }
.telegram-login-copy b { font-size: 15px; }
.telegram-login-copy span { color: var(--muted); font-size: 12.5px; }
.telegram-widget { min-height: 42px; display: flex; align-items: center; justify-content: center; }
.telegram-widget iframe { max-width: 100%; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.account-profile { display: grid; gap: 5px; padding: 14px; margin-bottom: 5px; border: 1px solid rgba(165, 123, 255, .3); border-radius: var(--radius-sm); background: linear-gradient(145deg, rgba(165, 123, 255, .13), rgba(42, 171, 238, .05)); }
.account-profile b { font-size: 16px; overflow-wrap: anywhere; }
.account-profile small { color: var(--muted); font-size: 12px; }
.account-provider { width: fit-content; padding: 3px 8px; border-radius: 999px; color: #d9caff; background: rgba(165, 123, 255, .18); font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.pill-account #accountLabel { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.account-row span { color: var(--muted); }
.account-songs { list-style: none; max-height: 34vh; overflow-y: auto; margin: 14px 0; padding: 0; display: grid; gap: 8px; }
.account-songs li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 13.5px; }
.account-songs b { display: block; }
.account-songs span { color: var(--muted); font-size: 12px; }
.account-songs a { flex: 0 0 auto; font-size: 12.5px; font-weight: 800; }
@media (max-width: 420px) {
  .modal { padding: 22px 18px; }
  .account-songs li { align-items: flex-start; }
  .pill-account #accountLabel { max-width: 78px; }
}

/* ---------- Узкие экраны ---------- */
@media (max-width: 720px) {
  :root { --bar: 60px; }
  .bar { padding: 0 12px; }
  .bar-actions { gap: 7px; }
  .logo-name { font-size: 15px; }
  .logo-name small { display: none; }
  /* Переключатель языка раньше пропадал на телефоне — оставляем, но узкий */
  .lang { padding: 2px; }
  .lang { max-width: 104px; }
  .lang button { min-width: 30px; height: 28px; padding: 0 4px; font-size: 11px; }
  .pill { height: 38px; padding: 0 12px; gap: 6px; font-size: 13px; }
  .bubble { max-width: 84%; }
  .options { padding-left: 0; }
  .providers { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  /* Место кончилось: убираем название бренда и слово «песня», но не подписи
     самих кнопок — без них непонятно, что они делают */
  .logo-name { display: none; }
  .pill-tail { display: none; }
  .pill { padding: 0 10px; font-size: 12.5px; }
  .options { grid-template-columns: 1fr; }
  .option { min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .feed { scroll-behavior: auto; }
}
