:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1e2230;
  --line: #2a3040;
  --text: #e9ecf3;
  --muted: #9099ab;
  --accent: #7cc4ff;
  --accent-ink: #08131f;
  --pro: #ffcf5c;
  --warn: #ffb74d;
  --radius: 10px;
  --font: -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
a { color: var(--accent); }
kbd { font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; }
[hidden] { display: none !important; }

.site-header { display: flex; align-items: center; gap: 24px; padding: 14px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), #b388ff); }
.site-header nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a[aria-current="page"] { color: var(--text); }

main { max-width: 1320px; margin: 0 auto; padding: 0 20px; }
.hero { padding: 28px 0 12px; max-width: 820px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; margin: 0 0 10px; }
.hero p { color: var(--muted); margin: 0; font-size: 16px; }

.banner { background: #3a2a10; border: 1px solid var(--warn); color: #ffe2b0; border-radius: var(--radius); padding: 10px 14px; margin: 12px 0; }
.banner.error { background: #3a1414; border-color: #ff6b6b; color: #ffd0d0; }
.banner.info { background: #12263a; border-color: var(--accent); color: #d6ecff; }
.banner .btn { margin-left: 6px; }

.tool { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: 20px; align-items: start; margin: 16px 0 40px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.steps { padding: 6px 0; }
.step { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.preview-panel { position: sticky; top: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.stage { display: grid; place-items: center; background: #05060a; border-radius: 8px; padding: 10px; min-height: 240px; }
#previewCanvas { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; border-radius: 4px; }
audio { width: 100%; }

.aspect-tabs { display: flex; gap: 6px; }
.aspect-tabs button { flex: 1; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; cursor: pointer; }
.aspect-tabs button small { display: block; font-size: 11px; }
.aspect-tabs button[aria-selected="true"] { color: var(--text); border-color: var(--accent); }

label { display: block; color: var(--muted); font-size: 13px; }
label.inline { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
input[type=text], textarea { width: 100%; margin-top: 4px; background: #0c0e14; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
textarea { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
input[type=color] { width: 44px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 0; }

.drop { position: relative; display: block; border: 1px dashed #3a4256; border-radius: 8px; padding: 14px; margin-bottom: 10px; color: var(--text); cursor: pointer; text-align: center; }
.drop.small { padding: 10px; }
.drop.dragover, .drop:hover { border-color: var(--accent); background: rgba(124,196,255,0.05); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-name { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.hint.center { text-align: center; }

.btn { background: var(--panel-2); color: var(--text); border: 1px solid #39415a; border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 3px 8px; font-size: 12px; }
.btn.big { padding: 11px 18px; font-size: 15px; }
.file-btn { position: relative; overflow: hidden; display: inline-block; color: var(--text); font-size: 14px; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.tag { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 4px; padding: 1px 5px; vertical-align: 1px; }
.tag.free { background: #1d3b2a; color: #8be3a8; }
.tag.pro { background: #3d3214; color: var(--pro); }

.tap-panel { margin-top: 12px; padding: 12px; border: 1px solid var(--accent); border-radius: 8px; background: rgba(124,196,255,0.06); }
.tap-button { width: 100%; padding: 18px; font: 700 20px var(--font); color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; }
.tap-button kbd { color: var(--text); }
.tap-button:active { transform: scale(0.99); }

.line-tools { margin-top: 12px; }
.line-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.line-list:empty::before { content: "Your lines will appear here."; display: block; padding: 14px; color: var(--muted); font-size: 13px; }
.line-list li { display: grid; grid-template-columns: 84px auto 1fr; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 1px solid #222838; font-size: 13px; }
.line-list li:last-child { border-bottom: 0; }
.line-list li.current { background: rgba(124,196,255,0.12); }
.line-list li.cursor { outline: 2px solid var(--accent); outline-offset: -2px; }
.line-list li.bad .time { border-color: var(--warn); color: var(--warn); }
.line-list .time { width: 84px; margin: 0; padding: 3px 6px; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: #0c0e14; color: var(--text); border: 1px solid var(--line); border-radius: 5px; }
.line-list .ops { display: flex; gap: 2px; }
.line-list .ops button { background: none; border: 1px solid transparent; color: var(--muted); border-radius: 4px; padding: 1px 5px; font-size: 12px; cursor: pointer; }
.line-list .ops button:hover { border-color: var(--line); color: var(--text); }
.line-list .text { overflow-wrap: anywhere; }

.templates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.templates button { background: var(--panel-2); border: 2px solid transparent; border-radius: 8px; padding: 4px; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.templates button canvas { display: block; width: 100%; height: auto; border-radius: 4px; margin-bottom: 4px; }
.templates button[aria-checked="true"] { border-color: var(--accent); color: var(--text); }

.res-options { border: 0; padding: 0; margin: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.res-options legend { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.res-options label { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; cursor: pointer; }
.res-options label.locked span { color: var(--muted); }
.locked-btn { color: var(--muted); }

.export-box { margin-top: 12px; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
.download-box { margin-top: 12px; padding: 12px; border-radius: 8px; background: #13261b; border: 1px solid #2d5a3d; }
.download-box a { font-weight: 650; }

.content { max-width: 820px; padding-bottom: 40px; }
.content h2 { margin-top: 36px; font-size: 22px; }
.how li { margin-bottom: 10px; color: var(--muted); }
.how strong { color: var(--text); }
.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.compare th small { color: var(--muted); font-weight: 400; }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 8px 0 0; }

.pro-dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; max-width: 420px; padding: 22px; }
.pro-dialog::backdrop { background: rgba(0,0,0,0.6); }
.pro-dialog h2 { margin-top: 0; }
.pro-dialog ul { padding-left: 20px; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 18px 24px; text-align: center; }

@media (max-width: 900px) {
  .tool { grid-template-columns: 1fr; }
  .preview-panel { position: static; order: -1; }
  #previewCanvas { max-height: 50vh; }
}
