:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --text: #141824;
  --muted: #5d6478;
  --border: #dfe3ec;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8efff;
  --btn: #2563eb;
  --btn-hover: #1d4ed8;
  --ok: #15803d;
  --ok-soft: #e9f7ee;
  --no: #b42318;
  --no-soft: #fdeceb;
  --warn-soft: #fff6e0;
  --warn-border: #f2d28b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --surface: #171b24;
    --surface-2: #1f2430;
    --text: #e8ebf2;
    --muted: #9aa2b5;
    --border: #2b3140;
    --accent: #5b8cff;
    --accent-hover: #7aa2ff;
    --accent-soft: #1c2742;
    --btn: #3563e9;
    --btn-hover: #2952cc;
    --ok: #4ade80;
    --ok-soft: #13261b;
    --no: #f87171;
    --no-soft: #2b1617;
    --warn-soft: #2a2312;
    --warn-border: #5c4a1c;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1218; --surface: #171b24; --surface-2: #1f2430; --text: #e8ebf2; --muted: #9aa2b5;
  --border: #2b3140; --accent: #5b8cff; --accent-hover: #7aa2ff; --accent-soft: #1c2742; --btn: #3563e9; --btn-hover: #2952cc;
  --ok: #4ade80; --ok-soft: #13261b; --no: #f87171; --no-soft: #2b1617;
  --warn-soft: #2a2312; --warn-border: #5c4a1c; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main, .top, footer { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.top { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.status-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .9rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); display: inline-block; }
.dot.up { background: var(--ok); }
.dot.down { background: var(--no); }

.hero { padding: 20px 0 8px; }
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 60ch; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin: 20px 0;
}
.card h2 { margin: 0 0 8px; font-size: 1.2rem; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 6px; }
input[type=url], input[type=text], select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .85rem; margin: 6px 0 0; }

.support { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.support-col { border-radius: 10px; padding: 12px 14px; }
.support-col h3 { margin: 0 0 6px; font-size: .95rem; }
.support-col ul { margin: 0; padding-left: 18px; font-size: .9rem; }
.support-col.ok { background: var(--ok-soft); }
.support-col.no { background: var(--no-soft); }
.support-col a { color: var(--accent); }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px 16px; cursor: pointer; font-weight: 400; margin: 0;
}
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { font-size: 1.6rem; }
.file-name { font-weight: 600; color: var(--accent); word-break: break-all; }

.howto { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.howto summary { cursor: pointer; font-weight: 600; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 12px 0 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; font-size: .92rem; }
.steps li > div:last-child::before { content: counter(s) ". "; font-weight: 700; }
.mock { height: 56px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .7rem; }
.mock-bar { position: absolute; top: 0; left: 0; right: 0; height: 12px; background: var(--border); border-radius: 7px 7px 0 0; }
.mock-btn { margin-top: 10px; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 5px; font-weight: 700; }
.mock-play { font-size: 1rem; }
.mock-icon { position: absolute; top: 4px; right: 6px; font-size: .9rem; color: var(--accent); font-weight: 700; }
.mock-file { background: var(--surface); border: 1px solid var(--border); padding: 6px 6px; border-radius: 4px; font-weight: 700; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }

button { font: inherit; cursor: pointer; }
.primary {
  width: 100%; margin-top: 18px; padding: 13px; border: 0; border-radius: 10px;
  background: var(--btn); color: #fff; font-weight: 700; font-size: 1rem;
}
.primary:hover { background: var(--btn-hover); }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.secondary { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; }
.secondary:hover { border-color: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .primary { width: auto; margin-top: 0; padding: 10px 16px; }

.error { margin: 12px 0 0; padding: 12px 14px; background: var(--no-soft); color: var(--text); border-left: 4px solid var(--no); border-radius: 8px; }
.error a { color: var(--accent); font-weight: 600; }
.notice { padding: 12px 14px; border-radius: 10px; margin-top: 16px; font-size: .92rem; }
.notice.warn { background: var(--warn-soft); border: 1px solid var(--warn-border); }

.stages { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.stages li { padding-left: 28px; position: relative; color: var(--muted); }
.stages li::before { content: "○"; position: absolute; left: 4px; }
.stages li.active { color: var(--text); font-weight: 600; }
.stages li.active::before { content: "◐"; color: var(--accent); }
.stages li.done::before { content: "✓"; color: var(--ok); }
.stages li.skip { display: none; }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

.result-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.toggle { display: inline-flex; gap: 8px; align-items: center; font-weight: 400; }
.transcript {
  margin-top: 10px; max-height: 460px; overflow-y: auto; background: var(--surface-2);
  border-radius: 10px; padding: 14px; font-size: .95rem; white-space: pre-wrap; word-wrap: break-word;
}
.transcript .t { color: var(--accent); font-variant-numeric: tabular-nums; font-size: .82rem; margin-right: 8px; }
.transcript.no-times .t { display: none; }
.live { margin-top: 12px; max-height: 200px; }

footer { padding: 12px 16px 40px; color: var(--muted); font-size: .9rem; }
footer p { margin: 6px 0; }

/* status page */
.check { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.check:last-child { border-bottom: 0; }
.pill { font-weight: 700; padding: 2px 10px; border-radius: 99px; font-size: .85rem; white-space: nowrap; }
.pill.up { background: var(--ok-soft); color: var(--ok); }
.pill.down { background: var(--no-soft); color: var(--no); }

@media (max-width: 600px) {
  .support, .options { grid-template-columns: 1fr; }
  .steps li { grid-template-columns: 72px 1fr; }
  .card { padding: 16px; }
}

/* info card */
.info details { border-bottom: 1px solid var(--border); padding: 4px 0 10px; }
.info details:last-child { border-bottom: 0; }
.info summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.info summary::-webkit-details-marker { display: none; }
.info summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.info details[open] > summary::before { transform: rotate(90deg); }
.info summary h2 { margin: 0; font-size: 1.05rem; }
.info ul, .info ol { padding-left: 20px; margin: 6px 0; }
.info li { margin: 4px 0; }
.info p { margin: 6px 0; }
.info a { color: var(--accent); }
#slowHint button { margin-top: 8px; }
#buildCard > h2 { margin-bottom: 6px; }
#buildCard > p { color: var(--muted); }
#aboutCard { padding-top: 8px; padding-bottom: 8px; }
