/*
 * Escalero Spielblock – Liquid Glass
 * Ebenen: Tisch (Filz) → Block (Papier, Hauptinhalt) → Glas (Bedienung, schwebt darüber).
 * Glas nur für Bedienelemente; der Block bleibt opak und voll lesbar.
 */

/* ---------- Tokens: Tag ---------- */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --gutter: 8px;
  --bar-h: 50px;
  --btn: 44px;
  --row-h: 40px;
  --lab-w: 44px;
  --r-sheet: 34px;
  --r-tray: 36px;

  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --spring-pop: linear(0, 0.035, 0.123, 0.245, 0.383, 0.524, 0.657, 0.776, 0.876, 0.958, 1.019, 1.062, 1.09, 1.104, 1.107, 1.102, 1.092, 1.078, 1.064, 1.049, 1.035, 1.022, 1.012, 1.003, 0.997, 0.993, 0.99, 0.989, 0.989, 0.989, 0.99, 0.992, 0.993, 0.995, 0.997, 0.998, 1);
  --spring-soft: linear(0, 0.023, 0.081, 0.16, 0.25, 0.343, 0.435, 0.521, 0.599, 0.67, 0.732, 0.785, 0.83, 0.868, 0.899, 0.925, 0.945, 0.961, 0.974, 0.983, 0.99, 0.996, 0.999, 1.002, 1.004, 1.005, 1.005, 1.005, 1.005, 1.005, 1.004, 1.004, 1.003, 1.003, 1.002, 1.002, 1);

  /* Tisch */
  --felt-hi: #3f8169;
  --felt: #2d6954;
  --felt-lo: #1d4a3b;

  /* Block */
  --paper: #fff;
  --ink: #0f1513;
  --ink-2: #434f4b;
  --ink-3: #59645f;
  --rule: rgba(15, 21, 19, .075);
  --rule-2: rgba(15, 21, 19, .14);
  --rule-3: rgba(15, 21, 19, .26);

  /* Spieler: Blau und Zinnober, auch bei Farbsehschwäche gut unterscheidbar */
  --p1: #0a58b8;
  --p2: #b03a0c;
  --p1-bar: #2272da;
  --p2-bar: #d9561d;
  --p1-tint: rgba(10, 88, 184, .06);
  --p2-tint: rgba(208, 98, 30, .075);
  --p1-tint-2: rgba(10, 88, 184, .14);
  --p2-tint-2: rgba(176, 58, 12, .14);
  --p1-band: rgba(10, 88, 184, .028);
  --p2-band: rgba(176, 58, 12, .028);
  --p1-line: rgba(10, 88, 184, .55);
  --p2-line: rgba(176, 58, 12, .55);
  --p1-on-glass: #b6d8ff;
  --p2-on-glass: #ffc3a4;

  --accent: #17694d;
  --accent-ink: #11603f;
  --accent-tint: rgba(23, 105, 77, .1);
  --danger: #c4221c;

  /* Glas: klar (kleine Bedienelemente auf dem Tisch) und regulär (Flächen mit Text) */
  --on-glass: #fff;
  --on-glass-2: rgba(255, 255, 255, .86);
  --on-glass-3: rgba(255, 255, 255, .76);
  --cg-fill: rgba(3, 24, 16, .4);
  --thumb-p1: rgba(150, 196, 255, .17);
  --thumb-p2: rgba(255, 186, 156, .17);
  --cg-hl: rgba(255, 255, 255, .58);
  --cg-rim: rgba(255, 255, 255, .15);
  --cg-glow: rgba(255, 255, 255, .3);
  --cg-shade: rgba(0, 18, 11, .2);

  --rg-fill: rgba(248, 251, 249, .87);
  --rg-fill-open: rgba(250, 252, 251, .88);
  --rg-hl: rgba(255, 255, 255, .95);
  --rg-rim: rgba(255, 255, 255, .55);
  --rg-glow: rgba(255, 255, 255, .7);
  --rg-shade: rgba(15, 50, 36, .07);

  --tile: rgba(255, 255, 255, .72);
  --tile-hl: rgba(255, 255, 255, .95);
  --tile-press: rgba(255, 255, 255, .95);
  --well: rgba(255, 255, 255, .58);
  --seg-track: rgba(16, 46, 34, .075);
  --seg-thumb: #fff;
  --field: rgba(255, 255, 255, .9);

  --shadow-float: 0 1px 1px rgba(4, 24, 16, .08), 0 8px 22px -8px rgba(4, 24, 16, .42), 0 22px 44px -26px rgba(4, 24, 16, .5);
  --shadow-card: 0 1px 2px rgba(3, 22, 14, .16), 0 6px 14px -6px rgba(3, 22, 14, .28), 0 22px 48px -22px rgba(3, 22, 14, .55);
  --shadow-sheet: 0 -1px 2px rgba(3, 22, 14, .06), 0 -12px 34px -14px rgba(3, 22, 14, .45);
  --scrim: rgba(3, 18, 11, .28);
}

/* ---------- Tokens: Nacht ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --felt-hi: #183d30;
    --felt: #0f261e;
    --felt-lo: #06110d;
    --paper: #141a18;
    --ink: #edf2f0;
    --ink-2: #aab5b1;
    --ink-3: #8e9a95;
    --rule: rgba(255, 255, 255, .065);
    --rule-2: rgba(255, 255, 255, .12);
    --rule-3: rgba(255, 255, 255, .22);
    --p1: #76b5ff;
    --p2: #ff9566;
    --p1-bar: #5ea6ff;
    --p2-bar: #ff8352;
    --p1-tint: rgba(118, 181, 255, .1);
    --p2-tint: rgba(255, 149, 102, .1);
    --p1-tint-2: rgba(118, 181, 255, .19);
    --p2-tint-2: rgba(255, 149, 102, .19);
    --p1-band: rgba(118, 181, 255, .035);
    --p2-band: rgba(255, 149, 102, .035);
    --p1-line: rgba(118, 181, 255, .6);
    --p2-line: rgba(255, 149, 102, .6);
    --p1-on-glass: #9fcbff;
    --p2-on-glass: #ffb38f;
    --accent: #1f7a59;
    --accent-ink: #62d1a6;
    --accent-tint: rgba(98, 209, 166, .12);
    --danger: #ff6a61;
    --cg-fill: rgba(255, 255, 255, .06);
    --thumb-p1: rgba(120, 175, 255, .13);
    --thumb-p2: rgba(255, 150, 110, .13);
    --cg-hl: rgba(255, 255, 255, .3);
    --cg-rim: rgba(255, 255, 255, .09);
    --cg-glow: rgba(255, 255, 255, .1);
    --cg-shade: rgba(0, 0, 0, .3);
    --rg-fill: rgba(25, 33, 30, .76);
    --rg-fill-open: rgba(22, 29, 27, .86);
    --rg-hl: rgba(255, 255, 255, .2);
    --rg-rim: rgba(255, 255, 255, .1);
    --rg-glow: rgba(255, 255, 255, .07);
    --rg-shade: rgba(0, 0, 0, .3);
    --tile: rgba(255, 255, 255, .065);
    --tile-hl: rgba(255, 255, 255, .13);
    --tile-press: rgba(255, 255, 255, .13);
    --well: rgba(255, 255, 255, .045);
    --seg-track: rgba(255, 255, 255, .07);
    --seg-thumb: rgba(255, 255, 255, .17);
    --field: rgba(255, 255, 255, .08);
    --shadow-float: 0 1px 1px rgba(0, 0, 0, .3), 0 10px 26px -10px rgba(0, 0, 0, .75), 0 24px 48px -26px rgba(0, 0, 0, .8);
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, .045), 0 2px 4px rgba(0, 0, 0, .35), 0 18px 44px -18px rgba(0, 0, 0, .85);
    --shadow-sheet: 0 -1px 0 rgba(255, 255, 255, .04), 0 -14px 36px -14px rgba(0, 0, 0, .8);
    --scrim: rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --felt-hi: #183d30;
  --felt: #0f261e;
  --felt-lo: #06110d;
  --paper: #141a18;
  --ink: #edf2f0;
  --ink-2: #aab5b1;
  --ink-3: #8e9a95;
  --rule: rgba(255, 255, 255, .065);
  --rule-2: rgba(255, 255, 255, .12);
  --rule-3: rgba(255, 255, 255, .22);
  --p1: #76b5ff;
  --p2: #ff9566;
  --p1-bar: #5ea6ff;
  --p2-bar: #ff8352;
  --p1-tint: rgba(118, 181, 255, .1);
  --p2-tint: rgba(255, 149, 102, .1);
  --p1-tint-2: rgba(118, 181, 255, .19);
  --p2-tint-2: rgba(255, 149, 102, .19);
  --p1-band: rgba(118, 181, 255, .035);
  --p2-band: rgba(255, 149, 102, .035);
  --p1-line: rgba(118, 181, 255, .6);
  --p2-line: rgba(255, 149, 102, .6);
  --p1-on-glass: #9fcbff;
  --p2-on-glass: #ffb38f;
  --accent: #1f7a59;
  --accent-ink: #62d1a6;
  --accent-tint: rgba(98, 209, 166, .12);
  --danger: #ff6a61;
  --cg-fill: rgba(255, 255, 255, .06);
  --thumb-p1: rgba(120, 175, 255, .13);
  --thumb-p2: rgba(255, 150, 110, .13);
  --cg-hl: rgba(255, 255, 255, .3);
  --cg-rim: rgba(255, 255, 255, .09);
  --cg-glow: rgba(255, 255, 255, .1);
  --cg-shade: rgba(0, 0, 0, .3);
  --rg-fill: rgba(25, 33, 30, .76);
  --rg-fill-open: rgba(22, 29, 27, .86);
  --rg-hl: rgba(255, 255, 255, .2);
  --rg-rim: rgba(255, 255, 255, .1);
  --rg-glow: rgba(255, 255, 255, .07);
  --rg-shade: rgba(0, 0, 0, .3);
  --tile: rgba(255, 255, 255, .065);
  --tile-hl: rgba(255, 255, 255, .13);
  --tile-press: rgba(255, 255, 255, .13);
  --well: rgba(255, 255, 255, .045);
  --seg-track: rgba(255, 255, 255, .07);
  --seg-thumb: rgba(255, 255, 255, .17);
  --field: rgba(255, 255, 255, .08);
  --shadow-float: 0 1px 1px rgba(0, 0, 0, .3), 0 10px 26px -10px rgba(0, 0, 0, .75), 0 24px 48px -26px rgba(0, 0, 0, .8);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, .045), 0 2px 4px rgba(0, 0, 0, .35), 0 18px 44px -18px rgba(0, 0, 0, .85);
  --shadow-sheet: 0 -1px 0 rgba(255, 255, 255, .04), 0 -14px 36px -14px rgba(0, 0, 0, .8);
  --scrim: rgba(0, 0, 0, .45);
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  height: 100%;
  background: var(--felt-lo);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font: 400 15px/1.4 var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  /* Filz: feine Körnung, Lampenlicht von oben, Schatten zum Rand */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .7 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E"),
    radial-gradient(120% 55% at 50% -6%, var(--felt-hi) 0%, rgba(0, 0, 0, 0) 64%),
    radial-gradient(150% 85% at 50% 112%, var(--felt-lo) 0%, rgba(0, 0, 0, 0) 72%),
    var(--felt);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
button, [role="button"], [role="tab"], [role="menuitem"], .cell, .opt {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input { font: 500 16px/1.2 var(--font); }
p { margin: 0; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.topbar :focus-visible { outline-color: #fff; }

/* ---------- Glasmaterial ---------- */
.glass-clear, .glass-regular { position: relative; isolation: isolate; }
.glass-clear {
  background-color: var(--cg-fill);
  -webkit-backdrop-filter: blur(14px) saturate(175%);
  backdrop-filter: blur(14px) saturate(175%);
  box-shadow:
    inset 0 1px 0 var(--cg-hl),
    inset 0 -1px 0 rgba(255, 255, 255, .07),
    inset 0 0 0 1px var(--cg-rim),
    inset 0 12px 16px -14px var(--cg-glow),
    inset 0 -12px 18px -14px var(--cg-shade),
    var(--shadow-float);
}
.glass-regular {
  background-color: var(--rg-fill);
  -webkit-backdrop-filter: blur(26px) saturate(165%);
  backdrop-filter: blur(26px) saturate(165%);
  box-shadow:
    inset 0 1px 0 var(--rg-hl),
    inset 0 0 0 1px var(--rg-rim),
    inset 0 14px 20px -18px var(--rg-glow),
    inset 0 -14px 22px -18px var(--rg-shade),
    var(--shadow-float);
}
/* Spekulare Kante: Licht fällt von links oben ein, Gegenlicht unten rechts – wirkt wie eine gewölbte Linse */
.glass-clear::before, .glass-regular::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(152deg,
    rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, .28) 16%, rgba(255, 255, 255, 0) 38%,
    rgba(255, 255, 255, 0) 64%, rgba(255, 255, 255, .2) 84%, rgba(255, 255, 255, .55) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: var(--spec, .85);
}
.glass-regular::before { --spec: .7; }

/* Aufleuchten am Finger: Licht sammelt sich unter dem Berührungspunkt */
.press { --px: 50%; --py: 50%; }
.press::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at var(--px) var(--py), rgba(255, 255, 255, .55), rgba(255, 255, 255, .12) 45%, rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  transition: opacity .32s var(--ease-out);
}
.press:active::after, .press.is-pressed::after { opacity: 1; transition-duration: .06s; }

/* ---------- App-Hülle ---------- */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0 calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal));
}

/* ---------- Werkzeugleiste ---------- */
.topbar {
  position: relative;
  z-index: 6;
  flex: none;
  display: grid;
  grid-template-columns: var(--btn) minmax(0, 1fr) var(--btn);
  align-items: center;
  gap: 6px;
  padding-top: calc(var(--sat) + 8px);
}
.tb-side { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tb-right { justify-content: flex-end; }
.brand { display: none; }
.turn-sub { display: none; }

.gbtn {
  width: var(--btn);
  height: var(--btn);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: calc(var(--btn) / 2);
  color: var(--on-glass);
  cursor: pointer;
  transition: transform .26s var(--spring-soft), color .2s;
}
.gbtn svg { width: 21px; height: 21px; position: relative; z-index: 3; }
.gbtn .btn-label { display: none; position: relative; z-index: 3; font: 600 14px/1 var(--font); }
.gbtn:active { transform: scale(1.08); transition-duration: .12s; transition-timing-function: var(--ease-out); }
.gbtn:disabled { color: rgba(255, 255, 255, .4); cursor: default; }
.gbtn:disabled:active { transform: none; }
.gbtn:disabled::after { display: none; }

/* Statuskapsel: Stand, Siegchance, wer würfelt */
.scoreline {
  height: var(--bar-h);
  border-radius: calc(var(--bar-h) / 2);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  padding: 4px;
  color: var(--on-glass);
  min-width: 0;
}
.turn-thumb {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 40%;
  border-radius: calc(var(--bar-h) / 2 - 4px);
  background-color: rgba(255, 255, 255, .12);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 55%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    inset 0 0 0 1px rgba(255, 255, 255, .14),
    inset 0 -6px 10px -8px rgba(0, 0, 0, .25),
    0 2px 10px -3px rgba(0, 0, 0, .35);
  opacity: 0;
  transform-origin: 50% 50%;
  will-change: transform;
  transition: opacity .3s var(--ease-out), background-color .4s var(--ease-out);
}
.turn-thumb.is-on { opacity: 1; }
.turn-thumb[data-p="P1"] { background-color: var(--thumb-p1); }
.turn-thumb[data-p="P2"] { background-color: var(--thumb-p2); }

.player-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  padding: 0 8px 0 11px;
  border: 0;
  border-radius: calc(var(--bar-h) / 2 - 4px);
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.player-card[data-player="P2"] { flex-direction: row-reverse; text-align: right; padding: 0 11px 0 8px; }
.player-card .num {
  flex: none;
  min-width: .6em;
  font: 700 24px/1 var(--font-num);
  letter-spacing: -.02em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.player-card[data-player="P1"] .num { color: var(--p1-on-glass); }
.player-card[data-player="P2"] .num { color: var(--p2-on-glass); }
.pc-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; }
.player-card[data-player="P2"] .pc-text { align-items: flex-end; }
.pc-name {
  max-width: 100%;
  font: 600 13.5px/1.1 var(--font);
  color: var(--on-glass-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .25s;
}
.player-card.is-active .pc-name, .player-card.is-winner .pc-name { color: var(--on-glass); }
.pc-win {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 500 11.5px/1.1 var(--font);
  color: var(--on-glass-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pc-win b { font-weight: 600; color: var(--on-glass-2); transition: opacity .2s; }
.pc-win.is-stale-soft b { opacity: .6; }
.scoreline.is-final .pc-win > span[aria-hidden], .scoreline.is-final .pc-win > .visually-hidden { display: none; }
.player-card.is-active .pc-win b { color: var(--on-glass); }
.turn-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 34px;
  padding: 0 1px;
  pointer-events: none;
}
.turn-kicker { font: 500 10px/1.1 var(--font); color: var(--on-glass-3); white-space: nowrap; letter-spacing: .01em; }
.turn-kicker .tk-of { display: none; }
.turn-count { font: 650 16px/1 var(--font-num); color: var(--on-glass); white-space: nowrap; font-variant-numeric: tabular-nums; }
.turn-main { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Bühne und Spielblock ---------- */
.stage { position: relative; flex: 1; min-height: 0; padding-top: 8px; }
.pad {
  position: relative;
  background: var(--paper);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  padding: 6px 4px 2px;
}
.pad-head { display: none; }
.pad-hint { display: none; }
.pad-scroll { position: relative; }

.block {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.block col.c-lab { width: var(--lab-w); }
.block th, .block td { padding: 0; text-align: center; }
.block .row-label, .block .corner { text-align: left; }

/* Kopf: Spaltenwert und Spielerkürzel */
.block thead th { vertical-align: bottom; }
.col-head {
  height: 22px;
  font: 700 16px/1 var(--font-num);
  color: var(--ink);
  box-shadow: inset 1px 0 0 var(--rule-2);
}
.col-head .ch-label { display: none; }
.col-head.is-high .ch-points { position: relative; }
.corner { text-align: left; padding-left: 4px !important; }
.corner .corner-t { font: 600 9px/1 var(--font); color: var(--ink-3); letter-spacing: .01em; }
.sub-head {
  height: 17px;
  font: 700 9.5px/1 var(--font);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  color: var(--pc);
  opacity: .55;
  transition: opacity .25s;
  box-shadow: inset 0 -1px 0 var(--rule-2);
}
.sub-head.p1 { --pc: var(--p1); box-shadow: inset 1px 0 0 var(--rule-2), inset 0 -1px 0 var(--rule-2); }
.sub-head.p2 { --pc: var(--p2); }
.sub-head.is-turn { opacity: 1; }
.sub-head .sh-long { display: none; }
.thead-sub .corner { box-shadow: inset 0 -1px 0 var(--rule-2); }

/* Zeilen */
.row-label {
  height: var(--row-h);
  text-align: left;
  padding: 0 0 0 3px !important;
  font: 600 11px/1.1 var(--font);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  box-shadow: inset 0 -1px 0 var(--rule);
}
.rl-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-label .die { width: 21px; height: 21px; flex: none; }
.rl-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-label.is-face .rl-text { display: none; }
.rl-name { display: block; overflow: hidden; text-overflow: ellipsis; }
.rl-long { display: none; }
.rl-short { display: inline; }
.rl-hint { display: none; font: 500 10.5px/1.1 var(--font); color: var(--ink-3); }
tr.is-sep > th, tr.is-sep > td { border-top: 1.5px solid var(--rule-3); }

td.c { position: relative; height: var(--row-h); box-shadow: inset 0 -1px 0 var(--rule); }
td.c.p1 { box-shadow: inset 1px 0 0 var(--rule-2), inset 0 -1px 0 var(--rule); }
td.c.p2 { box-shadow: inset 1px 0 0 var(--rule), inset 0 -1px 0 var(--rule); }
tbody tr:last-child > * { box-shadow: none; }
tbody tr:last-child > td.c.p1 { box-shadow: inset 1px 0 0 var(--rule-2); }
tbody tr:last-child > td.c.p2 { box-shadow: inset 1px 0 0 var(--rule); }
/* Spalten des Spielers am Zug ganz leicht hinterlegt */

.cell {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--row-h);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--pc);
  font: 600 var(--cell-fs, 16px)/1 var(--font-num);
  letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
  cursor: default;
}
.cell.p1 { --pc: var(--p1); --pt: var(--p1-tint); --pt2: var(--p1-tint-2); --pl: var(--p1-line); }
.cell.p2 { --pc: var(--p2); --pt: var(--p2-tint); --pt2: var(--p2-tint-2); --pl: var(--p2-line); }
.cell:disabled { pointer-events: none; color: var(--pc); opacity: 1; }
.cell .v { position: relative; z-index: 1; display: block; }
/* Mulde: zeigt freie eigene Felder an */
.cell::before {
  content: "";
  position: absolute;
  inset: max(4px, calc((var(--row-h) - 32px) / 2)) 3px;
  border-radius: 9px;
  background: var(--pt);
  box-shadow: inset 0 0 0 1px transparent;
  opacity: 0;
  transform: scale(.86);
  pointer-events: none;
  /* Zugwechsel: die Mulden laufen als leichte Welle über die Spalten */
  transition:
    opacity .26s var(--ease-out) calc(var(--ci, 0) * 18ms),
    transform .34s var(--spring-soft) calc(var(--ci, 0) * 18ms),
    background-color .12s;
}
.cell.is-open { cursor: pointer; z-index: 1; }
.cell.is-open::before { opacity: 1; transform: none; }
.cell.is-open:active::before { background: var(--pt2); transform: scale(.92); transition-duration: .08s; transition-delay: 0s; }
.cell .v { pointer-events: none; }
.cell.is-target::before { opacity: 1; transform: none; background: var(--pt2); box-shadow: inset 0 0 0 1.5px var(--pl); }
.cell.is-last::before { opacity: 1; transform: none; left: 1px; right: 1px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--pl); }
.cell.is-zero .v { opacity: .42; }
.cell:focus-visible { outline: none; }
.cell:focus-visible::before { opacity: 1; transform: none; box-shadow: inset 0 0 0 2px var(--pc); }
.cell .hit { position: absolute; inset: 0; }
.cell.is-open .hit { inset: 0 -42%; }
.cell.just-set .v { animation: ink .62s var(--spring-pop) .12s both; }
@keyframes ink {
  from { transform: scale(.35); opacity: 0; }
  30% { opacity: 1; }
  to { transform: none; opacity: 1; }
}
.block.is-finished .cell::before { opacity: 0; }
.block.is-finished .cell.is-last::before { opacity: 1; }

/* Summen und Spaltenchance */
tfoot th, tfoot td { vertical-align: middle; }
.sum-row > * { height: 30px; border-top: 1.5px solid var(--rule-3); }
.sum-row .row-label, .lead-row .row-label { box-shadow: none; height: auto; font-size: 10.5px; }
td.sum {
  position: relative;
  isolation: isolate;
  color: var(--pc);
  font: 700 13.5px/1 var(--font-num);
  letter-spacing: -.015em;
}
td.sum.p1 { --pc: var(--p1); --pt2: var(--p1-tint-2); box-shadow: inset 1px 0 0 var(--rule-2); }
td.sum.p2 { --pc: var(--p2); --pt2: var(--p2-tint-2); box-shadow: inset 1px 0 0 var(--rule); }
td.sum::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 5px 2px;
  border-radius: 8px;
  background: var(--pt2);
  opacity: 0;
  transform: scale(.8);
  transition: opacity .3s var(--ease-out), transform .4s var(--spring-soft);
}
td.sum.is-ahead::before { opacity: 1; transform: none; }
/* dreistellige Summen (ab Spielmitte) bleiben getrennt lesbar */
td.sum.is-wide { font-size: 11.5px; letter-spacing: -.035em; font-variant-numeric: proportional-nums; }
td.sum.is-wide::before { inset: 6px 1px; }
td.sum.bump { animation: bump .6s var(--spring-pop); }
@keyframes bump { from { transform: scale(.82); } to { transform: none; } }

.lead-row .row-label .rl-hint { display: none; }
td.lead {
  height: 36px;
  padding: 3px 3px 5px;
  box-shadow: inset 1px 0 0 var(--rule-2);
  font: 600 9.5px/1 var(--font);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
}
.lead-now { display: none; }
.lead-bar {
  display: flex;
  gap: 1.5px;
  height: 4px;
  margin: 0 2px 5px;
  border-radius: 2px;
  overflow: hidden;
}
.lead-bar i { display: block; min-width: 0; flex: 1 1 0; transition: flex-grow .6s var(--ease-out); }
.lead-bar .b1, .split .b1, .win-bar .b1 { background: var(--p1-bar); }
.lead-bar .bd, .split .bd, .win-bar .bd { background: var(--rule-3); }
.lead-bar .b2, .split .b2, .win-bar .b2 { background: var(--p2-bar); }
.lead-p { display: block; font-variant-numeric: tabular-nums; transition: opacity .2s; }
.lead-p.p1 { color: var(--p1); }
.lead-p.p2 { color: var(--p2); }
.lp-long, .lw-long { display: none; }
.lead.is-calc .lead-p { opacity: .55; }
.lead.flip .lead-bar, .lead.flip .lead-p { animation: flip .45s var(--ease-out); }
@keyframes flip { from { opacity: .2; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.lead-box { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.lead.w-P1 { --pc: var(--p1); }
.lead.w-P2 { --pc: var(--p2); }
.lead.is-won .lead-who { color: var(--pc); font: 700 9.5px/1 var(--font); }
.lead.is-won .lead-what { color: var(--pc); font: 700 14px/1 var(--font-num); }
.lead.is-tie-final .lead-who { font: 600 9.5px/1 var(--font); color: var(--ink-3); }
.lead.is-tie-final .lead-what { font: 700 13px/1 var(--font-num); color: var(--ink-3); }
.lead.stamp-in .lead-box { animation: stampIn .6s var(--spring-pop) both; }
@keyframes stampIn { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }

/* Würfel */
.die { display: block; overflow: visible; }
.die-body { fill: #fff; stroke: rgba(15, 21, 19, .2); stroke-width: 1; }
.die-shade { fill: none; stroke: rgba(15, 21, 19, .05); stroke-width: 1.4; }
.die-t { fill: #1b1f1e; font-family: var(--font); font-weight: 700; }
.die.is-red .die-t { fill: #c3261c; }
:root[data-theme="dark"] .die-body { fill: #e9ecea; stroke: rgba(0, 0, 0, .4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .die-body { fill: #e9ecea; stroke: rgba(0, 0, 0, .4); } }
/* leerer Würfel bleibt in beiden Darstellungen nur Umriss */
svg.die.is-ghost .die-body { fill: none !important; stroke: var(--rule-3) !important; stroke-dasharray: 2.5 2.2; }

/* ---------- Statistik-Sheet (Telefon) ---------- */
.stats {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 0;
  top: var(--sheet-top, 62%);
  bottom: -200px;
  padding-bottom: 200px;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  transform: translate3d(0, var(--sheet-off, 0px), 0);
  will-change: transform;
  box-shadow:
    inset 0 1px 0 var(--rg-hl),
    inset 0 0 0 1px var(--rg-rim),
    inset 0 14px 20px -18px var(--rg-glow),
    var(--shadow-sheet);
  transition: background-color .4s var(--ease-out);
}
.stats.is-open { background-color: var(--rg-fill-open); }
.stats-grip {
  flex: none;
  position: relative;
  z-index: 3;
  padding: 0 12px 6px;
  touch-action: none;
  cursor: grab;
}
.stats.is-dragging .stats-grip { cursor: grabbing; }
.sheet-toggle {
  display: block;
  position: relative;
  width: 100%;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: inherit;
}
.grabber {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 38px;
  height: 5px;
  margin-left: -19px;
  border-radius: 3px;
  background: var(--rule-3);
  transition: background-color .2s, transform .3s var(--spring-soft);
}
.sheet-toggle:active .grabber { background: var(--ink-3); transform: scaleX(1.12); }

.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: 36px;
  padding: 3px;
  border-radius: 18px;
  background: var(--seg-track);
}
.tab-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 20%;
  border-radius: 15px;
  background: var(--seg-thumb);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    inset 0 0 0 .5px rgba(0, 0, 0, .04),
    0 1px 1px rgba(0, 0, 0, .05),
    0 4px 10px -3px rgba(0, 20, 12, .22);
  transform-origin: 50% 50%;
  will-change: transform;
}
.tab {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 15px;
  background: none;
  font: 600 13px/1 var(--font);
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s;
}
.tab[aria-selected="true"] { color: var(--ink); }
.tab:active { color: var(--ink); }

.stats-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 10px 16px calc(var(--sab) + 28px);
  overscroll-behavior: contain;
  touch-action: none;
}
.stats.is-open .stats-body { overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.calc-state {
  position: absolute;
  top: 2px;
  right: 18px;
  font: 500 11px/1 var(--font);
  color: var(--ink-3);
}
.panel { display: none; }
.panel.is-active { display: block; }
.panel.is-stale { opacity: .6; transition: opacity .2s; }
.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 2px 8px;
  font: 700 17px/1.2 var(--font);
  letter-spacing: -.01em;
}
.panel-title small { font: 500 12px/1.2 var(--font); color: var(--ink-3); text-align: right; letter-spacing: 0; }
.panel-title-2 { margin-top: 22px; }
.panel-title h3 { margin: 0; font: inherit; }
.card-in {
  background: var(--well);
  border-radius: 20px;
  padding: 12px 14px;
}

/* Lage */
.fc-summary { display: grid; gap: 4px; padding: 2px 2px 0; }
.win-names, .win-figs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
}
.win-names { font: 600 12.5px/1.2 var(--font); color: var(--ink-2); }
.win-names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-names span:nth-child(2) { text-align: center; color: var(--ink-3); font-weight: 500; }
.win-names span:last-child, .win-figs .p2 { text-align: right; }
.win-figs .big { font: 700 34px/1.02 var(--font-num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.win-figs .big .pc { font-size: .5em; margin-left: 2px; letter-spacing: 0; vertical-align: .55em; font-weight: 600; }
.win-figs .p1 { color: var(--p1); }
.win-figs .p2 { color: var(--p2); }
.win-figs .mid { font: 500 12.5px/1 var(--font); color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.win-bar { display: flex; gap: 2px; height: 8px; margin-top: 6px; border-radius: 4px; overflow: hidden; }
.win-bar span { display: block; min-width: 0; flex: 1 1 0; transition: flex-grow .7s var(--ease-out); }
.win-deltas { display: grid; grid-template-columns: 1fr 1fr; min-height: 16px; font: 600 11.5px/1.3 var(--font); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.win-deltas span:last-child { text-align: right; }
.delta { opacity: 0; transform: translateY(3px); transition: opacity .4s var(--ease-out), transform .5s var(--ease-out); }
.delta.fade { opacity: 1; transform: none; }
.fc-chart { margin: 14px 0 0; padding: 12px 12px 6px; background: var(--well); border-radius: 20px; }
.fc-chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px; margin: 0 2px 6px; }
.fig-title { font: 650 13.5px/1.2 var(--font); }
.fig-readout { font: 500 11.5px/1.3 var(--font); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart-box { position: relative; touch-action: pan-y; cursor: crosshair; border-radius: 10px; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box .grid { stroke: var(--rule); stroke-width: 1; }
.chart-box .mid-line { stroke: var(--rule-3); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-box .axis-t { fill: var(--ink-3); font: 500 10px var(--font); font-variant-numeric: tabular-nums; }
.chart-box .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .l1 { stroke: var(--p1-bar); }
.chart-box .l2 { stroke: var(--p2-bar); }
.chart-box .guide { stroke: var(--ink-3); stroke-width: 1; }
.chart-box .dot1 { fill: var(--p1-bar); stroke: var(--paper); stroke-width: 2; }
.chart-box .dot2 { fill: var(--p2-bar); stroke: var(--paper); stroke-width: 2; }
.chart-empty { padding: 26px 0; text-align: center; font-size: 13px; color: var(--ink-3); }
.fc-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 12px 0 0; border-radius: 20px; overflow: hidden; }
.fc-facts div { background: var(--well); padding: 10px 14px; }
.fc-facts dt { font: 500 11.5px/1.2 var(--font); color: var(--ink-2); }
.fc-facts dd { margin: 4px 0 0; font: 650 17px/1.1 var(--font-num); font-variant-numeric: tabular-nums; }
.fc-facts dd small { font: 500 11.5px var(--font); color: var(--ink-3); }
.last-move { margin: 12px 4px 0; font: 500 12.5px/1.4 var(--font); color: var(--ink-2); }

/* Tabellen in der Statistik */
.stat { width: 100%; border-collapse: collapse; table-layout: fixed; font: 500 13px/1.25 var(--font); font-variant-numeric: tabular-nums; }
.stat th, .stat td { padding: 9px 3px; text-align: right; vertical-align: top; border-bottom: 1px solid var(--rule); }
.stat thead th { padding: 2px 3px 7px; vertical-align: bottom; font: 600 11px/1.2 var(--font); color: var(--ink-2); border-bottom-color: var(--rule-2); }
.stat th[scope="row"] { text-align: left; font-weight: 600; }
.stat tr:last-child > * { border-bottom: 0; }
.stat .sub { display: block; margin-top: 3px; font: 500 11px/1.2 var(--font); color: var(--ink-3); }
.stat .p1 { color: var(--p1); }
.stat .p2 { color: var(--p2); }
.stat .muted, .muted { color: var(--ink-3); }
.stat .pos { color: var(--accent-ink); }
.stat .neg { color: var(--danger); }
.stat .strong { font-weight: 700; }
.stat tr.sep > * { border-top: 1.5px solid var(--rule-2); }
.stat .die { display: inline-block; width: 17px; height: 17px; vertical-align: -4px; margin-right: 6px; }
.lab-long { display: none; }
.lab-short { display: inline; }
.col-tbl col.c-sp { width: 20%; }
.col-tbl col.c-now { width: 21%; }
.col-tbl col.c-exp { width: 22%; }
.col-tbl td:last-child, .col-tbl th:last-child { padding-left: 14px; }
.col-tbl .sp-n { display: inline-block; min-width: 14px; font: 700 16px/1 var(--font-num); margin-right: 5px; }
.col-tbl .sp-w { color: var(--ink-2); font-weight: 500; }
.col-tbl tr.is-final { opacity: .62; }
.split-n { display: flex; justify-content: space-between; gap: 4px; font-weight: 600; }
.split-n .t { color: var(--ink-3); font-weight: 500; }
.split { display: flex; gap: 1.5px; height: 5px; margin-top: 6px; border-radius: 3px; overflow: hidden; }
.split i { display: block; min-width: 0; flex: 1 1 0; }
.odds-tbl col.c-row, .need-tbl col.c-row { width: 27%; }
.p-cell .pbar { display: block; height: 3px; margin-top: 5px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.p-cell .pbar i { display: block; height: 100%; background: var(--ink-3); border-radius: inherit; }
.need-tbl tr.is-done { opacity: .5; }
.seg {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  padding: 2px;
  border-radius: 12px;
  background: var(--seg-track);
  max-width: 62%;
}
.seg-b {
  min-width: 0;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  font: 600 12.5px/1 var(--font);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.seg-b[aria-checked="true"] { background: var(--seg-thumb); box-shadow: 0 1px 1px rgba(0, 0, 0, .05), 0 3px 8px -3px rgba(0, 20, 12, .25); }
.seg-b.p1[aria-checked="true"] { color: var(--p1); }
.seg-b.p2[aria-checked="true"] { color: var(--p2); }
.cmp-tbl col.c-k { width: 40%; }
.cmp-tbl thead th { font: 650 13px/1.2 var(--font); }
.cmp-tbl thead .p1 { color: var(--p1); }
.cmp-tbl thead .p2 { color: var(--p2); }
.cmp-tbl td { font: 600 14px/1.2 var(--font-num); }
.cmp-tbl td small { font: 500 11px var(--font); color: var(--ink-3); }
.cmp-tbl tr.is-key td { font: 700 22px/1 var(--font-num); letter-spacing: -.02em; }
.cmp-tbl tr.is-key .pc { font-size: .55em; margin-left: 1px; }
.cmp-tbl th[scope="row"] { font: 500 13px/1.25 var(--font); color: var(--ink-2); }
.hard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hard-grid > div { background: var(--well); border-radius: 18px; padding: 10px 12px 6px; min-width: 0; }
.hard-grid h4 { margin: 0 0 4px; font: 650 13px/1.2 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hard-grid h4.p1 { color: var(--p1); }
.hard-grid h4.p2 { color: var(--p2); }
.hard-list { list-style: none; margin: 0; padding: 0; }
.hard-list li { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 12.5px; }
.hard-list li:last-child { border-bottom: 0; }
.hl-name { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 600; }
.hl-name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-name .die { width: 17px; height: 17px; flex: none; }
.hl-col { display: block; font: 500 10.5px/1.2 var(--font); color: var(--ink-3); }
.hl-p { text-align: right; font: 650 13px/1.1 var(--font-num); white-space: nowrap; }
.hl-p small { display: block; font: 500 10.5px var(--font); color: var(--ink-3); }
.empty-note { font-size: 12.5px; color: var(--ink-3); padding: 6px 0 8px; }
.model-note { display: grid; gap: 10px; font-size: 14px; line-height: 1.5; }
.model-note p { margin: 0; }
.model-note p:first-child { font-weight: 500; }
.model-extra { color: var(--ink-2); font-size: 13px; }

/* ---------- Menü ---------- */
.menu-catcher { position: fixed; inset: 0; z-index: 29; }
.menu-catcher[hidden], .menu[hidden] { display: none; }
.menu {
  position: fixed;
  z-index: 30;
  min-width: 236px;
  padding: 6px;
  border-radius: 24px;
  color: var(--ink);
  transform-origin: var(--ox, 0) var(--oy, 0);
  will-change: transform, opacity;
}
.mi {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 18px;
  background: none;
  font: 500 16px/1 var(--font);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background-color .15s;
}
.mi svg { width: 21px; height: 21px; flex: none; color: var(--ink-2); }
.mi:active, .mi:focus-visible { background: var(--seg-track); outline: none; }
.mi-val { margin-left: auto; font-size: 14.5px; color: var(--ink-2); }
.mi-sep { height: 1px; margin: 5px 12px; background: var(--rule-2); }
@media (hover: hover) and (pointer: fine) {
  .mi:hover { background: var(--seg-track); }
  .gbtn:not(:disabled):hover::after { opacity: .45; }
  .tab:hover { color: var(--ink); }
  .opt:hover { background-color: var(--tile-press); }
  .btn:hover { filter: brightness(1.04); }
  .cell.is-open:hover::before { background: var(--pt2); }
  .player-card:hover .pc-name { color: var(--on-glass); }
}

/* ---------- Dialoge ---------- */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(3, 18, 11, .28); }
:root[data-theme="dark"] dialog::backdrop { background: rgba(0, 0, 0, .45); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) dialog::backdrop { background: rgba(0, 0, 0, .45); } }
dialog[open]::backdrop { animation: fadeIn .22s var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

/* Eingabeschale */
.entry {
  position: fixed;
  inset: auto calc(var(--gutter) + var(--sar)) calc(var(--gutter) + var(--sab)) calc(var(--gutter) + var(--sal));
  width: auto;
  max-width: none;
  max-height: calc(100% - var(--sat) - var(--sab) - 70px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.entry.p1, .entry[data-p="P1"] { --pc: var(--p1); --pt: var(--p1-tint); --pt2: var(--p1-tint-2); --pbar: var(--p1-bar); }
.entry[data-p="P2"] { --pc: var(--p2); --pt: var(--p2-tint); --pt2: var(--p2-tint-2); --pbar: var(--p2-bar); }
.entry-inner {
  max-height: inherit;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px 12px;
  border-radius: var(--r-tray);
  background-color: var(--rg-fill-open);
  transform-origin: 0 0;
  will-change: transform;
}
.entry-content { position: relative; z-index: 3; }
.entry-grab { display: block; width: 36px; height: 5px; margin: 0 auto 4px; border-radius: 3px; background: var(--rule-3); }
.entry-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 2px 4px 10px;
  touch-action: none;
}
.entry-kicker { margin: 0 0 3px; font: 600 12.5px/1.2 var(--font); color: var(--ink-2); }
.entry-kicker .who { color: var(--pc); }
#entry-title { margin: 0; font: 700 22px/1.15 var(--font); letter-spacing: -.02em; }
#entry-title .col { display: inline-block; margin-left: 8px; font: 500 13.5px/1.2 var(--font); letter-spacing: 0; color: var(--ink-2); white-space: nowrap; }
.entry-close {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 17px;
  background: var(--tile);
  color: var(--ink-2);
  box-shadow: inset 0 1px 0 var(--tile-hl), 0 1px 2px rgba(0, 0, 0, .06);
  cursor: pointer;
  transition: transform .2s var(--ease-out);
}
.entry-close svg { width: 14px; height: 14px; position: relative; z-index: 2; }
.entry-close:active { transform: scale(.92); }
.ladder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  padding: 10px 14px 11px;
  border-radius: 22px;
  background: var(--well);
}
.st { display: grid; gap: 4px; min-width: 0; }
.st-l { font: 500 11px/1.1 var(--font); color: var(--ink-2); white-space: nowrap; }
.st-v { font: 650 15px/1 var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-bar { display: block; height: 3px; border-radius: 2px; background: var(--rule-2); overflow: hidden; }
.st-bar i { display: block; height: 100%; border-radius: inherit; background: var(--pbar); }
.st-exp { padding-left: 12px; box-shadow: inset 1px 0 0 var(--rule-2); }
.ctx-col { margin: 10px 6px 12px; font: 500 12.5px/1.45 var(--font); color: var(--ink-2); }
.ctx-col b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.entry-options { display: grid; gap: 8px; }
.opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 11px 4px 10px;
  border: 0;
  border-radius: 24px;
  background-color: var(--tile);
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--tile-hl), 0 1px 2px rgba(0, 0, 0, .05), 0 8px 18px -12px rgba(0, 20, 12, .35);
  cursor: pointer;
  transition: transform .18s var(--ease-out), background-color .18s;
}
.opt:active { transform: scale(.96); background-color: var(--tile-press); transition-duration: .08s; }
.opt > * { position: relative; z-index: 2; }
.opt .dice { display: flex; justify-content: center; gap: 2px; height: 16px; }
.opt .dice .die { width: 15px; height: 15px; transform: rotate(var(--r, 0deg)); }
.o-main { margin-top: 3px; font: 700 27px/1 var(--font-num); letter-spacing: -.03em; color: var(--pc); font-variant-numeric: tabular-nums; }
.o-sub { font: 500 11.5px/1.2 var(--font); color: var(--ink-2); white-space: nowrap; }
.o-win { margin-top: 2px; font: 500 11.5px/1.2 var(--font); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; transition: opacity .25s; }
.o-win b { color: var(--ink); font-weight: 650; }
.o-win .up { color: var(--accent-ink); font-weight: 600; }
.o-win .down { color: var(--ink-3); font-weight: 600; }
.o-win.is-wait { opacity: .45; }
.opt.is-zero .o-main { color: var(--ink-3); }
.opt.is-served { background-color: color-mix(in srgb, var(--tile) 82%, var(--accent) 18%); }
@supports not (background-color: color-mix(in srgb, red 50%, blue)) { .opt.is-served { background-color: var(--accent-tint); } }
.opt.is-served .o-sub { color: var(--accent-ink); font-weight: 650; }
.o-key { display: none; position: absolute; top: 9px; right: 12px; font: 600 10px/1 var(--font); color: var(--ink-3); }
.entry-odds { margin: 10px 0 2px; text-align: center; font: 500 11.5px/1.3 var(--font); color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) { .o-key { display: block; } }

/* Fliegende Glasform beim Schließen (blockiert keine Eingabe) */
.ghost {
  position: fixed;
  z-index: 38;
  pointer-events: none;
  border-radius: var(--r-tray);
  transform-origin: 0 0;
  will-change: transform, opacity;
}
.ghost-scrim { position: fixed; inset: 0; z-index: 37; pointer-events: none; background: var(--scrim); animation: fadeOut .24s var(--ease-out) forwards; }

/* Alerts: Namen, Neues Spiel */
.alert, .finale {
  width: min(330px, calc(100% - 40px));
  max-width: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 32px;
  background: transparent;
  overflow: visible;
}
.alert[open], .finale[open] { animation: alertIn .42s var(--spring-soft); }
@keyframes alertIn { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: none; } }
.alert-inner, .finale-inner {
  border-radius: inherit;
  padding: 22px 18px 16px;
  text-align: center;
  background-color: var(--rg-fill-open);
}
.alert-inner > *, .finale-inner > * { position: relative; z-index: 3; }
.alert h2 { margin: 0 0 6px; font: 650 17.5px/1.25 var(--font); letter-spacing: -.01em; }
.alert p { font: 400 14px/1.4 var(--font); color: var(--ink-2); }
.alert-foot, .finale-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.btn {
  position: relative;
  height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 24px;
  background-color: var(--tile);
  color: var(--ink);
  font: 600 16px/1 var(--font);
  box-shadow: inset 0 1px 0 var(--tile-hl), 0 1px 2px rgba(0, 0, 0, .06);
  cursor: pointer;
  transition: transform .18s var(--ease-out);
}
.btn:active { transform: scale(.96); }
.btn > span { position: relative; z-index: 2; }
.btn-danger { color: var(--danger); }
.btn-primary {
  background-color: var(--accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -8px 14px -10px rgba(0, 0, 0, .35), 0 8px 18px -10px rgba(10, 60, 40, .7);
}
.names-alert { margin: calc(var(--sat) + 72px) auto auto; }
.name-field { display: grid; gap: 5px; margin-top: 14px; text-align: left; }
.name-field label { padding-left: 4px; font: 650 12.5px/1.2 var(--font); }
.name-field[data-p="P1"] { --pc: var(--p1); }
.name-field[data-p="P2"] { --pc: var(--p2); }
.name-field label { color: var(--pc); }
.name-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  background: var(--field);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--rule-2);
  font: 500 16px/1.2 var(--font);
  transition: box-shadow .2s;
}
.name-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--pc); }
.alert .alert-foot.single { grid-template-columns: 1fr; }

/* Spielende */
.finale { width: min(370px, calc(100% - 28px)); }
.finale-kicker { font: 600 12.5px/1.2 var(--font); color: var(--ink-2); letter-spacing: .02em; }
#finale-title { margin: 4px 0 0; font: 700 26px/1.15 var(--font); letter-spacing: -.02em; }
#finale-title.p1 { color: var(--p1); }
#finale-title.p2 { color: var(--p2); }
.finale-score { display: flex; justify-content: center; align-items: baseline; gap: 12px; margin: 6px 0 12px; font: 700 58px/1 var(--font-num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.finale-score .p1 { color: var(--p1); }
.finale-score .p2 { color: var(--p2); }
.finale-score .sep { color: var(--ink-3); font-weight: 500; }
.finale-cols { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.finale-cols li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 9px 2px 8px;
  border-radius: 16px;
  background: var(--well);
  animation: stampIn .55s var(--spring-pop) both;
  animation-delay: calc(var(--i) * 60ms + 120ms);
}
.finale-cols li.w-P1 { --pc: var(--p1); background: var(--p1-tint-2); }
.finale-cols li.w-P2 { --pc: var(--p2); background: var(--p2-tint-2); }
.finale-cols b { font: 700 18px/1 var(--font-num); color: var(--pc, var(--ink-3)); }
.finale-cols span { max-width: 100%; font: 600 10px/1.1 var(--font); color: var(--pc, var(--ink-3)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finale-note { margin-top: 12px; font: 500 12.5px/1.4 var(--font); color: var(--ink-2); }

/* ---------- Momente ---------- */
.moment-layer { position: fixed; inset: 0; z-index: 36; pointer-events: none; }
.stamp {
  position: absolute;
  padding: 10px 18px 11px;
  border-radius: 22px;
  color: var(--pc);
  font: 700 17px/1.15 var(--font);
  letter-spacing: -.01em;
  text-align: center;
  white-space: nowrap;
  background-color: var(--rg-fill-open);
  transform: translate(-50%, -50%);
  animation: stampPop .7s var(--spring-pop) both, fadeOut .35s 1.45s var(--ease-out) forwards;
}
.stamp > * { position: relative; z-index: 3; }
.stamp small { display: block; margin-top: 2px; font: 500 12px/1.2 var(--font); color: var(--ink-2); letter-spacing: 0; }
@keyframes stampPop { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 30% { opacity: 1; } to { opacity: 1; transform: translate(-50%, -50%); } }
.grande-moment {
  position: absolute;
  left: 50%;
  top: 44%;
  padding: 22px 30px 20px;
  border-radius: 34px;
  text-align: center;
  pointer-events: none;
  background-color: var(--rg-fill-open);
  transform: translate(-50%, -50%);
  animation: stampPop .75s var(--spring-pop) both, fadeOut .4s 2.9s var(--ease-out) forwards;
}
.grande-moment > * { position: relative; z-index: 3; }
.gm-dice { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; }
.gm-dice .die { width: 38px; height: 38px; animation: tumble .8s var(--spring-pop) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes tumble { from { opacity: 0; transform: translateY(-26px) rotate(-90deg) scale(.6); } to { opacity: 1; transform: rotate(var(--r, 0deg)); } }
.grande-moment h3 { margin: 0; font: 800 30px/1 var(--font); letter-spacing: -.03em; }
.grande-moment p { margin-top: 6px; font: 600 14px/1.35 var(--font); color: var(--ink-2); }
.grande-moment small { display: block; font-weight: 500; color: var(--ink-3); }

.fatal { padding: 24px; margin: 16px 0; background: var(--paper); border-radius: 24px; }
.fatal h2 { margin: 0 0 8px; }

/* ---------- Kleine Telefone ---------- */
@media (max-width: 379px) {
  :root { --gutter: 6px; --btn: 40px; --bar-h: 48px; --lab-w: 42px; }
  .row-label { font-size: 10.5px; }
  .sum-row .row-label, .lead-row .row-label { font-size: 10px; }
  .player-card { gap: 6px; padding: 0 7px 0 10px; }
  .player-card[data-player="P2"] { padding: 0 10px 0 7px; }
  .player-card .num { font-size: 22px; }
  .pc-name { font-size: 13px; }
  .pc-win { font-size: 11px; }
  .turn-info { min-width: 32px; }
  .tab { font-size: 12.5px; }
  .opt { padding: 9px 3px 9px; }
  .o-main { font-size: 25px; }
}
@media (min-width: 410px) and (max-width: 899px) {
  :root { --lab-w: 48px; }
  .col-head { font-size: 17px; }
}

/* ---------- Tablet hochkant: mehr Platz im Block ---------- */
@media (min-width: 600px) and (max-width: 899px) {
  :root { --gutter: 14px; --lab-w: 92px; }
  .row-label.is-face .rl-text { display: flex; }
  .rl-long { display: inline; }
  .rl-short { display: none; }
  .sub-head .sh-long { display: inline; }
  .sub-head .sh-short { display: none; }
  .lp-long, .lw-long { display: inline; }
  .lp-short, .lw-short { display: none; }
  .stats { left: 50%; right: auto; width: min(680px, 100%); margin-left: max(-340px, -50%); }
  .scoreline { max-width: 620px; justify-self: center; width: 100%; }
  .pad { max-width: 760px; margin: 0 auto; }
}

/* ---------- Breit: Block links, Statistik als Glasspalte rechts ---------- */
@media (min-width: 900px) {
  :root { --gutter: 20px; --bar-h: 58px; --btn: 46px; --lab-w: 116px; }
  .topbar { grid-template-columns: minmax(180px, 1fr) minmax(0, 660px) minmax(180px, 1fr); gap: 16px; padding-top: calc(var(--sat) + 16px); }
  .brand { display: block; font: 700 21px/1 var(--font); letter-spacing: -.02em; color: var(--on-glass); }
  .brand small { display: block; margin-top: 4px; font: 500 12px/1 var(--font); letter-spacing: 0; color: var(--on-glass-3); }
  .gbtn.has-label { width: auto; padding: 0 18px 0 14px; }
  .gbtn .btn-label { display: inline; }
  .gbtn.has-label:active { transform: scale(1.04); }
  .player-card { padding: 0 16px 0 20px; gap: 12px; }
  .player-card[data-player="P2"] { padding: 0 20px 0 16px; }
  .player-card .num { font-size: 30px; }
  .pc-name { font-size: 15px; }
  .pc-win { font-size: 12.5px; }
  .turn-info { min-width: 180px; }
  .turn-kicker { font-size: 13px; }
  .turn-kicker .tk-of { display: inline; }
  .turn-count { display: none; }
  .turn-sub { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 11.5px/1.2 var(--font); color: var(--on-glass-3); text-align: center; }
  .stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(360px, 31vw, 460px);
    gap: 20px;
    align-items: start;
    padding: 16px 0 calc(var(--sab) + 20px);
  }
  .pad { padding: 10px 14px 6px; border-radius: 28px; }
  .pad-head { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 4px 10px; font: 650 15px/1.2 var(--font); }
  .pad-head small { font: 500 12.5px/1.2 var(--font); color: var(--ink-3); }
  .pad-hint { display: block; margin: 10px 4px 4px; font: 500 12px/1.4 var(--font); color: var(--ink-3); }
  .col-head { height: 34px; font-size: 22px; }
  .col-head .ch-label { display: block; margin-top: 3px; font: 600 10px/1 var(--font); color: var(--ink-3); }
  .corner .corner-t { font-size: 11px; }
  .sub-head { height: 22px; font-size: 11.5px; letter-spacing: 0; }
  .sub-head .sh-long { display: inline; }
  .sub-head .sh-short { display: none; }
  .row-label { font-size: 14px; padding-left: 6px !important; }
  .row-label .die { width: 22px; height: 22px; }
  .row-label.is-face .rl-text { display: flex; }
  .rl-long { display: inline; }
  .rl-short { display: none; }
  .rl-hint { display: block; }
  .block.is-compact .rl-hint { display: none; }
  .sum-row > * { height: 40px; }
  td.sum, td.sum.is-wide { font-size: 18px; letter-spacing: -.015em; }
  td.sum::before { inset: 6px 5px; border-radius: 10px; }
  td.lead { height: 50px; padding: 5px 6px 6px; font-size: 11px; }
  .lead-now { display: block; margin-bottom: 5px; font: 600 11px/1 var(--font); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
  .lead.w-P1 .lead-now { color: var(--p1); }
  .lead.w-P2 .lead-now { color: var(--p2); }
  .lead-bar { height: 5px; }
  .lp-long, .lw-long { display: inline; }
  .lp-short, .lw-short { display: none; }
  .lead.is-won .lead-who { font-size: 11.5px; }
  .lead.is-won .lead-what { font-size: 18px; }
  .cell::before { inset: max(6px, calc((var(--row-h) - 34px) / 2)) max(6px, 14%); border-radius: 10px; }
  .stats {
    position: relative;
    inset: auto;
    width: auto;
    margin: 0;
    height: 100%;
    max-height: 100%;
    padding-bottom: 0;
    border-radius: 30px;
    transform: none !important;
    will-change: auto;
    background-color: var(--rg-fill);
    -webkit-backdrop-filter: blur(26px) saturate(165%);
    backdrop-filter: blur(26px) saturate(165%);
    box-shadow:
      inset 0 1px 0 var(--rg-hl),
      inset 0 0 0 1px var(--rg-rim),
      inset 0 14px 20px -18px var(--rg-glow),
      var(--shadow-float);
  }
  .stats-grip { padding: 14px 14px 6px; touch-action: auto; cursor: default; }
  .sheet-toggle { display: none; }
  .stats-body { overflow-y: auto; touch-action: auto; padding: 12px 18px 22px; }
  .lab-long { display: inline; }
  .lab-short { display: none; }
  .entry.is-anchored { inset: auto; width: 412px; max-height: calc(100% - 24px); }
  .entry.is-anchored .entry-grab { display: none; }
  .entry.is-anchored .entry-inner { border-radius: 30px; padding-top: 14px; }
  .entry.is-anchored .entry-head { touch-action: auto; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  :root { --lab-w: 96px; }
  .rl-hint { display: none !important; }
}

/* ---------- Barrierefreiheit ---------- */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --cg-fill: #24503f;
    --rg-fill: #eef3f0;
    --rg-fill-open: #f6f8f7;
    --tile: #fff;
    --well: rgba(15, 50, 36, .05);
  }
  :root[data-theme="dark"] { --cg-fill: #1e2d27; --rg-fill: #1b2321; --rg-fill-open: #1b2321; --tile: #26302d; --well: rgba(255, 255, 255, .05); }
  .glass-clear, .glass-regular, .stats, .ghost { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (prefers-reduced-transparency: reduce) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --cg-fill: #1e2d27; --rg-fill: #1b2321; --rg-fill-open: #1b2321; --tile: #26302d; --well: rgba(255, 255, 255, .05); }
}
@media (prefers-contrast: more) {
  :root { --rule: rgba(15, 21, 19, .2); --rule-2: rgba(15, 21, 19, .34); --ink-2: #29322f; --ink-3: #3d4744; --cg-fill: rgba(5, 22, 15, .55); --rg-fill: rgba(250, 252, 251, .96); --rg-fill-open: #fff; }
  .glass-clear, .glass-regular { outline: 1px solid rgba(255, 255, 255, .5); outline-offset: -1px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; scroll-behavior: auto !important; }
  .cell::before, td.sum::before, .lead-bar i, .win-bar span, .grabber, .delta { transition-duration: .01ms !important; }
  .gbtn:active, .opt:active, .btn:active, .entry-close:active { transform: none; }
  .stamp, .grande-moment { animation: fadeOut .3s 1.6s forwards !important; }
}
