/* stuxnet.pro lab site — shared styles */
:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-raise: #11161d;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: rgba(88, 166, 255, .12);
  --accent-contrast: #04121f;
  --accent-border: rgba(88, 166, 255, .35);
  --good: #3fb950;
  --bad: #f85149;
  --warn: #d29922;
  --surface: #010409;
  --hover-bg: #0e1622;
  --shadow-hover: rgba(0, 0, 0, .35);
  --sel: rgba(88, 166, 255, .3);
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fa;
  --panel: #ffffff;
  --panel-raise: #f6f8fa;
  --border: #d0d7de;
  --text: #24292f;
  --muted: #57606a;
  --accent: #0969da;
  --accent-contrast: #ffffff;
  --accent-dim: rgba(9, 105, 218, .08);
  --accent-border: rgba(9, 105, 218, .4);
  --good: #1a7f37;
  --bad: #cf222e;
  --warn: #9a6700;
  --surface: #ffffff;
  --hover-bg: #eaf2fb;
  --shadow-hover: rgba(60, 76, 96, .18);
  --sel: rgba(9, 105, 218, .15);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0 16px 64px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  scroll-behavior: smooth;
}
::selection { background: var(--sel); }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.wrap { max-width: 860px; margin: 0 auto; }
a { color: var(--accent); }
h1, h2 { letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Hub ─────────────────────────────────────────── */
header.site {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}
header.site h1 { margin: 0 0 6px; font-size: 1.7rem; }
header.site .lede { margin: 0 0 14px; color: var(--muted); max-width: 46rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: .76rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  background: var(--panel);
}

/* Category panels with lab tiles */
.category-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 26px 0;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--panel-raise);
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: .01em;
}
.panel-badge {
  margin-left: auto;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 3px 11px;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 18px 20px 20px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  background: var(--panel-raise);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px 12px;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease,
              background .18s ease, box-shadow .18s ease;
}
.tile:hover {
  border-color: var(--accent);
  background: var(--hover-bg);
  transform: translateY(-3px);
  box-shadow: 0 12px 24px var(--shadow-hover);
}
.tile-num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  line-height: 1.2;
}
.tile-title { font-size: .82rem; font-weight: 650; color: var(--text); }
.tile-sub {
  font-size: .7rem;
  color: var(--muted);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-meta { margin-top: 7px; display: flex; align-items: center; gap: 7px; }
.chip-mini {
  font-size: .62rem;
  letter-spacing: .04em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}
.tile-status {
  font-size: .65rem;
  font-weight: 600;
  color: var(--good);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tile-status::before { content: "●"; font-size: .5rem; }
@media (max-width: 480px) {
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 10px; padding: 14px; }
}

.legal {
  margin-top: 26px;
  padding: 14px 18px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--warn);
  font-size: .9rem;
}
footer.site {
  margin-top: 34px;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
footer.site p { margin: 0; }
.backtop {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--shadow-hover);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.backtop:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* Theme toggle (bottom-left, mirrors the back-to-top button) */
.themebtn {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--shadow-hover);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.themebtn:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}
@media (max-width: 480px) {
  .backtop { bottom: 16px; right: 16px; width: 40px; height: 40px; }
  .themebtn { bottom: 16px; left: 16px; width: 40px; height: 40px; }
}

/* ── Lab pages — shared dark scaffolding ─────────── */
h1 { font-size: 1.35rem; }
form { margin: 0; }
input, button { font: inherit; }
input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
}
button {
  padding: 8px 14px; border: 0; border-radius: 6px; background: var(--accent);
  color: var(--accent-contrast); font-weight: 600; cursor: pointer;
}
button:hover { filter: brightness(1.1); }
.page-center { text-align: center; padding: 9vh 0 24px; }
.page-top { padding-top: 36px; }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 20px; margin: 30px 0 0; text-align: left;
}
.panel details { border: 0; padding: 8px 0 0; margin: .8rem 0 0; }
.panel pre { margin: 10px 0; }
details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0;
}
details summary { cursor: pointer; font-weight: 600; }
.fineprint { color: var(--muted); font-size: .88rem; }
.err { color: var(--bad); font-size: 1.05rem; font-weight: 600; margin-top: 2rem; }
.tries {
  margin-top: 1.4rem; background: var(--panel); border: 1px solid var(--bad);
  border-radius: 8px; padding: 12px 20px; text-align: left;
  max-width: 660px; margin-left: auto; margin-right: auto;
}
.tries p { margin: 6px 0; }
.tries .why { color: var(--muted); font-size: .88rem; }
.profile {
  margin-top: 1.5rem; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 22px; text-align: left;
}
code, pre {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
code { padding: 2px 6px; }
pre { padding: 12px; overflow-x: auto; line-height: 1.5; }
pre code { padding: 0; border: 0; background: none; }

@media (prefers-reduced-motion: reduce) {
  .tile, .backtop, .themebtn { transition: none; transform: none !important; }
  body { scroll-behavior: auto; }
}

/* Category menu pages (/, /or, /xss) */
.menu-body { padding: 8px 22px 22px; text-align: left; }
.menu-cat { font-size: 1.3rem; margin: 10px 0 4px; }
.menu-sub { color: var(--muted); margin: 0 0 14px; font-size: .95rem; }
.menu-list { margin: 0; padding-left: 1.15rem; display: grid; gap: 7px; }
.menu-list li { margin: 0; }
.menu-list a { color: var(--text); text-decoration: none; }
.menu-list a:hover { color: var(--accent); text-decoration: underline; }
.menu-list .num { font-family: var(--mono); color: var(--accent); font-weight: 700; margin-right: 6px; }
.menu-list .status { font-size: .68rem; font-weight: 600; color: var(--good); margin-left: 10px; }
.menu-list .status.drill { color: var(--warn); }
.menu-group {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 6px;
}

/* Root hub — fixed-width category tiles, L→R rows, no stretching, no h-scroll */
:root { --tile-w: 270px; }
.cat-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, min(var(--tile-w), calc(100vw - 32px)));
  justify-content: start;
}
.cat-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 175px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease,
              background .18s ease, box-shadow .18s ease;
}
.cat-tile:hover {
  border-color: var(--accent);
  background: var(--hover-bg);
  transform: translateY(-3px);
  box-shadow: 0 12px 24px var(--shadow-hover);
}
.cat-head { display: flex; align-items: center; justify-content: space-between; }
.cat-num { font-family: var(--mono); font-weight: 700; font-size: .95rem; color: var(--accent); }
.cat-count {
  font-size: .68rem;
  font-weight: 600;
  color: var(--good);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.cat-name { font-size: 1.12rem; font-weight: 650; color: var(--text); letter-spacing: -.01em; }
.cat-desc {
  color: var(--muted);
  font-size: .88rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cat-open { margin-top: auto; color: var(--accent); font-weight: 600; font-size: .88rem; }

/* Markdown labs — comment textarea + rendered preview */
textarea {
  display: block;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
  max-width: 640px;
  resize: vertical;
  margin: 0 0 10px;
}
textarea:focus { outline: none; border-color: var(--accent); }
.md-preview {
  margin-top: 1.2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 22px;
  text-align: left;
  line-height: 1.55;
}
.md-preview p { margin: 8px 0; }
.md-preview h2, .md-preview h3, .md-preview h4 { margin: 12px 0 6px; }
.md-preview img { max-width: 100%; }
.md-preview a { color: var(--accent); }

/* Stored-XSS comment pages */
.post-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  text-align: left;
}
.post-card h2 { margin: 0 0 4px; font-size: 1.25rem; }
.post-card .pmeta { color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.post-card p { margin: 10px 0 0; font-size: .95rem; }
.cform {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 22px 18px;
  margin-top: 16px;
  text-align: left;
}
.cform label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 4px;
}
.cform input, .cform textarea { max-width: none; margin: 0; }
.comments-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 8px; }
.comments-head h2 { margin: 0; font-size: 1.15rem; }
.comment {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--panel-raise);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
  text-align: left;
  overflow-wrap: anywhere;
}
.cavatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: var(--accent-contrast);
  background: var(--accent);
}
.cmeta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cmeta .who { font-weight: 700; font-size: .85rem; color: var(--text); }
.cmeta .when { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.comment .body { display: block; font-size: .93rem; line-height: 1.5; }
.stored-ok { color: var(--good); font-weight: 600; }
