/* Retro LGS: an 8-bit game-store skin over app.css.
   A pixel-art store (static/lgs.js) runs behind every page; panels are chunky
   framed boxes, type is pixel type, and the bracket colours stay the only
   colours that mean a bracket. Loaded after app.css, so it only overrides. */

@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/pixelify-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
/* Pixelify's 5 reads like an S, so body digits come from Silkscreen. The digit
   face is declared last: for overlapping faces the browser uses the later one. */
@font-face {
  font-family: "Pixel Body";
  src: url("fonts/pixelify-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Pixel Body";
  src: url("fonts/silkscreen-400.woff2") format("woff2");
  font-weight: 400 700;
  unicode-range: U+0030-0039;
  font-display: swap;
}
@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/press-start-2p.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("fonts/silkscreen-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("fonts/silkscreen-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* Palette: a bright farm-town shop, in the spirit of Stardew menus (not a copy):
   parchment panels framed in wood, dark brown text, a warm wash over the store.
   The five bracket colours are still the only colours that mean a bracket. */
:root {
  --bg: #e9c98f;
  --panel: #fbe8c2;
  --panel-2: #f0d4a2;
  --text: #3d2412;
  --muted: #6b4528;
  --accent: #9b4f1e;      /* wood-brown: links, focus, active tab, current clue */
  --accent-ink: #fff3d6;  /* text on wood */
  --primary: #a8622c;
  --primary-text: #fff3d6;
  --line: #c9945a;
  --edge: #5a3218;        /* the dark wood outline every pixel box gets */
  --shade: #f6c784;       /* the warm drop shadow behind headline text */
  --hit: #3d9a3a;
  --close: #d0841c;
  --miss: #c4463a;
  --slow: #a08060;
  --b1: #5cc04a;
  --b2: #47a6e6;
  --b3: #a07ae6;
  --b4: #f2a02e;
  --b5: #e85a5e;
  --pixel: "Pixel Body", "Pixelify Sans", ui-monospace, monospace;
  --digits: "Press Start 2P", "Silkscreen", ui-monospace, monospace;  /* big numerals: chips, guesses, answers */
  --blocky: "Silkscreen", "Pixelify Sans", ui-monospace, monospace;
}

/* Square corners everywhere except real card images, which keep their card corners. */
*:not(.card-img):not(.card-img *) { border-radius: 0 !important; }

body {
  font: 500 18px/1.55 var(--pixel);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: none;
}
a { color: var(--accent); }

/* The store scene sits behind everything under a warm, light wash. */
#lgs {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  object-fit: cover;  /* the top-down room is a whole number of tiles wide */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 240, 210, 0.45), rgba(255, 240, 210, 0.6) 45%, rgba(255, 240, 210, 0.72));
}
body.wide::after { background: linear-gradient(180deg, rgba(255, 240, 210, 0.58), rgba(255, 240, 210, 0.75)); }
.hero p, .pool, .global-stat, .round-head, .clue-track { text-shadow: 2px 2px 0 rgba(255, 244, 220, 0.85); }

h1, h2, h3 { font-family: var(--pixel); font-weight: 700; letter-spacing: 0.01em; color: var(--text); }

/* ---------- header and footer: wooden signboards ---------- */
.site-header {
  background: linear-gradient(180deg, #b06a32 0, #a1602c 50%, #94562a 50%, #8a4f26 100%);
  border-bottom: 4px solid var(--edge);
  box-shadow: inset 0 3px 0 rgba(255, 220, 160, 0.35);
  align-items: center;
}
.brand.wordmark {
  line-height: 1;
  font: 700 1.6rem/1 var(--pixel);
  color: #fff3d6;
  text-decoration: none;
  letter-spacing: 0.02em;
  text-shadow: 3px 3px 0 var(--edge);
}
.wordmark .sq { color: #f6c784; }
.wordmark .n3 { color: #d9c2ff; }
.site-nav a { font: 700 0.9rem var(--blocky); text-transform: uppercase; color: #ffe3b0; }
.site-nav a[aria-current] { color: var(--text); background: var(--panel); box-shadow: inset 0 -4px 0 var(--accent), 0 0 0 3px var(--edge); }
.site-nav a:hover { color: var(--text); background: var(--panel-2); }

.site-footer { border-top: 4px solid var(--edge); background: #8a4f26; color: #ffe3b0; font-size: 0.9rem; }
.site-footer a { color: #fff3d6; }

/* ---------- pixel boxes: parchment framed in wood ---------- */
.bracket-list li, .stat-group, .hand, .digest, .reveal, .result-rows li, .tile, .cmdr-guess,
.clue-list, .cmdr-answer, .created-decks li, .feedback-list li, .stat-total, .field input,
.feedback-form textarea, .dev-notes textarea, .segmented, .report-list li {
  background: var(--panel);
  color: var(--text);
  border: 3px solid var(--edge);
  box-shadow: inset 3px 3px 0 #fff6dd, inset -3px -3px 0 rgba(150, 90, 40, 0.25), 4px 4px 0 rgba(90, 50, 24, 0.55);
}
.result-rows li { border-left-width: 8px; }
.reveal { border-top-width: 8px; }

/* Panel headings read like a game menu. */
.hand h2, .digest h2, .stat-group h2, .group h3, .community h3, .dist-title {
  font: 700 0.88rem var(--blocky);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* ---------- buttons: wooden, they press in ---------- */
button.primary, a.primary, button.secondary, a.secondary {
  font: 700 0.85rem var(--blocky);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 3px solid var(--edge);
  box-shadow: inset -4px -4px 0 rgba(90, 50, 24, 0.3), inset 4px 4px 0 rgba(255, 240, 200, 0.45), 0 5px 0 var(--edge);
  transform: translateY(0);
  transition: transform 0.05s steps(1), box-shadow 0.05s steps(1);
  margin-bottom: 5px;
}
button.primary, a.primary { background: var(--primary); color: var(--primary-text); text-shadow: 2px 2px 0 rgba(90, 50, 24, 0.6); }
button.primary:hover, a.primary:hover { background: #b9703a; }
button.secondary, a.secondary { background: var(--panel); color: var(--text); }
button.secondary:hover, a.secondary:hover { background: #fff3d6; }
button.primary:active, a.primary:active, button.secondary:active, a.secondary:active {
  transform: translateY(5px);
  box-shadow: inset -4px -4px 0 rgba(90, 50, 24, 0.3), inset 4px 4px 0 rgba(255, 240, 200, 0.45), 0 0 0 var(--edge);
}
.streak { font-family: var(--pixel); text-transform: none; }

/* ---------- home ---------- */
.hero h1 { font-size: 2.4rem; line-height: 1.1; text-shadow: 3px 3px 0 var(--shade); }
.hero h1 .three { color: #7a4fd0; }
.hero p { color: var(--text); }
.global-stat strong { color: var(--accent); }
.bracket-chip { font-family: var(--digits); font-weight: 400; font-size: 0.85rem; color: var(--edge); box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.2), inset 3px 3px 0 rgba(255, 255, 255, 0.45), 0 0 0 2px var(--edge); }
.bracket-list .blurb { color: var(--muted); font-size: 0.95rem; }
.field-label { font-family: var(--blocky); text-transform: uppercase; font-size: 0.8rem; color: var(--text); }
.field input { font-family: var(--pixel); }
.field input::placeholder { color: #a8835e; }
.pool, .empty { color: var(--muted); }

/* ---------- round ---------- */
.round-head h1 { font-size: 1.4rem; text-shadow: 3px 3px 0 var(--shade); }
.progress { height: 10px; background: var(--panel-2); border: 3px solid var(--edge); }
.progress span { background: var(--accent); }
.clue-count { font-family: var(--blocky); color: var(--accent); }
.clue-track a { font-family: var(--blocky); font-size: 0.74rem; border-top-width: 6px; border-top-color: var(--line); color: var(--muted); text-transform: uppercase; }
.clue-track li.done a { border-top-color: var(--muted); color: var(--text); }
.clue-track li.current a { border-top-color: var(--accent); color: var(--accent); }
/* The commanders' colours show as a pixel strip along the top of the stage, clear of the card names. */
.commanders::before { filter: none; opacity: 0.75; inset: -0.6rem max(10%, calc(50% - 14rem)) auto; height: 6px; border-radius: 0;
  background: linear-gradient(90deg, var(--glow)); box-shadow: 0 0 0 2px var(--edge); }
.commanders .card-img { box-shadow: 6px 6px 0 rgba(90, 50, 24, 0.6); }
.card-grid figcaption, .commanders figcaption { color: var(--text); }
[data-new-clue] { box-shadow: 0 0 0 4px var(--accent), 4px 4px 0 rgba(90, 50, 24, 0.55) !important; }
.group li { color: var(--text); }
.deck-stats { color: var(--muted); }
.deck-stats span { color: var(--text); }

/* guess bar: chunky buttons in each bracket's colour on a wooden shelf */
.guess-bar { background: linear-gradient(180deg, #a1602c, #8a4f26); border-top: 4px solid var(--edge); }
.guess-bar summary, .bracket-guide summary { color: #fff3d6; }
button.guess {
  background: var(--bc);
  color: var(--edge);
  border: 3px solid var(--edge);
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.2), inset 4px 4px 0 rgba(255, 255, 255, 0.5), 0 5px 0 var(--edge);
  margin-bottom: 5px;
  transition: none;
}
button.guess:hover, button.guess:focus-visible { background: color-mix(in srgb, var(--bc) 78%, #fff); color: var(--edge); outline: 3px solid #fff3d6; outline-offset: 1px; }
button.guess:active { transform: translateY(5px); box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.2), inset 4px 4px 0 rgba(255, 255, 255, 0.5), 0 0 0 var(--edge); }
button.guess .num { color: inherit; font: 400 1.25rem/1.2 var(--digits); }
button.guess .name { font: 700 0.82rem var(--pixel); }
button.guess:disabled { background: var(--panel-2); color: var(--muted); opacity: 0.5; box-shadow: none; }
.bracket-guide summary { font-family: var(--blocky); font-size: 0.75rem; text-transform: uppercase; }

/* ---------- reveal ---------- */
.reveal { animation: reveal-pop 0.3s steps(4) both; }
.answer-chip.bracket-chip { font-size: 1.6rem; box-shadow: inset -5px -5px 0 rgba(0, 0, 0, 0.2), inset 5px 5px 0 rgba(255, 255, 255, 0.5), 0 0 0 3px var(--edge), 4px 4px 0 3px rgba(90, 50, 24, 0.4); animation: answer-blink 0.6s steps(2) 2 both 0.15s; }
.answer-text .label { font-family: var(--blocky); color: var(--muted); }
.answer-name { font-size: 1.7rem; text-shadow: 3px 3px 0 var(--shade); }
.reveal h2 { font-size: 1.2rem; }
.reveal.hit h2 { color: var(--hit); }
.verdict-cell .label, .vote-count { font-family: var(--blocky); font-size: 0.8rem; text-transform: uppercase; color: var(--muted); }
.verdict-cell .name, .consensus, .attribution, .label-report { color: var(--muted); }
.bar { height: 16px; border: 2px solid var(--edge); background: var(--panel-2); }
.bar .fill { animation-timing-function: steps(6); }
.bar-value { color: var(--text); }
.tag { font-family: var(--blocky); text-transform: uppercase; font-size: 0.68rem; }
.tag.you { background: var(--accent); color: var(--accent-ink); }
.tag.builder { border-color: var(--edge); color: var(--text); }

@keyframes reveal-pop { from { transform: scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes answer-blink { 0% { opacity: 0; } 100% { opacity: 1; } }

/* ---------- results ---------- */
.score-line { text-shadow: 3px 3px 0 var(--shade); font-size: 2.2rem; }
.global-compare, .result-rows .round-number, .result-rows .guessed, .result-rows .gold, .seed-note { color: var(--muted); }
.guess-distribution .bar { height: 1.6rem; }
.guess-distribution .fill { font-family: var(--digits); font-size: 0.7rem; color: var(--edge); }
.guess-distribution .fill.empty { color: var(--muted); }
.perfect-banner { font-family: var(--blocky); text-transform: uppercase; }
.celebration i { width: 0.7rem; height: 0.7rem; }

.bracket-chip.small { font-size: 0.6rem; box-shadow: 0 0 0 2px var(--edge); }
.bracket-chip.missed { text-decoration: none; opacity: 0.35; }
.deck-stats span { font-family: var(--digits); font-size: 1.05rem; line-height: 1.6; }
code { background: var(--panel-2); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .answer-chip.bracket-chip { animation: none; }
}

/* Readability: card lists, stats labels and small print sit a step larger and bolder. */
.group li { font-size: 1rem; }
.deck-stats { font-size: 0.9rem; }
.answer-text .label, .clue-count { font-size: 0.85rem; }
.result-rows li { font-size: 1rem; }
.site-footer .fan-content { font-size: 0.8rem; }
/* The clue track's five labels share the row; on phones they shrink rather than overflow. */
.clue-track ol { min-width: 0; }
.clue-track li { min-width: 0; }
@media (max-width: 480px) { .clue-track a { font-size: 0.62rem; letter-spacing: 0; } }

/* Results: the summary under "Congratulations!" reads in full-strength text. */
.global-compare { color: var(--text); font-weight: 600; font-size: 1.05rem; line-height: 1.5; text-shadow: 2px 2px 0 rgba(255, 244, 220, 0.9); margin-top: 0.25rem; }
/* The bracket guide opens over the wooden bar as a parchment card. */
.bracket-help-list { background: var(--panel); color: var(--text); border: 3px solid var(--edge); padding: 0.6rem 0.75rem; font-size: 0.95rem; box-shadow: 4px 4px 0 rgba(90, 50, 24, 0.55); }
.bracket-help-list strong { color: var(--text); }
.floor-reasons { color: var(--text); font-size: 0.92rem; }
.floor-reasons strong { color: var(--accent); }
@media (max-width: 480px) { .site-nav a { font-size: 0.74rem; padding: 0.35rem 0.4rem; } }

/* /dev's drafts and to-dos are working text: a plain, readable face, not pixel type. */
.dev-notes textarea { font: 500 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: auto; padding: 0.75rem 0.9rem; }
/* The home page's "What are brackets?" prose sits on parchment above the list. */
.about-brackets { background: var(--panel); border: 3px solid var(--edge); padding: 0.9rem 1.1rem; margin: 0 0 0.75rem; max-width: 26rem;
  box-shadow: inset 3px 3px 0 #fff6dd, inset -3px -3px 0 rgba(150, 90, 40, 0.25), 4px 4px 0 rgba(90, 50, 24, 0.55); }
.about-brackets h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.about-brackets p { margin: 0 0 0.75rem; line-height: 1.5; }
.about-brackets p:last-child { margin-bottom: 0; }
.redacted-list { border: 3px solid var(--edge); box-shadow: inset 3px 3px 0 #fff6dd, inset -3px -3px 0 rgba(150, 90, 40, 0.25), 4px 4px 0 rgba(90, 50, 24, 0.55); }
.redacted-list h2 { font: 700 0.88rem var(--blocky); color: var(--accent); }
.redacted { background: var(--edge); }
.agree { background: var(--panel-2); border: 3px solid var(--edge); }
.agree-q { font-size: 1.1rem; }
.thumb { border: 3px solid var(--edge); background: var(--panel); box-shadow: inset -3px -3px 0 rgba(90, 50, 24, 0.2), inset 3px 3px 0 #fff6dd, 0 4px 0 var(--edge); margin-bottom: 4px; }
.thumb:active { transform: translateY(4px); box-shadow: none; }
.agree-pick .guess-chip { box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.2), inset 3px 3px 0 rgba(255, 255, 255, 0.45), 0 0 0 2px var(--edge); width: 2.4rem; height: 2.4rem; }
.stat-title { font: 700 0.9rem var(--blocky); }
/* Big stat numbers in Silkscreen: crisp blocky digits, no drop shadow, so they read at a glance. */
.stat-big { font: 400 2.4rem/1.1 "Silkscreen", var(--pixel); text-shadow: none; color: var(--text); }
.stat-name { font: 700 0.72rem var(--blocky); text-transform: uppercase; }
.stat-tiles.global { border-top: 3px solid var(--edge); padding-top: 0.9rem; }
.commander-preview img { box-shadow: 6px 6px 0 rgba(90, 50, 24, 0.6); }
.stat-everyone { font: 600 0.85rem var(--pixel); color: var(--muted); }
.stat-tiles.rates .stat-name { max-width: 9rem; }
