/* ==========================================================================
   Core8Bit portal design system
   --------------------------------------------------------------------------
   Plain CSS, no framework. Blade-friendly BEM-ish classes.
   1. Fonts         5. Components
   2. Tokens        6. Page modules
   3. Base          7. Utilities
   4. Layout
   Theme: dark by default. Light follows prefers-color-scheme unless the
   <html data-theme="dark|light"> override is set (site.js stores it).
   ========================================================================== */

/* 1. Fonts ---------------------------------------------------------------- */
@font-face {
  font-family: "Jersey 15";
  src: url("../fonts/jersey-15-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215;
}
@font-face {
  font-family: "Golos Text";
  src: url("../fonts/golos-text-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215;
}
@font-face {
  font-family: "Golos Text";
  src: url("../fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 400 900; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 400 700; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* 2. Tokens --------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Brand (from the BIOS logo) */
  --brand-chip: #31c2ff;      /* gear / chip blue */
  --brand-cart: #f2c700;      /* UI yellow (the logo itself uses #E6C200) */
  --brand-night: #101935;     /* midnight PCB */
  --page-bg: var(--c-bg);     /* resolved at :root, so .is-night blocks can still reach the page colour */

  /* Surfaces */
  --c-bg: #0e1631;
  --c-bg-band: #131d40;
  --c-surface: #182449;
  --c-surface-2: #213060;
  --c-surface-3: #2a3a70;
  --c-line: #33447c;
  --c-line-strong: #4a5d9c;

  /* Text */
  --c-ink: #edf2ff;
  --c-ink-2: #b4c0e2;
  --c-ink-3: #8c9ac6;

  /* Roles */
  --c-link: #5fd0ff;
  --c-accent: var(--brand-cart);
  --c-on-accent: #101935;
  --c-blue: var(--brand-chip);
  --c-on-blue: #06253a;
  --c-select: #1e4bb8;        /* launcher selection bar */
  --c-on-select: #ffffff;
  --c-success: #3ee0a1;
  --c-success-bg: rgba(62, 224, 161, .14);
  --c-warn: #ffc94a;
  --c-warn-bg: rgba(255, 201, 74, .14);
  --c-danger: #ff7a6b;
  --c-danger-bg: rgba(255, 122, 107, .14);
  --c-info-bg: rgba(49, 194, 255, .14);
  --c-ai: #c4a6ff;
  --c-ai-bg: rgba(196, 166, 255, .15);
  --c-focus: #ffffff;
  --c-focus-halo: #31c2ff;
  --c-code-bg: #0a1128;
  --c-shadow: #070c1e;
  --c-star-off: #3a4a80;

  /* Type */
  --ff-display: "Jersey 15", "Golos Text", system-ui, sans-serif; /* Cyrillic falls back to Golos */
  --ff-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: .8125rem;   /* 13 */
  --fs-sm: .875rem;    /* 14 */
  --fs-base: 1.0625rem;/* 17 */
  --fs-md: 1.3125rem;  /* 21 */
  --fs-lg: 1.5rem;     /* 24 */
  --fs-xl: 2.25rem;    /* 36 */
  --fs-2xl: clamp(2.5rem, 4vw + 1.25rem, 3.75rem);  /* display face runs small: 40 → 60 */
  --fs-3xl: clamp(3rem, 6vw + 1rem, 6rem);          /* 48 → 96 */
  --lh-body: 1.6;
  --lh-tight: 1;
  --fs-d-lg: 1.875rem;  /* display face equivalents of 24 / 21 */
  --fs-d-md: 1.5rem;

  /* Space (4px pixel grid) */
  --px: 4px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1240px;
  --maxw-text: 68ch;
  --header-h: 64px;

  /* Pixel-notched corner (2 steps of 4px), echoes the logo gear teeth */
  --notch: polygon(0 8px, 4px 8px, 4px 4px, 8px 4px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 4px, calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px), calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0 calc(100% - 8px));
  --notch-sm: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));

  --ease: cubic-bezier(.2, .7, .2, 1);
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath d='M5 0h2v1h-2zM5 1h2v1h-2zM4 2h4v1h-4zM4 3h4v1h-4zM0 4h12v1h-12zM1 5h10v1h-10zM2 6h8v1h-8zM3 7h6v1h-6zM2 8h8v1h-8zM2 9h3v1h-3zM7 9h3v1h-3zM1 10h3v1h-3zM8 10h3v1h-3zM1 11h2v1h-2zM9 11h2v1h-2z'/%3E%3C/svg%3E");
}

/* Light theme tokens (system preference, unless forced dark) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --c-bg: #e9eff9;
    --c-bg-band: #dde6f4;
    --c-surface: #ffffff;
    --c-surface-2: #f2f6fc;
    --c-surface-3: #e3eaf6;
    --c-line: #c3cee3;
    --c-line-strong: #93a2c4;
    --c-ink: #101935;
    --c-ink-2: #3f4c72;
    --c-ink-3: #56638a;
    --c-link: #0063a3;
    --c-on-accent: #101935;
    --c-select: #1e4bb8;
    --c-success: #0b7a4f;
    --c-success-bg: #dcf5ea;
    --c-warn: #8a5a00;
    --c-warn-bg: #fff1c7;
    --c-danger: #c0362a;
    --c-danger-bg: #fde4e1;
    --c-info-bg: #ddf1fc;
    --c-ai: #6236c9;
    --c-ai-bg: #ece4ff;
    --c-focus: #101935;
    --c-focus-halo: #0f8fd6;
    --c-code-bg: #0f1734;
    --c-shadow: #101935;
    --c-star-off: #c3cee3;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --c-bg: #e9eff9;
  --c-bg-band: #dde6f4;
  --c-surface: #ffffff;
  --c-surface-2: #f2f6fc;
  --c-surface-3: #e3eaf6;
  --c-line: #c3cee3;
  --c-line-strong: #93a2c4;
  --c-ink: #101935;
  --c-ink-2: #3f4c72;
  --c-ink-3: #56638a;
  --c-link: #0063a3;
  --c-on-accent: #101935;
  --c-select: #1e4bb8;
  --c-success: #0b7a4f;
  --c-success-bg: #dcf5ea;
  --c-warn: #8a5a00;
  --c-warn-bg: #fff1c7;
  --c-danger: #c0362a;
  --c-danger-bg: #fde4e1;
  --c-info-bg: #ddf1fc;
  --c-ai: #6236c9;
  --c-ai-bg: #ece4ff;
  --c-focus: #101935;
  --c-focus-halo: #0f8fd6;
  --c-code-bg: #0f1734;
  --c-shadow: #101935;
  --c-star-off: #c3cee3;
}

/* A block that always stays "night" (hero, console art) regardless of theme */
.is-night {
  color-scheme: dark;
  --c-bg: #0e1631; --c-bg-band: #131d40; --c-surface: #182449; --c-surface-2: #213060;
  --c-surface-3: #2a3a70; --c-line: #33447c; --c-line-strong: #4a5d9c;
  --c-ink: #edf2ff; --c-ink-2: #b4c0e2; --c-ink-3: #8c9ac6; --c-link: #5fd0ff;
  --c-focus: #ffffff; --c-focus-halo: #31c2ff; --c-success: #3ee0a1; --c-danger: #ff7a6b;
  --c-success-bg: rgba(62,224,161,.14); --c-shadow: #070c1e; --c-star-off: #3a4a80;
  color: var(--c-ink);
  background-color: var(--c-bg);
}

/* 3. 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); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  font-synthesis-weight: none;
  overflow-x: hidden;
}
main { flex: 1 0 auto; }
img, svg, video { max-width: 100%; display: block; }
figure { margin: 0; }
fieldset { min-width: 0; }
img { height: auto; }
.pixelated { image-rendering: pixelated; }
h1, h2, h3, h4 { margin: 0; font-family: var(--ff-display); font-weight: 400; line-height: var(--lh-tight); letter-spacing: .005em; text-wrap: balance; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-d-lg); line-height: 1.05; }
h4 { font-size: var(--fs-d-md); line-height: 1.1; }
p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
a { color: var(--c-link); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; color: var(--c-ink); }
small { font-size: var(--fs-sm); }
code, kbd, pre, samp { font-family: var(--ff-mono); font-size: .9em; }
hr { border: 0; height: 2px; background: var(--c-line); margin: var(--s-6) 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--brand-cart); color: var(--brand-night); }

:focus-visible { outline: 3px solid var(--c-focus-halo); outline-offset: 2px; }

.icon { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; shape-rendering: crispEdges; }
.icon--sm { width: 1em; height: 1em; }
.icon--lg { width: 24px; height: 24px; }
.icon--xl { width: 48px; height: 48px; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 16px; background: var(--brand-cart); color: var(--brand-night); font-weight: 700; }
.skip-link:focus { top: 8px; }

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

/* 4. Layout --------------------------------------------------------------- */
.container { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: calc(860px + 2 * var(--gutter)); }
.section { padding-block: clamp(48px, 7vw, 96px); }
.section--band { background: var(--c-bg-band); }
.section--tight { padding-block: clamp(32px, 4vw, 56px); }
.section__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s-3) var(--s-5); margin-bottom: var(--s-6); }
.section__head p { color: var(--c-ink-2); max-width: 56ch; margin: var(--s-3) 0 0; }
.section__link { font-weight: 600; white-space: nowrap; }
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.split { display: grid; gap: var(--s-7); align-items: center; }
.dash-grid > *, .split > *, .with-sidebar > *, .docs > *, .dash > *, .gl-card > *, .gl-teaser > *, .hero__inner > * { min-width: 0; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } .split--wide-left { grid-template-columns: 1.2fr 1fr; } }
.page-head { padding-block: clamp(32px, 5vw, 56px) var(--s-5); }
.page-head__lede { color: var(--c-ink-2); font-size: var(--fs-md); max-width: 52ch; margin-top: var(--s-3); line-height: 1.45; }
.with-sidebar { display: grid; gap: var(--s-6); }
@media (min-width: 1000px) { .with-sidebar { grid-template-columns: 260px minmax(0, 1fr); gap: var(--s-7); } .with-sidebar--right { grid-template-columns: minmax(0, 1fr) 340px; } }

/* 5. Components ----------------------------------------------------------- */

/* --- Pixel panel: notched outline drawn with two pseudo layers ---------- */
.panel {
  position: relative; isolation: isolate;
  padding: var(--s-5);
  color: var(--c-ink);
}
.panel::before, .panel::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
.panel::before { inset: 0; background: var(--c-line); clip-path: var(--notch); }
.panel::after { inset: 2px; background: var(--c-surface); clip-path: var(--notch); }
.panel--raised::after { background: var(--c-surface-2); }
.panel--accent::before { background: var(--brand-cart); }
.panel--blue::before { background: var(--c-blue); }
.panel--danger::before { background: var(--c-danger); }
.panel--flat::before { background: var(--c-surface); }
.panel--lg { padding: clamp(24px, 4vw, 40px); }
.panel--sm { padding: var(--s-4); }
.panel__title { font-size: var(--fs-d-md); margin-bottom: var(--s-3); }
.panel__foot { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 2px solid var(--c-line); }

/* --- Header ------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--c-line);
}
.site-header__bar { display: flex; align-items: center; gap: var(--s-5); min-height: var(--header-h); }
.logo { display: inline-flex; align-items: center; color: inherit; text-decoration: none; flex: none; }
.logo svg { height: 40px; width: auto; }
.logo--stack svg { height: 96px; }
/* Traced logo colours, exactly as in the BIOS splash: #31C2FF gear, #000 disc, #E6C200 wordmark */
.logo__mark { fill: #31c2ff; }
.logo__disc { fill: #000; }
.logo__word { fill: #e6c200; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .logo__word { fill: var(--brand-night); } :root:not([data-theme="dark"]) .logo__mark { fill: #0a8ad0; } }
:root[data-theme="light"] .logo__word { fill: var(--brand-night); }
:root[data-theme="light"] .logo__mark { fill: #0a8ad0; }
.is-night .logo__word { fill: #e6c200; }
.is-night .logo__mark { fill: #31c2ff; }

.nav { display: flex; gap: var(--s-1); }
.nav__link {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; color: var(--c-ink-2); text-decoration: none; font-weight: 600; font-size: .9875rem;
}
.nav__link:hover { color: var(--c-ink); background: var(--c-surface); }
.nav__link[aria-current="page"] { color: var(--c-ink); }
.nav__link[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -14px; height: 4px; background: var(--brand-cart); }
.site-header__tools { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 2px solid transparent; background: transparent; color: var(--c-ink-2);
}
.icon-btn:hover { color: var(--c-ink); background: var(--c-surface); }
.icon-btn .icon { width: 20px; height: 20px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .i-moon { display: none; }
}
.console-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px;
  border: 2px solid var(--c-line); color: var(--c-ink); text-decoration: none; font-size: var(--fs-sm); font-weight: 600;
}
.console-pill:hover { border-color: var(--c-line-strong); color: var(--c-ink); }
.dot { width: 8px; height: 8px; background: var(--c-ink-3); flex: none; display: inline-block; }
.dot--on { background: var(--c-success); box-shadow: 0 0 0 3px var(--c-success-bg); }
.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  background: var(--brand-chip); color: var(--brand-night); font-family: var(--ff-display); font-size: 1.375rem;
  clip-path: var(--notch-sm); text-decoration: none;
}
.avatar--lg { width: 48px; height: 48px; font-size: 1.75rem; }
.avatar--yellow { background: var(--brand-cart); }
.avatar--coral { background: #ff8a7a; }
.avatar--mint { background: #5fe6b2; }
.nav-toggle { display: none; }
.mobile-nav { display: none; }
@media (max-width: 959px) {
  .site-header .nav, .site-header .console-pill, .site-header__auth { display: none; }
  .nav-toggle { display: inline-grid; }
  .mobile-nav { border-top: 2px solid var(--c-line); padding: var(--s-3) 0 var(--s-5); }
  .mobile-nav[data-open="true"] { display: block; }
  .mobile-nav .nav { flex-direction: column; }
  .mobile-nav .nav__link { padding: 12px 8px; font-size: var(--fs-base); }
  .mobile-nav .nav__link[aria-current="page"]::after { display: none; }
  .mobile-nav .nav__link[aria-current="page"]::before { content: ""; width: 0; height: 0; border: 6px solid transparent; border-left: 8px solid var(--brand-cart); margin-right: -4px; }
  .mobile-nav__foot { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
}

/* --- Footer ------------------------------------------------------------- */
.site-footer { margin-top: auto; border-top: 2px solid var(--c-line); background: var(--c-bg-band); padding-block: var(--s-7) var(--s-6); font-size: var(--fs-sm); color: var(--c-ink-2); }
.site-footer__grid { display: grid; gap: var(--s-6); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 800px) { .site-footer__grid { grid-template-columns: 1.6fr repeat(4, 1fr); } }
.site-footer__brand { grid-column: 1 / -1; }
@media (min-width: 800px) { .site-footer__brand { grid-column: auto; } }
.site-footer__brand p { max-width: 32ch; margin-top: var(--s-3); }
.site-footer h2 { font-family: var(--ff-body); font-weight: 700; font-size: var(--fs-sm); color: var(--c-ink); margin-bottom: var(--s-3); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--c-ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--c-ink); text-decoration: underline; }
.site-footer__legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-7); padding-top: var(--s-4); border-top: 2px solid var(--c-line); }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  --btn-bg: var(--c-surface-2); --btn-fg: var(--c-ink); --btn-edge: var(--c-shadow);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  border: 0; background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--ff-body); font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  clip-path: var(--notch-sm);
  box-shadow: inset 0 -4px 0 var(--btn-edge);
  transition: transform .08s steps(2), filter .12s;
}
.btn:hover { color: var(--btn-fg); filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--btn-edge); }
.btn:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--c-focus), inset 0 0 0 5px var(--btn-bg), inset 0 0 0 7px var(--c-focus); }
.btn--primary { --btn-bg: var(--brand-cart); --btn-fg: var(--brand-night); --btn-edge: #a88a00; }
.btn--primary:focus-visible { box-shadow: inset 0 0 0 3px var(--brand-night), inset 0 0 0 5px var(--btn-bg), inset 0 0 0 7px var(--brand-night); }
.btn--blue { --btn-bg: var(--brand-chip); --btn-fg: #06253a; --btn-edge: #1786b8; }
.btn--blue:focus-visible { box-shadow: inset 0 0 0 3px #06253a, inset 0 0 0 5px var(--btn-bg), inset 0 0 0 7px #06253a; }
.btn--secondary { --btn-bg: transparent; --btn-fg: var(--c-ink); box-shadow: inset 0 0 0 2px var(--c-line-strong); }
.btn--secondary:hover { --btn-bg: var(--c-surface); }
.btn--secondary:active { box-shadow: inset 0 0 0 2px var(--c-line-strong); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--c-link); box-shadow: none; padding-inline: 12px; }
.btn--ghost:hover { --btn-bg: var(--c-surface); }
.btn--danger { --btn-bg: transparent; --btn-fg: var(--c-danger); box-shadow: inset 0 0 0 2px currentColor; }
.btn--danger:hover { --btn-bg: var(--c-danger-bg); }
.btn--danger-solid { --btn-bg: #e2463a; --btn-fg: #fff; --btn-edge: #9f2a21; }
.btn--success { --btn-bg: var(--c-success-bg); --btn-fg: var(--c-success); box-shadow: inset 0 0 0 2px currentColor; }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: var(--fs-sm); }
.btn--lg { min-height: 52px; padding: 14px 28px; font-size: 1.0625rem; }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"], .btn.is-disabled {
  --btn-bg: var(--c-surface-2); --btn-fg: var(--c-ink-3); cursor: not-allowed; filter: none; transform: none;
  box-shadow: inset 0 0 0 2px var(--c-line);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--c-line) 45%, transparent) 6px 8px);
}
.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; background: var(--btn-fg); animation: px-spin .8s steps(4) infinite; clip-path: polygon(0 0, 40% 0, 40% 40%, 0 40%, 0 0, 60% 60%, 100% 60%, 100% 100%, 60% 100%, 60% 60%); }
@keyframes px-spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.btn-hint { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-sm); color: var(--c-ink-2); margin-top: var(--s-2); }
.btn-hint .icon { margin-top: 3px; }

/* --- Badges & tags ------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.5; white-space: nowrap;
  color: var(--c-ink-2); background: var(--c-surface-2); box-shadow: inset 0 0 0 1px var(--c-line);
}
.badge .icon { width: 12px; height: 12px; }
.badge--handmade { color: var(--c-success); background: var(--c-success-bg); box-shadow: none; }
.badge--ai { color: var(--c-ai); background: var(--c-ai-bg); box-shadow: none; }
.badge--early { color: var(--c-warn); background: var(--c-warn-bg); box-shadow: none; }
.badge--verified { color: var(--c-link); background: var(--c-info-bg); box-shadow: none; }
.badge--danger { color: var(--c-danger); background: var(--c-danger-bg); box-shadow: none; }
.badge--solid { background: var(--brand-cart); color: var(--brand-night); box-shadow: none; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- Rating ------------------------------------------------------------- */
.rating { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--fs-sm); }
.stars {
  --pct: 80%; --size: 14px;
  display: inline-block; width: calc(var(--size) * 5 + 8px); height: var(--size); flex: none;
  background: linear-gradient(90deg, var(--brand-cart) var(--pct), var(--c-star-off) var(--pct));
  -webkit-mask: var(--star) 0 0 / calc(var(--size) + 2px) var(--size) repeat-x; mask: var(--star) 0 0 / calc(var(--size) + 2px) var(--size) repeat-x;
}
.stars--lg { --size: 22px; }
.rating__count { color: var(--c-ink-3); font-weight: 500; }

/* --- Forms -------------------------------------------------------------- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: var(--s-4); }
.label { font-weight: 600; font-size: .9375rem; }
.label__opt { color: var(--c-ink-3); font-weight: 400; }
.hint { font-size: var(--fs-sm); color: var(--c-ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: var(--c-surface); color: var(--c-ink);
  border: 2px solid var(--c-line-strong); border-radius: 0;
}
.textarea { min-height: 120px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--c-ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-ink-3); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--c-focus-halo); outline-offset: 0; border-color: var(--c-focus-halo); }
.select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--c-ink-2) 50%), linear-gradient(-45deg, transparent 50%, var(--c-ink-2) 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--c-danger); }
.field__error { display: flex; gap: 6px; align-items: flex-start; color: var(--c-danger); font-size: var(--fs-sm); font-weight: 600; }
.field__error .icon { margin-top: 3px; width: 14px; height: 14px; }
.input-group { position: relative; }
.input-group .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--c-ink-3); width: 18px; height: 18px; pointer-events: none; }
.input-group .input { padding-left: 42px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: .9875rem; }
.check input { appearance: none; flex: none; width: 20px; height: 20px; margin: 2px 0 0; border: 2px solid var(--c-line-strong); background: var(--c-surface); display: grid; place-items: center; cursor: pointer; }
.check input[type="radio"] { border-radius: 0; }
.check input:checked { background: var(--brand-cart); border-color: var(--brand-cart); box-shadow: none; }
.check input:checked::after { content: ""; width: 10px; height: 10px; background: var(--brand-night); clip-path: polygon(0 50%, 20% 30%, 40% 55%, 80% 10%, 100% 30%, 40% 90%); }
.check input[type="radio"]:checked { background: var(--c-surface); border-color: var(--brand-cart); }
.check input[type="radio"]:checked::after { clip-path: none; width: 8px; height: 8px; background: var(--brand-cart); }
.check input:focus-visible { outline: 3px solid var(--c-focus-halo); outline-offset: 2px; }
.check__count { margin-left: auto; color: var(--c-ink-3); font-size: var(--fs-sm); }
.choice {
  position: relative; display: flex; gap: var(--s-3); padding: var(--s-4); cursor: pointer;
  border: 2px solid var(--c-line); background: var(--c-surface);
}
.choice:hover { border-color: var(--c-line-strong); }
.choice:has(input:checked) { border-color: var(--brand-cart); background: color-mix(in srgb, var(--brand-cart) 8%, var(--c-surface)); }
.choice:has(input:focus-visible) { outline: 3px solid var(--c-focus-halo); outline-offset: 2px; }
.choice__title { font-weight: 700; display: block; }
.choice__desc { color: var(--c-ink-2); font-size: var(--fs-sm); display: block; margin-top: 2px; }
.choice .check { pointer-events: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-top: var(--s-5); }

/* Pairing code: 8 cells, ABCD-EFGH */
.code-input { display: flex; align-items: center; gap: 6px; max-width: 500px; }
.code-input__group { display: flex; gap: 6px; flex: 1; min-width: 0; }
.code-input__cell {
  flex: 1 1 0; min-width: 0; width: auto; max-width: 52px; height: clamp(48px, 12vw, 64px); padding: 0; text-align: center;
  font-family: var(--ff-display); font-size: clamp(1.75rem, 7vw, 2.75rem); text-transform: uppercase;
  background: var(--c-surface); color: var(--c-ink); border: 2px solid var(--c-line-strong); border-radius: 0;
  caret-color: var(--brand-cart);
}
.code-input__cell:focus-visible { outline: none; border-color: var(--brand-cart); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-cart) 40%, transparent); }
.code-input__cell.is-filled { border-color: var(--c-ink-3); }
.code-input__dash { width: 14px; height: 4px; background: var(--c-ink-3); flex: none; }
.code-input[aria-invalid="true"] .code-input__cell { border-color: var(--c-danger); }

/* --- Segmented control (launcher-style) --------------------------------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--c-line); }
.seg__btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; background: var(--c-surface); color: var(--c-ink-2); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; }
.seg__btn:hover { color: var(--c-ink); }
.seg__btn[aria-pressed="true"], .seg__btn[aria-selected="true"], .seg__btn[aria-current="true"] { background: var(--c-select); color: var(--c-on-select); }

/* Tabs */
.tabs { display: flex; gap: var(--s-1); border-bottom: 2px solid var(--c-line); overflow-x: auto; scrollbar-width: none; }
.tabs__tab { position: relative; padding: 12px 16px; color: var(--c-ink-2); font-weight: 700; text-decoration: none; white-space: nowrap; border: 0; background: none; }
.tabs__tab:hover { color: var(--c-ink); }
.tabs__tab[aria-selected="true"], .tabs__tab[aria-current="page"] { color: var(--c-ink); }
.tabs__tab[aria-selected="true"]::after, .tabs__tab[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 4px; background: var(--brand-cart); }
.tabs__count { color: var(--c-ink-3); font-weight: 500; margin-left: 4px; }

/* Chips (filters) */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 2px solid var(--c-line); background: transparent; color: var(--c-ink-2); font-size: var(--fs-sm); font-weight: 600; }
.chip:hover { border-color: var(--c-line-strong); color: var(--c-ink); }
.chip[aria-pressed="true"] { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-bg); }
.chip .icon { width: 12px; height: 12px; }

/* --- Alerts / notices / toast ------------------------------------------- */
.notice { display: flex; gap: var(--s-3); padding: var(--s-4); border-left: 4px solid var(--c-blue); background: var(--c-info-bg); font-size: .9875rem; }
.notice .icon { color: var(--c-link); margin-top: 2px; }
.notice__title { font-weight: 700; display: block; }
.notice--success { border-color: var(--c-success); background: var(--c-success-bg); }
.notice--success .icon { color: var(--c-success); }
.notice--warn { border-color: var(--c-warn); background: var(--c-warn-bg); }
.notice--warn .icon { color: var(--c-warn); }
.notice--danger { border-color: var(--c-danger); background: var(--c-danger-bg); }
.notice--danger .icon { color: var(--c-danger); }
.toast {
  display: inline-flex; align-items: center; gap: var(--s-3); padding: 12px 16px;
  background: var(--brand-night); color: #edf2ff; box-shadow: 4px 4px 0 var(--brand-chip); font-weight: 600; font-size: .9375rem;
}
.toast .icon { color: #3ee0a1; }
.toast a { color: var(--brand-cart); }

/* --- Breadcrumbs ---------------------------------------------------------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--c-ink-3); list-style: none; margin: 0; padding: 0; }
.crumbs a { color: var(--c-ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--c-ink); text-decoration: underline; }
.crumbs .icon { width: 10px; height: 10px; }

/* --- Tables --------------------------------------------------------------- */
.table-wrap { position: relative; overflow-x: auto; border: 2px solid var(--c-line); background: var(--c-surface); }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 2px solid var(--c-line); }
.table th { font-size: var(--fs-sm); color: var(--c-ink-2); font-weight: 600; background: var(--c-surface-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--c-surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table code { font-size: .875em; color: var(--c-ink-2); }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; background: var(--c-ink-3); }
.status--live::before { background: var(--c-success); }
.status--live { color: var(--c-success); }
.status--pending::before { background: var(--c-warn); animation: blink 1s steps(2) infinite; }
.status--pending { color: var(--c-warn); }
.status--failed::before { background: var(--c-danger); }
.status--failed { color: var(--c-danger); }
@keyframes blink { 50% { opacity: 0; } }

/* Description list (spec sheets, requirements) */
.spec { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; font-size: .9375rem; }
.spec dt, .spec dd { padding: 10px 0; border-bottom: 2px dotted var(--c-line); margin: 0; }
.spec dt { color: var(--c-ink-2); padding-right: var(--s-5); }
.spec dd { font-weight: 600; text-align: right; }
.spec > :nth-last-child(-n+2) { border-bottom: 0; }

/* --- Segmented progress (health-bar style) ------------------------------ */
.meter { --value: 50; --blocks: 20; display: grid; gap: 6px; }
.meter__bar {
  height: 16px; padding: 2px; background: var(--c-surface-2); box-shadow: inset 0 0 0 2px var(--c-line);
}
.meter__fill {
  height: 100%; width: calc(var(--value) * 1%);
  background: repeating-linear-gradient(90deg, var(--brand-cart) 0 calc(100% / var(--blocks) - 2px), transparent 0 calc(100% / var(--blocks)));
  background-size: calc(100% * 100 / var(--value)) 100%;
}
.meter--blue .meter__fill { background-image: repeating-linear-gradient(90deg, var(--brand-chip) 0 calc(100% / var(--blocks) - 2px), transparent 0 calc(100% / var(--blocks))); }
.meter--done .meter__fill { background-image: repeating-linear-gradient(90deg, var(--c-success) 0 calc(100% / var(--blocks) - 2px), transparent 0 calc(100% / var(--blocks))); }
.meter__label { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-sm); color: var(--c-ink-2); }
.meter__label strong { color: var(--c-ink); font-family: var(--ff-display); font-size: 1.375rem; line-height: 1; }

/* Stage track: a real sequence, so it is numbered */
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; list-style: none; margin: 0; padding: 0; counter-reset: stage; }
.stages__item { counter-increment: stage; position: relative; padding-top: 12px; font-size: var(--fs-xs); font-weight: 600; color: var(--c-ink-3); line-height: 1.3; }
.stages__item::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: var(--c-line); }
.stages__item.is-done { color: var(--c-ink-2); }
.stages__item.is-done::before { background: var(--c-ink-3); }
.stages__item.is-current { color: var(--c-ink); }
.stages__item.is-current::before { background: var(--brand-cart); }

/* --- Screen frame: 480 x 272 aspect with a quiet scanline ---------------- */
.screen {
  position: relative; aspect-ratio: 480 / 272; overflow: hidden; background: #000;
  box-shadow: 0 0 0 2px var(--c-line), 0 0 0 10px #0a0f22, 0 0 0 12px var(--c-line);
  margin: 12px;
}
.screen img { width: 100%; height: 100%; object-fit: cover; }
.screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(180deg, transparent 0 2px, rgba(0, 0, 0, .14) 2px 3px); }
.screen--bare { margin: 0; box-shadow: 0 0 0 2px var(--c-line); }

/* --- Game card: a cartridge --------------------------------------------- */
.cart-grid { display: grid; gap: var(--s-5) var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); list-style: none; margin: 0; padding: 0; }
@media (max-width: 520px) { .cart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4) var(--s-3); } .cart-grid .cart { padding-inline: 6px; } .cart-grid .cart__title { font-size: 1.25rem; } .cart-grid .cart__flags .badge:nth-child(n+2) { display: none; } .cart-grid .rating { font-size: var(--fs-xs); gap: 4px; } .cart-grid .stars { --size: 10px; } }
.cart {
  position: relative; isolation: isolate; display: flex; flex-direction: column; height: 100%;
  padding: 0 10px 12px; color: var(--c-ink); text-decoration: none;
}
.cart::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--c-line); clip-path: polygon(0 18px, 4px 18px, 4px 14px, 8px 14px, 8px 10px, 30% 10px, 30% 0, 70% 0, 70% 10px, calc(100% - 8px) 10px, calc(100% - 8px) 14px, calc(100% - 4px) 14px, calc(100% - 4px) 18px, 100% 18px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)); }
.cart::after { content: ""; position: absolute; inset: 2px; z-index: -1; background: var(--c-surface); clip-path: polygon(0 18px, 4px 18px, 4px 14px, 8px 14px, 8px 10px, calc(30% - 1px) 10px, calc(30% - 1px) 0, calc(70% + 1px) 0, calc(70% + 1px) 10px, calc(100% - 8px) 10px, calc(100% - 8px) 14px, calc(100% - 4px) 14px, calc(100% - 4px) 18px, 100% 18px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)); }
.cart__grip { height: 22px; margin: 0 22%; background: repeating-linear-gradient(90deg, transparent 0 6px, var(--c-line) 6px 8px); background-size: 100% 6px; background-repeat: no-repeat; background-position: 0 6px; }
.cart__label { position: relative; overflow: hidden; aspect-ratio: 1; background: var(--c-surface-2); box-shadow: 0 0 0 2px var(--c-line); }
.cart__label img { width: 100%; height: 100%; object-fit: cover; }
.cart__flags { position: absolute; left: 6px; top: 6px; right: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.cart__flags .badge { background: rgba(10, 17, 40, .86); box-shadow: none; }
.cart__flags .badge--early { color: #ffc94a; }
.cart__flags .badge--ai { color: #c4a6ff; }
.cart__flags .badge--handmade { color: #3ee0a1; }
.cart__flags .badge--verified { color: #5fd0ff; }
.cart__body { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; flex: 1; }
.cart__title { font-family: var(--ff-display); font-size: 1.5rem; font-weight: 400; line-height: 1; }
.cart__title a { color: inherit; text-decoration: none; }
.cart__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.cart__dev { color: var(--c-ink-2); font-size: var(--fs-sm); }
.cart__meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; }
.cart__price { font-family: var(--ff-display); font-size: 1.375rem; line-height: 1; }
.cart__price--free { color: var(--c-success); }
.cart:hover::before, .cart:focus-within::before { background: var(--brand-cart); }
.cart:focus-within { outline: none; }
.cart a:focus-visible { outline: none; }
.cart:has(a:focus-visible)::before { background: var(--c-focus-halo); }
.cart-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: var(--s-4); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--s-3); list-style: none; margin: 0; padding-left: 0; scrollbar-width: thin; }
.cart-row > * { scroll-snap-align: start; }
@media (min-width: 1200px) { .cart-row { grid-auto-columns: calc((100% - 5 * var(--s-4)) / 6); } }
@media (max-width: 700px) { .cart-row { grid-auto-columns: 62%; } }

/* --- Launcher list (used in docs nav, library, hero console) ------------ */
.launcher { list-style: none; margin: 0; padding: 0; }
.launcher__item > a, .launcher__item > button {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 12px 8px 26px; color: var(--c-ink-2); text-decoration: none; text-align: left; border: 0; background: none; font-size: .9375rem;
}
.launcher__item > a:hover { color: var(--c-ink); background: var(--c-surface); }
.launcher__item > a[aria-current="page"], .launcher__item.is-selected > a {
  background: var(--c-select); color: var(--c-on-select); font-weight: 600;
}
.launcher__item > a[aria-current="page"]::before, .launcher__item.is-selected > a::before {
  content: ""; position: absolute; left: 9px; top: 50%; width: 0; height: 0; transform: translateY(-50%);
  border: 6px solid transparent; border-left: 8px solid var(--brand-cart); border-right: 0;
}

/* --- Code ----------------------------------------------------------------- */
.code {
  position: relative; margin: 0; padding: var(--s-5); overflow-x: auto;
  background: var(--c-code-bg); color: #dfe7ff; font-family: var(--ff-mono); font-size: .875rem; line-height: 1.7; tab-size: 4;
  box-shadow: inset 0 0 0 2px #26335f;
}
.code__file { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px 8px 20px; background: #1a2550; color: #b4c0e2; font-size: var(--fs-sm); font-family: var(--ff-mono); }
.code__file + .code { margin-top: 0; }
.code__copy { font: inherit; font-family: var(--ff-body); font-weight: 600; font-size: var(--fs-xs); border: 2px solid #3a4a80; background: transparent; color: #dfe7ff; padding: 2px 10px; }
.code__copy:hover { border-color: #f2c700; }
.tok-k { color: #ff9be0; } .tok-f { color: #5fd0ff; } .tok-s { color: #ffd866; } .tok-n { color: #ffb06b; } .tok-c { color: #8794c4; font-style: italic; } .tok-p { color: #9ee8c4; }
:not(pre) > code { white-space: nowrap; padding: 1px 6px; background: var(--c-surface-2); box-shadow: inset 0 0 0 1px var(--c-line); font-size: .875em; color: var(--c-ink); }

/* --- Empty / loading / error states -------------------------------------- */
.state { display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: clamp(32px, 6vw, 64px) var(--s-5); }
.state__art { width: 96px; height: 96px; color: var(--c-ink-3); margin-bottom: var(--s-2); }
.state__art .icon { width: 96px; height: 96px; }
.state h3 { font-size: var(--fs-d-lg); }
.state p { color: var(--c-ink-2); max-width: 44ch; }
.state--error .state__art { color: var(--c-danger); }
.skeleton { background: var(--c-surface-2); position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0 40%, color-mix(in srgb, var(--c-ink) 7%, transparent) 40% 60%, transparent 60%); background-size: 300% 100%; animation: shimmer 1.4s steps(12) infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.skeleton--line { height: 14px; margin-top: 8px; }
.skeleton--title { height: 20px; width: 70%; margin-top: 12px; }
.loader { display: inline-flex; gap: 4px; }
.loader span { width: 10px; height: 10px; background: var(--brand-cart); animation: loader 0.9s steps(1) infinite; }
.loader span:nth-child(2) { animation-delay: .3s; }
.loader span:nth-child(3) { animation-delay: .6s; }
@keyframes loader { 0%, 100% { opacity: .25; } 33% { opacity: 1; } }

/* Dialog */
.dialog { border: 0; padding: 0; background: transparent; color: var(--c-ink); max-width: min(480px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(7, 12, 30, .7); }
.dialog .panel { padding: var(--s-6); }

/* Pagination */
.pager { display: flex; justify-content: center; gap: 4px; margin-top: var(--s-7); }
.pager a, .pager span { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border: 2px solid var(--c-line); color: var(--c-ink-2); text-decoration: none; font-weight: 600; }
.pager a:hover { border-color: var(--c-line-strong); color: var(--c-ink); }
.pager [aria-current="page"] { background: var(--c-select); border-color: var(--c-select); color: #fff; }

/* 6. Page modules --------------------------------------------------------- */

/* --- Hero (index) ------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(40px, 7vw, 96px) 0; }
.hero__sky { position: absolute; inset: 0; pointer-events: none; background:
  radial-gradient(2px 2px at 12% 18%, #fff 98%, transparent), radial-gradient(2px 2px at 28% 62%, #9fdcff 98%, transparent),
  radial-gradient(2px 2px at 44% 12%, #fff 98%, transparent), radial-gradient(2px 2px at 58% 40%, #f2c700 98%, transparent),
  radial-gradient(2px 2px at 72% 8%, #fff 98%, transparent), radial-gradient(2px 2px at 86% 30%, #9fdcff 98%, transparent),
  radial-gradient(2px 2px at 94% 70%, #fff 98%, transparent), radial-gradient(2px 2px at 6% 80%, #fff 98%, transparent),
  radial-gradient(4px 4px at 66% 22%, #fff 98%, transparent), radial-gradient(2px 2px at 36% 30%, #fff 98%, transparent),
  linear-gradient(180deg, #0b1230 0%, #172a66 70%, #24357a 100%); }
.hero__inner { position: relative; display: grid; gap: var(--s-7); align-items: center; padding-bottom: 40px; }
@media (min-width: 1000px) { .hero__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); } }
.hero__title { font-size: var(--fs-3xl); line-height: .95; color: #fff; max-width: 9.5em; text-shadow: 4px 4px 0 #0a1028; }
.hero__lede { margin-top: var(--s-5); font-size: var(--fs-md); line-height: 1.5; color: var(--c-ink-2); max-width: 46ch; }
.hero__actions { margin-top: var(--s-6); }
.hero__specs { display: flex; flex-wrap: wrap; gap: 8px; margin: var(--s-6) 0 0; padding: 0; list-style: none; }
.hero__specs li { padding: 4px 10px; font-size: var(--fs-sm); font-weight: 600; color: #dfe7ff; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12); }
.hero__ground { position: relative; height: 8px; margin-top: clamp(32px, 6vw, 72px);
  background: var(--page-bg); }
.hero__ground::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 48px; background: var(--page-bg);
  clip-path: polygon(0 100%, 0 60%, 4% 60%, 4% 40%, 9% 40%, 9% 20%, 13% 20%, 13% 50%, 20% 50%, 20% 70%, 26% 70%, 26% 30%, 31% 30%, 31% 0, 35% 0, 35% 45%, 42% 45%, 42% 65%, 50% 65%, 50% 35%, 56% 35%, 56% 15%, 61% 15%, 61% 55%, 68% 55%, 68% 75%, 74% 75%, 74% 40%, 80% 40%, 80% 20%, 85% 20%, 85% 50%, 91% 50%, 91% 65%, 96% 65%, 96% 45%, 100% 45%, 100% 100%); }

/* The real Core8Bit: a near-square portrait slab (100 x 115), textured black
   faceplate on a cream 3D-printed body. Every part is positioned in % of the
   faceplate, measured from product photos. The screen keeps a 480x272 grid
   (1 screen pixel = --u) so the launcher mock matches the device. */
.handheld { container-type: inline-size; width: min(100%, 440px); margin-inline: auto; }
.handheld__body {
  position: relative; aspect-ratio: 100 / 115;
  padding: 0 2.2cqw 3.2cqw 1.2cqw;               /* cream edge shows right and bottom */
  background: linear-gradient(90deg, #cdbb93 0%, #e3d3b0 30%, #efe3c6 100%);
  border-radius: 4.5cqw;
  box-shadow: 0 2.5cqw 5cqw rgba(0, 0, 0, .45), 0 0.6cqw 0 rgba(0, 0, 0, .25);
}
.handheld__face {
  position: relative; height: 100%; border-radius: 3.6cqw; overflow: hidden;
  background-color: #1b1b1d;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, #26262a 0%, #1b1b1d 45%, #151517 100%);
  box-shadow: inset 0 0.4cqw 0 rgba(255, 255, 255, .06), inset 0 -0.4cqw 0 rgba(0, 0, 0, .5);
}
/* recessed screen bezel, top of the faceplate */
.handheld__bezel {
  position: absolute; left: 3.6%; right: 3.6%; top: 3.2%;
  padding: 3.2% 3.6% 5.4%;
  background: #121214; border-radius: 1.2cqw;
  box-shadow: inset 0 0.6cqw 1cqw rgba(0, 0, 0, .7), 0 0 0 0.35cqw #2a2a2e;
}
.handheld__bezel .lscreen { box-shadow: 0 0 0 0.3cqw #000; }
.handheld__part { position: absolute; transform: translate(-50%, -50%); }
/* orange round buttons in dark sockets */
.handheld__btn {
  width: 7.6%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #ffc27a 0%, #f7931e 42%, #d9740a 100%);
  box-shadow: 0 0 0 0.7cqw #0c0c0d, 0 0 0 1.05cqw #3a3732, inset 0 -0.5cqw 0.6cqw rgba(120, 50, 0, .45);
}
/* engraved gear-8 (traced logo mark) */
.handheld__logo { width: 13%; }
.handheld__logo svg { width: 100%; height: auto; display: block; }
.handheld .handheld__logo .logo__mark { fill: #c4b797; }
.handheld .handheld__logo .logo__disc { fill: #19191b; }
/* analog stick openings with black thumbsticks */
.handheld__stick {
  width: 12.5%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #050506 62%, #0b0b0c 63%);
  box-shadow: 0 0 0 0.45cqw #8d877a, inset 0 0.6cqw 1cqw rgba(0, 0, 0, .9);
}
.handheld__stick::after {
  content: ""; position: absolute; inset: 20%; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3b3b3f 0%, #1a1a1c 55%, #0a0a0b 100%);
  box-shadow: 0 0.3cqw 0.5cqw rgba(0, 0, 0, .8);
}
/* 3-slot speaker grilles */
.handheld__grill { width: 9%; display: grid; gap: 0.9cqw; }
.handheld__grill span { height: 1.9cqw; border-radius: 1cqw; background: #070708; box-shadow: 0 0 0 0.35cqw #6f6b62; }
.lscreen { container-type: inline-size; position: relative; aspect-ratio: 480 / 272; overflow: hidden; background: #050a1c; font-family: var(--ff-display); color: #fff; }
.lscreen { --u: calc(100cqw / 480); }
.lscreen__bg { position: absolute; inset: 0; background: linear-gradient(160deg, #10204a 0%, #091233 60%, #050a1c 100%); }
.lscreen__bg::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, transparent 0 calc(var(--u) * 38), rgba(95, 208, 255, .06) calc(var(--u) * 38) calc(var(--u) * 39)); }
.lscreen__rail { position: absolute; left: calc(var(--u) * 12); top: calc(var(--u) * 40); bottom: calc(var(--u) * 40); width: calc(var(--u) * 2); background: #6b7fb8; }
.lscreen__rail::before, .lscreen__rail::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); border: calc(var(--u) * 6) solid transparent; }
.lscreen__rail::before { top: calc(var(--u) * -14); border-bottom: calc(var(--u) * 9) solid #f2c700; border-top: 0; }
.lscreen__rail::after { bottom: calc(var(--u) * -14); border-top: calc(var(--u) * 9) solid #f2c700; border-bottom: 0; }
.lscreen__list { position: absolute; left: calc(var(--u) * 30); top: calc(var(--u) * 34); width: calc(var(--u) * 216); list-style: none; margin: 0; padding: 0; }
.lscreen__item { position: relative; height: calc(var(--u) * 24); line-height: calc(var(--u) * 24); padding-left: calc(var(--u) * 16); font-size: calc(var(--u) * 18); white-space: nowrap; }
.lscreen__item.is-selected { background: #1e3a9a; box-shadow: inset 0 0 0 calc(var(--u) * 1) #31c2ff; }
.lscreen__item.is-selected::before { content: ""; position: absolute; left: calc(var(--u) * 4); top: 50%; transform: translateY(-50%); border: calc(var(--u) * 5) solid transparent; border-left: calc(var(--u) * 7) solid #f2c700; border-right: 0; }
.lscreen__cover { position: absolute; right: calc(var(--u) * 16); top: calc(var(--u) * 34); width: calc(var(--u) * 196); height: calc(var(--u) * 196); box-shadow: 0 0 0 calc(var(--u) * 2) #6b7fb8; background: #0a0f22; }
.lscreen__cover img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.lscreen__bar { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--u) * 22); display: flex; align-items: center; justify-content: space-between; padding: 0 calc(var(--u) * 16) 0 calc(var(--u) * 38); background: rgba(0, 0, 0, .55); font-size: calc(var(--u) * 14); color: #b4c0e2; }
.lscreen__bar strong { color: #3ee0a1; font-weight: 600; }
.lscreen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(180deg, transparent 0 calc(var(--u) * 2), rgba(0, 0, 0, .16) calc(var(--u) * 2) calc(var(--u) * 3)); }

/* --- Pillars (what it is) ------------------------------------------------- */
.pillars { display: grid; gap: var(--s-5); list-style: none; margin: var(--s-6) 0 0; padding: 0; }
.pillar { display: grid; grid-template-columns: 48px 1fr; gap: var(--s-4); align-items: start; }
.pillar__icon { display: grid; place-items: center; width: 48px; height: 48px; background: var(--brand-night); color: var(--brand-cart); clip-path: var(--notch-sm); }
.pillar__icon .icon { width: 24px; height: 24px; }
.pillar h3 { font-size: var(--fs-d-md); margin-bottom: 4px; }
.pillar p { color: var(--c-ink-2); margin: 0; }
.art-frame { position: relative; }
.art-frame img { width: 100%; box-shadow: 0 0 0 2px var(--c-line); }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.photo-pair img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; box-shadow: 0 0 0 2px var(--c-line); }
.art-frame figcaption { margin-top: var(--s-3); font-size: var(--fs-sm); color: var(--c-ink-3); }

/* --- Greenlight ---------------------------------------------------------- */
.gl-teaser { display: grid; gap: var(--s-6); align-items: center; }
@media (min-width: 900px) { .gl-teaser { grid-template-columns: 1fr 1.15fr; } }
.gl-list { display: grid; gap: var(--s-5); list-style: none; margin: 0; padding: 0; }
.gl-card { display: grid; gap: var(--s-5); }
@media (min-width: 760px) { .gl-card { grid-template-columns: minmax(240px, 40%) 1fr; align-items: start; } }
.gl-card__media { margin: 0; }
.gl-card__media .screen { margin: 10px; }
.gl-card__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2); align-items: start; }
.gl-card__title { font-size: var(--fs-d-lg); }
.gl-card__title a { color: inherit; text-decoration: none; }
.gl-card__title a:hover { text-decoration: underline; }
.gl-card__by { color: var(--c-ink-2); font-size: var(--fs-sm); margin-top: 4px; }
.gl-card__desc { color: var(--c-ink-2); margin-top: var(--s-3); max-width: 60ch; }
.gl-card__foot { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; justify-content: space-between; margin-top: var(--s-5); }
.gl-card__foot .meter { flex: 1 1 260px; }
.vote { display: grid; justify-items: end; gap: 6px; }
.vote__note { font-size: var(--fs-xs); color: var(--c-ink-3); }
.vote__note button { font-size: inherit; border: 0; background: none; color: var(--c-link); text-decoration: underline; padding: 0; }
.gl-explainer { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: step; list-style: none; padding: 0; margin: 0; }
.gl-explainer li { counter-increment: step; display: grid; grid-template-columns: 36px 1fr; gap: var(--s-3); font-size: .9375rem; color: var(--c-ink-2); }
.gl-explainer li::before { content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; background: var(--brand-cart); color: var(--brand-night); font-family: var(--ff-display); font-size: 1.5rem; clip-path: var(--notch-sm); }
.gl-explainer strong { display: block; color: var(--c-ink); }

/* --- Store ---------------------------------------------------------------- */
.store-toolbar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; margin-bottom: var(--s-5); }
.store-toolbar__search { flex: 1 1 320px; max-width: 520px; }
.store-toolbar__count { color: var(--c-ink-2); font-size: var(--fs-sm); }
.filters { display: grid; gap: var(--s-6); align-content: start; }
.filters fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.filters legend { font-family: var(--ff-display); font-size: 1.5rem; line-height: 1; margin-bottom: 10px; padding: 0; }
.filters__details > summary { display: none; }
@media (max-width: 999px) {
  .filters__details { border: 2px solid var(--c-line); }
  .filters__details > summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-weight: 700; cursor: pointer; list-style: none; }
  .filters__details > summary::-webkit-details-marker { display: none; }
  .filters__details[open] > summary { border-bottom: 2px solid var(--c-line); }
  .filters__details .filters { padding: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}
.sort-select { display: none; }
@media (max-width: 720px) { .sort-seg { display: none; } .sort-select { display: block; width: auto; min-width: 180px; } }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s-5); align-items: center; }

/* --- Game page ------------------------------------------------------------ */
.game-head { display: grid; gap: var(--s-4); padding-block: var(--s-5) var(--s-6); }
.game-head__title { font-size: var(--fs-2xl); }
.game-head__by { color: var(--c-ink-2); }
.game-head__meta { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); align-items: center; }
.gallery__main .screen { margin: 12px; }
.gallery__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); margin: var(--s-4) 12px 0; list-style: none; padding: 0; }
.gallery__thumb { padding: 0; border: 0; background: none; aspect-ratio: 480 / 272; position: relative; box-shadow: 0 0 0 2px var(--c-line); }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.gallery__thumb[aria-current="true"] { box-shadow: 0 0 0 3px var(--brand-cart); }
.gallery__thumb[aria-current="true"] img, .gallery__thumb:hover img { opacity: 1; }
.gallery__thumb--video::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0; border: 10px solid transparent; border-left: 14px solid #fff; border-right: 0; filter: drop-shadow(2px 2px 0 #000); }
.buy-box { display: grid; gap: var(--s-4); align-content: start; }
.buy-box__price { font-family: var(--ff-display); font-size: 3rem; line-height: 1; }
.buy-box__note { font-size: var(--fs-sm); color: var(--c-ink-2); }
.sticky-side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: var(--s-5); align-self: start; align-content: start; }
.prose { max-width: var(--maxw-text); }
.prose h2 { font-size: var(--fs-xl); margin: var(--s-7) 0 var(--s-4); }
.prose h3 { margin: var(--s-6) 0 var(--s-3); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li + li { margin-top: 6px; }
.prose ul li::marker { content: "■  "; color: var(--brand-cart); font-size: .7em; }
.prose .code, .prose .code-block, .prose .table-wrap, .prose .notice { margin: var(--s-5) 0; }
.prose .code-block .code { margin: 0; }
.review-summary { display: grid; gap: var(--s-5); align-items: center; }
@media (min-width: 640px) { .review-summary { grid-template-columns: auto 1fr; gap: var(--s-7); } }
.review-summary__score { font-family: var(--ff-display); font-size: 5rem; line-height: 1; }
.histo { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.histo li { display: grid; grid-template-columns: 2.5em 1fr 3em; gap: 10px; align-items: center; color: var(--c-ink-2); }
.histo__bar { height: 10px; background: var(--c-surface-2); }
.histo__bar span { display: block; height: 100%; background: var(--brand-cart); }
.histo li > :last-child { text-align: right; font-variant-numeric: tabular-nums; }
.reviews { list-style: none; margin: 0; padding: 0; display: grid; }
.review { display: grid; grid-template-columns: 40px 1fr; gap: var(--s-4); padding-block: var(--s-5); border-top: 2px solid var(--c-line); }
.review__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.review__name { font-weight: 700; }
.review__meta { color: var(--c-ink-3); font-size: var(--fs-sm); }
.review__body { margin-top: var(--s-2); }
.review__foot { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-3); font-size: var(--fs-sm); color: var(--c-ink-3); }
.review__reply { margin-top: var(--s-3); padding: var(--s-3) var(--s-4); border-left: 4px solid var(--brand-chip); background: var(--c-surface); font-size: .9375rem; }
.changelog { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.changelog li { display: grid; grid-template-columns: 7.5em 1fr; gap: var(--s-4); padding: var(--s-4) 0; border-top: 2px solid var(--c-line); }
.changelog__ver { font-family: var(--ff-display); font-size: 1.5rem; line-height: 1.1; }
.changelog__date { display: block; color: var(--c-ink-3); font-size: var(--fs-sm); font-family: var(--ff-body); font-weight: 400; }
.changelog ul { margin: 0; padding-left: 1.2em; color: var(--c-ink-2); }
@media (max-width: 600px) { .changelog li { grid-template-columns: 1fr; gap: var(--s-2); } }
.compat { display: flex; gap: var(--s-3); align-items: flex-start; }
.compat .icon { color: var(--c-success); width: 24px; height: 24px; }

/* --- Developers / docs ------------------------------------------------------ */
.dev-hero { position: relative; overflow: hidden; }
.dev-hero__inner { display: grid; gap: var(--s-6); align-items: center; padding-block: clamp(40px, 6vw, 80px); }
@media (min-width: 960px) { .dev-hero__inner { grid-template-columns: 1fr 1fr; } }
.doc-tiles { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); list-style: none; margin: 0; padding: 0; }
.doc-tile { display: grid; grid-template-rows: auto auto 1fr auto; gap: var(--s-2); height: 100%; text-decoration: none; color: var(--c-ink); }
.doc-tile__icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--brand-night); background: var(--brand-chip); clip-path: var(--notch-sm); margin-bottom: var(--s-2); }
.doc-tile__icon--yellow { background: var(--brand-cart); }
.doc-tile__icon--coral { background: #ff8a7a; }
.doc-tile__icon--mint { background: #5fe6b2; }
.doc-tile__icon--violet { background: #c4a6ff; }
.doc-tile__icon .icon { width: 24px; height: 24px; }
.doc-tile h3 { font-size: var(--fs-d-lg); }
.doc-tile p { color: var(--c-ink-2); font-size: .9375rem; margin: 0; }
.doc-tile__links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: var(--s-3); font-size: var(--fs-sm); font-weight: 600; }
.panel:has(.doc-tile__title a:focus-visible)::before { background: var(--c-focus-halo); }
.doc-tile__title a { color: inherit; text-decoration: none; }
.doc-tile__title a:hover { text-decoration: underline; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-5); counter-reset: s; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.steps li { counter-increment: s; display: grid; gap: 6px; align-content: start; padding-top: var(--s-4); border-top: 4px solid var(--c-line); }
.steps li::before { content: counter(s); font-family: var(--ff-display); font-size: 3rem; color: var(--brand-cart); line-height: 1; }
.steps h3 { font-size: var(--fs-d-md); }
.steps p { color: var(--c-ink-2); font-size: .9375rem; margin: 0; }

.docs { display: grid; gap: var(--s-6); padding-block: var(--s-6) var(--s-8); }
@media (min-width: 1000px) { .docs { grid-template-columns: 240px minmax(0, 1fr); gap: var(--s-7); } }
@media (min-width: 1280px) { .docs { grid-template-columns: 240px minmax(0, 1fr) 200px; } }
.docs__nav { font-size: .9375rem; }
@media (min-width: 1000px) { .docs__nav, .docs__toc { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; } }
.docs__nav h2 { font-size: 1.375rem; font-family: var(--ff-display); margin: var(--s-5) 0 var(--s-2); color: var(--c-ink); }
.docs__nav h2:first-child { margin-top: 0; }
.docs__nav details > summary { display: none; }
@media (max-width: 999px) {
  .docs__nav details { border: 2px solid var(--c-line); }
  .docs__nav details > summary { display: flex; justify-content: space-between; padding: 12px 16px; font-weight: 700; cursor: pointer; list-style: none; }
  .docs__nav details > summary::-webkit-details-marker { display: none; }
  .docs__nav details[open] > summary { border-bottom: 2px solid var(--c-line); }
  .docs__nav-inner { padding: var(--s-4); }
}
.docs__toc { display: none; font-size: var(--fs-sm); }
@media (min-width: 1280px) { .docs__toc { display: block; } }
.docs__toc h2 { font-size: var(--fs-sm); font-family: var(--ff-body); font-weight: 700; color: var(--c-ink); margin-bottom: var(--s-2); }
.docs__toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--c-line); }
.docs__toc a { display: block; padding: 4px 12px; color: var(--c-ink-2); text-decoration: none; margin-left: -2px; border-left: 2px solid transparent; }
.docs__toc a:hover { color: var(--c-ink); }
.docs__toc a[aria-current="true"] { color: var(--c-ink); border-left-color: var(--brand-cart); font-weight: 600; }
.docs__article .crumbs { margin-bottom: var(--s-4); }
.docs__article h1 { font-size: var(--fs-2xl); margin-bottom: var(--s-4); }
.docs__lede { font-size: var(--fs-md); color: var(--c-ink-2); line-height: 1.5; max-width: 60ch; }
.docs__meta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin: var(--s-4) 0 var(--s-6); font-size: var(--fs-sm); color: var(--c-ink-3); }
.docs__pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-8); max-width: var(--maxw-text); }
.docs__pager a { display: grid; gap: 2px; padding: var(--s-4); border: 2px solid var(--c-line); text-decoration: none; color: var(--c-ink); font-weight: 700; }
.docs__pager a:hover { border-color: var(--brand-cart); }
.docs__pager span { color: var(--c-ink-3); font-size: var(--fs-sm); font-weight: 400; }
.docs__pager a:last-child { text-align: right; }

/* --- Auth --------------------------------------------------------------- */
.auth { position: relative; display: grid; place-items: center; padding: clamp(32px, 6vw, 80px) var(--gutter); flex: 1; }
.auth__card { width: 100%; max-width: 460px; }
.auth__card--wide { max-width: 540px; }
.auth__title { font-size: var(--fs-xl); margin-bottom: var(--s-2); }
.auth__sub { color: var(--c-ink-2); margin-bottom: var(--s-5); }
.auth__alt { margin-top: var(--s-5); text-align: center; font-size: .9375rem; color: var(--c-ink-2); }
.auth__row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.dev-fields { margin-top: var(--s-4); padding: var(--s-4); border-left: 4px solid var(--brand-cart); background: var(--c-surface-2); }
.dev-fields[hidden] { display: none; }
.verify-art { display: grid; place-items: center; width: 88px; height: 88px; background: var(--brand-cart); color: var(--brand-night); clip-path: var(--notch); margin-bottom: var(--s-5); }
.verify-art .icon { width: 48px; height: 48px; }

/* --- Devices ---------------------------------------------------------------- */
.pair-steps { list-style: none; margin: 0 0 var(--s-5); padding: 0; display: grid; gap: var(--s-3); counter-reset: p; }
.pair-steps li { counter-increment: p; display: grid; grid-template-columns: 28px 1fr; gap: var(--s-3); color: var(--c-ink-2); }
.pair-steps li::before { content: counter(p); display: grid; place-items: center; width: 28px; height: 28px; background: var(--c-surface-3); color: var(--c-ink); font-family: var(--ff-display); font-size: 1.25rem; }
.pair-steps strong { color: var(--c-ink); }
.device-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }
.device { display: grid; gap: var(--s-4); grid-template-columns: 64px 1fr; align-items: start; }
@media (min-width: 760px) { .device { grid-template-columns: 64px 1fr auto; align-items: center; } }
.device__icon { display: grid; place-items: center; width: 64px; height: 64px; background: var(--c-surface-2); color: var(--brand-chip); clip-path: var(--notch-sm); }
.device__icon .icon { width: 40px; height: 40px; }
.device__name { font-family: var(--ff-display); font-size: 1.75rem; line-height: 1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.device__facts { display: flex; flex-wrap: wrap; gap: 4px var(--s-5); margin: 6px 0 0; font-size: var(--fs-sm); color: var(--c-ink-2); }
.device__facts div { display: flex; gap: 6px; }
.device__facts dt { color: var(--c-ink-3); }
.device__facts dd { margin: 0; font-weight: 600; color: var(--c-ink); }
.device__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; grid-column: 1 / -1; }
@media (min-width: 760px) { .device__actions { grid-column: auto; } }
.mono { font-family: var(--ff-mono); font-size: .9em; letter-spacing: .02em; }

/* --- Library ---------------------------------------------------------------- */
.lib-list { list-style: none; margin: 0; padding: 0; border: 2px solid var(--c-line); background: var(--c-surface); }
.lib-row { position: relative; display: grid; grid-template-columns: 72px 1fr; gap: var(--s-3) var(--s-4); align-items: center; padding: var(--s-3) var(--s-4); border-top: 2px solid var(--c-line); }
.lib-row:first-child { border-top: 0; }
@media (min-width: 820px) { .lib-row { grid-template-columns: 72px minmax(0, 1.4fr) minmax(0, 1fr) auto; } }
.lib-row:hover { background: var(--c-surface-2); }
.lib-row.is-selected { background: color-mix(in srgb, var(--c-select) 22%, var(--c-surface)); box-shadow: inset 4px 0 0 var(--brand-cart); }
.lib-row__cover { width: 72px; height: 72px; box-shadow: 0 0 0 2px var(--c-line); }
.lib-row__cover img { width: 100%; height: 100%; object-fit: cover; }
.lib-row__title { font-family: var(--ff-display); font-size: 1.5rem; line-height: 1; }
.lib-row__title a { color: inherit; text-decoration: none; }
.lib-row__title a:hover { text-decoration: underline; }
.lib-row__sub { color: var(--c-ink-2); font-size: var(--fs-sm); }
.lib-row__state { font-size: var(--fs-sm); color: var(--c-ink-2); display: grid; gap: 2px; }
.lib-row__actions { display: flex; gap: var(--s-2); grid-column: 1 / -1; flex-wrap: wrap; }
@media (min-width: 820px) { .lib-row__actions { grid-column: auto; justify-content: end; } }
.lib-summary { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); align-items: center; justify-content: space-between; margin-bottom: var(--s-5); }

/* --- Dev dashboard ------------------------------------------------------- */
.dash { display: grid; gap: var(--s-6); padding-block: var(--s-6) var(--s-8); }
@media (min-width: 1000px) { .dash { grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-7); } }
.dash__nav { align-self: start; }
@media (min-width: 1000px) { .dash__nav { position: sticky; top: calc(var(--header-h) + 24px); } }
@media (max-width: 999px) { .dash__nav .launcher { display: flex; overflow-x: auto; gap: 4px; border-bottom: 2px solid var(--c-line); } .dash__nav .launcher__item > a { white-space: nowrap; } .dash__nav-studio { display: none; } }
.dash__nav-studio { display: flex; gap: var(--s-3); align-items: center; margin-bottom: var(--s-5); }
.dash__nav-studio strong { display: block; line-height: 1.2; }
.dash__nav-studio div span { font-size: var(--fs-sm); color: var(--c-ink-2); }
.dash__head { display: flex; flex-wrap: wrap; gap: var(--s-4); justify-content: space-between; align-items: end; margin-bottom: var(--s-6); }
.dash__head h1 { font-size: var(--fs-2xl); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 2px; background: var(--c-line); border: 2px solid var(--c-line); margin: 0 0 var(--s-6); }
.stats > div { background: var(--c-surface); padding: var(--s-4) var(--s-5); }
.stats dt { font-size: var(--fs-sm); color: var(--c-ink-2); }
.stats dd { margin: 4px 0 0; font-family: var(--ff-display); font-size: 2.75rem; line-height: 1; }
.stats dd small { font-family: var(--ff-body); font-size: var(--fs-sm); font-weight: 600; color: var(--c-success); margin-left: 6px; }
.dash-grid { display: grid; gap: var(--s-5); }
@media (min-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.table--nowrap td { white-space: nowrap; }
.proj-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.proj { display: grid; grid-template-columns: 56px 1fr auto; gap: var(--s-4); align-items: center; padding: var(--s-3); border: 2px solid var(--c-line); background: var(--c-surface); }
.proj img { width: 56px; height: 56px; object-fit: cover; }
.proj__title { font-weight: 700; }
.proj__title a { color: inherit; text-decoration: none; }
.proj__title a:hover { text-decoration: underline; }
.proj__sub { font-size: var(--fs-sm); color: var(--c-ink-2); }
.keycard { display: grid; gap: var(--s-4); }
.keycard__status { display: flex; gap: var(--s-3); align-items: center; }
.keycard__badge { display: grid; place-items: center; width: 48px; height: 48px; background: var(--c-success-bg); color: var(--c-success); clip-path: var(--notch-sm); flex: none; }
.keycard__badge .icon { width: 24px; height: 24px; }
.fingerprint { font-family: var(--ff-mono); font-size: .8125rem; line-height: 1.6; overflow-wrap: anywhere; padding: var(--s-3); background: var(--c-surface-2); color: var(--c-ink-2); }
.dropzone { display: grid; justify-items: center; gap: var(--s-2); text-align: center; padding: var(--s-6) var(--s-4); border: 2px dashed var(--c-line-strong); background: var(--c-surface); color: var(--c-ink-2); }
.dropzone .icon { width: 36px; height: 36px; color: var(--brand-chip); }
.dropzone strong { color: var(--c-ink); }

/* --- Roadmap / news ---------------------------------------------------- */
.roadmap { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.roadmap li { position: relative; display: grid; grid-template-columns: 7em 1fr; gap: var(--s-4); padding: 0 0 var(--s-5); }
.roadmap li::before { content: ""; position: absolute; left: calc(7em + 10px); top: 8px; bottom: -8px; width: 4px; background: var(--c-line); }
.roadmap li:last-child::before { display: none; }
.roadmap__when { font-family: var(--ff-display); font-size: 1.375rem; line-height: 1.2; color: var(--c-ink-2); }
.roadmap__what { position: relative; padding-left: var(--s-5); }
.roadmap__what::before { content: ""; position: absolute; left: -12px; top: 6px; width: 16px; height: 16px; background: var(--c-surface-3); box-shadow: 0 0 0 4px var(--c-bg); }
.roadmap .is-done .roadmap__what::before { background: var(--c-success); }
.roadmap .is-now .roadmap__what::before { background: var(--brand-cart); }
.roadmap__what strong { display: block; }
.roadmap__what span { color: var(--c-ink-2); font-size: .9375rem; }
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }
.news a { display: grid; gap: 4px; padding: var(--s-4) 0; border-top: 2px solid var(--c-line); text-decoration: none; color: var(--c-ink); }
.news a:hover h3 { text-decoration: underline; }
.news time { color: var(--c-ink-3); font-size: var(--fs-sm); }
.news h3 { font-size: var(--fs-d-md); }
.news p { color: var(--c-ink-2); font-size: .9375rem; margin: 0; }

/* --- States gallery page ---------------------------------------------- */
.spec-sheet { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }
.spec-sheet__label { font-size: var(--fs-sm); color: var(--c-ink-3); margin-bottom: var(--s-3); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-3); list-style: none; padding: 0; margin: 0; }
.swatch { font-size: var(--fs-sm); }
.swatch span { display: block; height: 64px; margin-bottom: 6px; box-shadow: inset 0 0 0 2px rgba(127, 127, 127, .3); }
.swatch code { font-size: .8125rem; }

/* 7. Utilities ----------------------------------------------------------- */
.u-hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.u-muted { color: var(--c-ink-2); }
.u-mt-0 { margin-top: 0; } .u-mt-3 { margin-top: var(--s-3); } .u-mt-5 { margin-top: var(--s-5); } .u-mt-6 { margin-top: var(--s-6); } .u-mt-7 { margin-top: var(--s-7); }
.u-mb-0 { margin-bottom: 0; } .u-mb-4 { margin-bottom: var(--s-4); } .u-mb-5 { margin-bottom: var(--s-5); }
.u-center { text-align: center; }
.u-nowrap { white-space: nowrap; }
.u-display { font-family: var(--ff-display); }

/* Auth backdrop: a quiet pixel dot grid */
.is-auth main { display: flex; flex-direction: column; background-image: radial-gradient(var(--c-line) 1px, transparent 1.5px); background-size: 24px 24px; }

/* Game page: compact buy bar for small screens (the full buy box sits below the content there) */
.game-head__buy { display: none; }
@media (max-width: 999px) { .game-head__buy { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-4); background: var(--c-surface); border: 2px solid var(--brand-cart); } .game-head__buy .buy-box__price { font-size: 2.25rem; } }

/* ==========================================================================
   Portal (Laravel) additions
   ========================================================================== */
.nav__link[aria-disabled="true"] { color: var(--c-ink-3); cursor: default; }
.nav__link[aria-disabled="true"]:hover { background: none; color: var(--c-ink-3); }
.nav__soon { font-size: .6875rem; font-weight: 700; padding: 0 6px; line-height: 1.6; color: var(--c-ink-2); box-shadow: inset 0 0 0 1px var(--c-line-strong); }
.signout { display: inline-flex; align-items: center; gap: var(--s-2); margin: 0; }
.signout__handle { font-weight: 700; font-size: var(--fs-sm); color: var(--c-ink); }
.flash { margin-top: var(--s-4); }
.input--code {
  max-width: 320px; min-height: 64px; text-align: center; text-transform: uppercase; letter-spacing: .12em;
  font-family: var(--ff-display); font-size: 2.5rem; caret-color: var(--brand-cart);
}
.input--code::placeholder { color: var(--c-ink-3); opacity: .6; }
.soon-panel { display: grid; gap: var(--s-5); align-items: center; }
@media (min-width: 900px) { .soon-panel { grid-template-columns: 1.2fr 1fr; } }
.lscreen__cover--mark { display: grid; place-items: center; background: #0a1230; }
.lscreen__cover--mark svg { width: 62%; height: auto; }
.lscreen__cover--mark .logo__mark { fill: #31c2ff; }
.lscreen__cover--mark .logo__disc { fill: #000; }
.error-page { display: grid; place-items: center; text-align: center; padding: clamp(48px, 10vw, 120px) var(--gutter); }
.error-page__code { font-family: var(--ff-display); font-size: clamp(5rem, 18vw, 9rem); line-height: .9; color: var(--brand-cart); }
.error-page p { color: var(--c-ink-2); max-width: 44ch; margin-inline: auto; }

/* Phones: the signed-in block (avatar, handle, Sign out) lives in the mobile menu instead of the bar. */
@media (max-width: 640px) {
  .site-header__tools form.site-header__auth { display: none; }
}

/* Docs rendered from Markdown */
.docs__pages { list-style: none; margin: 0; padding: 0; }
.docs__pages a { display: block; padding: 5px 10px; color: var(--c-ink-2); text-decoration: none; border-left: 2px solid transparent; }
.docs__pages a:hover { color: var(--c-ink); }
.docs__pages a[aria-current="page"] { color: var(--c-ink); font-weight: 700; border-left-color: var(--brand-cart); }
.docs__body { max-width: 860px; overflow-wrap: anywhere; }
.docs__body table { width: 100%; border-collapse: collapse; margin: var(--s-5) 0; font-size: var(--fs-sm); display: block; overflow-x: auto; }
.docs__body th, .docs__body td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--c-line); vertical-align: top; }
.docs__body th { color: var(--c-ink); font-weight: 700; white-space: nowrap; }
.docs__body pre { background: var(--c-code-bg, #0b1226); color: #dfe8ff; padding: var(--s-4); overflow-x: auto; font-size: .875rem; line-height: 1.5; border: 2px solid var(--c-line); }
.docs__body :not(pre) > code { font-family: var(--ff-mono, ui-monospace, monospace); font-size: .9em; padding: 1px 5px; background: var(--c-surface-2, rgba(127,127,160,.15)); }
.docs__body h2, .docs__body h3, .docs__body h4 { scroll-margin-top: 90px; }
.docs__body h4 { font-size: 1.05rem; margin: var(--s-6) 0 var(--s-2); font-family: var(--ff-mono, monospace); }
.heading-anchor { margin-left: .4em; color: var(--c-ink-3); text-decoration: none; opacity: 0; }
.docs__body :is(h2, h3, h4):hover .heading-anchor { opacity: 1; }
@media (min-width: 960px) { .docs { grid-template-columns: 240px minmax(0, 1fr); } .docs__nav { position: sticky; top: 90px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; } }
.docs > * { min-width: 0; }
.docs__body :not(pre) > code { overflow-wrap: anywhere; word-break: break-word; }
.docs__body h1 code, .docs__body h2 code, .docs__body h3 code { background: none; padding: 0; font-size: inherit; }
.docs__body :not(pre) > code { white-space: normal; }
.docs__body table { max-width: 100%; }
.docs__body td code, .docs__body th code { white-space: normal; }

.docs__body img { max-width: 100%; height: auto; display: block; margin: var(--s-4) 0; border: 2px solid var(--c-line); }
