/* Fonts: Space Grotesk for headings and big numbers, Manrope for text. Both are SIL Open
   Font License (licences in fonts/) and served by this app, so no third-party requests (the
   CSP only allows our own origin anyway). Split into Latin and accented Latin ("latin-ext")
   files, so a page only downloads the characters it uses. */
@font-face {
  font-family: "Space Grotesk"; src: url("fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700; font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Space Grotesk"; src: url("fonts/space-grotesk-latin-ext.woff2") format("woff2");
  font-weight: 300 700; font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
/* Without "|" (U+007C): Manrope's looks exactly like a capital I, so "Xbox Series X|S"
   would read "XIS". The text stack falls back to Space Grotesk's for that one character. */
@font-face {
  font-family: "Manrope"; src: url("fonts/manrope-latin.woff2") format("woff2");
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0000-007B,U+007D-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Manrope"; src: url("fonts/manrope-latin-ext.woff2") format("woff2");
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* Tokens: neutral surfaces + one accent (validated green), light and dark selected separately. */
:root {
  color-scheme: light;
  --page: #f9f9f9;
  --surface: #ffffff;
  --ink: #191919;
  --ink-2: #666666;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #008a17;
  --accent-track: #d3ecd6; /* lighter step of the accent ramp */
  --success-ink: #006c10;
  --error-ink: #b42324;
  --mythic: #2fc94b;
  --mythic-ink: #006c10; /* text on the page surface */
  --mythic-glow: rgba(47, 201, 75, 0.35);
  --rare-ink: #6b3fc0; /* Rare: purple */
  --ultra-rare-ink: #9a5a00; /* Ultra rare: amber */
  --radius: 12px;
  --font-text: "Manrope", "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-text);
  font-family: var(--font-text);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0b0b0b;
    --surface: #191919;
    --ink: #efefef;
    --ink-2: #9c9c9c;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #0aac23;
    --accent-track: #173a1d;
    --success-ink: #53c556;
    --error-ink: #eb6263;
    --mythic: #3ddc58;
    --mythic-ink: #53c556;
    --mythic-glow: rgba(61, 220, 88, 0.35);
    --rare-ink: #b79cf2;
    --ultra-rare-ink: #f2b84b;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.4; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1, h2, h3, .tile-value, .brand { font-family: var(--font-display); }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }

/* Icons (static/icons.svg): line icons that take the surrounding text colour and size. */
.icon {
  width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.14em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.badge, .completed, .console-note, .back, .saved, .status, .gs, .brand, .secret-toggle > span {
  display: inline-flex; align-items: center; gap: 0.3em;
}
.gs { gap: 0.25em; font-variant-numeric: tabular-nums; }
.gs-strong { font-weight: 700; }
.icon-gs { stroke-width: 2.2; }
.status-unlocked .icon { color: var(--success-ink); }
.badge-mythic .icon { color: var(--mythic); }

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.brand { font-weight: 700; text-decoration: none; gap: 0.4em; }
.brand-icon { width: 1.35em; height: 1.35em; color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.topnav { display: flex; gap: 0.25rem; margin-right: auto; }
.topnav a {
  padding: 0.4rem 0.75rem; border-radius: 999px; text-decoration: none; font-weight: 600;
  color: var(--ink-2);
}
.topnav a:hover { color: var(--ink); background: var(--accent-track); }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--accent-track); }
.topbar-actions form { margin: 0; }
.topbar-actions a.button-quiet { text-decoration: none; }
.profile {
  display: flex; align-items: center; gap: 0.5rem; margin-right: 0.5rem; color: inherit;
  text-decoration: none; border-radius: 999px;
}
.profile:hover .gamertag { text-decoration: underline; }
.gamerpic { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--accent-track); flex-shrink: 0; }
.gamertag { font-weight: 600; }
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* Buttons & inputs */
button, input, select { font: inherit; color: inherit; }
.button-primary, .button-quiet, .segmented button {
  border-radius: 8px; padding: 0.5rem 0.9rem; cursor: pointer; border: 1px solid var(--border);
}
.button-primary { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.button-quiet, .segmented button { background: var(--surface); }
.button-quiet:hover, .segmented button:hover { border-color: var(--ink-2); }
input[type="search"], select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Read by screen readers, not shown. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* Dropdowns: native selects and the checkbox filters share one look, with the chevron
   set in from the border (the browser's own arrow sits almost against it). */
.select { position: relative; display: inline-flex; }
.select select { appearance: none; width: 100%; padding-right: 2.5rem; cursor: pointer; }
.select::after, .dropdown-button::after {
  content: ""; width: 1rem; height: 1rem; flex-shrink: 0; background: var(--ink-2);
  mask: url("chevron-down.svg") center / contain no-repeat; pointer-events: none;
}
.select::after { position: absolute; right: 0.85rem; top: 50%; translate: 0 -50%; }
.dropdown-button {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.5rem 0.85rem 0.5rem 0.75rem; cursor: pointer; white-space: nowrap;
}
.dropdown-button:hover, .select select:hover { border-color: var(--ink-2); }
.dropdown[open] > .dropdown-button::after { rotate: 180deg; }
.dropdown-items { left: 0; right: auto; margin: 0; min-width: 100%; }
.dropdown-option { display: flex; align-items: center; gap: 0.6rem; }
.dropdown-option input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }

/* KPI row */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 1rem; margin-bottom: 2rem; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.25rem;
}
.tile-label { color: var(--ink-2); font-size: 0.9rem; }
.tile-value { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-hero .tile-value { font-size: 2.5rem; }
.tile-value .icon-gs { width: 0.8em; height: 0.8em; color: var(--accent); }

/* Filters */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.75rem; }
.section-head p { margin: 0; }
.section-head h1 { font-size: 1.5rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filters input[type="search"] { flex: 1 1 240px; min-width: 0; }

/* Meter: thin, rounded, accent on a lighter step of the same ramp */
.meter {
  appearance: none; width: 100%; height: 8px; border: 0; border-radius: 4px;
  background: var(--accent-track); overflow: hidden; display: block;
}
.meter::-webkit-progress-bar { background: var(--accent-track); border-radius: 4px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 4px; }

.badge {
  white-space: nowrap; font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--ink-2);
}
/* Console badges keep full wording, so let them wrap on narrow cards rather than overflow. */
.game-card-meta > .badge-bc, .game-card-meta > .badge-360-only { white-space: normal; border-radius: 0.75rem; }
.badge-bc { color: var(--success-ink); border-color: currentColor; }
.badge-360-only { border-style: dashed; }
.console-note { margin: 0; }
.completed { color: var(--success-ink); font-weight: 600; }
.figures {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 0.75rem;
  margin: 0.5rem 0 0; font-variant-numeric: tabular-nums;
}
.figures > span { white-space: nowrap; }

/* Game grid */
.game-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: 1rem;
}
.game-card a {
  display: flex; flex-direction: column; height: 100%; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: transform 120ms ease, border-color 120ms ease;
}
.game-card a:hover { transform: translateY(-2px); border-color: var(--ink-2); }
.art { position: relative; }
.game-card .art-image, .art-placeholder { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--accent-track); display: block; }
.art-placeholder { display: grid; place-items: center; font-size: 3rem; color: var(--ink-2); }
.game-card-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.game-card h3 { font-size: 1rem; }
.game-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; font-size: 0.85rem; }
.game-card-meta > * { white-space: nowrap; }
.game-card .figures { margin-top: auto; font-size: 0.9rem; }
.empty { color: var(--ink-2); text-align: center; padding: 3rem 0; }

/* Mythic: green "heroic" frame on the art, star-in-laurel emblem, plus a text label */
.mythic-emblem {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.is-mythic .art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 3px var(--mythic), inset 0 0 18px var(--mythic-glow);
}
.game-card.is-mythic a { border-color: var(--mythic); box-shadow: 0 0 12px var(--mythic-glow); }
.game-card.is-mythic a:hover { border-color: var(--mythic); }
.game-hero.is-mythic { border-color: var(--mythic); box-shadow: 0 0 16px var(--mythic-glow); }
.game-hero .mythic-emblem { width: 40px; height: 40px; top: 6px; right: 6px; }
.badge-mythic { color: var(--mythic-ink); border-color: var(--mythic); font-weight: 600; }
.tile-mythic { border-color: var(--mythic); }
.tile-mythic .tile-value { display: flex; align-items: center; gap: 0.5rem; }
.tile-emblem { width: 1.15em; height: 1.15em; }

/* Game page */
.back { display: inline-block; margin-bottom: 1rem; color: var(--ink-2); text-decoration: none; }
.back:hover { color: var(--ink); }
.game-hero {
  display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem;
  position: relative; overflow: hidden; isolation: isolate;
}
/* Faded game screenshot behind the banner: the surface colour washes over it, strongest
   behind the text on the left, so the copy keeps its contrast in light and dark mode. */
.hero-backdrop {
  position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover;
}
.hero-backdrop-blur { filter: blur(28px) saturate(1.2); transform: scale(1.25); }
.game-hero:has(.hero-backdrop)::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--surface) 94%, transparent) 0%,
    color-mix(in srgb, var(--surface) 86%, transparent) 50%,
    color-mix(in srgb, var(--surface) 62%, transparent) 100%);
}
.game-description { margin: 0; max-width: 65ch; color: var(--ink-2); line-height: 1.45; }
.game-hero .art { flex-shrink: 0; border-radius: 8px; overflow: hidden; }
.game-hero .art-image { width: 140px; height: 140px; object-fit: cover; display: block; }
.game-hero-info { flex: 1; display: flex; flex-direction: column; gap: 0.6rem; }
.game-hero .figures { justify-content: flex-start; gap: 1.5rem; }
.segmented { display: inline-flex; gap: 0.25rem; margin-bottom: 1rem; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.achievement-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.achievement {
  display: flex; align-items: center; gap: 1rem; padding: 0.75rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.achievement img, .icon-placeholder { width: 56px; height: 56px; border-radius: 8px; flex-shrink: 0; object-fit: cover; }
.icon-placeholder { display: grid; place-items: center; background: var(--page); color: var(--ink-2); font-weight: 700; font-size: 1.5rem; }
.achievement.is-locked img { filter: grayscale(1); opacity: 0.5; }
.achievement-text { flex: 1; min-width: 0; }
.achievement-text h3 { font-size: 1rem; }
.achievement-text p { margin: 0.2rem 0 0; font-size: 0.9rem; }
/* Locked secrets: hidden until clicked. The whole row toggles; the button is for keyboards. */
.achievement.is-hidden-secret { cursor: pointer; }
.achievement.is-hidden-secret:hover { border-color: var(--ink-2); }
.achievement.is-hidden-secret:not(.is-revealed) .achievement-text h3 { color: var(--ink-2); font-style: italic; }
.secret-toggle { flex-shrink: 0; font-size: 0.85rem; padding: 0.35rem 0.75rem; }
.badge-secret { font-size: 0.7rem; vertical-align: middle; font-weight: 400; }
/* Rarity */
.rarity { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.achievement-text .rarity { margin-top: 0.35rem; font-size: 0.85rem; }
.badge-rarity { font-weight: 600; border-color: currentColor; }
.badge-rare { color: var(--rare-ink); }
.badge-ultra-rare { color: var(--ultra-rare-ink); }
.badge-ultra-rare .icon { width: 1.25em; height: 1.25em; }
.list-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 1rem; }
.list-controls .segmented { margin-bottom: 0; }

/* Dashboard achievement rows: "Your rarest achievements" and the hall of fame. Each is one
   row of cards (four on a wide screen) that the arrows, or a swipe, scroll through. */
.showcase, .progress, .hall-of-fame { margin-bottom: 2rem; }
.carousel {
  list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem;
  grid-auto-flow: column; grid-auto-columns: calc((100% - 3 * 0.75rem) / 4);
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel-controls { display: flex; gap: 0.4rem; }
.carousel-arrow { display: grid; place-items: center; padding: 0.4rem; border-radius: 999px; }
.carousel-arrow .icon { width: 1.2em; height: 1.2em; }
.carousel-arrow:disabled { opacity: 0.35; cursor: default; }
@media (max-width: 1000px) { .carousel { grid-auto-columns: calc((100% - 0.75rem) / 2); } }
/* Progress over time. Marks in the accent; text, ticks and grid in the text tokens. */
.timeline-picker { display: flex; flex-wrap: wrap; margin-bottom: 0.75rem; }
.chart {
  margin: 0 0 1rem; padding: 1rem 1rem 0.5rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.chart-title { font-family: var(--font-display); font-weight: 600; margin-bottom: 0.25rem; }
.chart-total { font-family: var(--font-text); font-weight: 400; color: var(--ink-2); margin-left: 0.4rem; }
.chart-plot { position: relative; min-height: 240px; }
.chart-svg { display: block; overflow: visible; }
.chart-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.chart-grid line { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick { fill: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-band { fill: var(--accent); fill-opacity: 0.15; }
.chart-edge { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-crosshair { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-tooltip {
  position: absolute; top: 0; display: flex; flex-direction: column; gap: 0.1rem; pointer-events: none;
  padding: 0.4rem 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); font-size: 0.85rem; white-space: nowrap;
}
.chart-tooltip strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.chart-tooltip span { color: var(--ink-2); }
.chart-note { font-size: 0.9rem; }
.chart-note .icon { margin-right: 0.3em; }
.setting-field { flex-direction: column; cursor: default; }
.setting-field input[type="month"] {
  width: auto; height: auto; padding: 0.45rem 0.6rem; margin: 0; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface);
}

@media (max-width: 600px) { .carousel { grid-auto-columns: 85%; } }

.ach-card {
  position: relative; scroll-snap-align: start; min-width: 0; min-height: 9.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.ach-card:hover { border-color: var(--ink-2); }
.ach-card-link {
  display: flex; gap: 0.85rem; align-items: flex-start; height: 100%; box-sizing: border-box;
  padding: 0.85rem; text-decoration: none; border-radius: inherit;
}
.ach-card-link img, .ach-card-link .icon-placeholder { width: 64px; height: 64px; border-radius: 8px; flex-shrink: 0; object-fit: cover; }
.ach-card-text { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.ach-card-text h3 { font-size: 0.95rem; }
.ach-card-text p { margin: 0; font-size: 0.85rem; }
.ach-card-game { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* Hall of fame */
.heading-icon { color: var(--ultra-rare-ink); margin-right: 0.35em; vertical-align: -0.12em; }
.ach-card-hof { border-color: color-mix(in srgb, var(--ultra-rare-ink) 45%, var(--border)); }
.ach-card-hof:hover { border-color: var(--ultra-rare-ink); }
.ach-card-hof .ach-card-link { padding-right: 2.5rem; } /* room for the menu button */
.ach-card-hof .menu { position: absolute; top: 0.4rem; right: 0.4rem; }
.ach-card-empty { border-style: dashed; background: transparent; }
.hof-add {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; background: none; border: 0; border-radius: var(--radius); color: var(--ink-2); cursor: pointer; font-size: 0.9rem;
}
.hof-add .icon { width: 2rem; height: 2rem; padding: 0.6rem; border-radius: 50%; border: 1.5px dashed currentColor; }
.hof-add:hover { color: var(--ink); background: var(--surface); }
.badge-hall-of-fame { color: var(--ultra-rare-ink); border-color: currentColor; font-size: 0.7rem; vertical-align: middle; font-weight: 600; }

/* Three-dots menu */
.menu { position: relative; flex-shrink: 0; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-button {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  cursor: pointer; color: var(--ink-2);
}
.menu-button:hover, .menu[open] > .menu-button { background: var(--page); color: var(--ink); }
.menu-button .icon { width: 1.25em; height: 1.25em; }
.menu-items {
  position: absolute; right: 0; top: calc(100% + 0.25rem); z-index: 5; min-width: 14rem; padding: 0.3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.menu-items form { margin: 0; }
.menu-item {
  width: 100%; text-align: left; background: none; border: 0; border-radius: 6px;
  padding: 0.5rem 0.65rem; cursor: pointer; white-space: nowrap;
}
.menu-item:hover { background: var(--page); }
.menu-item > span, .button-quiet > span[data-when] { display: inline-flex; align-items: center; gap: 0.5em; }

/* Hall of fame picker */
.picker {
  width: min(560px, calc(100vw - 2rem)); max-height: min(720px, calc(100vh - 2rem)); padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.picker[open] { display: flex; flex-direction: column; }
.picker::backdrop { background: rgba(0, 0, 0, 0.5); }
.picker-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem 0.5rem 1.25rem; }
.picker-head h2 { font-size: 1.15rem; }
.picker-close { display: grid; place-items: center; padding: 0.4rem; border-radius: 50%; }
.picker-body { overflow-y: auto; padding: 0.25rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.picker-search { width: 100%; box-sizing: border-box; }
.picker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.picker-row {
  width: 100%; display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; text-align: left;
  background: none; border: 1px solid var(--border); border-radius: 10px; box-sizing: border-box;
}
button.picker-row { cursor: pointer; }
button.picker-row:hover { border-color: var(--ink-2); }
.picker-row img, .picker-row .icon-placeholder { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex-shrink: 0; font-size: 1.2rem; }
.picker-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; font-size: 0.9rem; }
.picker-row form { margin: 0; flex-shrink: 0; }
.picker-row form .button-quiet { font-size: 0.85rem; padding: 0.35rem 0.65rem; }
.picker-added { display: inline-flex; align-items: center; gap: 0.3em; font-size: 0.85rem; flex-shrink: 0; }
.picker-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.85rem; padding: 0.3rem 0.65rem; }
.picker-game { font-size: 1rem; }

/* Toast: confirms hall of fame changes. */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 20;
  max-width: calc(100vw - 2rem); padding: 0.7rem 1.1rem; border-radius: 10px;
  background: var(--ink); color: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); font-size: 0.9rem;
}

/* Arriving from an achievement card: clear the sticky top bar and highlight the achievement. */
.achievement { scroll-margin-top: 6rem; }
.achievement:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.achievement-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; white-space: nowrap; font-size: 0.9rem; }

/* Login */
.login-card {
  max-width: 440px; margin: 4rem auto; padding: 2rem; display: flex; flex-direction: column; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.login-card p { margin: 0 0 0.75rem; }
.code-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.device-code { font-size: 2rem; font-weight: 700; letter-spacing: 0.15em; }
.error { color: var(--error-ink); }

/* Settings */
.settings-card {
  max-width: 640px; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.settings-card fieldset { border: 0; margin: 0 0 1rem; padding: 0; }
.settings-card legend { font-weight: 600; margin-bottom: 0.75rem; padding: 0; }
.setting { display: flex; gap: 0.75rem; align-items: flex-start; cursor: pointer; }
.setting input { width: 1.15rem; height: 1.15rem; margin: 0.1rem 0 0; accent-color: var(--accent); flex-shrink: 0; }
.setting > span { display: flex; flex-direction: column; gap: 0.2rem; }
.settings-actions { display: flex; align-items: center; gap: 1rem; }
.saved { color: var(--success-ink); font-weight: 600; }

@media (max-width: 600px) {
  .game-hero { flex-direction: column; align-items: flex-start; }
  /* Stacked layout: text spans the full width, so wash the backdrop evenly. */
  .game-hero:has(.hero-backdrop)::before { background: color-mix(in srgb, var(--surface) 88%, transparent); }
  .tile-hero { grid-column: 1 / -1; }  /* headline gamerscore gets its own row */
  .topbar { padding: 0.75rem 1rem; flex-wrap: wrap; row-gap: 0.5rem; }
  /* Profile and Games get their own row under the brand and buttons. */
  .topnav { order: 3; flex-basis: 100%; margin-right: 0; }
  .topnav a { flex: 1; text-align: center; }
  .container { padding: 1rem; }
  /* The gamerpic stands in for the gamertag; keep the name for screen readers. */
  .gamertag { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .profile { margin-right: 0.25rem; }
  .filters .dropdown, .filters .select { flex: 1 1 auto; }
  .achievement { flex-wrap: wrap; }
  .achievement-meta { flex-direction: row; gap: 0.75rem; width: 100%; justify-content: space-between; }
}
@media (max-width: 480px) {
  /* Room for Settings, Refresh and Sign out: the trophy stands in for the name. */
  .brand-name {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .brand { font-size: 1.1rem; }
  .topbar-actions { gap: 0.35rem; }
  .topbar-actions .button-quiet { padding: 0.45rem 0.65rem; white-space: nowrap; }
}
@media (max-width: 360px) {
  .topbar { gap: 0.5rem; }
  .topbar-actions .button-quiet { padding: 0.4rem 0.5rem; font-size: 0.875rem; }
  .gamerpic { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .game-card a { transition: none; }
}
