@font-face {
  font-family: 'Press Start 2P';
  src: url('/assets/game/fonts/PressStart2P-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #070b0e;
  --surface: #0b1014;
  --surface-raised: #10161b;
  --line: #333b40;
  --line-soft: #20282d;
  --text: #f4f2eb;
  --muted: #a4a6a7;
  --acid: #e8ff61;
  --orange: #ff7a19;
  --danger: #ff837a;
  --content: 1160px;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; background: var(--background); color: var(--text); font: 15px/1.65 var(--sans); }
body::before { content: ''; position: fixed; z-index: 20; inset: 0; opacity: .035; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); }
img, svg { display: block; }
a, button, input, summary { -webkit-tap-highlight-color: transparent; }
a, button, summary { transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease, opacity .2s ease; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--acid); outline-offset: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.lower-page { position: relative; width: min(var(--content), calc(100% - 72px)); margin: 0 auto; padding: clamp(80px, 9vw, 132px) 0 0; }
.pixel-kicker { margin: 0; color: var(--acid); font: 400 11px/1.4 var(--pixel); letter-spacing: -.04em; text-transform: uppercase; }
.about-section { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(330px, .9fr); gap: clamp(70px, 10vw, 150px); align-items: start; }
.about-copy h2 { margin: 28px 0 26px; max-width: 680px; font-size: clamp(45px, 5.3vw, 70px); font-weight: 800; line-height: .98; letter-spacing: -.055em; text-wrap: balance; }
.about-intro { max-width: 600px; margin: 0; color: #c3c4c4; font-size: 19px; }
.about-details { padding-top: 31px; }
.feature-row { display: grid; grid-template-columns: 58px 1fr; gap: 18px; margin-bottom: 33px; }
.feature-row h3 { margin: 0 0 5px; font-size: 15px; line-height: 1.45; letter-spacing: -.02em; }
.feature-row p { max-width: 390px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.feature-icon { display: grid; width: 58px; height: 58px; place-items: center; }
.feature-icon img { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; }
.github-cta { display: grid; min-height: 72px; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; padding: 0 28px; border: 1px solid var(--acid); border-radius: 4px; color: var(--text); text-decoration: none; font-size: 16px; font-weight: 750; }
.github-cta svg { width: 29px; height: 29px; fill: currentColor; }
.github-cta span { color: var(--acid); }
.github-cta b { color: var(--acid); font-size: 24px; font-weight: 500; }
.github-cta:hover { background: rgba(232,255,97,.08); transform: translateY(-2px); }
.github-cta:active { transform: translateY(1px); }

.trail-divider { position: relative; height: 86px; margin: 22px -20px 2px; overflow: hidden; }
.trail-divider::before { content: ''; position: absolute; inset: 0; background: url('/assets/ui/train-divider-minimal.webp') center / cover no-repeat; filter: brightness(1.2) saturate(1.08); image-rendering: pixelated; }
.trail-divider::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, var(--background), transparent 12%, transparent 88%, var(--background)), linear-gradient(180deg, var(--background), transparent 24%, transparent 76%, var(--background)); }

.try-section { padding: 33px 0 12px; }
#extract-form { margin: 20px 0 0; }
.input-row { display: grid; min-height: 74px; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 4px; border: 1px solid #5a6064; border-radius: 4px; background: rgba(7,11,14,.58); transition: border-color .2s ease, box-shadow .2s ease; }
.input-row:focus-within { border-color: var(--acid); box-shadow: none; }
.input-link-icon { color: #adb1b4; font-size: 27px; transform: rotate(-45deg); }
input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 17px/1.3 var(--mono); }
input::placeholder { color: #74797e; }
#extract-form button { display: inline-flex; min-width: 184px; min-height: 60px; align-items: center; justify-content: center; gap: 17px; border: 2px solid #f4ff9d; border-radius: 3px; background: linear-gradient(180deg, #efff7d 0%, #d9f64f 100%); color: #10140a; cursor: pointer; font: 800 17px/1 var(--sans); box-shadow: 0 3px 0 #798b24, inset 0 2px 0 rgba(255,255,255,.48); text-shadow: 0 1px rgba(255,255,255,.35); }
#extract-form button:hover:not(:disabled) { background: linear-gradient(180deg, #f7ffa8 0%, #e5ff62 100%); transform: translateY(-2px); box-shadow: 0 5px 0 #798b24, inset 0 2px 0 rgba(255,255,255,.58); }
#extract-form button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #798b24, inset 0 2px 0 rgba(121,139,36,.16); }
#extract-form button:disabled { cursor: wait; opacity: .62; }
.button-mark { width: 31px; height: 31px; object-fit: contain; image-rendering: pixelated; }
.form-hint { margin: 13px 0 0; color: var(--muted); font-size: 13px; }
.status { min-height: 30px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.status:empty { min-height: 0; margin-top: 0; }
.status[data-state='loading'] { display: flex; align-items: center; gap: 12px; color: #d1d2cf; }
.status[data-state='loading']::before { content: ''; width: 92px; height: 5px; background: repeating-linear-gradient(90deg, var(--acid) 0 8px, transparent 8px 13px); animation: search-track .75s steps(5,end) infinite; }
.status[data-state='error'] { color: var(--danger); }
.status[data-state='success'] { color: var(--acid); }
@keyframes search-track { to { background-position: 26px 0; } }

.results { padding: 65px 0 0; }
.results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.result-domain { margin: 0; color: var(--muted); font: 12px/1.4 var(--mono); }
.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.role-card { position: relative; min-width: 0; padding: 0 24px 0 0; }
.role-card + .role-card { padding-left: 28px; border-left: 1px solid var(--line); }
.role-card:last-child { padding-right: 0; }
.role-heading { display: flex; align-items: center; gap: 13px; min-height: 48px; }
.role-number { display: grid; width: 38px; height: 38px; place-items: center; background: var(--acid); color: #0b1007; font: 400 11px/1 var(--pixel); }
.role-heading h3 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.preview { position: relative; display: grid; aspect-ratio: 1.38; place-items: center; overflow: hidden; padding: 28px; background: repeating-conic-gradient(#e6e6e2 0 25%, #f7f7f4 0 50%) 50% / 22px 22px; }
.preview img { max-width: 84%; max-height: 82%; object-fit: contain; }
.download-overlay { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid rgba(7,11,14,.34); background: rgba(7,11,14,.82); color: white; font: 700 10px/1 var(--mono); text-decoration: none; opacity: 0; transform: translateY(4px); }
.preview:hover .download-overlay, .download-overlay:focus-visible { opacity: 1; transform: translateY(0); }
.candidate-body { padding-top: 15px; }
.candidate-body > p { min-height: 49px; margin: 0; color: #b4b6b6; font-size: 13px; line-height: 1.65; }
.candidate-meta { display: flex; flex-wrap: wrap; margin-top: 11px; }
.candidate-meta span { padding: 4px 9px; border: 1px solid #454c50; color: #bdc0c1; font: 11px/1.2 var(--mono); }
.candidate-meta span + span { border-left: 0; }
.role-card.empty .preview { background: #0b1014; border: 1px dashed #333d42; }
.empty-mark { color: #626a6e; font: 400 20px/1 var(--pixel); }

.complete-results { margin-top: 42px; border: 1px solid var(--acid); border-radius: 4px; }
.complete-results summary { display: grid; min-height: 74px; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; padding: 0 30px; cursor: pointer; list-style: none; font-size: 17px; font-weight: 750; }
.complete-results summary::-webkit-details-marker { display: none; }
.summary-icon { color: var(--orange); font-size: 26px; }
.summary-chevron { width: 14px; height: 14px; border-right: 2px solid var(--acid); border-bottom: 2px solid var(--acid); transform: rotate(45deg) translate(-2px, 2px); }
.complete-results[open] .summary-chevron { transform: rotate(225deg) translate(-2px, 2px); }
.complete-results[open] summary { border-bottom: 1px solid var(--line); }
.complete-results-body { padding: 24px; }
.diagnostics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.diagnostics span { padding: 5px 9px; border: 1px solid var(--line); color: var(--muted); font: 10px/1.2 var(--mono); text-transform: uppercase; }
.family-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.family-card { display: grid; min-width: 0; grid-template-columns: minmax(130px, .85fr) 1fr; background: var(--surface); }
.family-card .preview { aspect-ratio: auto; min-height: 210px; }
.family-card .candidate-body { display: flex; min-width: 0; flex-direction: column; padding: 18px; }
.family-card h3 { margin: 7px 0 4px; font-size: 17px; }
.family-card p { min-height: 0; color: var(--muted); font-size: 11px; }
.rank { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; color: var(--acid); font: 9px/1.3 var(--mono); text-transform: uppercase; }
.variant-list { display: grid; gap: 1px; margin-top: 15px; background: var(--line); }
.variant-list a { display: grid; grid-template-columns: 42px 1fr auto; gap: 9px; padding: 8px 9px; background: var(--surface-raised); color: var(--text); text-decoration: none; font: 10px/1.2 var(--mono); }
.variant-list a span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.variant-list a span:last-child { color: var(--acid); }
.actions { margin-top: auto; padding-top: 12px; }
.actions a { color: var(--acid); font-size: 11px; text-decoration: none; }

.api-section { display: grid; grid-template-columns: 250px minmax(0, 1fr); column-gap: 64px; padding: clamp(100px, 12vw, 150px) 0 clamp(90px, 10vw, 140px); }
.api-copy .pixel-kicker { margin-bottom: 18px; }
.api-copy h2 { margin: 0 0 22px; font-size: 35px; line-height: 1.02; letter-spacing: -.045em; }
.api-copy > p:last-child { max-width: 220px; margin: 0; color: #b7b9b9; font-size: 14px; line-height: 1.7; text-wrap: pretty; }
.terminal { overflow: hidden; border: 1px solid #41494f; border-radius: 8px; background: radial-gradient(circle at 75% 0, rgba(232,255,97,.045), transparent 38%), rgba(8,12,15,.92); box-shadow: 0 18px 70px rgba(0,0,0,.22); }
.terminal-bar { display: grid; min-height: 57px; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 20px; border-bottom: 1px solid #333b40; color: #737a7f; font: 9px/1 var(--pixel); text-transform: uppercase; }
.terminal-dots { display: flex; gap: 8px; }
.terminal-dots i { width: 13px; height: 13px; border-radius: 50%; background: #ff4b4b; }
.terminal-dots i:nth-child(2) { background: #f7d94f; }
.terminal-dots i:nth-child(3) { background: #55c96a; }
.self-hosted-badge { display: inline-flex; justify-self: end; align-items: center; gap: 8px; color: var(--acid); font: 400 8px/1 var(--pixel); }
.self-hosted-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 0 3px rgba(232,255,97,.1); }
.terminal-content { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(230px, .95fr); min-height: 460px; }
.terminal-code { min-width: 0; border-right: 1px solid #30383d; }
.code-block-heading { display: flex; align-items: center; gap: 11px; padding: 23px 28px 0; color: #8c9397; font: 400 9px/1.4 var(--pixel); text-transform: uppercase; }
.code-block-heading span { color: var(--acid); }
.code-block-heading + pre { padding-top: 14px; }
.terminal-code pre + .code-block-heading { border-top: 1px solid #30383d; }
pre { margin: 0; overflow: auto; padding: 24px 28px; color: #ebeee8; font: 12px/1.75 var(--mono); white-space: pre; }
.code-accent, .code-key { color: var(--acid); }
.code-string { color: #d9f1b5; }
.code-success { color: #82d991; }
.api-steps { position: relative; display: grid; align-content: center; gap: 29px; margin: 0; padding: 28px 25px; list-style: none; }
.api-steps::before { content: ''; position: absolute; top: 72px; bottom: 72px; left: 45px; border-left: 1px dashed #3b454a; }
.api-steps li { position: relative; display: grid; grid-template-columns: 41px 1fr; gap: 14px; }
.api-steps li > span { display: grid; width: 41px; height: 41px; place-items: center; border: 2px solid var(--acid); border-radius: 50%; background: var(--background); color: var(--text); font: 400 11px/1 var(--pixel); }
.api-steps strong { color: var(--acid); font: 400 9px/1.5 var(--pixel); }
.api-steps p { margin: 7px 0 0; color: #aeb2b3; font-size: 12px; line-height: 1.65; }
.api-bottom { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 38px 0 0; }
.api-bottom > p { margin: 0; color: var(--muted); font-size: 12px; }
.github-cta--small { min-width: 302px; min-height: 64px; gap: 15px; padding: 0 20px; font: 400 8px/1.4 var(--pixel); }
.github-cta--small svg { width: 27px; height: 27px; }

.night-desert { position: relative; z-index: 0; width: 100%; height: clamp(300px, 36vw, 500px); margin-top: 0; background: url('/assets/game/desert-night-campfire.webp') center bottom / cover no-repeat; image-rendering: pixelated; }
.night-desert::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, var(--background) 0, transparent 30%); pointer-events: none; }
.site-footer { display: grid; min-height: 145px; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 40px; padding: 0 max(36px, calc((100vw - var(--content))/2)); border-top: 1px solid #171e23; background: #070b0e; }
.footer-brand { display: inline-flex; align-items: center; gap: 13px; color: var(--text); font-size: 18px; font-weight: 800; text-decoration: none; }
.footer-brand img { image-rendering: pixelated; }
.site-footer nav { display: flex; align-items: center; gap: clamp(26px, 4vw, 58px); }
.site-footer nav a, .site-footer > p { color: #b7b8b6; font: 13px/1.3 var(--mono); text-decoration: none; }
.site-footer nav a:hover, .site-footer > p a:hover { color: var(--acid); }
.site-footer > p { justify-self: end; margin: 0; }
.site-footer > p a { color: inherit; text-decoration: underline; text-decoration-color: #596168; text-underline-offset: 3px; }
.site-footer > p span { color: #ff5a37; font-size: 20px; }

@media (max-width: 900px) {
  .lower-page { width: min(var(--content), calc(100% - 40px)); }
  .about-section { grid-template-columns: 1fr; gap: 48px; }
  .about-copy h2 { font-size: clamp(44px, 8.5vw, 68px); }
  .about-details { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; padding-top: 0; }
  .about-details .github-cta { grid-column: 1 / -1; }
  .feature-row { margin-bottom: 0; }
  .api-section { grid-template-columns: 1fr; gap: 32px; }
  .api-copy { display: grid; grid-template-columns: auto auto 1fr; align-items: start; gap: 28px; }
  .api-copy .pixel-kicker { margin: 8px 0 0; }
  .api-copy h2 { margin: 0; }
  .api-copy > p:last-child { max-width: 340px; }
  .api-bottom { grid-column: 1; }
  .site-footer { grid-template-columns: 1fr auto; }
  .site-footer nav { order: 3; grid-column: 1 / -1; justify-content: center; padding-bottom: 25px; }
}

@media (max-width: 720px) {
  .lower-page { width: min(100% - 28px, var(--content)); padding-top: 68px; }
  .pixel-kicker { font-size: 9px; line-height: 1.6; }
  .about-copy h2 { margin-top: 20px; font-size: clamp(40px, 12.7vw, 60px); line-height: 1.02; }
  .about-copy h2 br { display: none; }
  .about-intro { font-size: 16px; }
  .about-details { grid-template-columns: 1fr; }
  .feature-row { grid-template-columns: 48px 1fr; gap: 14px; }
  .feature-icon { width: 48px; height: 48px; }
  .feature-icon img { width: 46px; height: 46px; }
  .feature-row p { font-size: 13px; }
  .github-cta { min-height: 64px; padding: 0 18px; font-size: 14px; }
  .trail-divider { height: 64px; margin: 18px -14px 0; }
  .trail-divider::before { background-position: 52% center; }
  .input-row { grid-template-columns: 28px minmax(0,1fr); padding: 9px; }
  .input-row button { grid-column: 1 / -1; width: 100%; min-height: 58px; }
  input { font-size: 15px; }
  .results { padding-top: 51px; }
  .results-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .role-grid { grid-template-columns: 1fr; gap: 37px; }
  .role-card, .role-card + .role-card, .role-card:last-child { padding: 0; border-left: 0; }
  .preview { aspect-ratio: 1.55; }
  .download-overlay { opacity: 1; transform: none; }
  .complete-results summary { min-height: 68px; gap: 12px; padding: 0 17px; font-size: 14px; }
  .complete-results-body { padding: 14px; }
  .family-grid { grid-template-columns: 1fr; }
  .family-card { grid-template-columns: 1fr; }
  .family-card .preview { min-height: 190px; }
  .api-section { padding-top: 88px; padding-bottom: 76px; }
  .api-copy { display: block; }
  .api-copy .pixel-kicker { margin: 0 0 16px; }
  .api-copy h2 { font-size: 34px; }
  .api-copy > p:last-child { max-width: 360px; }
  .terminal-bar { grid-template-columns: 1fr auto; }
  .terminal-bar > span:nth-child(2) { display: none; }
  .terminal-content { grid-template-columns: 1fr; }
  .terminal-code { border-right: 0; }
  pre { padding: 20px 18px; font-size: 10px; }
  .code-block-heading { padding: 20px 18px 0; }
  .api-steps { border-top: 1px solid #30383d; }
  .api-bottom { align-items: stretch; flex-direction: column; padding-top: 24px; }
  .github-cta--small { min-width: 0; }
  .night-desert { height: 320px; margin-top: 36px; background-position: center bottom; }
  .site-footer { min-height: 210px; grid-template-columns: 1fr; gap: 22px; padding: 30px 22px; }
  .site-footer nav { order: 0; grid-column: auto; flex-wrap: wrap; justify-content: flex-start; gap: 18px 27px; padding: 0; }
  .site-footer > p { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
