:root {
  --bg: #0b0b12;
  --bg2: #12121c;
  --card: #161624;
  --line: #262638;
  --text: #ececf4;
  --muted: #8f8fa8;
  --accent: #7c5cff;
  --accent2: #22d3ee;
  --ok: #34d399;
  --err: #ff6b81;
  --radius: 16px;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(124, 92, 255, .18), transparent 60%),
    radial-gradient(700px 400px at -10% 10%, rgba(34, 211, 238, .10), transparent 60%),
    var(--bg);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

.top { display: flex; align-items: center; gap: 16px; padding: 18px 24px; max-width: 1280px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 18px; }
.logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.tag { color: var(--muted); font-size: 13px; }

main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 8px 24px 32px; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.hero { text-align: center; max-width: 720px; margin: 28px auto 28px; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.1; margin: 0 0 14px; letter-spacing: -.02em; }
.hero p { color: var(--muted); margin: 0; font-size: 16px; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
#uploadForm { max-width: 760px; margin: 0 auto; }

.drop { display: block; border: 2px dashed #34344c; border-radius: 14px; padding: 36px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s; background: var(--bg2); }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: rgba(124, 92, 255, .07); outline: none; }
.drop.has { border-style: solid; border-color: var(--accent); }
.drop-icon { font-size: 28px; margin-bottom: 6px; opacity: .8; }
.drop-main { font-weight: 600; font-size: 16px; word-break: break-word; }
.drop-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field i, .switch i { font-style: normal; opacity: .7; }
.field input, .field select { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 14px; }
.field input:focus, .field select:focus { outline: 2px solid rgba(124, 92, 255, .5); border-color: var(--accent); }
.switch { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.knob { width: 40px; height: 22px; border-radius: 99px; background: #33334a; position: relative; transition: background .15s; flex: none; }
.knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent2); }

.actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: #1f1f30; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600;
  transition: transform .05s, background .15s, border-color .15s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover:not(:disabled) { background: #29293e; border-color: #3a3a55; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5b8cff); border-color: transparent; color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); background: linear-gradient(135deg, var(--accent), #5b8cff); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; font-weight: 500; border-radius: 8px; }
#goBtn { flex: 1; padding: 13px; font-size: 16px; justify-content: center; }
.err { color: var(--err); margin: 14px 0 0; }
.muted { color: var(--muted); font-size: 13px; }

.steps { list-style: none; padding: 0; margin: 34px auto 0; max-width: 760px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.steps li { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.steps b { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #22223a; color: var(--text); font-size: 12px; }

/* progress */
.progress-card { max-width: 560px; margin: 60px auto; text-align: center; }
.pc-file { font-weight: 700; font-size: 17px; word-break: break-word; }
.pc-stage { color: var(--muted); margin: 6px 0 18px; }
.bar { height: 10px; border-radius: 99px; background: #23233a; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s ease; }
.bar-fill.indet { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.pc-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 8px; }
.stage-list { list-style: none; padding: 0; margin: 22px 0 0; text-align: left; display: grid; gap: 8px; }
.stage-list li { color: var(--muted); padding-left: 26px; position: relative; font-size: 14px; }
.stage-list li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #3a3a55; }
.stage-list li.on { color: var(--text); }
.stage-list li.on::before { border-color: var(--accent2); background: var(--accent2); box-shadow: 0 0 0 4px rgba(34, 211, 238, .2); animation: pulse 1s infinite alternate; }
.stage-list li.ok { color: var(--text); }
.stage-list li.ok::before { border-color: var(--ok); background: var(--ok); }
@keyframes pulse { to { box-shadow: 0 0 0 7px rgba(34, 211, 238, .05); } }
#pcBack { margin-top: 16px; }

/* studio */
.studio-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 6px 0 16px; flex-wrap: wrap; }
.sh-title { font-size: 22px; font-weight: 700; }
.sh-sub { color: var(--muted); font-size: 13px; }
.sh-actions { display: flex; gap: 10px; }
.studio { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.player { padding: 0; overflow: hidden; display: flex; flex-direction: column; position: sticky; top: 12px; }
.lyrics { height: min(62vh, 560px); overflow-y: auto; padding: 40% 28px; scroll-behavior: smooth; text-align: center;
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  background: radial-gradient(600px 300px at 50% 50%, rgba(124, 92, 255, .10), transparent 70%); }
.lyrics .ln { font-size: clamp(18px, 2.2vw, 24px); font-weight: 700; line-height: 1.35; padding: 8px 6px; margin: 2px 0; border-radius: 10px;
  color: #5d5d78; cursor: pointer; transition: color .25s, transform .25s, opacity .25s; position: relative; }
.lyrics .ln:hover { color: #9a9ab5; }
.lyrics .ln.past { color: #77779a; }
.lyrics .ln.active { color: #fff; transform: scale(1.04); }
.lyrics .ln.active .fill { background: linear-gradient(90deg, #fff var(--p, 0%), rgba(255,255,255,.45) var(--p, 0%));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.lyrics .ln .t { display: block; font: 500 11px var(--mono); color: #55556e; letter-spacing: .04em; }
.lyrics .ln.active .t { color: var(--accent2); }
.lyrics .ln.gap { color: transparent; height: 8px; padding: 0; pointer-events: none; }
.lyrics .empty { color: var(--muted); font-weight: 400; font-size: 15px; }

.controls { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--bg2); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex: none; font-size: 16px;
  background: linear-gradient(135deg, var(--accent), #5b8cff); color: #fff; }
.icon-btn:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.time { font: 12px var(--mono); color: var(--muted); min-width: 38px; text-align: center; }
#seek { flex: 1; accent-color: var(--accent); min-width: 0; }
#rate { background: #1f1f30; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font-size: 12px; }
.test-src { display: flex; gap: 8px; align-items: center; padding: 0 16px 14px; background: var(--bg2); flex-wrap: wrap; }

.editor { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 10px; }
.tab { background: none; border: 0; padding: 13px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
#lrcText { width: 100%; height: min(56vh, 520px); resize: vertical; border: 0; outline: 0; background: var(--bg2); padding: 14px 16px;
  font: 13.5px/1.7 var(--mono); color: #d8d8e6; white-space: pre; tab-size: 2; }
.plain { margin: 0; height: min(60vh, 560px); overflow: auto; padding: 16px 18px; background: var(--bg2); font: 15px/1.7 Inter, system-ui, sans-serif; white-space: pre-wrap; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); }
kbd { font: 11px var(--mono); background: #23233a; border: 1px solid #34344c; border-bottom-width: 2px; padding: 1px 5px; border-radius: 5px; }

.foot { text-align: center; color: #66667f; font-size: 12px; padding: 18px 16px 26px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #23233a; border: 1px solid #3a3a55; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 10; }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .player { position: static; }
  .lyrics { height: 48vh; }
}
@media (max-width: 640px) {
  .top { padding: 14px 16px; }
  .tag { display: none; }
  main { padding: 4px 16px 24px; }
  .opts { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px; }
  .player, .editor { padding: 0; }
  .lyrics { padding: 40% 14px; }
  .sh-actions { width: 100%; }
  .sh-actions .btn { flex: 1; justify-content: center; }
  .controls { gap: 6px; padding: 12px; }
  .time { min-width: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
