:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #24344d;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --ok: #34d399;
  --err: #f87171;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { font-size: 1.25rem; font-weight: 700; }
.brand span { color: var(--muted); font-weight: 400; font-size: 0.9rem; margin-left: 6px; }

.hub { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; }
.hub a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.hub a:hover { background: var(--panel-2); }

main { max-width: 1080px; margin: 0 auto; padding: 20px; }

.hero h1 { font-size: 1.7rem; margin: 8px 0 6px; }
.hero p { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.tab {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 0.92rem;
}
.tab.active {
  background: var(--accent);
  color: var(--on-accent, #ffffff);
  border-color: var(--accent);
  font-weight: 600;
}

.panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.panel.active { display: block; }
.panel h2 { margin: 0 0 4px; font-size: 1.15rem; }
.panel .hint { color: var(--muted); margin: 0 0 12px; font-size: 0.9rem; }

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.options label { display: flex; align-items: center; gap: 6px; font-size: 0.92rem; color: var(--text); }
.options input[type="checkbox"] { accent-color: var(--accent); }
.options select, .options input[type="text"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.92rem;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  background: var(--panel-2);
  color: var(--text);
}
button.primary { background: var(--accent); color: #ffffff; font-weight: 600; border-color: var(--accent); }
button.secondary { background: var(--panel-2); }
button:hover { filter: brightness(1.1); }
button:active {
  filter: brightness(0.82);
  transform: translateY(1px) scale(0.98);
}
@keyframes click-flash {
  0% { box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.55); }
  100% { box-shadow: 0 0 0 4px rgba(56, 189, 248, 0); }
}
button.clicked { animation: click-flash 300ms ease-out; }

.workbench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 720px) { .workbench { grid-template-columns: 1fr; } }

.col { display: flex; flex-direction: column; gap: 6px; }
.col label { color: var(--muted); font-size: 0.9rem; }

textarea {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.92rem;
  resize: vertical;
}
textarea[readonly] { background: var(--panel-2); }

.stats { color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }
.detail { color: var(--ok); font-size: 0.9rem; min-height: 1.2em; }
.detail.err { color: var(--err); }
.stale { color: var(--err); font-size: 0.85rem; }
textarea[data-stale="true"] { opacity: 0.55; }

.actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.deeplink { margin-top: 8px; }
.deeplink a { color: var(--accent); word-break: break-all; font-size: 0.85rem; }

/* Action toast — green success / neutral no-op / red error. Auto-clears. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(90vw, 560px);
  padding: 10px 18px;
  border-radius: 999px;
  background: #065f46;
  border: 1px solid #10b981;
  color: #d1fae5;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast[hidden] { display: none; }
.toast[data-type="noop"] { background: #334155; border-color: #64748b; color: #e2e8f0; }
.toast[data-type="err"] { background: #7f1d1d; border-color: #f87171; color: #fecaca; }

.py-note { color: #fbbf24; font-size: 0.85rem; margin: 0 0 10px; }
.py-status { color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }
.py-status[data-state="ready"] { color: var(--ok); }
.py-status[data-state="error"] { color: var(--err); }
.py-status[data-state="loading"] { color: var(--accent); }

.py-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .py-grid { grid-template-columns: 1fr; } }

/* Owner defect #25 (2026-11-19): the old 60px boxes were too small to read
 * multi-line Python output. Give output/return real working height; cap with
 * overflow:auto so long traces scroll instead of pushing ad slots around. */
.py-output, .py-result {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 120px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.py-output { min-height: 220px; }
.py-result { min-height: 120px; }
@media (max-width: 720px) {
  /* Stack on mobile: both boxes stay usable without overlapping. */
  .py-output { min-height: 200px; max-height: 50vh; }
  .py-result { min-height: 110px; max-height: 30vh; }
}
.py-output[data-state="error"], .py-result[data-state="error"] { color: var(--err); }
.py-result[data-state="ok"] { color: var(--ok); }

.ad {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 18px;
  min-height: 90px;
}

footer {
  border-top: 1px solid var(--line);
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.foot-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.foot-links a { color: var(--accent); text-decoration: none; }
footer p { margin: 6px 0; }

/* >>> theme-by-name (2026-11-02) >>> */
/* Theme derived from the site's MEANING, not a random variant.
 * A utility suite = cool daylight and a clean sans. Nothing should compete with the text.
 * Ad layout is deliberately NOT set here — container width and rail geometry are
 * measured and verified separately by check-ad-layout.mjs.
 */
:root {
  --bg: #f5f9ff;
  --card: #ffffff;
  --ink: #12233a;
  --muted: #5c7188;
  --line: #dbe7f3;
  --brand: #0369a1;
  /* The dark block above defines --panel/--accent for the pre-light theme.
     Without overriding them here the tab strip keeps rendering as dark navy
     pills on a near-white page — the "dark boxes with greyed-out text" defect
     (measured 2026-11-13). Light-theme tabs are white with a slate label. */
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --accent: #0369a1;
  --on-accent: #ffffff;
  --brand-strong: #0369a1;
  /* Was re-declared as #0891b2 two lines later — the duplicate won, and white
     text on that lighter cyan measured 3.68:1 (below AA). One accent only. */
  /* --text and --panel-2 are read by .options label, .col label, .hint and
     others; leaving them on the dark palette put #e2e8f0 on a near-white page
     (1.23:1, measured 2026-11-13). */
  --text: #12233a;
  --radius: 12px;
  --font-sans: 'Nunito Sans', 'Segoe UI', Candara, sans-serif;
}
body { font-family: var(--font-sans); background: var(--bg); color: var(--ink); }
h1, h2, h3 { font-family: var(--font-sans); font-weight: 500; letter-spacing: -0.015em; }
.card, .panel, section[class*="card"] { border-radius: var(--radius); }
/* <<< theme-by-name <<< */

/* Privacy architecture section (2026-11-08) — the selling point of every site. */
.privacy-section{margin-top:34px;padding-top:24px;border-top:2px solid #e2e8f0}
.privacy-section h2{font-size:1.35em;margin-bottom:10px}
.privacy-section h3{font-size:1.05em;margin:20px 0 8px}
.privacy-steps{margin:10px 0 14px;padding-left:22px}
.privacy-steps li{margin-bottom:8px;line-height:1.6}
.privacy-section kbd{background:#f1f5f9;border:1px solid #cbd5e1;border-bottom-width:2px;
  border-radius:4px;padding:1px 5px;font-size:.85em;font-family:ui-monospace,Menlo,monospace}
