:root {
  --bg: #0b0d12;
  --surface: #15181f;
  --surface-hi: #1c2029;
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.05);
  --text: #e6e9ef;
  --text-dim: #8a909c;
  --text-faint: #565a66;
  --accent: #b58aff;
  --accent-soft: rgba(181, 138, 255, 0.16);
  --accent2: #7aa2ff;
  --good: #5cc48a;
  --good-soft: rgba(92, 196, 138, 0.14);
  --bad: #e87878;
  --bad-soft: rgba(232, 120, 120, 0.12);
  --mono: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior: none;
}
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.55;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(16px + var(--sat)) calc(18px + var(--sar)) 14px calc(18px + var(--sal));
  background: rgba(11, 13, 18, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand .status {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-faint);
}
.dot.live {
  background: var(--good);
  box-shadow: 0 0 8px rgba(92, 196, 138, 0.5);
}

.subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ── Layout ─────────────────────────────────────────────────────── */
main {
  padding: 20px calc(18px + var(--sal)) calc(60px + var(--sab)) calc(18px + var(--sar));
  max-width: 720px;
  margin: 0 auto;
}

.block {
  margin-bottom: 28px;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--mono);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.muted {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 14px;
}

code {
  font-family: var(--mono);
  background: var(--surface-hi);
  color: var(--accent2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  word-break: break-word;
}

pre.cmd {
  font-family: var(--mono);
  background: var(--surface-hi);
  color: var(--accent2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  user-select: all;
  -webkit-user-select: all;
}

strong {
  color: var(--text);
  font-weight: 700;
}

/* ── Steps ──────────────────────────────────────────────────────── */
.steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.steps > li {
  counter-increment: step;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 14px 52px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  top: 14px;
  left: 14px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(181, 138, 255, 0.3);
}

/* ── Copy box ───────────────────────────────────────────────────── */
.copy-box {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 18px;
  min-height: 44px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.08s, background 0.12s, border-color 0.12s;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  color: #1a0d2a;
  border-color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.01em;
  min-width: 150px;
  box-shadow: 0 6px 18px -8px rgba(181, 138, 255, 0.55);
}
button.primary:hover { background: #c6a2ff; }

.copy-msg {
  font-size: 13px;
  font-family: var(--mono);
  opacity: 0;
  transition: opacity 0.15s;
  color: var(--text-dim);
}
.copy-msg.show { opacity: 1; }
.copy-msg.ok { color: var(--good); }
.copy-msg.err { color: var(--bad); }

.raw-link {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.raw-link:hover { color: var(--accent2); }

/* ── Legend (parameter table) ───────────────────────────────────── */
.legend {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
}
.legend dt {
  font-family: var(--mono);
  font-size: 13px;
}
.legend dd {
  color: var(--text-dim);
}

/* ── Note / callout ─────────────────────────────────────────────── */
.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.55;
}

/* ── Notes list ─────────────────────────────────────────────────── */
.notes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notes > li {
  position: relative;
  padding: 10px 12px 10px 26px;
  font-size: 13.5px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  line-height: 1.5;
}
.notes > li::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 17px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.7;
}

/* ── Small screens ──────────────────────────────────────────────── */
@media (max-width: 440px) {
  body { font-size: 14.5px; }
  .steps > li { padding: 14px 14px 14px 48px; font-size: 14px; }
  .steps > li::before { width: 24px; height: 24px; font-size: 11px; left: 12px; }
  button.primary { width: 100%; min-width: 0; }
  .copy-box { gap: 8px; }
  .legend { font-size: 13px; padding: 12px 14px; }
}
