:root {
  --bg: #f3eee4;
  --ink: #1c2420;
  --ink-2: #5a645e;
  --ink-3: #8d958f;
  --line: #dcd3c2;
  --card: #fffcf6;
  --felt: #2a6b4f;
  --felt-2: #17402f;
  --felt-ink: #eef6f1;
  --accent: #b8323f;
  --gold: #d9a53a;
  --gold-soft: #f4e4bd;
  --sel: #e9a92a;
  --shadow: 0 1px 2px rgb(30 25 15 / .08), 0 8px 24px rgb(30 25 15 / .09);
  --radius: 14px;
  --paper: #fffdf8; --paper-2: #f3ecdc; --red: #c8213a; --blk: #1b1b1f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1714; --ink: #e9eeea; --ink-2: #a3aea7; --ink-3: #6c7770; --line: #24332c; --card: #16211c;
    --felt: #1f5540; --felt-2: #0e2a1f; --felt-ink: #e6f3ec; --accent: #ef5d6a; --gold: #e9b955; --gold-soft: #3a3119;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .35);
    --paper: #f6f1e6; --paper-2: #e6dcc6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1714; --ink: #e9eeea; --ink-2: #a3aea7; --ink-3: #6c7770; --line: #24332c; --card: #16211c;
  --felt: #1f5540; --felt-2: #0e2a1f; --felt-ink: #e6f3ec; --accent: #ef5d6a; --gold: #e9b955; --gold-soft: #3a3119;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .35);
  --paper: #f6f1e6; --paper-2: #e6dcc6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
a.btn { text-decoration: none; }
.serif { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }

/* ---------- Kopf ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; max-width: 1100px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { width: 30px; height: 30px; display: block; }
.brand span { font: italic 800 1.5rem/1 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.code-badge {
  font: 700 .95rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .18em;
  padding: 7px 10px 7px 12px; border-radius: 999px; background: var(--gold-soft); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); cursor: pointer;
}
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 24px; }

/* ---------- Buttons & Felder ---------- */
.btn {
  appearance: none; border-radius: 12px; padding: 10px 16px; cursor: pointer; font-weight: 650;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  transition: transform .08s, background .2s, opacity .2s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.dark { background: var(--ink); color: var(--bg); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.dashed { border-style: dashed; background: transparent; margin-top: 10px; }
.btn.block { width: 100%; }
.field { display: grid; gap: 6px; }
.field label { font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); min-height: 46px; }
.input:focus, .btn:focus-visible, .slot:focus-visible, .meld:focus-visible, .pile:focus-visible, .chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--gold) 65%, transparent); outline-offset: 2px; }
.input.code { text-transform: uppercase; letter-spacing: .4em; font: 700 1.4rem/1 ui-monospace, Menlo, monospace; text-align: center; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.err { color: var(--accent); font-size: .9rem; min-height: 1.2em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.card p { margin: 0 0 14px; }
.card form { display: grid; gap: 12px; }
.cards { display: grid; gap: 14px; align-content: start; }
.tag { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--ink); white-space: nowrap; }
.tag.bot { background: color-mix(in srgb, #3b5bdb 18%, transparent); }
.tag.hr { background: var(--accent); color: #fff; font-size: .62rem; padding: 2px 6px; }
.spacer { flex: 1; }
.link-btn { background: none; border: 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; padding: 4px; }
.rules-card summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.rules-card summary::-webkit-details-marker { display: none; }
.rules-card summary::after { content: "＋"; color: var(--ink-3); font-weight: 700; }
.rules-card[open] summary::after { content: "−"; }
.rules-card summary h2 { margin: 0; }
.rules { margin: 12px 0 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: .92rem; color: var(--ink-2); }
.rules b { color: var(--ink); }

/* ---------- Karten ---------- */
.pc {
  --w: 76px; --c: var(--blk);
  width: var(--w); height: calc(var(--w) * 1.4); flex: none; position: relative; overflow: hidden;
  border-radius: calc(var(--w) * .09); color: var(--c); user-select: none; -webkit-user-select: none;
  background: linear-gradient(160deg, var(--paper) 55%, var(--paper-2));
  box-shadow: 0 0 0 1px rgb(0 0 0 / .16), 0 1px 2px rgb(0 0 0 / .18), 0 4px 10px rgb(0 0 0 / .14);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
.pc.red { --c: var(--red); }
.pc .ix {
  position: absolute; display: grid; justify-items: center; line-height: .9; width: calc(var(--w) * .2);
}
.pc .ix b { font-weight: 700; font-size: calc(var(--w) * .22); letter-spacing: -.04em; }
.pc .ix i { font-style: normal; font-size: calc(var(--w) * .19); line-height: 1; }
.pc.r10 .ix b { letter-spacing: -.1em; font-size: calc(var(--w) * .2); margin-left: -.08em; }
.pc .ix.tl { left: calc(var(--w) * .035); top: calc(var(--w) * .05); }
.pc .ix.br { right: calc(var(--w) * .035); bottom: calc(var(--w) * .05); transform: rotate(180deg); }
.pc .pips { position: absolute; left: 31%; right: 31%; top: 17%; bottom: 17%; }
.pc .pips i {
  position: absolute; font-style: normal; font-size: calc(var(--w) * .19); line-height: 1;
  transform: translate(-50%, -50%);
}
.pc .pips i.dn { transform: translate(-50%, -50%) rotate(180deg); }
.pc.r2 .pips, .pc.r3 .pips { top: 17%; bottom: 17%; }
.pc .ace { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--w) * .62); line-height: 1; }
.pc .face {
  position: absolute; left: 22%; right: 22%; top: 13%; bottom: 13%; display: grid; place-items: center; align-content: center;
  border-radius: calc(var(--w) * .05);
  background: radial-gradient(120% 80% at 50% 40%, color-mix(in srgb, var(--c) 9%, transparent), transparent 70%);
}
.pc .face .orn { position: absolute; inset: 0; width: 100%; height: 100%; color: color-mix(in srgb, var(--c) 55%, transparent); }
.pc .face .crown { width: 46%; fill: #d9a53a; stroke: color-mix(in srgb, var(--c) 70%, #000); stroke-width: .8; margin-bottom: calc(var(--w) * -.02); }
.pc .face b { font-size: calc(var(--w) * .38); line-height: .95; font-weight: 700; font-style: italic; }
.pc .face i { font-style: normal; font-size: calc(var(--w) * .2); line-height: 1; }
.pc.joker { --c: #1b1b1f; background: linear-gradient(160deg, var(--paper) 50%, #f2e7cf); }
.pc.joker .ix i { color: #c8213a; }
.joker-art { position: absolute; left: 50%; top: 47%; width: 60%; transform: translate(-50%, -50%); }
.joker-word { position: absolute; left: 0; right: 0; bottom: 11%; text-align: center; font: 800 calc(var(--w) * .12)/1 "Iowan Old Style", Georgia, serif; letter-spacing: .14em; color: #c8213a; }

/* Mini-Karten (ausgelegte Kombinationen): nur Index sichtbar */
.pc.mini { --w: 46px; border-radius: 5px; }
.pc.mini .pips, .pc.mini .face, .pc.mini .ace, .pc.mini .ix.br, .pc.mini .joker-word { display: none; }
.pc.mini .ix { width: auto; left: 4px; top: 4px; }
.pc.mini .ix b { font-size: 15px; }
.pc.mini .ix i { font-size: 14px; }
.pc.mini::after { content: ""; position: absolute; inset: auto 0 0 0; height: 0; }
.pc.mini .joker-art { width: 70%; top: 66%; left: 54%; }
.pc.micro { --w: 24px; border-radius: 3px; }
.pc.micro .pips, .pc.micro .face, .pc.micro .ace, .pc.micro .ix.br, .pc.micro .joker-word, .pc.micro .joker-art { display: none; }
.pc.micro .ix { width: auto; left: 2px; top: 2px; }
.pc.micro .ix b { font-size: 10px; }
.pc.micro .ix i { font-size: 9px; }

.pc.back {
  background:
    repeating-linear-gradient(45deg, rgb(255 255 255 / .07) 0 3px, transparent 3px 7px),
    repeating-linear-gradient(-45deg, rgb(255 255 255 / .07) 0 3px, transparent 3px 7px),
    linear-gradient(160deg, #a52a3a, #6e1422);
  box-shadow: 0 0 0 calc(var(--w) * .045) var(--paper) inset, 0 0 0 1px rgb(0 0 0 / .25), 0 3px 8px rgb(0 0 0 / .25);
}
.back-mark {
  position: absolute; left: 50%; top: 50%; width: 42%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--paper); box-shadow: 0 0 0 2px #d9a53a;
}
.back-mark::after { content: "♠♥\A♣♦"; white-space: pre; position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font: calc(var(--w) * .13)/1 Georgia, serif; color: #6e1422; }
.pc.flyer { --w: 50px; position: fixed; z-index: 70; pointer-events: none; }

/* ---------- Startseite ---------- */
.hero { display: grid; gap: 28px; padding: 16px 0 8px; grid-template-columns: 1.1fr 1fr; align-items: center; }
.hero h1 { font: italic 800 clamp(2.4rem, 6.5vw, 4.2rem)/.98 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; margin: 0 0 14px; letter-spacing: -.01em; }
.hero h1 em { color: var(--accent); }
.hero p.lead { font-size: 1.1rem; color: var(--ink-2); max-width: 31rem; margin: 0; }
.fan { position: relative; height: clamp(170px, 34vw, 230px); margin: 30px 0 0; max-width: 420px; }
.fan-slot { position: absolute; left: 50%; bottom: 0; transform-origin: 50% 120%; transform: translateX(-50%) rotate(calc(var(--i) * 13deg)) translateY(calc(var(--a) * 6px)); transition: transform .3s; }
.fan-slot .pc { --w: clamp(84px, 16vw, 116px); }
.fan:hover .fan-slot { transform: translateX(-50%) rotate(calc(var(--i) * 17deg)) translateY(calc(var(--a) * 8px - 6px)); }
.leader { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.leader li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 8px 12px; border-radius: 10px; background: var(--bg); }
.leader .place { width: 1.5em; font-weight: 800; color: var(--ink-3); }
.leader .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.leader .wins b { font-variant-numeric: tabular-nums; }

/* ---------- Lobby ---------- */
.lobby { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; padding-top: 8px; align-items: start; }
.share-code { font: 800 clamp(2.8rem, 12vw, 4.5rem)/1 ui-monospace, Menlo, monospace; letter-spacing: .22em; text-align: center; padding: 18px 0 14px; }
.player-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.player-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.player-list .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9rem; flex: none; position: relative; line-height: 1; }
.avatar.sm { width: 22px; height: 22px; font-size: .7rem; }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); border: 2px solid var(--card); }
.avatar .dot.on { background: #3ccf6e; }
.opt-head { margin: 18px 0 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); margin: 8px 0 0; cursor: pointer; }
.opt.ro, .opt.seg-opt { cursor: default; }
.opt.seg-opt { align-items: center; }
.opt.seg-opt > span { flex: 1; }
.opt input { accent-color: var(--accent); width: 18px; height: 18px; margin-top: 2px; flex: none; }
.opt small { display: block; color: var(--ink-2); font-weight: 400; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--card); padding: 8px 14px; font-weight: 700; cursor: pointer; min-width: 48px; }
.seg button.on { background: var(--accent); color: #fff; }

/* ---------- Spiel ---------- */
.game { display: grid; gap: 12px; max-width: 980px; margin: 0 auto; grid-template-columns: minmax(0, 1fr); }
.game > * { min-width: 0; }
.opps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.opp {
  position: relative; min-width: 100px; max-width: 150px; padding: 6px 10px 7px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.opp.cur { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 50%, transparent), var(--shadow); transform: translateY(-2px); }
.opp-name { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: .9rem; }
.opp-name span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-meta { font-size: .76rem; color: var(--ink-2); white-space: nowrap; }
.mini-fan { height: 30px; position: relative; margin-bottom: 3px; }
.mini-fan i {
  position: absolute; left: 50%; bottom: 0; width: 18px; height: 26px; border-radius: 3px; transform-origin: 50% 140%;
  transform: translateX(-50%) rotate(calc(var(--k) * 8deg));
  background: linear-gradient(160deg, #a52a3a, #6e1422); box-shadow: 0 0 0 1.5px var(--paper), 0 1px 3px rgb(0 0 0 / .3);
}
.opened-flag {
  position: absolute; top: -8px; right: -6px; background: #2f8f5b; color: #fff; font: 800 .62rem/1 system-ui, sans-serif;
  padding: 4px 6px; border-radius: 999px; transform: rotate(6deg); box-shadow: 0 2px 6px rgb(0 0 0 / .25); letter-spacing: .03em;
}
.think { position: absolute; left: 8px; top: 8px; display: flex; gap: 2px; }
.think i { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); animation: blink 1s infinite; }
.think i:nth-child(2) { animation-delay: .2s; } .think i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }

.felt {
  position: relative; border-radius: 22px; padding: 18px 16px 34px;
  background:
    radial-gradient(120% 100% at 50% 20%, var(--felt), var(--felt-2) 85%);
  color: var(--felt-ink); box-shadow: inset 0 0 0 3px rgb(0 0 0 / .12), inset 0 0 40px rgb(0 0 0 / .25), var(--shadow);
}
.piles { display: flex; justify-content: center; align-items: center; gap: clamp(30px, 10vw, 70px); }
.pile { position: relative; --w: clamp(62px, 16vw, 86px); width: var(--w); height: calc(var(--w) * 1.4); border: 0; padding: 0; background: none; color: inherit; }
.pile:disabled { cursor: default; }
.pile .pc { --w: inherit; position: absolute; inset: 0; width: 100%; height: 100%; }
.draw-pile .d3 { transform: translate(-5px, 5px); }
.draw-pile .d2 { transform: translate(-2.5px, 2.5px); }
.pile.can { cursor: pointer; }
.draw-pile.can .d1 { animation: nudge 1.8s ease-in-out infinite; }
.pile.can:hover .d1 { transform: translateY(-6px) rotate(-3deg); animation: none; }
@keyframes nudge { 50% { transform: translateY(-5px) rotate(-2deg); } }
.pile-empty { position: absolute; inset: 0; border: 2px dashed rgb(255 255 255 / .3); border-radius: 10px; display: grid; place-items: center; font-size: .75rem; opacity: .7; }
.deck-count {
  position: absolute; left: -12px; top: -10px; z-index: 2; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center; background: #fff; color: #1b2030; font: 800 .78rem/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums; box-shadow: 0 2px 6px rgb(0 0 0 / .3);
}
.pile-card { position: absolute; inset: 0; }
.pile-card .pc { transform: rotate(var(--r)) translate(calc(var(--o) * -2px), calc(var(--o) * 1px)); }
.discard.can .pile-top .pc { box-shadow: 0 0 0 3px var(--gold), 0 8px 18px rgb(0 0 0 / .35); }
.discard.drop::after {
  content: "hier ablegen"; position: absolute; z-index: 5; left: 50%; top: -12px; transform: translateX(-50%); white-space: nowrap;
  font-size: .72rem; font-weight: 700; background: var(--gold); color: #241a00; padding: 3px 8px; border-radius: 999px;
}
.discard.drop { cursor: pointer; }
.discard.drop .pile-top .pc, .discard.drop .pile-empty { box-shadow: 0 0 0 3px var(--gold); }
.felt-info { position: absolute; left: 14px; right: 14px; bottom: 8px; display: flex; justify-content: space-between; font-size: .72rem; opacity: .75; font-weight: 600; }

/* Tisch mit ausgelegten Kombinationen */
.table { display: grid; gap: 8px; }
.table-empty { margin: 0; text-align: center; color: var(--ink-3); font-size: .88rem; }
.pmelds { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px 8px; }
.pmelds.mine { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.pm-head { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--ink-2); margin: 0 0 5px 2px; }
.meld-row { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.meld {
  display: flex; padding: 4px 6px 4px 4px; border-radius: 10px; border: 1px solid transparent; background: color-mix(in srgb, var(--felt) 10%, transparent);
  cursor: default; transition: transform .15s, box-shadow .2s;
}
.meld .pc.mini + .pc.mini { margin-left: -24px; }
.meld .pc.mini { box-shadow: 0 0 0 1px rgb(0 0 0 / .2), -2px 0 4px rgb(0 0 0 / .08); }
.meld.target { cursor: pointer; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 45%, transparent); animation: glow 1.4s ease-in-out infinite; }
.meld.target.swap { border-style: dashed; }
.meld.target:hover { transform: translateY(-2px); }
.meld.fresh { animation: fresh 1.2s ease-out; }
@keyframes glow { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 25%, transparent); } }
@keyframes fresh { from { background: color-mix(in srgb, var(--gold) 45%, transparent); } }

/* Dock unten: Status, Aktionen, Hand */
.dock {
  position: sticky; bottom: 0; z-index: 20; display: grid; gap: 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  margin: 0 -16px; padding: 8px 16px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); grid-template-columns: minmax(0, 1fr);
}
.dock > *, .hand-wrap, .table > *, .pmelds { min-width: 0; }
.status { display: grid; gap: 6px; text-align: center; }
.turn-line { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; min-height: 24px; }
.turn-line strong { font-size: 1.05rem; }
.my-turn .turn-line strong { color: var(--accent); }
.hint { font-size: .88rem; color: var(--ink-2); min-height: 1.3em; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; min-height: 44px; }
.staged { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.staged-grp { position: relative; display: flex; border: 1px dashed var(--gold); background: var(--gold-soft); border-radius: 10px; padding: 4px 6px 4px 4px; cursor: pointer; }
.staged-grp .pc.mini + .pc.mini { margin-left: -26px; }
.staged-grp .x { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 800; display: grid; place-items: center; font-size: .8rem; line-height: 1; }
.staged-sum { font-size: .8rem; font-weight: 700; color: var(--ink-2); }

.hand-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 6px 0 2px; }
.hand-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 12px; font-size: .78rem; font-weight: 700; color: var(--ink-2); }
.hand-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sorters { display: flex; gap: 6px; flex: none; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 3px 9px; font-size: .74rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.hand {
  --gap: 6px; display: flex; justify-content: safe center; overflow-x: auto; overflow-y: visible;
  padding: 22px 10px 10px; scrollbar-width: thin; touch-action: pan-x;
}
.hand .pc { --w: clamp(58px, 15.5vw, 84px); }
.slot { flex: none; position: relative; transition: margin .15s; outline: none; cursor: pointer; touch-action: pan-x; }
.slot + .slot { margin-left: var(--gap); }
.slot .pc { transition: transform .15s, box-shadow .2s; }
.slot:hover .pc { transform: translateY(-6px); }
.slot.sel .pc { transform: translateY(-18px); box-shadow: 0 0 0 3px var(--sel), 0 10px 18px rgb(0 0 0 / .28); }
.slot.taken::before { content: "neu"; position: absolute; top: -18px; left: 4px; z-index: 2; font-size: .62rem; font-weight: 800; color: var(--accent); }
.slot.must .pc { box-shadow: 0 0 0 3px var(--accent), 0 6px 14px rgb(0 0 0 / .25); }
.slot.dragging { z-index: 100 !important; transition: none; }
.slot.dragging .pc { box-shadow: 0 0 0 3px var(--gold), 0 14px 24px rgb(0 0 0 / .35); }
.slot.gap-before { margin-left: calc(var(--gap) + 26px); }
.hand.gap-end { padding-right: 36px; }
.slot.leaving { opacity: .25; }

.log { font-size: .85rem; }
.log summary { cursor: pointer; color: var(--ink-2); font-weight: 600; padding: 4px 0; width: max-content; }
.log-list { display: grid; gap: 5px; max-height: 220px; overflow: auto; margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.log-list div { display: flex; gap: 8px; align-items: baseline; color: var(--ink-2); }
.log-list div:first-child { color: var(--ink); font-weight: 600; }
.log-list time { opacity: .6; font-variant-numeric: tabular-nums; flex: none; }
.score-scroll { overflow-x: auto; margin-top: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.scores { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .82rem; }
.scores th, .scores td { padding: 5px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.scores th:first-child, .scores td:first-child { text-align: left; }
.scores td.win { color: #2f8f5b; font-weight: 800; }
.scores tfoot th { border-bottom: 0; }

.reclaim-box { display: grid; gap: 6px; margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px dashed currentColor; text-align: left; }
.reclaim-box .small { opacity: .8; }
.reclaim-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.btn.reclaim { min-height: 40px; padding: 6px 12px 6px 8px; }

/* ---------- Dialoge ---------- */
.picker, .overlay {
  position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 65%, transparent); backdrop-filter: blur(6px); animation: fade .25s ease-out;
}
.picker { z-index: 65; }
@keyframes fade { from { opacity: 0; } }
.picker-card, .win-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  padding: 20px; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
}
.picker-card h2 { margin: 0 0 4px; }
.picker-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 8px; }
.picker-btns .btn:only-child { grid-column: 1 / -1; }

/* ---------- Ergebnis ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
.win-card { text-align: center; width: min(480px, 100%); }
.trophy { width: 140px; height: 156px; margin: -6px auto 2px; display: block; animation: drop 1s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes drop { 0% { transform: translateY(-80px) scale(.6) rotate(-8deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.trophy .shine { animation: shine 2.4s ease-in-out infinite 1s; }
@keyframes shine { 0%, 100% { opacity: .2; } 50% { opacity: .9; } }
.trophy .spark { animation: twinkle 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.trophy .spark:nth-of-type(2) { animation-delay: .5s; }
.trophy .spark:nth-of-type(3) { animation-delay: 1s; }
@keyframes twinkle { 0%, 100% { transform: scale(.3); opacity: .2; } 50% { transform: scale(1); opacity: 1; } }
.win-card h2 { font: italic 800 1.9rem/1.05 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; margin: 6px 0 4px; }
.win-card .pts { color: var(--ink-2); margin-bottom: 12px; }
.col-head { display: flex; justify-content: flex-end; gap: 22px; margin: 0 14px 4px; font-size: .72rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.ranking { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; text-align: left; }
.ranking li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 12px; border-radius: 10px; background: var(--bg); }
.ranking li.top { box-shadow: inset 0 0 0 2px var(--gold); }
.ranking .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-weight: 650; }
.ranking .rp { min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.ranking .rp .neg { color: var(--accent); }
.ranking .rp .ok { color: #2f8f5b; }
.ranking .tot { min-width: 4.4em; text-align: right; font-variant-numeric: tabular-nums; font-size: .88rem; }
.ranking .place { width: 1.4em; font-weight: 800; color: var(--ink-3); }
.left-hand { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 2px; padding-left: 2.2em; }
.alltime { text-align: left; margin: 0 0 14px; font-size: .9rem; }
.alltime summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.win-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.win-actions .btn.primary { grid-column: 1 / -1; }
.win-actions .btn.ghost { border-color: var(--line); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 90;
  box-shadow: var(--shadow); max-width: calc(100% - 32px); font-weight: 600; text-align: center;
}

/* ---------- Responsiv ---------- */
@media (min-width: 900px) {
  .game { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-areas: "opps opps" "felt table" "dock dock" "log log"; align-items: start; }
  .opps { grid-area: opps; } .felt { grid-area: felt; } .table { grid-area: table; } .log { grid-area: log; } .dock, .game > .status { grid-area: dock; }
  .felt { min-height: 190px; display: grid; align-items: center; }
}
@media (max-width: 860px) {
  .hero, .lobby { grid-template-columns: 1fr; }
  .fan { margin: 24px auto 0; }
}
@media (max-width: 520px) {
  main { padding: 0 10px 0; }
  .dock { margin: 0 -10px; padding-left: 10px; padding-right: 10px; }
  .opps { gap: 6px; }
  .opp { min-width: 0; flex: 1 1 28%; max-width: 32%; padding: 5px 6px 6px; }
  .opp-name { font-size: .8rem; }
  .opp-meta { font-size: .7rem; }
  .mini-fan { height: 22px; }
  .mini-fan i { width: 13px; height: 19px; }
  .felt { padding: 14px 12px 28px; border-radius: 18px; }
  .actions .btn { flex: 1 1 28%; padding: 8px 10px; min-height: 42px; font-size: .92rem; }
  .meld .pc.mini { --w: 40px; }
  .meld .pc.mini + .pc.mini { margin-left: -21px; }
  .pc.mini .ix b { font-size: 13px; }
  .pc.mini .ix i { font-size: 12px; }
  .hand { padding: 20px 6px 8px; }
  .hand-wrap { border-radius: 14px; }
  .win-card h2 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
.actions .btn { white-space: nowrap; }
.staged .pc.mini { --w: 34px; }
.staged .pc.mini .ix b { font-size: 12px; }
.staged .pc.mini .ix i { font-size: 11px; }
.staged-grp .pc.mini + .pc.mini { margin-left: -16px; }
@media (max-width: 520px) { .actions .btn { flex: 1 1 0; min-width: 0; padding: 8px 6px; } }
