:root {
  --bg: #0b0b10;
  --panel: #15151d;
  --line: #262633;
  --text: #f2f2f7;
  --muted: #9a9aab;
  --accent: #ff3d6e;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(11, 11, 16, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.logo { color: var(--accent); }

.layout {
  display: grid; gap: 20px; padding: 16px;
  max-width: 1180px; margin: 0 auto;
}
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(300px, 420px) 1fr; align-items: start; }
  .stage-wrap { position: sticky; top: 76px; }
}

.stage-box { position: relative; display: flex; justify-content: center; }
#stage {
  display: block; max-width: 100%; max-height: 52vh; width: auto; height: auto;
  border-radius: var(--radius); background: #000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
@media (min-width: 900px) { #stage { max-height: calc(100vh - 170px); } }

.transport { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

.panel { display: grid; gap: 14px; min-width: 0; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.step h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.step h2 span {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px;
}
.step h2 small { color: var(--muted); font-weight: 400; }

label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input[type=text], textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0f0f15; color: var(--text); font: inherit; font-size: 16px;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

.drop {
  position: relative; border: 2px dashed var(--line); border-radius: 12px; padding: 18px;
  text-align: center; cursor: pointer; color: var(--text); transition: border-color .15s;
}
.drop.small { padding: 12px; }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop small { display: block; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #1f1f2a; color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 42px;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-main { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; }
.btn-pro { background: linear-gradient(135deg, #ff3d6e, #a855f7); border: 0; color: #fff; }
.btn-pro.is-pro { background: #1f1f2a; border: 1px solid var(--line); cursor: default; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1 1 auto; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #0f0f15; color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.seg em { font-style: normal; font-size: 10px; font-weight: 700; background: #a855f7; color: #fff; padding: 1px 5px; border-radius: 5px; margin-left: 4px; }

.tag { font-style: normal; font-size: 10px; font-weight: 700; background: #a855f7; color: #fff; padding: 1px 5px; border-radius: 5px; }
.is-pro-user .seg em, .is-pro-user .tag { display: none; }
.pack-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
.pack-list a { color: var(--text); }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.color { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
input[type=color] { width: 44px; height: 36px; border: 0; background: none; padding: 0; cursor: pointer; }

.wave { width: 100%; height: 90px; border-radius: 10px; background: #0f0f15; cursor: pointer; touch-action: none; display: block; }

.muted { color: var(--muted); }
.small { font-size: 12px; margin: 0; }

.progress { height: 8px; background: #0f0f15; border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.lyrics-list { margin: 0; padding-left: 22px; display: grid; gap: 4px; font-size: 14px; max-height: 220px; overflow: auto; }
.lyrics-list li { color: var(--muted); }
.lyrics-list li b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 6px; }
.lyrics-list li.next { color: var(--text); }

.sync-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 12px; padding: 20px; background: linear-gradient(transparent 30%, rgba(0, 0, 0, .85));
  border-radius: var(--radius);
}
.sync-hint { margin: 0; color: var(--muted); font-size: 13px; }
.sync-line { margin: 0; font-size: 20px; font-weight: 700; text-align: center; min-height: 1.5em; }
.btn-tap { width: 100%; max-width: 260px; min-height: 80px; font-size: 24px; background: var(--accent); border: 0; color: #fff; touch-action: manipulation; }

.result { display: grid; gap: 10px; }
.result video { width: 100%; max-height: 420px; border-radius: 12px; background: #000; }

.paywall {
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text);
  padding: 24px; width: min(92vw, 380px);
}
.paywall::backdrop { background: rgba(0, 0, 0, .7); }
.paywall form { display: grid; gap: 12px; }
.paywall h2 { margin: 0; }
.paywall ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.badge { font-size: 12px; background: linear-gradient(135deg, #ff3d6e, #a855f7); padding: 2px 8px; border-radius: 6px; vertical-align: middle; }
.restore summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.restore .row { margin-top: 8px; flex-wrap: nowrap; }
.restore input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0f0f15; color: var(--text); font: inherit; font-size: 16px;
}
.price { font-size: 26px; font-weight: 800; margin: 4px 0 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #26263a; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 50;
  max-width: calc(100vw - 32px); text-align: center;
}
