/* Design angelehnt an fontawesome.com: hell, Navy-Text, runde Schrift,
   farbige Karten mit dickem Rand unten und Pill-Badges. */

/* Dark ist Standard; Light über <html data-theme="light"> (Umschalter oben rechts).
   --navy ist die Haupt-Textfarbe (im Dark-Theme hell). */
:root {
  --page: #0e1a2b;
  --topbar: rgba(14, 26, 43, 0.88);
  --navy: #e9eef6;
  --muted: #94a3bd;
  --card: #1a2b45;
  --line: #2f4366;
  --yellow: #ffd43b;
  --blue: #74c0fc;
  --on-accent: #183153;
  --ok: #69db7c;
  --danger-text: #ff8787;
  --radius: 20px;
  --topbar-h: 80px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --page: #f0f1f3;
  --topbar: rgba(240, 241, 243, 0.9);
  --navy: #183153;
  --muted: #616d8a;
  --card: #ffffff;
  --line: #c3c6d1;
  --ok: #2b8a3e;
  --danger-text: #c92a2a;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--navy);
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.55;
}

a { color: inherit; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 14px 40px;
  background: var(--topbar);
  backdrop-filter: blur(10px);
}
.logo {
  white-space: nowrap;
  font-size: 1.6rem;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo span {
  display: inline-block;
  margin-left: 2px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--on-accent);
}

.theme-toggle {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--navy); }
.theme-toggle svg { width: 22px; height: 22px; }
.search {
  width: 100%;
  height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
}
.search-wrap {
  position: relative;
  min-width: 0;
  flex: 1;
  max-width: 440px;
  margin-left: auto;
}
/* „Zuletzt gespielt“ und Favoriten klappen beim Klick ins leere Suchfeld auf */
.search-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 10px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
}
.search-pop h3 {
  margin: 4px 8px 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.search-pop h3:not(:first-child) { margin-top: 14px; }
.search-pop p { margin: 4px 8px 6px; color: var(--muted); font-weight: 700; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 12px;
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}
.recent-item:hover, .recent-item:focus-visible { outline: none; background: color-mix(in srgb, var(--line) 55%, transparent); }
.recent-thumb {
  flex: none;
  width: 52px;
  height: 39px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg);
}
.recent-thumb .art { display: block; width: 100%; height: 100%; }
.search::placeholder { color: var(--muted); font-weight: 600; }
.search:focus { outline: none; border-color: var(--navy); }

main {
  max-width: 2400px;
  margin: 0 auto;
  padding: 8px 40px 64px;
}

/* ---------- Badges ---------- */
.badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 4px 16px;
  border-radius: 999px;
  --accent: var(--yellow);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge--soon { --accent: var(--blue); }
/* Kartenfarbe ≈ Badge-Farbe: dunkle Pille mit farbiger Schrift, damit der Badge sichtbar bleibt */
.badge--alt {
  background: var(--on-accent);
  color: var(--accent);
}
.tile .badge { top: 10px; left: auto; right: 10px; transform: none; font-size: 0.72rem; padding: 3px 12px; }

/* ---------- Filter-Chips ---------- */
.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 32px;
}
/* Überschrift der Spieleliste mit Platz für den Filter-Knopf (Handy) rechts daneben */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 14px; }
.section-head h2 { min-width: 0; margin: 0; }

/* Handy: Filter als Dropdown statt Chip-Reihe (Übersicht und Shop), spart Platz */
.dropdown { position: relative; display: none; flex: none; }
.dropdown-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 16px; }
.dropdown-btn svg { flex: none; width: 16px; height: 16px; }
.dropdown-chevron { transition: transform 0.15s; }
.dropdown-btn[aria-expanded="true"] .dropdown-chevron { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  min-width: 220px;
  max-height: min(60vh, 440px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.dropdown-menu[hidden] { display: none; }
.dropdown--end .dropdown-menu { left: auto; right: 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--navy);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus-visible { outline: none; background: rgba(127, 127, 127, 0.14); }
.dropdown-item[aria-selected="true"] { background: rgba(127, 127, 127, 0.1); }
.dropdown-check { flex: none; width: 18px; height: 18px; }
.page > .dropdown { margin-top: 20px; }
@media (max-width: 700px) {
  .chips--collapse { display: none; }
  .dropdown { display: block; }
  .section-head { margin-top: 20px; }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* PC: Filter der Übersicht bleiben beim Scrollen direkt unter der Kopfzeile (74px = 46px Knöpfe + 2 × 14px) */
@media (min-width: 901px) {
  .chips--sticky {
    position: sticky;
    top: 74px;
    z-index: 5;
    margin: 20px -40px 0;
    padding: 12px 40px;
    /* wie die Kopfzeile: durchscheinend und weichgezeichnet, über die volle Breite */
    background: var(--topbar);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}
.chip {
  padding: 8px 20px;
  border-radius: 999px;
  border: 2px solid var(--navy);
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chip:hover { background: rgba(24, 49, 83, 0.08); }
.chip--active, .chip--active:hover { background: var(--navy); color: var(--page); }

section h2 { font-size: 1.3rem; font-weight: 900; margin: 32px 0 14px; }

/* ---------- Spiele-Kacheln ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 22px;
}
.tile {
  --foot: color-mix(in srgb, var(--bg) 65%, var(--edge));
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 5px 0 var(--edge);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile-art { aspect-ratio: 4 / 3; overflow: hidden; }
.tile-art .art { display: block; width: 100%; height: 100%; transition: transform 0.3s ease; }
.tile-foot {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 10px 14px 12px;
  background: var(--foot);
}
.tile-name { font-size: 1.02rem; font-weight: 900; }
.tile-cats { font-size: 0.78rem; font-weight: 700; opacity: 0.75; }

.tile.is-playable:hover, .tile.is-playable:focus-within { transform: translateY(-4px); box-shadow: 0 9px 0 var(--edge); }
.is-playable:hover .art { transform: scale(1.05); }

.is-soon { cursor: default; }
.is-soon .tile-art { filter: saturate(0.55); opacity: 0.8; }

.art-num {
  font-family: var(--font);
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
}

.empty { color: var(--muted); margin-top: 32px; font-size: 1.1rem; }

/* ---------- Buttons ---------- */
.btn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--navy);
  background: var(--card);
  color: var(--navy);
  font: inherit;
  font-weight: 800;
  text-decoration: none; /* auch Links im Knopf-Stil (z. B. „Jetzt kaufen“ nach der Probe-Runde) */
  cursor: pointer;
  box-shadow: 0 3px 0 var(--navy);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--navy); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.btn--primary { background: var(--yellow); color: var(--on-accent); border-color: var(--on-accent); box-shadow: 0 3px 0 var(--on-accent); }

/* ---------- Spieleseite ---------- */
.game-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}
.game-head h1 { margin: 0; font-size: 1.9rem; font-weight: 900; flex: 1; }
.back { text-decoration: none; font-weight: 800; color: var(--muted); }
.back:hover { color: var(--navy); }
.game-actions { display: flex; gap: 12px; }
.game-actions .btn { display: inline-flex; align-items: center; gap: 8px; }
.game-actions .btn[hidden] { display: none; }
.game-actions .btn svg { flex: none; width: 18px; height: 18px; }
/* Aktiver Umschalter (z. B. Favorit): gelb gefüllt wie der Hauptknopf */
.btn.is-on, .btn.is-on:hover, .btn.is-on:active { background: var(--yellow); color: var(--on-accent); border-color: var(--on-accent); }
.btn.is-on { box-shadow: 0 3px 0 var(--on-accent); }
.btn.is-on:hover { box-shadow: 0 4px 0 var(--on-accent); }
.btn.is-on:active { box-shadow: 0 1px 0 var(--on-accent); }

/* Bühne = sichtbare Fensterhöhe unter der Kopfzeile. Das Spielfeld passt sich per
   Container-Einheiten (cqi/cqh) an Breite UND Höhe des Rahmens an. */
.game-stage {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--topbar-h) - 28px);
  min-height: 380px;
}
/* Vollbild-Bereich: Rahmen + „Vollbild beenden“-Knopf */
.game-fs {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 14px;
}
.game-frame {
  flex: 1;
  min-height: 0;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--edge, var(--card));
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}
.game-fs:fullscreen, .game-fs.is-fs { margin: 0; background: var(--page); }
.game-fs:fullscreen .game-frame, .game-fs.is-fs .game-frame { border-radius: 0; padding: 64px 24px 24px; box-shadow: none; }
/* Vollbild-Ersatz für iPhone-Safari (kein Element-Vollbild): Rahmen füllt das ganze Fenster */
.game-fs.is-fs { position: fixed; inset: 0; z-index: 200; }
html.fs-lock, html.fs-lock body { overflow: hidden; overscroll-behavior: none; }
.fs-exit {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(14, 26, 43, 0.6);
  color: #fff;
  cursor: pointer;
}
.fs-exit svg { width: 22px; height: 22px; }
.fs-exit:hover { background: rgba(14, 26, 43, 0.8); }
.game-fs:fullscreen .fs-exit, .game-fs.is-fs .fs-exit { display: grid; }

/* Probe-Runde („Ausprobieren“ im Shop): schmale Leiste über dem Spielfeld, danach Abschluss-Karte im Rahmen */
.trial-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 6px 6px 6px 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font-weight: 800;
}
.trial-tag {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.trial-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trial-rules { color: var(--muted); }
.trial-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.trial-bar .btn { flex: none; }
.trial-end {
  width: min(100%, 420px);
  max-height: 100%;
  overflow: auto;
  padding: 24px 22px;
  border-radius: 20px;
  background: var(--card);
  color: var(--navy);
  text-align: center;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}
.trial-end h2 { margin: 4px 0 8px; font-size: 1.5rem; font-weight: 900; }
.trial-end-kicker { margin: 0; color: var(--muted); font-size: 0.85rem; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; }
.trial-end-text { margin: 0 0 12px; color: var(--muted); font-weight: 700; }
.trial-end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.btn--try { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn--try .i-play { flex: none; width: 16px; height: 16px; }

.game-info { max-width: 820px; margin-top: 28px; font-size: 1.1rem; color: var(--muted); }
.game-info strong { color: var(--navy); }
.cat {
  display: inline-block;
  margin-right: 8px;
  padding: 3px 14px;
  border-radius: 999px;
  border: 2px solid var(--navy);
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Snake ---------- */
.snake { width: min(100cqi, (100cqh - 52px) * 17 / 15); }
@media (pointer: coarse) { .snake { width: min(100cqi, (100cqh - 190px) * 17 / 15); } }
.snake-hud {
  display: flex;
  gap: 28px;
  align-items: center;
  padding: 8px 16px;
  border-radius: 14px 14px 0 0;
  background: #4a752c;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
}
.snake-stat { display: inline-flex; align-items: center; gap: 8px; }
.snake-board { position: relative; }
.snake-board canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0 0 14px 14px;
  touch-action: none;
}
.snake-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  border-radius: 0 0 14px 14px;
  background: rgba(24, 49, 83, 0.55);
  color: #fff;
}
.snake-overlay[hidden] { display: none; }
.snake-overlay p { margin: 0; font-size: 2.6rem; font-weight: 900; }
.snake-overlay small { font-weight: 700; opacity: 0.85; }
.snake-overlay .btn { padding: 14px 40px; font-size: 1.2rem; }
.snake-pad {
  display: none;
  grid-template-columns: repeat(3, 60px);
  grid-template-areas: ". up ." "left down right";
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.snake-pad button {
  height: 52px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 1.2rem;
}
.snake-pad [data-dir="up"] { grid-area: up; }
.snake-pad [data-dir="left"] { grid-area: left; }
.snake-pad [data-dir="down"] { grid-area: down; }
.snake-pad [data-dir="right"] { grid-area: right; }
@media (pointer: coarse) {
  .snake-pad { display: grid; }
}

/* ---------- Kleinere Bildschirme (Desktop first) ---------- */
@media (max-width: 700px) {
  .topbar { padding: 12px 16px; gap: 12px; }
  .logo { font-size: 1.25rem; }
  main { padding: 8px 16px 48px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 18px; }
  .tile-foot { padding: 10px 12px 12px; }
  .tile-cats { display: none; }
  /* Spieleseite: eine Zeile (Zurück · Titel · Icon-Knöpfe), damit das Spielfeld möglichst groß wird */
  .game-stage { height: calc(100dvh - var(--topbar-h) - 16px); }
  .game-head { flex-wrap: nowrap; gap: 10px; margin-top: 10px; }
  .game-head h1 { min-width: 0; font-size: 1.25rem; line-height: 1.15; overflow-wrap: break-word; }
  .game-head .back { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-size: 1.15rem; }
  .back-label { display: none; }
  .game-actions { flex: none; gap: 8px; }
  .game-actions .btn { justify-content: center; width: 40px; height: 40px; padding: 0; }
  .game-actions .btn-label { display: none; }
  .game-fs { margin-top: 10px; }
  .trial-bar { gap: 8px; margin-top: 10px; }
  .trial-rules { display: none; }
  .game-fs:fullscreen .game-frame, .game-fs.is-fs .game-frame { padding: 62px 12px 12px; }
  .game-frame { padding: 10px; }
  .game-info { margin-top: 20px; font-size: 1rem; }
  .snake-hud { font-size: 1.1rem; }
}

/* ---------- Link über ganzer Karte + Favoriten-Stern ---------- */
.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius);
}
.card-link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.fav-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(14, 26, 43, 0.55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
}
.fav-btn svg { width: 19px; height: 19px; }
.is-playable:hover .fav-btn, .is-playable:focus-within .fav-btn, .fav-btn.is-on { opacity: 1; }
.fav-btn:hover { transform: scale(1.12); background: rgba(14, 26, 43, 0.8); }
.fav-btn.is-on { color: var(--yellow); }
@media (hover: none) {
  .fav-btn { opacity: 1; }
}

/* ---------- 2048 ---------- */
.g2048 {
  container-type: inline-size;
  width: min(100cqi, 100cqh - 76px);
}
.g2048-hud {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}
.g2048-box {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 110px;
  padding: 6px 18px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  line-height: 1.15;
}
.g2048-box span {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}
.g2048-box b { font-size: 1.7rem; font-weight: 900; }
.g2048-plus {
  position: absolute;
  right: 12px;
  top: 6px;
  font-style: normal;
  font-weight: 900;
  font-size: 1.1rem;
  color: #fff;
  opacity: 0;
  pointer-events: none;
}
.g2048-plus.is-anim { animation: g2048-plus 0.7s ease-out; }
@keyframes g2048-plus {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-34px); }
}
.g2048-new { margin-left: auto; align-self: center; }
@container (max-width: 420px) {
  .g2048-hud { gap: 8px; margin-bottom: 12px; }
  .g2048-box { flex: 1; min-width: 0; padding: 6px 12px; }
  .g2048-box b { font-size: 1.3rem; }
  .g2048-new { flex: none; padding: 10px 14px; font-size: 0.85rem; }
}

.g2048-board {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.4cqi;
  padding: 2.4cqi;
  border-radius: 18px;
  background: #e8890c;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12);
  touch-action: none;
  user-select: none;
}
.g2048-cell { border-radius: 12px; background: rgba(255, 255, 255, 0.22); }
.g2048-tiles { position: absolute; inset: 2.4cqi; }
.g2048-tile {
  position: absolute;
  top: 0;
  left: 0;
  width: 22cqi;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-weight: 900;
  font-size: 13cqi;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.14);
  transform: translate(calc(var(--c) * 24.4cqi), calc(var(--r) * 24.4cqi));
  transition: transform 110ms ease-in-out;
  z-index: 1;
}
.g2048-tile[data-digits="3"] { font-size: 10.5cqi; }
.g2048-tile[data-digits="4"] { font-size: 8cqi; }
.g2048-tile[data-digits="5"] { font-size: 6.5cqi; }
.g2048-tile.is-new { animation: g2048-new 160ms ease-out 60ms backwards; }
.g2048-tile.is-merged { animation: g2048-pop 180ms ease-out; z-index: 2; }
@keyframes g2048-new {
  from { scale: 0; }
  to { scale: 1; }
}
@keyframes g2048-pop {
  0% { scale: 0.9; }
  50% { scale: 1.15; }
  100% { scale: 1; }
}

.g2048-tile[data-v="2"] { background: #fff9db; color: #5c3c00; }
.g2048-tile[data-v="4"] { background: #fff3bf; color: #5c3c00; }
.g2048-tile[data-v="8"] { background: #ffc078; color: #fff; }
.g2048-tile[data-v="16"] { background: #ffa94d; color: #fff; }
.g2048-tile[data-v="32"] { background: #ff8787; color: #fff; }
.g2048-tile[data-v="64"] { background: #fa5252; color: #fff; }
.g2048-tile[data-v="128"] { background: #74c0fc; color: #fff; }
.g2048-tile[data-v="256"] { background: #4dabf7; color: #fff; }
.g2048-tile[data-v="512"] { background: #9775fa; color: #fff; }
.g2048-tile[data-v="1024"] { background: #7048e8; color: #fff; }
.g2048-tile[data-v="2048"] { background: #ffd43b; color: #183153; box-shadow: 0 5px 0 #f08c00, 0 0 30px rgba(255, 212, 59, 0.8); }
.g2048-tile[data-v="super"] { background: #183153; color: #ffd43b; }

.g2048-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border-radius: 18px;
  background: rgba(24, 49, 83, 0.6);
  color: #fff;
  text-align: center;
  animation: g2048-fade 0.3s ease-out;
}
.g2048-overlay[hidden] { display: none; }
.g2048-overlay p { margin: 0; font-size: 2.6rem; font-weight: 900; }
.g2048-overlay-actions { display: flex; gap: 12px; }
.g2048-overlay .btn { padding: 12px 28px; font-size: 1.1rem; }
@keyframes g2048-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Gemeinsames Spiel-Layout: Bedienfeld neben dem Spielfeld ----------
   Das Spielfeld berechnet seine Größe selbst über cqi/cqh des Spielrahmens. */
.gp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 100%;
  height: 100%;
  color: #fff;
}
.gp-panel {
  flex: none;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.gp-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.gp-group[hidden] { display: none; }
.gp-seg { display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); }
.gp-seg button {
  flex: 1;
  padding: 7px 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}
.gp-seg button { min-width: 0; white-space: nowrap; }
.gp-seg--tight button { padding-inline: 2px; font-size: 0.8rem; }
.gp-seg button:hover { background: rgba(255, 255, 255, 0.1); }
.gp-seg button.is-active { background: #fff; color: #183153; }
.gp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gp-stat {
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  line-height: 1.15;
}
.gp-stat span {
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}
.gp-stat b { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.gp-hint { margin: 0; font-size: 0.8rem; font-weight: 700; line-height: 1.4; opacity: 0.7; }
.gp-hint kbd {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  font: inherit;
  font-weight: 900;
}

/* Abschluss-Overlay über dem Spielfeld (gewonnen, verloren, Pause) */
.gp-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  border-radius: inherit;
  background: rgba(24, 49, 83, 0.62);
  color: #fff;
  text-align: center;
  animation: gp-fade 0.3s ease-out;
}
.gp-overlay[hidden] { display: none; }
.gp-overlay p { margin: 0; font-size: clamp(1.4rem, 5cqi, 2.6rem); font-weight: 900; line-height: 1.15; }
.gp-overlay small { font-size: 1rem; font-weight: 700; opacity: 0.85; }
.gp-overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.gp-overlay .btn { padding: 12px 28px; font-size: 1.05rem; }
@keyframes gp-fade {
  from { opacity: 0; }
}

/* Schmaler Spielrahmen: Bedienfeld über das Spielfeld */
@container (max-width: 760px) {
  .gp { flex-direction: column; gap: 12px; }
  .gp-panel { width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
  .gp-label, .gp-hint { display: none; }
  /* Punkte kompakt in einer Zeile – sonst wird das Bedienfeld auf kleinen Handys zu hoch fürs Spielfeld */
  .gp-stats { flex: 1 1 100%; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; gap: 6px; }
  .gp-stat { min-width: 0; padding: 5px 10px; }
  .gp-stat span { font-size: 0.6rem; }
  .gp-stat b { font-size: 1.1rem; }
  .gp-panel > .btn { padding: 8px 16px; font-size: 0.9rem; }
}

/* ---------- Vier gewinnt ---------- */
.c4-players { display: flex; flex-direction: column; gap: 10px; }
.c4-player {
  --chip: #fa5252;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}
.c4-player[data-player="2"] { --chip: #fcc419; }
.c4-player.is-turn, .c4-player.is-winner {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 2px var(--chip);
}
.c4-player.is-turn { transform: translateX(6px); }
.c4-chip {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--chip);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.c4-player-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.c4-player-text b { font-size: 1.05rem; font-weight: 900; }
.c4-player-text small { min-height: 1.2em; font-size: 0.8rem; font-weight: 700; opacity: 0.75; }
.c4-score { font-size: 1.7rem; font-weight: 900; }

/* Bühne: quadratisch = Vorschau-Zeile + Brett (Maße in Prozent der 732er SVG-Geometrie) */
.c4-stage {
  position: relative;
  flex: none;
  width: min(100cqh, 100cqi - 268px);
  aspect-ratio: 1;
  container-type: inline-size;
  user-select: none;
  touch-action: manipulation;
}
.c4-discs { position: absolute; inset: 0; overflow: hidden; }
.c4-board {
  position: absolute;
  left: 0;
  top: 13.661%;
  width: 100%;
  height: 86.339%;
  border-radius: 4.098% / 4.747%;
  box-shadow: 0 1.3cqi 0 #364fc7;
  pointer-events: none;
}
.c4-board svg { display: block; width: 100%; height: 100%; }
.c4-col-hl {
  position: absolute;
  top: 13.661%;
  width: 13.661%;
  height: 86.339%;
  border-radius: 2cqi;
  background: rgba(255, 255, 255, 0.09);
  pointer-events: none;
  transition: left 0.12s ease, opacity 0.15s;
}
.c4-disc {
  position: absolute;
  width: 10.929%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fa5252;
  box-shadow: inset 0 -0.7cqi 0 rgba(0, 0, 0, 0.2);
}
.c4-disc[data-p="2"] { background: #fcc419; }
.c4-disc::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 0.6cqi solid rgba(0, 0, 0, 0.13);
}
.c4-preview { top: 1.366%; pointer-events: none; transition: left 0.12s ease, opacity 0.15s; }
.c4-preview.is-hidden, .c4-col-hl.is-hidden { opacity: 0; }
.c4-discs .c4-disc { transition: opacity 0.4s; }
.c4-stage.is-over .c4-discs .c4-disc:not(.is-win) { opacity: 0.35; }
.c4-disc.is-win { animation: c4-win 0.9s ease-in-out infinite; }
.c4-disc.is-win::after { border-color: #fff; border-width: 0.9cqi; }
@keyframes c4-win { 50% { scale: 1.1; } }

.c4-cols {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 2.186%;
}
.c4-cols button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.c4-stage.is-locked .c4-cols button { cursor: default; }
.c4-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  height: 13.661%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6cqi;
  animation: c4-banner 0.35s ease-out;
}
.c4-banner[hidden] { display: none; }
.c4-banner-text {
  padding: 0.9cqi 2.6cqi;
  border-radius: 999px;
  background: #fff;
  color: #183153;
  font-size: clamp(15px, 3.4cqi, 30px);
  font-weight: 900;
}
.c4-banner .btn { padding: 0.9cqi 2.6cqi; font-size: clamp(14px, 2.6cqi, 22px); }
@keyframes c4-banner {
  from { opacity: 0; transform: translateY(-30%); }
}

/* Schmaler Spielrahmen */
@container (max-width: 760px) {
  .c4-players { flex: 1 1 100%; flex-direction: row; gap: 8px; }
  .c4-player { flex: 1; min-width: 0; gap: 8px; padding: 6px 10px; }
  .c4-chip { width: 22px; height: 22px; }
  .c4-player-text b, .c4-player-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .c4-player-text b { font-size: 0.9rem; }
  .c4-player-text small { font-size: 0.7rem; }
  .c4-score { font-size: 1.3rem; }
  .c4-player.is-turn { transform: none; }
  .c4-stage { width: min(100cqi, 100cqh - 160px); }
}

/* ---------- Paare finden ---------- */
.pairs-field {
  --ratio: 1;
  --cols: 5;
  position: relative;
  flex: none;
  width: min(100cqi - 268px, 100cqh / var(--ratio));
  container-type: inline-size;
  border-radius: 2cqi;
}
.pairs-grid {
  --card: calc((100cqi - (var(--cols) - 1) * 2cqi) / var(--cols));
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 2cqi;
}
.pc {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  animation: pc-deal 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) backwards;
  animation-delay: calc(var(--i) * 22ms);
  -webkit-tap-highlight-color: transparent;
}
.pc:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: calc(var(--card) * 0.1); }
.pc-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.4, 0.1, 0.3, 1), translate 0.15s;
}
.pc:hover .pc-inner { translate: 0 calc(var(--card) * -0.03); }
.pc.is-open .pc-inner, .pc.is-matched .pc-inner { transform: rotateY(180deg); }
.pc.is-open, .pc.is-matched { cursor: default; }
.pc-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: calc(var(--card) * 0.1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 calc(var(--card) * 0.04) 0 rgba(0, 0, 0, 0.22);
}
.pc-back { background: #1c3d6e; }
.pc-back::before {
  content: '';
  position: absolute;
  inset: 8%;
  border: calc(var(--card) * 0.02) dashed #4dabf7;
  border-radius: calc(var(--card) * 0.06);
  opacity: 0.7;
}
.pc-back::after { content: '?'; color: #74c0fc; font-size: calc(var(--card) * 0.42); font-weight: 900; }
.pc-front { background: #fff; transform: rotateY(180deg); }
.pc-front svg { width: 66%; height: auto; }
.pc.is-matched .pc-front {
  box-shadow: 0 calc(var(--card) * 0.04) 0 rgba(0, 0, 0, 0.22), inset 0 0 0 calc(var(--card) * 0.035) #51cf66;
}
.pc.is-matched { animation: pc-pop 0.45s ease-out; }
.pc.is-wrong .pc-inner { animation: pc-shake 0.35s ease-in-out; }
.pairs-grid.is-won .pc { animation: pc-pop 0.6s ease-in-out backwards; animation-delay: calc(var(--i) * 30ms); }
@keyframes pc-deal {
  from { opacity: 0; scale: 0.6; }
}
@keyframes pc-pop {
  45% { scale: 1.1; }
}
@keyframes pc-shake {
  25% { translate: -5% 0; }
  75% { translate: 5% 0; }
}
@container (max-width: 760px) {
  .pairs-field { width: min(100cqi, (100cqh - 150px) / var(--ratio)); }
}

/* ---------- Minesweeper ---------- */
.ms-field {
  --ratio: 1;
  --cols: 9;
  position: relative;
  flex: none;
  width: min(100cqi - 268px, 100cqh / var(--ratio));
  container-type: inline-size;
  border-radius: 14px;
}
/* Einheit u = eine Zelle; Abstand 0,08 u, Rand 0,3 u */
.ms-board {
  --u: calc(100cqi / (var(--cols) * 1.08 + 0.52));
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: calc(var(--u) * 0.08);
  padding: calc(var(--u) * 0.3);
  border-radius: calc(var(--u) * 0.4);
  background: #ced4da;
  box-shadow: 0 calc(var(--u) * 0.16) 0 #adb5bd;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.ms-cell {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: calc(var(--u) * 0.16);
  background: #f8f9fa;
  box-shadow: inset 0 calc(var(--u) * -0.1) 0 #adb5bd;
  color: #212529;
  font: inherit;
  font-size: calc(var(--u) * 0.62);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ms-cell:hover { background: #fff; }
.ms-cell:focus-visible { outline: calc(var(--u) * 0.08) solid #183153; outline-offset: 1px; z-index: 1; }
.ms-cell svg { width: 72%; height: 72%; }
.ms-cell.is-open {
  background: transparent;
  box-shadow: none;
  cursor: default;
  animation: ms-open 0.22s ease-out backwards;
  animation-delay: var(--d, 0ms);
}
.ms-cell.is-open[data-n] { cursor: pointer; }
.ms-cell[data-n="1"] { color: #1c7ed6; }
.ms-cell[data-n="2"] { color: #2b8a3e; }
.ms-cell[data-n="3"] { color: #e03131; }
.ms-cell[data-n="4"] { color: #5f3dc4; }
.ms-cell[data-n="5"] { color: #a61e4d; }
.ms-cell[data-n="6"] { color: #0c8599; }
.ms-cell[data-n="7"] { color: #212529; }
.ms-cell[data-n="8"] { color: #868e96; }
.ms-cell.is-mine {
  background: #e9ecef;
  box-shadow: none;
  cursor: default;
  animation: ms-pop 0.3s ease-out backwards;
  animation-delay: var(--d, 0ms);
}
.ms-cell.is-boom { background: #ff6b6b; }
.ms-cell.is-wrong::after {
  content: '';
  position: absolute;
  inset: 14%;
  background:
    linear-gradient(45deg, transparent 43%, #e03131 43% 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, #e03131 43% 57%, transparent 57%);
}
.ms-field.is-won .ms-cell.is-flag { animation: ms-pop 0.4s ease-out backwards; animation-delay: var(--d, 0ms); }
.ms-field.is-lost .ms-cell:not(.is-open):not(.is-mine) { cursor: default; }
@keyframes ms-open {
  from { opacity: 0; scale: 0.5; }
}
@keyframes ms-pop {
  0% { scale: 0.4; }
  60% { scale: 1.18; }
  100% { scale: 1; }
}
@container (max-width: 760px) {
  .ms-field { width: min(100cqi, (100cqh - 170px) / var(--ratio)); }
}

/* ---------- Mauerbrecher ---------- */
.bk-field {
  position: relative;
  flex: none;
  width: min(100cqi - 268px, 100cqh * 4 / 3);
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.bk-field canvas { display: block; width: 100%; height: 100%; border-radius: inherit; }
.bk-field.is-playing { cursor: none; }
.bk-lives { display: flex; align-items: center; gap: 2px; min-height: 1.55rem; color: #fff; }
@container (max-width: 760px) {
  .bk-field { width: min(100cqi, (100cqh - 170px) * 4 / 3); }
}

/* ---------- Würfelsprung ---------- */
.cj-field {
  position: relative;
  flex: none;
  width: min(100cqi - 268px, 100cqh * 16 / 9);
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
.cj-field canvas { display: block; width: 100%; height: 100%; border-radius: inherit; }
@container (max-width: 760px) {
  .cj-field { width: min(100cqi, (100cqh - 170px) * 16 / 9); }
}
/* Handy quer (Rahmen niedrig): schmales Bedienfeld links, Spielfeld nimmt die ganze Höhe */
@container (max-height: 460px) and (min-width: 480px) {
  .cj { flex-direction: row; gap: 10px; }
  .cj .gp-panel { width: 112px; flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: center; gap: 6px; }
  .cj .gp-stats { flex: none; grid-auto-flow: row; grid-template-columns: 1fr; gap: 4px; }
  .cj .gp-stats .gp-stat { grid-column: auto !important; }
  .cj .gp-stat { padding: 3px 8px; }
  .cj .gp-stat span { font-size: 0.55rem; }
  .cj .gp-stat b { font-size: 0.95rem; }
  .cj .gp-panel > .btn { padding: 5px 8px; font-size: 0.8rem; }
  .cj-field { width: min(100cqi - 122px, 100cqh * 16 / 9); border-radius: 12px; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .game-fs:fullscreen .game-frame:has(.cj), .game-fs.is-fs .game-frame:has(.cj) { padding: 8px; }
  .game-fs:fullscreen .game-frame:has(.cj) ~ .fs-exit, .game-fs.is-fs .game-frame:has(.cj) ~ .fs-exit { top: 8px; left: 8px; right: auto; width: 36px; height: 36px; }
  .game-fs:fullscreen .game-frame:has(.cj) .gp-panel, .game-fs.is-fs .game-frame:has(.cj) .gp-panel { padding-top: 40px; }
}

/* ---------- Blockfall ---------- */
.bf-center {
  --touch-h: 0px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.bf-well {
  position: relative;
  height: min(100cqh - var(--touch-h), (100cqi - 536px) * 2);
  aspect-ratio: 1 / 2;
  border-radius: 14px;
  background: #24164f;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.22);
}
.bf-well canvas { display: block; width: 100%; height: 100%; border-radius: inherit; }
.bf-box { padding: 10px 12px 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); }
.bf-box .gp-label { margin-bottom: 2px; }
.bf-hold, .bf-next { display: block; width: 120px; margin: 0 auto; }
.bf-hold { height: 72px; }
.bf-next { height: 216px; }
.bf-touch { display: none; gap: 8px; }
.bf-touch button {
  width: 52px;
  height: 50px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.bf-touch button:active { background: rgba(255, 255, 255, 0.35); }
@media (pointer: coarse) {
  .bf-center { --touch-h: 62px; }
  .bf-touch { display: flex; }
}
/* Schmal (Handy): Punkte oben, Spielfeld links, Halten/Nächstes/Knöpfe rechts daneben, Touch-Tasten unten */
@container (max-width: 760px) {
  .gp.bf {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    grid-template-rows: auto auto auto auto auto 1fr auto;
    grid-template-areas:
      'stats stats'
      'well  hold'
      'well  next'
      'well  new'
      'well  pause'
      'well  .'
      'touch touch';
    width: 100%;
    align-content: center;
    gap: 10px;
  }
  .bf .gp-panel, .bf-center { display: contents; }
  .bf .gp-stats { grid-area: stats; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .bf .gp-stat { min-width: 0; padding: 5px 8px; }
  .bf .gp-stat span { font-size: 0.6rem; }
  .bf .gp-stat b { font-size: 1.05rem; }
  .bf .gp-panel:not(.bf-side) > .bf-box { grid-area: hold; }
  .bf-side > .bf-box { grid-area: next; }
  .bf .bf-box { padding: 8px; }
  .bf-hold, .bf-next { width: 80px; height: 72px; }
  .bf [data-new] { grid-area: new; }
  .bf [data-pause] { grid-area: pause; }
  .bf [data-new], .bf [data-pause] { width: 100%; padding: 8px 6px; font-size: 0.8rem; white-space: normal; }
  .bf-well { grid-area: well; justify-self: center; height: min(100cqh - 70px - var(--touch-h), (100cqi - 106px) * 2); }
  .bf-touch { grid-area: touch; justify-content: center; }
  .bf-touch button { width: 48px; }
}

/* ---------- Watermelon Drop ---------- */
.wm-field {
  position: relative;
  flex: none;
  width: min(100cqh * 2 / 3, 100cqi - 536px);
  aspect-ratio: 2 / 3;
  border-radius: 18px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
/* Canvas absolut, damit nur das Seitenverhältnis die Feldhöhe bestimmt (nicht die Pixelgröße des Canvas) */
.wm-field canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border-radius: inherit; }
.wm-wide { grid-column: span 2; }
.wm-box { padding: 10px 12px 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); text-align: center; }
.wm-box .gp-label { margin-bottom: 2px; text-align: left; }
.wm-next { display: block; width: 104px; height: 104px; margin: 0 auto; }
.wm-next-name { font-weight: 900; }
.wm-cycle { display: block; width: 200px; height: 200px; margin: 0 auto; }
@container (max-width: 1100px) {
  .wm-side { display: none; }
  .wm-field { width: min(100cqh * 2 / 3, 100cqi - 268px); }
}
@container (max-width: 760px) {
  .wm-field { width: min(100cqi, (100cqh - 130px) * 2 / 3); }
  .wm-wide, .wm-next-name { display: none; }
  .wm .gp-stats { grid-template-columns: auto auto; }
  .wm-box { padding: 4px 8px; }
  .wm-next { width: 40px; height: 40px; }
  .wm .gp-stats { flex: none; }
  .wm .gp-panel .btn { padding: 6px 10px; font-size: 0.8rem; }
}

/* ---------- Coins, Glücksrad, Shop und Erfolge ---------- */
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--sm { padding: 7px 14px; font-size: 0.9rem; }

.topnav { display: flex; gap: 4px; }
.account[hidden], .topnav a[hidden] { display: none; }
.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}
.topnav a:hover { color: var(--navy); background: rgba(127, 127, 127, 0.12); }
.topnav a.is-active { color: var(--navy); background: var(--card); }
.topnav svg { flex: none; width: 18px; height: 18px; }

.account { display: flex; align-items: center; gap: 10px; flex: none; }
.icon-btn {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--navy); }
.icon-btn svg { width: 24px; height: 24px; }
.wheel-btn .dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fa5252;
  box-shadow: 0 0 0 3px var(--page);
  animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse {
  50% { scale: 1.25; }
}
.wheel-btn svg { width: 26px; height: 26px; }
.wheel-btn.has-bonus svg { transform-origin: 50% 85%; animation: gift-wiggle 2.6s ease-in-out infinite; }
@keyframes gift-wiggle {
  0%, 68%, 100% { rotate: 0deg; }
  74% { rotate: -14deg; }
  80% { rotate: 11deg; }
  86% { rotate: -7deg; }
  92% { rotate: 3deg; }
}

.wallet {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.wallet:hover { border-color: var(--navy); }
.wallet.is-bump { animation: wallet-bump 0.6s ease-out; }
@keyframes wallet-bump {
  30% { scale: 1.12; }
}
.wallet-item, .reward, .price { display: inline-flex; align-items: center; gap: 6px; }
.wallet svg, .reward svg, .price svg { width: 20px; height: 20px; flex: none; }

.user-menu { position: relative; display: flex; }
.avatar {
  width: 46px;
  height: 46px;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--yellow);
  color: var(--on-accent);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.menu[hidden] { display: none; }
.menu-name { font-weight: 900; }
.menu-note { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.menu a, .menu button {
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu a:hover, .menu button:hover { background: rgba(127, 127, 127, 0.14); }

/* Einblendungen */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18), 0 14px 30px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  animation: toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.toast.is-out { animation: toast-out 0.3s ease-in forwards; }
.toast-icon { flex: none; color: var(--muted); }
.toast-icon svg { display: block; width: 32px; height: 32px; }
.toast-text { display: flex; flex-direction: column; line-height: 1.25; }
.toast-text b { font-weight: 900; }
.toast-text small { color: var(--muted); font-weight: 700; }
.toast .btn { flex: none; white-space: nowrap; }
.toast--gold { border-color: #fcc419; }
.toast--gold .toast-icon { color: #f59f00; }
.toast--error { border-color: #fa5252; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(40px); }
}
@keyframes toast-in-top {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

/* Gelber Punkt: Belohnung zum Abholen wartet (Inventar in der Navigation, ☰-Knopf auf dem Handy) */
.topnav a.has-dot { position: relative; }
.topnav a.has-dot::after, .menu-toggle.has-dot::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fcc419;
  box-shadow: 0 0 0 3px var(--page);
  animation: dot-pulse 1.6s ease-in-out infinite;
}
.topnav a.has-dot::after { top: 4px; right: 6px; }
.menu-toggle.has-dot::after { top: 1px; right: 1px; }

/* Abholbare Erfolge */
.ach.is-pending { box-shadow: 0 3px 0 #f59f00, inset 0 0 0 2px #fcc419; }
.ach-claim { margin-top: 4px; padding: 4px 12px; font-size: 0.78rem; }
.claim-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin: -4px 0 16px;
  padding: 10px 14px;
  border: 2px solid #fcc419;
  border-radius: 12px;
  background: rgba(252, 196, 25, 0.12);
  font-weight: 700;
}
.gm-ach.is-pending { box-shadow: inset 0 0 0 2px #fcc419; }
.gm-claim {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #fcc419;
  color: #3d2600;
  font-size: 0.75rem;
  font-weight: 900;
  text-decoration: none;
}

/* Fenster */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 14, 26, 0.65);
  backdrop-filter: blur(3px);
  animation: gp-fade 0.2s ease-out;
}
.modal-backdrop.is-out { opacity: 0; transition: opacity 0.2s; }
.modal {
  position: relative;
  width: min(100%, 440px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 28px;
  border-radius: 22px;
  background: var(--card);
  color: var(--navy);
  text-align: center;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}
.modal h2 { margin: 0 0 6px; font-size: 1.6rem; font-weight: 900; }
.modal-text { margin: 0 0 18px; color: var(--muted); font-weight: 700; }
.modal-close {
  position: absolute;
  /* Immer über dem Inhalt – in der Detailansicht ragt das Vorschaubild bis unter den Button */
  z-index: 2;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}
.modal-close svg { display: block; width: 20px; height: 20px; }
.modal-close:hover { box-shadow: inset 0 0 0 19px rgba(127, 127, 127, 0.15); color: var(--navy); }
.modal-actions { display: flex; justify-content: center; gap: 12px; }
.modal--wheel { width: min(100%, 470px); overflow-x: hidden; }

/* Glücksrad */
.wheel { position: relative; width: min(100%, 340px); aspect-ratio: 1; margin: 0 auto; }
.wheel-rotor { width: 100%; height: 100%; }
.wheel-rotor svg { display: block; width: 100%; height: 100%; font-family: var(--font); }
.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-top: 32px solid #fa5252;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.3));
}
.wheel-result { min-height: 1.5em; margin: 14px 0 8px; font-size: 1.3rem; font-weight: 900; line-height: 1.3; }
.wheel-spin { min-width: 220px; }
.wheel-odds { margin-top: 18px; color: var(--muted); font-size: 0.9rem; text-align: left; }
.wheel-odds summary { font-weight: 800; text-align: center; cursor: pointer; }
.wheel-odds ul { display: grid; gap: 4px; margin: 10px 0; padding: 0; list-style: none; }
.wheel-odds li { display: flex; justify-content: space-between; font-weight: 700; }
.confetti-box { position: absolute; inset: 0; pointer-events: none; }
.confetti {
  position: absolute;
  top: 35%;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall 2.4s cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
@keyframes confetti-fall {
  from { transform: translate(0, -60px) rotate(0); opacity: 1; }
  to { transform: translate(var(--drift), 260px) rotate(var(--spin)); opacity: 0; }
}

/* Seiten Shop und Erfolge */
.page { max-width: 1240px; margin: 0 auto; padding-top: 16px; }
.page-head h1 { margin: 0; font-size: 2.4rem; font-weight: 900; overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 700px) {
  .page-head h1 { font-size: 1.9rem; }
}
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 1.1rem; }
.page-sub { margin: 30px 0 14px; font-size: 1.3rem; font-weight: 900; }
.page-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 16px;
  border: 2px dashed var(--line);
  background: var(--card);
  font-weight: 800;
}

/* ---------- Shop 2.0, Profil (Spec: docs/superpowers/specs/2026-10-05-shop-v2-design.md) ---------- */
.page--wide { max-width: 2400px; }

/* Kleine Kacheln (Shop und Sammlung): ganze Kachel ist ein Knopf */
.shop-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.shop-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--navy);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--line);
  transition: transform 0.15s, box-shadow 0.15s;
}
.shop-tile:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--line); }
.shop-tile:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.shop-tile.is-equipped { box-shadow: 0 4px 0 #2f9e44, inset 0 0 0 3px #40c057; cursor: default; }
.shop-tile.is-equipped:hover { transform: none; }
.tile-preview { position: relative; display: block; overflow: hidden; border-radius: 16px 16px 0 0; aspect-ratio: 8 / 5; }
/* Hervorgehoben (z. B. „Beliebt“): gelber Rand und Schild oben mittig – wie „Bester Wert“ beim Tausch */
.shop-tile.is-featured { box-shadow: 0 4px 0 #f59f00, inset 0 0 0 3px #fcc419; }
.shop-tile.is-featured:hover { box-shadow: 0 7px 0 #f59f00, inset 0 0 0 3px #fcc419; }
.shop-tile.is-featured .tile-preview, .shop-tile.is-equipped .tile-preview { margin: 3px 3px 0; border-radius: 13px 13px 0 0; }
.tile-tag, .item-tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: #fcc419;
  color: #3d2600;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}
.tile-tag { position: absolute; top: -11px; left: 50%; z-index: 2; transform: translateX(-50%); }
.item-tag { display: inline-block; margin-left: 8px; vertical-align: 1px; }
.tile-preview canvas, .item-preview canvas { display: block; width: 100%; height: 100%; }
.tile-info { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 9px 12px 11px; }
.tile-title { overflow: hidden; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta, .tile-left, .tile-state { font-size: 0.8rem; font-weight: 800; color: var(--muted); }
.tile-left { color: var(--danger-text); }
.shop-tile.is-equipped .tile-state { color: var(--ok); }
.shop-tile .price svg { width: 18px; height: 18px; }

/* Preise: bei Rabatt alter Preis durchgestrichen */
.price b { font-weight: 900; }
.price s { color: var(--muted); font-weight: 700; text-decoration-thickness: 2px; }
.price--big { font-size: 1.5rem; }
.price--big svg { width: 26px; height: 26px; }

.sale-badge, .badge-exclusive {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}
.sale-badge { background: #fa5252; color: #fff; }
.badge-exclusive { background: #7048e8; color: #fff; }
.reward-name .badge-exclusive { position: static; margin-left: 4px; box-shadow: none; vertical-align: 1px; }

.shop-section .page-sub { display: flex; align-items: center; gap: 10px; }
.shop-sub { margin: 20px 0 10px; font-size: 1rem; font-weight: 900; color: var(--muted); }
.shop-done { margin-top: 28px; font-size: 1.1rem; font-weight: 800; color: var(--muted); }

/* Tausch und Creator-Code am Ende der Seite */
.shop-extra { margin-top: 44px; padding-top: 6px; border-top: 2px solid var(--line); scroll-margin-top: calc(var(--topbar-h) + 12px); }
.shop-extra .page-sub svg { width: 28px; height: 28px; flex: none; }
.shop-extra-text { max-width: 720px; margin: -6px 0 18px; color: var(--muted); font-weight: 700; }

.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; max-width: 1100px; padding-top: 10px; }
.pkg {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 14px 16px;
  border-radius: 16px;
  background: var(--card);
  text-align: center;
  box-shadow: 0 4px 0 var(--line);
}
.pkg.is-best { box-shadow: 0 4px 0 #f59f00, inset 0 0 0 3px #fcc419; }
.pkg-tag {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 999px;
  background: #fcc419;
  color: #3d2600;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}
.pkg-diamonds, .pkg-coins { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; }
.pkg-diamonds { font-size: 1.6rem; }
.pkg-diamonds svg { width: 28px; height: 28px; }
.pkg-coins { font-size: 1.1rem; }
.pkg-coins svg { width: 20px; height: 20px; }
.pkg-bonus { padding: 2px 10px; border-radius: 999px; background: rgba(64, 192, 87, 0.18); color: var(--ok); font-size: 0.8rem; font-weight: 900; }
.pkg-bonus.is-base { background: none; color: var(--muted); }
.pkg .btn { margin-top: 6px; }
.pkg-missing { margin-top: 8px; color: var(--muted); font-size: 0.85rem; font-weight: 800; }

.code-form { display: flex; gap: 10px; max-width: 520px; }
.code-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.code-input::placeholder { color: var(--muted); font-weight: 700; letter-spacing: 0; text-transform: none; }
.code-input:focus { outline: none; border-color: var(--navy); }
.code-input:disabled { opacity: 0.6; }
.code-error, .item-error { color: var(--danger-text); font-weight: 800; }
.code-error { margin: 10px 0 0; }

/* Detailansicht und Ergebnis eines Codes */
.modal--item, .modal--code { width: min(100%, 520px); }
.modal--item.is-featured { box-shadow: 0 8px 0 #f59f00, inset 0 0 0 4px #fcc419; }
.item-preview { position: relative; overflow: hidden; margin: 6px 0 14px; border-radius: 16px; aspect-ratio: 8 / 5; }
.item-preview .badge-exclusive { left: auto; right: 8px; }
.item-meta { margin: 2px 0 12px; color: var(--muted); font-weight: 700; }
.item-price { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.item-sale { padding: 2px 10px; border-radius: 999px; background: #fa5252; color: #fff; font-size: 0.85rem; font-weight: 900; }
.item-note { margin: 10px 0 18px; color: var(--muted); font-weight: 700; }
.item-error { margin: -8px 0 16px; }
.item-done { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 6px; color: var(--ok); font-size: 1.35rem; font-weight: 900; }
.item-done svg { width: 28px; height: 28px; flex: none; }
.modal-actions { flex-wrap: wrap; }
.link-btn { padding: 0; border: 0; background: none; color: var(--navy); font: inherit; font-weight: 900; text-decoration: underline; cursor: pointer; }
.equipped-label { align-self: center; color: var(--ok); font-size: 0.9rem; font-weight: 900; }
.reward-list { margin: 0 0 18px; padding: 0; list-style: none; text-align: left; }
.reward-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 2px solid var(--line); }
.reward-row canvas { flex: none; width: 96px; height: 60px; border-radius: 10px; }
.reward-name { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.reward-name small { color: var(--muted); font-weight: 700; }
.reward-icon { display: grid; flex: none; place-items: center; width: 96px; }
.reward-icon svg { width: 34px; height: 34px; }

/* Profil mit „Meine Sammlung“ */
.profile-head { display: flex; align-items: center; gap: 18px; margin-top: 12px; }
.profile-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--on-accent);
  font-size: 2rem;
  font-weight: 900;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-who { min-width: 0; }
.profile-who h1 { margin: 0; font-size: 2rem; font-weight: 900; overflow-wrap: anywhere; }
.profile-balance { display: flex; flex-wrap: wrap; gap: 16px; margin: 6px 0 0; font-size: 1.1rem; }
.collection-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 24px 0 10px; font-size: 1.05rem; font-weight: 900; }
.collection-count { color: var(--muted); font-size: 0.85rem; font-weight: 800; }
.profile-more { margin-top: 28px; color: var(--muted); font-weight: 700; }
/* Inventar: „Meine Designs“ und „Erfolge“ als Aufklapper (bei jedem Öffnen eingeklappt) */
.inv-sections { margin-top: 24px; border-bottom: 2px solid var(--line); }
.inv-section { border-top: 2px solid var(--line); scroll-margin-top: calc(var(--topbar-h) + 12px); }
.inv-head { margin: 0; }
.inv-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  width: 100%;
  padding: 18px 4px;
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-size: 1.3rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}
.inv-toggle:hover .inv-title { text-decoration: underline; text-underline-offset: 4px; }
.inv-toggle:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 8px; }
.inv-chevron { flex: none; width: 24px; height: 24px; margin-left: auto; transition: transform 0.2s; }
.inv-toggle[aria-expanded="true"] .inv-chevron { transform: rotate(180deg); }
.inv-pending { padding: 2px 10px; border-radius: 999px; background: #fcc419; color: #3d2600; font-size: 0.8rem; font-weight: 900; }
.inv-body { padding: 0 0 24px; }
.inv-body > .collection-head:first-child { margin-top: 4px; }
.profile-more a { color: var(--navy); font-weight: 900; }

/* Spielmenü: Rabatt-Badge auf gesperrten Designs */
.gm-design-art { position: relative; display: block; }

@media (max-width: 700px) {
  .shop-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pkg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pkg { padding: 18px 10px 14px; }
  .pkg-diamonds { font-size: 1.35rem; }
  .shop-extra { margin-top: 32px; }
  .profile-head { gap: 14px; }
  .profile-avatar { width: 56px; height: 56px; font-size: 1.5rem; }
  .profile-who h1 { font-size: 1.5rem; }
}
@media (max-width: 400px) {
  .tile-info { padding: 8px 10px 10px; }
  .shop-tile .price svg { width: 16px; height: 16px; }
  .code-form { gap: 8px; }
  .code-input { padding: 0 14px; }
  .reward-row canvas, .reward-icon { width: 72px; }
  .reward-row canvas { height: 45px; }
}

/* Erfolge kompakt: mehr Karten pro Reihe, Balken und Zahl in einer Zeile */
.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 10px; }
.ach {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 3px 0 var(--line);
}
.ach.is-done { box-shadow: 0 3px 0 #fcc419; }
.ach.is-epic.is-done { box-shadow: 0 3px 0 #22b8cf; }
.ach-icon {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.15);
  color: var(--muted);
}
.ach-icon svg { width: 20px; height: 20px; }
.ach.is-done .ach-icon { background: #fff3bf; color: #f59f00; }
.ach.is-epic.is-done .ach-icon { background: #c5f6fa; color: #1098ad; }
.ach-body { flex: 1; min-width: 0; }
.ach-body h3 { margin: 0; overflow: hidden; font-size: 0.92rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.ach-body p { display: -webkit-box; margin: 1px 0 4px; overflow: hidden; color: var(--muted); font-size: 0.78rem; font-weight: 700; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.ach-progress { display: flex; align-items: center; gap: 8px; }
.ach-progress small { flex: none; color: var(--muted); font-size: 0.72rem; font-weight: 800; }
.ach-bar { flex: 1; height: 6px; overflow: hidden; border-radius: 99px; background: rgba(127, 127, 127, 0.2); }
.ach-bar span { display: block; height: 100%; border-radius: inherit; background: #fcc419; }
.ach.is-epic .ach-bar span { background: #22b8cf; }
.ach-reward { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 0.85rem; font-weight: 900; }
.ach-reward svg { width: 16px; height: 16px; }

.show-sm, .theme-label, .menu-toggle, .menu-toggle .i-close { display: none; }

/* Tablet und Handy: Navigation, Suche und Hell/Dunkel wandern in das ☰-Menü unter der Kopfzeile */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topnav, .search-wrap, .theme-toggle { display: none; }
  .account { order: 1; margin-left: auto; }
  .menu-toggle { order: 2; display: grid; }
  .wallet { gap: 10px; padding: 0 12px; }

  .topbar.is-open { max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
  .topbar.is-open .menu-toggle .i-open { display: none; }
  .topbar.is-open .menu-toggle .i-close { display: block; }
  .topbar.is-open .search-wrap {
    display: block;
    order: 3;
    flex: 0 0 100%;
    max-width: none;
    margin: 4px 0 0;
    padding-top: 12px;
    border-top: 2px solid var(--line);
  }
  .topbar.is-open .search-pop { position: static; margin-top: 8px; box-shadow: none; max-height: none; }
  .topbar.is-open .topnav { display: flex; order: 4; flex: 0 0 100%; flex-direction: column; gap: 2px; }
  .topbar.is-open .theme-toggle {
    display: flex;
    order: 5;
    flex: 0 0 100%;
    width: auto;
    height: auto;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-weight: 800;
  }
  .topbar.is-open .theme-toggle:hover { color: var(--navy); background: rgba(127, 127, 127, 0.12); }
  .topbar.is-open .topnav a, .topbar.is-open .theme-toggle { gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: 1.05rem; }
  .topbar.is-open .topnav svg, .topbar.is-open .theme-toggle svg { width: 20px; height: 20px; }
  .topbar.is-open .theme-label { display: inline; }
  /* Beim Tippen nur das Suchfeld zeigen, damit die Ergebnisse darunter sichtbar bleiben */
  .topbar.is-open:has(.search:not(:placeholder-shown)) :is(.topnav, .theme-toggle) { display: none; }
}
@media (max-width: 700px) {
  :root { --topbar-h: 70px; }
}
/* Handy: Kopfzeile muss angemeldet in 320px passen (Logo, Geschenk, Guthaben, Avatar, ☰) */
@media (max-width: 520px) {
  :root { --topbar-h: 62px; }
  .topbar { column-gap: 6px; padding: 12px; }
  .logo { font-size: 1.1rem; }
  .logo span { padding: 0 7px; border-radius: 8px; }
  .account { gap: 6px; }
  .icon-btn, .avatar { width: 38px; height: 38px; }
  .icon-btn svg { width: 20px; height: 20px; }
  .wallet { height: 38px; gap: 8px; padding: 0 10px; font-size: 0.9rem; }
  .wallet-item { gap: 4px; }
  .wallet svg { width: 16px; height: 16px; }
  .account .btn--sm { padding: 6px 12px; font-size: 0.8rem; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  /* Profil wandert ins ☰-Menü (eigene Zeile mit Name und Abmelden), sonst passt die Kopfzeile nicht in 320px */
  .account { display: contents; }
  .account > * { order: 1; }
  .account > :first-child { margin-left: auto; }
  .user-menu { display: none; }
  .topbar.is-open .user-menu {
    display: flex;
    order: 6;
    flex: 0 0 100%;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 0;
    border-top: 2px solid var(--line);
  }
  .topbar.is-open .user-menu .avatar { pointer-events: none; }
  .topbar.is-open .user-menu .menu, .topbar.is-open .user-menu .menu[hidden] {
    position: static;
    display: flex;
    flex: 1;
    flex-flow: row wrap;
    align-items: center;
    gap: 6px 10px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }
  .topbar.is-open .user-menu .menu a:not(.menu-name) { display: none; }
  .topbar.is-open .user-menu .menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar.is-open .user-menu [data-logout] { padding: 7px 14px; border: 2px solid var(--line); border-radius: 999px; }
  /* Handy: Meldungen oben unter der Kopfzeile – unten würden sie im Spiel die Touch-Tasten verdecken */
  .toasts { top: calc(var(--topbar-h) + 8px); right: 12px; bottom: auto; left: 12px; flex-direction: column-reverse; align-items: stretch; }
  .toast { animation-name: toast-in-top; }
  .toast { max-width: none; }
}
@media (max-width: 400px) {
  :root { --topbar-h: 58px; }
  .topbar { padding: 10px; }
  .logo { font-size: 1rem; }
  .logo span { padding: 0 6px; }
  .wallet { gap: 6px; padding: 0 8px; font-size: 0.85rem; }
  .wallet svg { width: 14px; height: 14px; }
  .wallet-item { gap: 3px; }
  .modal { padding: 22px 18px; }
}
/* Sehr schmal (320px): Zurück-Knopf weglassen, damit der Spieltitel Platz hat (Logo führt zur Übersicht),
   Kopfzeile noch etwas enger, damit auch fünfstellige Kontostände in eine Zeile passen */
@media (max-width: 359px) {
  :root { --topbar-h: 54px; }
  .game-head .back { display: none; }
  .topbar { column-gap: 4px; padding: 8px; }
  .logo { font-size: 0.95rem; }
  .wallet { gap: 5px; padding: 0 6px; font-size: 0.8rem; }
}

/* ---------- Spielmenü (vor jedem Spiel) ---------- */
.gm {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 8px 6px 24px;
  color: #fff;
  scrollbar-width: thin;
}
.gm-hero {
  display: grid;
  grid-template-columns: minmax(240px, 420px) 1fr;
  align-items: center;
  gap: 28px;
  max-width: 1200px;
  margin: 0 auto;
}
.gm-art { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 18px; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25); }
.gm-art .art { display: block; width: 100%; height: 100%; }
.gm-info h2 { margin: 0; font-size: 2.6rem; font-weight: 900; line-height: 1.1; }
.gm-info p { max-width: 560px; margin: 8px 0 12px; font-size: 1.1rem; opacity: 0.9; }
.gm-best { display: inline-block; padding: 4px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.25); font-weight: 800; }
.gm-play-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.gm-play { padding: 14px 40px; font-size: 1.3rem; }
.gm-play-row small { font-weight: 700; opacity: 0.75; }

.gm-section { max-width: 1200px; margin: 26px auto 0; }
.gm-section h3 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 12px; font-size: 1.2rem; font-weight: 900; }
.gm-shop-link { margin-left: auto; color: #fff; font-size: 0.9rem; font-weight: 800; opacity: 0.85; }
.gm-count { font-size: 0.9rem; opacity: 0.75; }
.gm-gallery {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px 4px 14px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.gm-card {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 16px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}
.gm-card:hover { transform: translateY(-3px); }
.gm-card.is-selected { box-shadow: 0 0 0 4px #fff, 0 5px 0 rgba(0, 0, 0, 0.25); }
.gm-check {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 26px;
  height: 26px;
  display: none;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #2f9e44;
  font-weight: 900;
}
.gm-card.is-selected .gm-check { display: grid; }

.gm-level {
  width: 200px;
  min-height: 124px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--c);
  color: var(--ink);
}
.gm-level b { font-size: 1.3rem; font-weight: 900; }
.gm-level small { font-weight: 700; opacity: 0.85; }
.gm-level-dots { font-size: 0.7rem; letter-spacing: 2px; opacity: 0.8; }
.gm-stat { margin-top: auto; padding-top: 8px; font-size: 0.85rem; font-weight: 900; }

.gm-design { width: 210px; overflow: hidden; background: rgba(0, 0, 0, 0.22); color: #fff; }
.gm-design canvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; }
.gm-design-name { display: block; padding: 8px 12px 0; font-weight: 900; }
.gm-design-state { display: flex; align-items: center; gap: 5px; padding: 2px 12px 10px; font-size: 0.85rem; font-weight: 800; opacity: 0.85; }
.gm-design-state svg { width: 16px; height: 16px; }
.gm-design.is-locked canvas { filter: grayscale(0.85) brightness(0.75); }

.gm-achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.gm-ach { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); }
.gm-ach-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
}
.gm-ach-icon svg { width: 22px; height: 22px; }
.gm-ach.is-done .gm-ach-icon { background: #fff3bf; color: #f59f00; }
.gm-ach.is-epic.is-done .gm-ach-icon { background: #c5f6fa; color: #1098ad; }
.gm-ach-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gm-ach-body b { font-weight: 900; }
.gm-ach-body small { font-weight: 700; opacity: 0.8; }
.gm-ach-bar { height: 6px; margin-top: 4px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.2); }
.gm-ach-bar span { display: block; height: 100%; border-radius: inherit; background: #fcc419; }
.gm-ach.is-epic .gm-ach-bar span { background: #66d9e8; }
.gm-ach-reward { flex: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 900; }
.gm-ach-reward svg { width: 18px; height: 18px; }
.gm-hint { margin: 10px 0 0; font-weight: 700; opacity: 0.75; }

@container (max-width: 760px) {
  .gm-hero { grid-template-columns: 1fr; }
  .gm-info h2 { font-size: 1.8rem; }
}

/* ---------- Footer, Impressum, Datenschutz ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 2400px;
  margin: 0 auto;
  padding: 22px 40px 28px;
  border-top: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--navy); text-decoration: underline; }
@media (max-width: 720px) {
  /* Handy: untereinander und zentriert, Links umbrechen statt über den Rand zu laufen */
  .site-footer { flex-direction: column; justify-content: center; gap: 10px; padding: 18px 16px 24px; font-size: 0.9rem; text-align: center; }
  .site-footer nav { justify-content: center; gap: 6px 16px; }
}

.legal { max-width: 780px; line-height: 1.6; overflow-wrap: break-word; hyphens: auto; }
.legal .page-head { margin: 12px 0 8px; }
.legal h2 { margin: 28px 0 6px; font-size: 1.2rem; font-weight: 900; }
.legal p { margin: 0 0 10px; }
.legal a { color: inherit; }
.legal mark { padding: 0 4px; border-radius: 4px; background: var(--yellow); color: var(--on-accent); }
.legal-date { margin-top: 28px !important; color: var(--muted); }

/* Auswahl des Anmelde-Anbieters (Google, Discord) */
.login-choices { display: flex; flex-direction: column; gap: 10px; width: min(100%, 280px); margin-inline: auto; }
.login-choices .btn { width: 100%; justify-content: center; }
