/* Zack – Gestaltung.
   Leitidee: Der ganze Tisch nimmt die Farbe an, die gerade gilt. Alles andere bleibt ruhig:
   Schrift Jost, dunkle Umrisse, harte Schattenkante, keine Leuchteffekte. Hell und Dunkel umschaltbar. */

@font-face { font-family: Jost; font-weight: 500; font-display: swap; src: url(../assets/fonts/jost-500.woff2) format('woff2'); }
@font-face { font-family: Jost; font-weight: 600; font-display: swap; src: url(../assets/fonts/jost-600.woff2) format('woff2'); }
@font-face { font-family: Jost; font-weight: 700; font-display: swap; src: url(../assets/fonts/jost-700.woff2) format('woff2'); }
@font-face { font-family: Jost; font-weight: 800; font-display: swap; src: url(../assets/fonts/jost-800.woff2) format('woff2'); }

:root {
  --jost: Jost, 'Century Gothic', system-ui, sans-serif;
  --ink: #171a2b;
  --rot: #dc4a3e; --rot-d: #c53a30;
  --gelb: #efae1f; --gelb-d: #dc9a10;
  --gruen: #2ea36b; --gruen-d: #218c59;
  --blau: #2e72c8; --blau-d: #2260b0;
  --zack: #f6c42c;
  --weich: cubic-bezier(.2, .8, .2, 1);
  --feder: cubic-bezier(.3, 1.5, .5, 1);
  /* Oberfläche hell */
  --flaeche: #fdfcf9; --text: #171a2b; --text2: #5a5e73; --rand: #171a2b; --feld: #efede6; --linie: #e3e0d7; --knopf: #ffffff; --an: #171a2b; --an-text: #ffffff;
  color-scheme: light;
}
html[data-thema='dunkel'] {
  --flaeche: #23222a; --text: #f4f1ea; --text2: #b3aea6; --rand: #0a0b12; --feld: #32313b; --linie: #3b3a45; --knopf: #3a3944; --an: #f4f1ea; --an-text: #171a2b;
  color-scheme: dark;
}

/* Tischfarben: je Spielfarbe ein matter Verlauf */
.t-rot { --t1: #b8433a; --t2: #8f2c25; --t3: #5e1a15; }
.t-gelb { --t1: #c2931f; --t2: #946d11; --t3: #5f4509; }
.t-gruen { --t1: #2a8c63; --t2: #1a6546; --t3: #0f4330; }
.t-blau { --t1: #2f68ad; --t2: #1e4a82; --t3: #122f57; }
html[data-thema='dunkel'] .t-rot { --t1: #5d2722; --t2: #3b1714; --t3: #200c0a; }
html[data-thema='dunkel'] .t-gelb { --t1: #5e4811; --t2: #3c2d09; --t3: #201805; }
html[data-thema='dunkel'] .t-gruen { --t1: #174c37; --t2: #0e3123; --t3: #071b13; }
html[data-thema='dunkel'] .t-blau { --t1: #1b3c69; --t2: #112746; --t3: #091628; }

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; background: #122f57; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body { font-family: var(--jost); font-size: 16px; font-weight: 500; line-height: 1.4; color: #fff; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
button:disabled { cursor: default; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.blatt :focus-visible, .tafel :focus-visible { outline-color: var(--text); }
[hidden] { display: none !important; }

/* Hintergrund als feste Ebene (ein „fixed“-Hintergrund ruckelt am iPhone) */
.grund { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--t3, #122f57); }
.grund > i { position: absolute; inset: 0; background: radial-gradient(ellipse 120% 85% at 50% 38%, var(--t1), var(--t2) 58%, var(--t3)); }

/* ================= Karten ================= */
.karte { font-size: calc(var(--kb, 80px) / 10); width: 10em; height: 14.6em; flex: none; display: block; position: relative; margin: 0; padding: .5em;
  background: #fdfcf9; border: .22em solid var(--ink); border-radius: 1.15em; box-shadow: 0 .3em 0 rgba(10, 12, 24, .4);
  font-family: var(--jost); color: #fff; line-height: 1; text-align: center; user-select: none; -webkit-user-select: none; }
.k-feld { display: block; position: relative; width: 100%; height: 100%; border-radius: .7em; background: var(--kf); overflow: hidden; }
.f-rot { --kf: var(--rot); --kd: var(--rot-d); }
.f-gelb { --kf: var(--gelb); --kd: var(--gelb-d); }
.f-gruen { --kf: var(--gruen); --kd: var(--gruen-d); }
.f-blau { --kf: var(--blau); --kd: var(--blau-d); }
.f-joker { --kf: var(--ink); }
/* Jede Farbe hat ihre Form (hilft auch bei Farbschwäche): Kreis, Dreieck, Quadrat, Raute */
.k-feld::before { content: ''; position: absolute; left: 50%; top: 50%; width: 7.4em; height: 7.4em; transform: translate(-50%, -50%); background: var(--kd); }
.f-rot .k-feld::before { border-radius: 50%; }
.f-gelb .k-feld::before { clip-path: polygon(50% 3%, 99% 92%, 1% 92%); width: 8em; height: 7.6em; }
.f-gruen .k-feld::before { border-radius: .9em; width: 6.5em; height: 6.5em; }
.f-blau .k-feld::before { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: 7.8em; height: 9.8em; }
.f-joker .k-feld::before, .rueck .k-feld::before { display: none; }

.k-m { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 6.6em; letter-spacing: -.02em; text-shadow: .05em .06em 0 var(--ink); }
.k-m.art-plus { font-size: 4.7em; }
.k-m.art-bild { font-size: 6.2em; }
.k-m svg { width: 1.05em; height: 1.05em; display: block; filter: drop-shadow(.045em .055em 0 var(--ink)); }
.k-m.k-strich { text-decoration: underline; text-decoration-thickness: .07em; text-underline-offset: .09em; }
.k-e { position: absolute; left: .3em; top: .24em; min-width: .78em; display: flex; flex-direction: column; align-items: center; gap: .14em; font-weight: 800; font-size: 2.2em; text-shadow: .05em .07em 0 var(--ink); }
.k-e svg { width: .95em; height: .95em; display: block; }
.k-e.k-strich { text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .08em; }
.k-e2 { left: auto; top: auto; right: .3em; bottom: .24em; transform: rotate(180deg); }
.k-f { display: block; width: .4em; height: .4em; background: #fff; }
.f-rot .k-f { border-radius: 50%; }
.f-gelb .k-f { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.f-gruen .k-f { border-radius: .06em; }
.f-blau .k-f { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: .44em; height: .5em; }
.k-u { position: absolute; left: 0; right: 0; bottom: 1.5em; font-size: .98em; font-weight: 700; letter-spacing: .02em; }
.w-weg .k-m, .w-alle .k-m, .w-tausch .k-m { padding-bottom: .12em; }
.w-weg .k-e2, .w-alle .k-e2, .w-tausch .k-e2 { display: none; }   /* dort steht der Name der Karte */

/* Joker: Rad aus den vier Formen */
.k-rad { display: grid; grid-template-columns: 1fr 1fr; gap: .1em; width: 1em; height: 1em; }
.k-rad i { display: block; }
.fo-rot { background: var(--rot); border-radius: 50%; }
.fo-gelb { background: var(--gelb); clip-path: polygon(50% 4%, 100% 96%, 0 96%); }
.fo-gruen { background: var(--gruen); border-radius: .05em; }
.fo-blau { background: var(--blau); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.w-joker .k-m { font-size: 6em; }
.w-p4 .k-m { padding-bottom: .62em; }
.k-rad-unten { position: absolute; left: 50%; bottom: 1.05em; font-size: 3.1em; transform: translateX(-50%); }
/* Joker auf dem Stapel: Rahmen in der gewählten Farbe */
.gew-rot { --gf: var(--rot); } .gew-gelb { --gf: var(--gelb); } .gew-gruen { --gf: var(--gruen); } .gew-blau { --gf: var(--blau); }
.karte.gew .k-feld { box-shadow: inset 0 0 0 .62em var(--gf); }

/* Rückseite */
.rueck .k-feld { background: var(--ink); display: grid; place-items: center; box-shadow: inset 0 0 0 .16em rgba(255, 255, 255, .14); }
/* Logo-Schild: vier gleich breite Felder, jeder Buchstabe in seiner Farbe */
:is(.k-logo, .logo) > span { padding: .12em 0 .16em; text-align: center; background: var(--rot); }
:is(.k-logo, .logo) > span:nth-child(2) { background: var(--gelb); }
:is(.k-logo, .logo) > span:nth-child(3) { background: var(--gruen); }
:is(.k-logo, .logo) > span:nth-child(4) { background: var(--blau); }
.k-logo { position: absolute; left: 50%; top: 50%; display: grid; grid-template-columns: repeat(4, .9em); overflow: hidden; font-weight: 800; font-size: 2.75em; line-height: 1; color: #fff; text-shadow: .06em .07em 0 var(--ink);
  border-radius: .16em; transform: translate(-50%, -50%) rotate(-62deg) skewX(-10deg); }

/* ================= Knöpfe und Eingaben ================= */
.kn { font: 800 16px/1.15 var(--jost); color: #171a2b; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 11px 18px; min-height: 46px;
  box-shadow: 0 3px 0 var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative; top: 0; transition: top .06s, box-shadow .06s, filter .15s; }
.kn:active:not(:disabled) { top: 3px; box-shadow: 0 0 0 var(--ink); }
.kn:disabled { opacity: .5; }
.kn.haupt { background: var(--zack); }
.kn.gross { font-size: 19px; min-height: 56px; padding: 14px 26px; border-radius: 14px; }
.kn.breit { width: 100%; }
.kn.still { background: var(--knopf); color: var(--text); border-color: var(--rand); box-shadow: 0 3px 0 var(--rand); }
.kn.still:active:not(:disabled) { box-shadow: 0 0 0 var(--rand); }
.kn.rot { background: var(--rot); color: #fff; }
.kn.zack { background: var(--zack); font-size: 20px; padding: 10px 22px; transform: skewX(-8deg) rotate(-2deg); }
.kn.zack[disabled] { opacity: 1; background: #fff; }
@media (hover: hover) and (pointer: fine) { .kn:hover:not(:disabled) { filter: brightness(1.06); } }

.rund { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; display: grid; place-items: center; transition: background .15s, transform .1s; }
.rund:active { transform: scale(.94); }
.rund svg { width: 21px; height: 21px; display: block; }
@media (hover: hover) and (pointer: fine) { .rund:hover { background: rgba(255, 255, 255, .26); } }

.eingabe { width: 100%; height: 48px; padding: 0 14px; font: 600 16px var(--jost); color: var(--text); background: var(--feld); border: 2px solid transparent; border-radius: 12px; }
.eingabe:focus { outline: 0; border-color: var(--text); }

.wahl { display: flex; background: var(--feld); border-radius: 12px; padding: 3px; gap: 2px; }
.wahl button { flex: 1; min-height: 40px; padding: 6px 8px; border: 0; border-radius: 9px; background: none; color: var(--text); font: 700 14.5px/1.15 var(--jost); transition: background .15s, color .15s; }
.wahl button[aria-pressed='true'] { background: var(--an); color: var(--an-text); }

.schalter { width: 54px; height: 32px; flex: none; padding: 0; border: 2px solid var(--rand); border-radius: 99px; background: var(--feld); position: relative; transition: background .18s; }
.schalter::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text2); transition: transform .2s var(--feder), background .18s; }
.schalter[aria-checked='true'] { background: var(--gruen); }
.schalter[aria-checked='true']::after { transform: translateX(22px); background: #fff; }

.zaehler { display: inline-flex; align-items: center; gap: 4px; background: var(--feld); border-radius: 12px; padding: 3px; }
.zaehler button { width: 42px; height: 40px; border: 0; border-radius: 9px; background: var(--knopf); color: var(--text); font: 800 20px/1 var(--jost); box-shadow: inset 0 0 0 1.5px var(--linie); }
.zaehler button:disabled { opacity: .35; }
.zaehler output { min-width: 38px; text-align: center; font: 800 18px var(--jost); color: var(--text); }

/* ================= Start ================= */
.start { min-height: 100dvh; max-width: 1080px; margin: 0 auto; display: grid; gap: 14px; align-content: start;
  padding: calc(14px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); }
.start-oben { display: flex; justify-content: flex-end; gap: 8px; }
.buehne { position: relative; height: 252px; --kb: 100px; }
.buehne .karte { position: absolute; left: 50%; top: 8px; margin-left: -5em; transform: translate(calc(var(--i) * 4.5em), calc(var(--i) * var(--i) * .55em)) rotate(calc(var(--i) * 9deg)); animation: auffaechern .7s var(--weich) both; }
@keyframes auffaechern { from { transform: translate(0, 1em) rotate(0deg); } }
.logo { display: inline-grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; font: 800 64px/1 var(--jost); text-transform: uppercase; letter-spacing: .01em; color: #fff; text-shadow: 4px 5px 0 var(--ink);
  border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 6px 0 var(--ink); transform: skewX(-9deg) rotate(-4deg); }
.buehne .logo { position: absolute; left: 50%; bottom: 0; margin-left: -130px; width: 260px; text-align: center; z-index: 6; animation: logoRein .5s .25s var(--feder) both; }
@keyframes logoRein { from { transform: skewX(-9deg) rotate(-4deg) scale(.6); opacity: 0; } }
.start-text { text-align: center; font-size: 17px; font-weight: 600; margin: 18px auto 2px; max-width: 30ch; text-wrap: balance; }
.start-zahl { text-align: center; font-size: 14px; opacity: .8; }

.tafel { background: var(--flaeche); color: var(--text); border: 2px solid var(--rand); border-radius: 18px; box-shadow: 0 5px 0 var(--rand); padding: 18px; display: grid; gap: 18px; }
.tafel h2 { font: 800 15px/1.2 var(--jost); margin-bottom: 8px; }
.zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.zeile h2 { margin: 0; }
.werke { display: grid; gap: 8px; }
.werk { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; text-align: left; padding: 11px 14px; border: 2px solid var(--linie); border-radius: 13px; background: none; color: var(--text); transition: border-color .15s, background .15s; }
.werk b { font: 800 16px/1.2 var(--jost); }
.werk span { grid-column: 2; font-size: 13.5px; color: var(--text2); line-height: 1.3; }
.werk i { grid-row: 1 / 3; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text2); position: relative; }
.werk[aria-pressed='true'] { border-color: var(--text); background: var(--feld); }
.werk[aria-pressed='true'] i { border-color: var(--text); }
.werk[aria-pressed='true'] i::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--text); }
.textknopf { border: 0; background: none; padding: 6px 0; font: 700 15px var(--jost); color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-align: left; }

a.textknopf { display: inline-block; }
.start.steht .karte, .start.steht .logo { animation: none; }
.zurueck { margin-right: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 99px; background: rgba(255, 255, 255, .15); color: #fff; font: 700 15px var(--jost); text-decoration: none; }
.zurueck::before { content: ''; width: 8px; height: 8px; margin-right: 8px; border: solid currentColor; border-width: 0 0 2.5px 2.5px; transform: rotate(45deg); }
[data-bild] { background-size: cover !important; background-position: center !important; color: transparent !important; }

/* Online: Konto, Einladung, Aufstellung */
.konto { display: flex; align-items: center; gap: 12px; }
.konto b { flex: 1; font: 800 18px/1.2 var(--jost); }
.tafel .g-stein { width: 42px; height: 42px; flex: none; padding: 0; font-size: 18px; border-color: var(--rand); box-shadow: none; }
.code-zeile { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#code { text-transform: uppercase; letter-spacing: .12em; }
#code::placeholder { text-transform: none; letter-spacing: 0; }
.einladung { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.einladung > div { flex: 1 0 130px; }
.einladung.zwei > div { flex-basis: 100%; }
.einladung.zwei .kn { flex: 1; }
.blatt .einladung { padding-bottom: 14px; }
.einladung h2 { margin-bottom: 2px; font: 800 15px/1.2 var(--jost); }
.code { font: 800 27px/1.1 var(--jost); letter-spacing: .12em; user-select: text; -webkit-user-select: text; }
.start-links:not(:has(p)) { margin-bottom: 10px; }
.tafel [data-akt='los'] { position: sticky; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 2; }
.tafel [data-akt='los']:disabled { opacity: 1; background: var(--feld); color: var(--text2); }
.leute { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.leute li { display: flex; align-items: center; gap: 12px; }
.leute b { flex: 1; font: 700 16.5px/1.2 var(--jost); }
.leute li > span:last-child { font-size: 13.5px; color: var(--text2); }
.leute .weg { opacity: .5; }
.warten, .bereit-text { text-align: center; font-size: 15px; font-weight: 600; color: var(--text2); }
.bereit-text:empty { display: none; }
.gegner.weg .g-stein, .gegner.weg .g-name { opacity: .45; }
.netz-hinweis { position: fixed; z-index: 90; left: 50%; top: calc(62px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); padding: 9px 18px; border-radius: 99px; background: var(--ink); color: #fff; font: 700 15px var(--jost); white-space: nowrap; }

@media (min-width: 900px) {
  .start { grid-template-columns: 1.05fr 1fr; grid-template-rows: auto 1fr; column-gap: 56px; align-items: center; padding-top: 22px; }
  .start-oben { grid-column: 1 / -1; }
  .start-links { align-self: center; }
  .buehne { height: 450px; --kb: 172px; }
  .buehne .karte { top: 20px; }
  .logo { font-size: 104px; border-width: 4px; border-radius: 18px; box-shadow: 0 9px 0 var(--ink); text-shadow: 6px 7px 0 var(--ink); }
  .buehne .logo { width: 416px; margin-left: -208px; }
  .start-text { font-size: 21px; margin-top: 18px; }
  .tafel { padding: 24px; }
}

/* ================= Spiel ================= */
.spiel { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); overflow: hidden;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  --kb-hand: clamp(58px, 18.5vw, 84px); --kb-tisch: clamp(60px, min(22vw, 11.5vh), 108px); }
.spiel.wenige { --kb-tisch: clamp(64px, min(26vw, 12.5vh), 112px); }   /* zu zweit und zu dritt ist neben dem Stapel Platz */
.leiste { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; }
.leiste-mitte { flex: 1; min-width: 0; text-align: center; font-size: 14px; font-weight: 700; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mitspieler */
.gegner-reihe { position: absolute; inset: 0; }
.gegner { position: absolute; width: 82px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; border-radius: 16px; transition: background .25s, opacity .3s; }
.gegner.dran { background: rgba(255, 255, 255, .17); }
.gegner.raus { opacity: .4; }
.g-stein { width: 60px; height: 60px; border-radius: 50%; background: var(--ink); color: #fff; border: 2px solid rgba(255, 255, 255, .8); display: grid; place-items: center; padding-bottom: 10px; font: 800 26px/1 var(--jost);
  box-shadow: 0 3px 0 rgba(10, 12, 24, .35); transition: background .2s, color .2s, transform .25s var(--feder); }
.gegner.dran .g-stein { background: #fff; color: var(--ink); border-color: var(--ink); transform: scale(1.1); }
.g-name { max-width: 100%; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.g-karten { display: flex; justify-content: center; height: 37px; margin-top: -21px; position: relative; z-index: 1; --kb: 25px; --fb: 75px; }
.g-karten b { position: absolute; right: calc(50% - var(--schild, 42px)); bottom: 100%; margin: 0 0 13px; min-width: 27px; height: 27px; padding: 0 5px; display: grid; place-items: center; font: 800 16px/1 var(--jost); font-variant-numeric: tabular-nums; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 99px; }
.g-faecher { display: flex; justify-content: center; --schritt: min(var(--kb) * .62, (var(--fb) - var(--kb)) / var(--luecken)); }
.g-faecher i { flex: none; width: var(--kb); height: calc(var(--kb) * 1.45); border: 1.5px solid #fff; border-radius: 4px; background: var(--ink); display: grid; place-items: center; overflow: hidden; font: 800 calc(var(--kb) * .31)/1 var(--jost); transform: translateY(calc(var(--w) * var(--w) * var(--fall, 6px))) rotate(calc(var(--w) * 20deg)); }
.g-faecher .k-logo { font-size: 1em; text-shadow: .09em .1em 0 var(--ink), 0 0 .12em var(--ink); }
.g-faecher i + i { margin-left: calc(var(--schritt) - var(--kb)); }
.g-punkte { font-size: 11.5px; font-weight: 600; opacity: .75; }
.gegner .erwisch { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -8px); z-index: 5; min-height: 38px; padding: 7px 12px; font-size: 14px; white-space: nowrap; animation: plopp .25s var(--feder); }
.gegner.links .erwisch { left: 2px; transform: translateY(-8px); }
.gegner.rechts .erwisch { left: auto; right: 2px; transform: translateY(-8px); }
.gegner-reihe.viele .gegner { padding: 5px 2px 4px; }
.gegner-reihe.viele .g-stein { width: 56px; height: 56px; font-size: 24px; }
.gegner-reihe.viele .g-karten b { margin-bottom: 9px; }

.gegner-reihe.flach .gegner { width: 74px; padding: 4px 2px 3px; }
.gegner-reihe.flach .g-stein, .gegner-reihe.flach.viele .g-stein { width: 48px; height: 48px; font-size: 21px; }
.gegner-reihe.flach .g-punkte { display: none; }
.gegner-reihe.flach .g-name { margin-top: 0; font-size: 14px; }
.gegner-reihe.flach .g-karten { --kb: 17px; --fb: 66px; height: 26px; margin-top: -17px; }
.gegner-reihe.flach .g-karten b { min-width: 24px; height: 24px; --schild: 35px; margin: 0 0 10px; font-size: 14px; }
.gegner-reihe.flach .gegner { padding: 4px 2px 3px; }

/* Tischmitte */
.tisch { position: relative; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: center; }
.rund-tisch { position: relative; width: 100%; height: 100%; min-height: 0; }
.mitte { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: calc(var(--kb-tisch) * .26); --kb: var(--kb-tisch); }
.richtung { position: absolute; left: -7px; bottom: -10px; z-index: 3; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.richtung[hidden] { display: none; }
.richtung svg { width: 16px; height: 16px; transition: transform .45s var(--feder); }
.richtung.gegen svg { transform: scaleX(-1); }
.zieh { position: relative; padding: 0; border: 0; background: none; border-radius: calc(var(--kb) * .115); }
.zieh .karte { box-shadow: 0 .22em 0 #0b0d1a, 0 .44em 0 #fdfcf9, 0 .6em 0 #0b0d1a, 0 .95em 0 rgba(10, 12, 24, .3); }
.zieh:active .karte { transform: translateY(.3em); }
.zieh.lock .karte { animation: nicken .5s var(--weich); }
.zieh-zahl { position: absolute; left: 50%; bottom: -1.9em; transform: translateX(-50%); font-size: 12.5px; font-weight: 700; opacity: .75; white-space: nowrap; }
.strafe { position: absolute; right: -14px; top: -14px; z-index: 3; min-width: 46px; padding: 3px 9px 4px; font: 800 20px/1.1 var(--jost); color: #fff; text-shadow: 2px 2px 0 var(--ink);
  background: var(--rot); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 var(--ink); transform: rotate(8deg); animation: plopp .3s var(--feder); }
.ablage { position: relative; width: calc(var(--kb) * 1); height: calc(var(--kb) * 1.46); }
.ablage .karte { position: absolute; left: 0; top: 0; transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--d, 0deg)); }
.farbmarke { position: absolute; right: -15px; top: -15px; z-index: 3; width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; }
.farbmarke i { display: block; width: 17px; height: 17px; }
.farbmarke .fo-blau { width: 17px; height: 20px; }
.meldung { position: absolute; left: 50%; top: var(--melde-y, 6px); z-index: 8; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 8px 16px; font-size: 15.5px; font-weight: 700; text-align: center; color: #fff; background: var(--ink);
  border-radius: 99px; box-shadow: 0 3px 0 rgba(10, 12, 24, .35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; animation: meldung 1.5s var(--weich) both; }
@keyframes meldung { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.94); } 12%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -6px) scale(1); } }
.ansage { min-height: 1.4em; margin: 0 12px 4px; font-size: 16px; font-weight: 700; text-align: center; text-wrap: balance; }

/* Unten: Aktionen und eigene Hand */
.unten { position: relative; padding: 0 0 calc(8px + env(safe-area-inset-bottom, 0px)); }
.aktionen { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; min-height: 54px; padding: 2px 12px 8px; }
.hand { position: relative; margin: 0 10px; --kb: var(--kb-hand); transition: height .25s var(--weich); }
.hand .karte { position: absolute; left: 0; top: 0; cursor: pointer; will-change: transform;
  transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg)) translateY(var(--hub, 0em));
  transition: transform .3s var(--weich), filter .2s; }
.hand .karte.geht { --hub: -1.7em; }
.hand .karte.nein { filter: brightness(.58) saturate(.75); }
.hand .karte.gewaehlt { --hub: -3.6em; }
.hand .karte.rein { --hub: -1.7em; box-shadow: 0 0 0 .32em var(--zack), 0 .3em 0 rgba(10, 12, 24, .4); }
.hand .karte.neu { animation: neu .32s var(--feder); }
.hand .karte.wackel { animation: wackel .32s; }
.hand .karte .nr { position: absolute; left: 50%; top: -1.25em; margin-left: -1.1em; width: 2.2em; height: 2.2em; border-radius: 50%; background: var(--zack); color: var(--ink); border: .18em solid var(--ink); display: grid; place-items: center; font: 800 1.25em/1 var(--jost); }
@media (hover: hover) and (pointer: fine) { .hand .karte.geht:hover, .hand .karte.rein:hover { --hub: -2.8em; } }
@keyframes neu { from { opacity: 0; scale: .7; } }
@keyframes wackel { 20% { translate: -5px 0; } 45% { translate: 5px 0; } 70% { translate: -3px 0; } }
@keyframes nicken { 25% { transform: translateX(-4px) rotate(-2deg); } 60% { transform: translateX(4px) rotate(2deg); } }
@keyframes plopp { from { scale: .5; opacity: 0; } }

/* Fliegende Karten, Sprechblasen, Stempel */
.geist { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; transform-origin: 0 0; }
.geist .karte { position: static; }
.blase { position: fixed; z-index: 45; pointer-events: none; padding: 6px 16px 8px; font: 800 24px/1 var(--jost); color: var(--ink); background: var(--zack); border: 2.5px solid var(--ink); border-radius: 12px;
  box-shadow: 0 4px 0 var(--ink); transform: translate(-50%, -50%) skewX(-8deg) rotate(-5deg); animation: blase 1.25s var(--feder) both; white-space: nowrap; }
.blase.rot { background: var(--rot); color: #fff; }
@keyframes blase { 0% { opacity: 0; scale: .4; } 14%, 78% { opacity: 1; scale: 1; } 100% { opacity: 0; scale: 1.05; } }
.stempel { position: absolute; left: 50%; top: 4px; z-index: 4; width: 48px; height: 48px; margin-left: -24px; border-radius: 50%; background: var(--rot); color: #fff; border: 2px solid var(--ink); display: grid; place-items: center;
  animation: stempel .95s var(--weich) both; pointer-events: none; }
.stempel svg { width: 30px; height: 30px; }
.stempel.text { width: auto; height: auto; margin: 0; left: 50%; top: 14px; translate: -50% 0; padding: 3px 9px 4px; border-radius: 8px; font: 800 14px/1 var(--jost); rotate: -10deg; animation: none; }
@keyframes stempel { 0% { opacity: 0; scale: 1.7; } 18%, 75% { opacity: 1; scale: 1; } 100% { opacity: 0; scale: 1; } }

/* ================= Fenster ================= */
.schleier { position: fixed; inset: 0; z-index: 60; background: rgba(12, 14, 26, .58); display: grid; align-items: end; justify-items: center; animation: schleier .2s both; }
@keyframes schleier { from { opacity: 0; } }
.blatt { width: min(100%, 540px); max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--flaeche); color: var(--text); border: 2px solid var(--rand); border-bottom: 0; border-radius: 22px 22px 0 0;
  --bp: 18px; --bpu: calc(18px + env(safe-area-inset-bottom, 0px));
  padding: var(--bp) var(--bp) var(--bpu); animation: blattHoch .3s var(--weich) both; }
@keyframes blattHoch { from { transform: translateY(40px); opacity: 0; } }
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.blatt-kopf h2 { font: 800 21px/1.15 var(--jost); }
.blatt .rund { background: var(--feld); color: var(--text); }
.blatt-text { font-size: 15px; color: var(--text2); margin-bottom: 14px; }
/* Fuß bleibt beim Scrollen stehen und deckt die Liste dahinter ab */
.blatt-fuss { display: grid; gap: 10px; position: sticky; bottom: calc(0px - var(--bpu)); margin: 16px calc(0px - var(--bp)) calc(0px - var(--bpu)); padding: 12px var(--bp) var(--bpu);
  background: var(--flaeche); box-shadow: 0 -10px 12px -10px rgba(0, 0, 0, .28); }
@media (min-width: 700px) {
  .schleier { align-items: center; padding: 24px; }
  .blatt { --bp: 24px; --bpu: 24px; border-bottom: 2px solid var(--rand); border-radius: 22px; box-shadow: 0 6px 0 var(--rand); max-height: min(90dvh, 820px); }
  .blatt-fuss { border-radius: 0 0 20px 20px; }
}

/* Farbwahl */
.farbwahl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.farbwahl button { min-height: 92px; border: 2px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); color: #fff; font: 800 19px var(--jost); text-shadow: 2px 2px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; position: relative; top: 0; transition: top .06s, box-shadow .06s; }
.farbwahl button:active { top: 4px; box-shadow: 0 0 0 var(--ink); }
.farbwahl i { display: block; width: 28px; height: 28px; background: #fff !important; }
.farbwahl small { font: 600 13px var(--jost); text-shadow: none; opacity: .92; }
.fw-rot { background: var(--rot); } .fw-gelb { background: var(--gelb); } .fw-gruen { background: var(--gruen); } .fw-blau { background: var(--blau); }

/* Listen in Fenstern (Tauschen, Rundenende, Menü) */
.liste { display: grid; gap: 8px; }
.liste .kn { justify-content: space-between; }
.liste .kn small { font: 600 14px var(--jost); opacity: .7; }
.rang { display: grid; gap: 0; }
.rang-zeile { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--linie); }
.rang-zeile:first-child { border-top: 0; }
.rang-zeile .g-stein { width: 36px; height: 36px; padding: 0; font-size: 15px; border-color: var(--rand); box-shadow: none; grid-row: 1 / 3; }
.rang-zeile.sieger .g-stein { background: var(--zack); color: var(--ink); }
.rang-name { font: 800 16px/1.2 var(--jost); align-self: end; }
.rang-info { grid-column: 2; font-size: 13.5px; color: var(--text2); align-self: start; }
.rang-punkte { grid-row: 1 / 3; grid-column: 3; text-align: right; font: 800 20px/1.1 var(--jost); }
.rang-punkte small { display: block; font: 600 12.5px var(--jost); color: var(--text2); }
.rang-karten { grid-column: 2 / 4; display: flex; flex-wrap: wrap; padding-left: 9px; }
.rang-karten .karte { --kb: 26px; margin: 0 0 4px -9px; padding: 1.5px; border-width: 1.5px; box-shadow: none; }
.ende-titel { font: 800 30px/1.1 var(--jost); margin-bottom: 4px; text-wrap: balance; }

/* Regeln */
.regelgruppe { margin-top: 18px; }
.regelgruppe:first-of-type { margin-top: 4px; }
.regelgruppe > h3 { font: 800 13.5px/1.2 var(--jost); color: var(--text2); padding-bottom: 6px; }
.regel { display: grid; grid-template-columns: 1fr auto; gap: 3px 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--linie); }
.regel b { font: 700 16px/1.25 var(--jost); }
.regel p { grid-column: 1; font-size: 13.5px; line-height: 1.35; color: var(--text2); }
.regel > .schalter, .regel > .zaehler { grid-column: 2; grid-row: 1 / 3; }
.regel > .wahl { grid-column: 1 / -1; margin-top: 6px; }
.hinweis { font-size: 13.5px; color: var(--text2); background: var(--feld); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font-size: 13px; font-weight: 700; background: var(--feld); color: var(--text); border-radius: 99px; padding: 4px 11px; }

/* Lautstärke */
.lautregler { position: fixed; z-index: 60; display: flex; align-items: center; gap: 12px; width: min(320px, calc(100vw - 20px)); padding: 8px 16px 8px 8px; background: var(--flaeche); color: var(--text); border: 2px solid var(--ink); border-radius: 99px; box-shadow: 0 4px 0 var(--ink); animation: plopp .2s var(--feder); transform-origin: top right; }
[data-thema='dunkel'] .lautregler { background: var(--knopf); }
.lautregler .rund { background: var(--feld); color: var(--text); }
.lautregler output { min-width: 1.9em; text-align: right; font: 800 17px/1 var(--jost); font-variant-numeric: tabular-nums; }
.lautregler input { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 44px; margin: 0; background: none; cursor: pointer; touch-action: none; }
.lautregler input::-webkit-slider-runnable-track { height: 12px; border-radius: 99px; border: 2px solid var(--ink); background: linear-gradient(to right, var(--zack) var(--wert), var(--feld) var(--wert)); }
.lautregler input::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
.lautregler input::-moz-range-track { height: 8px; border-radius: 99px; border: 2px solid var(--ink); background: linear-gradient(to right, var(--zack) var(--wert), var(--feld) var(--wert)); }
.lautregler input::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }

/* ================= Größere Bildschirme ================= */
@media (min-width: 900px) and (min-height: 620px) {
  .spiel, .spiel.wenige { --kb-hand: 92px; --kb-tisch: 96px; }
  .leiste { padding: 12px 16px 4px; }
  .gegner, .gegner-reihe.viele .gegner { width: 144px; padding: 8px 6px 8px; }
  .g-stein, .gegner-reihe.viele .g-stein { width: 78px; height: 78px; font-size: 33px; }
  .g-name { font-size: 18px; }
  .gegner-reihe.flach .g-name { font-size: 16px; line-height: 1.25; }
  .gegner-reihe.flach .g-stein, .gegner-reihe.flach.viele .g-stein { width: 58px; height: 58px; font-size: 25px; }
  .g-karten { --kb: 30px; --fb: 128px; height: 46px; margin-top: -24px; }
  .gegner-reihe.flach .g-karten { --kb: 23px; --fb: 104px; height: 34px; margin-top: -20px; }
  .gegner-reihe.flach .gegner { padding: 4px 6px 2px; }
  .gegner-reihe.flach .g-karten b { min-width: 28px; height: 28px; --schild: 43px; margin: 0 0 13px; font-size: 16px; }
  .g-karten b, .gegner-reihe.viele:not(.flach) .g-karten b { min-width: 32px; height: 32px; --schild: 54px; margin: 0 0 24px; font-size: 19px; }
  .ansage { font-size: 18px; margin-bottom: 8px; }
  .meldung { font-size: 17px; }
  .hand { margin: 0 auto; max-width: 1100px; }
  .unten { padding-bottom: 16px; }
  .blase { font-size: 30px; }
}
@media (min-width: 900px) and (min-height: 760px) { .spiel, .spiel.wenige { --kb-hand: 100px; --kb-tisch: 112px; } }
@media (min-width: 900px) and (min-height: 900px) { .spiel, .spiel.wenige { --kb-hand: 112px; --kb-tisch: 134px; } }
/* Handy quer: flach bauen */
@media (max-height: 480px) {
  .spiel, .spiel.wenige { --kb-hand: 50px; --kb-tisch: 56px; grid-template-rows: minmax(0, 1fr) auto; }   /* die Leiste schwebt, also nur zwei Zeilen */
  .leiste { position: absolute; left: 0; right: 0; top: 0; padding: 4px 8px; z-index: 5; pointer-events: none; }
  .leiste > * { pointer-events: auto; }
  .leiste-mitte { visibility: hidden; }
  .gegner, .gegner-reihe.viele .gegner { width: max-content; display: grid; grid-template: 'stein karten karten' auto 'stein name punkte' auto / auto auto 1fr; align-items: center; justify-items: start; gap: 1px 6px; padding: 3px 8px; }
  .g-stein { grid-area: stein; } .g-karten { grid-area: karten; } .g-name { grid-area: name; margin: 0; font-size: 14px; } .g-punkte { grid-area: punkte; }
  .g-stein, .gegner-reihe.viele .g-stein { width: 40px; height: 40px; font-size: 18px; padding: 0; }
  .g-karten { --kb: 16px; --fb: 64px; --fall: 2px; height: 28px; margin: 0; }
  .g-karten b, .gegner-reihe.viele .g-karten b { position: static; margin: 0 0 0 7px; min-width: 24px; height: 24px; font-size: 14px; }
  .ansage { font-size: 14px; margin-bottom: 0; }
  .hand { margin: 0 calc(172px + env(safe-area-inset-right, 0px)); }
  .aktionen { min-height: 0; position: absolute; z-index: 3; right: 10px; bottom: 12px; width: 156px; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .meldung { animation-duration: 1.5s !important; animation-name: meldungRuhig; }
  .blase, .stempel { animation-duration: 1.2s !important; animation-name: meldungRuhig; }
  @keyframes meldungRuhig { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
}
