/* TrackToons — 90s Rewind / Radical Remix design system.
   Loaded after Tailwind CDN on the public quiz page only. The local admin
   tools (catalogue, keyboard, pads) keep using style.css and are unaffected. */

/* ---------- Mobile / touch quality-of-life ---------- */

html, body {
  /* Kill iOS Safari's blue tap-flash; we have our own active-press effect */
  -webkit-tap-highlight-color: transparent;
  /* Don't let the page rubber-band horizontally if a card edge sticks out */
  overscroll-behavior-x: none;
}
body {
  /* Stop horizontal scrollbars showing up from rotated cards extending edges */
  overflow-x: hidden;
}

/* ---------- Backgrounds and textures ---------- */

.memphis-pattern {
  background-color: #faf9fd;
  background-image:
    radial-gradient(#00e3fd 2px, transparent 2px),
    radial-gradient(#ff00ff 2px, transparent 2px);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
}

/* Halftone overlay using the element's own color. Pair with currentColor +
   opacity 10-20% on a semi-transparent inner div. */
.halftone-dots {
  background-image: radial-gradient(circle, currentColor 1px, transparent 1px);
  background-size: 4px 4px;
}

/* Halftone overlay in fixed black at 10% opacity — drop into ::after or
   an absolute-positioned <div> on a card. */
.halftone {
  background-image: radial-gradient(circle, #000 10%, transparent 11%);
  background-size: 6px 6px;
  opacity: 0.1;
  pointer-events: none;
}

/* ---------- Hard-edge displacement shadows ---------- */

.cartoon-shadow    { box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 1); }
.cartoon-shadow-sm { box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1); }

/* "Sink into shadow" press effect on buttons. */
.active-press { transition: transform 0.08s ease, box-shadow 0.08s ease; }
.active-press:hover { transform: translate(-1px, -1px); box-shadow: 9px 9px 0 0 rgba(0, 0, 0, 1); }
.active-press:active { transform: translate(4px, 4px); box-shadow: 0 0 0 0 rgba(0, 0, 0, 1); }
.active-press-sm:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 0 rgba(0, 0, 0, 1); }
.active-press-sm:active { transform: translate(4px, 4px); box-shadow: 0 0 0 0 rgba(0, 0, 0, 1); }

/* ---------- Slight rotations ("tossed on a desk") ---------- */

.rotate-rnd-1 { transform: rotate(-1.5deg); }
.rotate-rnd-2 { transform: rotate(1.2deg); }
.rotate-rnd-3 { transform: rotate(-0.8deg); }

/* Material Symbols — match design's bolder default */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 700, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}
.material-symbols-outlined.filled { font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 24; }

/* Hide the catalogue-link nav on the deployed bundle. The build-static
   strip regex removes the <a> but leaves the <nav> wrapper with only
   whitespace inside, so :empty wouldn't match — :has(a) handles it. */
.view-nav:not(:has(a)) { display: none; }

/* ---------- Brand mark in the header ---------- */

.brand-mark {
  display: inline-block;
  padding: 4px 14px;
  background: #facc15; /* yellow-400 */
  border: 4px solid #1a1b1e;
  box-shadow: 6px 6px 0 0 rgba(0, 0, 0, 1);
  color: #a900a9; /* primary pink */
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  font-size: 32px;
  font-style: italic;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.1;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.brand-mark:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 1); }
.brand-mark:active { transform: translate(4px, 4px); box-shadow: 0 0 0 0 rgba(0, 0, 0, 1); }

/* ---------- Status pills (header: player / progress / score) ---------- */

.tt-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  background: #00e3fd; /* secondary-container cyan */
  border: 4px solid #1a1b1e;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
  padding: 4px 12px;
  color: #00616d;
  font-family: "Plus Jakarta Sans", sans-serif;
  white-space: nowrap;
}
.tt-pill .pill-label {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.1;
}
.tt-pill .pill-value {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.tt-pill.tt-pill-player { background: #ffd7f5; color: #510051; transform: rotate(-2deg); }
.tt-pill.tt-pill-score  { background: #00e3fd; color: #00616d; transform: rotate(2deg); }
.tt-pill.tt-pill-round  { background: #facc15; color: #1a1b1e; transform: rotate(-1deg); }

/* ---------- Tier cells (#tier-row children rendered by quiz.js) ---------- */

.tier-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
}
.tier-cell {
  position: relative;
  background: #efedf1; /* surface-container locked grey */
  border: 4px solid #1a1b1e;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
  padding: 12px 14px;
  opacity: 0.7;
  transform: rotate(0.6deg);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tier-cell:nth-child(odd) { transform: rotate(-0.8deg); }
.tier-cell.used {
  background: #00a916; /* tertiary-container lime */
  color: #003302;
  opacity: 1;
}
.tier-cell.current {
  background: #facc15; /* yellow-400 */
  color: #1a1b1e;
  opacity: 1;
  transform: rotate(0deg) scale(1.05);
  z-index: 2;
}
.tier-cell .tier-num {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.tier-cell .tier-points {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tier-cell .tier-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 18px;
  font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 24;
}
.tier-cell.current::before {
  content: "ACTIVE";
  position: absolute;
  top: -10px;
  right: -10px;
  background: #a900a9; /* primary pink */
  color: #fff;
  border: 2px solid #1a1b1e;
  padding: 2px 8px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  transform: rotate(12deg);
  box-shadow: 2px 2px 0 0 rgba(0, 0, 0, 1);
  z-index: 3;
}

/* ---------- Reveal box (square ?-card / show image) ---------- */

.reveal-box {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: #00e3fd; /* secondary-container */
  border: 4px solid #1a1b1e;
  box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 1);
  border-radius: 12px;
  overflow: hidden;
  transform: rotate(-0.5deg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.reveal-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #00e3fd;
  color: #00616d;
}
.reveal-placeholder.hidden { display: none; }
.reveal-placeholder svg { display: none; } /* hide the legacy gradient SVG */
.reveal-placeholder::after {
  content: "?";
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 220px;
  line-height: 1;
  color: #00616d;
  text-shadow: 6px 6px 0 #1a1b1e;
}
.reveal-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, currentColor 1px, transparent 1px);
  background-size: 12px 12px;
  color: #1a1b1e;
  opacity: 0.08;
  pointer-events: none;
  z-index: 1;
}
.reveal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 2;
  animation: reveal-fade 0.45s ease;
}
.reveal-img.hidden { display: none; }
.reveal-box.revealed-no-image::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 160px;
  color: #00a916;
  background: rgba(0, 110, 10, 0.15);
  pointer-events: none;
  z-index: 3;
}
@keyframes reveal-fade {
  from { opacity: 0; transform: scale(1.04); }
  to   { opacity: 1; transform: scale(1.0); }
}

/* ---------- Horizontal timer bar ---------- */

.tt-timer {
  position: relative;
  width: 100%;
  height: 36px;
  background: #fff;
  border: 4px solid #1a1b1e;
  border-radius: 999px;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
  overflow: hidden;
}
.tt-timer .timer-fill {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  background: #00a916; /* lime */
  border-radius: 999px;
  transition: width 0.25s linear, background 0.3s ease;
}
.tt-timer .timer-fill.warn   { background: #facc15; }
.tt-timer .timer-fill.danger { background: #ba1a1a; }
.tt-timer .timer-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.2) 1px, transparent 1px);
  background-size: 6px 6px;
  border-radius: 999px;
  pointer-events: none;
}
.tt-timer-label {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 6px;
}
.tt-timer-label .label {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a900a9;
}
.tt-timer-label .seconds {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #1a1b1e;
}

/* ---------- Guess input + autocomplete ---------- */

.guess-area .ghost-shadow {
  position: relative;
}
.guess-area .ghost-shadow::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #1a1b1e;
  transform: translate(8px, 8px);
  border-radius: 12px;
  z-index: 0;
}
.guess-area .ghost-shadow > * {
  position: relative;
  z-index: 1;
}
.guess-input-row {
  display: flex;
  align-items: center;
  background: #fff;
  border: 4px solid #1a1b1e;
  border-radius: 12px;
  padding: 6px;
  gap: 8px;
}
#guess-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 14px;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: #1a1b1e;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  outline: none;
  min-width: 0;
}
#guess-input::placeholder {
  color: #b9b6c2;
  font-weight: 800;
}
#guess-input:focus { background: #facc15; }
#guess-input.wrong-flash { background: #ffdad6; animation: wrong-shake 0.3s ease; }
@keyframes wrong-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.guess-icon {
  font-size: 28px !important;
  color: #564052;
  padding-left: 8px;
}

.suggestions {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 4px solid #1a1b1e;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
  max-height: 320px;
  overflow-y: auto;
}
.suggestions.hidden { display: none; }
.suggestions li {
  padding: 14px 18px;
  cursor: pointer;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 18px;
  text-transform: uppercase;
  border-bottom: 4px solid #1a1b1e;
  color: #1a1b1e;
}
.suggestions li:last-child { border-bottom: none; }
.suggestions li:hover, .suggestions li.active {
  background: #ff00ff; /* primary-container */
  color: #fff;
}

/* Above-input "TYPE TO GUESS" tab */
.guess-tab {
  display: inline-block;
  background: #1a1b1e;
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  margin-bottom: 8px;
  margin-left: 18px;
  transform: rotate(-1deg);
}

/* ---------- Round result badge — overlaid on reveal-box as a horizontal
   "stamp" label across the middle of the image ---------- */

#round-result {
  position: absolute;
  /* Sit in the bottom third of the reveal box so the badge doesn't
     cover the focal area of the show image. */
  top: 78%;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
  /* Empty (no kind class) renders nothing visible */
}
.round-result.good,
.round-result.bad,
.round-result.warn {
  display: block;
  width: 88%;
  margin: 0 auto;     /* horizontal centering (with left:0 right:0 above) */
  padding: 10px 16px;
  border: 4px solid #1a1b1e;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 18px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.round-result.good { background: #facc15; color: #1a1b1e; transform: translateY(-50%) rotate(-3deg); }
.round-result.warn { background: #ffd7f5; color: #510051; transform: translateY(-50%) rotate(-1deg); font-size: 14px; }
.round-result.bad  { background: #ba1a1a; color: #fff;    transform: translateY(-50%) rotate(-3deg); font-size: 16px; }

/* ---------- Category tabs (landing card folder-tab header) ---------- */

/* Wrapper holds the same tilt the card used to carry, so the tab strip
   and the card rotate as one unit. */
.start-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
/* Append translateZ(0) to the rotation: this puts the element into a
   3D rendering context, which forces a GPU compositor layer on EVERY
   browser (including Mobile Safari, which ignores will-change for
   static transforms and would otherwise re-rasterize the rotated
   subtree on touch interactions — visible as a flickering hairline
   under the active tab and shimmering text). Combined transform value
   keeps the visible rotation while the translate3d is a no-op
   visually. */
.start-card-wrap.tilt-1 { transform: rotate(-1deg) translateZ(0); }
.start-card-wrap.tilt-2 { transform: rotate(1deg) translateZ(0); }
.start-card-wrap { will-change: transform; backface-visibility: hidden; }

/* The category tab strip — sits above the card at the top-left, like
   folder tabs poking up out of a file. The strip's negative margin lets
   the active tab visually merge into the card's top edge.
   No z-index here: inactive tabs paint in DOM order (before the card),
   so the card's top border draws over them — they read as "tucked
   behind". The active tab raises itself via z-index instead. */
.cat-tabs-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 24px;        /* indent from the card's left edge */
  margin-bottom: -4px;       /* tabs sit ON the card's top border */
}

/* Each tab. Same hard-edge cartoon vocabulary as the rest of the design
   system but shaped like a folder tab — rounded top corners only, no
   bottom border so it bleeds into the card below. */
.cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px 10px;
  background: #bdb6c4;       /* mid grey-purple — clearly "behind" the active tab */
  color: #1a1b1e;
  border: 4px solid #1a1b1e;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.07s ease;
}
.cat-chip:hover {
  background: #cec7d6;
  transform: translateY(-1px);
}
.cat-chip-active {
  /* Match the card body color exactly so the active tab visually merges
     into the card. position:relative + z-index raises this tab above
     the card sibling so the card's top border is painted over right
     where the tab sits — "opening" the folder under it. */
  background: #fff;
  color: #1a1b1e;
  position: relative;
  z-index: 2;
  cursor: default;
  transform: none;
  /* Slightly taller than inactive tabs so the eye reads it as foreground. */
  padding-bottom: 14px;
}
.cat-chip-active:hover {
  background: #fff;
  transform: none;
}
/* Bleed a strip of pure white that starts INSIDE the active tab (4px
   up from its bottom) and extends a few px past the tab into the card
   region. Starting inside the tab is what closes the hairline: if
   `top: 100%` lands on a fractional pixel boundary at the -1° rotation,
   the chip's actual bottom can round one way while 100% rounds the
   other, leaving a 1-px gap that exposes the card's top border. The
   4px overlap covers any subpixel rounding error. Strictly snapped to
   the chip's own width (left/right: 0) so the white doesn't bleed
   into the inter-tab gap or the neighboring chip's border. */
.cat-chip-active::after {
  content: "";
  position: absolute;
  top: calc(100% - 4px);  /* 4px overlap up into the chip */
  left: 0;
  right: 0;
  height: 12px;           /* 4px overlap + 8px below chip into card body */
  background: #fff;
  pointer-events: none;
}

/* ---------- Buttons (Start, Next, Play Again) ---------- */

.tt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 32px;
  background: #00a916; /* tertiary-container green */
  color: #003302;
  border: 4px solid #1a1b1e;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}
.tt-btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 0 rgba(0, 0, 0, 1); }
.tt-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 0 rgba(0, 0, 0, 1); }
.tt-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.tt-btn-primary { background: #a900a9; color: #fff; }
.tt-btn-primary:hover { background: #ff00ff; }
.tt-btn-secondary { background: #00e3fd; color: #00616d; }
.tt-btn-secondary:hover { background: #9cf0ff; }

/* "Coming Soon!" mode for the Start button on empty categories. Reads
   as a soft pink stamp rather than a green action — clearly future
   content rather than a click-me CTA. Click is a no-op (handled in JS). */
.tt-btn-coming-soon,
.tt-btn-coming-soon:hover,
.tt-btn-coming-soon:active {
  background: #ffd7f5;     /* primary-fixed pink — gentle, future-looking */
  color: #510051;          /* on-primary-container deep purple */
  cursor: default;
  transform: none;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
  opacity: 1;              /* override the .tt-btn:disabled rule if it lands */
}

/* ---------- Cards (start screen, scoreboards, footer banner) ---------- */

.tt-card {
  position: relative;
  background: #fff;
  border: 4px solid #1a1b1e;
  box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 1);
  padding: 24px;
}
/* Same translateZ(0) + will-change combo as .start-card-wrap — forces
   a GPU compositor layer on every browser (Mobile Safari especially)
   so the rotation's antialiasing is stable. Non-tilted cards stay on
   the CPU paint path since they have no fractional pixel positions. */
.tt-card.tilt-1 { transform: rotate(-1deg) translateZ(0); }
.tt-card.tilt-2 { transform: rotate(1deg) translateZ(0); }
.tt-card.tilt-1, .tt-card.tilt-2 {
  will-change: transform;
  backface-visibility: hidden;
}
.tt-card .halftone-overlay {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #000 10%, transparent 11%);
  background-size: 6px 6px;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}
.tt-card > * { position: relative; z-index: 1; }

.tt-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
}
.tt-card-header .tt-card-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #facc15;
  color: #1a1b1e;
  border: 4px solid #1a1b1e;
  padding: 4px 12px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: rotate(-2deg);
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 1);
}
.tt-card h2, .tt-card h3 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0 0 12px;
  color: #1a1b1e;
  letter-spacing: -0.02em;
}
.tt-card h2 { font-size: 32px; line-height: 1.1; }
.tt-card h3 { font-size: 20px; line-height: 1.1; }

/* ---------- Scoreboard list ---------- */

.score-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.score-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: #f4f3f7;
  border: 2px solid #1a1b1e;
  padding: 8px 12px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 14px;
}
.score-list li.empty {
  background: transparent;
  border: 2px dashed #897083;
  color: #897083;
  font-style: italic;
  text-align: center;
  justify-content: center;
}
.score-leader { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
.score-points {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: #a900a9;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  display: inline-block;
}
.score-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  color: #1a1b1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.score-meta {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 11px;
  color: #564052;
  text-transform: uppercase;
}

/* ---------- Start hero logo (above the start-grid) ---------- */

.start-hero-logo {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  margin: 8px auto 28px;
  /* drop-shadow follows the PNG's transparent edges, giving the
     cel-shaded look from the design system */
  filter: drop-shadow(10px 10px 0 #1a1b1e);
}

/* ---------- Start screen layout ---------- */

.start-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 280px;
  grid-template-rows: auto auto;
  gap: 24px;
  align-items: start;
  margin-top: 16px;
}
.start-grid .start-card-wrap {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
  margin: 0;
}
.start-grid .scoreboard-personal { display: none; }
.start-grid .scoreboard-stack {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (min-width: 1100px) {
  .start-grid {
    grid-template-columns: 280px minmax(420px, 1fr) 280px;
  }
  .start-grid .scoreboard-personal {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    display: block;
  }
  .start-grid .start-card-wrap { grid-column: 2 / 3; }
  .start-grid .scoreboard-stack { grid-column: 3 / 4; }
}

/* Start card specifics */
.start-card { padding: 32px; }
.start-card .start-rules {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.start-card .start-rules li {
  background: rgba(0, 227, 253, 0.15);
  border: 4px solid #1a1b1e;
  padding: 10px 14px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 14px;
  color: #1a1b1e;
  line-height: 1.5;
}
.start-card .start-rules li:nth-child(2) { background: rgba(255, 0, 255, 0.1); }
.start-card .start-rules li:nth-child(3) { background: rgba(255, 255, 0, 0.18); }
.start-card .start-rules li strong { color: #a900a9; }
.start-card .field-label {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #564052;
  margin: 8px 0 6px;
}
#player-name {
  width: 100%;
  background: #fff;
  border: 4px solid #1a1b1e;
  padding: 12px 16px;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: #1a1b1e;
  text-transform: uppercase;
  outline: none;
  margin-bottom: 16px;
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
}
#player-name:focus { background: #facc15; }
#player-name::placeholder { color: #b9b6c2; }

/* ---------- End screen ---------- */

#final-score {
  display: inline-block;
  background: #facc15;
  border: 4px solid #1a1b1e;
  box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 1);
  padding: 16px 32px;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 64px;
  color: #1a1b1e;
  font-variant-numeric: tabular-nums;
  transform: rotate(-2deg);
  margin: 16px 0 24px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
/* Final breakdown is a list of per-round cards. The previous text-padding
   approach didn't align in the proportional Space Grotesk font; this
   uses CSS grid for proper columns. */
ul.fb-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.fb-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 3px solid #1a1b1e;
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 1);
  padding: 10px 14px;
}
.fb-row.miss { background: #ffdad6; }
.fb-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  color: #1a1b1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.fb-tier {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  background: #00a916;
  color: #003302;
  border: 2px solid #1a1b1e;
  white-space: nowrap;
}
.fb-row.miss .fb-tier { background: #ba1a1a; color: #fff; }
.fb-score {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: #a900a9;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 70px;
  letter-spacing: -0.01em;
}
@media (max-width: 720px) {
  .fb-row { padding: 8px 12px; gap: 8px; grid-template-columns: 1fr auto; }
  .fb-tier { grid-column: 2; }
  /* Score wraps below title on narrow screens */
  .fb-score { grid-column: 1 / -1; text-align: right; font-size: 16px; min-width: 0; }
  .fb-title { font-size: 14px; }
}

/* ---------- Footer / Gridfire banner (kept content, restyled) ---------- */

.site-footer {
  margin-top: 48px;
  padding: 0 0 32px;
  display: flex;
  justify-content: center;
}
.gridfire-banner {
  display: block;
  width: 100%;
  max-width: 560px;
  background: #fff;
  border: 4px solid #1a1b1e;
  box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 1);
  text-decoration: none;
  /* Rotation + translateZ(0) forces a GPU compositor layer on every
     browser (Mobile Safari ignores will-change for static transforms),
     keeping the banner's outline and "Also from this developer" text
     stable instead of shimmering on neighbor hover. */
  transform: rotate(0.8deg) translateZ(0);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  will-change: transform;
  backface-visibility: hidden;
}
.gridfire-banner:hover {
  transform: rotate(0.8deg) translate(-2px, -2px) translateZ(0);
  box-shadow: 10px 10px 0 0 rgba(0, 0, 0, 1);
}
.gridfire-banner img { display: block; width: 100%; height: auto; }
.gridfire-banner .banner-tag {
  display: block;
  background: #facc15;
  color: #1a1b1e;
  border-bottom: 4px solid #1a1b1e;
  padding: 8px 16px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Mobile (≤720px) ---------- */

@media (max-width: 720px) {
  .start-hero-logo { max-width: 88%; margin-bottom: 18px; filter: drop-shadow(5px 5px 0 #1a1b1e); }
  .brand-mark { font-size: 22px; padding: 3px 10px; box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1); }

  /* Compact header pills: drop the player pill (less critical info during
     play, frees up real estate for round + score), and switch the
     remaining pills to a horizontal label/value layout so the brand mark
     and the pills fit on one row at common phone widths. */
  #player-pill { display: none !important; }
  .tt-pill {
    flex-direction: row;
    align-items: baseline;
    gap: 5px;
    padding: 3px 9px;
  }
  .tt-pill .pill-label { font-size: 9px; }
  .tt-pill .pill-value { font-size: 14px; }

  .start-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .start-grid .start-card-wrap,
  .start-grid .scoreboard-personal,
  .start-grid .scoreboard-stack { grid-column: 1 / -1 !important; grid-row: auto !important; }
  .start-grid .scoreboard-personal { display: block; }
  .start-card { padding: 18px; }

  /* Compact category tabs so all four fit on one row at mobile widths
     instead of wrapping to two awkward rows (the strip's -4px overlap
     only handles a single row, so a second row stacks ugly). Slightly
     smaller font, tighter padding, smaller gap, less left indent.
     `nowrap` on the strip + `white-space: nowrap` on each chip + zero
     flex-shrink ensures every label stays on one line at its natural
     width. On very narrow viewports (<360px) the strip falls back to
     horizontal scroll rather than wrapping. */
  /* Strip is not scrollable on mobile under any circumstance. The four
     short labels fit in 320px+ viewports at the shrunk font/padding;
     anything narrower clips at the right edge rather than scrolling.
     `touch-action: none` blocks gesture capture so a tap-drag on a
     tab can't be promoted into a scroll (which on Chrome Android was
     causing a diagonal swipe to translate the chips vertically once
     a horizontal pan had been started). */
  .cat-tabs-strip {
    padding-left: 12px;
    gap: 3px;
    flex-wrap: nowrap;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
  }
  .cat-chip {
    padding: 6px 10px 8px;
    font-size: 11px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .cat-chip-active { padding-bottom: 12px; }

  .tt-card { padding: 16px; box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1); }
  .tt-card h2 { font-size: 24px; }

  /* Smaller reveal box on mobile so tier row + input fit above the fold
     during guessing. After answer, scrollIntoView (in quiz.js) brings
     the box back into view for the fanfare. */
  .reveal-box { max-width: 100%; max-height: 240px; aspect-ratio: 1 / 1; }
  .reveal-placeholder::after { font-size: 110px; text-shadow: 4px 4px 0 #1a1b1e; }
  /* Account for the sticky header when scrollIntoView fires on the box. */
  #reveal-box { scroll-margin-top: 80px; }

  .tier-row { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
  .tier-cell { padding: 8px 10px; }
  .tier-cell .tier-points { font-size: 13px; }

  #guess-input { font-size: 18px; padding: 10px 12px; }
  .suggestions li { font-size: 16px; padding: 12px 14px; }
  .tt-btn { padding: 14px 22px; font-size: 18px; }
  #final-score { font-size: 44px; padding: 12px 22px; }
  .gridfire-banner { transform: rotate(0deg); box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1); }

  /* Sticky "next round" CTA at the bottom of the viewport so the player
     can see + tap it while the reveal image / fanfare is in view at the
     top of the scroll. Hidden by default; appears when JS removes the
     .hidden class on round end. */
  #next-row:not(.hidden) {
    position: fixed;
    bottom: 12px;
    left: 14px;
    right: 14px;
    z-index: 60;
    margin: 0;
    animation: tt-slide-up 0.25s ease-out;
  }
  #next-row .tt-btn {
    width: 100%;
    box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 1);
  }
  /* Bottom padding inside #game so the sticky CTA doesn't permanently
     overlap the round-result text underneath. */
  #game { padding-bottom: 90px; }
}

@keyframes tt-slide-up {
  from { transform: translateY(120%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
