/* Studz site stylesheet.
   Served from /style.css?v=<content-hash> with immutable caching (see static_assets.rs).

   Sizing rule: every font size, gap, padding, radius and control height comes
   from the scale tokens in :root. Don't add raw px values for those; pick the
   nearest token so everything lines up.

   Colour rule: three toy-box primaries on neutral grays, nothing else, and
   no gradients. Each colour keeps the same meaning everywhere:
       red     the brand: header bar; highlights (favorites, "new",
               notifications); destructive actions, staff/official
       blue    do something, and "you are here": primary buttons, links,
               active tab/chip/page
       green   play, join, positive confirmation
   plus slate, a neutral dark gray for quiet secondary fills.
   Fills carry white text at >= 4.5:1.
   Older class names map onto these roles so markup doesn't churn:
     cyan, sky -> blue   orange, yellow, gold -> red   violet -> slate
   - Neutrals (--sky, --surface*, --ink, --muted, --line, --border) swap per theme.
   - --tx-* are the accent hues tuned for text on --surface (>= 4.5:1).
   Each fill has an -edge (1px border) and -shade (the chunky 3px under-shadow). */

:root {
  /* Type scale */
  --t-xs: 13px;   /* meta, badges, stats labels */
  --t-sm: 14px;   /* labels, buttons, secondary text */
  --t-md: 15px;   /* body */
  --t-lg: 18px;   /* card titles, lead text */
  --t-xl: 22px;   /* section headings */
  --t-2xl: 28px;  /* page headings */
  --t-hero: clamp(30px, 4.4vw, 44px);

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* Shape & controls */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --h-sm: 36px;   /* small buttons, header controls, chips */
  --h: 40px;      /* buttons, inputs */
  --h-lg: 48px;   /* primary calls to action */
  --head: 50px;       /* card header height */
  --bar-h: 56px;       /* nav bar height */
  --sticky-top: 0px;   /* room sticky elements leave above them (the nav bar, when it sticks) */

  /* The three accent fills (same in both themes). */
  --red: #c8372d;    --red-edge: #a82e26;    --red-shade: #82231d;
  --blue: #1a3f9e;   --blue-edge: #153382;   --blue-shade: #0f2662;
  --green: #2a7f39;  --green-edge: #1f6a2f;  --green-shade: #16501f;
  --slate: #3d4148;  --slate-edge: #2e3137;  --slate-shade: #202226;   /* neutral, not an accent */
  --live: #2fd35a;   /* presence dot only, never text */

  /* Role aliases (see the colour rule above). */
  --cyan: var(--blue);    --cyan-edge: var(--blue-edge);    --cyan-shade: var(--blue-shade);
  --orange: var(--red);   --orange-edge: var(--red-edge);   --orange-shade: var(--red-shade);
  --violet: var(--slate); --violet-edge: var(--slate-edge); --violet-shade: var(--slate-shade);
  --gold: var(--red);

  /* Light theme neutrals. --sky is the backdrop on both sides of the page
     column (a plain gray now; the name is historical); --on-sky is text
     placed directly on it (the footer). */
  --sky: #e6e8ec;
  --on-sky: #3a3e45;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --surface-3: #eceef1;
  --ink: #1d1f23;
  --muted: #5d6169;
  --line: #e3e5e9;
  --border: #cbcfd6;
  --link: #153382;
  --focus: #1a3f9e;
  --tx-blue: #153382;
  --tx-green: #1f6a2f;
  --tx-red: #a82e26;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 2px 8px rgba(20, 22, 26, .06);  /* resting cards */
  --shadow-lg: 0 10px 28px rgba(20, 22, 26, .16);   /* floating layers only: menus, dialogs */
  --stage-top: #eceef1;
  --stage-bottom: #f5f6f8;
  --stage-floor: rgba(26, 63, 158, .10);
  --tx-cyan: var(--tx-blue);
  --tx-orange: var(--tx-red);
  --tx-gold: var(--tx-red);
  --tx-violet: var(--ink);

  --font: "Montserrat", "Montserrat Fallback", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}

/* Dark theme: follows the OS unless the viewer picked light/dark (theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky: #111316;
    --on-sky: #b9bec7;
    --surface: #1c1e22;
    --surface-2: #23262b;
    --surface-3: #2b2e34;
    --ink: #eceef1;
    --muted: #a3a8b1;
    --line: #2f3238;
    --border: #41454d;
    --slate: #4a4f58; --slate-edge: #3a3e45; --slate-shade: #2a2d32;
    --link: #8fb4f0;
    --focus: #8fb4f0;
    --tx-blue: #8fb4f0;
    --tx-green: #74cc88;
    --tx-red: #ff8f86;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 28px rgba(0, 0, 0, .5);
    --stage-top: #23262b;
    --stage-bottom: #1c1e22;
    --stage-floor: rgba(143, 180, 240, .10);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sky: #111316;
  --on-sky: #b9bec7;
  --surface: #1c1e22;
  --surface-2: #23262b;
  --surface-3: #2b2e34;
  --ink: #eceef1;
  --muted: #a3a8b1;
  --line: #2f3238;
  --border: #41454d;
  --slate: #4a4f58; --slate-edge: #3a3e45; --slate-shade: #2a2d32;
  --link: #8fb4f0;
  --focus: #8fb4f0;
  --tx-blue: #8fb4f0;
  --tx-green: #74cc88;
  --tx-red: #ff8f86;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, .5);
  --stage-top: #23262b;
  --stage-bottom: #1c1e22;
  --stage-floor: rgba(143, 180, 240, .10);
  color-scheme: dark;
}

/* Arial scaled to Montserrat's metrics, so text doesn't jump when the web
   font arrives. */
@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("ArialMT"), local("Liberation Sans");
  size-adjust: 112.5%;
  ascent-override: 86%;
  descent-override: 22.3%;
  line-gap-override: 0%;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; scroll-padding-top: calc(var(--sticky-top) + var(--s-4)); }
body {
  min-height: 100vh;
  background: var(--sky);
  color: var(--ink);
  font: 500 var(--t-md)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 800; line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }
p { text-wrap: pretty; }
/* The nav bar sticks to the top on wide screens (on phones it wraps to two
   rows, too tall to pin). Sticky things below it leave room for it. */
@media (min-width: 861px) { :root { --sticky-top: var(--bar-h); } }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--blue); color: #fff; }
.icon { flex-shrink: 0; width: 20px; height: 20px; }
.muted { color: var(--muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pre-line { white-space: pre-line; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: var(--s-2); top: -100px; z-index: 100; padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); background: var(--blue); color: #fff; font-weight: 700; }
.skip:focus { top: var(--s-2); }

/* ---------- Shell: centered column ----------
   The illustrated banner sits on the sky; under it one white panel holds
   the nav bar and the page, with the sky showing on both sides. */
.site { display: flex; flex-direction: column; width: 100%; max-width: 1040px; min-height: 100vh; margin: 0 auto; padding: 0 var(--s-4); }
main { flex: 1; width: 100%; padding: var(--s-5) var(--s-5) var(--s-7); background: var(--surface); border-radius: 0 0 var(--r) var(--r); box-shadow: var(--shadow); }
main:focus { outline: none; }
@media (max-width: 600px) {
  .site { padding: 0; }
  main { padding: var(--s-4) var(--s-4) var(--s-6); border-radius: 0; }
}

/* The banner above the panel: the Studz logo (static/studz.png, 1600x600 with
   transparent padding) centred at the banner's height. */
.masthead { display: grid; place-items: center; height: 120px; margin: var(--s-3) 0; }
.masthead:hover { text-decoration: none; }
.masthead-logo { display: block; width: auto; max-width: 100%; height: 120px; object-fit: contain; transition: transform .2s; }
.masthead:hover .masthead-logo { transform: translateY(-2px); }
@media (max-width: 600px) { .masthead { height: 72px; margin: 0; } .masthead-logo { height: 72px; } }

/* The brand bar: strictly blue and white. White nav on blue, the current
   page as a white pill, and white-only buttons, so nothing else competes. */
.topbar {
  position: relative;
  top: 0;
  z-index: 40;
  background: var(--blue);
  border-bottom: 3px solid var(--blue-shade);
  border-radius: var(--r) var(--r) 0 0;
  box-shadow: 0 2px 10px rgba(20, 22, 26, .12);
  color: #fff;
}
@media (min-width: 861px) { .topbar { position: sticky; } }
@media (max-width: 600px) { .topbar { border-radius: 0; } }
.topbar-inner { display: flex; align-items: center; gap: var(--s-3); height: var(--bar-h); padding: 0 var(--s-4); }
.topbar :focus-visible { outline-color: #fff; }
.nav { display: flex; align-items: center; gap: var(--s-1); margin-left: calc(-1 * var(--s-2)); white-space: nowrap; }
.nav a {
  display: flex;
  align-items: center;
  height: var(--h-sm);
  padding: 0 var(--s-3);
  border-radius: 999px;
  color: #fff;
  font-size: var(--t-sm);
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.nav a:hover { background: rgba(255, 255, 255, .16); text-decoration: none; }
.nav a.active { background: #fff; color: var(--blue); }
/* Header buttons: solid white (primary) and white outline (secondary).
   Doubled class so they beat the .btn base rule defined further down. */
.btn.btn-bar { --fill: #fff; --edge: #fff; --shade: var(--blue-shade); --t: var(--blue); }
.btn.btn-bar:not(:disabled):hover { color: var(--blue); border-color: #fff; }
.btn.btn-bar-ghost { --fill: transparent; --edge: rgba(255, 255, 255, .7); --shade: transparent; --t: #fff; }
.btn.btn-bar-ghost:not(:disabled):hover { --fill: rgba(255, 255, 255, .14); border-color: #fff; color: #fff; }
/* Balance chip, next to the account menu. */
.wallet-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--h-sm);
  padding: 0 var(--s-3) 0 var(--s-2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: var(--t-sm);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.wallet-chip:hover, .wallet-chip.active { background: rgba(255, 255, 255, .24); text-decoration: none; }
.wallet-chip .icon { width: 18px; height: 18px; }
.wallet-chip .menu-dot { top: 3px; left: 20px; }
.search-btn {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: 1;
  max-width: 240px;
  height: var(--h-sm);
  margin-left: auto;
  padding: 0 var(--s-1) 0 var(--s-3);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
}
.search-btn:hover { background: rgba(255, 255, 255, .24); }
.search-btn .icon { width: 18px; height: 18px; }
.top-actions { display: flex; align-items: center; gap: var(--s-2); }
/* Closed-alpha layout: no nav or search, so push the log-in button right. */
.topbar-closed .top-actions { margin-left: auto; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--h);
  height: var(--h);
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }

.menu { position: relative; }
.menu > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: var(--h-sm);
  padding: 0 var(--s-2) 0 2px;
  border-radius: var(--r-sm);
  color: #fff;
  font-size: var(--t-sm);
  font-weight: 700;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { background: rgba(255, 255, 255, .16); }
.menu > summary img { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .2); }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s-2));
  z-index: 50;
  min-width: 220px;
  padding: var(--s-2);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.menu-list a, .menu-list button {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: var(--h);
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.menu-list a:hover, .menu-list button:hover { background: var(--surface-3); text-decoration: none; }
.menu-list :focus-visible { outline-color: var(--focus); }
/* Friend-request indicators: a dot on the account button, a count in the menu. */
.menu > summary { position: relative; }
/* Alerts are red: a dot on the blue bar, a count in the white menu. */
.menu-dot { position: absolute; top: 2px; left: 24px; width: 11px; height: 11px; border: 2px solid var(--blue); border-radius: 50%; background: var(--red); }
.count-pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: auto; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; }
.notice-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-5); padding: var(--s-3) var(--s-4); border: 1px solid color-mix(in srgb, var(--red) 35%, var(--surface)); border-left: 4px solid var(--red); border-radius: var(--r-sm); background: color-mix(in srgb, var(--red) 7%, var(--surface)); color: var(--tx-red); font-size: var(--t-sm); }
.notice-bar:hover { text-decoration: none; border-color: var(--red); }
.notice-bar span { font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-1) 0; }

@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: var(--s-2); gap: var(--s-2); }
  .nav { order: 3; width: 100%; height: 48px; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-2); overflow-x: auto; scrollbar-width: none; border-top: 1px solid rgba(255, 255, 255, .2); }
  .nav::-webkit-scrollbar { display: none; }
  .search-btn { flex: 0 0 auto; width: var(--h-sm); padding: 0; justify-content: center; }
  .search-btn span, .menu > summary span { display: none; }
  .menu > summary { padding: 0 var(--s-1); }
}

/* ---------- Buttons ----------
   Chunky pressed buttons: one flat fill, a 1px edge, and a solid 3px shade
   underneath; labels in bold caps. Pressing moves the button down onto its
   shade. */
.btn {
  --fill: var(--surface);
  --edge: var(--border);
  --shade: var(--border);
  --t: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: var(--h);
  padding: 0 var(--s-4);
  margin-bottom: 3px;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--fill);
  box-shadow: 0 3px 0 var(--shade);
  color: var(--t);
  font-size: var(--t-sm);
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: filter .15s, transform .12s, box-shadow .12s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--shade); }
.btn:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shade); }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: default; pointer-events: none; }
.btn:not(.btn-green, .btn-orange, .btn-yellow, .btn-violet, .btn-blue, .btn-red, .btn-cyan):hover { filter: none; border-color: var(--blue); color: var(--tx-blue); }
.btn-green  { --fill: var(--green);  --edge: var(--green-edge);  --shade: var(--green-shade);  --t: #fff; }
.btn-orange,
.btn-yellow { --fill: var(--orange); --edge: var(--orange-edge); --shade: var(--orange-shade); --t: #fff; }
.btn-violet { --fill: var(--slate);  --edge: var(--slate-edge);  --shade: var(--slate-shade);  --t: #fff; }
.btn-blue,
.btn-cyan,
.btn-primary { --fill: var(--blue);  --edge: var(--blue-edge);   --shade: var(--blue-shade);   --t: #fff; }
.btn-red    { --fill: var(--red);    --edge: var(--red-edge);    --shade: var(--red-shade);    --t: #fff; }
/* Kept for older markup; the plain white button. */
.btn-on-color { --fill: var(--surface); }
.btn-ghost { --fill: transparent; --edge: transparent; --shade: transparent; margin-bottom: 0; }
.btn-sm { height: var(--h-sm); padding: 0 var(--s-3); font-size: var(--t-xs); }
.btn-lg { height: var(--h-lg); padding: 0 var(--s-5); font-size: var(--t-md); }
.btn-block { width: 100%; }

/* Text-style button for inline actions (post tools etc.). */
.link-btn { padding: 0; border: 0; background: none; color: var(--link); font-size: inherit; font-weight: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--tx-red); }

/* ---------- Corner flags ----------
   A folded triangle in the corner of a thumbnail, with its label on it. */
.ribbon-wrap { position: relative; overflow: hidden; }
.ribbon {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 64px;
  height: 64px;
  padding: 9px 7px 0 0;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-align: right;
  text-transform: uppercase;
  pointer-events: none;
}
.ribbon-hot { background: var(--red); }
.ribbon-live { background: var(--green); }
/* Event flag: staff pin a game for an event and its label sits on the picture. */
.event-flag {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 2;
  max-width: calc(100% - 2 * var(--s-2));
  padding: 2px var(--s-2);
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--red);
  box-shadow: 0 2px 0 var(--red-shade);
  color: #fff;
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: .05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.game-hero .event-flag { top: var(--s-3); left: var(--s-3); padding: 4px var(--s-3); font-size: var(--t-sm); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: var(--head);
  padding: var(--s-2) var(--s-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.card-head h1, .card-head h2 { font-size: var(--t-lg); letter-spacing: 0; overflow-wrap: anywhere; }
.card-head a { font-size: var(--t-sm); font-weight: 700; }
/* Coloured header strips: accent fill, white text. */
.card-head:is(.blue, .violet, .cyan, .sky, .orange, .red, .green) { border-bottom: 0; color: #fff; }
.card-head.blue, .card-head.cyan, .card-head.sky { background: var(--blue); }
/* Form and account cards (the "violet" class) get the brand blue, like the nav. */
.card-head.violet { background: var(--blue); }
.card-head.orange { background: var(--orange); }
.card-head.red { background: var(--red); }
.card-head.green { background: var(--green); }
.card-head:is(.blue, .violet, .cyan, .sky, .orange, .red, .green) a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.card-body { padding: var(--s-4); }
.card-body > p + p { margin-top: var(--s-3); }
.notice { color: var(--muted); font-weight: 600; text-align: center; }

/* ---------- Hero banners ---------- */
/* A light blue sheet with dark text: the blue bar above stays the only
   solid-blue slab, so the two don't merge. */
.hero {
  position: relative;
  display: grid;
  align-items: center;
  margin-bottom: var(--s-6);
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--surface));
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--blue) 7%, var(--surface));
  color: var(--ink);
  overflow: hidden;
}
.hero-body { max-width: 680px; margin: 0 auto; padding: var(--s-7) var(--s-6); text-align: center; }

/* ---------- Closed alpha ---------- */
/* Slim reminder between the bar and the page for signed-in testers. */
.alpha-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s-1) var(--s-3);
  padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid color-mix(in srgb, var(--blue) 18%, var(--surface));
  background: color-mix(in srgb, var(--blue) 7%, var(--surface));
  color: var(--ink); font-size: var(--t-xs); font-weight: 600; text-align: center;
}
.alpha-strip b { color: var(--tx-blue); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.alpha-hero .hero-body { padding-block: calc(var(--s-7) * 1.5); }
.alpha-denied { margin: 0 auto var(--s-5); max-width: 520px; }
.alpha-points h2 { margin-bottom: var(--s-1); font-size: var(--t-lg); font-weight: 800; }
.alpha-points p { margin: 0; }
.hero .row { justify-content: center; }
.hero h1 { font-size: var(--t-hero); font-weight: 900; line-height: 1.08; letter-spacing: -.03em; }
.hero p { margin: var(--s-3) 0 var(--s-5); color: var(--muted); font-size: var(--t-lg); font-weight: 600; }
/* Small caps label above a heading. */
.eyebrow, .hero .eyebrow { margin: 0 0 var(--s-2); color: var(--tx-blue); font-size: var(--t-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 600px) { .hero-body { padding: var(--s-6) var(--s-4); } }

/* Signed-out home: the pitch on the left, today's top games on the right
   (one big, two small), so the first thing you see is what people made. */
@media (min-width: 760px) {
  .hero-home { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--s-2); }
  .hero-home .hero-body { margin: 0; padding-right: 0; text-align: left; }
  .hero-home .row { justify-content: flex-start; }
}
.hero-art { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); padding: 0 var(--s-5) var(--s-5); }
@media (min-width: 760px) { .hero-art { padding: var(--s-5) var(--s-5) var(--s-5) 0; } }
.hero-art a { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r); background: var(--surface-3); box-shadow: var(--shadow); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.hero-art a:first-child { grid-column: 1 / -1; }
.hero-art a:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.hero-art img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Hero stats line ---------- */
.hero .hero-stats { margin: var(--s-5) 0 0; color: var(--muted); font-size: var(--t-sm); font-weight: 600; }
.hero .hero-stats b { color: var(--ink); font-weight: 800; }

/* ---------- Home header (signed in) ---------- */
.home-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-4) var(--s-5); margin-bottom: var(--s-6); }
.home-avatar img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-3);
  transition: transform .2s;
}
.home-avatar:hover img { transform: scale(1.04); }
.home-hello { flex: 1; min-width: 220px; }
.home-hello h1 { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); overflow-wrap: anywhere; }
.home-hello p { color: var(--muted); font-size: var(--t-lg); font-weight: 600; }
@media (max-width: 600px) {
  .home-head { flex-direction: column; text-align: center; }
  .home-hello h1 { justify-content: center; }
}

/* ---------- Sections ---------- */
.section { margin-top: var(--s-6); }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; min-height: var(--h); margin-bottom: var(--s-3); }
.section-head h1, .section-head h2 { margin-right: auto; }
.section-head h1 { font-size: var(--t-2xl); font-weight: 900; }
.section-head h2 { display: flex; align-items: baseline; gap: var(--s-2); font-size: var(--t-xl); font-weight: 900; }
/* A short brand-blue bar before each section and page title. */
.section-head h2::before, .section-head > h1:not(.thread-title)::before, .page-head h1::before, .page-title::before {
  content: "";
  display: inline-block;
  align-self: center;
  width: 6px;
  height: .8em;
  margin-right: var(--s-2);
  border-radius: 3px;
  background: var(--blue);
  vertical-align: -.04em;
}
.section-head h2::before { margin-right: 0; }
.page-head h1, .page-title { font-weight: 900; }
.count { color: var(--muted); font-size: var(--t-md); font-weight: 700; }
.see-all { display: inline-flex; align-items: center; gap: 2px; font-size: var(--t-sm); font-weight: 700; }
.carousel-btns { display: flex; gap: var(--s-1); }
.carousel-btns[hidden] { display: none; }
.carousel-btn { width: var(--h-sm); height: var(--h-sm); border: 1px solid var(--border); border-radius: 50%; background: var(--surface); }
.carousel-btn:hover { border-color: var(--blue); color: var(--tx-blue); }
.carousel-btn.prev .icon { transform: scaleX(-1); }
@media (max-width: 700px) { .carousel-btns { display: none; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }

/* Sort / filter pills. */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-5); }
.chips a {
  display: inline-flex;
  align-items: center;
  height: var(--h-sm);
  padding: 0 var(--s-4);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 700;
}
.chips a:hover { border-color: var(--blue); text-decoration: none; }
.chips a.active { border-color: var(--blue); background: var(--blue); color: #fff; }

/* ---------- Game tiles ---------- */
.game-grid { display: grid; gap: var(--s-5) var(--s-4); grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.game-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 4 * var(--s-4)) / 5);
  gap: var(--s-4);
  margin: calc(-1 * var(--s-2));
  padding: var(--s-2) var(--s-2) var(--s-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--s-2);
  scrollbar-width: thin;
}
.game-row > * { scroll-snap-align: start; }
/* Positioned so absolutely placed children (sr-only labels) are clipped by the scroller. */
.game-row, .people-row, .game { position: relative; }
@media (max-width: 960px) { .game-row { grid-auto-columns: calc((100% - 3 * var(--s-4)) / 4); } }
@media (max-width: 700px) { .game-row { grid-auto-columns: 44%; } .game-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }

.game { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; border-radius: var(--r); color: var(--ink); }
.game:hover { text-decoration: none; }
.thumb { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r); background: var(--surface-3); overflow: hidden; }
.thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); pointer-events: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.game .thumb { margin-bottom: var(--s-1); transition: transform .15s, box-shadow .15s; }
.game:hover .thumb, .game:focus-visible .thumb { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.game:hover .game-name { text-decoration: underline; text-underline-offset: 2px; }
.game-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--t-md);
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.game-meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); color: var(--muted); font-size: var(--t-xs); font-weight: 700; }
.game-meta > span { display: inline-flex; align-items: center; gap: var(--s-1); }
.game-meta .is-live { color: var(--tx-green); }
.game-meta .tile-rating { color: var(--ink); }
.game-meta .icon { width: 14px; height: 14px; }
.game-meta .is-live::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--live); vertical-align: 1px; }

/* ---------- Game page ----------
   Screenshot on the left; on the right a "Creator: / Visits: " fact list,
   the favorite star, and a big PLAY. */
.game-page { display: grid; gap: var(--s-5); align-items: start; }
@media (min-width: 880px) { .game-page { grid-template-columns: minmax(0, 1fr) 340px; } }
.game-hero { aspect-ratio: 16 / 10; border-radius: var(--r-lg); background: var(--surface-3); overflow: hidden; }
.game-hero img { width: 100%; height: 100%; object-fit: cover; }
.game-hero .ribbon { width: 84px; height: 84px; padding: 12px 10px 0 0; font-size: var(--t-xs); }
.play-panel { display: flex; flex-direction: column; gap: var(--s-3); }
.play-panel h1 { font-size: var(--t-2xl); line-height: 1.15; overflow-wrap: anywhere; }
.play-panel .byline { margin-top: calc(-1 * var(--s-2)); margin-bottom: var(--s-1); color: var(--muted); font-weight: 600; }
.btn-play { height: 60px; font-size: var(--t-xl); letter-spacing: .06em; }

/* Rating: thumbs on either side of a like/dislike ratio bar. Your own vote
   fills its thumb (green for like, red for dislike). */
.rate { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s-2); }
.rate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--h-sm);
  padding: 0 var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--t-sm);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.rate-btn .icon { width: 18px; height: 18px; }
.rate-btn.up:not(:disabled):hover { border-color: var(--green); color: var(--tx-green); }
.rate-btn.down:not(:disabled):hover { border-color: var(--red); color: var(--tx-red); }
.rate-btn.up[aria-pressed="true"] { border-color: var(--green-edge); background: var(--green); color: #fff; }
.rate-btn.down[aria-pressed="true"] { border-color: var(--red-edge); background: var(--red); color: #fff; }
.rate-btn:disabled { opacity: .55; cursor: default; }
.rate-bar { height: 8px; border-radius: 999px; background: var(--red); overflow: hidden; }
.rate-bar span { display: block; width: var(--pct, 0%); height: 100%; background: var(--green); transition: width .3s; }
.rate-bar.is-empty { background: var(--surface-3); }
.rate-hint { margin: calc(-1 * var(--s-2)) 0 0; color: var(--muted); font-size: var(--t-xs); font-weight: 600; text-align: center; }

.btn-fav .icon { width: 18px; height: 18px; }
.btn-fav[aria-pressed="true"] .icon { fill: currentColor; }

/* Tip the creator: a label and three small amount buttons. */
.tip { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; padding-top: var(--s-3); border-top: 1px solid var(--line); }
.tip-label { color: var(--muted); font-size: var(--t-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tip-btns { display: flex; gap: var(--s-1); }
.tip-btns .btn { gap: 4px; padding: 0 var(--s-2); margin-bottom: 3px; }
.tip-btns .icon { width: 16px; height: 16px; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: var(--s-5) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  overflow: hidden;
}
/* Hairline separators without a filler colour showing in a half-empty last row. */
.stats div { display: flex; flex-direction: column-reverse; padding: var(--s-3) var(--s-4); box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.stats dt { color: var(--muted); font-size: var(--t-xs); font-weight: 700; }
.stats dd { margin: 0; font-size: var(--t-xl); font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* The last stat is the "Created" date: smaller so it fits on one line. */
.stats div:last-child dd { font-size: var(--t-md); line-height: 1.8; }
/* Favorites get the gold star. */
.stats dd[data-favorites]::before { content: "\2605"; margin-right: 6px; color: var(--gold); }

/* ---------- People ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--s-2);
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  vertical-align: middle;
  white-space: nowrap;
}
.badge-admin { background: var(--red); color: #fff; }
.badge-moderator { background: var(--blue); color: #fff; }
.badge-pin { background: color-mix(in srgb, var(--orange) 16%, var(--surface)); color: var(--tx-orange); }
.badge-ok { background: color-mix(in srgb, var(--green) 16%, var(--surface)); color: var(--tx-green); }
.badge-warn { background: color-mix(in srgb, var(--orange) 16%, var(--surface)); color: var(--tx-orange); }

/* Friends strip: round headshots in a scrolling row. */
.people-row { display: flex; gap: var(--s-4); margin: calc(-1 * var(--s-1)); padding: var(--s-1) var(--s-1) var(--s-2); overflow-x: auto; scrollbar-width: thin; }
.person { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); flex-shrink: 0; width: 92px; border-radius: var(--r); color: var(--ink); }
.person:hover { text-decoration: none; }
.person-pic {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface-3);
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.person-pic img { width: 100%; height: 100%; object-fit: cover; }
.person:hover .person-pic { border-color: var(--blue); transform: translateY(-2px); }
.person-playing { max-width: 100%; margin-top: -4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tx-green); font-size: 11px; font-weight: 800; }
.friend-who { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.friend-who img { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--stage-top); }
.friend-who span { display: flex; flex-direction: column; min-width: 0; }
.friend-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-xs); font-weight: 700; }

/* Online dot on friend avatars (only rendered in the viewer's own friend lists). */
.person { position: relative; }
.online-dot { position: absolute; width: 18px; height: 18px; border: 3px solid var(--surface); border-radius: 50%; background: var(--live); }
.person .online-dot { top: 62px; left: 66px; }
.avatar-wrap { position: relative; display: block; width: 100%; max-width: 96px; }
.avatar-wrap .online-dot { right: 2px; bottom: 2px; }
.user-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.user-grid.small { gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.user-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
  padding: var(--s-4) var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  text-align: center;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.user-tile:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.user-tile img { width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--surface-3); }
.user-tile b { max-width: 100%; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Profile ---------- */
.profile-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-5);
  padding: var(--s-5);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.profile-headshot { width: 112px; height: 112px; border-radius: 50%; background: var(--surface-3); }
.profile-id { flex: 1; min-width: 200px; }
.profile-id h1 { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); overflow-wrap: anywhere; }
.profile-id > p { font-weight: 600; }
.profile-counts { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-2); }
.profile-counts a { color: var(--muted); font-size: var(--t-sm); font-weight: 600; }
.profile-counts b { color: var(--ink); font-weight: 800; }
.profile-actions { align-self: center; }
.profile-grid { display: grid; gap: var(--s-4); margin-top: var(--s-4); align-items: start; }
@media (min-width: 880px) { .profile-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 600px) {
  .profile-head { flex-direction: column; text-align: center; }
  .profile-id h1, .profile-counts, .profile-actions { justify-content: center; }
}
.profile-stage { display: grid; place-items: center; }
.profile-avatar-wrap { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; }
.profile-avatar { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; border-radius: var(--r); background: var(--surface-3); }
.profile-viewer { position: absolute; inset: 0; border-radius: var(--r); overflow: hidden; background: var(--stage-top); }
.profile-avatar-wrap.is-3d .profile-avatar { visibility: hidden; }
.view3d {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: var(--h-sm);
  padding: 0 var(--s-4);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--t-xs);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--border);
}
.view3d:hover { border-color: var(--blue); color: var(--tx-blue); }
.view3d[aria-pressed="true"] { background: var(--blue); border-color: var(--blue-edge); color: #fff; box-shadow: 0 2px 0 var(--blue-shade); }
.view3d[aria-busy="true"] { opacity: .6; }

/* ---------- Simple lists (friends, forum activity) ---------- */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: var(--head); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row > a { font-weight: 700; }
.list-row .btn { margin-bottom: 2px; }
.list-row.stacked { flex-direction: column; align-items: stretch; justify-content: center; gap: 0; }
.list-row.stacked .muted { font-size: var(--t-xs); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: var(--s-4); }
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field label { font-size: var(--t-sm); font-weight: 700; }
.field small { font-size: var(--t-xs); color: var(--muted); }
.input {
  width: 100%;
  height: var(--h);
  padding: 0 var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--t-md);
  font-weight: 600;
  transition: border-color .12s;
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--blue); }
textarea.input { height: auto; min-height: 120px; padding: var(--s-2) var(--s-3); line-height: 1.5; resize: vertical; }
textarea.input.tall { min-height: 240px; }
.input.filter { width: 260px; max-width: 100%; height: var(--h-sm); border-radius: 999px; padding: 0 var(--s-4); }
select.input { appearance: auto; }
.alert { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); font-size: var(--t-sm); font-weight: 700; }
.alert[hidden] { display: none; }
.alert-error { background: color-mix(in srgb, var(--red) 10%, var(--surface)); color: var(--tx-red); border: 1px solid color-mix(in srgb, var(--red) 40%, var(--surface)); }
.alert-ok { background: color-mix(in srgb, var(--green) 10%, var(--surface)); color: var(--tx-green); border: 1px solid color-mix(in srgb, var(--green) 40%, var(--surface)); }
.auth { max-width: 440px; margin: var(--s-5) auto 0; }
.auth-foot { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: var(--t-sm); text-align: center; }
.settings { max-width: 680px; margin: 0 auto; }
.check { display: flex; align-items: flex-start; gap: var(--s-2); font-size: var(--t-sm); font-weight: 600; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--blue); }

/* ---------- Empty state ---------- */
.empty { grid-column: 1 / -1; padding: var(--s-6) var(--s-4); border: 2px dashed var(--line); border-radius: var(--r); color: var(--muted); font-size: var(--t-md); font-weight: 600; text-align: center; }
.empty[hidden] { display: none; }
.card .empty { border: 0; border-radius: 0; }

/* ---------- Download ---------- */
.steps { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 0; list-style: none; counter-reset: step; }
.steps li { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: var(--s-2); border-radius: 50%; background: var(--blue); box-shadow: 0 3px 0 var(--blue-shade); color: #fff; font-weight: 800; }
.steps b { font-size: var(--t-lg); }
.steps span { color: var(--muted); }

/* Download page: Linux install options. */
.dl-lead { max-width: 760px; margin-bottom: var(--s-4); }
.dl-options { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.dl-option { display: flex; flex-direction: column; }
.dl-option .card-body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: var(--s-3); }
.dl-option .card-body > .btn { margin-top: auto; }
.dl-foot { margin-top: var(--s-4); font-size: var(--t-sm); }
/* Copyable terminal command: wraps rather than scrolls; one click selects it. */
.cmd { align-self: stretch; margin: 0; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.cmd code { padding: 0; background: none; font-size: var(--t-sm); white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }

/* ---------- Prose (legal pages) ---------- */
.prose { max-width: 780px; margin: 0 auto; }
.prose .card-body { font-size: var(--t-md); line-height: 1.75; }
.prose .card-body > * + * { margin-top: var(--s-3); }
.prose h2 { margin-top: var(--s-5); font-size: var(--t-lg); }

/* ---------- Forum ---------- */
.crumbs { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-3); color: var(--muted); font-size: var(--t-sm); font-weight: 600; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }

/* Tables with a coloured header bar that carries the column labels. */
.ftable { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.forum-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 72px 180px;
  gap: var(--s-4);
  align-items: center;
  min-height: 64px;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line);
}
.ftable-head { min-height: 0; padding-top: var(--s-2); padding-bottom: var(--s-2); border-top: 0; color: #fff; font-size: var(--t-md); font-weight: 800; }
.ftable-head span:nth-child(2), .ftable-head span:nth-child(3) { text-align: center; font-size: var(--t-xs); }
.ftable-head + .forum-row { border-top: 0; }
.ftable-head.red { background: var(--red); }
.ftable-head.blue { background: var(--blue); }
.ftable-head.green { background: var(--green); }
.ftable-head.violet { background: var(--violet); }
.forum-row:not(.ftable-head):hover { background: var(--surface-2); }
.forum-row.pinned { background: color-mix(in srgb, var(--orange) 7%, var(--surface)); }
.forum-main { min-width: 0; }
.forum-main p { margin-top: 2px; font-size: var(--t-xs); }
.forum-main .badge { margin-left: var(--s-2); }
.forum-title { color: var(--ink); font-size: var(--t-md); font-weight: 800; overflow-wrap: anywhere; }
.forum-num { font-size: var(--t-md); font-weight: 700; text-align: center; }
.forum-last { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; font-size: var(--t-sm); font-weight: 600; text-align: right; }
.forum-last .muted { font-size: var(--t-xs); }
@media (max-width: 760px) {
  .forum-row { grid-template-columns: minmax(0, 1fr); gap: var(--s-1); }
  .ftable-head span:not(:first-child), .forum-num { display: none; }
  .forum-last { flex-direction: row; gap: var(--s-1); align-items: baseline; font-size: var(--t-xs); }
}

.forum-layout { display: grid; gap: var(--s-4); align-items: start; }
@media (min-width: 880px) { .forum-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.topic { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--line); }
.card-head + .topic { border-top: 0; }
.topic-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.topic-main > a { color: var(--ink); font-weight: 700; }
.topic-main .muted { font-size: var(--t-xs); }
/* Speech bubble holding a reply count. */
.bubble {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  min-width: 30px;
  height: 30px;
  margin-left: var(--s-2);
  padding: 0 var(--s-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 800;
}
.bubble::before { content: ""; position: absolute; left: -7px; top: 8px; border: 6px solid transparent; border-left: 0; border-right-color: var(--border); }
.thread-title { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; overflow-wrap: anywhere; }
.thread-stats { margin: calc(-1 * var(--s-3)) 0 var(--s-4); font-size: var(--t-sm); }

.post { display: grid; grid-template-columns: 160px minmax(0, 1fr); scroll-margin-top: calc(var(--sticky-top) + var(--s-4)); }
.post:target { border-color: var(--blue); outline: 3px solid var(--focus); outline-offset: 1px; }
.post-author {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-4) var(--s-3);
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--t-xs);
  text-align: center;
}
.post-author img { width: 96px; height: 96px; margin-bottom: var(--s-1); border-radius: 50%; background: var(--surface-3); }
.post-name { max-width: 100%; color: var(--ink); font-size: var(--t-md); font-weight: 800; overflow-wrap: anywhere; }
.post-main { display: flex; flex-direction: column; min-width: 0; padding: var(--s-4); }
.post-meta { display: flex; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.post-meta a { color: var(--muted); }
.post-body { flex: 1; font-size: var(--t-md); line-height: 1.65; overflow-wrap: anywhere; }
.post-body.removed { color: var(--muted); font-style: italic; }
.post-body blockquote, .report-excerpt {
  margin: var(--s-1) 0 var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-left: 3px solid var(--border);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-2);
  color: var(--muted);
}
.post-actions { display: flex; gap: var(--s-4); margin-top: var(--s-4); font-size: var(--t-sm); font-weight: 700; }
.post-actions:empty { display: none; }
@media (max-width: 640px) {
  .post { grid-template-columns: minmax(0, 1fr); }
  .post-author { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-right: 0; border-bottom: 1px solid var(--line); text-align: left; }
  .post-author img { width: var(--h-sm); height: var(--h-sm); margin: 0; }
}
.editor .spread small { font-size: var(--t-xs); }

.pager { display: flex; align-items: center; justify-content: center; gap: var(--s-1); flex-wrap: wrap; margin: var(--s-4) 0; }
.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--h-sm);
  height: var(--h-sm);
  padding: 0 var(--s-2);
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  font-weight: 700;
}
.pager a { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.pager a:hover { border-color: var(--blue); text-decoration: none; }
.pager .current { background: var(--blue); color: #fff; box-shadow: 0 2px 0 var(--blue-shade); }
.pager .gap { color: var(--muted); }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.layout-side { display: grid; gap: var(--s-4); align-items: start; }
@media (min-width: 880px) { .layout-side { grid-template-columns: 300px minmax(0, 1fr); } }
.grid-3 { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Footer ---------- */
.footer { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-5) var(--s-4) var(--s-6); color: var(--on-sky); font-size: var(--t-sm); font-weight: 600; text-align: center; }
.footer nav { display: flex; justify-content: center; gap: var(--s-2) var(--s-4); flex-wrap: wrap; }
.footer a, .footer .link-btn { color: var(--on-sky); font-weight: 800; }
.footer .link-btn { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Search dialog ---------- */
.palette {
  width: min(600px, calc(100% - 2 * var(--s-4)));
  margin: 10vh auto auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.palette::backdrop { background: rgba(10, 12, 16, .55); }
.palette-field { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-4); border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-field input { flex: 1; min-width: 0; height: var(--h-lg); border: 0; background: none; color: var(--ink); font-size: var(--t-lg); font-weight: 600; }
.palette-field input:focus { outline: none; }
.palette-field:focus-within { box-shadow: inset 0 -2px 0 var(--blue); }
.palette-results { max-height: 60vh; overflow-y: auto; padding: var(--s-2); }
.palette-results:empty { display: none; }
.palette-group { padding: var(--s-2) var(--s-3) var(--s-1); color: var(--muted); font-size: var(--t-xs); font-weight: 800; }
.palette-results a { display: flex; align-items: center; gap: var(--s-3); height: 48px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--ink); font-weight: 700; }
.palette-results a:hover { background: var(--surface-3); text-decoration: none; }
.palette-results a[aria-selected="true"] { background: var(--blue); color: #fff; }
.palette-results img { width: 48px; height: 30px; border-radius: 6px; background: var(--surface-3); object-fit: cover; }
.palette-results img.round { width: 32px; height: 32px; border-radius: 50%; }
.palette-results .none { padding: var(--s-4) var(--s-3); color: var(--muted); font-weight: 600; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--s-5);
  z-index: 70;
  max-width: calc(100% - 2 * var(--s-4));
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  background: #1b2430;
  color: #fff;
  font-size: var(--t-md);
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  transform: translate(-50%, 120%);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s, opacity .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--red); }

/* ---------- Avatar editor (DOM built by /editor/avatar-editor.js) ----------
   Viewport on the left, one tabbed panel on the right. Choices are native
   radio inputs (.pick-input) drawn as tiles (.pick-tile). */
.avatar-editor { display: grid; gap: var(--s-5); align-items: start; }
@media (min-width: 880px) {
  .avatar-editor { grid-template-columns: 300px minmax(0, 1fr); }
}
.avatar-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--stage-top);
  overflow: hidden;
}
.viewer-host { position: absolute; inset: 0; }
.viewer-canvas { width: 100%; height: 100%; cursor: grab; touch-action: none; outline: none; }
.viewer-canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.is-dragging .viewer-canvas { cursor: grabbing; }
.viewer-lost::after { content: "The 3D view stopped. Reload the page to bring it back."; position: absolute; inset: auto var(--s-3) var(--s-3); padding: var(--s-2); border-radius: var(--r-sm); background: rgba(0, 0, 0, .7); color: #fff; font-size: var(--t-xs); font-weight: 700; text-align: center; }
.avatar-loading, .avatar-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  max-width: calc(100% - 2 * var(--s-3));
  margin: 0;
  padding: var(--s-1) var(--s-3);
  border-radius: 999px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: var(--t-xs);
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}
.avatar-loading { top: 50%; transform: translate(-50%, -50%); }
.avatar-hint { bottom: var(--s-3); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-tools { position: absolute; top: var(--s-3); right: var(--s-3); display: flex; gap: var(--s-1); }
.tool-btn {
  display: grid;
  place-items: center;
  width: var(--h-sm);
  height: var(--h-sm);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.tool-btn:hover { border-color: var(--blue); }
.tool-btn:disabled { opacity: .4; cursor: default; border-color: var(--line); }
.tool-btn .icon { width: 18px; height: 18px; }
.avatar-fallback { width: 100%; height: 100%; object-fit: contain; }

.avatar-panel-head { padding: 0 var(--s-4); border-bottom: 1px solid var(--line); }
.save-state { order: -1; min-height: 20px; color: var(--muted); font-size: var(--t-xs); font-weight: 700; }
.save-state.is-error { color: var(--tx-red); }
.tabs { display: flex; gap: var(--s-1); margin-bottom: -1px; }
.tabs [role="tab"] {
  flex: 1;
  height: var(--h);
  padding: 0 var(--s-2);
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--muted);
  font-size: var(--t-sm);
  font-weight: 700;
  cursor: pointer;
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--tx-blue); border-bottom-color: var(--blue); }
.tab-panel { display: flex; flex-direction: column; gap: var(--s-4); }
.tab-panel[hidden] { display: none; }
.tab-panel > p { font-size: var(--t-sm); }

/* Radio tiles */
.pick { position: relative; display: block; cursor: pointer; }
.pick-input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.pick-tile { display: block; border: 2px solid var(--line); border-radius: var(--r-sm); }
.pick:hover .pick-tile { border-color: var(--muted); }
.pick-input:checked + .pick-tile { border-color: var(--blue); }
.pick-input:focus-visible + .pick-tile { outline: 3px solid var(--focus); outline-offset: 2px; }

.part-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.part-tile { display: flex; flex-direction: column; align-items: center; gap: var(--s-1); padding: var(--s-2) var(--s-1); font-size: var(--t-xs); font-weight: 700; }
.pick-input:checked + .part-tile { background: color-mix(in srgb, var(--blue) 10%, var(--surface)); color: var(--tx-blue); }
.part-dot { width: 22px; height: 22px; border: 1px solid rgba(0, 0, 0, .15); border-radius: 6px; }

.swatch-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.swatch { aspect-ratio: 1; border-color: rgba(0, 0, 0, .12); }
.pick-input:checked + .swatch { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--surface); }
.custom-color { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); font-weight: 700; cursor: pointer; }
.color-input { width: var(--h-sm); height: var(--h-sm); padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: none; cursor: pointer; }

.face-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.face-tile { aspect-ratio: 1; overflow: hidden; background: #f1c27d; }
/* Decal art occupies the middle ~half of the texture (see the head shader's UV window). */
.face-tile img { width: 100%; height: 100%; object-fit: contain; transform: scale(1.8); }

.shot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.shot-tile { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-2); font-size: var(--t-sm); font-weight: 700; text-align: center; }
.shot-tile img { width: 100%; height: auto; aspect-ratio: 1; border-radius: 6px; background: var(--surface-3); }
.avatar-guest { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-6); text-align: center; }

/* Editor: camera buttons, wearing strip, figure, filters, outfits */
.viewer-views { position: absolute; bottom: var(--s-2); right: var(--s-2); display: flex; gap: var(--s-1); }
.tool-text { width: auto; padding: 0 var(--s-3); font-size: var(--t-xs); font-weight: 800; }
.avatar-panel .tabs { overflow-x: auto; scrollbar-width: none; }
.avatar-panel .tabs [role="tab"] { flex: 1 1 auto; padding: 0 6px; font-size: var(--t-xs); }
.clan-tag { color: var(--muted); font-weight: 800; }
a.clan-tag:hover { color: var(--link); }
.mini-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); }
.avatar-stage { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.av-heading { margin-top: var(--s-3); padding-bottom: var(--s-1); border-bottom: 2px solid var(--line); font-size: var(--t-md); font-weight: 800; }
.wearing { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.wearing-empty { grid-column: 1 / -1; }
.wear-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: var(--s-1); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: 11px; font-weight: 700; cursor: pointer; }
.wear-tile img { width: 100%; height: auto; aspect-ratio: 1; background: var(--stage-top); object-fit: contain; }
.wear-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wear-x { position: absolute; top: 0; right: 0; z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 0 var(--r-sm) 0 var(--r-sm); background: var(--red); color: #fff; font-size: 14px; line-height: 1; }
.wear-tile:hover { border-color: var(--red); }
.shot-row { display: flex; gap: var(--s-2); }
.shot-row .pick { flex: 1; }
.shot-row .shot-tile { padding: var(--s-2); font-size: var(--t-sm); font-weight: 700; text-align: center; }
.subtabs { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); justify-content: center; }
.subtabs[hidden] { display: none; }
.subtab { padding: 2px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: var(--t-sm); font-weight: 700; cursor: pointer; }
.subtab:hover { color: var(--ink); }
.subtab[aria-pressed="true"] { color: var(--tx-blue); border-bottom-color: var(--blue); }
.pager { display: flex; justify-content: center; gap: var(--s-2); }
.pager:empty { display: none; }
.page-btn { padding: 0 2px; border: 0; background: none; color: var(--link); font-size: var(--t-sm); font-weight: 700; cursor: pointer; }
.page-btn[aria-current="page"] { color: var(--ink); text-decoration: underline; cursor: default; }
.face-picks { grid-template-columns: repeat(4, 1fr); }
.item-face { display: block; }

.body-top { display: flex; gap: var(--s-4); align-items: flex-start; }
.figure { flex: none; width: 112px; height: auto; }
.figure-part { stroke: rgba(0, 0, 0, .25); stroke-width: 1.5; cursor: pointer; outline: none; }
.figure-part:hover { stroke: var(--muted); stroke-width: 2; }
.figure-part.is-selected { stroke: var(--blue); stroke-width: 3; }
.figure-part:focus-visible { stroke: var(--focus); stroke-width: 3; }
.body-side { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.panel-title { font-size: var(--t-lg); }
.panel-label { margin-top: var(--s-1); font-size: var(--t-xs); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.skin-row { display: flex; flex-wrap: wrap; gap: 6px; }
.skin-chip { width: 30px; height: 30px; padding: 0; border: 2px solid rgba(0, 0, 0, .12); border-radius: 50%; cursor: pointer; }
.skin-chip:hover { border-color: var(--muted); }
.skin-chip[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--surface); }
.skin-chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.item-tools { display: flex; flex-direction: column; gap: var(--s-2); }
.input-sm { height: var(--h-sm); font-size: var(--t-sm); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.chips[hidden] { display: none; }
.chip { height: 28px; padding: 0 var(--s-3); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: var(--t-xs); font-weight: 700; cursor: pointer; }
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: #fff; }
.item-pick { position: relative; }
.item-pick::after { content: "+"; position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 0 var(--r-sm) 0 var(--r-sm); background: var(--green); color: #fff; font-size: 15px; font-weight: 800; }
.item-pick[aria-pressed="true"]::after { content: "\2713"; background: var(--blue); font-size: 12px; }

.outfit-save { display: flex; flex-direction: column; gap: var(--s-2); }
.outfit-list { display: flex; flex-direction: column; gap: var(--s-2); }
.outfit { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.outfit-dots { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; flex: none; }
.outfit-dot { width: 14px; height: 14px; border: 1px solid rgba(0, 0, 0, .15); border-radius: 4px; }
.outfit-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.outfit-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-tile img { background: var(--stage-top); }

@media (max-width: 879px) {
  .avatar-viewport { max-height: 50vh; margin: 0 auto; }
}

/* ---------- Auth & account pages ---------- */
.small { font-size: var(--t-xs); }
.small-link { font-size: var(--t-xs); font-weight: 700; }
.fineprint { color: var(--muted); font-size: var(--t-xs); text-align: center; }
.resend { display: flex; flex-direction: column; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px dashed var(--line); text-align: center; }
.resend[hidden] { display: none; }
.turnstile { min-height: 65px; }
.turnstile-error { display: flex; align-items: center; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.sent-panel { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-6) var(--s-5); text-align: center; }
.sent-panel[hidden] { display: none; }
.sent-panel .btn { margin-top: var(--s-2); }
.sent-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--blue); box-shadow: 0 4px 0 var(--blue-shade); color: #fff; font-size: 30px; font-weight: 800; }
.sent-icon.ok { background: var(--green); box-shadow: 0 4px 0 var(--green-shade); }
.sent-icon.bad { background: var(--orange); box-shadow: 0 4px 0 var(--orange-shade); }
.status-card { max-width: 520px; }
.status-details:empty { display: none; }
.status-details { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); background: var(--surface-2); }
.status-row span { color: var(--muted); font-size: var(--t-xs); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Settings ---------- */
/* Side menu on the left, one section on the right (a tab row on phones). */
.page-title { margin-bottom: var(--s-4); }
.settings-layout { display: grid; gap: var(--s-5); align-items: start; }
@media (min-width: 760px) { .settings-layout { grid-template-columns: 200px minmax(0, 1fr); } }
.settings-sections { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; max-width: 640px; }
[data-section][hidden] { display: none; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { display: flex; align-items: center; height: var(--h); padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--ink); font-size: var(--t-sm); font-weight: 700; }
.settings-nav a:hover { background: var(--surface-3); text-decoration: none; }
.settings-nav a[aria-current="page"] { background: var(--blue); color: #fff; }
.settings-nav a.danger { color: var(--tx-red); }
.settings-nav a.danger[aria-current="page"] { background: var(--red); color: #fff; }
@media (max-width: 759px) {
  .settings-nav { flex-direction: row; gap: 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
  .settings-nav a { flex-shrink: 0; border-radius: 0; border-bottom: 3px solid transparent; }
  .settings-nav a[aria-current="page"] { background: none; color: var(--tx-blue); border-bottom-color: var(--blue); }
  .settings-nav a.danger[aria-current="page"] { background: none; color: var(--tx-red); border-bottom-color: currentColor; }
}

.kv { display: flex; flex-direction: column; gap: 2px; }
.kv span { color: var(--muted); font-size: var(--t-xs); font-weight: 700; }
.kv b { overflow-wrap: anywhere; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
code { padding: 1px 5px; border-radius: 4px; background: var(--surface-3); font-size: .92em; }
.input.mono { letter-spacing: .12em; text-transform: uppercase; }
.danger-zone { border-color: color-mix(in srgb, var(--red) 45%, var(--surface)); }

/* ---------- Wallet ----------
   Balance (the one blue block), today's reward, and a short how-to, in a
   row on wide screens; the ledger underneath. */
.wallet { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 760px) { .wallet { grid-template-columns: 1.1fr 1fr 1fr; } }
.wallet > section { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.wallet h2 { font-size: var(--t-lg); }
.wallet p { color: var(--muted); font-size: var(--t-sm); }
.wallet > .wallet-balance { justify-content: center; border-color: var(--blue-edge); background: var(--blue); box-shadow: 0 4px 0 var(--blue-shade); color: #fff; }
.wallet-label, .wallet-unit { font-size: var(--t-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.wallet-amount { display: flex; align-items: center; gap: var(--s-2); font-size: 44px; font-weight: 900; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wallet-amount .icon { width: 36px; height: 36px; }
.wallet-daily .btn { margin-top: auto; }
.wallet .wallet-note { margin: 0; text-align: center; font-size: var(--t-xs); font-weight: 700; }
.wallet-help ul { margin: 0; padding-left: 1.1em; color: var(--muted); font-size: var(--t-sm); line-height: 1.7; }
.table .credit { color: var(--tx-green); font-weight: 800; }
.table .debit { color: var(--tx-red); font-weight: 800; }

/* ---------- Game owner tools ---------- */
details.manage { margin-top: var(--s-5); }
details.manage > summary { list-style: none; cursor: pointer; }
details.manage > summary::-webkit-details-marker { display: none; }
details.manage > summary::after { content: "\25BE"; color: var(--muted); font-weight: 800; transition: transform .15s; }
details.manage[open] > summary::after { transform: rotate(180deg); }
details.manage:not([open]) > summary { border-bottom: 0; }
.manage-hint { margin-left: auto; color: var(--muted); font-size: var(--t-xs); font-weight: 700; }
.manage-thumb { border-top: 1px solid var(--line); }
.file-btn { position: relative; }

/* ---------- Bar panels (coloured header bar + body), e.g. the staff panel ---------- */
.bar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; min-height: var(--head); padding: var(--s-2) var(--s-4); color: #fff; }
.bar-head h1 { font-size: var(--t-xl); }
.violet-bar { background: var(--slate); }   /* staff panel: quiet, so its content stands out */
.bar-tabs { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.bar-tabs a { display: flex; align-items: center; height: var(--h-sm); padding: 0 var(--s-3); border-radius: 999px; color: #fff; font-size: var(--t-sm); font-weight: 700; white-space: nowrap; }
.bar-tabs a:hover { background: rgba(255, 255, 255, .16); text-decoration: none; }
.bar-tabs a.active, .bar-tabs a[aria-current="page"] { background: #fff; color: var(--ink); }
.bar-body { padding: var(--s-4); }

/* ---------- Staff panel ---------- */
.mod-stats { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: var(--s-4); }
.mod-stat { display: flex; flex-direction: column; padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); }
a.mod-stat:hover { border-color: var(--violet); text-decoration: none; }
.mod-stat b { font-size: var(--t-2xl); font-weight: 800; line-height: 1.1; }
.mod-stat span { color: var(--muted); font-size: var(--t-xs); font-weight: 700; }
.mod-search { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-2); }
.mod-search .input[type="search"] { flex: 1; min-width: 200px; }
.mod-search select { width: auto; }
.mod-search .btn { margin-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th { padding: var(--s-2) var(--s-3); background: var(--surface-2); color: var(--muted); font-size: var(--t-xs); font-weight: 800; text-align: left; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table td { padding: var(--s-2) var(--s-3); border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table .wrap { min-width: 240px; overflow-wrap: anywhere; }
.table .actions { text-align: right; white-space: nowrap; }
.table .btn { margin-bottom: 2px; }
.mod-user { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.mod-user .muted { font-size: var(--t-xs); }
@media (max-width: 700px) { .hide-sm { display: none; } }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 var(--s-2); border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.pill-green { background: color-mix(in srgb, var(--green) 15%, var(--surface)); color: var(--tx-green); }
.pill-orange { background: color-mix(in srgb, var(--orange) 15%, var(--surface)); color: var(--tx-orange); }
.pill-red { background: color-mix(in srgb, var(--red) 15%, var(--surface)); color: var(--tx-red); }
.pill-violet { background: color-mix(in srgb, var(--violet) 15%, var(--surface)); color: var(--tx-violet); }
.inquiry .card-head h2 { font-size: var(--t-md); }

/* ---------- Modal dialog ---------- */
dialog.modal {
  width: min(560px, calc(100% - 2 * var(--s-4)));
  max-height: calc(100vh - 2 * var(--s-5));
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .45);
}
dialog.modal::backdrop { background: rgba(10, 12, 16, .55); }
.modal-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.modal-head h2 { font-size: var(--t-lg); overflow-wrap: anywhere; }
.modal-close { width: var(--h-sm); height: var(--h-sm); border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font-size: var(--t-xl); line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
.modal-body { padding: var(--s-4); }
.mod-form + .mod-form { padding-top: var(--s-4); border-top: 1px solid var(--line); }
.mod-form h3 { font-size: var(--t-md); }
/* Confirm / prompt dialog built by app.js (ask). */
dialog.ask { width: min(440px, calc(100% - 2 * var(--s-4))); }
.ask h2 { font-size: var(--t-lg); overflow-wrap: anywhere; }
.ask .ask-actions { justify-content: flex-end; }

/* ---------- Motion ----------
   Everything that moves on its own sits behind no-preference; hover and
   press feedback is switched off entirely for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  main > * { animation: rise-in .4s cubic-bezier(.2, .8, .2, 1) backwards; }
  main > :nth-child(2) { animation-delay: .04s; }
  main > :nth-child(3) { animation-delay: .08s; }
  main > :nth-child(n+4) { animation-delay: .12s; }
  .btn-orange[aria-pressed="true"] { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
  .ribbon { animation: ribbon-in .45s .25s cubic-bezier(.3, 1.6, .5, 1) backwards; }
  .game-row, .people-row { scroll-behavior: smooth; }
}
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { 40% { transform: scale(1.08); } }
@keyframes ribbon-in { from { transform: translate(20px, -20px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .btn:not(:disabled):hover, .btn:not(:disabled):active, .game:hover .thumb, .game:focus-visible .thumb, .user-tile:hover, .person:hover .person-pic, .home-avatar:hover img, .hero-art a:hover { transform: none; }
}

/* Windows High Contrast / forced colours: keep boundaries and focus visible. */
@media (forced-colors: active) {
  .btn, .chips a, .card, .input, .search-btn, .pick-tile { border: 1px solid CanvasText; }
  .pick-input:checked + .pick-tile, .tabs [aria-selected="true"] { outline: 2px solid Highlight; }
  .chips a.active, .palette-results a[aria-selected="true"] { outline: 2px solid Highlight; }
}

/* ---------- Catalog (avatar shop) ----------
   Item renders are square and share the avatar render's flat backdrop. */
.item-grid .thumb { aspect-ratio: 1; background: var(--stage-top); }
.item-grid .thumb img { object-fit: contain; }
.item-price { color: var(--ink); }
.wallet-note { margin: 0; color: var(--muted); text-align: center; font-size: var(--t-xs); font-weight: 700; }
.item-page .play-panel .pre-line { color: var(--ink); }
.item-stage { position: relative; aspect-ratio: 1; max-height: 70vh; margin-inline: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--stage-top); overflow: hidden; }
.item-stage .item-render { width: 100%; height: 100%; object-fit: contain; }
.item-stage.is-3d .item-render { visibility: hidden; }
.item-stage .view3d { right: var(--s-3); bottom: var(--s-3); }
.item-mini { display: block; width: 48px; height: 48px; border-radius: var(--r-sm); background: var(--stage-top); object-fit: contain; }

/* Staff editor: fit sliders, each with a number box for exact values. */
.fit { display: grid; gap: var(--s-2); margin: 0; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); }
.fit legend { padding: 0 var(--s-1); font-size: var(--t-sm); font-weight: 800; }
.fit-field { display: grid; grid-template-columns: 72px minmax(0, 1fr) 84px; align-items: center; gap: var(--s-2); font-size: var(--t-xs); font-weight: 700; }
.fit-range { width: 100%; accent-color: var(--blue); }
.input.input-sm { height: var(--h-sm); padding: 0 var(--s-2); font-size: var(--t-sm); }
.fit .link-btn { justify-self: start; font-size: var(--t-xs); font-weight: 700; }
/* Fields that only apply to 3D items or only to faces. */
[data-model-only][hidden], [data-face-only][hidden] { display: none; }
.item-server-render { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-3) 0 0; color: var(--muted); font-size: var(--t-xs); font-weight: 700; }
.item-server-render img { width: 80px; height: 80px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--stage-top); }

/* Avatar editor "Items" tab: owned items as toggles. */
.item-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); margin: var(--s-2) 0; }
@media (max-width: 520px) { .item-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.item-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: var(--s-1) var(--s-1) var(--s-2); border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); cursor: pointer; }
.item-pick:hover { border-color: var(--muted); }
.item-pick[aria-pressed="true"] { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, var(--surface)); }
.item-pick:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.item-pick img { width: 100%; height: auto; aspect-ratio: 1; border-radius: 4px; background: var(--stage-top); object-fit: contain; }
.item-pick-name { max-width: 100%; overflow: hidden; font-size: var(--t-xs); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.item-pick-slot { color: var(--muted); font-size: 11px; font-weight: 700; }
.item-pick[aria-pressed="true"] .item-pick-slot { color: var(--tx-blue); }
/* Stock status over an item picture (catalog tiles and the item page). A
   pill instead of the corner ribbon, which only fits a short word. */
.item-flag {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--s-2);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.item-flag.is-limited { background: var(--red); color: #fff; }
.item-flag.is-out { background: var(--ink); color: var(--surface); }
.item-stage .item-flag { top: var(--s-3); left: var(--s-3); }
.item.is-sold-out .thumb img { opacity: .55; filter: grayscale(.6); }
/* ---------- Polycarbonate authorization + developer hub ---------- */
.studio-who { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.studio-who img { width: 64px; height: 64px; border-radius: var(--r); background: var(--surface-3); }
.studio-who b { display: block; font-size: var(--t-lg); overflow-wrap: anywhere; }
.studio-who small { color: var(--muted); }
.studio-perms { display: grid; gap: var(--s-2); margin: var(--s-3) 0; padding-left: var(--s-5); }
.studio-auth .fineprint { margin: var(--s-3) 0; text-align: left; }
.studio-auth .form + .form { margin-top: var(--s-2); }
.hub-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: var(--s-4); }
.hub-game .card-body h2 { font-size: var(--t-md); overflow-wrap: anywhere; }
.hub-game .card-body > * + * { margin-top: var(--s-2); }
.hub-game .thumb { display: block; border-radius: 0; }
.hub-top { margin-bottom: var(--s-4); }
.hub-top .card-body > * + * { margin-top: var(--s-2); }
.hub-stack { display: grid; gap: var(--s-4); }
.hub-new { margin-bottom: var(--s-5); }

/* Game passes and badges: developer cards, the game page, profiles */
.dev-items { display: grid; gap: var(--s-4); }
.dev-item { padding: var(--s-4); }
.dev-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.dev-item-head h3 { font-size: var(--t-lg); overflow-wrap: anywhere; }
.dev-item-stats { display: flex; gap: var(--s-5); margin: var(--s-3) 0; color: var(--muted); font-size: var(--t-sm); }
.dev-item-stats b { color: var(--ink); font-size: var(--t-lg); }
.dev-item details.manage { margin-top: var(--s-2); }
.dev-item .card-head h4 { font-size: var(--t-md); }
.pass-row { align-items: center; }
.pass-info { display: flex; flex-direction: column; min-width: 0; }
.pass-info small { overflow-wrap: anywhere; }
.pass-row .btn .icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 2px; }
.badge-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin: 0; padding: 0; list-style: none; }
.badge-tile { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); color: var(--muted); }
.badge-tile b { color: var(--ink); overflow-wrap: anywhere; }
.badge-tile small { font-size: var(--t-xs); overflow-wrap: anywhere; }
.badge-tile .badge-meta { margin-top: var(--s-1); font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.badge-tile:not(.is-earned) { opacity: .75; }
.badge-tile.is-earned { border-color: var(--blue-edge); background: color-mix(in srgb, var(--blue) 8%, var(--surface)); box-shadow: inset 4px 0 0 var(--blue); }
.badge-tile.is-earned .badge-meta { color: var(--tx-blue); }

/* Hub: games table, sparklines, charts, tabs, script console */
.page-head ~ .mod-stats { margin-top: var(--s-4); }
.hub-body .mod-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.hub-table td { vertical-align: middle; }
.hub-name { display: flex; align-items: center; gap: var(--s-3); min-width: 220px; }
.hub-name b { overflow-wrap: anywhere; }
.hub-name .badge { margin-top: 2px; }
.hub-mini { flex: none; display: block; width: 64px; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r-sm); background: var(--surface-3); }
.hub-mini img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hub-spark { white-space: nowrap; }
.hub-spark small { display: block; }
.spark { display: block; width: 84px; height: 26px; }
.chart { display: block; width: 100%; height: 120px; }
.bar { fill: var(--blue); }
.chart-alt .bar { fill: var(--slate); }
.bar.zero { fill: var(--border); }
.chart-axis { display: flex; justify-content: space-between; margin-top: var(--s-1); color: var(--muted); font-size: var(--t-xs); font-weight: 700; }
.hub-charts { margin-bottom: var(--s-4); }
.hub-body > .card + .card, .hub-body > .grid-2 + .card { margin-top: var(--s-4); }
.hub-tabs { display: flex; gap: var(--s-1); margin: var(--s-3) 0 var(--s-4); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.hub-tabs a { display: flex; align-items: center; gap: var(--s-1); flex-shrink: 0; height: var(--h); padding: 0 var(--s-4); border-bottom: 3px solid transparent; margin-bottom: -1px; color: var(--muted); font-size: var(--t-sm); font-weight: 700; }
.hub-tabs a:hover { color: var(--ink); text-decoration: none; }
.hub-tabs a[aria-current="page"] { color: var(--tx-blue); border-bottom-color: var(--blue); }
.hub-thumb-preview { max-width: 320px; overflow: hidden; border-radius: var(--r-sm); }
.hub-thumb-preview img { display: block; width: 100%; height: auto; }
.delta { margin-left: var(--s-1); font-size: var(--t-xs); font-weight: 700; color: var(--muted); }
.delta.up { color: var(--tx-green); }
.delta.down { color: var(--tx-red); }
.console { max-height: 520px; overflow: auto; padding: var(--s-3); border-radius: var(--r-sm); background: var(--slate-shade); color: #d8dbe1; font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.console-line { display: flex; gap: var(--s-3); }
.console-line time, .console-src { flex: none; color: #8b919c; }
.console-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.console-line.note .console-text { color: #8b919c; font-style: italic; }
.console-line.warn .console-text { color: #fff; font-weight: 700; }
.console-line.error .console-text { color: #ff9b93; }
/* ---------- Developer hub (Polycarbonate) ----------
   The logo's slate gray stands in for the site blue on the hub and the
   Polycarbonate sign-in page (body.dev-site, set by base.rs). */
.dev-site {
  --blue: #3d4352; --blue-edge: #2f3441; --blue-shade: #222631;
  --link: #3d4352; --focus: #3d4352; --tx-blue: #3d4352;
  --cyan: var(--blue); --cyan-edge: var(--blue-edge); --cyan-shade: var(--blue-shade);
  --tx-cyan: var(--tx-blue);
  --stage-floor: rgba(61, 67, 82, .10);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dev-site {
    --blue: #5a6078; --blue-edge: #484e63; --blue-shade: #2f3445;
    --link: #b6bcd6; --focus: #b6bcd6; --tx-blue: #b6bcd6;
    --cyan: var(--blue); --cyan-edge: var(--blue-edge); --cyan-shade: var(--blue-shade);
    --tx-cyan: var(--tx-blue);
  }
}
:root[data-theme="dark"] .dev-site {
  --blue: #5a6078; --blue-edge: #484e63; --blue-shade: #2f3445;
  --link: #b6bcd6; --focus: #b6bcd6; --tx-blue: #b6bcd6;
  --cyan: var(--blue); --cyan-edge: var(--blue-edge); --cyan-shade: var(--blue-shade);
  --tx-cyan: var(--tx-blue);
}
.dev-site .masthead { height: 96px; }
.dev-site .masthead-logo { height: 96px; }
@media (max-width: 600px) { .dev-site .masthead, .dev-site .masthead-logo { height: 56px; } }

/* ---------- Clans (2019 Roblox-groups style layout) ---------- */
.clan-layout { display: grid; gap: var(--s-4); align-items: start; }
@media (min-width: 760px) { .clan-layout { grid-template-columns: 240px minmax(0, 1fr); } }
.clan-side h1 { font-size: var(--t-xl); overflow-wrap: anywhere; }
.clan-emblem { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 var(--s-2); border-radius: var(--r-sm); background: var(--slate); color: #fff; font-size: var(--t-sm); font-weight: 900; letter-spacing: .04em; text-transform: uppercase; flex: none; }
.clan-emblem.big { width: 100%; height: 120px; font-size: 32px; }
.clan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.clan-card { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.clan-card:hover { border-color: var(--blue); text-decoration: none; }
.clan-card small { color: var(--muted); }
.clan-row { justify-content: flex-start; gap: var(--s-3); color: var(--ink); }
.clan-row:hover { background: var(--surface-2); text-decoration: none; }
.clan-row-name { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.clan-row-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan-roles { justify-content: flex-start; margin-bottom: var(--s-3); }
.clan-roles a { padding: 2px 0; border-bottom: 2px solid transparent; font-weight: 700; color: var(--muted); }
.clan-roles a.active { color: var(--tx-blue); border-bottom-color: var(--blue); }
.clan-new-role { padding-top: var(--s-3); }

/* ---------- Profile (2019 Roblox-style: avatar column + content) ---------- */
.profile-layout { display: grid; gap: var(--s-4); align-items: start; }
@media (min-width: 760px) { .profile-layout { grid-template-columns: 260px minmax(0, 1fr); } }
.profile-side h1 { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); font-size: var(--t-xl); overflow-wrap: anywhere; }
.profile-side .profile-avatar-wrap { max-width: none; }
.profile-side .profile-counts { margin-top: 0; }
.profile-actions { display: flex; flex-direction: column; gap: var(--s-2); align-items: stretch; }
.profile-actions .btn { width: 100%; }
.profile-main { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.profile-main > .section { margin-top: 0; }

/* ---------- Decals and clan emblems ---------- */
img.clan-emblem { object-fit: cover; background: var(--surface-3); padding: 0; }
.clan-emblem.big { aspect-ratio: 1; height: auto; }
.clan-emblem-tools { margin-top: var(--s-3); }
.clan-emblem-tools label { cursor: pointer; }
.decal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--s-3); list-style: none; padding: 0; }
.decal-tile { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-width: 0; }
.decal-tile img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; border-radius: var(--r-sm); background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.decal-tile b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decal-tile code { font-size: var(--t-xs); color: var(--muted); }
.sound-list { display: flex; flex-direction: column; gap: var(--s-2); list-style: none; padding: 0; }
.sound-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-width: 0; }
.sound-row audio { height: 36px; max-width: 100%; flex: 0 1 260px; }
.sound-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 140px; }
.sound-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-row code { font-size: var(--t-xs); color: var(--muted); }

/* ---------- Developer hub shell, dashboard, Creator Store, docs ---------- */
.hub-layout { display: grid; gap: var(--s-5); align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .hub-layout { grid-template-columns: 220px minmax(0, 1fr); } }
.hub-side nav { display: flex; flex-direction: column; gap: 2px; padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
@media (min-width: 900px) { .hub-side { position: sticky; top: calc(var(--sticky-top) + var(--s-4)); } }
.hub-side a { display: flex; align-items: center; height: var(--h-sm); padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--ink); font-size: var(--t-sm); font-weight: 700; }
.hub-side a:hover { background: var(--surface-2); text-decoration: none; }
.hub-side a[aria-current="page"] { background: var(--blue); color: #fff; }
.hub-side-label { padding: var(--s-3) var(--s-3) var(--s-1); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
@media (max-width: 899px) {
  .hub-side nav { flex-direction: row; align-items: center; overflow-x: auto; scrollbar-width: none; }
  .hub-side a { flex-shrink: 0; }
  .hub-side-label { display: none; }
}
.hub-main, .hub-side { min-width: 0; }
.hub-main > .page-head { margin-bottom: var(--s-4); }
.hub-actions { flex-wrap: wrap; }
.hub-hero .card-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); }
.hub-hero h2 { font-size: var(--t-xl); overflow-wrap: anywhere; }
.hub-hero + .mod-stats { margin-top: var(--s-4); }
.hub-tiles { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.hub-tile { display: flex; flex-direction: column; gap: 2px; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.hub-tile:hover { border-color: var(--blue); text-decoration: none; }
.hub-tile b { font-size: var(--t-2xl); font-weight: 800; line-height: 1.1; }
.hub-tile span { font-weight: 700; }
.hub-tile small { color: var(--muted); font-size: var(--t-xs); }
.hub-two { margin-top: var(--s-5); align-items: start; }
.hub-two .card-head { justify-content: space-between; }
.hub-game-row { color: var(--ink); }
.hub-game-row:hover { background: var(--surface-2); text-decoration: none; }
.hub-steps { display: grid; gap: var(--s-2); padding-left: var(--s-5); }
.hub-amount { color: var(--tx-green); white-space: nowrap; }
.hub-model { flex-wrap: wrap; }
.hub-model > .row:first-child { flex: 1 1 260px; min-width: 0; color: var(--ink); }
.hub-model-thumb { flex: none; width: 64px; height: 64px; border-radius: var(--r-sm); background: var(--surface-3); object-fit: contain; }
.hub-model-name { display: flex; flex-direction: column; min-width: 0; }
.hub-model-name b { overflow-wrap: anywhere; }
.hub-model details.manage { flex-basis: 100%; }
.decal-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-1); }

/* Creator Store */
.store-search { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-3); }
.store-search .input { width: auto; }
.store-search .input[type="search"] { flex: 1 1 240px; min-width: 0; }
.store-search select.input { flex: 0 0 auto; }
.store-how { margin-bottom: var(--s-4); font-size: var(--t-sm); }
.store-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); list-style: none; padding: 0; margin: 0; }
.store-tile { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.store-thumb { display: block; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-sm); background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.store-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
a.store-thumb:hover { outline: 2px solid var(--blue); }
.store-thumb.store-audio { display: grid; place-items: center; padding: var(--s-2); background: var(--surface-3); }
.store-audio audio { width: 100%; height: 36px; }
.store-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-tile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); font-size: var(--t-xs); }
.store-ref { align-self: flex-start; }
.store-ref code { font-size: var(--t-xs); }
.store-pager { display: flex; align-items: center; justify-content: center; gap: var(--s-3); margin-top: var(--s-5); }
.store-detail { display: grid; gap: var(--s-5); align-items: start; }
@media (min-width: 760px) { .store-detail { grid-template-columns: 280px minmax(0, 1fr); } }
.store-detail-pic { padding: var(--s-3); background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.store-detail-pic img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.store-detail-info { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.store-detail-info h2 { font-size: var(--t-2xl); overflow-wrap: anywhere; }
.chip-link { display: inline-flex; align-items: center; height: 28px; padding: 0 var(--s-3); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: var(--t-xs); font-weight: 700; }
.chip-link:hover { border-color: var(--blue); text-decoration: none; }

/* Documentation */
.docs-shell { display: grid; gap: var(--s-5); align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .docs-shell { grid-template-columns: 240px minmax(0, 1fr); } }
.docs-main { min-width: 0; }
.docs-nav { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: var(--t-sm); }
@media (min-width: 900px) { .docs-nav { position: sticky; top: calc(var(--sticky-top) + var(--s-4)); max-height: calc(100vh - 2 * var(--s-5)); overflow-y: auto; } }
/* Narrow screens read the page first and find the other pages below it. */
@media (max-width: 899px) { .docs-nav { order: 2; } .docs-toc { display: none; } }
.docs-nav a { display: flex; align-items: center; min-height: var(--h-sm); padding: var(--s-1) var(--s-3); border-radius: var(--r-sm); color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.docs-nav a:hover { background: var(--surface-2); text-decoration: none; }
.docs-nav a[aria-current="page"] { background: var(--blue); color: #fff; }
.docs-home { font-weight: 800; }
.docs-group summary { padding: var(--s-2) var(--s-3); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.docs-group > a { margin-left: var(--s-1); }
.docs-toc { display: flex; flex-direction: column; margin: 2px 0 var(--s-2) var(--s-4); padding-left: var(--s-2); border-left: 2px solid var(--line); }
.docs-nav .docs-toc a { min-height: 0; padding: var(--s-1) var(--s-2); font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
.docs-nav .docs-toc a:hover { color: var(--ink); }
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-top: var(--s-6); }
.docs-pager a { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); }
.docs-pager a:hover { border-color: var(--blue); text-decoration: none; }
.docs-pager small { color: var(--muted); font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.docs-pager b { color: var(--tx-blue); }
.docs-pager-next { grid-column: 2; text-align: right; }
.doc-body { min-width: 0; }
.doc-body > * + * { margin-top: var(--s-3); }
.doc-body > h1 { margin-bottom: var(--s-2); }
.doc-body > h1 + p { color: var(--muted); font-size: var(--t-md); }
.doc-body h1 { font-size: var(--t-2xl); font-weight: 900; }
.doc-body h2 { margin-top: var(--s-6); padding-bottom: var(--s-2); border-bottom: 1px solid var(--line); font-size: var(--t-xl); font-weight: 800; }
.doc-body h3 { margin-top: var(--s-5); font-size: var(--t-lg); font-weight: 800; }
.doc-body h4 { margin-top: var(--s-4); font-size: var(--t-md); font-weight: 800; }
.doc-body :is(h1, h2, h3, h4) { position: relative; scroll-margin-top: calc(var(--sticky-top) + var(--s-4)); overflow-wrap: anywhere; }
.doc-anchor { position: absolute; left: calc(-1 * var(--s-4)); color: var(--muted); font-weight: 400; opacity: 0; }
.doc-body :is(h1, h2, h3, h4):hover .doc-anchor, .doc-anchor:focus { opacity: 1; text-decoration: none; }
.doc-body ul, .doc-body ol { display: grid; gap: var(--s-1); padding-left: var(--s-5); }
.doc-body ul ul, .doc-body ol ul, .doc-body ul ol { margin-top: var(--s-1); }
.doc-body p, .doc-body li { overflow-wrap: anywhere; }
.doc-body :not(pre) > code { padding: 1px 5px; border-radius: 4px; background: var(--surface-3); font: .9em ui-monospace, SFMono-Regular, Consolas, monospace; }
.doc-code { margin: 0; padding: var(--s-3); overflow-x: auto; border-radius: var(--r-sm); background: var(--slate-shade); color: #d8dbe1; font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.doc-code code { background: none; padding: 0; font: inherit; }
.doc-body blockquote { margin: 0; padding: var(--s-2) var(--s-4); border-left: 4px solid var(--blue); background: var(--surface-2); }
.doc-body hr { border: 0; border-top: 1px solid var(--line); }
.doc-table th, .doc-table td { vertical-align: top; }
.hub-doc-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.hub-doc-card b { font-size: var(--t-lg); }
.store-warn { margin: 0; }