/* Doko-Block · Gestaltung „Spieltisch und Schreibblock“
   Oben der blaue Filz des Spieltischs mit den Plätzen als Spielkarten (Kreuz, Pik, Herz, Karo = Rangfolge wie beim Doppelkopf),
   darunter der Schreibblock: Papier mit Abrisskante, roter Randlinie und Linien. Zahlen in Lora (Serifen, gleich breite Ziffern).
   Dunkelmodus: echtes Schwarz für OLED-Displays. */

@font-face { font-family: "Lora"; src: url("fonts/lora.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/lora-italic.woff") format("woff"); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  --tisch: #1d3a63;
  --tisch-2: #142b4b;
  --tisch-ink: #f1f3f8;
  --tisch-ink-2: rgba(241, 243, 248, .72);
  --tisch-linie: rgba(241, 243, 248, .16);
  --bg: #eef1f6;
  --papier: #fffefa;
  --papier-2: #f2f4f8;
  --linie: #dfe5ee;
  --linie-2: #c6cfdc;
  --rand-rot: #e48a80;
  --tinte: #1b2333;
  --tinte-2: #626e82;
  --gewinn: #1f5bb0;
  --marker: rgba(52, 120, 220, .14);
  --wahl: #1d3a63;
  --wahl-ink: #ffffff;
  --karo: #c2392d;
  --karo-hell: #fbe9e6;
  --gold: #e6b33b;
  --gold-ink: #2a1d00;
  --punkt: #8cc0ff;
  --schatten: 0 1px 2px rgba(20, 30, 25, .12);
  --schatten-karte: 0 1px 0 rgba(0, 0, 0, .06), 0 8px 18px -8px rgba(0, 0, 0, .45);

  --schrift: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --anzeige: "Lora", Georgia, "Times New Roman", serif;
  --kopf-h: 54px;
  --rand: max(12px, env(safe-area-inset-left, 0px));
  --rand-r: max(12px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tisch: #060c18; --tisch-2: #03070f; --tisch-ink: #e6ebf4; --tisch-ink-2: rgba(230, 235, 244, .62); --tisch-linie: rgba(230, 235, 244, .12);
    --bg: #000000; --papier: #0b0f17; --papier-2: #121825; --linie: #1a2130; --linie-2: #2b3547;
    --rand-rot: #6a2b26; --tinte: #e6ebf4; --tinte-2: #8e99ad; --gewinn: #82b6ff; --marker: rgba(130, 182, 255, .13);
    --wahl: #82b6ff; --wahl-ink: #04122a; --punkt: #82b6ff; --karo: #ff7b6c; --karo-hell: #33130f; --gold: #d8a838; --gold-ink: #1c1300;
    --schatten: none; --schatten-karte: 0 0 0 1px rgba(255, 255, 255, .05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --tisch: #060c18; --tisch-2: #03070f; --tisch-ink: #e6ebf4; --tisch-ink-2: rgba(230, 235, 244, .62); --tisch-linie: rgba(230, 235, 244, .12);
  --bg: #000000; --papier: #0b0f17; --papier-2: #121825; --linie: #1a2130; --linie-2: #2b3547;
  --rand-rot: #6a2b26; --tinte: #e6ebf4; --tinte-2: #8e99ad; --gewinn: #82b6ff; --marker: rgba(130, 182, 255, .13);
  --wahl: #82b6ff; --wahl-ink: #04122a; --punkt: #82b6ff; --karo: #ff7b6c; --karo-hell: #33130f; --gold: #d8a838; --gold-ink: #1c1300;
  --schatten: none; --schatten-karte: 0 0 0 1px rgba(255, 255, 255, .05);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0;
  background: var(--bg); color: var(--tinte);
  font: 16px/1.45 var(--schrift);
  -webkit-tap-highlight-color: transparent;
}
/* Nur dieser Bereich scrollt. Er beginnt unter der Statusleiste, damit iOS dort nichts verschwimmen lässt. */
#app {
  position: fixed; left: 0; right: 0; bottom: 0; top: env(safe-area-inset-top, 0px);
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}
body.tisch {
  background-color: var(--tisch);
  background-image: radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, .07), transparent 60%);
  background-attachment: fixed;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--tisch-2); }
body.tisch #app { background: transparent; }
body.sheet-offen { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gewinn); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.laden { padding: 40px 16px; text-align: center; color: var(--tinte-2); }
body.tisch .laden { color: var(--tisch-ink-2); }
.leise { color: var(--tinte-2); font-weight: 400; }
.klein-text { font-size: 13px; }
.farbe { width: 1em; height: 1em; display: inline-block; vertical-align: -.12em; }
.farbe.rot { color: var(--karo); }

/* Kopfzeile: Filzband */
.kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 2px;
  min-height: var(--kopf-h);
  padding: 0 max(6px, env(safe-area-inset-right, 0px)) 0 max(6px, env(safe-area-inset-left, 0px));
  background: var(--tisch-2); color: var(--tisch-ink);
  box-shadow: 0 1px 0 var(--tisch-linie);
}
.kopf-titel { flex: 1; min-width: 0; padding: 0 8px; display: flex; flex-direction: column; }
.kopf h1 { margin: 0; font: 600 19px/1.2 var(--anzeige); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unter { font-size: 12px; color: var(--tisch-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--punkt); margin-right: 4px; vertical-align: 1px; box-shadow: 0 0 0 3px rgba(140, 192, 255, .2); }
.live.aus::before { background: #ff7b6c; box-shadow: 0 0 0 3px rgba(255, 123, 108, .2); }
.ikon {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 12px; background: transparent; color: inherit; text-decoration: none;
}
.ikon svg { width: 22px; height: 22px; }
.ikon:active { background: var(--tisch-linie); }
.ikon.an { background: var(--gold); color: var(--gold-ink); }
.sheet .ikon { color: var(--tinte); }
.sheet .ikon:active { background: var(--linie); }

/* Plätze als Spielkarten auf dem Filz */
.stand {
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 7px;
  padding: 14px var(--rand-r) 14px var(--rand);
}
.platz {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0;
  min-height: 92px; padding: 24px 4px 9px;
  background: var(--papier); color: var(--tinte);
  border-radius: 10px; box-shadow: var(--schatten-karte);
}
.platz .idx {
  position: absolute; top: 6px; left: 7px;
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  font: 700 15px var(--anzeige);
}
.platz .idx .farbe { width: 11px; height: 11px; margin-top: 2px; }
.platz .nm { max-width: 100%; font-size: 13px; color: var(--tinte-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platz .pk { font: 700 28px/1.05 var(--anzeige); font-variant-numeric: lining-nums tabular-nums; }
.platz.p1 { box-shadow: var(--schatten-karte), inset 0 0 0 2px var(--gold); }
.platz.p1 .pk { color: var(--gewinn); }

.hinweis-ab, .zielbalken {
  margin: 0 var(--rand-r) 12px var(--rand); padding: 10px 14px; border-radius: 12px; font-size: 15px;
}
.hinweis-ab { background: var(--tisch-linie); color: var(--tisch-ink); }
.zielbalken { background: var(--gold); color: var(--gold-ink); font-weight: 650; }
.zielbalken.ende { background: var(--karo); color: #fff; }

/* Schreibblock */
.block-wrap {
  position: relative;
  margin: 0 var(--rand-r) 0 var(--rand);
  padding-top: 12px;
  background: var(--papier); border-radius: 4px 4px 8px 8px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08), 0 14px 30px -14px rgba(0, 0, 0, .55);
  overflow: hidden; overflow: clip;
}
.block-wrap::before { /* Abrisskante oben */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px;
  background: radial-gradient(circle at 5px -1px, var(--tisch) 3.2px, transparent 3.6px) 0 0 / 10px 7px repeat-x;
}
body:not(.tisch) .block-wrap::before { display: none; }
.block { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-variant-numeric: lining-nums tabular-nums; }
.block th {
  position: sticky; top: var(--kopf-h); z-index: 5;
  background: var(--papier); padding: 8px 2px 8px; vertical-align: bottom;
  font: 600 15px/1.15 var(--anzeige); text-align: center; color: var(--tinte);
  border-bottom: 2px solid var(--tinte);
}
.block th.sp span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block th.sp em {
  display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 6px;
  background: var(--gold); color: var(--gold-ink); font: 700 9.5px/1.5 var(--schrift); font-style: normal; letter-spacing: .08em; text-transform: uppercase;
}
.block th.nr, .block th.w, .block th.sig { font: 600 12px var(--schrift); color: var(--tinte-2); letter-spacing: .02em; }
.block td {
  height: 44px; padding: 0 2px; text-align: center;
  font: 600 20px var(--anzeige); color: var(--tinte);
  border-bottom: 1px solid var(--linie);
}
.block td + td { border-left: 1px solid var(--linie); }
.block .nr { width: 30px; border-right: 1.5px solid var(--rand-rot); font: 500 12px var(--schrift); color: var(--tinte-2); }
.block td.nr + td { border-left: 0; box-shadow: inset 2px 0 0 var(--papier), inset 3.5px 0 0 var(--rand-rot); }
.block th.nr + th { box-shadow: inset 2px 0 0 var(--papier), inset 3.5px 0 0 var(--rand-rot); }
.block .w { width: 54px; border-left: 2px solid var(--linie-2) !important; white-space: nowrap; font-size: 17px; font-weight: 500; }
.block .sig { width: 44px; color: var(--tinte-2); font-size: 15px !important; font-weight: 500 !important; }
.block tbody tr { cursor: pointer; }
.block tbody tr:active td { background: var(--papier-2); }
.block td.plus { color: var(--gewinn); background: var(--marker); }
.block td.minus { color: var(--karo); }
.block td.strich { color: var(--linie-2); font-weight: 400; }
.block td.aus { opacity: .5; }
.block td.solist { box-shadow: inset 0 -3px 0 var(--karo); }
.block tr.letzte td:not(.nr):not(.w):not(.sig):not(.strich) { font-weight: 700; }
.block tbody tr:last-child td { border-bottom: 0; }
.block tr.mit-notiz td { border-bottom: 0; }
.block tr.notizzeile td {
  height: auto; padding: 0 8px 7px; text-align: left; border-left: 0 !important; box-shadow: none !important;
  font: italic 400 14px/1.3 var(--anzeige); color: var(--tinte-2);
}
.block tr.notizzeile td.nr { padding: 0; }
.block tr.leer { cursor: default; }
.block tr.leer td { height: auto; padding: 34px 16px; font: italic 400 16px/1.5 var(--anzeige); color: var(--tinte-2); }
.m { font: 700 10px var(--schrift); font-style: normal; margin-left: 3px; padding: 1px 4px; border-radius: 5px; vertical-align: 3px; }
.m.solo { background: var(--karo-hell); color: var(--karo); }
.m.frei { background: var(--linie); color: var(--tinte-2); }

/* Leiste unten */
.fuss {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 22px var(--rand-r) calc(12px + env(safe-area-inset-bottom, 0px)) var(--rand);
  background: linear-gradient(to bottom, transparent, var(--bg) 45%);
}
body.tisch .fuss { background: linear-gradient(to bottom, transparent, var(--tisch) 45%); }
.fuss > * { max-width: 560px; margin: 0 auto; }
.fuss-reihe { display: flex; gap: 10px; }
.fuss-reihe .haupt { flex: 1; width: auto; }
.fuss-reihe > .zweit:not(.rueck) { flex: 1; }
body.tisch .fuss .haupt { background: var(--gold); color: var(--gold-ink); }
body.tisch .fuss .zweit { color: var(--tisch-ink); border-color: var(--tisch-linie); background: rgba(0, 0, 0, .18); }
.rueck { flex: none; min-width: 56px; padding: 0 14px; font-weight: 700; white-space: nowrap; }
.rueck svg { width: 22px; height: 22px; }

/* Knöpfe */
.haupt {
  width: 100%; min-height: 54px; padding: 0 18px; border: 0; border-radius: 16px;
  background: var(--wahl); color: var(--wahl-ink); font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset;
}
.haupt svg { width: 22px; height: 22px; }
.haupt:active { transform: translateY(1px); }
.haupt:disabled { opacity: .5; }
.zweit {
  min-height: 52px; padding: 0 18px; border-radius: 16px;
  border: 1.5px solid var(--linie-2); background: var(--papier); font-weight: 600; color: var(--tinte);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.zweit svg { width: 20px; height: 20px; }
.gefahr { min-height: 52px; padding: 0 18px; border-radius: 16px; border: 0; background: var(--karo); color: #fff; font-weight: 700; }
.klein { min-height: 40px; padding: 0 12px; border-radius: 12px; font-size: 14px; }

/* Bottom-Sheet */
#sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-hg { position: absolute; inset: 0; background: rgba(4, 8, 18, .55); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  max-height: calc(100% - var(--oben, env(safe-area-inset-top, 0px)) - 10px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  background: var(--papier); border-radius: 22px 22px 0 0;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
  animation: hoch .22s ease-out;
}
@keyframes hoch { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-kopf { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; background: var(--papier); padding-top: 18px; }
.sheet-kopf::before { content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--linie-2); }
.sheet-kopf h2 { flex: 1; margin: 0; font: 600 22px/1.2 var(--anzeige); }
.hilfe-link { font-size: 14px; text-decoration: none; padding: 8px; }
.hinweis-text { margin: 0; color: var(--tinte-2); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 13px; background: var(--papier-2); border: 1px solid var(--linie); }
.seg button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--tinte-2); font-weight: 650; }
.seg button.an { background: var(--papier); color: var(--tinte); box-shadow: var(--schatten), 0 0 0 1px var(--linie-2); }
.seg button.an.rot { color: var(--karo); }
.seg button.an.gruen { color: var(--gewinn); }

.feld { display: flex; flex-direction: column; gap: 8px; }
.lbl { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tinte-2); }
.lbl .leise { text-transform: none; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  flex: 1 1 auto; min-height: 48px; padding: 0 14px; border-radius: 24px;
  border: 1.5px solid var(--linie-2); background: var(--papier); font-weight: 650;
}
.chip.an { background: var(--wahl); border-color: var(--wahl); color: var(--wahl-ink); }
.chip.k-aus.an { background: var(--tinte-2); border-color: var(--tinte-2); color: var(--papier); }
.chip.k-solist.an { background: var(--karo); border-color: var(--karo); color: #fff; }
.chip.k-gibt.an { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.chip:disabled { opacity: .3; }
.klein-chips .chip { flex: 0 0 auto; min-height: 36px; font-size: 14px; padding: 0 12px; }

.wertzeile { display: flex; gap: 8px; align-items: stretch; }
.wertzeile > input:not(.zahl) { flex: 1; min-width: 0; }
#f-wert {
  width: 80px; flex: none; text-align: center; font: 700 30px var(--anzeige);
  border: 1.5px solid var(--linie-2); border-radius: 14px; background: var(--papier-2);
}
.schnell { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.schnell button { min-height: 44px; border: 1.5px solid var(--linie-2); border-radius: 12px; background: var(--papier); font: 600 18px var(--anzeige); }
.schnell button.an { background: var(--wahl); border-color: var(--wahl); color: var(--wahl-ink); }

.frei { display: grid; grid-template-columns: 1fr; gap: 8px; }
.frei label { display: grid; grid-template-columns: 1fr 44px 92px; gap: 8px; align-items: center; }
.frei span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.frei input { min-height: 46px; width: 100%; text-align: center; font: 600 21px var(--anzeige); border: 1.5px solid var(--linie-2); border-radius: 12px; background: var(--papier-2); }
.frei button { min-height: 46px; border: 1.5px solid var(--linie-2); border-radius: 12px; background: var(--papier); font-weight: 700; }

.vorschau { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 11px 14px; border-radius: 14px; background: var(--papier-2); border: 1px dashed var(--linie-2); font-size: 14px; color: var(--tinte-2); }
.vorschau b { font: 700 16px var(--anzeige); color: var(--tinte); }
.vorschau .plus b { color: var(--gewinn); }
.vorschau .minus b { color: var(--karo); }
.konflikt { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: var(--karo-hell); }
.konflikt p { margin: 0; }
.knopfzeile { display: flex; gap: 10px; flex-wrap: wrap; }
.knopfzeile > * { flex: 1 1 auto; }
.sheet-fuss { display: flex; gap: 10px; }
.sheet-fuss .haupt { flex: 1; }
.kachelknoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kachelknoepfe > * { min-height: 48px; padding: 0 8px; font-size: 15px; text-align: center; }

/* Eingaben und Seiten */
.eingabe, .seite input[type="text"], .seite input[type="password"], .sheet input[type="text"], .sheet input[type="password"], .sheet input[type="time"] {
  width: 100%; min-height: 48px; padding: 0 14px; font-size: 16px; font-weight: 400; color: var(--tinte);
  border: 1.5px solid var(--linie-2); border-radius: 13px; background: var(--papier);
}
.wertzeile input.eingabe.zahl[type="text"] { width: 84px; flex: none; padding: 0 6px; text-align: center; font: 700 26px var(--anzeige); background: var(--papier-2); }
.seite label, .sheet label.zeile { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tinte-2); }
.seite label input, .sheet label.zeile input { text-transform: none; letter-spacing: 0; }
.namen { display: grid; gap: 8px; }
.namen .zn { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 8px; }
.namen .zn b { font: 700 17px var(--anzeige); color: var(--tinte-2); text-align: center; }

.seite { max-width: 640px; margin: 0 auto; padding: 18px var(--rand-r) 28px var(--rand); display: flex; flex-direction: column; gap: 18px; }
.seite > .zweit { width: 100%; }
.abschnitt { display: flex; flex-direction: column; gap: 10px; }
.abschnitt > h2 { margin: 10px 0 0; font: 600 20px var(--anzeige); color: var(--tinte); }
.kasten { background: var(--papier); border: 1px solid var(--linie); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.kasten p { margin: 0; }

.karte {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 15px 16px 14px 22px; text-decoration: none; color: var(--tinte);
  background: var(--papier); border: 1px solid var(--linie); border-radius: 14px; box-shadow: var(--schatten); overflow: hidden;
}
.karte::before { content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 1.5px; background: var(--rand-rot); }
.karte:active { background: var(--papier-2); }
.karte-kopf { display: flex; align-items: baseline; gap: 8px; }
.karte-kopf strong { flex: 1; min-width: 0; font: 600 18px var(--anzeige); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.karte-kopf span { font-size: 13px; color: var(--tinte-2); white-space: nowrap; }
.mini { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--tinte-2); }
.mini b { color: var(--tinte); font: 700 15px var(--anzeige); font-variant-numeric: lining-nums tabular-nums; }
.mini .erster b { color: var(--gewinn); }
.leerseite { text-align: center; color: var(--tinte-2); padding: 28px 8px; font: italic 400 17px/1.5 var(--anzeige); }

.zeilenliste { display: flex; flex-direction: column; }
.zeilenliste > div { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--linie); }
.zeilenliste > div:last-child { border-bottom: 0; }
.zeilenliste .txt { flex: 1; min-width: 0; }
.zeilenliste .txt small { display: block; color: var(--tinte-2); font-size: 13px; }
.betrag { font: 700 17px var(--anzeige); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.summe { margin: 8px 0 0; text-align: right; }
.salden { margin-top: 10px; }
.plus-geld { color: var(--gewinn) !important; }
.minus-geld { color: var(--karo) !important; }
.qr-rahmen { display: grid; place-items: center; padding: 6px 0; }
.qr { width: min(70vw, 270px); height: auto; border-radius: 16px; border: 10px solid #ffffff; box-shadow: 0 0 0 1px var(--linie-2), var(--schatten); }
.bild-vorschau { width: 100%; border-radius: 12px; border: 1px solid var(--linie); }

/* Anmeldung */
.login { max-width: 400px; margin: 0 auto; padding: 40px var(--rand-r) 24px var(--rand); display: flex; flex-direction: column; gap: 18px; color: var(--tisch-ink); }
.login h1 { margin: 0; font: 600 34px/1.1 var(--anzeige); }
.login > p { margin: 0; color: var(--tisch-ink-2); }
.login form { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--papier); color: var(--tinte); border-radius: 18px; box-shadow: var(--schatten-karte); }
.login label { display: flex; flex-direction: column; gap: 6px; }
.login > a { color: var(--tisch-ink); text-align: center; }
.login > .zweit { background: rgba(0, 0, 0, .18); color: var(--tisch-ink); border-color: var(--tisch-linie); }
.logo {
  position: relative; width: 66px; height: 88px; border-radius: 10px; background: var(--papier); color: var(--tinte);
  box-shadow: var(--schatten-karte); transform: rotate(-6deg);
  display: grid; place-items: center;
}
.logo .farbe { width: 34px; height: 34px; }
.logo::before, .logo::after { content: "D"; position: absolute; font: 700 14px var(--anzeige); }
.logo::before { top: 5px; left: 7px; }
.logo::after { content: "K"; bottom: 5px; right: 7px; transform: rotate(180deg); }

/* Anleitung */
.anleitung { max-width: 65ch; margin: 0 auto; padding: 8px var(--rand-r) 32px var(--rand); }
.anleitung h2 { font: 600 21px/1.25 var(--anzeige); margin: 28px 0 8px; scroll-margin-top: calc(var(--kopf-h) + 12px); text-wrap: balance; }
.anleitung p, .anleitung li { line-height: 1.6; }
.anleitung ul, .anleitung ol { padding-left: 22px; }

/* Ewige Tabelle */
.tab-wrap { overflow-x: auto; background: var(--papier); border: 1px solid var(--linie); border-radius: 16px; }
.tab { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; }
.tab th, .tab td { padding: 11px 11px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--linie); }
.tab td { font: 600 17px var(--anzeige); font-variant-numeric: lining-nums tabular-nums; }
.tab th { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tinte-2); cursor: pointer; user-select: none; }
.tab th.an { color: var(--gewinn); }
.tab .nm { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--papier); font: 600 16px var(--schrift); box-shadow: 1px 0 0 var(--linie); }
.tab th.nm { font: 700 11px var(--schrift); }
.tab .pos { display: inline-block; min-width: 1.7em; color: var(--tinte-2); font: 500 14px var(--anzeige); }
.tab tbody tr:first-child .pos { color: var(--gold); font-weight: 700; }
.tab tbody tr:last-child td { border-bottom: 0; }
.tab small { display: block; color: var(--tinte-2); font: 400 11px var(--schrift); }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 14px;
  background: var(--tinte); color: var(--papier); font-size: 15px; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
body.sheet-offen #toast { bottom: auto; top: calc(14px + env(safe-area-inset-top, 0px)); }

/* Feinschliff: Platz für den Kartenindex, schmalere Köpfe bei 5 Spielern */
.platz { padding-top: 34px; min-height: 96px; }
.block.n5 th.sp { font-size: 13.5px; letter-spacing: -.01em; }
.block.n5 td { font-size: 18px; }
@media (max-width: 360px) { .block th.sp { font-size: 13px; } .platz .nm { font-size: 12px; } }

/* Trenner nach jeder Runde (jeder hat einmal gegeben) und am Ende */
.block tr.trenner td {
  height: auto; padding: 4px 10px 4px 40px; text-align: left; cursor: default;
  border-top: 2px solid var(--tinte); border-bottom: 1px solid var(--linie-2); border-left: 0 !important; box-shadow: none !important;
  background: var(--papier-2); color: var(--tinte-2);
  font: 700 10.5px/1.4 var(--schrift); letter-spacing: .09em; text-transform: uppercase;
}
.block tr.trenner.ende td { background: var(--gold); color: var(--gold-ink); border-top-color: var(--gold-ink); }
.block tr.trenner + tr td { border-top: 0; }
/* Geworfen: keine Punkte, neu gegeben */
.block tr.geworfen td {
  height: 34px; padding: 0 10px; text-align: left; border-left: 0 !important; box-shadow: none !important;
  font: italic 500 14px/1.3 var(--anzeige); color: var(--tinte-2);
  background: repeating-linear-gradient(135deg, transparent 0 7px, var(--linie) 7px 8px);
}
.block tr.geworfen td.nr { text-align: center; font: 600 15px var(--schrift); padding: 0; background: none; }
.geworfen-info { margin: 0; padding: 11px 14px; border-radius: 14px; background: var(--papier-2); border: 1px dashed var(--linie-2); color: var(--tinte-2); }
.geworfen-info b { color: var(--tinte); }
.fuss-reihe > .haupt:only-child { flex: 1; }

.block th.sp { font-size: 14.5px; letter-spacing: -.01em; }

/* Auf breiten Bildschirmen nicht über die ganze Breite ziehen */
@media (min-width: 760px) {
  .stand, .block-wrap, .hinweis-ab, .zielbalken { width: min(720px, calc(100% - 32px)); margin-left: auto; margin-right: auto; }
  .kopf { padding-left: max(16px, calc((100% - 720px) / 2)); padding-right: max(16px, calc((100% - 720px) / 2)); }
}

/* iPhone: iOS lässt die Zone bis etwa 40 pt unter der Statusleiste verschwimmen.
   Deshalb beginnt die App erst darunter; der Streifen darüber ist einfarbig (keine Schrift). */
:root { --oben: calc(env(safe-area-inset-top, 0px) + min(40px, env(safe-area-inset-top, 0px))); }
#app { top: var(--oben); }
body::before { height: var(--oben); }
body.sheet-offen #toast { top: calc(14px + var(--oben)); }

/* „Runde 1“ steht direkt unter den Namen, ohne zweiten dicken Strich */
.block tr.trenner.erste td { border-top: 0; }

/* Besonderheiten unter dem Block */
.besonders { margin: 18px var(--rand-r) 0 var(--rand); display: flex; flex-direction: column; gap: 10px; }
.besonders h2 { margin: 0; font: 600 20px var(--anzeige); color: var(--tinte); }
body.tisch .besonders h2, body.tisch .besonders > p { color: var(--tisch-ink); }
.besonders > p { margin: 0; }
.tab.kompakt th, .tab.kompakt td { text-align: center; }
.tab.kompakt .nm { text-align: left; }
.tab.kompakt th { cursor: default; }
.tab.kompakt .strich { color: var(--linie-2); font-weight: 400; }
.tab.kompakt .summe-zeile td { border-top: 2px solid var(--tinte); font-weight: 700; }
@media (min-width: 760px) { .besonders { width: min(720px, calc(100% - 32px)); margin-left: auto; margin-right: auto; } }

/* Archiv nach Jahren */
.jahr { background: var(--papier); border: 1px solid var(--linie); border-radius: 14px; overflow: hidden; }
.jahr summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; padding: 14px 16px;
  font: 600 19px var(--anzeige);
}
.jahr summary::-webkit-details-marker { display: none; }
.jahr summary::after { content: "›"; margin-left: auto; font: 400 22px var(--schrift); color: var(--tinte-2); transition: transform .15s; }
.jahr[open] summary::after { transform: rotate(90deg); }
.jahr summary small { font: 400 13px var(--schrift); color: var(--tinte-2); }
.archiv-liste { border-top: 1px solid var(--linie); }
.archiv-zeile { display: flex; align-items: center; gap: 12px; padding: 11px 16px; text-decoration: none; color: var(--tinte); border-bottom: 1px solid var(--linie); }
.archiv-zeile:last-child { border-bottom: 0; }
.archiv-zeile:active { background: var(--papier-2); }
.archiv-zeile .dat { flex: none; width: 72px; font: 600 14px var(--anzeige); color: var(--tinte-2); }
.archiv-zeile .txt { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archiv-zeile .txt small { display: block; font-weight: 400; font-size: 13px; color: var(--tinte-2); overflow: hidden; text-overflow: ellipsis; }
.archiv-zeile .pfeil { color: var(--tinte-2); font-size: 20px; }
.hinweis-gruppe { margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--papier); border: 1px dashed var(--linie-2); color: var(--tinte-2); }
.kopf .ikon { font: 700 18px var(--schrift); }

/* Einladung */
textarea.eingabe.einladung {
  width: 100%; min-height: 260px; padding: 12px 14px; resize: vertical;
  font: 15px/1.45 var(--schrift); color: var(--tinte);
  border: 1.5px solid var(--linie-2); border-radius: 13px; background: var(--papier-2);
}

/* Runde: Plätze und Namen bleiben oben fest, nur die Spiele scrollen.
   Plätze dafür flacher, damit darunter immer eine ganze Runde Platz hat. */
body.tisch .stand {
  position: sticky; top: var(--kopf-h); z-index: 8;
  background: var(--tisch); padding-top: 10px; padding-bottom: 10px;
  box-shadow: 0 6px 10px -8px rgba(0, 0, 0, .5);
}
.platz {
  min-height: 0; padding: 6px 6px 5px; gap: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 4px;
}
.platz .idx { position: static; flex-direction: row; gap: 2px; font-size: 13px; grid-row: 1; grid-column: 1; }
.platz .idx .farbe { width: 10px; height: 10px; margin-top: 0; }
.platz .nm { grid-row: 1; grid-column: 2; text-align: right; font-size: 12px; }
.platz .pk { grid-row: 2; grid-column: 1 / -1; text-align: center; font-size: 26px; line-height: 1.1; }
.block th { top: calc(var(--kopf-h) + var(--stand-h, 0px)); }
body.tisch .block-wrap { overflow: visible; }
body.tisch .block-wrap > .block { border-radius: inherit; }
.block th.sp em { margin-top: 2px; }
@media (min-width: 760px) { body.tisch .stand { width: auto; padding-left: max(16px, calc((100% - 720px) / 2)); padding-right: max(16px, calc((100% - 720px) / 2)); } }

/* Zusammenfassung nach dem Abschließen */
.abschluss { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.sieger {
  display: flex; align-items: center; gap: 18px;
  margin: 16px var(--rand-r) 4px var(--rand); padding: 18px;
  background: var(--papier); border-radius: 16px; box-shadow: var(--schatten-karte), inset 0 0 0 2px var(--gold);
}
.sieger h2 { margin: 2px 0; font: 600 26px/1.15 var(--anzeige); color: var(--tinte); text-wrap: balance; }
.sieger-zeile { margin: 0; font-size: 14px; color: var(--tinte-2); }
.sieger-karte {
  flex: none; width: 54px; height: 72px; border-radius: 8px; display: grid; place-items: center;
  background: var(--papier); color: var(--tinte); transform: rotate(-6deg);
  box-shadow: 0 0 0 1.5px var(--linie-2), 0 6px 14px -6px rgba(0, 0, 0, .4);
}
.sieger-karte .farbe { width: 28px; height: 28px; }
.endstand .platzmarke { display: inline-flex; align-items: center; gap: 2px; font: 700 16px var(--anzeige); }
.endstand .platzmarke .farbe { width: 12px; height: 12px; }
.endstand tr.erster td { background: rgba(230, 179, 59, .14); }
.tab.kompakt td small { display: block; font: 400 11px var(--schrift); color: var(--tinte-2); }
.tab tr.dabei td { background: var(--marker); }
.besonders > .zweit { width: 100%; }
@media (min-width: 760px) { .sieger { width: min(720px, calc(100% - 32px)); margin-left: auto; margin-right: auto; } }
.tab.kompakt th, .tab.kompakt td { padding: 9px 6px; }
.tab.kompakt th { font-size: 10px; letter-spacing: .03em; }
.tab.kompakt td { font-size: 16px; }
.tab.kompakt .nm { padding-left: 12px; }
.abschluss ~ .fuss .fuss-reihe > .zweit, .fuss-reihe > .zweit + .haupt { white-space: nowrap; }
.fuss-reihe > .zweit:not(.rueck) { flex: 0 1 auto; }
.fuss-reihe > .zweit:not(.rueck):only-child { flex: 1; }

/* Etwas niedrigere Zeilen, damit vorige und laufende Runde zusammen auf den Bildschirm passen */
.block td { height: 40px; }
.block tr.notizzeile td { padding-bottom: 5px; font-size: 13px; }
.block tr.trenner td { padding-top: 3px; padding-bottom: 3px; }
.sheet .besonders { margin: 0; }
.kachelknoepfe > :last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Re/Kontra: Ansage-Zeilen im Eintragen und Markierung im Block */
.ansage-zeile { display: grid; grid-template-columns: 62px 1fr; gap: 8px; align-items: start; }
.ansage-titel { padding-top: 9px; font-weight: 700; font-size: 14px; color: var(--tinte); }
.ansage-zeile .chip { min-height: 34px; padding: 0 10px; font-size: 13px; }
.block td.w small.partei {
  display: block; margin-top: -3px; font: 700 9.5px/1.1 var(--schrift); letter-spacing: .03em; color: var(--tinte-2);
}
.block td.w small.partei.re { color: var(--gewinn); }
.block td.w small.partei.kontra { color: var(--karo); }
.besonders .tab-wrap + .tab-wrap { margin-top: 2px; }

.sheet .besonders h2, .sheet .besonders > p, body.tisch .sheet .besonders h2, body.tisch .sheet .besonders > p { color: var(--tinte); }
.sheet .besonders { gap: 8px; }

/* 1.8.0: Vorschlag, Verlauf, Rekorde, Jahresrückblick, ohne Netz */
.vorschlag {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px;
  background: var(--papier-2); border: 1.5px solid var(--gold);
}
.vorschlag > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vorschlag b { font: 700 20px var(--anzeige); }
.vorschlag small { color: var(--tinte-2); font-size: 12px; line-height: 1.35; }

.verlauf { background: var(--papier); border: 1px solid var(--linie); border-radius: 16px; padding: 12px 10px 10px; }
.verlauf svg { width: 100%; height: auto; display: block; }
.verlauf .v-gitter { stroke: var(--linie); stroke-width: 1; }
.verlauf .v-achse { fill: var(--tinte-2); font: 10px var(--schrift); }
.v-legende { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 6px 0; font-size: 14px; color: var(--tinte); }
.v-legende i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.v-legende b { font: 700 15px var(--anzeige); }
.verlauf p { margin: 6px 6px 0; color: var(--tinte-2); }

.rekorde, .rb-karten { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rekord, .rb-karte {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; min-width: 0;
  background: var(--papier); border: 1px solid var(--linie); border-radius: 14px;
}
.rekord b, .rb-karte b { font: 600 18px/1.2 var(--anzeige); color: var(--tinte); overflow-wrap: anywhere; }
.r-titel { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tinte-2); }
.r-wer { font-size: 13px; color: var(--tinte-2); overflow-wrap: anywhere; }
.rb-karte.gross { grid-column: 1 / -1; box-shadow: inset 0 0 0 2px var(--gold); }
.rb-karte.gross b { font-size: 24px; }
.rueckblick { display: flex; flex-direction: column; gap: 8px; }
.rueckblick h2 { margin: 6px 0 0; font: 600 22px var(--anzeige); }
.rueckblick > p { margin: 0; color: var(--tinte-2); }
.seite .besonders { margin-left: 0; margin-right: 0; }
.seite .besonders h2 { color: var(--tinte); }

.block tr.wartet td { opacity: .55; }
.block tr.wartet td.nr::after { content: "…"; }

/* 1.9.0: mehrere Gruppen, Gesamtstatistik */
.gruppen-wahl { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
.gruppen-wahl::-webkit-scrollbar { display: none; }
.gruppen-wahl button {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 20px;
  background: var(--papier); color: var(--tinte); border: 1px solid var(--linie-2); font: 600 15px var(--schrift); white-space: nowrap;
}
.gruppen-wahl button.an { background: var(--gewinn); border-color: var(--gewinn); color: #fff; }
.gruppen-wahl button.plus { background: transparent; border-style: dashed; color: var(--tinte-2); }
.gruppen-wahl button.plus svg { width: 16px; height: 16px; }
.gruppen-wahl .punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); display: inline-block; }
.statistik-link { margin-top: 6px; }

.balken { display: flex; flex-direction: column; gap: 8px; background: var(--papier); border: 1px solid var(--linie); border-radius: 16px; padding: 14px; }
.b-zeile { display: grid; grid-template-columns: minmax(84px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.b-l { color: var(--tinte); overflow-wrap: anywhere; }
.b-spur { height: 10px; border-radius: 5px; background: var(--papier-2); overflow: hidden; }
.b-spur i { display: block; height: 100%; border-radius: 5px; background: var(--gewinn); }
.b-v { font: 700 15px var(--anzeige); color: var(--tinte); text-align: right; min-width: 64px; }
.b-v small { display: block; font: 400 11px var(--schrift); color: var(--tinte-2); }
