/* Rahmen für alle Spiele: Marke Puerto Patida, Ausprägung Spiel. Farben,
   Schrift, Radien und Schatten kommen aus tokens/ (Sync-Kopien). Das Startmenü
   folgt dem Aufbau von Baumi (baumi-versteck/src/style.css). */

:root {
  --ground-paper: var(--pp-paper);
  /* Schrift der Zahlen (Medaillen, Räder, Platz, Summe, Tafel beim Teilen). Ein
     Spiel, dessen Titelschrift keine Ziffern setzt, überschreibt sie in spiel.css. */
  --font-number: var(--font-display);
  --font-number-weight: 400;
  --share-number-size: 300px;
  /* Höchste Höhe einer Overlay-Karte; dvh, damit sie auf iOS über der Leiste endet. */
  --card-max: min(88dvh, 44rem);
  /* Was in der Ergebnis-Karte außer der Folie Platz braucht (Rand, Kopf, Punkte,
     Knöpfe): Die Folie wird so klein, dass nichts scrollt. Jedes Spiel setzt sie. */
  --fan-reserve: 0px;
  /* So weit ragt die Figur im Ergebnis über die vordere Folie. Jedes Spiel setzt sie. */
  --result-overlap: 0px;
  /* Schrift der Adresse im Band der Teilen-Tafel. */
  --share-address-font: var(--font-display);
  --share-address-weight: 400;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* Schnelles Tippen soll nicht zoomen. iOS wertet touch-action am berührten
   Element aus, nicht an html, deshalb an jedem; Zoomen mit zwei Fingern bleibt. */
*,
*::before,
*::after {
  touch-action: manipulation;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--text-m);
  line-height: var(--leading-body);
  color: var(--color-ink);
  /* Papier unter den Tupfern; das Bild selbst hat keine Papierfläche. */
  background-color: var(--ground-paper);
}

/* Regenbogen-Kante: 5 px oben, vier gleiche Segmente, harte Kanten. */
body::after {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 5px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--pp-rainbow-green) 0 25%,
    var(--pp-rainbow-yellow) 25% 50%,
    var(--pp-rainbow-orange) 50% 75%,
    var(--pp-rainbow-red) 75% 100%
  );
}

.app {
  max-width: 30rem;
  margin: 0 auto;
  padding: max(var(--space-2), env(safe-area-inset-top)) max(var(--space-4), env(safe-area-inset-right))
    max(var(--space-4), env(safe-area-inset-bottom)) max(var(--space-4), env(safe-area-inset-left));
}

h1,
h2,
h3 {
  margin: 0;
  line-height: var(--leading-tight);
  font-family: var(--font-display);
  font-weight: 400;
}

.lb-place {
  color: var(--color-ink-soft);
}
.lb-name {
  letter-spacing: 0.06em;
}

/* ---------- Startbildschirm (wie Baumi) ---------- */

/* Porträt als Kreis links neben der Wortmarke; die Wortmarke ist die Überschrift (alt-Text = Titel).
   Der Kopf rückt neben den Zurück-Pfeil hoch (gleiche Oberkante wie bei Baumi), damit das
   Startmenü aufs Handy passt; der Pfeil liegt darüber und bleibt antippbar. */
.start-bar {
  position: relative;
  z-index: 5;
}
.start-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: calc(-1 * var(--tap-min));
}
.start-logo {
  margin: 0;
  flex: 0 1 12.25rem;
  min-width: 0;
}
.start-logo img {
  display: block;
  width: 100%;
  height: auto;
}

/* Herr Lano (Zeichnung von Alexa Trost); die Ecken des Bildes schneidet der Kreis ab. */
.portrait {
  display: block;
  border-radius: 50%;
  box-shadow: var(--shadow-raised);
}
.portrait-head {
  flex: 0 0 5.1rem;
  width: 5.1rem;
  height: 5.1rem;
}
/* Etwas eingerückt: Die Drehung ragt sonst über den Rand und erzeugt eine Scrollleiste. */
.portrait-result {
  flex: none;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 0.25rem 0 auto;
  transform: rotate(5deg);
}
.credit {
  font-size: var(--text-xs);
  color: var(--color-ink-soft);
}

.top3 {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.55rem 0.9rem 0.5rem;
  background: var(--color-surface);
  /* Auf der Fläche immer Tinte, auch wenn der Grund helle Schrift vererbt (Bomben). */
  color: var(--color-ink);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out);
}
.top3[hidden] {
  display: none;
}
.top3:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.top3-head {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.88rem;
}
.top3-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.top3-list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.top3-list .lb-place {
  flex: 0 0 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--color-surface-sunken);
}
.top3-list li:nth-child(1) .lb-place {
  background: var(--podium-1);
  color: var(--podium-1-ink);
}
.top3-list li:nth-child(2) .lb-place {
  background: var(--podium-2);
  color: var(--podium-2-ink);
}
.top3-list li:nth-child(3) .lb-place {
  background: var(--podium-3);
  color: var(--podium-3-ink);
}
.top3-list .lb-name {
  font-weight: 700;
  letter-spacing: normal;
}
.top3-list .lb-time {
  margin-left: auto;
  color: var(--color-ink-soft);
  font-size: 0.82rem;
}
.top3-list li.is-own .lb-name,
.lb-list li.is-own .lb-name {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.top3-note {
  margin: 0;
  font-size: 0.73rem;
  color: var(--color-ink-soft);
}

/* Serienkette: Kreise je Tag auf dem Grund, verbunden durch eine Linie, die zwischen zwei
   gelösten Tagen kräftig durchläuft. Medaille bei Platz 1 bis 3, sonst Haken. */
.streak {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin: 0.5rem 0 0.2rem;
}
.streak-chain {
  display: flex;
  align-items: flex-start;
  width: 100%;
  max-width: 21rem;
}
.streak-day {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
}
button.streak-day {
  cursor: pointer;
}
button.streak-day:focus-visible {
  outline: 3px solid var(--color-on-bg);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}
.streak-day + .streak-day::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: -50%;
  right: 50%;
  top: calc(1.15rem - 2px);
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--color-on-bg) 22%, transparent);
}
.streak-day.full + .streak-day.full::before,
.streak-day.full + .streak-day.shielded::before,
.streak-day.shielded + .streak-day.full::before,
.streak-day.shielded + .streak-day.shielded::before {
  background: var(--color-on-bg);
}
.streak-circle {
  position: relative;
  z-index: 1;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid color-mix(in srgb, var(--color-on-bg) 35%, transparent);
  font-family: var(--font-number);
  font-weight: var(--font-number-weight);
  font-size: 0.9rem;
  line-height: 1;
  color: var(--color-on-bg);
}
.streak-circle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.streak-day.full .streak-circle {
  background: var(--color-surface);
  border-color: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-raised);
}
.streak-day.shielded .streak-circle {
  background: var(--color-surface);
  border-color: var(--color-surface);
  color: var(--color-accent-2);
  box-shadow: var(--shadow-raised);
}
.streak-day.shielded .streak-circle svg {
  fill: currentColor;
  stroke: none;
}
.streak-day.place1 .streak-circle {
  background: var(--podium-1);
  border-color: var(--podium-1);
  color: var(--podium-1-ink);
}
.streak-day.place2 .streak-circle {
  background: var(--podium-2);
  border-color: var(--podium-2);
  color: var(--podium-2-ink);
}
.streak-day.place3 .streak-circle {
  background: var(--podium-3);
  border-color: var(--podium-3);
  color: var(--podium-3-ink);
}
.streak-day.today .streak-circle {
  transform: scale(1.14);
  box-shadow:
    0 0 0 2px var(--color-bg),
    0 0 0 4px var(--color-on-bg);
}
.streak-day.later .streak-circle {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--color-on-bg) 55%, transparent);
}
.streak-weekday {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-on-bg);
}
.streak-day.later .streak-weekday {
  color: var(--color-ink-soft);
}
.streak-text {
  margin: 0;
  color: var(--color-on-bg);
  font-weight: 700;
}
.streak-text b {
  font-size: 1.3rem;
}
.streak-text[hidden] {
  display: none;
}
.streak-shields {
  display: inline-flex;
  gap: 0.08rem;
  vertical-align: -0.16em;
}
.streak-shields svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* Menü wie bei Baumi: Creme-Knöpfe mit Titel in Lilita One. */
.menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.mitem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  font: inherit;
  text-align: center;
  cursor: pointer;
  background: var(--color-surface);
  color: var(--color-ink);
  border: none;
  border-radius: var(--radius-m);
  padding: 0.72rem 1rem;
  box-shadow: var(--shadow-raised);
  transition: transform var(--duration-fast) var(--ease-out);
}
.mitem[hidden] {
  display: none;
}
.mitem:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.mtitle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.levels {
  display: flex;
  gap: 0.35rem;
}
.mitem.level {
  flex: 1;
  padding: 0.6rem 0.3rem;
}
.mitem.level .mtitle {
  font-size: 1.05rem;
}
.mitem.quiet {
  background: none;
  color: var(--color-on-bg);
  box-shadow: none;
  padding: 0.35rem 1rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.mitem.quiet .mtitle {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 700;
}
.mitem.daily {
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.mitem.daily .mtitle {
  font-size: 1.4rem;
}
/* Gelöst: der Knopf wird zur Quittung, nicht nur ausgegraut. */
.mitem.daily.done {
  background: color-mix(in srgb, var(--color-surface) 55%, transparent);
  color: var(--color-ink);
  box-shadow: none;
}
.mitem.daily.done .mtitle {
  font-size: 1.05rem;
}
/* Die gelöste Zeit im Tagesknopf. */
.mnum {
  font-family: var(--font-number);
  font-weight: var(--font-number-weight);
}
.mtitle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.legal {
  margin: 0.1rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-on-bg);
}
.legal a {
  padding: 0.25rem 0.3rem;
  color: var(--color-on-bg);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.mitem[disabled] {
  cursor: default;
}

/* Einstellungen: Karte klappt unter dem Textlink auf (kein Overlay). */
.settings {
  gap: 0;
  padding: var(--space-1) var(--space-4);
}
.settings[hidden] {
  display: none;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--tap-min);
  padding: 0;
  font: inherit;
  font-weight: 700;
  text-align: left;
  color: var(--color-ink);
  background: none;
  border: 0;
  cursor: pointer;
}
.settings-row:focus-visible,
.switch:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
/* Unterzeile einer Einstellungszeile, etwa unter "Spielstand übertragen". */
.settings-sub {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-ink-soft);
}

/* Dialog "Spielstand übertragen" (transfer.js). */
.transfer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.transfer p {
  margin: 0;
}
.transfer-actions {
  display: flex;
  gap: var(--space-2);
}
.transfer-actions .btn,
.transfer > .btn {
  flex: 1;
  align-self: stretch;
}
.transfer-actions .btn {
  padding-inline: var(--space-2);
}
/* Zweiter Knopf mit eigener Fläche, damit er auf der Karte als Knopf lesbar ist. */
.transfer-actions .btn-quiet {
  background: var(--color-surface-sunken);
  color: var(--color-ink);
  box-shadow: none;
}
.transfer-code {
  width: 100%;
  padding: var(--space-2);
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-s);
  font:
    400 var(--text-xs) / 1.4 ui-monospace,
    monospace;
  color: var(--color-ink);
  background: var(--color-surface);
  word-break: break-all;
  resize: none;
}
.transfer-code[hidden],
.transfer > .btn[hidden] {
  display: none;
}
.transfer-privacy {
  font-size: var(--text-xs);
  color: var(--color-ink-soft);
}

.settings-row[hidden] {
  display: none;
}
.settings-row svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.switch {
  appearance: none;
  flex: none;
  position: relative;
  width: 3rem;
  height: 1.75rem;
  margin: 0;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-ink) 28%, transparent);
  cursor: pointer;
}
.switch::before {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-surface);
  transition: transform var(--duration-fast) var(--ease-out);
}
.switch:checked {
  background: var(--color-primary);
}
.switch:checked::before {
  transform: translateX(1.25rem);
}

/* Hinweise im Startmenü: "Neue Version" im Fluss, "Zum Home-Bildschirm" fest unten. */
.notice,
.homebar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface);
  /* Auf der Fläche immer Tinte, auch wenn der Grund helle Schrift vererbt (Bomben). */
  color: var(--color-ink);
  box-shadow: var(--shadow-raised);
}
.notice {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-m);
}
.notice[hidden],
.homebar[hidden] {
  display: none;
}
.notice .btn {
  flex: none;
}
.notice-text {
  flex: 1;
  min-width: 0;
}
.notice-title,
.notice-sub {
  margin: 0;
}
.notice-title {
  font-weight: 700;
  font-size: var(--text-s);
}
.notice-sub {
  font-size: var(--text-xs);
  line-height: 1.3;
  color: var(--color-ink-soft);
}
.homebar {
  position: fixed;
  z-index: 30;
  left: max(var(--space-2), env(safe-area-inset-left));
  right: max(var(--space-2), env(safe-area-inset-right));
  bottom: max(var(--space-2), env(safe-area-inset-bottom));
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  border-radius: var(--radius-l);
}
.homebar-icon {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-s);
}
.homebar-close {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  color: var(--color-ink);
  background: var(--color-surface-sunken);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.homebar-close:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.homebar-close svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
}
/* Platz, damit die Leiste den Fuß des Menüs nicht verdeckt. */
.start.has-homebar {
  padding-bottom: 5.5rem;
}

@media (hover: hover) {
  .mitem:not([disabled]):hover,
  .top3:hover {
    transform: translateY(-1px);
  }
}

/* "Bewegung reduzieren" (Schalter oder Systemeinstellung): das Attribut setzt
   motion.js; die Tokens kennen die Systemeinstellung schon. Übergänge mit
   eigener Dauer (Spiel) schalten ihre Regeln selbst ab. */
html[data-reduced-motion] {
  --duration-fast: 0ms;
  --duration-base: 0ms;
}

/* ---------- Karten und Knöpfe ---------- */

.view {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.view[hidden] {
  display: none;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-raised);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.card-eyebrow {
  margin: 0;
  font-size: var(--text-s);
  font-weight: 700;
  color: var(--color-accent-2);
}

.status {
  margin: 0;
  color: var(--color-ink-soft);
}

.btn {
  font-family: var(--font-display);
  font-size: 1.05rem;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-5);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out);
}
.btn:active {
  transform: scale(0.97);
}
.btn:focus-visible,
.link:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.btn[disabled] {
  opacity: 0.45;
  cursor: default;
}
.btn[hidden] {
  display: none;
}

/* Nur für Screenreader sichtbar. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Eingabe "Spiele-Code eingeben" im Startmenü. --wrong-text setzt jedes Spiel. */
.seed-form {
  flex-wrap: wrap;
  gap: var(--space-2);
  cursor: default;
}
.seed-input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  font: inherit;
  font-size: var(--text-m);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-s);
  color: var(--color-ink);
}
.seed-input:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 1px;
}
.seed-go {
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  font-family: var(--font-display);
  font-size: 1.05rem;
  border: 0;
  border-radius: var(--radius-s);
  background: var(--color-primary);
  color: var(--color-on-primary);
  cursor: pointer;
}
.seed-hint {
  flex-basis: 100%;
  margin: 0;
  font-size: var(--text-s);
  color: var(--wrong-text);
}
.seed-hint:empty {
  display: none;
}

/* Spiele-Code im Spielkopf: "#L-4RAJU" mit Kopier-Symbol, Antippen kopiert (copy-code.js). */
.code-copy {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--tap-min);
  padding: 0 var(--space-1);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--text-s);
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  cursor: pointer;
}
.code-copy[hidden] {
  display: none;
}
.code-copy:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.code-copy svg {
  width: 0.875rem;
  height: 0.875rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.code-copy.is-copied svg {
  display: none;
}

/* Kopfleiste: runder Pfeil oben links, im Startmenü zur Übersicht, im Spiel zum
   Startmenü; immer eine Ebene hoch, ohne Text. */
.bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.btn-icon {
  width: var(--tap-min);
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--color-surface);
  color: var(--color-ink);
  text-decoration: none;
}
.btn-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  align-self: flex-start;
}
.btn-quiet {
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-raised);
}

@media (hover: hover) {
  .btn-primary:hover {
    background: color-mix(in srgb, var(--color-primary) 85%, var(--color-surface));
  }
  .btn-quiet:hover {
    background: var(--color-accent);
  }
}

.link {
  font: inherit;
  font-weight: 700;
  min-height: var(--tap-min);
  background: none;
  border: 0;
  color: var(--color-on-bg);
  text-decoration: underline;
  cursor: pointer;
}

.entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  width: 100%;
}
.entry[hidden] {
  display: none;
}
.entry-sheet {
  margin: var(--space-3) 0;
  padding: var(--space-4);
  border-radius: var(--radius-m);
  background: var(--color-surface-sunken);
}
.entry-head {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
}
.entry-hint {
  margin: calc(-1 * var(--space-2)) 0 0;
  font-size: var(--text-xs);
  color: var(--color-ink-soft);
}
.entry-status {
  margin: 0;
  font-size: var(--text-s);
  color: var(--color-ink-soft);
}
.entry-status:empty {
  display: none;
}
.link-card {
  min-height: auto;
  padding: 0;
  color: var(--color-link);
}
.link-card[hidden] {
  display: none;
}
/* Namensräder wie bei Baumi: fünf Walzen ohne eigene Fläche, drei Zeilen sichtbar,
   die mittlere gilt. Ein umrandetes Band markiert sie; oben und unten laufen die
   Zeilen weich aus, das liest sich als Walze. */
.wheels {
  --wheel-row: 2.5rem;
  --wheel-width: 2.25rem;
  position: relative;
  display: flex;
  gap: var(--space-1);
  align-self: center;
}
.wheels::before {
  content: "";
  position: absolute;
  inset: var(--wheel-row) 0 auto;
  height: var(--wheel-row);
  border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  box-shadow: inset 0 0 0 2px var(--color-primary);
  pointer-events: none;
}
.wheel {
  position: relative;
  width: var(--wheel-width);
  height: calc(3 * var(--wheel-row));
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  /* Senkrecht dreht das Rad, waagerecht gehört die Geste dem Fächer nie. */
  touch-action: pan-y;
  overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, transparent 0, black 30%, black 70%, transparent 100%);
}
.wheel::-webkit-scrollbar {
  display: none;
}
.wheel:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.wheel-pad {
  height: var(--wheel-row);
}
.wheel-item {
  height: var(--wheel-row);
  display: grid;
  place-items: center;
  scroll-snap-align: center;
  /* Die Schrift wächst mit dem Rad, damit die Räder die Folie füllen. */
  font-size: calc(var(--wheel-width) * 0.65);
  font-family: var(--font-number);
  font-weight: var(--font-number-weight);
  color: var(--color-ink-soft);
  opacity: 0.45;
  cursor: grab;
}
.wheel-item.is-selected {
  color: var(--color-primary);
  opacity: 1;
}

/* Platz nach dem Eintragen: groß die Zahl, daneben das Lob. */
.rank {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: flex-end;
}
.rank > div {
  display: flex;
  flex-direction: column;
}
.rank-big {
  font-size: var(--text-2xl);
  font-family: var(--font-number);
  font-weight: var(--font-number-weight);
  line-height: 1;
  color: var(--color-accent-2);
}
.rank-small {
  font-size: var(--text-s);
  font-weight: 700;
  color: var(--color-ink-soft);
}
.rank-as {
  flex-basis: 100%;
  margin: 0;
  font-weight: 700;
}

.lb-list {
  list-style: none;
  margin: var(--space-3) 0;
  padding: 0;
}
.lb-list li {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-s);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lb-list li:nth-child(odd) {
  background: var(--color-surface-sunken);
}
/* Eigene Zeile ist ein Knopf (Abrechnung): füllt die Zeile, Maße wie die übrigen Zeilen. */
.lb-list li.is-own:has(.lb-open) {
  display: block;
  padding: 0;
}
.lb-open {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--tap-min);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: inherit;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.lb-open:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: -3px;
}
/* Eigene Zeile: Fläche in der Akzentfarbe, Name unterstrichen, nicht nur Farbe (Grundsatz 3). */
.lb-list li.is-own {
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.lb-list li.is-own .lb-place {
  color: inherit;
}
/* Bestenliste auf der Folie im Ergebnis: volle Folienbreite, enge Zeilen, damit
   Platz und Liste auch auf einer schmalen Folie in 9:16 passen. */
.share-slide .lb-list {
  align-self: stretch;
  margin: 0;
  font-size: var(--text-s);
}
.share-slide .lb-list li {
  grid-template-columns: 1.5rem 1fr auto;
  padding: var(--space-1) var(--space-2);
}
.share-slide.entry {
  gap: var(--space-2);
}
.share-slide .rank {
  flex-wrap: nowrap;
  gap: var(--space-3);
}
.share-slide .rank-big {
  font-size: var(--text-xl);
}
/* Der eigene Name ist in der Liste markiert. */
.share-slide .rank-as {
  display: none;
}
/* Tageswechsel in der Bestenliste: Pfeile links und rechts vom Datum. */
.lb-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.lb-nav .card-eyebrow {
  flex: 1;
  margin: 0;
  text-align: center;
}
/* Im Overlay liegt der Knopf auf der Karte, nicht auf dem Grund. */
.lb-nav .btn-icon {
  background: var(--color-surface-sunken);
}
.lb-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}
.lb-actions .btn {
  width: 100%;
}
.lb-note {
  margin: 0;
  font-size: var(--text-s);
  color: var(--color-ink-soft);
  text-align: center;
}
.lb-note[hidden] {
  display: none;
}

/* Teilen-Fächer: die Tafeln (Canvas, 9:16) liegen nebeneinander und rasten ein. */
/* Jede Folie liegt mittig in voller Fächerbreite; von den Nachbarn lugt nichts
   herein (sonst wirkt ein Rand wie ein Seitenstreifen), die Punkte zeigen, dass es weitergeht. */
.share-fan {
  /* Folienbreite: höchstens 16rem und die Fächerbreite, so schmal, dass die
     9:16-Folie in die Karte passt, aber nie unter 10rem (sonst lieber scrollen). */
  --slide-w: max(10rem, min(16rem, 100%, calc((var(--card-max) - var(--fan-reserve)) * 9 / 16)));
  display: flex;
  /* Eine zu hohe DOM-Folie streckt die Tafeln daneben nicht. */
  align-items: flex-start;
  width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.share-fan:empty {
  display: none;
}
.share-fan.is-locked {
  overflow-x: hidden;
}
.share-fan > * {
  flex: 0 0 var(--slide-w);
  width: var(--slide-w);
  height: auto;
  aspect-ratio: 9 / 16;
  margin-inline: calc((100% - var(--slide-w)) / 2);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-raised);
  scroll-snap-align: center;
}
/* Eintragskarte: DOM-Folie in den Maßen der Tafeln, Inhalt mittig wie bei Baumi. Kein
   overflow: hidden: Auf dem iPhone ließen sich die Namensräder darin nicht mehr drehen. */
.share-slide {
  justify-content: center;
  align-items: center;
  padding: var(--space-4) var(--space-3) var(--space-3);
  background: var(--color-surface);
  text-align: center;
  container-type: inline-size;
}
/* Auf einer schmalen Folie werden die Räder schmaler: Inhaltsbreite der Folie minus vier Lücken. */
.share-slide .wheels {
  --wheel-width: min(2.75rem, (100cqi - 1rem) / 5);
}
.entry > .btn {
  align-self: center;
}
.share-dots {
  display: flex;
  gap: var(--space-2);
  align-self: center;
}
.share-dots span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--color-line);
}
.share-dots span.on {
  background: var(--color-ink);
}
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.btn-accent.is-idle {
  visibility: hidden;
}
.btn-accent svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.share-status {
  margin: 0;
  font-size: var(--text-s);
  color: var(--color-ink-soft);
}
.share-status:empty {
  display: none;
}

/* Kopf des Ergebnisses: Die Figur rechts ragt um --result-overlap über die vordere
   Folie und fängt keine Wischgesten ab. */
.result-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  width: 100%;
  margin-bottom: calc(-1 * var(--result-overlap));
  pointer-events: none;
}

/* Fuß des Ergebnisses: Zurück und Neue Runde nebeneinander. */
.result-foot {
  display: flex;
  gap: var(--space-2);
  width: 100%;
}
.result-foot .btn {
  flex: 1;
}
.result-foot .btn-quiet {
  background: var(--color-surface-sunken);
  box-shadow: none;
}

/* Konfetti fällt über das ganze Ergebnis-Overlay und fängt keine Eingabe ab. */
.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Overlays (Muster von Baumi) ---------- */

.ueberlage {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-ink) 55%, transparent);
  backdrop-filter: blur(2px);
}
.overlay-open {
  overflow: hidden;
}
.ueberlage[hidden] {
  display: none;
}
.ue-karte {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 30rem;
  max-height: var(--card-max);
  padding: var(--space-4) var(--space-5) var(--space-5);
  border-radius: var(--radius-l);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-raised);
}
.ue-kopf {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.ue-titel {
  flex: 1;
  margin: 0;
  font-size: var(--text-xl);
}
.ue-zu {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface-sunken);
  color: var(--color-ink);
  cursor: pointer;
}
.ue-zu:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.ue-zu svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
}
.ue-inhalt {
  overflow-y: auto;
}
.ue-inhalt h3 {
  font-size: var(--text-m);
  margin-top: var(--space-3);
}
.ue-inhalt ul {
  padding-left: 1.2em;
  margin: 0;
}
.ue-inhalt li + li {
  margin-top: var(--space-2);
}

/* Abrechnung: Posten untereinander, die Summe unten abgesetzt. */
.ue-inhalt .settle {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
}
.ue-inhalt .settle li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-2) 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ue-inhalt .settle li.settle-total {
  margin-top: var(--space-2);
  border-top: 2px solid var(--color-ink);
  font-family: var(--font-number);
  font-weight: var(--font-number-weight);
  font-size: var(--text-l);
}
