/* FirePoop pixel UI kit. One source for the look the canvas HUD already has (journey/src/hud-pixel.js: PAL, the extruded score digits, drawProgress,
   the stepped corner of the bar track). Every DOM surface (leaderboard, claim panel, pills, buttons, toasts) takes its tokens from here, so there is one
   place to change them. tests/pixel-tokens.test.mjs fails when these colours drift from hud-pixel.js.
   Rules: flat colour, no shadows, no blur. Corners are stepped (clip-path) with a border of the same step, so the border always follows the corner.
   Sentence case. The pixel face is for short labels and numbers only; sentences stay in the page font. No red and no orange. Needs pixel-fonts.css. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fonts/inter-latin.woff2') format('woff2'); }
:root {
  --px-font: 'Press Start 2P', monospace;
  --px-text: "Inter", system-ui, sans-serif;
  /* ink and surfaces (hud-pixel.js: OUT '#2b1048' in drawProgress, PAL.*.out '#1c0b2e' on the lettering) */
  --px-face-hover: #4f2392; /* one hover face for every pixel button (HAG-4703) */
  --px-ink: #2b1048;
  --px-ink-deep: #1c0b2e;
  --px-panel: #14082a;
  --px-row: #1d0e3a;
  /* palettes, as PAL.yellow / pink / cyan / white */
  --px-gold-hi: #fff7a0; --px-gold: #ffe54d; --px-gold-lo: #ffd23e; --px-gold-ext: #b0721c; --px-gold-ext2: #74441a;
  --px-pink-hi: #ffc9ee; --px-pink: #ff7ad1; --px-pink-lo: #e650b8; --px-pink-ext: #8f2272;
  --px-cyan-hi: #bdf7ff; --px-cyan: #5be8ff; --px-cyan-lo: #30c6ee; --px-cyan-ext: #1d6498;
  --px-white: #eceeff; --px-white-lo: #c3c8f4;
  /* the progress bar (drawProgress): bright track with a shade row, the fill runs yellow to pink along the whole bar */
  --px-track: #f1e9ff; --px-track-shade: #d6c8f2; --px-track-cur: #fff4c9;
  --px-fill: linear-gradient(90deg, #fff27a, #ffe066 30%, #ffa6dc 58%, #ff5cc8 82%, #d42fc0);
  --px-fill-edge: #b8268f;
  /* text on the dark panel */
  --px-fg: #ffe9f4; --px-fg-soft: #ffd3ee; --px-fg-mute: #bfb1de; --px-focus: #35f0d0;
  /* pixel unit: every frame, notch and bar row is a whole number of these */
  --px-u: 3px; --px-bw: 3px;
}

/* Stepped corner: the clip cuts one pixel off each corner, the border (same width) runs straight and stops at the step, like the bar's outline. */
.px-box, .px-btn, .px-row {
  --c: var(--px-u);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, calc(100% - var(--c)) var(--c), 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, var(--c) calc(100% - var(--c)), 0 calc(100% - var(--c)), 0 var(--c), var(--c) var(--c));
}
.px-box { box-sizing: border-box; background: var(--px-panel); border: var(--px-bw) solid var(--px-pink-lo); border-radius: 0; color: var(--px-fg); }

/* Buttons: tabs, close, submit, the pills over the canvas. Face plus a shade row at the bottom, the way the bar track has one. */
.px-btn, #mute, #quality, #beatring, .lb-pill, .lb-close, .lb-submit, .lb-tab, .cb-tab {
  --face: var(--px-ink); --shade: var(--px-ink-deep); --ink: var(--px-fg-soft); --edge: var(--px-pink-lo);
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; margin: 0; padding: 7px 12px 9px;
  border: 2px solid var(--edge); border-radius: 0; color: var(--ink);
  background: linear-gradient(to bottom, var(--face) calc(100% - 4px), var(--shade) 0);
  font-family: var(--px-font); font-size: 10px; line-height: 1.4; font-weight: 400; text-transform: none; letter-spacing: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; white-space: nowrap;
}
.px-btn, #mute, #quality, #beatring, .lb-pill, .lb-close, .lb-submit, .lb-tab, .cb-tab { --c: 2px; clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, calc(100% - var(--c)) var(--c), 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, var(--c) calc(100% - var(--c)), 0 calc(100% - var(--c)), 0 var(--c), var(--c) var(--c)); }
.px-btn[hidden], #mute[hidden], .lb-pill[hidden], .lb-close[hidden], .lb-submit[hidden], .lb-tab[hidden], .cb-tab[hidden], .lb-name[hidden] { display: none; }
.px-btn:hover, .lb-close:hover, .lb-tab:hover, .cb-tab:hover, #mute:hover, #quality:hover, #beatring:hover, .px-link:hover { --face: var(--px-face-hover); --edge: var(--px-pink-hi); }
/* the main action: a pink face (PAL.pink bands) with the plum extrusion as the shade row. The chosen tab: gold edge and shade row, gold lettering (pixel-text.js paints both). */
.px-btn--hot, .lb-submit, .lb-pill { --face: var(--px-pink-lo); --shade: var(--px-pink-ext); --ink: var(--px-ink-deep); --edge: var(--px-ink-deep); }
.px-btn--hot:hover, .lb-submit:hover, .lb-pill:hover { --face: var(--px-pink); }
.lb-tab[aria-selected="true"], .cb-tab[aria-selected="true"] { --face: var(--px-ink); --shade: var(--px-gold-ext); --edge: var(--px-gold); }
.px-btn:disabled, .lb-submit:disabled { --face: #4a3a63; --shade: var(--px-ink-deep); --ink: #d8cdee; --edge: #4a3a63; cursor: default; }
.px-btn:disabled .pxl-img, .lb-submit:disabled .pxl-img { opacity: .6; }
.px-btn:focus-visible, #mute:focus-visible, #quality:focus-visible, #beatring:focus-visible, .lb-pill:focus-visible, .lb-close:focus-visible, .lb-submit:focus-visible, .lb-tab:focus-visible, .cb-tab:focus-visible, .px-link:focus-visible { outline: 3px solid var(--px-focus); outline-offset: -6px; }
.lb-ico { display: inline-flex; width: 14px; height: 14px; color: inherit; flex: none; }
.lb-ico svg { width: 100%; height: 100%; }
@media (pointer: coarse) { .px-btn, .lb-close, .lb-submit, .lb-tab, .cb-tab { min-height: 44px; } .lb-close { min-width: 44px; } }

/* ---- Pixel lettering (journey/src/leaderboard/pixel-text.js) ----
   Every label, number and sentence on the leaderboard surfaces is an image painted by the HUD lettering renderer (hud-pixel.js pixelText), next to the real
   text, which is visually hidden. No Inter, no underlined links: the buttons and links below are the pixel buttons. */
.pxl { position: relative; display: inline-block; vertical-align: middle; line-height: 0; max-width: 100%; }
.pxl-img { display: block; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: pixelated; max-width: none; user-select: none; -webkit-user-select: none; }
.pxl-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.pxw { display: block; position: relative; line-height: 0; }
.pxw-vis { display: flex; flex-wrap: wrap; align-items: flex-start; row-gap: 7px; padding: 2px 3px 3px; }
.pxw-vis .pxl { display: block; }
.px-on { display: none; }
[aria-selected="true"] > .px-on, [role="radio"][aria-checked="true"] > .px-on { display: inline-block; }
[aria-selected="true"] > .px-off, [role="radio"][aria-checked="true"] > .px-off { display: none; }
button:hover .pxl-img, a.px-link:hover .pxl-img { filter: brightness(1.14); }

/* Text field: the same Press Start 2P face the lettering uses (typed text cannot be an image), on the deep panel colour with the stepped corner. */
.px-field, .lb-name { box-sizing: border-box; width: 100%; min-height: 44px; padding: 10px 12px; background: var(--px-ink-deep); color: var(--px-white); border: 2px solid var(--px-pink-lo); border-radius: 0; font-family: var(--px-font); font-size: 12px; line-height: 1.4; --c: 2px; clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, calc(100% - var(--c)) var(--c), 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, var(--c) calc(100% - var(--c)), 0 calc(100% - var(--c)), 0 var(--c), var(--c) var(--c)); }
.px-field::placeholder, .lb-name::placeholder { color: #bfb1de; opacity: 1; font-size: 10px; }
.px-field:focus-visible, .lb-name:focus-visible { outline: 3px solid var(--px-focus); outline-offset: -5px; }
.lb-name[aria-invalid="true"] { border-color: var(--px-gold); }

/* Rank crown: hud-pixel.js pixelCrown, painted for ranks 1 to 3. */
.px-crown { display: block; flex: none; }

/* Toast (leaderboard/toast.js): a small panel, the lettering inside. */
.px-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(120px + env(safe-area-inset-bottom, 0px)); z-index: 9; width: max-content; max-width: min(92vw, 360px); padding: 10px 14px; pointer-events: none; }
.px-toast[hidden] { display: none; }

/* ---- Leaderboard: panel, rows, states ---- */
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lb-title { margin: 0; flex: 1 1 auto; min-width: 0; font-family: var(--px-font); font-size: 12px; font-weight: 400; line-height: 0; }
.lb-tabs, .cb-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-status, .cb-page .lb-status { margin: 0; line-height: 0; }
.lb-best, .cb-sub { margin: 0; line-height: 0; }
.lb-privacy, .px-link { box-sizing: border-box; display: flex; align-items: center; align-self: stretch; min-height: 44px; padding: 8px 12px 12px; border: 2px solid var(--px-pink-lo); text-decoration: none; color: var(--px-fg); cursor: pointer; --face: #170a2e; --shade: var(--px-ink-deep); --edge: var(--px-pink-lo); border-color: var(--edge); background: linear-gradient(to bottom, var(--face) calc(100% - 4px), var(--shade) 0); --c: 2px; clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, calc(100% - var(--c)) var(--c), 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, var(--c) calc(100% - var(--c)), 0 calc(100% - var(--c)), 0 var(--c), var(--c) var(--c)); }
.lb-privacy .pxw-vis, .px-link .pxw-vis { padding: 0; }
.lb-privacy .pxw, .px-link .pxw { flex: 1 1 auto; }
.cb-note, .lb-hint { margin: 0; line-height: 0; }
.lb-label { display: block; line-height: 0; }
.lb-form, .cb-form { display: flex; flex-direction: column; gap: 8px; }
.lb-form-row { display: flex; gap: 8px; align-items: stretch; }
.lb-form-row .lb-name { flex: 1 1 auto; min-width: 0; }
.lb-form[hidden], .cb-form[hidden], .cb-claim[hidden], .cb-mine[hidden], .cb-sub[hidden] { display: none; }

.lb-viz { display: block; }
.lb-viz:empty, .lb-viz[hidden] { display: none; }
.lb-viz .pxl-img { display: block; }
.pxl-bar.is-error { opacity: .5; } .pxl-bar.is-empty { opacity: .8; }

.lb-list, .cb-list { margin: 0; padding: 0 4px 0 3px; list-style: none; overflow-y: auto; flex: 1 1 auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--px-pink-lo) transparent; display: flex; flex-direction: column; gap: 4px; }
.lb-list:empty, .cb-panel .cb-list:empty { display: none; }
.px-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; box-sizing: border-box; padding: 9px 10px 11px; border: 2px solid transparent; border-radius: 0; background: var(--px-row); color: var(--px-fg); flex: none; --c: 2px; }
.px-rank { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.px-who { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.px-nameline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.px-nick { display: block; min-width: 0; overflow: hidden; padding: 4px 3px 5px; margin: -4px -3px -5px; }
.cb-seal { display: inline-flex; width: 16px; height: 16px; color: var(--px-focus); flex: none; }
.cb-seal svg { width: 100%; height: 100%; }
.px-you { flex: none; }
.px-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.px-meta > .pxl-bar { flex: none; }
.px-metatext { display: block; min-width: 0; }
.px-score { display: block; justify-self: end; text-decoration: none; }
a.px-score { padding: 6px 0; }
a.px-score:focus-visible { outline: 3px solid var(--px-focus); outline-offset: 2px; }
.px-row.px-me { background: #3b1460; border-color: var(--px-gold); }
.px-row.px-ghost { background: #12304a; border: 2px dashed var(--px-cyan); }
.px-row.px-unclaimed { background: #170a2e; }
.px-unclaimed .pxl-img { opacity: .72; }
.px-unclaimed .pxl-bar { filter: grayscale(1); }
.lb-list.lb-more, .cb-panel .cb-list.lb-more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), transparent); }

/* legacy board header (#, Name, Time, Score): the same columns as the rows */
.lb-cols { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 10px; padding: 0 12px; line-height: 0; }
.lb-cols .pxl { display: block; }
.lb-cols > .lb-t { display: none; }
.lb-cols .lb-rank { display: flex; justify-content: center; }
.lb-cols .lb-s { display: flex; justify-content: flex-end; }
.lb-cols[hidden] { display: none; }

.cb-mine { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.cb-flush { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cb-fscore { display: block; min-width: 5em; }
.cb-ftier { display: block; flex: 1 1 auto; min-width: 0; }

@media (prefers-reduced-motion: reduce) { .pxl-loading { animation: none; } }
@media (max-width: 600px) { .px-row { grid-template-columns: 34px minmax(0, 1fr) auto; column-gap: 8px; padding: 8px 8px 10px; } .lb-cols { grid-template-columns: 34px minmax(0, 1fr) auto; column-gap: 8px; padding: 0 10px; } }

/* ---- Lettering profile (hud-pixel.js PXF sets html[data-font]): a, Departure Mono, is the default (HAG-5151); b only by ?font=b on staging. ---- */
html[data-font="a"] { --px-font: 'Departure Mono', 'Press Start 2P', monospace; }
html[data-font="b"] .pxw-vis { row-gap: 14px; }
html[data-font="b"] .px-bare .px-meta { gap: 12px 18px; }
html[data-font="b"] .px-bare .lb-list, html[data-font="b"] .px-bare .cb-list { gap: 18px; }
html[data-font="b"] .px-bare .px-col { gap: 28px; }
html[data-font="b"] .px-bare .px-who { row-gap: 10px; }
html[data-font="b"] .px-nameline { flex-wrap: wrap; row-gap: 8px; }
