/* ============================================================
   VINYL PERSONA — mobile-first web app
   Clean dark UI · bold accent · Western Gen-Z aesthetic
   ============================================================ */

:root {
  --bg: #0c0c0e;
  --surface: #151518;
  --surface-2: #1d1d22;
  --elevated: #232329;
  --line: #2a2a31;
  --line-soft: rgba(255, 255, 255, 0.08);

  --text: #f6f6f4;
  --text-2: #b6b6ad;
  --text-3: #7a7a72;

  --accent: #c4f04a;
  --accent-deep: #9cc22f;
  --accent-ink: #10130a;
  --pink: #ff7ea0;
  --blue: #7fb4ff;

  --danger: #ff6b6b;
  --radius: 18px;
  --radius-lg: 26px;
  --maxw: 460px;

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The hidden attribute must always win over display utility classes. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(120% 60% at 80% -10%, rgba(196, 240, 74, 0.08), transparent 60%),
    radial-gradient(90% 50% at -10% 100%, rgba(127, 180, 255, 0.06), transparent 55%),
    var(--bg);
  min-height: 100dvh;
}

/* ---------- App shell (phone column on desktop) ---------- */
.app {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 20px 34px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; animation: fade 0.28s ease; }

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
p { color: var(--text-2); line-height: 1.55; }
.muted { color: var(--text-3); }
.brand-word {
  font-size: 13px; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: none; cursor: pointer;
  font-family: var(--font); font-weight: 700;
  border-radius: 999px; padding: 15px 22px;
  font-size: 16px; width: 100%;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 10px 30px rgba(196, 240, 74, 0.22);
}
.btn-primary:hover { background: #d2fb63; }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 10px;
}
.top-link {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line-soft);
  color: var(--text); border-radius: 999px; padding: 9px 15px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.top-link:hover { background: var(--surface-2); }

/* ---------- Home ---------- */
.home-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 10px 0; }
.hero-disc {
  width: min(78vw, 300px); aspect-ratio: 1; margin: 0 auto;
  border-radius: 50%; position: relative;
  background:
    radial-gradient(circle at 50% 50%, #2a2a2f 0 16%, #141416 17% 22%, #1c1c20 23% 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.hero-disc::before {
  content: ""; position: absolute; inset: 12%; border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  animation: spin 18s linear infinite;
}
.hero-disc::after {
  content: ""; width: 26%; aspect-ratio: 1; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(196, 240, 74, 0.15);
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-title { font-size: 40px; text-align: center; }
.hero-title em { font-style: normal; color: var(--accent); }
.hero-sub { text-align: center; font-size: 15px; }
.hero-actions { display: flex; flex-direction: column; gap: 12px; }
.hero-note { text-align: center; font-size: 12px; color: var(--text-3); }

/* ---------- Progress header ---------- */
.progress-head { display: flex; align-items: baseline; gap: 12px; padding: 18px 0 6px; }
.step-index { font-size: 13px; color: var(--accent); font-weight: 800; }
.step-name { font-size: 22px; font-weight: 800; }
.progress-track { height: 4px; border-radius: 99px; background: var(--elevated); margin: 8px 0 22px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s ease; }

.section-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.section-title.mt { margin-top: 26px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Selectable options ---------- */
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px 18px; cursor: pointer;
  transition: border 0.15s ease, background 0.15s ease;
}
.option:hover { background: var(--surface-2); }
.option.active { border-color: var(--accent); background: rgba(196, 240, 74, 0.08); }
.opt-title { font-weight: 700; font-size: 15px; }
.opt-desc { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.opt-mark {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 2px solid var(--line);
  position: relative;
}
.option.active .opt-mark { border-color: var(--accent); }
.option.active .opt-mark::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent);
}

/* ---------- Voice character chips ---------- */
.voice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.voice-chip {
  font-family: var(--font); font-size: 13px; font-weight: 700;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 9px 14px; cursor: pointer;
  transition: border 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.voice-chip:hover { color: var(--text); background: var(--surface-2); }
.voice-chip.active {
  color: var(--accent-ink); background: var(--accent); border-color: var(--accent);
}

/* ---------- Occasion template chips ---------- */
.tpl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-chip {
  font-family: var(--font); font-size: 13px; font-weight: 700;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 9px 15px; cursor: pointer;
  transition: border 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.tpl-chip:hover { color: var(--text); background: var(--surface-2); }
.tpl-chip.active {
  color: var(--accent-ink); background: var(--accent); border-color: var(--accent);
}
.tpl-tagline { font-size: 12.5px; color: var(--text-3); margin: 10px 2px 0; min-height: 16px; }

/* ---------- Inputs ---------- */
.input-box, .desc-box {
  width: 100%; font-family: var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 15px 16px; font-size: 15px;
  outline: none; transition: border 0.15s ease;
}
.input-box:focus, .desc-box:focus { border-color: var(--accent); }
.input-box::placeholder, .desc-box::placeholder { color: var(--text-3); }
.desc-box { min-height: 150px; resize: none; line-height: 1.55; }
.field-hint { font-size: 12.5px; color: var(--text-3); margin: 8px 2px 0; }
.count { text-align: right; font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* ---------- Avatar picker ---------- */
.avatar-pick {
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 14px;
}
.avatar-pick:hover { background: var(--surface-2); }
.pick-thumb { width: 62px; height: 62px; border-radius: 14px; object-fit: cover; flex: none; }
.pick-add {
  width: 62px; height: 62px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-size: 28px; color: var(--accent);
  background: rgba(196, 240, 74, 0.1);
}
.pick-title { font-weight: 700; font-size: 14px; }
.pick-desc { font-size: 12px; color: var(--text-3); margin-top:3px; }

/* ---------- Result stage ---------- */
.stage-wrap { display: grid; place-items: center; padding: 14px 0 20px; }
.avatar-stage { position: relative; width: 230px; height: 230px; }
.avatar-halo {
  position: absolute; inset: -14px; border-radius: 50%;
  border: 2px solid rgba(196, 240, 74, 0.35);
}
.avatar-stage.singing .avatar-halo { animation: haloPulse 1.1s ease-in-out infinite; }
@keyframes haloPulse { 0%,100% { transform: scale(1); opacity: .55; } 50% { transform: scale(1.06); opacity: 1; } }
.avatar-frame {
  position: relative; width: 100%; height: 100%; border-radius: 50%;
  overflow: hidden; border: 3px solid var(--elevated);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.avatar-stage.singing .avatar-frame { animation: headBob 0.9s ease-in-out infinite; transform-origin: bottom center; }
@keyframes headBob { 0%,100% { transform: rotate(-2.2deg); } 50% { transform: rotate(2.2deg); } }
.avatar-img { width: 100%; height: 100%; object-fit: cover; }
.avatar-blush {
  position: absolute; top: 56%; width: 22px; height: 13px; border-radius: 50%;
  background: rgba(255, 126, 160, 0.55); opacity: 0;
}
.avatar-stage.singing .avatar-blush { opacity: 1; }
.blush-l { left: 18%; } .blush-r { right: 18%; }
.avatar-mouth {
  position: absolute; left: 50%; top: 63%;
  width: 26px; height: 30px;
  background: radial-gradient(circle at 50% 30%, #7a2438, #4a1220);
  border-radius: 50% 50% 46% 46%;
  transform: translate(-50%, -50%) scaleY(0.25);
  transform-origin: center;
}
.avatar-video { width: 230px; height: 230px; border-radius: 50%; object-fit: cover; border: 3px solid var(--elevated); }

/* fallback spinning disc */
.disc {
  width: 220px; height: 220px; border-radius: 50%; position: relative;
  background: radial-gradient(circle, #2a2a2f 0 14%, #161619 16% 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.disc.spin { animation: spin 6s linear infinite; }
.disc-center { width: 22%; aspect-ratio: 1; border-radius: 50%; background: var(--accent); }
.disc-label { position: absolute; bottom: 26%; font-size: 12px; color: var(--text-2); font-weight: 700; }

/* ---------- Meta / tags ---------- */
.meta { text-align: center; margin-bottom: 18px; }
.song-title { font-size: 24px; margin-bottom: 10px; }
.tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tag {
  font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 99px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-soft);
}
.tag.hot { color: var(--accent); border-color: rgba(196,240,74,0.4); }
.tag.pink { color: var(--pink); border-color: rgba(255,126,160,0.4); }

/* ---------- Player ---------- */
.player { margin-bottom: 18px; }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.play-row { display: flex; align-items: center; gap: 16px; }
.play-btn {
  width: 58px; height: 58px; border-radius: 50%; flex: none;
  background: var(--accent); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 24px rgba(196, 240, 74, 0.25);
}
.play-btn:active { transform: scale(0.94); }
.icon-play { width: 0; height: 0; border-style: solid; border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent var(--accent-ink); margin-left: 3px; }
.icon-pause { display: flex; gap: 4px; }
.icon-pause .bar { width: 5px; height: 18px; background: var(--accent-ink); border-radius: 2px; }
.play-row .progress-track { flex: 1; margin: 0; }

/* ---------- Lyrics ---------- */
.lyrics-card { margin-bottom: 16px; }
.lyrics { white-space: pre-wrap; font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* ---------- Actions / report ---------- */
.actions { display: flex; gap: 12px; }
.actions .btn { flex: 1; }
.report-entry { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 16px; cursor: pointer; }
.report-entry:hover { color: var(--text-2); }

/* ---------- Generating ---------- */
.generating { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; }
.gen-disc { width: 120px; height: 120px; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.gen-text { font-weight: 700; color: var(--text-2); text-align: center; }

/* Generation progress: stages, timer, notify, error/retry */
.gen-stages { display: flex; align-items: center; gap: 12px; }
.gen-stage { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--text-3); transition: color .25s ease; }
.gs-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); border: 1px solid var(--line-soft); transition: all .25s ease; }
.gen-stage.active { color: var(--text); }
.gen-stage.active .gs-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196,240,74,.18); }
.gen-stage.done { color: var(--text-2); }
.gen-stage.done .gs-dot { background: var(--accent-deep); border-color: var(--accent-deep); }
.gen-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.gen-sep { opacity: .6; }
.gen-notify { width: auto; padding: 10px 20px; font-size: 13px; }
.gen-error { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 4px; }
.gen-error-msg { font-size: 13px; font-weight: 600; color: var(--danger); text-align: center; max-width: 280px; line-height: 1.5; }
.gen-error .btn { width: auto; padding: 12px 30px; }

/* ---------- Lyric review ---------- */
.lyric-loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.lyric-versions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.lyric-ver {
  font-family: var(--font); font-size: 13px; font-weight: 700;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
  transition: border 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.lyric-ver:hover { background: var(--surface-2); }
.lyric-ver.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.lyric-box {
  width: 100%; min-height: 260px; resize: vertical;
  font-family: var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 15px 16px; font-size: 14px;
  line-height: 1.6; outline: none; transition: border 0.15s ease;
}
.lyric-box:focus { border-color: var(--accent); }
.lyric-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ---------- Vertical share clip preview ---------- */
.video-preview {
  width: 100%; max-height: 58vh; display: block;
  margin: 0 auto; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--line-soft);
  object-fit: contain;
}

/* ---------- Modal ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
  animation: fade 0.2s ease;
}
.modal {
  width: 100%; max-width: var(--maxw); background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 24px 22px 28px;
  border: 1px solid var(--line-soft); max-height: 86vh; overflow-y: auto;
}
.modal-title { font-size: 20px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }
.modal .stack { margin-top: 4px; }
.legal-body { font-size: 13.5px; line-height: 1.7; color: var(--text-2); max-height: 60vh; overflow-y: auto; }
.legal-body h4 { color: var(--text); margin: 16px 0 6px; font-size: 14px; }
.legal-body p { margin-bottom: 8px; font-size: 13px; }

/* ---------- Age gate ---------- */
.age-gate { position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 26px; }
.age-card { width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 16px; }
.age-logo { font-size: 15px; letter-spacing: .3em; color: var(--accent); font-weight: 800; }
.age-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.age-fine { font-size: 11.5px; color: var(--text-3); line-height: 1.6; }

/* ---------- My works ---------- */
.work-item { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.work-thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-2); }
.work-meta { flex: 1; min-width: 0; }
.work-name { font-weight: 700; font-size: 14px; }
.work-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.empty { text-align: center; color: var(--text-3); padding: 70px 20px; }
.empty .btn { margin-top: 18px; width: auto; padding: 13px 28px; }

/* ---------- Bottom spacing helper ---------- */
.bottom-space { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--elevated); color: var(--text); padding: 12px 20px;
  border-radius: 99px; font-size: 13.5px; font-weight: 600; z-index: 80;
  border: 1px solid var(--line-soft); box-shadow: var(--shadow);
  animation: fade 0.2s ease; max-width: 88%; text-align: center;
}

/* ---------- Desktop: center the phone column ---------- */
@media (min-width: 560px) {
  .app {
    margin-top: 28px; margin-bottom: 28px;
    min-height: calc(100dvh - 56px);
    background: rgba(21, 21, 24, 0.6);
    border: 1px solid var(--line-soft);
    border-radius: 32px;
    padding: 0 24px 34px;
    box-shadow: var(--shadow);
  }
}

/* ============================================================
   Free / Pro tier, preview note & paywall (#41)
   All values reuse the existing design tokens.
   ============================================================ */
.preview-note {
  text-align: center; font-size: 12.5px; font-weight: 700;
  color: var(--accent); margin: 4px 0 10px; letter-spacing: .02em;
}

.pro-tag {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  border-radius: 99px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .08em; vertical-align: middle;
  background: var(--accent-ink); color: var(--accent);
}
.btn.is-locked { opacity: .85; }
.btn.is-locked .pro-tag {
  background: var(--accent-ink); color: var(--accent);
}

/* Paywall modal */
.pro-modal { text-align: center; max-width: 400px; }
.pro-badge {
  font-size: 11px; font-weight: 800; letter-spacing: .22em;
  color: var(--accent); margin-bottom: 10px;
}
.pro-features {
  list-style: none; text-align: left; margin: 6px 0 16px;
  display: flex; flex-direction: column; gap: 9px;
}
.pro-features li {
  position: relative; padding-left: 24px; font-size: 13.5px;
  color: var(--text-2); line-height: 1.4;
}
.pro-features li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--accent); font-weight: 800;
}
.pro-or {
  color: var(--text-3); font-size: 12px; margin: 14px 0 8px;
  text-transform: uppercase; letter-spacing: .14em;
}
.redeem-row { display: flex; gap: 10px; }
.redeem-row .input-box { flex: 1; min-width: 0; }
.redeem-row .btn { width: auto; flex: none; padding: 0 18px; }
.redeem-err {
  color: var(--danger); font-size: 12.5px; min-height: 16px;
  margin-top: 8px;
}
.pro-close { margin-top: 12px; width: 100%; }
