/* ============================================================================
   Spieleabend – warme Farbwelt, Anzeigetafel-Handschrift.
   Aufbau: erst die Farbtoken (hell + dunkel), dann die Bausteine.
   Wer Farben aendern will, aendert nur den obersten Block.
   ============================================================================ */

:root {
  /* Grundflaechen: cremiges Papier als Grund, echtes Weiss fuer Karten.
     Genau dieser Unterschied fehlte vorher - Karte und Hintergrund waren
     nahezu gleich hell, dadurch wirkte alles flach. */
  --color-background: #F5EFE6;
  --color-surface: #FFFFFF;
  --color-surface-variant: #EDE4D8;
  --color-topbar: #4A3428;
  --color-on-topbar: #F6EEE6;

  --color-primary: #A65B2A;
  --color-primary-container: #F6DFC9;
  --color-on-primary: #FFFFFF;
  --color-on-primary-container: #4A2410;

  --color-secondary: #2F6B4F;
  --color-secondary-container: #D9E8DE;
  --color-on-secondary-container: #16321F;

  --color-on-surface: #2A211B;
  --color-on-surface-variant: #6B5B4E;
  --color-outline: #C0AB94;
  --color-divider: #E3D6C5;

  --color-error: #A8322A;
  --color-error-container: #F6DAD5;
  --color-on-error-container: #4A100C;

  --color-gold: #C8961E;
  --color-silver: #9A9A94;
  --color-bronze: #B07439;

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;

  /* Warm getoente Schatten statt neutralem Grau - auf cremigem Grund wirkt
     ein grauer Schatten schmutzig. */
  --shadow-1: 0 1px 2px rgba(74,52,40,0.10), 0 3px 10px rgba(74,52,40,0.07);
  --shadow-2: 0 4px 18px rgba(74,52,40,0.16);
}

html[data-theme="dark"] {
  --color-background: #1A1512;
  --color-surface: #241D18;
  --color-surface-variant: #2E2621;
  --color-topbar: #241D18;
  --color-on-topbar: #EDE4DA;

  --color-primary: #E8A06A;
  --color-primary-container: #6B3D1E;
  --color-on-primary: #3A1D0A;
  --color-on-primary-container: #FBDCC2;

  --color-secondary: #6FBF95;
  --color-secondary-container: #2C4437;
  --color-on-secondary-container: #CDEAD9;

  --color-on-surface: #EDE4DA;
  --color-on-surface-variant: #BCAA9B;
  --color-outline: #7A6857;
  --color-divider: #3A302A;

  --color-error: #F0938A;
  --color-error-container: #5C231D;
  --color-on-error-container: #FBD9D4;

  --color-gold: #E5B547;
  --color-silver: #B8B4AC;
  --color-bronze: #C68A49;

  /* Im Dunkeln traegt kein Schatten - Tiefe entsteht ueber Helligkeitsstufen
     und eine haarfeine helle Kante. */
  --shadow-1: none;
  --shadow-2: 0 6px 22px rgba(0,0,0,0.45);
}

/* Spielerfarben: gleiche Reihenfolge und gleicher Farbton wie bisher, nur
   entsaettigt und waermer gestimmt. Alle dunkel genug fuer weisse Initialen. */
.player-color-0 { background: #4E8259; } .player-color-1 { background: #3F6F94; }
.player-color-2 { background: #A46B26; } .player-color-3 { background: #A84A5F; }
.player-color-4 { background: #7A5B96; } .player-color-5 { background: #3F8A8A; }
.player-color-6 { background: #B0563A; } .player-color-7 { background: #6E5648; }

html[data-theme="dark"] .player-color-0 { background: #6BA57B; }
html[data-theme="dark"] .player-color-1 { background: #5C93BC; }
html[data-theme="dark"] .player-color-2 { background: #C9924A; }
html[data-theme="dark"] .player-color-3 { background: #C4707F; }
html[data-theme="dark"] .player-color-4 { background: #9A83B4; }
html[data-theme="dark"] .player-color-5 { background: #5EACAC; }
html[data-theme="dark"] .player-color-6 { background: #CE7A5C; }
html[data-theme="dark"] .player-color-7 { background: #8F7666; }

/* ---------------------------------------------------------------- Grundlagen */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-background);
  color: var(--color-on-surface);
  -webkit-tap-highlight-color: transparent;
}

/* Zahlen laufen ueberall im gleichen Raster, damit Punktestaende beim
   Hochzaehlen nicht springen. */
.num, .score, .sb-points, .sb-rank { font-variant-numeric: tabular-nums; }

#app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--color-topbar);
  color: var(--color-on-topbar);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
  text-align: center;
}
.icon-btn {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.3rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,0.15); }
.topbar-actions { display: flex; }
.topbar-spacer { width: 40px; }

main.screen {
  flex: 1;
  padding: 16px;
  padding-bottom: 100px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

h2.screen-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-on-surface);
  margin: 4px 0 4px;
}
/* Kleine Zeile unter der Ueberschrift: zaehlt Kontext auf (z.B. "19 Spiele"). */
.screen-sub {
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-on-surface-variant);
  margin: 0 0 18px;
}

/* -------------------------------------------------------------------- Karten */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
  padding: 16px;
  margin-bottom: 12px;
}
html[data-theme="dark"] .card { border: 1px solid rgba(255,255,255,0.055); }
.card.container-tint { background: var(--color-surface-variant); }

/* ------------------------------------------------------------------- Buttons */

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-m);
  padding: 12px 20px;
  cursor: pointer;
  background: var(--color-primary);
  color: var(--color-on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.outlined {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-outline);
}
.btn.text { background: transparent; color: var(--color-primary); padding: 10px 12px; }
.btn.danger { background: var(--color-error); color: #fff; }
html[data-theme="dark"] .btn.danger { background: transparent; color: var(--color-error); border: 1.5px solid var(--color-error); }
.btn.danger.text { background: transparent; color: var(--color-error); border: none; }
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 0.85rem; }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

input[type="text"], input[type="number"], input[type="password"], textarea, select {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: var(--radius-m);
  border: 1.5px solid var(--color-outline);
  background: var(--color-surface);
  color: var(--color-on-surface);
  width: 100%;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent);
}
textarea { resize: vertical; }
label.field-label {
  font-size: 0.8rem;
  color: var(--color-on-surface-variant);
  margin-bottom: 4px;
  display: block;
}
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.spread { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.95rem;
  flex-shrink: 0;
}
.avatar.small { width: 28px; height: 28px; font-size: 0.75rem; }

.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px;
}

/* ==========================================================================
   ANZEIGETAFEL (Punktezaehler)
   Kein Kartenstapel mehr: eine Tafel, Rangfolge sichtbar, Fuehrender gross.
   ========================================================================== */

.sb {
  background: var(--color-surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  margin-bottom: 14px;
}
html[data-theme="dark"] .sb { border: 1px solid rgba(255,255,255,0.055); }

.sb-head { padding: 15px 15px 12px; border-bottom: 1px solid var(--color-divider); }
.sb-game { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sb-game .sb-name {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em;
  text-transform: uppercase; line-height: 1.08; min-width: 0;
  overflow-wrap: anywhere;
}
.sb-game .sb-meta {
  font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-on-surface-variant); white-space: nowrap;
}

/* Wertungsschalter: bestimmt, ob wenigste oder meiste Punkte fuehren. */
.sb-toggle {
  display: flex; align-items: center; gap: 10px; margin-top: 11px;
  background: none; border: none; padding: 0; width: 100%;
  font-family: inherit; cursor: pointer; color: inherit; text-align: left;
}
.sb-toggle .sb-toggle-label { font-size: 0.8rem; color: var(--color-on-surface-variant); flex: 1; }
.sb-toggle .sb-toggle-state {
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-on-surface-variant); width: 26px; text-align: right;
}
.sb-switch {
  width: 40px; height: 22px; border-radius: 11px; flex: none;
  background: var(--color-outline); position: relative; transition: background 0.15s;
}
.sb-switch::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: left 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.sb-switch.on { background: var(--color-secondary); }
.sb-switch.on::after { left: 21px; }

.sb-row {
  display: grid;
  grid-template-columns: 5px 26px 1fr auto;
  align-items: center;
  gap: 0 10px;
  padding: 12px 15px 12px 0;
  border-bottom: 1px solid var(--color-divider);
  position: relative;
}
.sb-row:last-child { border-bottom: none; }
/* Farbleiste laeuft ueber beide Zeilen (Name/Punkte oben, Tasten darunter). */
.sb-bar { width: 5px; grid-row: 1 / -1; align-self: stretch; border-radius: 0 3px 3px 0; }
.sb-rank {
  font-size: 0.85rem; color: var(--color-on-surface-variant);
  text-align: center; font-weight: 600;
}
.sb-player { font-weight: 600; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-points { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }

/* Der Fuehrende: goldener Grund, Versalien, groessere Zahl. */
.sb-row.leader { background: color-mix(in srgb, var(--color-gold) 14%, transparent); }
.sb-row.leader .sb-rank { color: var(--color-on-surface); font-weight: 800; }
.sb-row.leader .sb-player { text-transform: uppercase; letter-spacing: 0.02em; font-weight: 800; }
.sb-row.leader .sb-points { font-size: 2.15rem; }
.sb-crown { position: absolute; top: 7px; right: 14px; font-size: 0.72rem; color: var(--color-gold); }

/* Schnelltasten: kompakt in der Zeile statt vollbreit darunter. */
.sb-keys { grid-column: 3 / span 2; display: flex; gap: 6px; margin-top: 9px; }
.sb-keys button {
  flex: 1; border: none; border-radius: 8px; padding: 9px 0;
  font-family: inherit; font-weight: 700; font-size: 0.82rem; cursor: pointer;
  background: color-mix(in srgb, var(--color-primary) 13%, transparent);
  color: var(--color-primary);
}
.sb-keys button.minus {
  background: color-mix(in srgb, var(--color-error) 13%, transparent);
  color: var(--color-error);
}
.sb-keys button:active { transform: scale(0.96); }
.sb-keys button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.sb-empty { padding: 26px 16px; text-align: center; color: var(--color-on-surface-variant); }

/* ==========================================================================
   LISTEN (Bibliothek, Historie, Spieler)
   Struktur aus Linien und Raum statt aus lauter Kaesten.
   ========================================================================== */

.lst {
  background: var(--color-surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  margin-bottom: 14px;
}
html[data-theme="dark"] .lst { border: 1px solid rgba(255,255,255,0.055); }
.lst-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-divider);
}
.lst-row:last-child { border-bottom: none; }
.lst-row.tap { cursor: pointer; }
.lst-row.tap:active { background: var(--color-surface-variant); }
.lst-main { flex: 1; min-width: 0; }
.lst-title { font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; }
.lst-sub { font-size: 0.79rem; color: var(--color-on-surface-variant); margin-top: 2px; }
.lst-right { text-align: right; font-size: 0.74rem; color: var(--color-on-surface-variant); line-height: 1.35; flex: none; }
/* Zeile mit ausklappbarem Detailbereich (Bibliothek). Die Trennlinie sitzt
   am Wrapper, damit sie unter dem aufgeklappten Text durchlaeuft. */
.lst-item { border-bottom: 1px solid var(--color-divider); }
.lst-item:last-child { border-bottom: none; }
.lst-item .lst-row { border-bottom: none; }
.lst-body { padding: 0 14px 14px; font-size: 0.9rem; }

.lst-head {
  padding: 12px 14px 10px;
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-on-surface-variant);
  border-bottom: 1px solid var(--color-divider);
}
.lst-dim { opacity: 0.5; }

/* Vorschaubild in Listenzeilen: zweischichtig wie die grosse Karte, damit
   auch hochformatige Schachtelbilder randlos sitzen. */
.lst-thumb {
  width: 54px; height: 54px; border-radius: var(--radius-s);
  flex: none; position: relative; overflow: hidden;
  background: var(--color-surface-variant);
}
.lst-thumb .img-bg {
  position: absolute; inset: -6px;
  background-size: cover; background-position: center;
  filter: blur(8px) brightness(0.7);
}
.lst-thumb .img-fg {
  position: absolute; inset: 0;
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
.lst-thumb .thumb-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; opacity: 0.5;
}

/* Historie: Sieger gross, die uebrigen als knappe Zeile darunter. */
.hs-win { display: flex; align-items: baseline; gap: 9px; margin-top: 8px; }
.hs-win .hs-crown { color: var(--color-gold); font-size: 0.95rem; }
.hs-win .hs-name { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hs-win .hs-pts { font-size: 1.15rem; font-weight: 800; margin-left: auto; font-variant-numeric: tabular-nums; }
.hs-rest {
  display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 5px;
  font-size: 0.83rem; color: var(--color-on-surface-variant);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Sonstiges */

.fab-stack {
  position: fixed;
  right: 20px; bottom: 24px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  z-index: 15;
}
.fab {
  border: none; border-radius: 28px; cursor: pointer;
  background: var(--color-primary); color: var(--color-on-primary);
  box-shadow: var(--shadow-2);
  padding: 16px; font-size: 1.3rem;
  display: flex; align-items: center; gap: 8px;
}
.fab.small { padding: 10px; font-size: 1.1rem; background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-2); }
html[data-theme="dark"] .fab.small { border: 1px solid var(--color-divider); }
.fab.extended { padding: 14px 20px; font-size: 0.95rem; font-weight: 700; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 20px;
  border: 1.5px solid var(--color-outline);
  background: transparent; color: var(--color-on-surface-variant);
  font-size: 0.85rem; cursor: pointer; font-family: inherit;
}
.chip.selected {
  background: var(--color-secondary); border-color: transparent;
  color: #fff; font-weight: 600;
}
html[data-theme="dark"] .chip.selected { color: #12241A; }

.badge {
  display: inline-block;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.badge.highlight { background: rgba(168,50,42,0.8); }

/* Grosse Bildkarte - weiterhin fuer die Bibliothek in den Einstellungen und
   den Kopf des laufenden Spiels in Gebrauch. */
.game-card {
  border-radius: var(--radius-m);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  margin-bottom: 12px;
  background: var(--color-surface);
  cursor: pointer;
}
html[data-theme="dark"] .game-card { border: 1px solid rgba(255,255,255,0.055); }
.game-card.dim { opacity: 0.55; }
.game-card-image {
  position: relative;
  height: 120px;
  overflow: hidden;
  background: #6B5647;
  display: flex; flex-direction: column; justify-content: space-between;
}
/* Zweischichtiges Bild: unscharfer, gezoomter Hintergrund fuellt die Flaeche randlos,
   das eigentliche Bild bleibt darueber komplett sichtbar (kein Beschnitt). */
.game-card-image .img-bg {
  position: absolute; inset: -12px;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  filter: blur(14px) brightness(0.65);
  transform: scale(1.15);
  z-index: 0;
}
.game-card-image .img-fg {
  position: absolute; inset: 0;
  background-size: contain; background-position: center; background-repeat: no-repeat;
  z-index: 1;
}
.game-card-image .top-row { display: flex; justify-content: space-between; padding: 8px; position: relative; z-index: 3; }
.game-card-image .badges { display: flex; gap: 4px; flex-wrap: wrap; }
.game-card-image .title {
  color: white; font-weight: 700; font-size: 1.15rem; padding: 12px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  position: relative; z-index: 3;
}
.game-card-image::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.65));
  pointer-events: none;
  z-index: 2;
}
.game-card-body { padding: 14px; }

.tabs { display: flex; border-bottom: 1px solid var(--color-divider); margin-bottom: 16px; }
.tab {
  flex: 1; text-align: center; padding: 12px 4px; cursor: pointer;
  border-bottom: 3px solid transparent; font-weight: 600; color: var(--color-on-surface-variant);
  background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; font-size: 0.9rem;
}
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(30,20,14,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-l);
  padding: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2);
}
.modal h3 { margin-top: 0; font-size: 1.2rem; letter-spacing: -0.01em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal-actions .spacer { flex: 1; }

.modal.fullscreen {
  max-width: none; width: 100%; height: 100%; max-height: 100%;
  border-radius: 0; display: flex; flex-direction: column; padding: 0;
}

.progress-ring, .empty-hint { text-align: center; color: var(--color-on-surface-variant); padding: 40px 20px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #33261D; color: #F6EEE6; padding: 12px 20px; border-radius: 24px;
  font-size: 0.9rem; z-index: 200; box-shadow: var(--shadow-2);
  max-width: 90vw;
}

.medal { width: 26px; display: inline-block; text-align: center; }
.gold-row { background: color-mix(in srgb, var(--color-gold) 16%, transparent); }
.silver-row { background: color-mix(in srgb, var(--color-silver) 16%, transparent); }
.bronze-row { background: color-mix(in srgb, var(--color-bronze) 15%, transparent); }

.tool-grid { display: flex; gap: 12px; }
.tool-tile {
  flex: 1; border-radius: var(--radius-m); padding: 16px; text-align: center;
}
.tool-tile .value { font-size: 1.7rem; font-weight: 800; margin: 6px 0; font-variant-numeric: tabular-nums; }

.qp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.qp-btn {
  border: none; border-radius: var(--radius-s); padding: 10px 4px; font-weight: 700; font-size: 0.85rem; cursor: pointer;
  font-family: inherit;
}

.bar-track { height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--color-on-surface) 12%, transparent); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }

a { color: var(--color-primary); }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background: var(--color-outline);
  border-radius: 26px; transition: 0.15s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: 0.15s;
}
.switch input:checked + .slider { background: var(--color-secondary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px;
  background: var(--color-topbar); color: var(--color-on-topbar);
  padding: 12px 16px; border-radius: var(--radius-m);
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-2); z-index: 150;
}
.install-banner .btn { background: var(--color-primary); color: var(--color-on-primary); }

.pin-gate {
  position: fixed; inset: 0; z-index: 500;
  background: var(--color-background);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.pin-gate-box {
  width: 100%; max-width: 320px;
  background: var(--color-surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-2);
  padding: 28px 24px;
  text-align: center;
}
.pin-gate-box h2 { margin: 0 0 8px; letter-spacing: -0.01em; }
.pin-gate-box p { margin: 0 0 16px; color: var(--color-on-surface-variant); }
.pin-gate-box input {
  width: 100%; text-align: center; letter-spacing: 4px; font-size: 1.3rem;
}

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.badge-item {
  text-align: center; padding: 12px 8px; border-radius: var(--radius-m);
  background: var(--color-surface-variant); opacity: 0.45; filter: grayscale(1);
}
.badge-item.unlocked { opacity: 1; filter: none; background: var(--color-primary-container); color: var(--color-on-primary-container); }
.badge-icon { font-size: 1.8rem; }
.badge-title { font-weight: 700; font-size: 0.85rem; margin-top: 4px; }
.badge-desc { font-size: 0.72rem; color: var(--color-on-surface-variant); margin-top: 2px; }
.badge-item.unlocked .badge-desc { color: inherit; opacity: 0.75; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--color-on-surface) 25%, transparent); border-radius: 4px; }
