/* AceStream Scraper — Docker command builder (docs/index.html).
   Plain CSS, no build step. Tokens on :root; dark theme via prefers-color-scheme. */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eaf0f4;
  --border: #d3dbe3;
  --border-strong: #b7c2cd;
  --text: #17212b;
  --muted: #55636f;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #d9f5ef;
  --accent-text: #0b5f59;
  --blue: #1d4ed8;
  --warm: #c2410c;
  --info-bg: #eaf2ff;
  --info-border: #9dbdf5;
  --info-text: #1e3a8a;
  --warn-bg: #fff4e5;
  --warn-border: #f3b76a;
  --warn-text: #7c3a00;
  --err-bg: #fdeaea;
  --err-border: #f19a9a;
  --err-text: #8a1c1c;
  --code-bg: #0f1a26;
  --code-text: #e3ebf3;
  --code-head: #17263a;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b;
    --surface: #151d27;
    --surface-2: #1b2531;
    --border: #2a3644;
    --border-strong: #3a4859;
    --text: #e7edf3;
    --muted: #9fadbb;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #0f3f3a;
    --accent-text: #7ff0e0;
    --blue: #60a5fa;
    --warm: #fb923c;
    --info-bg: #14233a;
    --info-border: #2f4f80;
    --info-text: #bfd6ff;
    --warn-bg: #3a2610;
    --warn-border: #8a5a1e;
    --warn-text: #ffd7a8;
    --err-bg: #3b1717;
    --err-border: #8a3030;
    --err-text: #ffc2c2;
    --code-bg: #0a1017;
    --code-text: #dbe5ee;
    --code-head: #121c28;
    --focus: #93c5fd;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must win over display rules on .field/.layout etc. */
[hidden] { display: none !important; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); }
a:hover { color: var(--accent-strong); }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre code { background: none; padding: 0; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: -999px; top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.85rem; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--blue) 100%);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.brand h1 { font-size: 1.15rem; margin: 0; line-height: 1.2; font-weight: 700; }
.tagline { margin: 0; color: var(--muted); font-size: 0.9rem; }
.header-links { display: flex; gap: 1.25rem; font-weight: 500; font-size: 0.95rem; }
.header-links a { text-decoration: none; }
.header-links a:hover { text-decoration: underline; }

/* Intro */
.intro {
  font-size: 1.05rem;
  max-width: 62ch;
  margin: 1.75rem 0 1.5rem;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  padding-bottom: 3rem;
}
@media (min-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 2rem; align-items: start; }
  .output-col { position: sticky; top: 1rem; }
}

/* Steps */
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.step h2 {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 1.1rem; margin: 0 0 1rem; font-weight: 600;
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 700; font-size: 0.9rem;
}

fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
fieldset:last-child { margin-bottom: 0.25rem; }
legend { font-weight: 600; padding: 0; margin-bottom: 0.6rem; font-size: 0.95rem; }

.hint { color: var(--muted); font-size: 0.88rem; margin: 0.6rem 0 0; }
.optional { color: var(--muted); font-weight: 400; }

/* Option cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 0.6rem;
}
.card {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms, box-shadow 120ms;
}
.card:hover { border-color: var(--border-strong); }
.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface));
}
.card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.card-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; margin-bottom: 0.2rem; }
.card-title::before {
  content: "";
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  background: var(--surface);
}
.card.selected .card-title::before {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 45%, transparent 50%);
}
.card-summary { color: var(--muted); font-size: 0.86rem; margin: 0; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.chip {
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 0.12rem 0.5rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.chip-accent { background: var(--accent-soft); color: var(--accent-text); }
.chip-warm { background: color-mix(in srgb, var(--warm) 16%, var(--surface)); color: var(--warm); }
.chip-mono { font-family: var(--mono); font-weight: 500; }

.inline-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.35rem 0.85rem; cursor: pointer; font-size: 0.92rem;
  background: var(--surface);
}
.pill input { margin: 0; accent-color: var(--accent); }
.pill.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.75rem; min-width: 0; }
.field label { font-weight: 500; font-size: 0.9rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; }
input[type="text"], input[type="number"], select {
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  width: 100%;
  min-width: 0;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus {
  outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus);
}
input.mono { font-family: var(--mono); }
.subfields {
  margin-top: 0.75rem; padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0;
}
.subfields .hint { margin-top: 0; margin-bottom: 0.25rem; }

/* Feature toggles */
.toggle-list { display: flex; flex-direction: column; gap: 0.5rem; }
.toggle {
  display: grid; grid-template-columns: auto 1fr; gap: 0.8rem; align-items: start;
  border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.85rem; cursor: pointer;
}
.toggle.disabled { cursor: not-allowed; opacity: 0.7; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  width: 40px; height: 22px; border-radius: 999px; position: relative; margin-top: 0.15rem;
  background: var(--border-strong); transition: background 120ms; flex-shrink: 0;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform 120ms; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(18px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--focus); outline-offset: 2px; }
.toggle-title { font-weight: 600; }
.toggle-desc { color: var(--muted); font-size: 0.86rem; margin: 0.1rem 0 0; }

/* Port / volume rows */
.row-list { display: flex; flex-direction: column; gap: 0.5rem; }
.map-row {
  display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: start;
  border: 1px solid var(--border); border-radius: 8px; padding: 0.65rem 0.85rem;
}
.map-row input[type="checkbox"] { margin-top: 0.3rem; accent-color: var(--accent); width: 1rem; height: 1rem; }
.map-row.off { opacity: 0.62; }
.map-title { font-weight: 600; display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: baseline; }
.map-desc { color: var(--muted); font-size: 0.86rem; margin: 0.1rem 0 0.45rem; }
.map-edit { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.9rem; }
.map-edit input { width: 8.5rem; }
.map-edit input.wide { width: min(100%, 18rem); }
.map-edit .arrow { color: var(--muted); }
.map-edit .target { font-family: var(--mono); font-size: 0.86rem; }
.empty-note { color: var(--muted); font-size: 0.88rem; margin: 0; }

.advanced { margin-top: 0.5rem; }
.advanced summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; padding: 0.35rem 0; }
.advanced .field-row { margin-top: 0.25rem; }

/* Output panel */
.output-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: var(--shadow);
}
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 0.9rem; }
.tabs [role="tab"] {
  font: inherit; font-weight: 600; font-size: 0.92rem;
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px;
  padding: 0.5rem 0.85rem; color: var(--muted); cursor: pointer; border-radius: 6px 6px 0 0;
}
.tabs [role="tab"]:hover { color: var(--text); background: var(--surface-2); }
.tabs [role="tab"][aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent); }

.code-block {
  border-radius: 8px; overflow: hidden; margin-bottom: 0.85rem;
  border: 1px solid var(--border);
}
.code-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  background: var(--code-head); color: #c8d3de; font-size: 0.82rem; padding: 0.45rem 0.75rem;
}
.code-head code { background: rgba(255,255,255,0.08); color: inherit; }
.copy-btn {
  font: inherit; font-size: 0.8rem; font-weight: 600;
  background: var(--accent); color: #06201d; border: 0; border-radius: 6px;
  padding: 0.3rem 0.7rem; cursor: pointer;
}
.copy-btn:hover { background: var(--accent-strong); }
.copy-btn.done { background: #22c55e; color: #06200f; }
.code-block pre {
  margin: 0; padding: 0.85rem 0.95rem;
  background: var(--code-bg); color: var(--code-text);
  font-family: var(--mono); font-size: 0.83rem; line-height: 1.55;
  overflow-x: auto; tab-size: 2;
}

/* Warnings */
#warnings { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.9rem; }
#warnings:empty { display: none; }
.warning-card {
  display: grid; grid-template-columns: auto 1fr; gap: 0.55rem; align-items: start;
  border: 1px solid; border-radius: 8px; padding: 0.55rem 0.75rem; font-size: 0.88rem; margin: 0;
}
.warning-card .icon { font-weight: 700; font-family: var(--mono); }
.warn-info  { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.warn-warn  { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.warn-error { background: var(--err-bg);  border-color: var(--err-border);  color: var(--err-text); }
.warning-card a { color: inherit; }

.next-steps { font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 0.75rem; }
.next-steps p { margin: 0 0 0.4rem; }
.next-steps p:last-child { margin-bottom: 0; }
.next-steps strong { color: var(--text); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
