/* Cambio – mobile first. Desktop-Erweiterungen ganz unten. */
:root {
  --felt: #0f5132;
  --felt-dark: #0a3a24;
  --felt-light: #16704a;
  --ink: #f3f1ea;
  --muted: #b9cfc2;
  --gold: #f2c14e;
  --red: #c8102e;
  --black: #1b1b1f;
  --swap: #00e5ff;
  --radius: 9px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
:root, [data-theme="classic"] {
  /* Design-Variablen – werden pro Design (data-theme) überschrieben */
  --table-bg: radial-gradient(ellipse at 50% 40%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%);
  --table-base: var(--felt-dark);
  --title: var(--gold);
  --panel: rgba(0,0,0,.2);
  --panel-strong: rgba(0,0,0,.3);
  --chip-bg: rgba(0,0,0,.28);
  --btn-bg: rgba(255,255,255,.14);
  --btn-bg-hover: rgba(255,255,255,.22);
  --btn-ink: var(--ink);
  --primary: var(--gold);
  --primary-hover: #ffd36b;
  --primary-ink: #2a1e00;
  --danger: var(--red);
  --danger-ink: #fff;
  --snap-bg: #ffdd00;
  --badge-bg: rgba(255,255,255,.15);
  --empty-border: rgba(255,255,255,.15);
  --divider: rgba(255,215,160,.45);
  --dialog-bg: #12392a;
  --line: rgba(255,255,255,.1);
  --error: #ffb4b4;
  --suit-red: var(--red);
  --suit-black: var(--black);
  --face-bg: #fffdf7;
  --face-border: #ddd;
  --back-bg:
    repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 5px, transparent 5px 10px),
    linear-gradient(135deg, #7a1f2b, #4b0f19);
  --back-border: #f6efe0;
  --penalty-border: #ffd7a0;
  --card-font: inherit;
  --title-font: inherit;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--table-bg);
  background-attachment: fixed;
  background-color: var(--table-base);
  min-height: 100vh; min-height: 100dvh;
  overscroll-behavior: none;
  touch-action: manipulation;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
.desktop-only { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 12px 20px; min-height: 46px;
  background: var(--btn-bg); color: var(--btn-ink); font-weight: 700; font-size: 16px;
  transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.danger { background: var(--danger); color: var(--danger-ink); }
.btn.snap {
  background: var(--snap-bg); color: #2a1e00; margin-top: 4px; padding: 8px 14px; min-height: 38px;
  animation: pulse 1s infinite; white-space: nowrap; font-size: 15px;
}
.btn.snap.armed { background: white; outline: 3px solid var(--snap-bg); animation: none; }
.btn.snap.off { visibility: hidden; animation: none; }
.chip {
  border: 0; background: var(--chip-bg); color: var(--ink);
  padding: 7px 12px; border-radius: 999px; font-size: 14px; min-height: 34px;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.chip.muted { color: var(--muted); }
.chip.icon { width: 36px; justify-content: center; padding: 0; font-weight: 800; flex: none; }
#share { min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
@keyframes pulse { 50% { transform: scale(1.06); } }

/* ---------- Startseite ---------- */
#home {
  display: grid; place-items: center; min-height: 100vh; min-height: 100dvh;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
}
.home-card {
  width: min(420px, 100%); background: var(--panel-strong); border-radius: 20px;
  padding: 24px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 12px;
}
.home-card h1 { margin: 0; font-size: 44px; letter-spacing: 1px; color: var(--title); font-family: var(--title-font); }
/* Zusatz unter „Cambio“ – gleiche Schrift, klein */
.home-card h1 .h1-suffix { font-size: .5em; letter-spacing: 0; white-space: nowrap; }
.home-card .subtitle {
  margin: -10px 0 4px; font-family: var(--title-font); font-weight: 800; line-height: 1.25;
  font-size: clamp(12.5px, 3.7vw, 16px); white-space: nowrap;
  color: var(--title); letter-spacing: .5px; opacity: .9;
}
[data-theme="flower"] .home-card .subtitle { font-weight: 400; text-shadow: 1px 1px 0 #ffd60a; }
.tagline { margin: 0 0 6px; color: var(--muted); }
.online-count {
  align-self: flex-start; margin: 0; padding: 4px 12px 4px 10px; border-radius: 999px;
  background: var(--badge-bg); font-size: 13px; font-weight: 700; color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
}
.online-count::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 0 3px rgba(46,204,113,.25); animation: online-pulse 2s infinite; }
@keyframes online-pulse { 50% { box-shadow: 0 0 0 6px rgba(46,204,113,0); } }
.home-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input {
  font: inherit; font-size: 16px; /* verhindert Auto-Zoom auf dem iPhone */
  padding: 12px 14px; border-radius: 12px; border: 2px solid transparent; min-height: 48px;
  background: rgba(255,255,255,.94); color: #111; outline: none; width: 100%;
}
input:focus { border-color: var(--gold); }
.or { text-align: center; color: var(--muted); font-size: 13px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 4px; font-weight: 700; min-width: 0; }
.error { color: var(--error); min-height: 1.2em; margin: 0; }
.home-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; }
.home-links .home-link { margin: 0; text-decoration: none; font-size: 15px; }
.home-legal { display: block; width: fit-content; margin: 10px auto 0; padding: 4px 8px; font-size: 12px; color: var(--muted); text-decoration: none; }
.home-legal:hover { text-decoration: underline; }

/* ---------- Spieltisch ---------- */
#game {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  -webkit-user-select: none; user-select: none;
}
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.brand { font-weight: 800; color: var(--title); font-family: var(--title-font); font-size: 20px; margin-right: auto; }
@media (max-width: 420px) { .brand { font-size: 0; } .brand::first-letter { font-size: 22px; } }
.layout { flex: 1; display: flex; padding: 0 10px 10px; gap: 16px; }
.table {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch;
  justify-content: space-between; gap: 6px;
}
.side { display: none; }
.log { margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.4; display: flex; flex-direction: column; gap: 6px; }
.log li { color: var(--muted); }
.log li:first-child { color: var(--ink); }

/* Gegner */
.opponents { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.seat {
  background: var(--panel); border-radius: 14px; padding: 6px 8px 8px;
  border: 2px solid transparent; transition: border-color .2s, box-shadow .2s;
  display: flex; flex-direction: column; align-items: center;
}
.seat.active { border-color: var(--gold); box-shadow: 0 0 22px rgba(242,193,78,.35); }
.seat.offline { opacity: .5; }
/* Kopf darf das Feld nicht verbreitern (width 0 + min-width 100%) und hat feste Höhe */
.seat-head { width: 0; min-width: 100%; display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; font-size: 12px; }
.seat-title { display: flex; justify-content: center; align-items: baseline; gap: 6px; white-space: nowrap; min-width: 0; height: 1.35em; }
.seat-title .seat-name { min-width: 0; }
/* Was nicht in die Zeile passt, rutscht in eine unsichtbare zweite Zeile (statt halb abgeschnitten) */
.seat-badges { display: flex; justify-content: center; align-content: flex-start; align-items: center; gap: 4px; height: 18px; overflow: hidden; flex-wrap: wrap; row-gap: 10px; }
.opponents .seat { min-width: 112px; }
.seat-badges .badge { flex: none; }
.me .seat { min-width: min(100%, 300px); }
.me .seat-head { flex-direction: row; justify-content: center; align-items: center; gap: 6px; height: 22px; overflow: hidden; }
.me .seat-title { flex: 0 1 auto; height: auto; }
.me .seat-badges { flex: 0 1 auto; min-width: 0; height: 20px; }
.seat-name { font-weight: 700; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 10px; padding: 2px 6px; border-radius: 999px; background: var(--badge-bg); white-space: nowrap; }
.badge.gold { background: var(--gold); color: #2a1e00; font-weight: 700; }
.badge.red { background: var(--danger); color: var(--danger-ink); }
.points { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* Kartenraster: Spalten kommen aus JS (--cols), Positionen sind fest */
.grid {
  --cols: 2;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--card-w));
  grid-auto-rows: var(--card-h);
  gap: var(--gap, 6px);
  --spacers: 0;
}
/* Abstand + Trennlinie zwischen den 4 Ursprungskarten und den Strafkarten */
.penalty-divider {
  justify-self: center; width: 0; height: 100%;
  border-left: 2px dashed var(--divider);
}
.opponents .grid {
  --penalty-gap: 6px;
  --card-w: clamp(20px, calc(84px / var(--cols)), 38px);
  --card-h: calc(var(--card-w) * 1.43);
  --gap: 4px;
}
.me { display: flex; justify-content: center; }
.me .seat { padding: 6px 12px 10px; }
.me .seat-head { font-size: 14px; }
.me .grid {
  --penalty-gap: 14px;
  --card-w: min(80px, calc((100vw - 64px - var(--safe-left) - var(--safe-right) - var(--spacers) * (var(--penalty-gap) + 8px)) / var(--cols) - 8px), calc(var(--stable-h, 100svh) * .086));
  --card-h: calc(var(--card-w) * 1.43);
  --gap: 8px;
}
.penalty-slot.card.back { border-color: var(--penalty-border); }

/* ---------- Karten ---------- */
.card {
  width: var(--card-w); height: var(--card-h); border-radius: var(--radius);
  position: relative; flex: none;
  box-shadow: 0 3px 8px rgba(0,0,0,.35);
  transition: transform .15s, box-shadow .15s, outline-color .15s;
  outline: 3px solid transparent; outline-offset: 2px;
}
.card.back {
  background: var(--back-bg);
  border: max(2px, calc(var(--card-w) * .045)) solid var(--back-border);
}
.card.face {
  background: var(--face-bg); color: var(--suit-black); border: 1px solid var(--face-border);
  font-family: var(--card-font);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card.face.red { color: var(--suit-red); }
.card .corner { position: absolute; top: 3px; left: 5px; font-weight: 800; font-size: calc(var(--card-w) * .26); line-height: 1; text-align: center; }
.card .corner small { display: block; font-size: .85em; }
.card .pip { font-size: calc(var(--card-w) * .5); }
.card .val { position: absolute; bottom: 2px; right: 5px; font-size: calc(var(--card-w) * .16); opacity: .6; font-weight: 700; }
.slot-empty { width: var(--card-w); height: var(--card-h); border-radius: var(--radius); border: 2px dashed var(--empty-border); }

.card.target { cursor: pointer; outline-color: rgba(242,193,78,.65); }
.card.target:active { transform: scale(.95); }
.card.selected { outline: 4px solid var(--swap); transform: translateY(-5px); }
.card.peeking { outline-color: #7fd1ff; }
.card.public-reveal { outline-color: var(--red); }

/* Markierungen für alle Spieler */
.card.flash-swap, .card.flash-exchange {
  outline: 5px solid var(--swap); outline-offset: 2px;
  animation: wiggle .5s 2, swap-glow 1.2s ease-in-out infinite;
  z-index: 1;
}
.card.flash-swap { outline-color: var(--gold); --glow: rgba(242,193,78,.9); }
.card.flash-exchange { --glow: rgba(0,229,255,.9); }
.card[data-mark]::after {
  content: attr(data-mark);
  position: absolute; top: -10px; right: -10px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 900;
  background: var(--swap); color: #002b33; box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.card.flash-swap[data-mark]::after { background: var(--gold); color: #2a1e00; }
.card.flash-peek { animation: glow 1s 3; }
.card.flash-snap, .card.flash-penalty { animation: glow-red 1s 3; }
@keyframes wiggle { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes swap-glow { 50% { box-shadow: 0 0 0 4px var(--glow), 0 0 22px var(--glow); } }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(127,209,255,.8); } }
@keyframes glow-red { 50% { box-shadow: 0 0 0 6px rgba(255,90,90,.85); } }

/* ---------- Mitte ---------- */
.center {
  display: flex; justify-content: center; align-items: flex-start; gap: 16px;
  --card-w: min(66px, calc(var(--stable-h, 100svh) * .08)); --card-h: calc(var(--card-w) * 1.43);
}
.pile { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: var(--card-w); }
.pile-label { font-size: 12px; color: var(--muted); text-align: center; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
#deck.clickable { cursor: pointer; outline-color: var(--gold); }
#discard.clickable { cursor: pointer; }
#discard.clickable .card { outline-color: var(--gold); }
.slot-empty.give-target { border-color: var(--swap); border-style: solid; animation: glow 1s infinite; }
#drawn-slot .card { transform: rotate(-3deg); }

/* Status mit fester Höhe (Titel + max. 2 Zeilen Hinweis), damit darunter nichts springt */
.status {
  text-align: center; font-size: 16px; font-weight: 700; padding: 0 4px;
  height: 60px; display: flex; flex-direction: column; justify-content: center; overflow: hidden;
}
.status .hint {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 3px; line-height: 1.3;
}
.last-log {
  border: 0; background: var(--panel); border-radius: 10px; padding: 6px 10px;
  font-size: 13px; color: var(--muted); text-align: center; align-self: center; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.last-log:empty { display: none; }
.actions { display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap; height: 46px; }
.actions .btn { white-space: nowrap; padding: 12px 16px; }
.actions:empty { visibility: hidden; }

.results { background: var(--panel-strong); border-radius: 14px; padding: 12px 14px; align-self: center; width: min(460px, 100%); }
.results h3 { margin: 0 0 4px; color: var(--title); font-family: var(--title-font); }
.results p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.results table { width: 100%; border-collapse: collapse; font-size: 15px; }
.results td, .results th { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--line); }
.results th { color: var(--muted); font-weight: 500; font-size: 13px; }
.results td.num, .results th.num { text-align: right; }
.results .actions { margin-top: 10px; }
.results tr.loser td { color: var(--danger); font-weight: 700; }
.results .reset-note { color: var(--gold); font-weight: 700; white-space: nowrap; }
.results .reset-hint, .results .next-starter { margin: 8px 0 0; font-size: 13px; }
.results.game-over { outline: 3px solid var(--danger); }
.results .game-over-text { color: var(--ink); font-weight: 600; }

/* ---------- Overlays ---------- */
.banner {
  position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 10;
  font-size: clamp(32px, 10vw, 72px); font-weight: 900; color: var(--title); font-family: var(--title-font);
  text-shadow: 0 4px 30px rgba(0,0,0,.6); animation: pop 2s forwards; text-align: center; padding: 16px;
}
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 15% { transform: scale(1.05); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.toast {
  position: fixed; bottom: calc(16px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 11;
  background: #2b2b2b; color: white; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: calc(100% - 32px); text-align: center;
}
dialog {
  border: 0; border-radius: 18px; width: min(520px, calc(100% - 24px)); max-height: 80dvh;
  background: var(--dialog-bg); color: var(--ink); padding: 16px 18px;
}
dialog h2 { margin: 0 0 10px; font-size: 18px; }
dialog form { margin-top: 12px; text-align: right; }
dialog::backdrop { background: rgba(0,0,0,.55); }

/* ---------- Geräte mit Maus ---------- */
@media (hover: hover) {
  .btn:hover { background: var(--btn-bg-hover); }
  .btn.primary:hover { background: var(--primary-hover); }
  .card.target:hover { transform: translateY(-4px); outline-color: var(--gold); }
  #deck.clickable:hover { transform: translateY(-4px); }
}

/* ---------- Tablet / Desktop ---------- */
@media (min-width: 900px) {
  .mobile-only { display: none !important; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .brand { font-size: 22px; }
  .layout { padding: 0 16px 16px; }
  .table { justify-content: flex-start; gap: 14px; }
  .side {
    display: block; width: 280px; flex: none; background: var(--panel); border-radius: 14px;
    padding: 12px 14px; max-height: calc(100dvh - 80px); overflow: auto; position: sticky; top: 10px;
  }
  .side h2 { margin: 0 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
  .log { font-size: 13px; }
  .opponents { gap: 12px; }
  .seat { padding: 10px 12px 12px; }
  .seat-head { font-size: 14px; }
  .seat-badges { height: 20px; }
  .badge { font-size: 11px; }
  .points { font-size: 12px; }
  .opponents .grid { --card-w: clamp(30px, calc(110px / var(--cols)), 52px); --gap: 6px; }
  .center { gap: 28px; --card-w: 78px; }
  .me .grid { --card-w: min(84px, calc(560px / var(--cols))); --gap: 10px; --penalty-gap: 20px; }
  .status { font-size: 17px; }
  .status .hint { font-size: 14px; }
}

/* =====================================================================
   Design „Flower Power“: Strandbar-Holztisch + Karten im Ibiza-Look
   ===================================================================== */
[data-theme="flower"] {
  --ink: #3a2212;
  --muted: #74502f;
  --gold: #ff8a1e;
  --red: #e0245e;
  --swap: #00b3d6;
  --table-bg:
    radial-gradient(ellipse at 50% 30%, rgba(255,236,200,.38), transparent 65%),
    repeating-linear-gradient(90deg, rgba(70,38,14,.55) 0 2px, rgba(255,232,196,.28) 2px 3px, transparent 3px 92px),
    url("/themes/wood-grain.svg"),
    repeating-linear-gradient(90deg, #c99060 0 92px, #d8a46f 92px 184px, #bf8656 184px 276px, #d39c66 276px 368px);
  --table-base: #c99060;
  --title: #ff4f9a;
  --panel: rgba(255,247,228,.78);
  --panel-strong: rgba(255,247,228,.92);
  --chip-bg: rgba(255,247,228,.85);
  --btn-bg: rgba(255,247,228,.9);
  --btn-bg-hover: #fff;
  --btn-ink: #3a2212;
  --primary: #ffd60a;
  --primary-hover: #ffe14d;
  --primary-ink: #2338a0;
  --danger: #ff4f9a;
  --danger-ink: #fff;
  --snap-bg: #7be08a;
  --badge-bg: rgba(35,56,160,.12);
  --empty-border: rgba(58,34,18,.3);
  --divider: rgba(255,79,154,.7);
  --dialog-bg: #fff4df;
  --line: rgba(58,34,18,.14);
  --error: #c0392b;
  --suit-red: #e0245e;
  --suit-black: #2338a0;
  --face-bg: #fffdf6;
  --face-border: #e8dcc0;
  --back-bg: #2b44b0;
  --back-border: #fbfaf4;
  --penalty-border: #ff6fb6;
  --title-font: "Shrikhand", "Cooper Black", Georgia, serif;
  --card-font: "Fredoka", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-family: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}
/* Vorschau: realistischerer Holztisch (Bretter, Maserung, Astlöcher, Nägel) */
[data-theme="flower"][data-wood="neu"] {
  --table-bg:
    radial-gradient(ellipse at 50% 30%, rgba(255, 248, 228, .38), transparent 62%),
    radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(90, 50, 20, .20) 100%),
    url("/themes/wood-table.svg") center top / 450px 960px repeat;
  --table-base: #e2bb8a;
}
[data-theme="flower"] .card.back { border-width: max(2px, calc(var(--card-w) * .07)); overflow: hidden; }
.card .back-art { display: none; }
[data-theme="flower"] .card.back .back-art { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
/* Vorderseite schlicht: nur Zahl und Symbol */
[data-theme="flower"] .card.face .val { display: none; }
[data-theme="flower"] .card { box-shadow: 0 4px 10px rgba(60,30,8,.35), 0 1px 2px rgba(60,30,8,.3); }
[data-theme="flower"] .seat { box-shadow: 0 4px 14px rgba(60,30,8,.18); }
[data-theme="flower"] .seat.active { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(255,138,30,.45); }
[data-theme="flower"] .home-card { box-shadow: 0 20px 50px rgba(60,30,8,.35); }
[data-theme="flower"] .home-card h1 { font-weight: 400; text-shadow: 2px 2px 0 #ffd60a; }
[data-theme="flower"] .brand { font-weight: 400; text-shadow: 1px 1px 0 #ffd60a; }
[data-theme="flower"] .banner { font-weight: 400; text-shadow: 3px 3px 0 #ffd60a, 0 6px 30px rgba(60,30,8,.5); }
/* Text, der direkt auf dem Holz steht, bekommt eine helle Unterlage */
[data-theme="flower"] .status { background: var(--panel); border-radius: 14px; padding: 4px 14px; align-self: center; }
[data-theme="flower"] .status:empty { display: none; }
[data-theme="flower"] .pile-label { background: var(--panel); border-radius: 999px; padding: 1px 8px; }
[data-theme="flower"] .btn.snap { color: #17451f; }
[data-theme="flower"] .toast { background: #2338a0; }

/* ---------- Flug-Animationen ---------- */
.card.flying { z-index: 60; pointer-events: none; box-shadow: 0 14px 28px rgba(0,0,0,.35); outline: none; }

/* ---------- Zug-Timer ---------- */
.turn-timer { align-self: center; width: min(320px, 100%); position: relative; height: 22px; }
.turn-timer .bar { position: absolute; inset: 0; border-radius: 999px; background: var(--panel); overflow: hidden; }
.turn-timer .bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--timer, #7be08a); transition: width .25s linear; opacity: .85; }
.turn-timer span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--ink); }
.turn-timer.mine span { color: var(--ink); }
.turn-timer.warn .bar i { background: #ffb020; }
.turn-timer.danger .bar i { background: #ff4040; }
.turn-timer.danger.mine { animation: pulse .6s infinite; }
.turn-timer.danger.mine span { color: #fff; }
.badge.warn { background: #ffb020; color: #2a1e00; font-weight: 700; }
.badge.timer-badge { font-variant-numeric: tabular-nums; }
.badge.timer-badge.danger { background: #e02929; color: #fff; }
.seat.out { opacity: .45; filter: grayscale(.8); }

/* ---------- Einladen ---------- */
.invite-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.invite-status { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { flex: 1; min-width: 0; font-size: 15px; -webkit-user-select: text; user-select: text; }
.invite-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.invite-btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.invite-btn.whatsapp { background: #25d366; color: #05361a; }
.invite-qr-wrap { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.invite-qr { width: 120px; height: 120px; flex: none; background: #fff; border-radius: 10px; padding: 4px; display: grid; place-items: center; font-size: 11px; color: #555; }
.invite-qr svg { width: 100%; height: 100%; }
.invite-hint { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ---------- Stammtische ---------- */
table.rank { width: 100%; border-collapse: collapse; font-size: 15px; }
table.rank td, table.rank th { padding: 7px 5px; text-align: left; border-bottom: 1px solid var(--line); }
table.rank th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.rank .num { text-align: right; }
table.rank td.losses { font-weight: 800; font-size: 17px; }
table.rank tr.me-row td { background: var(--badge-bg); }
.rank-hint { font-size: 13px; color: var(--muted); }

/* ---------- Über Cambio (Strandbar) ---------- */
dialog.about {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border-radius: 0; background: #bfe9fb; overflow: hidden; color: #3a2212;
}
dialog.about::backdrop { background: #5fc4f0; }
.about-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.about-waves { animation: about-sway 6s ease-in-out infinite alternate; }
@keyframes about-sway { to { transform: translateX(-18px); } }
.about-card {
  position: absolute; left: 50%; top: calc(18px + var(--safe-top)); transform: translateX(-50%);
  width: min(440px, calc(100% - 28px)); max-height: calc(100% - 150px - var(--safe-top) - var(--safe-bottom));
  overflow: auto; -webkit-overflow-scrolling: touch;
  background: rgba(255, 248, 230, .9); border-radius: 22px; padding: 20px 20px 16px;
  box-shadow: 0 18px 40px rgba(20, 60, 90, .35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  font-family: "Fredoka", ui-rounded, system-ui, sans-serif; line-height: 1.45; font-size: 16px;
}
.about-card h2 { margin: 0 0 8px; font-family: "Shrikhand", Georgia, serif; font-weight: 400; color: #ff4f9a; font-size: 30px; text-shadow: 2px 2px 0 #ffd60a; }
.about-card p { margin: 0 0 12px; }
.about-lead { font-size: 18px; }
.about-shout { font-weight: 700; margin-bottom: 6px !important; }
.about-names { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.about-names li { background: #2ec4b6; color: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 15px; }
.about-sign { font-style: italic; }
.about-card form { text-align: center; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .about-waves { animation: none; } }

/* ---------- Gegen Computer ---------- */
.practice-hint { color: var(--muted); margin: 0 0 12px; }
.practice-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.practice-options .btn { font-size: 20px; }
#share.practice-chip { cursor: default; }

/* ---------- Startseite: Account, Tische ---------- */
.account-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.account-label { font-size: 15px; }
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--title); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; margin-left: auto; }
.open-tables { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow: auto; margin-bottom: 6px; }
.open-table { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--chip-bg); }
.open-table-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.open-table-info span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.open-table .btn { flex: none; padding: 10px 14px; }
.mode-options { display: grid; gap: 10px; }
.mode-option {
  border: 3px solid transparent; border-radius: 16px; padding: 14px; background: var(--chip-bg); text-align: left;
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; align-items: center;
}
.mode-option:active { border-color: var(--gold); }
.mode-option .mode-icon { grid-row: 1 / 3; font-size: 28px; }
.mode-option b { font-size: 17px; }
.mode-option span:last-child { font-size: 13px; color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; background: var(--badge-bg); padding: 4px; border-radius: 999px; }
.tab { border: 0; border-radius: 999px; padding: 8px; background: transparent; font-weight: 700; }
.tab.active { background: var(--primary); color: var(--primary-ink); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 4px 0; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--title); }
.settings-account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.settings-account p { margin: 0; width: 100%; }
.practice-hint.small { font-size: 12px; margin: 12px 0 0; }
#delete-pw { margin-bottom: 4px; }

/* ---------- Spielregeln ---------- */
dialog.rules-dialog { width: min(560px, calc(100% - 20px)); max-height: 88dvh; padding: 0; display: none; }
dialog.rules-dialog[open] { display: flex; flex-direction: column; }
.rules-dialog > h2 { margin: 0; padding: 16px 18px 8px; }
#rules-content { overflow: auto; padding: 0 18px; -webkit-overflow-scrolling: touch; }
.rules-dialog > form { padding: 10px 18px 16px; margin: 0; border-top: 1px solid var(--line); }
.rules-doc { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.rules-doc section { background: var(--chip-bg); border-radius: 14px; padding: 10px 12px; }
.rules-doc h3 { margin: 0 0 6px; font-size: 16px; }
.rules-doc p { margin: 0 0 6px; font-size: 14px; line-height: 1.45; }
.rules-doc p:last-child { margin-bottom: 0; }
.rules-sub { color: var(--muted); }
.rules-note { background: var(--badge-bg); border-radius: 10px; padding: 6px 10px; }
.rules-steps { margin: 0 0 6px; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 6px; }
.rules-steps li { counter-increment: step; position: relative; padding-left: 32px; font-size: 14px; line-height: 1.4; }
.rules-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--primary); color: var(--primary-ink);
}
.rules-list { margin: 4px 0 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.4; }
.rules-list li { padding-left: 4px; }
.rules-list li.good::before { content: "✓ "; color: #1f9d55; font-weight: 800; }
.rules-list li.bad::before { content: "✗ "; color: var(--error); font-weight: 800; }
.rules-row { display: flex; gap: 12px; align-items: center; }
.rules-row p { flex: 1; }
.rules-setup { display: grid; grid-template-columns: repeat(2, auto); gap: 4px; flex: none; }
.rules-card { display: flex; flex-direction: column; align-items: center; gap: 2px; --card-w: 34px; --card-h: 49px; --radius: 6px; }
.rules-card .card { box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.rules-card .card .val { display: none; }
.rules-card-label { font-size: 13px; font-weight: 800; }
.rules-card.good .rules-card-label { color: #1f9d55; }
.rules-card.best .rules-card-label { color: #1f9d55; }
.rules-card.best .card { outline: 2px solid #1f9d55; outline-offset: 1px; }
.rules-card.worst .rules-card-label { color: var(--error); }
.rules-card.worst .card { outline: 2px solid var(--error); outline-offset: 1px; }
.rules-points { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 8px 4px; margin-bottom: 8px; justify-items: center; }
.rules-effects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rules-effect { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.3; }
.rules-pairs { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.rules-pair { display: flex; align-items: center; gap: 4px; }
.rules-op { font-weight: 800; color: var(--muted); }
.rules-result { font-size: 18px; min-width: 22px; }
.rules-pair.good .rules-result, .rules-pair.best .rules-result { color: #1f9d55; }

/* ---------- Passwort-Prüfung ---------- */
.match-hint { margin: -4px 0 6px; font-size: 14px; font-weight: 700; min-height: 1.2em; }
.match-hint.ok { color: #1f9d55; }
.match-hint.bad { color: var(--error); }

/* ---------- Admin ---------- */
.admin-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; max-height: 50vh; overflow: auto; }
.admin-table { background: var(--chip-bg); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.admin-table-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.admin-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.admin-chip { background: #2ec4b6; color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.admin-chip.pending { background: transparent; color: var(--muted); border: 1.5px dashed var(--muted); }
.admin-table .btn { padding: 8px 14px; min-height: 0; }
textarea { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.94); color: #111; resize: vertical; }
textarea:focus { border-color: var(--gold); outline: none; }
.code-input { text-transform: uppercase; letter-spacing: 4px; font-weight: 700; }
.open-table-info .here { color: var(--title); font-weight: 600; }
.adm-code-info { margin: -2px 0 10px; font-weight: 700; }

/* ---------- Sprache ---------- */
.lang-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang-option { border: 3px solid transparent; border-radius: 999px; padding: 10px; background: var(--chip-bg); font-weight: 700; }
.lang-option[aria-checked="true"] { border-color: var(--gold); }

/* ---------- Einstellungen ---------- */
.settings-head { display: flex; align-items: center; justify-content: space-between; }
/* Einstellungen oben rechts auf der Startkarte: nur das Zahnrad, ohne Hintergrund, große Tippfläche */
.chip.icon.home-settings {
  align-self: flex-end; margin: -6px -8px -44px 0;
  width: 48px; height: 48px; min-height: 48px; padding: 0;
  background: transparent; box-shadow: none; border-radius: 50%;
  font-size: 28px; line-height: 1; color: var(--ink);
}
.chip.icon.home-settings:active { transform: scale(.9); }
.setting-label { margin: 6px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-option {
  border: 3px solid transparent; border-radius: 16px; padding: 6px; background: var(--chip-bg);
  display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: center; font-weight: 700;
}
.theme-option[aria-checked="true"] { border-color: var(--gold); }
.theme-preview {
  height: 92px; border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--table-bg); background-color: var(--table-base);
  --card-w: 44px; --card-h: 63px; --radius: 6px;
}
.theme-preview .card:first-child { transform: rotate(-6deg); }
.theme-preview .card:last-child { transform: rotate(5deg); }
.settings-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Feedback ---------- */
.feedback-dialog .fb-q { margin: 16px 0 8px; font-size: 15px; }
.fb-req { color: var(--danger); }
.fb-rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.fb-face {
  border: 3px solid transparent; border-radius: 14px; background: var(--chip-bg); padding: 8px 2px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 64px;
}
.fb-face[aria-checked="true"] { border-color: var(--gold); background: var(--btn-bg-hover); }
.fb-emoji { font-size: 28px; line-height: 1; }
.fb-face-label { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.15; }
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-chip {
  border: 2px solid transparent; border-radius: 999px; background: var(--chip-bg); color: var(--ink);
  padding: 7px 12px; font-size: 14px; min-height: 38px;
}
.fb-chip[aria-pressed="true"] { border-color: var(--gold); background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.fb-other { margin-top: 8px; }
.fb-text {
  font: inherit; font-size: 16px; width: 100%; box-sizing: border-box; resize: vertical; margin-top: 2px;
  padding: 10px 12px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.94); color: #111; outline: none;
}
.fb-text:focus { border-color: var(--gold); }
#fb-bug-text { margin-top: 8px; }

.review-dialog .rv-head { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.rv-big { font-size: 44px; line-height: 1; }
.rv-section { margin-top: 14px; }
.rv-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr 30px; align-items: center; gap: 8px; font-size: 13px; margin: 3px 0; }
.rv-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-track { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rv-bar { display: block; height: 100%; border-radius: 999px; background: var(--gold); }
.rv-bar.good { background: #2ec4b6; }
.rv-bar.bad { background: var(--danger); }
.rv-num { text-align: right; font-weight: 700; }
.rv-topic { margin-bottom: 8px; }
.rv-topic-name { font-size: 13px; font-weight: 600; }
.rv-topic .rv-row { grid-template-columns: 24px 1fr 30px; margin: 1px 0; }
.rv-meta { color: var(--muted); font-size: 12px; margin: 0; }
.rv-entry { background: var(--chip-bg); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
.rv-entry-head { display: flex; align-items: center; gap: 8px; }
.rv-entry-face { font-size: 22px; }
.rv-entry-head .rv-meta { flex: 1; }
.rv-del { border: 0; background: none; font-size: 16px; padding: 6px; min-width: 36px; min-height: 36px; }
.rv-line, .rv-text { margin: 4px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.rv-text { white-space: pre-wrap; }
.rv-text.bug { color: var(--error); }
.rv-devices { width: 100%; }
.review-dialog .rv-head { flex-wrap: wrap; }
.rv-section { border-top: 1px solid var(--line); padding-top: 10px; }
.rv-q { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 8px; font-size: 15px; }
.rv-q-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--primary); color: var(--primary-ink); font-size: 13px; font-weight: 800; margin-top: 1px;
}
.rv-row.wide, .rv-section .rv-row:has(.wide) { grid-template-columns: minmax(90px, 46%) 1fr 30px; }
.rv-sub { margin: 8px 0 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.rv-bullets { margin: 2px 0 0; padding-left: 20px; }
.rv-bullets li { margin: 4px 0; font-size: 14px; overflow-wrap: anywhere; }
.rv-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rv-none { font-style: italic; }
.rv-section .rv-row:has(.wide) .rv-label { white-space: normal; line-height: 1.2; }
.rv-all > summary { font-weight: 700; cursor: pointer; list-style: none; user-select: none; padding: 4px 0; }
.rv-all > summary::-webkit-details-marker { display: none; }
.rv-chevron { display: inline-block; width: 22px; text-align: center; transition: transform .15s; }
.rv-all[open] .rv-chevron { transform: rotate(90deg); }

/* Buttons in Dialogen (Flower Power): leicht gelb, damit sie sich vom hellen Hintergrund abheben –
   aber dezenter als der Haupt-Button („Fertig“) */
[data-theme="flower"] dialog .btn:not(.primary):not(.danger) {
  background: #fff0b8; box-shadow: inset 0 0 0 1.5px rgba(232, 180, 20, .45);
}
@media (hover: hover) {
  [data-theme="flower"] dialog .btn:not(.primary):not(.danger):hover { background: #ffe68a; }
}
