/* ---- Marvel Site — DTU 02805 Social Graphs & Interactions ----
   Design system carried over from DTU02805 (the framework project);
   extended just enough to host Week 1's network figures and the
   in-browser interactive graph, without introducing a second style. */

:root {
  --bg: #0e0f13;
  --bg-elevated: #16181f;
  --line: #262932;
  --text: #e9eaee;
  --text-dim: #9a9daa;
  --accent: #e6353a;      /* Marvel red — primary accent */
  --accent-soft: rgba(230, 53, 58, 0.14);
  --accent-2: #4d7cff;    /* link / secondary accent (also: giant component) */
  --accent-3: #e0a020;    /* tertiary accent, used sparingly (islands) */
  --radius: 10px;
  --maxw: 880px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  /* Striped background, copied verbatim (same colors, same opacities) from
     website/style.css's body rule -- a diagonal repeating-linear-gradient
     stripe plus a radial-gradient grain dot -- just layered over this
     site's own dark var(--bg) instead of that theme's var(--ink). DTU02805
     itself has no striped background to port (its body is a flat
     var(--bg) fill; the only gradient anywhere in its CSS is a radial
     glow behind the header) -- this pattern's origin is website/style.css.
     Tiles indefinitely, so it still covers pages taller than the viewport. */
  background:
    repeating-linear-gradient(115deg, rgba(201, 162, 39, 0.05) 0px, rgba(201, 162, 39, 0.05) 2px, transparent 2px, transparent 26px),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.06) 1.4px, transparent 1.4px) 0 0 / 16px 16px,
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

header.site-header {
  border-bottom: 1px solid var(--line);
  padding: 28px 0;
  background:
    radial-gradient(1200px 300px at 15% -20%, var(--accent-soft), transparent 60%);
}

.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand .mark,
.week-group .mark {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 0.02em;
}

.brand h1 {
  font-size: 22px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

nav.site-nav a {
  color: var(--text-dim);
  margin-left: 18px;
  font-size: 14px;
  font-weight: 600;
}
nav.site-nav a:hover { color: var(--text); text-decoration: none; }

main { padding: 48px 0 80px; }

.hero {
  padding: 8px 0 40px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.hero p.lede {
  font-size: 19px;
  color: var(--text-dim);
  max-width: 60ch;
}

.hero .tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}

h2.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 18px;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.post-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.post-card .week {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

.post-card h3 {
  margin: 6px 0 6px;
  font-size: 18px;
  color: var(--text);
}

.post-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14.5px;
}

.post-card.empty {
  border-style: dashed;
  color: var(--text-dim);
}
.post-card.empty:hover { transform: none; border-color: var(--line); }

/* Collapsible week groups on the index: each week is a <details> whose
   summary is a header bar in the site's own idiom — the .mark pill with
   the accent border (same as the header's 02805 logo), a bold topic
   title, and a .tag pill carrying the dataset count; expanding reveals
   the per-dataset post cards. */
.week-group {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.week-group + .week-group { margin-top: 14px; }

.week-group > summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s ease;
}
.week-group > summary::-webkit-details-marker { display: none; }
.week-group > summary::before {
  content: "▸";
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
  transition: transform 0.15s ease, color 0.15s ease;
  flex: 0 0 auto;
}
.week-group[open] > summary::before { transform: rotate(90deg); color: var(--accent); }
.week-group > summary:hover { background: var(--accent-soft); }
.week-group > summary:hover h3 { color: var(--text); }

.week-group > summary h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  flex: 1 1 auto;
  transition: color 0.15s ease;
}
/* the Week-N pill lives inline in the summary's h3 ("Week 2: Models & null
   models"): baseline-align the bordered pill with the following text and
   give the colon breathing room */
.week-group > summary h3 .mark {
  display: inline-block;
  margin-right: 6px;
  transform: translateY(-1px);
}
.week-group > summary .tag {           /* dataset-count chip, .tag styling */
  margin-left: 4px;
  flex: 0 0 auto;
}

.week-group[open] > summary {
  border-bottom: 1px solid var(--line);
  background: none;
}
.week-group[open] > summary::before { transform: rotate(90deg); }

.dataset-list {
  list-style: none;
  margin: 0;
  padding: 20px 22px 22px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}


.crew {
  margin-top: 60px;
}

.crew ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.crew li {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
}

footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  color: var(--text-dim);
  font-size: 13px;
}

/* ---- post pages ---- */

article.post {
  max-width: 68ch;
}

/* Week 1's page uses this to make its articles share the same content
   width as its wide-figures (the network explorer, the static drawing)
   instead of the narrower 68ch reading column -- see the two
   <article class="post wide"> in week-1-marvel-network.html. Scoped to
   .wide rather than changing article.post itself, so the still-narrow
   week-2..week-8 placeholder pages are unaffected. */
article.post.wide {
  max-width: none;
}

article.post .post-meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  margin-bottom: 6px;
}

article.post h1 {
  font-size: 32px;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

article.post .subtitle {
  color: var(--text-dim);
  font-size: 17px;
  margin-bottom: 32px;
}

article.post h2 {
  font-size: 21px;
  margin: 40px 0 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

/* subheading one level below h2 -- e.g. the "Big Bang" counterfactual
   sitting inside the preferential-attachment section -- no border, so it
   doesn't read as a new top-level (nav-anchored) section. */
article.post h3 {
  font-size: 17px;
  margin: 30px 0 12px;
  color: var(--text);
}

article.post figure {
  margin: 28px 0;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

article.post figure img,
article.post figure svg { display: block; width: 100%; height: auto; border-radius: 6px; }

article.post figcaption {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--text-dim);
}

article.post code, article.post pre {
  font-family: var(--mono);
  font-size: 13.5px;
}

article.post pre {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
}

article.post blockquote {
  border-left: 3px solid var(--accent);
  margin: 24px 0;
  padding: 4px 0 4px 18px;
  color: var(--text-dim);
}

.callout {
  background: var(--accent-soft);
  border: 1px solid rgba(230, 53, 58, 0.35);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 28px 0;
  font-size: 14.5px;
}

.back-link { display: inline-block; margin-top: 48px; }

@media (max-width: 560px) {
  .brand h1 { font-size: 19px; }
  article.post h1 { font-size: 26px; }
}

/* ---- Week 1 extensions: kept inside the same design system ----
   (dark surfaces, --line borders, --radius corners, mono labels) —
   no new colors beyond --accent-3, no competing visual language. */

/* Full-width figures: a shared card treatment for anything that should
   break out of the 68ch article column and use the site's full .wrap
   content width instead -- the static network drawing and the
   interactive explorer both use it. See the <article class="post">
   split around them in week-1-marvel-network.html. */
.wide-figure {
  margin: 28px 0;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.wide-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.wide-figure figcaption,
.explorer-caption {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--text-dim);
}

/* prose sitting between two wide-figures -- same width as everything
   else on the page now that article.post.wide matches it too */
.lede-connector {
  color: var(--text);
  margin: 28px 0;
}

.explorer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.hero-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1 1 320px;
}

.hero-search-label,
.network-toggles-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.hero-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.network-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.network-toggles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* compact segmented control: which end of each directed edge gets an
   arrowhead. Purely a display choice over the same edges/positions --
   unrelated to the island/isolate show-hide toggles above, so it gets
   its own small label rather than looking like a third layer toggle. */
.arrow-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.arrow-mode-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.arrow-toggle {
  display: inline-flex;
  /* keep the capsule hugging its buttons: align-self: flex-start shrugs off
     the stretch of column-flex parents like .hero-search, fit-content covers
     plain block parents -- row-based usages (.arrow-mode-row, etc.) are
     unaffected either way */
  align-self: flex-start;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.arrow-toggle-btn {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: none;
  padding: 6px 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.arrow-toggle-btn + .arrow-toggle-btn { border-left: 1px solid var(--line); }

.arrow-toggle-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.btn {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn:hover { border-color: var(--accent); }

.btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.search-input {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  min-width: 0;
  flex: 1 1 170px;
  -webkit-appearance: none;
  appearance: none;
}

.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dim); }

.search-status {
  font-size: 12px;
  color: var(--accent);
  min-height: 1.2em;
  margin: 2px 2px 0;
}

.explorer-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin: 16px 2px 18px;
}

.explorer-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* interactive network canvas -- generous height, full section width */
.network-box {
  height: 420px;
  width: 100%;
  background: #fff;
  border-radius: 6px;
}

@media (min-width: 640px) {
  .network-box { height: 600px; }
}

.inspector {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.inspector-empty {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 0;
}

.inspector-name {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--text);
}

.inspector-group {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  margin-bottom: 14px;
}

.inspector-stats {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
}

.inspector-stat {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}

.inspector-stat .stat-label { font-size: 10.5px; margin-bottom: 4px; }
.inspector-stat .stat-value { font-size: 17px; line-height: 1.2; }

.inspector-lists {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 560px) {
  .inspector-lists { grid-template-columns: 1fr 1fr; }
}

.inspector-section h5 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.neighbor-pill {
  display: inline-block;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 4px 4px 0;
}

.neighbor-more {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 24px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.legend-swatch {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.network-note {
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 8px 0 0;
}

/* stat cards, replacing a plain HTML table for the Week 1 metrics
   (shared by .stats-grid, .test-readout and .inspector-stat cards) */
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-label {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.stat-value {
  display: block;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stats-grid {
  list-style: none;
  margin: 20px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stats-grid .stat-value {
  font-size: 22px;
}

/* ---- Week 6: five ways to say "close" ---- */

.w6-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 18px 0;
}

.w6-picker select,
.w6-picker input {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.w6-picker input {
  flex: 1;
  min-width: 180px;
  font-family: var(--mono);
}

.w6-docs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 16px 0;
}

@media (min-width: 900px) {
  .w6-docs { grid-template-columns: 1fr 1fr 1fr; }
}

.w6-doc-col {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 12px 8px;
  min-width: 0;
}

.w6-doc-head {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.w6-doc-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 0 0 10px;
}

.w6-nb-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.w6-nb-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid transparent;
  min-width: 0;
}

.w6-nb-row:hover { background: rgba(255, 255, 255, 0.04); }
.w6-nb-row.active { border-color: var(--accent); background: var(--accent-soft); }

.w6-rank {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  width: 1.4em;
  flex: none;
}

.w6-cdot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  align-self: center;
}

.w6-nname {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.w6-cos {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  flex: none;
}

.w6-link {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: none;
  border-radius: 999px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}

.w6-row-linked .w6-link {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.w6-topic-chip {
  display: inline-block;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 1px 8px;
  margin: 1px 2px 0 0;
  color: var(--text);
}

.w6-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.w6-chip {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

.w6-chip:hover { border-color: var(--accent); }
.w6-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.w6-word-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 12px 0;
}

@media (min-width: 900px) {
  .w6-word-cols { grid-template-columns: 1fr 1fr 1fr; }
}

.w6-bar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.w6-bar-row {
  display: grid;
  grid-template-columns: 6.5em 1fr 3.2em;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  font-size: 12.5px;
  min-width: 0;
}

.w6-bar-word {
  font-family: var(--mono);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.w6-bar-track {
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.w6-bar-fill {
  /* inline element by default -> width/height ignored; needs inline-block */
  display: inline-block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent-2);
}

.w6-bar-val {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: right;
}

.w6-drawer {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 8px 0 20px;
}

.w6-drawer h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.w6-drawer .cos-note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.w6-sents {
  columns: 2;
  column-gap: 18px;
  margin-top: 8px;
}

@media (max-width: 700px) {
  .w6-sents { columns: 1; }
}

.w6-sent {
  font-size: 13px;
  color: var(--text-dim);
  border-left: 2px solid var(--accent-2);
  padding: 2px 0 2px 10px;
  margin: 0 0 8px;
  break-inside: avoid;
}

.w6-sent mark {
  background: var(--accent-soft);
  color: var(--text);
  padding: 0 1px;
}

.w6-sent-src {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
  color: var(--accent);
}

.w6-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 10px 0 18px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.w6-legend .swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}

/* ---- Week 6-2: the similarity cascade ---- */

.w62-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: flex-end;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 0;
}

.w62-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  min-width: 0;
}

.w62-field select,
.w62-field input[type="range"] {
  font-family: inherit;
  font-size: 13px;
  accent-color: var(--accent-2);
}

.w62-field select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  max-width: 260px;
}

.w62-field .w62-val {
  font-family: var(--mono);
  color: var(--text);
}

.w62-checks {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.w62-checks label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
}

.w62-checks input { accent-color: var(--accent-2); }

/* small colored counters in the legend rows */
.w62-count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ---- Week 6-4: one-character deep dive ---- */

.w64-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 16px 0;
}

@media (min-width: 1050px) {
  .w64-grid { grid-template-columns: 400px 1fr; align-items: start; }
}

.w64-col > * + * { margin-top: 14px; }
.w64-col-first > * + * { margin-top: 14px; }

.w64-ring-svg-display {
  width: 100%;
  height: 470px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: grab;
}

.w64-ring-svg-display:active { cursor: grabbing; }

.w64-ring-hint {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 4px 0 10px;
}

.w64-wordcols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 900px) {
  .w64-wordcols { grid-template-columns: 1fr 1fr 1fr; }
}

.w64-wordcol {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
}

.w64-vecmap-svg {
  width: 100%;
  height: 280px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* ---- Week 6-5: living between topics ---- */

.w65-panel {
  max-height: 620px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 4px;
}

.w65-row {
  display: grid;
  grid-template-columns: 2.2em 11px minmax(9.5em, 14.5em) 1fr 3.2em;
  gap: 8px;
  align-items: center;
  padding: 2px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  min-width: 0;
}

.w65-row:hover { background: rgba(255, 255, 255, 0.05); }
.w65-row.w65-active { background: var(--accent-soft); outline: 1px solid var(--accent); }
.w65-top20 .w65-name { color: var(--text); font-weight: 600; }

.w65-rank {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.w65-cdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.w65-name {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.w65-barrow { min-width: 0; }

.w65-bar {
  display: flex;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.w65-seg { display: inline-block; height: 100%; }

.w65-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

/* ---- Week 6-6: the analogy slot machine ---- */

.w66-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
}

.w66-eq {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 0;
}

.w66-eq select {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 26px 7px 14px;
  max-width: 190px;
  text-overflow: ellipsis;
  -webkit-appearance: none;
  appearance: none;
  /* native caret, tinted: small data-uri chevron */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.w66-eq select:focus { outline: none; border-color: var(--accent); }

.w66-eq .search-input { max-width: 200px; }
.w66-eq .w66-op {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--accent);
  line-height: 1;
}

.w66-podium { margin: 10px 0; }
.w66-podium .w66-win {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.w66-podium .w66-win .w6-nname { font-weight: 700; }

.w66-verdict {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 13.5px;
  color: var(--text);
}

.w66-map { margin: 10px 0 4px; }
.w66-map svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.w66-map circle[data-nid] { cursor: pointer; }
.w66-map circle[data-nid]:hover { opacity: 1; stroke: #fff; stroke-width: 1; }

.w66-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-dim);
  margin: 8px 2px 2px;
}
.w66-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: -1px;
}
.w66-legend .lg-dot { background: var(--text-dim); opacity: 0.7; }
.w66-legend .lg-start { background: none; border: 2px solid #fff; box-sizing: border-box; }
.w66-legend .lg-after { background: var(--accent); }
.w66-legend .lg-winner { background: none; border: 2px dashed #fff; opacity: 0.8; box-sizing: border-box; }
.w66-legend .lg-expect { background: none; border: 2px dashed var(--accent); box-sizing: border-box; }
.w66-cap {
  margin: 4px 2px 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ranked list, e.g. "top 5 by in-degree" */
.rank-list {
  list-style: none;
  margin: 20px 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.rank-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.rank-list .rank {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  width: 1.5em;
}

.rank-list .name { flex: 1; color: var(--text); }
.rank-list .metric { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }

/* side-by-side figure pairs (linear vs. log-log, etc.) */
.figure-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 720px) {
  .figure-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

.figure-grid figure { margin: 0; }

/* ---- Week 2 extensions: kept inside the same design system ----
   (dark surfaces, --line borders, --radius corners, mono labels) --
   no new colors, no competing visual language. Hand-rolled SVG charts
   (CCDF, histogram, scatter) live in posts/week2.js and are styled via
   the .chart-* classes below rather than a charting library. */

.week2-quicknav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 8px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.week2-quicknav a {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}

.week2-quicknav a:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

/* SVG chart container -- dark, matching the rest of the page (unlike the
   Week 1 vis-network box, which needs a white background because
   vis-network doesn't theme; our hand-rolled SVG charts can just use the
   site's own palette directly). */
.chart-box {
  width: 100%;
  height: 300px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (min-width: 640px) {
  .chart-box { height: 360px; }
}

/* taller variant for the Big Bang / sequential-growth node-link diagram --
   a network needs more vertical room than a curve or histogram to read. */
.chart-box.chart-box-tall { height: 420px; }

@media (min-width: 640px) {
  .chart-box.chart-box-tall { height: 520px; }
}

.chart-svg { width: 100%; height: 100%; display: block; }
.chart-axis { stroke: var(--text-dim); stroke-width: 1; }
.chart-gridline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-tick-label { fill: var(--text-dim); font-family: var(--mono); font-size: 10px; }

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.chart-legend-item { display: flex; align-items: center; gap: 6px; }

.chart-legend-swatch {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.slider-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 180px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}

.slider-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  min-width: 2ch;
  text-align: right;
}

.draw-history {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.draw-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}

.draw-chip.is-latest { color: #fff; background: var(--accent-soft); border-color: var(--accent); }

.stat-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.test-readout {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.test-readout .stat-card { padding: 10px 12px; }
.test-readout .stat-value { font-size: 17px; }
/* section heading + "back to top" arrow, scoped to this wrapper so the
   shared article.post h2 rule (used by every other page) is untouched --
   the wrapper takes over the margin/border-bottom that h2 normally owns,
   so heading and arrow sit on one baseline with one rule under both. */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 40px 0 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.section-head h2 {
  margin: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.back-to-top {
  flex: none;
  align-self: center;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
}

.back-to-top:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

/* inline math / key-result styling -- a reusable pill for equations sitting
   in ordinary prose (e.g. "⟨k⟩ = 9.465"), distinct from .stat-card (which is
   for whole standalone metrics) and .callout (a full block, not inline). */
.formula {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.95em;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 8px;
  margin: 0 1px;
  white-space: nowrap;
}

/* ---- Week 3 extensions: kept inside the same design system ----
   (dark surfaces, --line borders, --radius corners, mono labels) -- no new
   colors beyond the existing --accent/--accent-2/--accent-3 trio, no
   competing visual language. Everything else Week 3's four interactives use
   (.rank-list, .inspector*, .chart-box, .legend-grid, .test-readout,
   .arrow-toggle, .network-note, .callout, .explorer-*) is unchanged Week 1/2
   CSS, reused as-is -- see posts/week3.js. */

/* scope badge on the centrality explorer -- makes "this measure is computed
   on the undirected giant component" vs. "...on the full directed network"
   a glanceable color, not just a sentence to read every time. Same pill
   shape as .tag, just with the graph-type coded onto its border/text color
   the way .legend-swatch/.chart-legend already code meaning onto color
   elsewhere on the site. */
.tag-scope-undirected {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.tag-scope-directed {
  border-color: var(--accent);
  color: var(--accent);
}

/* =====================================================================
   "Save the Marvel Network" -- network-crisis-simulator visual identity.

   Deliberately its OWN look, distinct from the rest of the site (as
   agreed): a dark command-center/HUD aesthetic instead of the analytical
   Week 1/2/3 data-journalism style. Scoped entirely under body.sg-body /
   .sg-* / #sg-* / #screen-* / #save-* so none of it can leak onto any
   other page, and none of the site's shared rules (.wrap, .btn, .rank-list,
   .callout, etc.) are touched -- this page simply doesn't use them for its
   game screens. See posts/week3-save-game.js.

   Design tokens are additive custom properties on :root (a new --sg-*
   namespace) so they can't collide with or override the existing
   --accent/--bg/etc. tokens the rest of the site relies on.
   ===================================================================== */

:root {
  --sg-bg: #05070c;
  --sg-bg-panel: #0b0e16;
  --sg-line: #1c2130;
  --sg-cyan: #35e0ff;
  --sg-cyan-dim: rgba(53, 224, 255, 0.35);
  --sg-danger: #ff3b4e;
  --sg-danger-dim: rgba(255, 59, 78, 0.25);
  --sg-amber: #ffb020;
  --sg-success: #2ee6a8;
  --sg-text: #eef2f8;
  --sg-text-dim: #8993a8;
}

body.sg-body main.sg-shell {
  max-width: none;
  margin: 0;
  padding: 0;
  color: var(--sg-text);
}

.sg-shell {
  background: var(--sg-bg);
}

/* ---- screens: one visible at a time, cross-faded by JS toggling
   .is-active (no page navigation, so nothing re-fetches) ---- */
.sg-screen { display: none; }
.sg-screen.is-active { display: block; animation: sg-fade-in 0.35s ease both; }
@keyframes sg-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- generic HUD button -- deliberately NOT .btn: a different shape
   (sharper corners, mono caps, glow) so this page reads as its own
   interface rather than a themed variant of the analysis page's UI. ---- */
.sg-btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 11px 24px;
  border-radius: 4px;
  border: 1px solid var(--sg-line);
  background: var(--sg-bg-panel);
  color: var(--sg-text);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.sg-btn:hover { transform: translateY(-1px); text-decoration: none; }
.sg-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.sg-btn-primary {
  background: var(--sg-cyan);
  border-color: var(--sg-cyan);
  color: #04181d;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(53, 224, 255, 0.35);
}
.sg-btn-primary:hover { background: #63eaff; }

.sg-btn-danger {
  background: var(--sg-danger);
  border-color: var(--sg-danger);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(255, 59, 78, 0.4);
}
.sg-btn-danger:hover { background: #ff5c6c; }

.sg-btn-ghost { background: transparent; }
.sg-btn-ghost:hover { border-color: var(--sg-cyan); color: var(--sg-cyan); }

.sg-btn-start { font-size: 15px; padding: 15px 38px; margin: 10px 0 20px; }
.sg-btn-attack, .sg-btn-continue { width: 100%; margin-top: 4px; }

/* ---- shared status banner (intro + debrief) ---- */
.sg-status-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sg-danger);
  border: 1px solid rgba(255, 59, 78, 0.45);
  background: rgba(255, 59, 78, 0.08);
  padding: 8px 16px;
  border-radius: 4px;
  animation: sg-banner-flicker 2.2s ease-in-out infinite;
}
.sg-status-banner--stable {
  color: var(--sg-success);
  border-color: rgba(46, 230, 168, 0.45);
  background: rgba(46, 230, 168, 0.08);
  animation: none;
}
@keyframes sg-banner-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.sg-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sg-cyan);
  box-shadow: 0 0 8px var(--sg-cyan);
  flex: none;
}
.sg-status-dot--critical {
  background: var(--sg-danger);
  box-shadow: 0 0 10px var(--sg-danger);
  animation: sg-pulse-dot 1s ease-in-out infinite;
}
.sg-status-dot--stable { background: var(--sg-success); box-shadow: 0 0 8px var(--sg-success); }
@keyframes sg-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.5); }
}

/* =====================================================================
   Screen 1: crisis briefing
   ===================================================================== */
#screen-intro {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
/* #screen-intro is an ID selector (specificity 1,0,0), which would always
   beat the class-level ".sg-screen { display: none }" show/hide rule
   (specificity 0,1,0) if it set `display` unconditionally -- exactly the
   same bug shape as the #sg-overlay fix above, just via specificity origin
   instead of UA-vs-author origin. Scoping `display: flex` to only the
   `.is-active` state (specificity 1,1,0, still ID-led so it correctly wins
   over .sg-screen.is-active's 0,2,0) means the intro screen actually
   disappears once the game starts, instead of permanently stacking above
   every other screen. */
#screen-intro.is-active {
  display: flex;
}
.sg-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.022) 0px, rgba(255, 255, 255, 0.022) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: overlay;
  pointer-events: none;
}
.sg-intro-network { position: absolute; inset: 0; opacity: 0.5; }
.sg-intro-network svg { width: 100%; height: 100%; display: block; }
.sg-intro-network circle { animation: sg-bg-pulse 5s ease-in-out infinite; }
.sg-intro-network line { stroke: var(--sg-line); stroke-width: 0.6; opacity: 0.6; }
@keyframes sg-bg-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.9; }
}
.sg-intro-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, transparent 25%, rgba(5, 7, 12, 0.9) 82%);
  pointer-events: none;
}
.sg-intro-content { position: relative; z-index: 2; max-width: 640px; text-align: center; }

.sg-title { margin: 24px 0 20px; line-height: 1.05; }
.sg-title-sub {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.4em;
  color: var(--sg-text-dim);
  font-weight: 700;
  margin-bottom: 6px;
}
.sg-title-main {
  display: block;
  font-size: clamp(32px, 7vw, 60px);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 0 28px rgba(53, 224, 255, 0.4), 0 0 2px rgba(255, 255, 255, 0.6);
}

.sg-brief { color: var(--sg-text-dim); font-size: 16px; margin: 0 0 14px; }
.sg-brief-strong { color: var(--sg-text); }
.sg-footnote { font-size: 12px; color: var(--sg-text-dim); margin: 4px 0 16px; font-family: var(--mono); }
.sg-back-link { font-size: 13.5px; }
.sg-back-link a { color: var(--sg-cyan); }

/* =====================================================================
   Screen 2: the simulation
   ===================================================================== */
#screen-game { padding-bottom: 40px; }

.sg-hud-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--sg-line);
  background: linear-gradient(180deg, rgba(53, 224, 255, 0.05), transparent);
}
.sg-hud-status { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.sg-hud-status-text { color: var(--sg-cyan); }
.sg-hud-status.is-armed .sg-hud-status-text { color: var(--sg-amber); }
.sg-hud-status.is-critical .sg-hud-status-text { color: var(--sg-danger); }
.sg-hud-status.is-resolved .sg-hud-status-text { color: var(--sg-success); }
.sg-hud-status.is-armed #sg-status-dot { background: var(--sg-amber); box-shadow: 0 0 8px var(--sg-amber); }
.sg-hud-status.is-critical #sg-status-dot { background: var(--sg-danger); box-shadow: 0 0 10px var(--sg-danger); animation: sg-pulse-dot 0.6s ease-in-out infinite; }
.sg-hud-status.is-resolved #sg-status-dot { background: var(--sg-success); box-shadow: 0 0 8px var(--sg-success); animation: none; }

.sg-hud-attempts { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--sg-text-dim); text-transform: uppercase; }
.sg-pip-row { display: flex; gap: 6px; }
.sg-pip { width: 22px; height: 6px; border-radius: 3px; background: var(--sg-line); transition: background 0.3s ease, box-shadow 0.3s ease; }
.sg-pip.is-current { background: var(--sg-cyan); box-shadow: 0 0 8px var(--sg-cyan); }
.sg-pip.is-done { background: var(--sg-text-dim); }
.sg-attempt-value { color: #fff; font-weight: 700; }

.sg-hint { padding: 14px 24px 0; margin: 0; color: var(--sg-text-dim); font-size: 13.5px; font-family: var(--mono); }

.sg-console { display: flex; flex-direction: column; gap: 18px; padding: 18px 24px 0; }
@media (min-width: 900px) {
  .sg-console { flex-direction: row; align-items: stretch; }
  .sg-viewport { flex: 2 1 0; min-width: 0; }
  .sg-panel { flex: 1 1 320px; max-width: 360px; }
}

.sg-viewport {
  position: relative;
  border: 1px solid var(--sg-line);
  border-radius: 6px;
  background: radial-gradient(circle at 28% 18%, rgba(53, 224, 255, 0.06), transparent 55%), #04060a;
  overflow: hidden;
  min-height: 440px;
}
@media (min-width: 640px) { .sg-viewport { min-height: 540px; } }
@media (min-width: 900px) { .sg-viewport { min-height: 620px; } }
.sg-viewport.is-shaking { animation: sg-shake 0.4s ease-in-out; }
@keyframes sg-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(5px, -4px); }
  60% { transform: translate(-4px, 2px); }
  80% { transform: translate(3px, -2px); }
}

.sg-corner { position: absolute; width: 22px; height: 22px; border-color: var(--sg-cyan-dim); opacity: 0.8; z-index: 1; pointer-events: none; }
.sg-corner-tl { top: 10px; left: 10px; border-top: 2px solid; border-left: 2px solid; }
.sg-corner-tr { top: 10px; right: 10px; border-top: 2px solid; border-right: 2px solid; }
.sg-corner-bl { bottom: 10px; left: 10px; border-bottom: 2px solid; border-left: 2px solid; }
.sg-corner-br { bottom: 10px; right: 10px; border-bottom: 2px solid; border-right: 2px solid; }

.sg-network-box { position: absolute; inset: 0; }
.sg-network-box svg { width: 100%; height: 100%; display: block; }
.sg-network-box circle {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: r 0.18s ease, opacity 0.35s ease, stroke-width 0.15s ease, stroke 0.15s ease;
  cursor: pointer;
}
.sg-network-box line { transition: opacity 0.35s ease, stroke 0.25s ease, stroke-width 0.25s ease; }
.sg-network-box circle.is-drifting {
  animation: sg-drift var(--sg-drift-duration, 5s) ease-in-out infinite;
  animation-delay: var(--sg-drift-delay, 0s);
}
@keyframes sg-drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(var(--sg-drift-dx, 2px), var(--sg-drift-dy, 2px)); }
}
.sg-network-box circle.is-relaxing {
  transition: r 0.18s ease, opacity 0.35s ease, stroke-width 0.15s ease, stroke 0.15s ease,
    cx 0.75s cubic-bezier(0.22, 0.61, 0.36, 1), cy 0.75s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.sg-network-box circle.is-pulsing { animation: sg-node-pulse 0.35s ease-in-out 2; }
@keyframes sg-node-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.6); }
}
.sg-network-box circle.is-shockwave {
  animation: sg-shockwave 0.65s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
  pointer-events: none;
}
@keyframes sg-shockwave {
  from { r: 4; opacity: 0.9; stroke-width: 2.5; }
  to { r: 90; opacity: 0; stroke-width: 0.5; }
}

.sg-network-legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--sg-text-dim);
  background: rgba(5, 7, 12, 0.6);
  padding: 6px 10px;
  border-radius: 4px;
  z-index: 1;
}
.sg-network-legend .legend-row { display: flex; align-items: center; gap: 6px; }

.sg-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--sg-bg-panel);
  border: 1px solid var(--sg-cyan-dim);
  border-radius: 4px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.12s ease;
  transform: translate(-50%, -125%);
  white-space: nowrap;
  z-index: 2;
}
.sg-tooltip.is-visible { opacity: 1; }
.sg-tooltip .sg-tooltip-degree { color: var(--sg-cyan); font-size: 11px; }

/* ---- countdown / impact takeover -- the whole viewport reacts, not just
   the side panel ---- */
.sg-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(255, 59, 78, 0.22), rgba(5, 7, 12, 0.9) 72%);
}
/* `display: flex` above is an author-stylesheet rule, which always beats the
   browser's own default `[hidden] { display: none }` UA rule regardless of
   selector specificity -- so without this override, #sg-overlay stayed
   display:flex (and therefore visible AND absorbing every pointer event
   over the whole viewport, on top of the network SVG) even while its
   `hidden` attribute was set, silently blocking every node click on the
   game screen. This same-origin, higher-specificity rule restores the
   attribute's actual effect. */
.sg-overlay[hidden] {
  display: none;
}
.sg-overlay-inner { text-align: center; }
.sg-overlay-banner {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sg-danger);
  margin-bottom: 16px;
  animation: sg-banner-flicker 0.7s ease-in-out infinite;
}
.sg-overlay-count {
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(60px, 13vw, 130px);
  color: #fff;
  text-shadow: 0 0 44px var(--sg-danger), 0 0 10px #fff;
  line-height: 1;
}

/* ---- side panel: HUD console ---- */
.sg-panel { display: flex; flex-direction: column; gap: 16px; padding: 4px 0 20px; }
.sg-panel-section {
  background: var(--sg-bg-panel);
  border: 1px solid var(--sg-line);
  border-radius: 6px;
  padding: 18px 20px;
}
.sg-panel-heading {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sg-text-dim);
}
.sg-stat-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sg-stat { text-align: center; }
.sg-stat-value {
  display: block;
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 14px rgba(53, 224, 255, 0.3);
  font-variant-numeric: tabular-nums;
}
.sg-stat-label { display: block; font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--sg-text-dim); margin-top: 3px; }

.sg-panel-empty { color: var(--sg-text-dim); font-size: 13px; font-family: var(--mono); }

.sg-target-name { font-size: 21px; font-weight: 800; letter-spacing: 0.01em; margin-bottom: 4px; color: #fff; }
.sg-target-degree { font-family: var(--mono); font-size: 12.5px; color: var(--sg-cyan); margin-bottom: 16px; }

.sg-result-banner {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 14px;
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 700;
}
.sg-result-card[data-severity="high"] .sg-result-banner { background: rgba(255, 59, 78, 0.14); border: 1px solid rgba(255, 59, 78, 0.5); color: var(--sg-danger); }
.sg-result-card[data-severity="medium"] .sg-result-banner { background: rgba(255, 176, 32, 0.14); border: 1px solid rgba(255, 176, 32, 0.5); color: var(--sg-amber); }
.sg-result-card[data-severity="low"] .sg-result-banner { background: rgba(46, 230, 168, 0.12); border: 1px solid rgba(46, 230, 168, 0.4); color: var(--sg-success); }

.sg-result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sg-result-stat { background: var(--sg-bg); border: 1px solid var(--sg-line); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.sg-result-value { font-family: var(--mono); font-size: 16px; font-weight: 800; color: #fff; }
.sg-result-text { color: var(--sg-text-dim); font-size: 13px; margin: 0 0 4px; }

@media (prefers-reduced-motion: reduce) {
  .sg-status-dot--critical,
  .sg-hud-status.is-critical #sg-status-dot,
  .sg-status-banner,
  .sg-overlay-banner,
  .sg-intro-network circle,
  .sg-network-box circle.is-drifting,
  .sg-viewport.is-shaking {
    animation: none !important;
  }
  .sg-network-box circle,
  .sg-network-box line,
  .sg-network-box circle.is-relaxing,
  .sg-network-box circle.is-shockwave {
    transition-duration: 0.01s !important;
    animation-duration: 0.01s !important;
  }
}

/* =====================================================================
   Screen 3: mission debrief
   ===================================================================== */
.sg-debrief { max-width: 760px; margin: 0 auto; padding: 48px 24px 72px; }
.sg-debrief-title { font-size: clamp(26px, 5vw, 38px); font-weight: 800; margin: 20px 0 10px; color: #fff; }
.sg-debrief-subtitle { color: var(--sg-text-dim); margin: 0 0 8px; font-size: 15px; }
.sg-debrief-heading {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sg-cyan);
  border-bottom: 1px solid var(--sg-line);
  padding-bottom: 8px;
  margin: 36px 0 14px;
}
.sg-debrief-note { color: var(--sg-text-dim); font-size: 13.5px; margin: 0 0 12px; }

.sg-report-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.sg-report-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--sg-bg-panel);
  border: 1px solid var(--sg-line);
  border-radius: 6px;
  padding: 10px 14px;
}
.sg-report-list .rank { font-family: var(--mono); font-size: 12px; color: var(--sg-cyan); width: 1.5em; flex: none; }
.sg-report-list .name { flex: 1; color: #fff; }
.sg-report-list .metric { font-family: var(--mono); font-size: 12px; color: var(--sg-text-dim); }

.sg-debrief-message {
  background: var(--sg-bg-panel);
  border: 1px solid var(--sg-line);
  border-left: 3px solid var(--sg-cyan);
  border-radius: 6px;
  padding: 18px 20px;
  margin: 24px 0;
}
.sg-debrief-message p { margin: 0 0 10px; color: var(--sg-text); font-size: 14.5px; }
.sg-debrief-message p:last-child { margin-bottom: 0; }

.sg-debrief-actions { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }

.sg-footer { border-top: 1px solid var(--sg-line); background: var(--sg-bg); color: var(--sg-text-dim); }

/* ---- Week 4 backbone explorable: quest message states (design-system tokens only) ---- */
.bb-msg { min-height: 1.2em; margin: 12px 0 0; font-size: 13.5px; color: var(--text-dim); }
.bb-msg.is-right { color: #0ca678; }
.bb-msg.is-wrong { color: var(--accent); }
.stat-card.is-broken { border-color: var(--accent); }
.stat-card.is-broken .stat-value { color: var(--accent); }

/* ---- Week 4 Louvain/Infomap community lists: scannable size cards ----
   Opt-in variant of the shared .rank-list (used as-is elsewhere on the
   site) that turns each item into a small card with a prominent count and
   a size bar. Text content is untouched; only the layout changes. */
.rank-list.community-list > li {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.community-row-top {
  line-height: 1.6;
}

.community-dot {
  display: inline-block;
  vertical-align: middle;
  width: 8px;
  height: 8px;
  margin-bottom: 2px;
  border-radius: 2px;
  background: var(--accent-3);
}

.community-list--louvain .community-dot,
.community-list--aristotle .community-dot {
  background: var(--accent-2);
}

.community-count {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.community-desc {
  color: var(--text-dim);
  font-size: 13.5px;
}

.community-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  display: flex;
  gap: 2px;
  overflow: hidden;
}

.community-bar > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent-2);
}

.community-list--infomap .community-bar > span {
  background: var(--accent-3);
}

@media (max-width: 480px) {
  .community-count { font-size: 14.5px; }
  .community-desc { font-size: 13px; }
}

/* ============================================================
   Week 5 additions — Heaps growth + weird-page leaderboard
   ============================================================ */

/* heaps explorer */













/* weirdness leaderboard */





















.wz-chips-label {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 8px 0 6px;
}

.wz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wz-chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}


@media (max-width: 640px) {
}

/* duel explorable (combined Zipf + Heaps) */
.duel-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .duel-grid { grid-template-columns: 1fr; }
}

.duel-left { min-width: 0; }
.duel-right { min-width: 0; }

.dl-stats {
  grid-template-columns: 1fr 1fr;
  margin: 10px 0 12px;
  display: grid;
  gap: 6px;
  list-style: none;
  padding: 0;
}

.dl-stats .stat-card { padding: 7px 10px; }
.dl-stats .stat-value { font-size: 14px; }

.dl-head { margin: 8px 0 4px; }
.dl-head strong { color: var(--text); }

.dl-used {
  font-size: 12px;
  color: var(--text-dim);
  margin: 8px 0 10px;
}

.dl-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
}

.dl-check input { accent-color: var(--accent); }

#dl-top-zipf[disabled],
#dl-top-heaps[disabled] { opacity: 0.45; cursor: not-allowed; }

#dl-add-buttons.is-done .btn { color: var(--text-dim); }

.dl-empty { color: var(--text-dim); font-size: 13px; margin: 6px 0; }

/* duel explorable: header row (label left, reset right) and inline
   control names used in the prose above it */
.dl-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 12px;
}

.ctl {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}

/* week 5 investigation charts */
.inv-figure { margin-top: 12px; margin-bottom: 8px; }
.inv-info {
  font-size: 13px;
  color: var(--text-dim);
  margin: 12px 2px 0;
  min-height: 8.5em;
  line-height: 1.6;
}
.inv-info strong { color: var(--text); }
.inv-title { color: var(--text); font-weight: 600; font-size: 14px; }

/* week 5 takeaways */
.takeaways { margin: 0 0 20px; padding-left: 20px; }
.takeaways li { margin: 0 0 10px; }
.takeaways li strong { color: var(--text); }
