/* Four-shade palette: near-black, warm gray, off-white, white. */
:root {
  --gb-0: #1c1c1a;
  --gb-1: #707068;
  --gb-2: #f4f1e6;
  --gb-3: #fffefa;
  --gb-1-dark: #a8a69c; /* lighter gray accent for dark mode */

  --bg: var(--gb-2);
  --panel: var(--gb-3);
  --ink: var(--gb-0);
  --accent: var(--gb-1);
  --border: var(--gb-0);
  --shadow: var(--gb-1);
  --photo-bg: var(--gb-2);
  --photo-fg: var(--gb-1);

  --px: 4px;

  /* Type scale: pixel font (Press Start 2P) and body font (IBM Plex Mono). */
  --fs-px-s: 12px;
  --fs-px-m: 16px;
  --fs-px-l: clamp(20px, 2.4vw, 28px);
  --fs-px-xl: clamp(20px, 4.8vw, 58px);
  --fs-s: 14px;
  --fs-m: 16px;
  --fs-l: 20px;
  --max: 1180px;
  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-body: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--gb-0);
    --panel: var(--gb-0);
    --ink: var(--gb-3);
    --accent: var(--gb-1-dark);
    --border: var(--gb-2);
    --shadow: var(--gb-1);
    --photo-bg: var(--gb-1);
    --photo-fg: var(--gb-2);
  }
}
:root[data-theme="dark"] {
  --bg: var(--gb-0);
  --panel: var(--gb-0);
  --ink: var(--gb-3);
  --accent: var(--gb-1-dark);
  --border: var(--gb-2);
  --shadow: var(--gb-1);
  --photo-bg: var(--gb-1);
  --photo-fg: var(--gb-2);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-m);
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 3px dashed var(--ink); outline-offset: 4px; }
::selection { background: var(--ink); color: var(--bg); }
.wrap { width: min(calc(100% - 32px), var(--max)); margin: 0 auto; }
.pixel { font-family: var(--font-pixel); font-weight: 400; letter-spacing: 0; }
/* Arrows and triangles are missing from the pixel font. */
.sym { font-family: var(--font-body); font-weight: 700; font-size: 1.5em; line-height: 0; }

@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* Notched pixel border: four hard shadows leave the corners open. */
.px-box {
  position: relative;
  background: var(--panel);
  margin: var(--px);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--border),
    0 var(--px) 0 0 var(--border),
    calc(var(--px) * -1) 0 0 0 var(--border),
    var(--px) 0 0 0 var(--border),
    var(--px) calc(var(--px) * 3) 0 0 var(--shadow),
    calc(var(--px) * 3) var(--px) 0 0 var(--shadow);
}
/* Dialogue box: pixel border plus a thin inner rule, like an RPG text box. */
.dialog { padding: 28px 30px 34px; }
.dialog::before {
  content: "";
  position: absolute; inset: 6px;
  border: 2px solid var(--accent);
  pointer-events: none;
}
.dialog .next {
  position: absolute; right: 18px; bottom: 12px;
  font-family: var(--font-pixel); font-size: var(--fs-px-s);
  animation: blink 1s steps(1) infinite;
}
.dialog-label {
  position: absolute; top: -14px; left: 22px;
  background: var(--ink); color: var(--bg);
  padding: 6px 10px;
  font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1;
}

.button {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1.4;
  background: var(--panel); color: var(--ink);
  margin: var(--px);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--border),
    0 var(--px) 0 0 var(--border),
    calc(var(--px) * -1) 0 0 0 var(--border),
    var(--px) 0 0 0 var(--border),
    0 calc(var(--px) * 2) 0 0 var(--shadow);
  transition: transform .08s steps(1);
}
.button.primary { background: var(--ink); color: var(--bg); }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(var(--px)); }

/* Header */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: var(--px) solid var(--border);
}
nav { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 75px; height: 33px; display: block; flex: none; --logo-x: var(--gb-1); }
.brand-name { font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1.6; white-space: nowrap; }
.navlinks { display: flex; gap: 22px; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.navlinks a { display: inline-flex; gap: 6px; padding: 6px 0; white-space: nowrap; }
.navlinks a::before { content: "▶"; font-family: var(--font-body); visibility: hidden; }
.navlinks a:hover::before, .navlinks a:focus-visible::before { visibility: visible; }
.navlinks { margin-left: auto; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; padding: 0; border: 2px solid var(--ink); background: transparent; color: var(--ink);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.theme-toggle:hover { background: var(--ink); color: var(--bg); }
.theme-toggle:focus-visible { outline: 3px dashed var(--ink); outline-offset: 3px; }

/* Hero */
.hero { padding: 80px 0 88px; }
.eyebrow { font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1.6; margin-bottom: 32px; }
h1 {
  margin: 0;
  font-family: var(--font-pixel); font-weight: 400;
  font-size: var(--fs-px-xl);
  line-height: 1.45;
  text-transform: uppercase;
}
h1 .trained { color: var(--accent); }
h1 .interactive { display: inline-block; background: var(--ink); color: var(--bg); padding: .12em .22em .08em; line-height: 1.2; }
.press-start {
  display: inline-block; margin-top: 30px;
  font-family: var(--font-pixel); font-size: var(--fs-px-s);
  animation: blink 1.2s steps(1) infinite;
}
.hero-grid { margin-top: 56px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; align-items: start; }
.hero-copy { font-size: var(--fs-l); line-height: 1.6; margin: 0; }
.hero-copy strong { background: var(--ink); color: var(--panel); padding: 0 .25em; font-weight: 500; }
.lab-info { font-size: var(--fs-m); line-height: 1.7; }
.lab-info b { font-weight: 700; }
.cta-row { display: flex; gap: 10px 16px; flex-wrap: wrap; margin-top: 22px; }

/* Sections */
section { padding: 88px 0; border-top: var(--px) dashed var(--accent); }
.section-head { display: grid; grid-template-columns: .45fr 1.55fr; gap: 40px; margin-bottom: 56px; }
.kicker { font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1.8; padding-top: 8px; }
.kicker::before { content: "▶ "; font-family: var(--font-body); font-size: 1.4em; line-height: 0; }
h2 {
  margin: 0;
  font-family: var(--font-pixel); font-weight: 400;
  font-size: var(--fs-px-l);
  line-height: 1.6;
}
.section-intro { font-size: var(--fs-l); max-width: 720px; margin: 22px 0 0; }

/* Research quests */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
.pillar { display: flex; flex-direction: column; }
.pillar .icon { width: 64px; height: 64px; color: var(--ink); margin-bottom: 26px; }
.pillar .num { font-family: var(--font-pixel); font-size: var(--fs-px-s); color: var(--accent); }
.pillar h3 { font-family: var(--font-pixel); font-weight: 400; font-size: var(--fs-px-m); line-height: 1.75; margin: 14px 0 18px; }
.pillar p { margin: 0; font-size: var(--fs-m); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 24px; }
.tag { border: 2px solid var(--ink); padding: 3px 8px; font-size: var(--fs-s); font-weight: 500; }

/* Statement */
.statement {
  background: var(--ink); color: var(--bg);
  padding: 56px 48px;
  display: grid; grid-template-columns: .45fr 1.55fr; gap: 40px;
}
.statement .small { font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1.8; }
.statement blockquote {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: var(--fs-px-l);
  line-height: 1.8;
}
.statement blockquote em { font-style: normal; text-decoration: underline; text-decoration-thickness: var(--px); text-underline-offset: 8px; }
.statement .cursor { animation: blink 1s steps(1) infinite; }

/* Publications as an item list */
.pubs { padding: 18px 12px; }
.pub {
  display: grid; grid-template-columns: 22px 150px 1fr auto; gap: 20px;
  padding: 22px 16px;
  align-items: start;
}
.pub + .pub { border-top: 2px dashed var(--accent); }
.pub .cursor { font-family: var(--font-pixel); font-size: var(--fs-px-s); visibility: hidden; padding-top: 4px; }
a.pub:hover, a.pub:focus-visible { background: var(--ink); color: var(--panel); outline: none; }
a.pub:hover .cursor, a.pub:focus-visible .cursor { visibility: visible; animation: blink 1s steps(1) infinite; }
.venue { font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1.8; padding-top: 3px; }
.badge { display: inline-block; margin-top: 6px; border: 2px solid currentColor; padding: 4px 6px; font-size: var(--fs-px-s); }
.pub h3 { margin: 0 0 6px; font-size: var(--fs-l); line-height: 1.4; font-weight: 700; }
.pub p { margin: 0; font-size: var(--fs-s); }
.pub .arrow { font-family: var(--font-pixel); font-size: var(--fs-px-s); padding-top: 4px; }

/* People as party cards */
.people-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 32px; }
.person { display: flex; flex-direction: column; }
.photo {
  aspect-ratio: 1 / 1;
  background: var(--photo-bg);
  color: var(--photo-fg);
  border-bottom: var(--px) solid var(--border);
  display: grid; place-items: end center;
  overflow: hidden;
}
.photo svg { width: 78%; height: auto; display: block; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: pixelated; }
.person-body { padding: 18px 18px 22px; }
.person h3 { font-family: var(--font-pixel); font-weight: 400; font-size: var(--fs-px-m); line-height: 1.7; margin: 0 0 10px; }
.person-dept { margin: 0 0 8px; font-size: var(--fs-s); line-height: 1.5; }
.person-topic { margin: 0; font-size: var(--fs-s); line-height: 1.5; font-weight: 500; }
a.person:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* Join */
.join { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.join .kicker { margin-bottom: 20px; }
.encounter { font-family: var(--font-pixel); font-size: var(--fs-px-m); line-height: 1.8; margin: 0 0 18px; }
.join .dialog p:not(.encounter) { font-size: var(--fs-l); margin: 0 0 22px; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 36px; }
.contact-grid .dialog { padding-top: 36px; }
.contact-grid p { margin: 0; font-size: var(--fs-m); }
.contact-grid a { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

footer { border-top: var(--px) solid var(--border); padding: 32px 0 48px; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.foot-text { font-size: var(--fs-s); }

/* "More" link under a list */
.more-row { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 12px 24px; margin-top: 32px; }
.contact-visit { margin-top: 112px; }

/* Full publication list page */
.page-hero { padding: 72px 0 64px; }
.page-hero h1 { font-size: var(--fs-px-xl); }
.page-hero .section-intro { margin-top: 18px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 28px; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.back-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.year-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.year-nav a { border: 2px solid var(--ink); padding: 6px 10px; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.year-nav a:hover, .year-nav a:focus-visible { background: var(--ink); color: var(--bg); outline: none; }
.pub-group + .pub-group { margin-top: 64px; }
.pub-group h2 { margin-bottom: 28px; scroll-margin-top: 110px; }
.pub-full { grid-template-columns: 150px 1fr; }
.pub-full h3 a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.pub-full h3 a:hover { background: var(--ink); color: var(--panel); text-decoration: none; }
.pub-authors { margin: 0 0 4px; font-size: var(--fs-s); }
.pub-authors b { font-weight: 700; }
.pub-venue-full { margin: 0; font-size: var(--fs-s); font-style: italic; }
.pub-venue-full b { font-style: normal; }
.pub-num { color: var(--accent); }
.year-nav .count { opacity: 1; color: var(--accent); }
.year-nav a:hover .count, .year-nav a:focus-visible .count { color: inherit; }
.pub-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pub-links a { border: 2px solid var(--ink); padding: 2px 8px; font-size: var(--fs-s); font-weight: 500; }
.pub-links a:hover, .pub-links a:focus-visible { background: var(--ink); color: var(--panel); outline: none; }


/* Current page in the menu */
.navlinks a[aria-current="page"]::before { visibility: visible; }

/* Teaching overview */
.course-list { display: grid; gap: 40px; }
.course-card { display: block; padding-top: 40px; }
.course-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 10px; }
.course-card h3 { margin: 0; font-family: var(--font-pixel); font-weight: 400; font-size: var(--fs-px-m); line-height: 1.6; }
.course-code { font-family: var(--font-pixel); font-size: var(--fs-px-s); color: var(--accent); }
.course-meta { margin: 0 0 12px; font-size: var(--fs-s); font-weight: 500; }
.course-card p:not(.course-meta) { margin: 0; max-width: 760px; }
.course-more { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
a.course-card:hover h3, a.course-card:focus-visible h3 { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.res-card { min-width: 0; padding-top: 40px; }
.res-card h3 { margin: 0; font-family: var(--font-pixel); font-weight: 400; font-size: var(--fs-px-m); line-height: 1.6; }
.res-card h3 a:hover, .res-card h3 a:focus-visible { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.res-card p { margin: 12px 0 0; max-width: 760px; }
.res-featured h3 { font-size: var(--fs-px-l); }
.res-lead { font-size: var(--fs-l); }
.res-list { margin: 16px 0 20px; padding-left: 1.2em; max-width: 760px; }
.res-list li { margin-bottom: 6px; }
.res-paper { font-size: var(--fs-s); }
.res-paper a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.res-code { margin: 0; padding: 16px 18px; overflow-x: auto; background: var(--ink); color: var(--panel); font-family: var(--font-body); font-size: var(--fs-s); line-height: 1.6; }
.res-card .tags { padding-top: 20px; }
.res-button { margin-top: 24px; }

/* Course page */
.course-top { display: grid; grid-template-columns: 1.4fr .6fr; gap: 36px; align-items: start; }
.course-top .dialog { padding-top: 40px; }
.course-top .dialog p { margin: 0; }
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.info-list dt { font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 2; }
.info-list dd { margin: 0; }
.info-list a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.objectives { margin: 28px 0 0; padding: 0; list-style: none; counter-reset: obj; display: grid; gap: 16px; }
.objectives li { counter-increment: obj; display: grid; grid-template-columns: 40px 1fr; font-size: var(--fs-m); }
.objectives li::before { content: counter(obj, decimal-leading-zero); font-family: var(--font-pixel); font-size: var(--fs-px-s); color: var(--accent); padding-top: 4px; }
.module-title { margin: 56px 0 24px; font-family: var(--font-pixel); font-weight: 400; font-size: var(--fs-px-m); line-height: 1.6; }
.schedule { padding: 18px 12px; }
.schedule + .module-title { margin-top: 56px; }
.week { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 20px 16px; }
.week + .week { border-top: 2px dashed var(--accent); }
.week-when { font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1.8; }
.week-num { color: var(--accent); }
.week h3 { margin: 0; font-size: var(--fs-l); line-height: 1.4; font-weight: 700; }
.week-items { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-s); }
.week-items li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.week-tag { border: 2px solid var(--ink); padding: 0 6px; font-weight: 700; text-align: center; }
.week-off h3 { font-weight: 400; font-style: italic; }
a.week:hover, a.week:focus-visible { background: var(--ink); color: var(--panel); outline: none; }
a.week:hover .week-num, a.week:focus-visible .week-num { color: inherit; }
a.week:hover .week-tag, a.week:focus-visible .week-tag { border-color: currentColor; }
.chapter-list .week-items li { grid-template-columns: 128px 1fr; }
.week-play { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.week-next { background: var(--ink); color: var(--panel); }
.week-next .week-num { color: inherit; }
.week-next .week-tag { border-color: currentColor; }
.week-next .week-when::after { content: "▶ Next up"; display: block; margin-top: 6px; animation: blink 1.2s steps(1) infinite; }
.grades { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 28px; max-width: 760px; }
.grade-row { display: flex; justify-content: space-between; gap: 16px; font-size: var(--fs-l); }
.grade-row b { font-family: var(--font-pixel); font-weight: 400; font-size: var(--fs-px-m); }
.grade-bar { display: block; height: 16px; margin-top: 10px; border: 2px solid var(--ink); background: var(--panel); }
.grade-bar span { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--ink) 0 12px, transparent 12px 16px); }
.grade-subs { list-style: none; margin: 12px 0 0; padding: 0 0 0 20px; display: grid; gap: 4px; font-size: var(--fs-s); }
.grade-subs li { display: flex; justify-content: space-between; max-width: 320px; }
.grade-subs li::before { content: "▸"; margin-left: -20px; width: 20px; }
.grade-subs li span:first-child { flex: 1; }

/* "Bonus stage" box under the research cards */
.play-box { padding-top: 40px; }
.play-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 48px; }
.play-option { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.play-option p { margin: 0; font-size: var(--fs-s); max-width: 420px; }
.play-option .button { margin-left: var(--px); }

/* Join / recruiting page */
.join-intro { display: grid; grid-template-columns: 1.3fr .7fr; gap: 36px; align-items: start; }
.join-intro .dialog { padding-top: 40px; }
.pi-card-body { display: grid; grid-template-columns: 128px 1fr; gap: 24px; align-items: start; }
.pi-card-body img { width: 128px; height: 128px; image-rendering: pixelated; border: var(--px) solid var(--ink); }
.pi-stats, .who-list, .paper-list, .offer-list, .apply-box ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.pi-stats li, .paper-list li, .apply-box ul li { display: grid; grid-template-columns: 20px 1fr; font-size: var(--fs-s); }
.pi-stats li::before, .paper-list li::before, .apply-box ul li::before { content: "▸"; }
.who-list { gap: 12px; margin-bottom: 18px; }
.who-list li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; font-size: var(--fs-s); }
.join-intro .encounter { margin: 0; }
.paper-list li { font-size: var(--fs-m); }
.more-link { margin: 16px 0 0; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.more-link a:hover { text-decoration: underline; text-underline-offset: 4px; }
.paper-list a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.learn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.learn-grid .dialog { padding-top: 40px; }
.learn-grid p { margin: 0; }
.track { display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: start; }
.track .module-title:first-child { margin-top: 0; }
.track p { margin: 0 0 14px; }
.offer-list { gap: 18px; }
.offer-list li { padding-left: 16px; border-left: var(--px) solid var(--accent); }
.offer-list b { display: block; margin-bottom: 2px; }
.apply-box { margin-top: 32px; padding-top: 40px; }
.apply-box p, .apply-box ul { margin: 0 0 14px; font-size: var(--fs-s); }
.apply-box a:not(.button) { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.page-hero .section-intro a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Hidden mini-game (game.js) */
.game-open, .game-open body { overflow: hidden; }
.game-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 32px 16px; overflow: auto; background: color-mix(in srgb, var(--ink) 75%, transparent); }
.game-overlay[hidden] { display: none; }
.game-box { width: min(640px, 100%); padding-top: 40px; }
.game-screen { display: block; width: 100%; height: auto; image-rendering: pixelated; border: var(--px) solid var(--ink); cursor: crosshair; }
.game-screen:focus-visible { outline: 3px dashed var(--ink); outline-offset: 4px; }
.game-msg { min-height: 4.95em; margin: 18px 0 0; font-size: var(--fs-m); }
.game-msg a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.game-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; }

.gallery-box { width: min(720px, 100%); }
.gallery-head { display: flex; align-items: flex-end; gap: 16px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.gallery-head figure { margin: 0; }
.gallery-head canvas { display: block; width: 96px; height: 72px; image-rendering: pixelated; border: var(--px) solid var(--ink); }
.gallery-head figcaption { margin-top: 6px; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.gallery-stats { margin: 0 0 0 auto; text-align: right; font-size: var(--fs-m); }
.gallery-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.gallery-grid.is-busy { opacity: .4; pointer-events: none; }
.gallery-tile { display: block; padding: 0; border: 3px solid transparent; background: none; cursor: pointer; }
.gallery-tile canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.gallery-tile.is-center { border-color: var(--accent); }
.gallery-tile:hover, .gallery-tile:focus-visible { border-color: var(--ink); outline: none; }

.ww-box { width: min(720px, 100%); }
.ww-now { flex: 0 1 256px; }
.ww-now canvas, .ww-opt canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; background: #fffefa; }
.ww-now canvas { border: var(--px) solid var(--ink); }
.ww-now figcaption { font-family: var(--font-body); font-size: var(--fs-s); line-height: 1.5; }
.ww-q { margin: 0 0 10px; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.ww-options { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 256px)); gap: 16px 24px; }
.ww-opt { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: var(--ink); font-family: var(--font-pixel); font-size: var(--fs-px-s); line-height: 1.6; text-align: left; }
button.ww-opt { cursor: pointer; }
.ww-opt canvas { border: var(--px) solid var(--accent); }
button.ww-opt:not(:disabled):hover canvas, button.ww-opt:focus-visible canvas { border-color: var(--ink); }
button.ww-opt:focus-visible { outline: 3px dashed var(--ink); outline-offset: 3px; }
.ww-opt.is-right canvas { border-color: var(--ink); }
.ww-opt.is-wrong { opacity: .55; }
.ww-opt.is-wrong canvas { border-style: dashed; }
.ww-opt.is-picked span::before { content: "▶ "; }
.ww-cursor { position: absolute; left: 0; top: 0; display: flex; align-items: flex-start; gap: 4px; pointer-events: none; transition: transform .9s steps(9); }
.ww-cursor[hidden] { display: none; }
.ww-cursor canvas { width: 18px; height: 30px; image-rendering: pixelated; }
.ww-cursor span { margin-top: 26px; padding: 3px 5px; background: var(--ink); color: var(--panel); font-family: var(--font-pixel); font-size: 10px; }
.ww-cursor.is-clicking canvas { transform: scale(.8); transform-origin: top left; }
.ww-bars { display: grid; gap: 10px; }
.ww-bar { display: grid; grid-template-columns: 11em 1fr 3.5em; align-items: center; gap: 12px; font-size: var(--fs-s); }
.ww-bar span { white-space: nowrap; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.ww-bar b { text-align: right; }
.ww-track { height: 18px; border: var(--px) solid var(--ink); }
.ww-track div { height: 100%; background: var(--ink); }
@media (prefers-reduced-motion: reduce) { .ww-cursor { transition: none; } }

.rpg-box { width: min(640px, 100%); }
.rpg-hud { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 12px; font-family: var(--font-pixel); font-size: var(--fs-px-s); }
.rpg-scene { display: block; width: 100%; height: auto; image-rendering: pixelated; border: var(--px) solid var(--ink); background: #f4f1e6; }
.rpg-play { margin-top: 16px; }
.rpg-text { min-height: 5.6em; margin: 16px 0 0; font-size: var(--fs-m); cursor: pointer; }
.rpg-text a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.rpg-dial { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.rpg-dial-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 6px; border: 3px solid var(--ink); background: var(--panel); color: var(--ink); font-family: var(--font-pixel); font-size: var(--fs-px-s); cursor: pointer; }
.rpg-dial-btn span { min-height: 1.4em; font-family: var(--font-body); font-size: var(--fs-s); }
.rpg-dial-btn:disabled { cursor: default; }
.rpg-dial-btn.is-you { background: var(--ink); color: var(--panel); }
.rpg-dial-btn.is-bo { background: var(--accent); color: var(--panel); border-style: dashed; }
.rpg-dial-btn.is-rest { color: var(--accent); }
.rpg-poster { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: flex-end; }
.rpg-poster-row { display: flex; flex-wrap: wrap; gap: 12px; }
.rpg-swatch { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: var(--ink); font-family: var(--font-pixel); font-size: var(--fs-px-s); cursor: pointer; }
.rpg-swatch canvas { width: 96px; height: 72px; image-rendering: pixelated; border: var(--px) solid var(--accent); background: #fffefa; }
.rpg-swatch:not(:disabled):hover canvas, .rpg-swatch:focus-visible canvas, .rpg-swatch.is-ref canvas { border-color: var(--ink); }
.rpg-swatch:disabled { cursor: default; }
.rpg-swatch:focus-visible { outline: 3px dashed var(--ink); outline-offset: 3px; }
.rpg-robot { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; }
.rpg-maze { width: 192px; height: 192px; image-rendering: pixelated; border: var(--px) solid var(--ink); cursor: crosshair; }
.rpg-options { display: grid; gap: 10px; }
.rpg-option { padding: 12px 14px; border: 3px solid var(--ink); background: var(--panel); color: var(--ink); font: inherit; font-size: var(--fs-s); text-align: left; cursor: pointer; }
.rpg-option b { margin-right: 8px; font-family: var(--font-pixel); font-weight: 400; }
.rpg-option:hover, .rpg-option:focus-visible { background: var(--ink); color: var(--panel); outline: none; }
.rpg-recap { margin: 0 0 4px; padding-left: 1.2em; font-size: var(--fs-s); }
.rpg-recap li { margin-bottom: 6px; }
.rpg-recap button { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }

.maze-box { width: min(820px, 100%); }
.maze-layout { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: 24px; align-items: start; }
.maze-screen { display: block; width: 100%; height: auto; image-rendering: pixelated; border: var(--px) solid var(--ink); cursor: crosshair; touch-action: none; }
.maze-screen:focus-visible { outline: 3px dashed var(--ink); outline-offset: 4px; }
.maze-side .gallery-stats { margin: 0 0 12px; text-align: left; }
.maze-side .game-msg { margin-top: 12px; font-size: var(--fs-s); }
.maze-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.maze-tools .button { padding: 10px 12px; }

/* The menu moves under the logo before it runs out of room. */
@media (max-width: 1180px) {
  nav { flex-wrap: wrap; padding: 14px 0 10px; gap: 10px; }
  .navlinks { width: 100%; flex-wrap: wrap; gap: 4px 18px; order: 2; margin-left: 0; }
}
@media (max-width: 900px) {
  .hero { padding-top: 56px; }
  .hero-grid, .section-head, .join, .statement, .contact-grid, .pillars { grid-template-columns: 1fr; }
  .section-head { gap: 18px; margin-bottom: 40px; }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; }
  .statement { padding: 40px 28px; gap: 24px; }
  .pub, .pub-full, .week { grid-template-columns: 1fr; gap: 8px; }
  .course-top, .play-options, .join-intro, .learn-grid, .track, .maze-layout { grid-template-columns: 1fr; }
  .pi-card-body { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; gap: 2px; }
  .info-list dd { margin-bottom: 10px; }
  .pub .cursor, .pub .arrow { display: none; }
}
@media (max-width: 520px) {
  .ww-options { grid-template-columns: minmax(0, 256px); }
  section { padding: 64px 0; }
  .dialog { padding: 24px 20px 32px; }
  .people-grid { grid-template-columns: 1fr; gap: 28px; }
  .person { flex-direction: row; }
  .photo { width: 104px; flex: none; align-self: flex-start; border-bottom: 0; border-right: var(--px) solid var(--border); }
  .person-body { padding: 14px 14px 16px; }
}

/* Unpixelated photo (trial) */
.photo img.real, .pi-card-body img.real { image-rendering: auto; }
