/* ==========================================================================
   Super Prompt Brothers · style.css
   --------------------------------------------------------------------------
   1. Tokens            8. Trophy case (bento, results)
   2. Base              9. Writeups
   3. Utilities        10. Team
   4. Components       11. CTA band
   5. Header & menu    12. Footer
   6. Hero             13. 404
   7. Terminal         14. Motion, 8-bit mode, a11y media
   ========================================================================== */

/* 1. Tokens ================================================================ */
:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #07090a; --bg-1: #0c1011; --bg-2: #11171a; --bg-3: #161e21; --term-bg: #090c0d;
  /* lines */
  --line: #ffffff14; --line-2: #ffffff24; --line-accent: #36f67a47;
  /* text (AA-checked; --text-3 is the floor) */
  --text-1: #ecf2ee; --text-2: #a9b6ae; --text-3: #7a8880;
  /* accent */
  --accent: #36f67a; --accent-hover: #6bff9c; --accent-ink: #03140a;
  --accent-soft: #36f67a1a; --accent-glow: #36f67a59; --teal: #2dd4bf;
  /* medals */
  --gold: #f5c451; --gold-soft: #f5c4511a; --gold-line: #f5c45147; --gold-ink: #1f1603;
  --silver: #c9d3dd; --silver-soft: #c9d3dd14; --silver-line: #c9d3dd3d; --silver-ink: #12161a;
  --bronze: #e3a173; --bronze-soft: #e3a1731a; --bronze-line: #e3a17347; --bronze-ink: #1f1206;
  /* terminal */
  --term-fg: #d3eadb; --term-dim: #7a8880; --term-err: #ff7b72;
  --dot-r: #ff5f57cc; --dot-y: #febc2ecc; --dot-g: #28c840cc;
  /* effects */
  --shadow-1: inset 0 1px 0 #ffffff0d, 0 1px 2px #00000066;
  --shadow-2: 0 30px 80px -24px #000000e6;
  --glow: 0 0 120px -30px #36f67a59;
  --aurora: radial-gradient(60% 55% at 50% 0%, #36f67a29 0%, transparent 70%),
            radial-gradient(40% 40% at 85% 8%, #2dd4bf14 0%, transparent 70%);
  --grid-lines: linear-gradient(#ffffff08 1px, transparent 1px) 0 0 / 64px 64px,
                linear-gradient(90deg, #ffffff08 1px, transparent 1px) 0 0 / 64px 64px;
  --grid-mask: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
  /* radii */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;
  /* spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px;
  --s-8: 40px; --s-9: 48px; --s-10: 64px; --s-11: 80px; --s-12: 96px; --s-13: 128px;
  --gutter: clamp(16px, 4vw, 32px);
  --max: 1200px;
  --section-y: clamp(72px, 9vw, 128px);
  --header-h: 56px;
  /* motion */
  --ease: cubic-bezier(.2, .7, .2, 1); --dur-fast: 150ms; --dur: 250ms; --dur-slow: 600ms;
  /* fonts */
  --font-sans: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-pixel: 'VT323', var(--font-mono);
  /* type scale */
  --fs-h1: clamp(2.625rem, 1.2rem + 6vw, 5.5rem);
  --fs-h2: clamp(1.875rem, 1.25rem + 2.5vw, 3.25rem);
  --fs-h3: clamp(1.125rem, 1rem + .45vw, 1.375rem);
  --fs-stat-xl: clamp(4rem, 2.5rem + 6vw, 6.5rem);
  --fs-stat: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem);
  --fs-lead: clamp(1.0625rem, 1rem + .35vw, 1.25rem);
  --fs-body: 1rem;
  --fs-nav: .9375rem;
  --fs-sm: .875rem;
  --fs-mono: .8125rem;
  --fs-label: .75rem;
  --fs-term: clamp(.78125rem, .74rem + .2vw, .875rem);
  --chips-h: 52px;
}
@media (min-width: 960px) { :root { --header-h: 64px; } }
@media (max-width: 479px) { :root { --fs-term: .875rem; } }
@media (pointer: coarse) { :root { --chips-h: 60px; } }

/* 2. Base ================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
  overflow-x: clip;
  background: var(--bg);
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-width: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
code, kbd { font-family: var(--font-mono); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h2 {
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-1);
}
h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }

/* 3. Utilities ============================================================= */
.nowrap { white-space: nowrap; }
html:not(.js) .js-only { display: none; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 56ch;
}
.eyebrow {
  font: 500 var(--fs-label)/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow .idx { color: var(--accent); }

.skip-link {
  position: fixed;
  top: -60px; left: 16px;
  z-index: 100;
  display: inline-flex; align-items: center;
  height: 40px; padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: 12px; }
.skip-link:focus-visible { outline-color: var(--text-1); }

/* 4. Components ============================================================ */
/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 500 var(--fs-nav)/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn-lg { height: 48px; padding: 0 22px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: .875rem; }
.btn-block { display: flex; width: 100%; height: 48px; }
@media (pointer: coarse) { .btn:not(.btn-sm) { height: 48px; } .btn-sm { height: 44px; } }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: inset 0 1px 0 #ffffff66, 0 0 0 1px #36f67a, 0 8px 24px -8px #36f67a80;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-primary:focus-visible { outline: 2px solid var(--text-1); outline-offset: 3px; border-radius: 10px; }
.btn-ghost { background: #ffffff08; border-color: var(--line-2); color: var(--text-1); }
.btn-ghost:hover { background: #ffffff0f; border-color: #ffffff33; }
.btn-ghost:active { transform: scale(.98); }
.btn:focus-visible { border-radius: 10px; }
.glyph { font: 500 .875em/1 var(--font-mono); color: var(--accent); }
.btn [aria-hidden="true"] { display: inline-block; transition: transform var(--dur) var(--ease); }
.btn:hover .arrow-ne, a:hover > .arrow-ne { transform: translate(2px, -2px); }
.btn:hover .arrow-down { transform: translateX(3px); }

/* Inline links */
.link {
  color: var(--accent);
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size var(--dur) var(--ease);
}
.link:hover, .link:focus-visible { background-size: 100% 1px; }

/* Tags */
.tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 400 var(--fs-label)/1 var(--font-mono);
  color: var(--text-2);
  margin-left: 4px;
  vertical-align: 2px;
  white-space: nowrap;
}
.tag-hunt { background: var(--accent-soft); color: var(--accent); border-color: var(--line-accent); }

/* Placement pills and pixel-notched medals */
.place-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 12px 0 5px;
  border: 1px solid;
  border-radius: var(--r-sm);
  font: 500 var(--fs-sm)/1 var(--font-sans);
  white-space: nowrap;
}
.medal {
  display: inline-grid; place-items: center;
  flex: none;
  width: 20px; height: 20px;
  clip-path: polygon(0 0, 30% 0, 30% 15%, 70% 15%, 70% 0, 100% 0, 100% 80%, 80% 80%, 80% 100%, 20% 100%, 20% 80%, 0 80%);
  font: 700 11px/1 var(--font-mono);
  padding-bottom: 1px;
}
.place-pill.gold, .medal-gold { --m: var(--gold); --m-soft: var(--gold-soft); --m-line: var(--gold-line); --m-ink: var(--gold-ink); }
.place-pill.silver, .medal-silver { --m: var(--silver); --m-soft: var(--silver-soft); --m-line: var(--silver-line); --m-ink: var(--silver-ink); }
.place-pill.bronze, .medal-bronze { --m: var(--bronze); --m-soft: var(--bronze-soft); --m-line: var(--bronze-line); --m-ink: var(--bronze-ink); }
.place-pill { background: var(--m-soft); border-color: var(--m-line); color: var(--m); }
.medal { background: var(--m); color: var(--m-ink); }

/* kbd */
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

/* Section header block */
.section { position: relative; padding-block: var(--section-y); scroll-margin-top: calc(48px - var(--section-y)); }
.section::before {
  content: "";
  position: absolute; top: 0; left: 50%;
  width: min(var(--max), 100% - 2 * var(--gutter));
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #ffffff1a 50%, transparent);
}
.section-head { margin-bottom: clamp(32px, 5vw, 56px); }
.section-rule { display: flex; align-items: center; gap: 16px; }
.rule-line, .rule-path { display: none; }
.section-head h2 { margin-top: 16px; }
.section-head .lead { margin-top: 16px; }
@media (min-width: 640px) {
  .rule-line { display: block; flex: 1; height: 1px; background: var(--line); }
  .rule-path { display: block; font: 400 var(--fs-label)/1 var(--font-mono); color: var(--text-3); }
}

/* 5. Header & menu ========================================================= */
.site-header {
  position: relative;
  z-index: 50;
  height: var(--header-h);
  background: #07090ab8;
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: #07090af2; }
}
html.js .site-header { position: sticky; top: 0; border-bottom-color: transparent; }
html.js .site-header.is-scrolled { border-bottom-color: var(--line); background: #07090ae6; }
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 100%;
  gap: 16px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  min-width: 0;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text-1);
  white-space: nowrap;
  padding-block: 8px;
  margin-block: -8px;
}
.wordmark .mark { flex: none; }
.header-cta { position: relative; }
@media (pointer: coarse) {
  /* 44px hit areas without changing the visual size */
  .header-cta::after, .pill::after { content: ""; position: absolute; inset: -4px -2px; }
}
.nav-desktop { display: none; }
.header-actions { grid-column: 3; display: flex; align-items: center; gap: 8px; }
.header-cta { display: none; }
.cta-long { display: none; }
@media (min-width: 640px) {
  .header-cta { display: inline-flex; }
}
@media (min-width: 1100px) {
  .header-inner { grid-template-columns: 1fr auto 1fr; }
  .header-actions { justify-self: end; }
  .nav-desktop { display: block; grid-column: 2; justify-self: center; }
  .nav-desktop ul { display: flex; gap: 4px; }
  .nav-desktop a {
    position: relative;
    display: block;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    font-size: var(--fs-nav);
    font-weight: 500;
    color: var(--text-2);
    transition: color var(--dur-fast), background-color var(--dur-fast);
  }
  .nav-desktop a:hover { color: var(--text-1); background: #ffffff08; }
  .nav-desktop a[aria-current="location"] { color: var(--text-1); }
  .nav-desktop a[aria-current="location"]::after {
    content: "";
    position: absolute; left: 50%; bottom: -6px;
    width: 4px; height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: var(--accent);
  }
  .cta-long { display: inline; }
  .cta-short { display: none; }
  .menu { display: none; }
}

/* Mobile menu (works without JS) */
.menu-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  margin-right: -10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  list-style: none;
}
.menu-btn::-webkit-details-marker { display: none; }
.menu-btn::marker { content: ""; }
.menu-btn:hover { background: #ffffff08; }
.menu-bars { position: relative; display: block; width: 18px; height: 10px; }
.menu-bars i {
  position: absolute; left: 0;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: var(--text-1);
  transition: transform 200ms var(--ease), top 200ms var(--ease);
}
.menu-bars i:first-child { top: 0; }
.menu-bars i:last-child { top: 8px; }
.menu[open] .menu-bars i:first-child { top: 4px; transform: rotate(45deg); }
.menu[open] .menu-bars i:last-child { top: 4px; transform: rotate(-45deg); }
.menu-panel {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  padding: 8px var(--gutter) 24px;
  background: #0a0d0e;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 24px 48px -24px #000000cc;
  animation: menu-in 200ms var(--ease);
}
.menu-panel::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 100%;
  height: 100vh;
  background: #000000a6;
  animation: fade-in 200ms var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
.menu:not([open]) .menu-panel { display: none; }
.menu-list { margin-bottom: 20px; }
.menu-list a {
  display: flex; align-items: center; gap: 14px;
  height: 56px;
  border-bottom: 1px solid var(--line);
}
.menu-idx { font: 400 var(--fs-label)/1 var(--font-mono); color: var(--text-3); }
.menu-label { flex: 1; font-size: 18px; font-weight: 500; color: var(--text-1); }
.menu-arrow { color: var(--text-3); transition: transform var(--dur) var(--ease); }
.menu-list a:hover .menu-arrow { transform: translateX(3px); color: var(--text-1); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }

/* 6. Hero ================================================================== */
.hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding: 32px 0 clamp(64px, 7vw, 96px);
  text-align: center;
}
.hero::before, .hero::after {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 900px;
  pointer-events: none;
  z-index: -1;
}
.hero::before { background: var(--aurora); }
.hero::after {
  background: var(--grid-lines);
  -webkit-mask-image: var(--grid-mask);
  mask-image: var(--grid-mask);
}
@media (min-width: 640px) { .hero { padding-top: clamp(48px, 7vw, 96px); } }

.pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  max-width: 100%;
  height: 32px;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: #ffffff06;
  font: 400 var(--fs-mono)/1 var(--font-mono);
  color: var(--text-2);
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.pill:hover { border-color: #ffffff38; background: #ffffff0a; color: var(--text-1); }
.pill:focus-visible { border-radius: var(--r-pill); }
.pill-tag {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 8px;
  border: 1px solid var(--line-accent);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.pill-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-long { display: none; }
.pill-arrow { transition: transform var(--dur) var(--ease); }
.pill:hover .pill-arrow { transform: translateX(3px); }
@media (min-width: 640px) { .pill-long { display: inline; } }
/* Touch-sized pill on phones and touch screens: 40px visual, 48px hit area on coarse pointers */
@media (pointer: coarse), (max-width: 639px) {
  .pill { height: 40px; padding: 4px 16px 4px 5px; }
  .pill-tag { height: 30px; padding: 0 10px; }
}

.hero-title {
  margin: 20px auto 0;
  max-width: 8.6em;
  padding-block: .04em .1em;
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: .95;
  color: var(--text-1);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero-title {
    background: linear-gradient(180deg, #ffffff 0%, #b9c6be 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
@media (min-width: 640px) { .hero-title { margin-top: 28px; } }
@media (min-width: 1150px) { .hero-title { max-width: none; white-space: nowrap; } }
.cursor {
  display: inline-block;
  width: .12em; height: .8em;
  margin-left: .08em;
  vertical-align: -0.04em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.tagline {
  margin-top: 16px;
  font: 500 14px/1.5 var(--font-mono);
  color: var(--accent);
}
.hero-lead { margin: 14px auto 0; max-width: 680px; text-wrap: balance; }
.hero-ctas {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 28px;
}
.hero-ctas .btn { width: 100%; }
@media (min-width: 480px) {
  .tagline { font-size: 15px; margin-top: 20px; }
  .hero-lead { margin-top: 16px; }
  .hero-ctas { flex-direction: row; justify-content: center; gap: 12px; margin-top: 36px; }
  .hero-ctas .btn { width: auto; }
}

/* 7. Terminal ============================================================== */
.terminal {
  max-width: 1040px;
  margin: 32px auto 0;
  text-align: left;
}
@media (min-width: 640px) { .terminal { margin-top: clamp(48px, 6vw, 72px); } }
.term-window {
  position: relative;
  padding: 1px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff2e, #ffffff0a 35%, #36f67a33);
  box-shadow: var(--shadow-2), var(--glow), inset 0 1px 0 #ffffff0f;
  transition: box-shadow var(--dur) var(--ease);
}
.term-window::after {
  content: "";
  position: absolute; left: 15%; right: 15%; bottom: -56px;
  height: 40px;
  background: var(--accent-glow);
  filter: blur(40px);
  opacity: .5;
  z-index: -1;
  pointer-events: none;
}
.term-window:focus-within {
  background: linear-gradient(180deg, #ffffff2e, #ffffff0a 35%, var(--line-accent));
  outline: 2px solid #36f67a99;
  outline-offset: 4px;
}
.term-inner {
  position: relative;
  overflow: hidden;
  border-radius: 11px;
  background: var(--term-bg);
}
@media (min-width: 640px) {
  .term-window { border-radius: 14px; }
  .term-inner { border-radius: 13px; }
}
.term-titlebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.term-dots { display: flex; gap: 8px; }
.term-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--dot-r); }
.term-dots i:nth-child(2) { background: var(--dot-y); }
.term-dots i:nth-child(3) { background: var(--dot-g); }
.term-title {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 12.5px/1 var(--font-mono);
  color: var(--text-3);
}
.term-size { justify-self: end; display: none; font: 400 12px/1 var(--font-mono); color: var(--text-3); }
@media (min-width: 640px) { .term-size { display: block; } }

.term-body {
  position: relative;
  /* Starts compact and grows with output, then scrolls inside. */
  min-height: 236px;
  max-height: clamp(340px, 60vh, 460px);
  max-height: clamp(340px, 60svh, 460px);
  padding: 14px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  font: 400 var(--fs-term)/1.6 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--term-fg);
  scrollbar-width: thin;
  scrollbar-color: #ffffff24 transparent;
}
.term-inner::before {
  content: "";
  position: absolute; inset: 44px 0 var(--chips-h);
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, #00000008 2px 3px);
}
@media (min-width: 640px) { .term-body { min-height: 280px; max-height: 460px; padding: 20px 22px; } }
@media (min-width: 960px) { .term-body { min-height: 300px; max-height: 500px; } }
@media (max-height: 500px) and (orientation: landscape) {
  .term-body { min-height: 160px; max-height: calc(100vh - var(--header-h) - 44px - var(--chips-h) - 24px); max-height: calc(100svh - var(--header-h) - 44px - var(--chips-h) - 24px); }
}

.output-line { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.6em; }
.output-line.muted, .output-line .muted { color: var(--term-dim); }
.output-line.boot { color: var(--accent); }
.output-line.error { color: var(--term-err); }
.output-line a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.output-line a:hover { color: var(--accent-hover); }
.output-line.gold, .table .gold { color: var(--gold); }
.table .silver { color: var(--silver); }
.table .bronze { color: var(--bronze); }
.output-line.success {
  font: 400 36px/1.1 var(--font-pixel);
  color: var(--gold);
  letter-spacing: .02em;
  margin-block: 4px;
}
.command-echo { margin-top: 10px; }
.echo-prompt { color: var(--term-dim); }
.echo-command { color: var(--text-1); }
.output-line.table, .output-line.ascii-output {
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: normal;
  white-space: pre;
  scrollbar-width: thin;
}
.output-line.indent { padding-left: 6ch; }
.output-line.ascii-output { font-size: max(10px, 1em); line-height: 1.3; }
.output-line.table > div { min-height: 1.6em; }
.train { white-space: pre; overflow: hidden; animation: train 2.3s linear forwards; }
@keyframes train { from { transform: translateX(110%); } to { transform: translateX(-110%); } }
.term-window.glitch { animation: glitch .12s steps(2) 4; }
@keyframes glitch {
  0% { transform: translate(2px, -1px); filter: hue-rotate(40deg); }
  50% { transform: translate(-2px, 1px); }
  100% { transform: none; }
}
.matrix-canvas { position: absolute; inset: 44px 0 var(--chips-h); z-index: 3; width: 100%; height: calc(100% - 44px - var(--chips-h)); }

#command-form { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .6em; margin-top: 10px; }
#command-form[hidden] { display: none; }
.prompt { color: var(--accent); white-space: nowrap; overflow-wrap: anywhere; }
.prompt-host { display: none; }
@media (min-width: 480px) { .prompt-host { display: inline; } }
.input-wrap { position: relative; flex: 1 1 8ch; min-width: 8ch; }
#command-input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-1);
  font: inherit;
  caret-color: var(--accent);
}
#command-input:focus-visible { outline: none; }
@media (pointer: coarse) { #command-input { font-size: 16px; } }
.block-cursor {
  position: absolute; left: 0; top: .2em;
  width: .6em; height: 1.2em;
  background: var(--accent);
  pointer-events: none;
  animation: blink 1.1s steps(1) infinite;
}
/* Empty prompt: the block is the caret. Solid and blinking while focused, hollow while not. */
#command-input:placeholder-shown { caret-color: transparent; }
#command-input:not(:focus) + .block-cursor { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); animation: none; }
#command-input:not(:placeholder-shown) + .block-cursor { display: none; }

/* Chip bar */
.term-chips {
  position: relative;
  display: flex; align-items: center;
  height: var(--chips-h);
  padding-left: 16px;
  border-top: 1px solid var(--line);
  background: #0b0f10;
}
.chips-label {
  flex: none;
  font: 500 var(--fs-label)/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.chips-row {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
  height: 100%;
  padding-inline: 12px 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 12px 16px;
  scrollbar-width: none;
}
.chips-row.is-overflowing {
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
html:not(.js) .chips-label { display: none; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-row[hidden] { display: none; }
.chips-offline { padding-left: 0; font: 400 var(--fs-label)/1.3 var(--font-mono); color: var(--text-3); }
.chip {
  flex: none;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #ffffff08;
  color: var(--text-2);
  font: 400 var(--fs-mono)/1 var(--font-mono);
  scroll-snap-align: start;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--dur-fast), color var(--dur-fast), background-color var(--dur-fast), transform var(--dur-fast);
}
.chip::before { content: "$ "; color: var(--text-3); }
@media (pointer: coarse) { .chip { height: 44px; padding: 0 14px; } }
.chip:hover { border-color: var(--line-accent); color: var(--accent); }
.chip:active { background: var(--accent-soft); transform: scale(.97); }
.chip.ran { border-color: var(--accent); }
.chip:focus-visible { outline-offset: 1px; border-radius: var(--r-sm); }

.term-caption {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-3);
}
.term-keys { display: none; }
.term-keys kbd { margin-right: 2px; }
@media (min-width: 768px) and (hover: hover) { .term-keys { display: block; } }
@media (max-width: 767px) { .term-caption { justify-content: center; } }

/* 8. Trophy case =========================================================== */
.bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.bento > * { min-width: 0; }
.tile {
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #ffffff06, #ffffff02), var(--bg-1);
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur-fast);
}
.tile::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), #36f67a14, transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
@media (hover: hover) and (pointer: fine) {
  .tile:hover { border-color: var(--line-2); }
  .tile:hover::before { opacity: 1; }
}
.tile-label {
  font: 500 var(--fs-label)/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.stat {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  font-variant-numeric: tabular-nums;
}
.stat-num {
  font-size: var(--fs-stat);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text-1);
  white-space: nowrap;
}
.stat-xl .stat-num { font-size: var(--fs-stat-xl); letter-spacing: -0.04em; }
.stat-arrow { color: var(--text-3); font-weight: 400; }
.gold-num { color: var(--gold); }
.stat-suffix { font-size: 18px; font-weight: 500; color: var(--text-2); }
.stat-xl .stat-suffix { font-size: 20px; color: var(--text-1); }
.tile-caption { margin-top: auto; font-size: var(--fs-sm); line-height: 1.55; color: var(--text-2); }
.tile-a, .tile-b, .tile-c, .tile-e, .tile-d { grid-column: span 2; }
.tile-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tile-count { font: 600 var(--fs-sm)/1 var(--font-mono); letter-spacing: 0; color: var(--gold); }

/* First places: which events were won */
.firsts { display: grid; }
.firsts li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.firsts li:first-child { border-top: 0; padding-top: 2px; }
.firsts-event { min-width: 0; font-size: 15px; font-weight: 500; color: var(--text-1); }
.firsts-year { font: 400 var(--fs-mono)/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-2); }

/* Pips: the signature podium bar */
.tile-a-side { display: flex; flex-direction: column; gap: 14px; margin-top: auto; }
.pips { position: relative; display: flex; gap: 6px; height: 10px; overflow: hidden; border-radius: 3px; }
.pip { flex: 1; border-radius: 3px; box-shadow: inset 0 1px 0 #ffffff40; background: var(--gold); }
.pip.silver { background: var(--silver); }
.pip.bronze { background: var(--bronze); }
.pips::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, #ffffffa6 50%, transparent 70%);
  transform: translateX(-100%);
}
@media (hover: hover) and (pointer: fine) {
  .tile-a:hover .pips::after { transform: translateX(100%); transition: transform 700ms var(--ease); }
}
.pips-legend {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px;
  font: 400 var(--fs-mono)/1.4 var(--font-mono);
  color: var(--text-2);
}
.legend-items { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend-items > span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 2px; background: var(--gold); }
.dot.silver { background: var(--silver); }
.dot.bronze { background: var(--bronze); }
.legend-since { color: var(--text-3); }

/* Podium graphic (desktop tile A only; decorative, counts synced) */
.podium { display: none; }
@media (min-width: 1200px) {
  .podium {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
    flex: 1;
    min-height: 150px;
    max-height: 220px;
    margin: 20px 0 8px;
  }
  .step { display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; justify-content: flex-end; }
  .step-count { font: 500 var(--fs-mono)/1 var(--font-mono); color: var(--text-2); font-variant-numeric: tabular-nums; }
  .step-block {
    display: flex; justify-content: center;
    width: 100%;
    padding-top: 12px;
    border: 1px solid var(--m-line);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    background: linear-gradient(180deg, var(--m-soft), transparent 90%);
  }
  .step-1 { --m-line: var(--gold-line); --m-soft: #f5c45126; }
  .step-2 { --m-line: var(--silver-line); --m-soft: #c9d3dd1f; }
  .step-3 { --m-line: var(--bronze-line); --m-soft: #e3a17326; }
  .step-1 .step-block { height: 78%; }
  .step-2 .step-block { height: 54%; }
  .step-3 .step-block { height: 36%; }
  .tile-a .tile-a-main { margin-top: 0; border-top: 1px solid var(--line); padding-top: 20px; }
}
.progress { height: 6px; margin-bottom: 12px; border-radius: 3px; background: #ffffff0f; overflow: hidden; }
.progress-fill { display: block; width: 90.68%; height: 100%; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px #36f67a66; }

@media (min-width: 640px) {
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
  .tile { padding: 24px; min-height: 180px; }
  .tile-a {
    grid-column: span 6;
    min-height: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 48px;
    row-gap: 20px;
  }
  .tile-a .tile-label { grid-column: 1 / -1; }
  .tile-a-main { align-self: end; }
  .tile-a-side { align-self: end; margin-top: 0; padding-bottom: 6px; }
  .tile-b, .tile-c, .tile-e, .tile-d { grid-column: span 3; }
}
@media (min-width: 1200px) {
  .bento { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; grid-auto-rows: minmax(200px, auto); }
  .tile-a { grid-column: 1 / 6; grid-row: 1 / 3; display: flex; flex-direction: column; }
  .tile-a-main { align-self: stretch; margin-top: auto; padding-bottom: 8px; }
  .tile-a-side { align-self: stretch; margin-top: 24px; padding-bottom: 0; }
  .tile-b { grid-column: 6 / 10; grid-row: 1; }
  .tile-c { grid-column: 10 / 13; grid-row: 1; }
  .tile-e { grid-column: 6 / 10; grid-row: 2; }
  .tile-d { grid-column: 10 / 13; grid-row: 2; }
  .tile-c .stat { flex-direction: column; gap: 6px; }
  /* The podium already shows the 4/2/1 split here; keep the legend, drop the bar. */
  .tile-a .pips { display: none; }
}

/* Results */
.results-wrap { display: grid; gap: 24px; margin-top: clamp(56px, 8vw, 96px); }
.results-wrap > * { min-width: 0; }
.results-aside h3 { font-size: var(--fs-h3); }
.results-intro { margin-top: 10px; font-size: 15px; color: var(--text-2); max-width: 46ch; }
.medal-legend { display: flex; gap: 18px; margin-top: 18px; font-size: var(--fs-sm); color: var(--text-2); }
.medal-legend li { display: inline-flex; align-items: center; gap: 8px; }
.results-note { margin-top: 18px; font-size: var(--fs-sm); color: var(--text-3); max-width: 44ch; }
.results-foot { margin-top: 10px; font: 400 var(--fs-mono)/1.5 var(--font-mono); color: var(--text-3); }
.results-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
}
.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "year place" "event event" "meta meta";
  align-items: center;
  column-gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  transition: background-color var(--dur-fast);
}
.result:first-child { border-top: 0; }
@media (hover: hover) { .result:hover { background: #ffffff05; } }
.result-year {
  grid-area: year;
  font: 400 var(--fs-mono)/1.4 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  white-space: nowrap;
}
.result-event { grid-area: event; min-width: 0; margin-top: 6px; }
.result-name { font-weight: 500; color: var(--text-1); }
.result-sub {
  display: block;
  margin-top: 2px;
  font: 400 var(--fs-sm)/1.5 var(--font-mono);
  color: var(--text-2);
}
.result-meta {
  grid-area: meta;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px;
  margin-top: 6px;
}
.result-points {
  font: 400 var(--fs-sm)/1.4 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.result-place { grid-area: place; justify-self: end; }
@media (max-width: 639px) {
  .result-meta { min-height: 22px; }
  .result-points + .result-link-cell::before { content: "·"; margin-right: 10px; color: var(--text-3); }
}
/* Where a two-part note cannot fit on one line, stack the parts instead of wrapping on the '·'. */
@media (max-width: 959px), (min-width: 1200px) and (max-width: 1279px) {
  .result-sub .nowrap { display: block; }
  .result-sub .sub-sep { display: none; }
}
.result-link {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--accent);
}
.result-link [aria-hidden="true"] { transition: transform var(--dur) var(--ease); }
.result-link:hover [aria-hidden="true"] { transform: translate(2px, -2px); }
.result-link:hover { color: var(--accent-hover); }
.is-unplaced .result-name { color: var(--text-2); }
.place-note { font-size: var(--fs-sm); color: var(--text-3); }
.result-gap {
  display: flex; gap: 14px; align-items: baseline;
  min-height: 48px;
  padding-block: 12px;
  background: repeating-linear-gradient(135deg, #ffffff05 0 6px, transparent 6px 12px);
}
.gap-note { font: 400 var(--fs-sm)/1.5 var(--font-mono); color: var(--text-3); }

@media (min-width: 640px) {
  .results-panel { border-radius: var(--r-lg); }
  .result, .is-unplaced {
    grid-template-columns: 48px minmax(0, 1fr) 88px 132px 92px;
    grid-template-areas: none;
    column-gap: 16px;
    min-height: 64px;
    padding: 14px 20px;
  }
  .result-meta { display: contents; }
  .result > *, .result-meta > * { grid-row: 1; margin-top: 0; }
  .result-year { grid-column: 1; font-size: var(--fs-mono); }
  .result-event { grid-column: 2; }
  .result-points { grid-column: 3; justify-self: end; font-size: var(--fs-mono); }
  .result-place { grid-column: 4; justify-self: start; }
  .result-link-cell { grid-column: 5; margin-top: 0; }
  .result-sub { font-size: var(--fs-mono); }
  .is-unplaced .result-place { grid-column: 4 / -1; margin-top: 0; }
  .result-gap { display: grid; min-height: 48px; padding-block: 12px; }
  .result-gap .gap-note { grid-column: 2 / -1; font-size: var(--fs-mono); }
}

/* Phones: keep the trophy case short. Year | event | medal on one row, points/link tucked under the event. */
@media (max-width: 639px) {
  .result {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: "year event place" ". meta meta";
    align-items: start;
    column-gap: 10px;
    padding: 12px 14px;
  }
  .result-year { padding-top: 3px; }
  .result-event { margin-top: 0; padding-top: 1px; }
  .result-meta { margin-top: 0; min-height: 0; }
  /* Keep a 44px tap target for the write-up link without adding 44px of row height. */
  .result-link { margin-block: -10px -12px; }
  /* CTF is the default; only the Treasure Hunt tag earns a line on a phone. */
  .result-event .tag:not(.tag-hunt) { display: none; }
  .is-unplaced { grid-template-areas: "year event event" ". place place" ". meta meta"; }
  .is-unplaced .result-place { justify-self: start; margin-top: 2px; }
  .result-gap { padding-inline: 14px; }

  /* The first-places list repeats four rows of the results table; drop it on phones. */
  .tile-b { display: none; }
  .tile { padding: 16px; gap: 8px; }
  .tile-c, .tile-d { grid-column: span 1; }
  .tile-e { order: 1; }
  .tile-d .stat-suffix { font-size: 15px; }
  .tile-a .stat-xl .stat-num { font-size: clamp(3.25rem, 2rem + 6vw, 4rem); }
}
@media (min-width: 1200px) {
  .results-wrap { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; align-items: start; }
  .results-aside { grid-column: 1 / 5; position: sticky; top: calc(var(--header-h) + 32px); padding-right: 16px; }
  .results-panel { grid-column: 5 / 13; }
  .result, .is-unplaced { grid-template-columns: 52px minmax(0, 1fr) 96px 132px 88px; column-gap: 14px; padding: 14px 24px; }
}

/* 9. Writeups ============================================================== */
.cards { display: grid; gap: 16px; }
.cards > * { min-width: 0; }
.card {
  position: relative;
  display: flex; flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-1);
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover, .card:focus-within { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.card-cover {
  position: relative;
  height: 168px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--term-bg);
}
.card-body { display: flex; flex-direction: column; flex: 1; padding: 20px; }
.card-eyebrow { font: 400 var(--fs-label)/1.4 var(--font-mono); color: var(--text-3); }
.card-year { color: var(--accent); }
.card h3 { margin-top: 12px; }
.card h3 a { color: var(--text-1); }
.card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--r-lg); }
.card h3 a:focus-visible { outline: none; }
.card h3 a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.card-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
.card-sub { display: block; margin-top: 2px; font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--text-2); }
.card-meta { margin-top: 10px; font: 400 var(--fs-mono)/1.5 var(--font-mono); color: var(--text-3); }
@media (max-width: 479px) {
  .card-meta > span { display: block; }
  .card-meta > .meta-sep { display: none; }
}
.card-text { margin-top: 14px; color: var(--text-2); max-width: 62ch; }
.card-stats {
  display: grid;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}
.card-stats > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.card-stats dt { font: 500 var(--fs-label)/1.4 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.card-stats dd { font-size: 16px; font-weight: 600; color: var(--text-1); text-align: right; font-variant-numeric: tabular-nums; }
.card-note { margin-top: 16px; font: 400 var(--fs-mono)/1.55 var(--font-mono); color: var(--text-2); }
.redacted { display: inline-block; width: 80px; height: 10px; margin-left: 4px; border-radius: 2px; background: var(--line-2); vertical-align: middle; }
.card-cta { margin-top: auto; padding-top: 24px; font-size: 15px; font-weight: 500; color: var(--accent); }
.card-cta .arrow-ne { display: inline-block; transition: transform var(--dur) var(--ease); }
.card:hover .card-cta .arrow-ne, .card:focus-within .card-cta .arrow-ne { transform: translate(2px, -2px); }
/* The query container is a plain wrapper: container-type on .card-body would cancel its subgrid. */
.card-stats-wrap { container-type: inline-size; min-width: 0; }
@container (min-width: 500px) {
  .card-stats { grid-template-columns: repeat(3, auto); justify-content: start; border-bottom: 1px solid var(--line); }
  .card-stats > div { flex-direction: column; justify-content: flex-start; gap: 6px; padding: 14px 24px 14px 20px; border-bottom: 0; border-left: 1px solid var(--line); }
  .card-stats > div:first-child { border-left: 0; padding-left: 0; }
  .card-stats dd { font-size: 18px; text-align: left; white-space: nowrap; }
}

/* PHREAKMYST cover: four timeline plates */
.cover-myst {
  background:
    linear-gradient(#ffffff06 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, #ffffff06 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(60% 80% at 70% 100%, #36f67a12, transparent 70%),
    var(--term-bg);
}
.plate-stack {
  position: absolute; left: 50%; top: 50%;
  width: min(80cqw, 380px, calc((100cqh - 28px) * 1.5));
  aspect-ratio: 3 / 2;
  transform: translate(-50%, -50%);
}
.cover-myst { container-type: size; }
.plate {
  --i: 0;
  position: absolute;
  left: calc(var(--i) * 9%);
  top: calc(var(--i) * 11%);
  width: 73%; height: 67%;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #0c1112;
  box-shadow: 0 12px 30px -12px #000000cc;
  transition: transform 400ms var(--ease);
}
.plate::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #ffffff05; }
.p1 { --i: 0; background: #0b0f10; }
.p2 { --i: 1; background: #0d1213; }
.p2::before { background: #ffffff08; }
.p3 { --i: 2; background: #0e1415; }
.p3::before { background: #ffffff0a; }
.p4 { --i: 3; background: #101718; border-color: #ffffff30; }
.p4::before { background: linear-gradient(180deg, #ffffff0d, #36f67a0a); }
.plate-label {
  position: absolute; top: 5px; left: 10px;
  white-space: nowrap;
  font: 400 var(--fs-label)/1 var(--font-mono);
  color: var(--text-3);
}
.vf {
  position: absolute; inset: 26px 12px 12px;
  --c: var(--accent);
  background:
    linear-gradient(var(--c), var(--c)) top left / 14px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 2px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 14px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 2px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 14px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 2px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 14px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 2px 14px no-repeat;
}
.plate-center {
  position: absolute; left: 0; right: 0; top: 50%;
  margin-top: 4px;
  text-align: center;
  font: 500 var(--fs-label)/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.card:hover .plate, .card:focus-within .plate { transform: translate(calc((var(--i) - 1.5) * 5px), calc((var(--i) - 1.5) * 5px)); }
.card:hover .p4, .card:focus-within .p4 { transform: translate(8px, 8px) rotate(-1deg); }

/* Treasure Hunt cover: decorative grid, four survivors */
.hunt-grid {
  position: absolute; left: 11%; right: 11%; top: 18px; bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, #ffffff0f 0 1px, transparent 1px 12px),
    repeating-linear-gradient(90deg, #ffffff0f 0 1px, transparent 1px 12px),
    var(--term-bg);
}
.hunt-hatch {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(45deg, #ffffff04 0 3px, transparent 3px 9px);
  -webkit-mask-image: radial-gradient(circle at 74% 62%, transparent 0 34px, #000 60px);
  mask-image: radial-gradient(circle at 74% 62%, transparent 0 34px, #000 60px);
}
.cell {
  position: absolute;
  width: 12px; height: 12px;
  outline: 1px solid var(--line-accent);
  outline-offset: -1px;
}
.c1 { left: calc(12px * 5); top: calc(12px * 3); }
.c2 { left: calc(12px * 14); top: calc(12px * 7); }
.c3 { left: calc(12px * 9); top: calc(12px * 6); }
.c4 { left: 72%; top: 58%; background: var(--accent); box-shadow: 0 0 18px 2px #36f67a73; outline: 0; }
.scan {
  position: absolute; left: 0; right: 0; top: -40px;
  height: 40px;
  background: linear-gradient(180deg, transparent, #36f67a14 60%, #36f67a29 100%);
  opacity: 0;
}
.cover-hunt.is-live .scan { animation: scan 1.2s var(--ease) 1 both; }
.cover-hunt.is-live .c4 { animation: pulse 700ms ease-in-out 1.2s 2; }
@keyframes scan { from { top: -40px; opacity: 1; } to { top: 100%; opacity: 1; } }
@keyframes pulse { 50% { box-shadow: 0 0 30px 8px #36f67a99; } }

@media (min-width: 640px) {
  .card-body { padding: 28px; }
  .card-cover { height: 208px; }
}
@media (min-width: 960px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .card-cover { height: 220px; }
  /* Smaller stack on the side-by-side cards, so the hover fan-out keeps 20px+ clear. */
  .plate-stack { width: min(72cqw, 340px, calc((100cqh - 60px) * 1.5)); }
  /* Line the two cards up row by row: cover, eyebrow, title, meta, text, stats, note, CTA. */
  @supports (grid-template-rows: subgrid) {
    .card { display: grid; grid-row: span 8; grid-template-rows: subgrid; row-gap: 0; }
    .card-body { display: grid; grid-row: 2 / span 7; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
    .card-body > .card-cta { grid-row: 7; align-self: end; }
  }
}

/* 10. Team ================================================================= */
.team-layout > * { min-width: 0; }
.roster-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-1); box-shadow: var(--shadow-1); }
.roster-bar {
  display: flex; justify-content: space-between; align-items: center;
  height: 44px; padding: 0 16px;
  border-bottom: 1px solid var(--line);
  font: 400 var(--fs-label)/1 var(--font-mono);
  color: var(--text-3);
}
.roster-heads { display: none; }
.member {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-areas: "mono handle badge" "mono meta meta";
  align-items: center;
  gap: 2px 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.member:first-child { border-top: 0; }
.monogram {
  grid-area: mono;
  align-self: start;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  margin-top: 2px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  font: 700 14px/1 var(--font-mono);
  color: var(--text-1);
}
.member-handle { grid-area: handle; min-width: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-1); }
.member-meta { grid-area: meta; font-size: var(--fs-sm); color: var(--text-2); }
.pill-sm {
  grid-area: badge;
  justify-self: end;
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  font: 400 var(--fs-label)/1 var(--font-mono);
  color: var(--text-2);
  white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); color: var(--accent); border-color: var(--line-accent); }
.pill-memoriam { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); }
.member-honorary .monogram { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.roster-hint { margin-top: 16px; font: 400 var(--fs-mono)/1.5 var(--font-mono); color: var(--text-3); }
.roster-hint code { color: var(--text-2); }
@media (min-width: 640px) {
  .roster-panel { border-radius: var(--r-lg); }
  .roster-bar { padding: 0 24px; }
  .roster-heads, .member {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1.5fr) 128px;
    grid-template-areas: none;
    align-items: center;
    column-gap: 16px;
    padding: 0 24px;
  }
  .roster-heads {
    height: 40px;
    border-bottom: 1px solid var(--line);
    font: 500 var(--fs-label)/1 var(--font-mono);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-3);
  }
  .member { min-height: 76px; }
  .member > *, .member-meta > * { grid-row: 1; }
  .monogram { grid-column: 1; align-self: center; margin-top: 0; }
  .member-handle { grid-column: 1; padding-left: 44px; font-size: 20px; }
  .member-meta { display: contents; }
  .member-joined { grid-column: 2; font: 400 var(--fs-sm)/1 var(--font-mono); color: var(--text-2); }
  .joined-label, .member-sep { display: none; }
  .member-note { grid-column: 3; font-size: 15px; color: var(--text-2); }
  .pill-sm { grid-column: 4; justify-self: end; }
}
@media (min-width: 960px) {
  .team-layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 24px; align-items: start; }
  .team-rule { grid-column: 1 / -1; }
  .team-head { grid-column: 1 / 5; margin-bottom: 0; }
  .team-head h2 { margin-top: 0; }
  .team-main { grid-column: 6 / 13; }
}

/* 11. CTA band ============================================================= */
.cta { padding-block: 0 var(--section-y); }
.cta-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(40px, 7vw, 88px) clamp(20px, 5vw, 64px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: radial-gradient(60% 80% at 50% 0%, #36f67a1f, transparent 70%), var(--bg-1);
  text-align: center;
}
.cta-panel::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background: var(--grid-lines);
  -webkit-mask-image: var(--grid-mask);
  mask-image: var(--grid-mask);
  pointer-events: none;
}
.cta-panel > * { max-width: 640px; margin-inline: auto; }
.cta-panel h2 { margin-top: 16px; }
.cta-panel .lead { margin-top: 16px; }
.cta-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.cta-buttons .btn { width: 100%; }
.cta-hint { margin-top: 24px; font: 400 var(--fs-mono)/1.5 var(--font-mono); color: var(--text-3); }
@media (min-width: 480px) {
  .cta-buttons { flex-direction: row; justify-content: center; }
  .cta-buttons .btn { width: auto; }
}
@media (min-width: 640px) { .cta-panel { border-radius: var(--r-xl); } }

/* 12. Footer =============================================================== */
.site-footer { padding: 48px 0 32px; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px; }
.footer-grid > * { min-width: 0; }
.footer-brand { grid-column: 1 / -1; }
.footer-brand p { margin-top: 14px; max-width: 40ch; font-size: var(--fs-sm); color: var(--text-2); }
.footer-label {
  margin-bottom: 8px;
  font: 500 var(--fs-label)/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.footer-col a {
  display: block;
  padding-block: 11px;
  line-height: 22px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  transition: color var(--dur-fast);
}
.footer-col a:hover { color: var(--text-1); }
.footer-bottom {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  margin-top: 40px; padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-3);
}
.domain { overflow-wrap: anywhere; }
.footer-quip { font-family: var(--font-mono); font-size: 12px; }
.to-top { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--text-2); }
.to-top:hover { color: var(--text-1); }
@media (min-width: 640px) and (pointer: fine) {
  .footer-col a { padding-block: 5px; }
}
@media (min-width: 960px) {
  .footer-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
  .footer-brand { grid-column: 1 / 7; }
  .footer-grid .footer-col:nth-child(2) { grid-column: 7 / 10; }
  .footer-grid .footer-col:nth-child(3) { grid-column: 10 / 13; }
  .footer-bottom { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; align-items: center; }
  .footer-bottom > :nth-child(1) { grid-column: 1 / 7; }
  .footer-bottom > :nth-child(2) { grid-column: 7 / 11; }
  .footer-bottom > :nth-child(3) { grid-column: 11 / 13; justify-self: end; }
}
@media (min-width: 960px) and (pointer: fine) { .to-top { min-height: 32px; } }

@media (max-width: 479px) {
  .card-note, .card-meta, .roster-hint, .results-foot, .cta-hint, .footer-bottom, .footer-quip, .to-top { font-size: var(--fs-sm); }
  .footer-copy .domain { display: block; }
  .footer-copy .sub-sep { display: none; }
}

/* 13. 404 ================================================================== */
.error-page {
  position: relative;
  isolation: isolate;
  overflow: clip;
  display: grid; place-items: center;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  padding-block: 48px;
  text-align: center;
}
.error-page::before, .error-page::after {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  pointer-events: none;
}
.error-page::before { background: var(--aurora); }
.error-page::after { background: var(--grid-lines); -webkit-mask-image: var(--grid-mask); mask-image: var(--grid-mask); }
.error-page .wrap { max-width: 760px; }
.err-code {
  font-size: clamp(6rem, 22vw, 12rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: .9;
  color: var(--text-1);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .err-code {
    background: linear-gradient(180deg, #ecf2ee, #ecf2ee33);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
.error-page h1 {
  margin-top: 24px;
  font: 500 clamp(15px, 2.4vw, 20px)/1.5 var(--font-mono);
  color: var(--text-1);
  overflow-wrap: anywhere;
}
.error-page h1 .err-prompt { color: var(--accent); }
.error-page p:not(.err-code) { margin-top: 12px; color: var(--text-2); }
.err-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.err-buttons .btn { width: 100%; }
@media (min-width: 480px) {
  .err-buttons { flex-direction: row; justify-content: center; }
  .err-buttons .btn { width: auto; }
}
.header-solo .header-inner { grid-template-columns: auto 1fr; }

/* 14. Motion, 8-bit mode, a11y media ======================================= */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes rise-scale { from { opacity: 0; transform: translateY(16px) scale(.985); } }
.hero .pill, .tagline, .hero-lead, .hero-ctas, .term-caption { animation: rise 600ms var(--ease) both; }
.tagline { animation-delay: 60ms; }
.hero-lead { animation-delay: 120ms; }
.hero-ctas { animation-delay: 180ms; }
.term-caption { animation-delay: 300ms; }
.term-window { animation: rise-scale 800ms var(--ease) 240ms both; }
.term-window.glitch { animation: glitch .12s steps(2) 4; }

/* Konami: Super Prompt Bros mode */
body.eight-bit {
  --bg: #090c24; --bg-1: #111a3d; --bg-2: #18234d; --bg-3: #1e2a5a; --term-bg: #0b1030;
  --line: #4a5f9440; --line-2: #4a5f9480; --accent: #65fc98;
  --text-1: #f0f4ff; --text-2: #c3cdea; --text-3: #8f9cc4; --term-fg: #dce6ff;
}
body.eight-bit .site-header { background: #090c24e6; }
body.eight-bit h1, body.eight-bit h2, body.eight-bit .stat-num {
  font-family: var(--font-pixel);
  font-weight: 400;
  letter-spacing: 0;
}
body.eight-bit .hero-title { background: none; -webkit-text-fill-color: currentColor; color: var(--accent); }
body.eight-bit .sr-only { font-family: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
  .card:hover, .card:focus-within { transform: none; box-shadow: var(--shadow-1); }
  .card:hover .plate, .card:focus-within .plate { transform: none; }
  .tile-a:hover .pips::after { transform: translateX(-100%); }
  .cover-hunt.is-live .scan { animation: none; }
}

@media (forced-colors: active) {
  .medal, .pip, .dot { border: 1px solid CanvasText; forced-color-adjust: none; }
  .btn, .chip, .tile, .card, .results-panel, .roster-panel { border: 1px solid CanvasText; }
  :focus-visible { outline: 2px solid Highlight; }
  .hero-title, .err-code { -webkit-text-fill-color: CanvasText; background: none; }
}

/* Mini CTF navigation indicator */
.nav-new { display: inline-block; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%; background: var(--accent); vertical-align: middle; }

.nav-desktop a[aria-current="page"] { color: var(--accent); }
