:root {
  --night: #0b0820;
  --night-soft: #151033;
  --plum: #2a1645;
  --plum-light: #4b2b67;
  --lavender: #b9b4ee;
  --mist: #eeeaff;
  --muted: #9e98c0;
  --gold: #f3c76d;
  --gold-light: #ffe7a6;
  --rose: #f4a5b7;
  --card: #f6f0e7;
  --card-ink: #271c39;
  --line: rgba(228, 219, 255, 0.15);
  --shadow: 0 18px 45px rgba(3, 1, 13, 0.48);
  --card-shadow: 0 12px 28px rgba(5, 2, 16, 0.45), 0 2px 5px rgba(5, 2, 16, 0.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }
html { background: var(--night); }

body {
  margin: 0;
  color: var(--mist);
  font-family: Avenir Next, Avenir, Montserrat, "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at 50% 46%, rgba(112, 76, 151, 0.24), transparent 34%),
    radial-gradient(circle at 15% 12%, rgba(80, 70, 151, 0.3), transparent 28%),
    linear-gradient(155deg, #17113a 0%, var(--night) 55%, #090719 100%);
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  opacity: 0.48;
  background-image:
    radial-gradient(circle at 7% 17%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 18% 65%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 29% 29%, #fff 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 43% 8%, #fff 0 1px, transparent 1.7px),
    radial-gradient(circle at 61% 22%, #fff 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 74% 11%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 88% 32%, #fff 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 94% 72%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 54% 76%, #fff 0 0.8px, transparent 1.5px);
  background-size: 420px 360px;
}

body::after {
  background: linear-gradient(90deg, rgba(4, 2, 14, 0.28), transparent 22% 78%, rgba(4, 2, 14, 0.28));
  mix-blend-mode: multiply;
}

.night-sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.cloud {
  position: absolute;
  width: 42vw;
  height: 16vw;
  border-radius: 50%;
  background: rgba(143, 128, 189, 0.055);
  filter: blur(32px);
}
.cloud-one { left: -12vw; top: 18%; transform: rotate(10deg); }
.cloud-two { right: -14vw; bottom: 9%; transform: rotate(-8deg); }

#app {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(clamp(14px, 4vw, 34px), env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(clamp(14px, 4vw, 34px), env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  z-index: 5;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  display: block;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 1px solid rgba(255, 231, 166, .3);
  border-radius: 14px;
  background: url("assets/nachtlicht-icon-192.png") center / cover no-repeat;
  box-shadow: 0 6px 18px rgba(5, 2, 20, .3), 0 0 18px rgba(185, 180, 238, .18);
}

.eyebrow {
  margin: 0 0 -2px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}
.topbar h1 {
  margin: 0;
  color: #fffaf0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(27px, 4vw, 38px);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
}

.round-pill {
  margin: 0;
  padding: 9px 14px;
  color: #d6d0ec;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.045em;
  background: rgba(31, 21, 61, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}
.round-icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #dcd6ef;
  font-size: 16px;
  line-height: 1;
  background: rgba(31, 21, 61, .72);
  border-color: var(--line);
  box-shadow: inset 0 1px rgba(255, 255, 255, .04);
}
.round-icon:hover { color: var(--gold-light); background: rgba(57, 37, 82, .9); }

#table {
  position: relative;
  flex: 1;
  margin-top: 8px;
  padding: 16px clamp(12px, 3.5vw, 38px) 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(14px, 2.4vh, 30px);
  isolation: isolate;
}

#table::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 2% 0 0;
  border: 1px solid rgba(203, 188, 232, 0.1);
  border-radius: 48% 48% 40% 40% / 22% 22% 28% 28%;
  background:
    radial-gradient(ellipse at 50% 54%, rgba(72, 41, 91, 0.62), rgba(28, 17, 55, 0.86) 58%, rgba(17, 11, 39, 0.92) 100%);
  box-shadow: inset 0 0 90px rgba(7, 3, 23, 0.5), 0 35px 70px rgba(2, 1, 8, 0.26);
}

.table-glow {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 46%;
  width: min(430px, 64vw);
  aspect-ratio: 2 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(237, 190, 107, 0.09);
  filter: blur(35px);
}

.opponents {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 3vw, 28px);
}

.seat {
  min-width: 170px;
  padding: 9px 10px 10px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(14, 9, 34, 0.28);
  transition: 180ms ease;
}
.seat.active {
  border-color: rgba(243, 199, 109, 0.52);
  background: rgba(46, 28, 65, 0.67);
  box-shadow: 0 0 26px rgba(243, 199, 109, 0.11), inset 0 0 24px rgba(243, 199, 109, 0.035);
}
.seat .name { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.player-identity { display: flex; align-items: center; gap: 7px; color: #ddd8ef; font-size: 11px; font-weight: 700; }
.avatar {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background-color: #2d224c;
  background-size: cover;
  background-position: center 20%;
  background-repeat: no-repeat;
  border: 1px solid rgba(255,255,255,.12);
}
.seat .score { display: flex; align-items: baseline; gap: 4px; color: #aaa4c8; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.seat .score b { color: var(--gold-light); font-size: 14px; line-height: 1; }
.mini-hand { display: flex; justify-content: center; gap: 5px; }

.card {
  --w: 72px;
  --h: 102px;
  position: relative;
  width: var(--w);
  height: var(--h);
  flex: 0 0 var(--w);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  box-shadow: var(--card-shadow);
  user-select: none;
  transform-origin: center bottom;
}

.mini-hand .card { --w: 32px; --h: 47px; border-radius: 7px; box-shadow: 0 5px 12px rgba(2,1,10,.38); }

.card.back {
  color: transparent;
  background-image: url("assets/card-back.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(221, 214, 255, .33);
  box-shadow: inset 0 0 0 3px rgba(13, 9, 34, .4), inset 0 0 0 4px rgba(222, 215, 255, .12), var(--card-shadow);
}
.card.back::before,
.card.back::after { content: none; }
.card.back span { display: none; }

.card.empty {
  border: 1px dashed rgba(211, 201, 236, .2);
  background: rgba(12, 8, 29, .22);
  box-shadow: inset 0 0 25px rgba(0,0,0,.15);
}
.card.empty::after {
  content: "";
  width: 24%;
  aspect-ratio: 1;
  border: 1px solid rgba(211, 201, 236, .12);
  border-radius: 50%;
}

.card.face {
  color: var(--card-ink);
  background:
    radial-gradient(circle at 75% 20%, rgba(255,255,255,.8), transparent 28%),
    linear-gradient(160deg, #fffaf1, #e9dfd4);
  border: 1px solid rgba(255, 255, 255, .82);
  box-shadow: inset 0 0 0 3px rgba(95, 65, 111, .075), var(--card-shadow);
}
.card.face::after {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: 0;
  border: 1px solid rgba(78, 46, 96, .12);
  border-radius: 9px;
  pointer-events: none;
}
.card.face .corner {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 9px;
  color: #49305f;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.card.face .ghost-art {
  position: absolute;
  z-index: 1;
  left: 8%;
  top: 18%;
  width: 84%;
  height: 65%;
  background-repeat: no-repeat;
  background-size: 500% 200%;
  background-position: var(--gx, 0%) var(--gy, 0%);
  filter: drop-shadow(0 4px 4px rgba(44, 29, 70, .18));
}
.card.face .ghost-art.ghost-5 {
  left: 15%;
  top: 17%;
  width: 70%;
  height: 68%;
  background-image: url("assets/ghost-5.webp");
  background-size: contain;
  background-position: center;
}
/* Aktionskarten + Joker: einzelne Vollfigur-PNG statt Sprite-Sheet. */
.card.face .ghost-art.art-figure {
  left: 13%;
  top: 15%;
  width: 74%;
  height: 70%;
  background-size: contain;
  background-position: center;
}
.card.face .tag {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 8px;
  color: #756781;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .15em;
  text-align: center;
  text-transform: uppercase;
}

.card.face.action {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 231, 166, .5), transparent 38%),
    linear-gradient(155deg, #f6ead1, #d9c39a);
  box-shadow: inset 0 0 0 3px rgba(92, 58, 57, .08), var(--card-shadow);
}
.card.face.action .corner { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.card.face.action .action-art,
.card.face.joker .action-art {
  position: relative;
  z-index: 2;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #52325e;
  font-family: Georgia, serif;
  font-size: 31px;
  background: rgba(255, 250, 232, .64);
  border: 1px solid rgba(111, 74, 93, .18);
  box-shadow: 0 5px 15px rgba(83, 49, 76, .14);
}
.card.face.joker {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 232, 143, .62), transparent 40%),
    linear-gradient(155deg, #e2dcf2, #b9a8d4);
  box-shadow: 0 0 28px rgba(246, 201, 106, .32), var(--card-shadow);
}
.card.face.joker .corner { color: #7e4f3a; }
.card.face.joker .action-art {
  color: #f0a13e;
  font-size: 36px;
  text-shadow: 0 0 12px rgba(255, 199, 87, .65);
}

.mini-hand .card.face .corner { top: 4px; left: 5px; font-size: 10px; }
.mini-hand .card.face .ghost-art { top: 18%; }
.mini-hand .card.face .tag { display: none; }
.mini-hand .card.face .action-art,
.mini-hand .card.face.joker .action-art { width: 21px; height: 21px; font-size: 13px; }
.mini-hand .card.face.action .corner { font-size: 7px; }

.card.selectable { cursor: pointer; }
.card.selectable:hover { transform: translateY(-7px) rotate(-1deg); transition: transform .16s ease, filter .16s ease; filter: brightness(1.04); }
.card.selectable:focus-visible { outline: 3px solid #fff2bd; outline-offset: 4px; }
.card.picked { outline: 3px solid var(--gold); outline-offset: 3px; }
.card.just-swapped {
  outline: 3px solid #a9dff0;
  outline-offset: 3px;
  animation: swapland .55s ease;
}
/* Getauschtes Feld: ruhiger, deutlicher Goldring (kein Blinken) + Badge. */
.card.changed {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 22px rgba(243, 199, 109, .5), var(--card-shadow);
}
.swap-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 6;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe9aa, #e4b95f);
  color: #2e203b;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 3px 9px rgba(3, 1, 12, .5);
  animation: badgein .28s ease;
}
@keyframes badgein { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
/* Ziel-Markierung: ruhige, statische gestrichelte Kontur (kein Dauerpuls). */
.card.target { outline: 2px dashed rgba(243, 199, 109, .6); outline-offset: 4px; }

@keyframes swapland {
  0% { transform: translateY(-18px) rotate(3deg) scale(1.07); }
  65% { transform: translateY(2px) rotate(-1deg); }
  100% { transform: none; }
}
@keyframes changedpulse {
  0%, 100% { box-shadow: var(--card-shadow); }
  50% { box-shadow: 0 0 23px rgba(243, 199, 109, .72), var(--card-shadow); }
}
@keyframes targetpulse {
  0%, 100% { outline-color: rgba(243, 199, 109, .25); }
  50% { outline-color: rgba(243, 199, 109, .82); }
}

.center {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 5vw, 64px);
  padding: 4px 0;
}
.pile { position: relative; text-align: center; }
.pile label { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.pile label small { color: #aaa3c6; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.pile label strong { color: #d9d3ea; font-size: 12px; font-weight: 650; }
.pile.clickable .card { cursor: pointer; box-shadow: 0 0 22px rgba(173, 158, 225, .22), var(--card-shadow); }
.pile.clickable .card:hover { transform: translateY(-6px) rotate(1deg); transition: transform .16s ease; }
#deck .card::marker { display: none; }
#deck::before,
#deck::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 3px;
  left: 3px;
  width: 72px;
  height: 102px;
  border-radius: 13px;
  background: #211942;
  border: 1px solid rgba(212, 203, 238, .14);
  transform: rotate(3deg);
}
#deck::after { left: -2px; transform: rotate(-3deg); }
@keyframes deckglow {
  0%, 100% { box-shadow: inset 0 0 0 3px rgba(13,9,34,.4), inset 0 0 0 4px rgba(222,215,255,.12), var(--card-shadow); }
  50% { box-shadow: inset 0 0 0 3px rgba(13,9,34,.4), inset 0 0 0 4px rgba(222,215,255,.12), 0 0 26px rgba(173,158,225,.22), var(--card-shadow); }
}

.drawn {
  width: 78px;
  min-height: 126px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.drawn:empty::before {
  content: "gezogene Karte";
  width: 60px;
  color: rgba(181, 172, 207, .35);
  font-family: Georgia, serif;
  font-size: 10px;
  font-style: italic;
  line-height: 1.3;
  text-align: center;
}
.drawn .card { animation: pop .22s ease; }
.drawn-cap { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
@keyframes pop { from { transform: scale(.72) rotate(-5deg); opacity: 0; } to { transform: none; opacity: 1; } }

.player-area { align-self: stretch; width: 100%; }
.player-label {
  width: min(560px, 100%);
  margin: 0 auto 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: #e0daf0;
}
.player-label span { font-family: Georgia, serif; font-size: 13px; }
.player-ghost { display: inline-flex; align-items: center; gap: 7px; }
.player-ghost img { width: 25px; height: 25px; object-fit: contain; border-radius: 8px; filter: drop-shadow(0 3px 5px rgba(3,1,13,.35)); }
.player-ghost b { font-weight: 500; }
.player-label i { color: #aaa3c6; font-size: 10px; font-style: normal; letter-spacing: .07em; text-transform: uppercase; }
.me { display: flex; justify-content: center; align-items: stretch; gap: clamp(8px, 2.2vw, 16px); width: min(560px, 100%); margin: 0 auto; }
.me .card { flex: 1 1 0; width: auto; height: auto; max-width: 124px; aspect-ratio: 5 / 7; border-radius: 15px; }
.me .card.face .corner { font-size: clamp(20px, 2.8vw, 27px); }
.me .card.face .tag { bottom: 10px; font-size: 9px; }
.me .card.face .action-art,
.me .card.face.joker .action-art { width: clamp(48px, 6vw, 62px); height: clamp(48px, 6vw, 62px); font-size: clamp(29px, 4vw, 39px); }

.controls {
  width: min(760px, calc(100% - 18px));
  margin: 12px auto 0;
  padding: 9px 12px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid rgba(220, 209, 244, .12);
  border-radius: 18px;
  background: rgba(18, 12, 39, .74);
  box-shadow: 0 12px 32px rgba(3,1,12,.26), inset 0 1px rgba(255,255,255,.025);
  backdrop-filter: blur(16px);
}
.hint-wrap { min-width: 220px; flex: 1 1 auto; display: flex; align-items: center; gap: 10px; }
.hint-orb {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(243, 199, 109, .75);
}
.hint { margin: 0; color: #d3cee3; font-size: 10px; line-height: 1.35; }
/* Fixer Balken: Hint und Button-Reihe belegen konstante Hoehe, damit beim
   Ein-/Ausblenden von Buttons nichts springt. */
.hint-wrap { min-height: 34px; }
.buttons { flex: 0 0 auto; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: nowrap; }

button {
  min-height: 35px;
  padding: 8px 15px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  color: #2e203b;
  font: inherit;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .025em;
  background: linear-gradient(180deg, #ffe9aa, #e4b95f);
  box-shadow: 0 5px 15px rgba(211, 155, 57, .18), inset 0 1px rgba(255,255,255,.55);
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}
button:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 7px 18px rgba(211,155,57,.25); }
button:focus-visible { outline: 2px solid #fff2bd; outline-offset: 3px; }
button:disabled { opacity: .42; cursor: not-allowed; transform: none; }
button.ghost { color: #f2d181; background: transparent; border-color: rgba(242, 209, 129, .48); box-shadow: none; }
button.ghost:hover { color: #2e203b; background: #f2d181; }
button.secondary { color: #ddd7ed; background: rgba(255,255,255,.04); border-color: rgba(222,215,240,.2); box-shadow: none; }
button.secondary:hover { color: #fff; background: rgba(255,255,255,.09); box-shadow: none; }
button.danger-soft { color: #ffd6df; background: rgba(155, 60, 84, .14); border-color: rgba(244,165,183,.28); box-shadow: none; }
button.danger-soft:hover { color: #fff; background: rgba(171, 66, 92, .3); box-shadow: none; }

.scorecard { width: 100%; padding: 4px 2px; }
.scorecard .win-art { display: block; width: 104px; height: auto; margin: 0 auto 4px; filter: drop-shadow(0 6px 10px rgba(3,1,13,.5)); }
.scorecard h3 { margin: 0 0 5px; color: var(--gold-light); font-family: Georgia, serif; font-size: 14px; font-weight: 500; }
.scorecard .row { display: flex; justify-content: space-between; padding: 3px 0; color: #cbc5db; font-size: 11px; }
.scorecard .row.win b { color: var(--gold); }
.scorecard .row .rs { color: var(--muted); }
.score-detail { display: flex; align-items: baseline; justify-content: flex-end; gap: 9px; text-align: right; }
.score-detail .rs { max-width: 24ch; font-size: 10px; line-height: 1.25; }

.signature { margin: 10px 0 0; color: rgba(164, 156, 189, .42); font-family: Georgia, serif; font-size: 9px; font-style: italic; text-align: center; }

/* Start-Overlay mit Runden-Auswahl */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: rgba(6, 3, 18, .72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.overlay[hidden] { display: none; }
.start-card {
  width: min(400px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 30px 26px 24px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(46, 30, 76, .96), rgba(19, 13, 42, .97));
  box-shadow: var(--shadow);
}
.start-card .eyebrow { justify-content: center; text-align: center; }
.start-logo {
  width: 58px;
  height: 58px;
  flex-basis: 58px;
  margin: 0 auto 10px;
  border-radius: 18px;
}
.start-card h2 {
  margin: 2px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: 34px;
  color: #fffaf0;
}
.start-lead { margin: 0 auto 14px; max-width: 34ch; color: var(--muted); font-size: 13px; line-height: 1.5; }
.ghost-picker { min-width: 0; margin: 0 0 15px; padding: 0; border: 0; }
.ghost-picker legend { width: 100%; margin: 0 0 8px; padding: 0; color: #cfc8e6; font-size: 12px; text-align: center; }
.ghost-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.ghost-choice {
  min-width: 0;
  min-height: 84px;
  padding: 7px 4px 6px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  border-radius: 16px;
  color: #dcd6ef;
  background: rgba(255,255,255,.035);
  border-color: rgba(222,215,240,.14);
  box-shadow: none;
}
.ghost-choice:hover { color: #fff; background: rgba(255,255,255,.08); box-shadow: none; }
.ghost-choice img {
  width: 48px;
  height: 48px;
  display: block;
  object-fit: contain;
  border-radius: 14px;
  filter: drop-shadow(0 5px 7px rgba(3,1,13,.35));
}
.ghost-choice span { font-size: 10px; font-weight: 800; }
.ghost-choice.on {
  color: #2e203b;
  border-color: rgba(255,231,166,.72);
  background: linear-gradient(180deg, #ffe9aa, #e4b95f);
  box-shadow: 0 6px 16px rgba(211,155,57,.16), inset 0 1px rgba(255,255,255,.5);
}
.ghost-choice.on img { background: rgba(38,24,58,.1); }
.rounds { display: flex; flex-direction: column; align-items: center; gap: 9px; margin-bottom: 16px; }
.rounds-label { color: #cfc8e6; font-size: 12px; letter-spacing: .03em; }
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(12, 8, 29, .5);
}
.seg button {
  min-height: 46px;
  min-width: 60px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #cfc8e6;
  box-shadow: none;
  font-size: 16px;
}
.seg button:hover { transform: none; filter: none; background: rgba(255, 255, 255, .05); }
.seg button.on { background: linear-gradient(180deg, #ffe9aa, #e4b95f); color: #2e203b; }
.start-go { width: 100%; min-height: 54px; font-size: 14px; }
.resume-panel { margin: 0 0 14px; padding: 13px; border: 1px solid rgba(243,199,109,.24); border-radius: 16px; background: rgba(243,199,109,.07); }
.resume-panel p { margin: 0 0 10px; }
.resume-panel strong { display: block; color: var(--gold-light); font-family: Georgia, serif; font-size: 16px; font-weight: 500; }
.resume-panel small { display: block; margin-top: 3px; color: #bbb3d0; font-size: 11px; }
.resume-panel button { width: 100%; min-height: 48px; }
.new-game-divider { display: block; margin: 1px 0 11px; color: #8f87a9; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.start-card.has-resume .start-lead { display: none; }

/* Gemeinsame Dialoge: Tutorial, Regeln und Einstellungen */
.modal-card {
  position: relative;
  width: min(430px, 100%);
  max-height: min(720px, calc(100dvh - 48px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 30px 28px 26px;
  border: 1px solid rgba(225, 216, 249, .17);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0, rgba(104, 72, 139, .32), transparent 37%),
    linear-gradient(160deg, rgba(45, 29, 75, .98), rgba(17, 11, 39, .99));
  box-shadow: var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: rgba(204,194,225,.38) transparent;
}
.modal-card::-webkit-scrollbar, .rules-content::-webkit-scrollbar { width: 7px; }
.modal-card::-webkit-scrollbar-track, .rules-content::-webkit-scrollbar-track { background: transparent; }
.modal-card::-webkit-scrollbar-thumb, .rules-content::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(204,194,225,.3); }
.modal-card h2 {
  margin: 4px 0 12px;
  color: #fffaf0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.08;
}
.modal-copy { margin: 0 auto; max-width: 34ch; color: #c8c2dc; font-size: 14px; line-height: 1.55; }
.modal-close {
  position: absolute;
  z-index: 3;
  top: 16px;
  right: 18px;
  min-height: 38px;
  padding: 6px 10px;
  color: #cfc8e3;
  font-size: 11px;
  background: rgba(12, 8, 29, .42);
  border-color: rgba(255,255,255,.1);
  box-shadow: none;
}
.modal-close:hover { color: #fff; background: rgba(255,255,255,.08); box-shadow: none; }
.modal-close.icon-close { width: 40px; min-width: 40px; padding: 0; font-size: 25px; font-weight: 400; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.modal-actions button { min-height: 46px; }

.tutorial-card { padding-top: 24px; text-align: center; overflow: hidden; }
.tutorial-art {
  position: relative;
  width: 190px;
  height: 170px;
  margin: 22px auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 157, .18), rgba(118, 89, 158, .11) 48%, transparent 69%);
}
.tutorial-art::before,
.tutorial-art::after {
  content: "";
  position: absolute;
  width: 42px;
  height: 58px;
  border-radius: 8px;
  background: url("assets/card-back.webp") center / cover;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 8px 15px rgba(2,1,10,.35);
}
.tutorial-art::before { left: 11px; bottom: 24px; transform: rotate(-12deg); }
.tutorial-art::after { right: 11px; bottom: 24px; transform: rotate(12deg); }
.tutorial-art img {
  position: relative;
  z-index: 2;
  width: 125px;
  height: 135px;
  object-fit: contain;
  filter: drop-shadow(0 12px 15px rgba(4,2,16,.48));
}
.tutorial-art.step-action img { width: 145px; height: 145px; }
.tutorial-art.step-action::before { transform: translateX(20px) rotate(-8deg); }
.tutorial-art.step-action::after { transform: translateX(-20px) rotate(8deg); }
.tutorial-art.step-lights img { width: 132px; height: 142px; }
.tutorial-art.step-lights::before,
.tutorial-art.step-lights::after { opacity: .45; transform: translateY(9px) scale(.86) rotate(-8deg); }
.tutorial-art.step-lights::after { transform: translateY(9px) scale(.86) rotate(8deg); }
.tutorial-moon { display: none; }
.tutorial-dots { display: flex; justify-content: center; gap: 7px; margin: 20px 0 0; }
.tutorial-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(202,194,225,.22); transition: width .18s ease, background .18s ease; }
.tutorial-dots span.on { width: 22px; border-radius: 999px; background: var(--gold); }
.tutorial-actions { justify-content: center; }
.tutorial-actions button { min-width: 130px; }

.rules-card {
  width: min(520px, 100%);
  height: min(510px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
.rules-heading { position: relative; padding: 28px 28px 13px; }
.rules-heading h2 { margin-bottom: 5px; }
.rules-heading > p:last-child { margin: 0; color: #aaa3c1; font-size: 12px; }
.rules-tabs {
  margin: 0 28px 15px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border: 1px solid rgba(222,215,240,.12);
  border-radius: 999px;
  background: rgba(10,7,26,.38);
}
.rules-tabs button {
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  color: #bbb4d0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  font-size: 10px;
}
.rules-tabs button:hover { transform: none; color: #fff; background: rgba(255,255,255,.05); box-shadow: none; }
.rules-tabs button.on { color: #30213e; background: linear-gradient(180deg, #ffe9aa, #e4b95f); box-shadow: inset 0 1px rgba(255,255,255,.55); }
.rules-content {
  min-height: 0;
  padding: 0 28px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(204,194,225,.38) transparent;
}
.rules-panel { animation: rules-panel-in .18s ease; }
@keyframes rules-panel-in { from { opacity: .3; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.rule-list { margin: 0; padding: 0; display: grid; gap: 12px; list-style: none; }
.rule-list li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.rule-list li > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #352440;
  font-family: Georgia, serif;
  font-weight: 700;
  background: linear-gradient(180deg, #ffe7a6, #dfb45b);
}
.rule-list strong, .setting-row strong { display: block; color: #f5efff; font-size: 14px; }
.rule-list p { margin: 2px 0 0; color: #bdb6d2; font-size: 12px; line-height: 1.4; }
.rules-tip { margin: 14px 0 0; padding: 11px 13px; color: #bdb6d2; font-size: 11px; line-height: 1.45; border-radius: 12px; background: rgba(255,255,255,.035); }
.rules-tip strong { color: var(--gold-light); }
.rule-note { padding: 13px 14px; color: #c8c1da; font-size: 12px; line-height: 1.5; border: 1px solid rgba(243,199,109,.18); border-radius: 14px; background: rgba(243,199,109,.06); }
.rule-note strong { color: var(--gold-light); }
.power-list { display: grid; gap: 10px; margin: 0; }
.power-list > div { min-height: 65px; display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 15px; background: rgba(255,255,255,.04); }
.power-list img { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(3,1,13,.35)); }
.power-list p { margin: 0; }
.power-list strong { display: block; color: #f5efff; font-size: 14px; }
.power-list span { display: block; margin-top: 2px; color: #aaa3c1; font-size: 12px; line-height: 1.35; }
.score-rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.score-rules > div { min-width: 0; min-height: 112px; padding: 15px 8px; display: grid; place-content: center; gap: 7px; text-align: center; border-radius: 16px; background: rgba(255,255,255,.04); }
.score-rules strong { color: var(--gold-light); font-family: Georgia, serif; font-size: 31px; font-weight: 500; line-height: 1; }
.score-rules span { color: #c6bfd8; font-size: 10px; line-height: 1.25; }
.rules-footer {
  padding: 14px 20px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid rgba(225,216,249,.1);
  background: rgba(10,7,27,.36);
}
.rules-secondary-actions { min-width: 0; display: flex; gap: 8px; }
.rules-footer button { min-height: 44px; padding: 10px 18px; }
.rules-secondary-actions button { flex: 0 1 auto; }
.rules-done { min-width: 112px; }

.story-card { width: min(620px, 100%); }
.story-card .modal-copy { max-width: 50ch; margin: 0 0 16px; }
.comic-art { display: block; width: 100%; height: auto; border-radius: 17px; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 12px 30px rgba(3,1,13,.36); }
.confirm-card { max-width: 390px; text-align: center; }
.confirm-ghost { display: block; width: 82px; height: 82px; margin: 0 auto 11px; border-radius: 24px; background: url("assets/nachtlicht-icon-192.png") center / cover; box-shadow: 0 10px 25px rgba(3,1,13,.4); }
.confirm-card .modal-actions { justify-content: center; }

.swap-event-card { width: min(500px, 100%); text-align: center; }
.swap-event-card .modal-copy { max-width: 42ch; }
.swap-visual {
  margin: 24px auto 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.swap-side { min-width: 0; display: grid; justify-items: center; gap: 10px; }
.swap-side > strong {
  min-height: 32px;
  display: flex;
  align-items: end;
  justify-content: center;
  color: #f6efff;
  font-size: 12px;
  line-height: 1.3;
}
.swap-card-slot { min-height: 158px; display: grid; place-items: center; }
.swap-card-slot .card { --w: 112px; --h: 158px; border-radius: 17px; }
.swap-card-slot .card.face .corner { font-size: 25px; }
.swap-card-slot .card.face .tag { bottom: 11px; font-size: 10px; }
.swap-arrow {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2e203b;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffe9aa, #e4b95f);
  box-shadow: 0 0 26px rgba(243,199,109,.26);
  animation: swap-arrow-in .45s ease;
}
.swap-event-note { margin: 0 auto; max-width: 42ch; color: #aaa3c1; font-size: 11px; line-height: 1.45; }
.swap-event-card .modal-actions { justify-content: center; margin-top: 18px; }
.swap-event-card .modal-actions button { min-width: 150px; }
@keyframes swap-arrow-in {
  from { transform: rotate(-90deg) scale(.65); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.setting-row { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid rgba(225,216,249,.11); }
.setting-row small { display: block; margin-top: 3px; color: #aaa3c1; font-size: 11px; line-height: 1.35; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: relative; width: 48px; height: 28px; border-radius: 999px; background: #312744; border: 1px solid rgba(255,255,255,.12); transition: .18s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #c7c0d6; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: .18s ease; }
.switch input:checked + span { background: #8d6a34; border-color: rgba(255,231,166,.5); }
.switch input:checked + span::after { left: 23px; background: #fff0b9; }
.switch input:focus-visible + span { outline: 2px solid #fff2bd; outline-offset: 3px; }
.switch em { min-width: 22px; color: #b9b2cc; font-size: 10px; font-style: normal; }
.restart-panel { padding-top: 22px; }
.restart-confirm { padding: 14px; border: 1px solid rgba(244,165,183,.18); border-radius: 15px; background: rgba(122,45,65,.09); }
.restart-confirm p { margin: 0 0 12px; color: #e4d8e3; font-size: 12px; }
.restart-confirm > div { display: flex; gap: 8px; }
.settings-card > .modal-actions { margin-top: 18px; }

@media (max-width: 680px) {
  #app {
    min-height: 100svh;
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }
  .topbar { min-height: 50px; padding: 0 4px; }
  .brand { gap: 10px; }
  .topbar .brand-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 12px; }
  .eyebrow { font-size: 9px; }
  .topbar h1 { font-size: 26px; }
  .topbar-actions { gap: 5px; }
  .round-pill { padding: 7px 9px; font-size: 10px; }
  .round-icon { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }

  #table { padding: 8px 6px 12px; justify-content: center; gap: clamp(18px, 2.4vh, 26px); }
  #table::before { border-radius: 34px; }

  .opponents { gap: 10px; }
  .seat { min-width: 0; flex: 1 1 0; max-width: 220px; padding: 8px 9px; }
  .player-identity { font-size: 11px; }
  .avatar { width: 22px; height: 22px; }
  .mini-hand { gap: 5px; }
  .mini-hand .card { --w: clamp(30px, 8.4vw, 40px); --h: clamp(43px, 11.8vw, 56px); }

  .center { gap: clamp(20px, 6.5vw, 38px); }
  .card { --w: clamp(72px, 21vw, 86px); --h: clamp(101px, 29.4vw, 121px); }
  #deck::before, #deck::after { width: clamp(72px, 21vw, 86px); height: clamp(101px, 29.4vw, 121px); }
  .drawn { width: clamp(72px, 21vw, 86px); min-height: clamp(112px, 32vw, 134px); }

  .me { width: 100%; gap: clamp(7px, 2.2vw, 12px); }
  .me .card { border-radius: 13px; }
  .me .card.face .tag { bottom: 8px; font-size: 10px; }
  .player-label span { font-size: 14px; }
  .player-label i { font-size: 10px; }
  .pile label small { font-size: 10px; }
  .pile label strong { font-size: 11px; }

  .controls { width: 100%; margin-top: 10px; flex-direction: column; gap: 10px; padding: 11px 12px; }
  .hint-wrap { min-width: 0; width: 100%; justify-content: center; }
  .hint { text-align: center; font-size: 12px; line-height: 1.4; }
  .hint-wrap { min-height: 38px; }
  .buttons { gap: 9px; width: 100%; min-height: 48px; }
  .buttons button { flex: 1 1 0; max-width: 260px; }
  button { min-height: 48px; padding: 12px 16px; font-size: 12px; }
  .signature { display: none; }

  .overlay {
    align-items: center;
    padding:
      max(16px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .start-card { padding: 25px 20px 20px; }
  .start-logo { width: 58px; height: 58px; flex-basis: 58px; }
  .ghost-choices { gap: 5px; }
  .ghost-choice { min-height: 76px; padding-inline: 2px; border-radius: 14px; }
  .ghost-choice img { width: 42px; height: 42px; border-radius: 12px; }
  .modal-card { padding: 27px 20px 20px; border-radius: 24px; }
  .modal-card h2 { font-size: 27px; }
  .modal-copy { font-size: 13px; }
  .tutorial-card { padding-top: 22px; overflow-y: auto; }
  .tutorial-art { width: 165px; height: 142px; margin-top: 25px; }
  .tutorial-art img { width: 108px; height: 112px; }
  .tutorial-art.step-action img { width: 126px; height: 126px; }
  .tutorial-art.step-lights img { width: 112px; height: 121px; }
  .tutorial-art::before, .tutorial-art::after { width: 36px; height: 50px; }
  .modal-actions { gap: 8px; }
  .modal-actions button { padding-inline: 13px; }
  .rules-card {
    width: 100%;
    height: min(560px, calc(100svh - 24px));
    max-height: calc(100svh - 24px);
    padding: 0;
    border-radius: 24px;
  }
  .rules-heading { padding: 22px 18px 10px; }
  .rules-heading h2 { font-size: 27px; }
  .rules-heading > p:last-child { font-size: 11px; }
  .rules-tabs { margin: 0 18px 12px; }
  .rules-tabs button { min-height: 40px; padding: 8px 5px; }
  .rules-content { padding: 0 18px 14px; }
  .rules-footer { grid-template-columns: 1fr; gap: 8px; padding: 10px 14px 13px; }
  .rules-secondary-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .rules-footer button, .rules-done { width: 100%; }
  .scorecard .row { align-items: center; gap: 8px; }
  .score-detail { max-width: 70%; }
  .score-detail .rs { font-size: 9px; }
  .story-card { padding-inline: 16px; }
  .swap-event-card { padding-inline: 16px; }
  .swap-visual { grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr); gap: 7px; }
  .swap-card-slot { min-height: 119px; }
  .swap-card-slot .card { --w: 84px; --h: 119px; border-radius: 14px; }
  .swap-arrow { width: 38px; height: 38px; font-size: 23px; }
  .swap-side > strong { min-height: 30px; font-size: 10px; }
}

@media (max-width: 390px) {
  .brand .eyebrow { display: none; }
  .topbar h1 { font-size: 24px; }
  .round-pill { padding-inline: 7px; font-size: 9px; }
  .round-icon { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .seat .score > span { display: none; }
}

@media (max-width: 340px) {
  .topbar { gap: 5px; }
  .brand { gap: 5px; }
  .topbar .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .topbar h1 { font-size: 20px; }
  .round-pill { padding-inline: 5px; font-size: 8px; }
  .topbar-actions { gap: 3px; }
}

@media (max-height: 700px) and (max-width: 680px) {
  #table { flex: 0 0 auto; gap: 12px; }
  .opponents { transform: scale(.92); transform-origin: center top; margin-bottom: -5px; }
  .center { transform: scale(.88); margin: -8px 0; }
  .player-area { transform: scale(.92); margin: -7px 0; }
  .controls { margin-top: 5px; padding-block: 8px; }
  .tutorial-art { height: 112px; margin: 15px auto 7px; }
  .tutorial-art img { height: 96px; }
  .rules-card { height: calc(100svh - 32px); max-height: calc(100svh - 32px); }
  .rules-heading { padding-top: 17px; padding-bottom: 7px; }
  .rules-heading > p:last-child { display: none; }
  .rules-tabs { margin-bottom: 9px; }
  .rules-content { padding-bottom: 10px; }
  .rules-footer { padding-top: 8px; padding-bottom: 9px; }
  .rule-list { gap: 8px; }
  .rule-list li { grid-template-columns: 31px 1fr; gap: 10px; }
  .rule-list li > span { width: 31px; height: 31px; }
  .start-card { padding-top: 18px; padding-bottom: 17px; }
  .start-logo { width: 50px; height: 50px; flex-basis: 50px; border-radius: 16px; margin-bottom: 6px; }
  .start-card h2 { margin-bottom: 8px; font-size: 29px; }
  .start-lead { margin-bottom: 9px; font-size: 11px; line-height: 1.35; }
  .ghost-picker { margin-bottom: 9px; }
  .ghost-picker legend { margin-bottom: 5px; font-size: 10px; }
  .ghost-choice { min-height: 61px; gap: 1px; padding-block: 3px; }
  .ghost-choice img { width: 35px; height: 35px; }
  .ghost-choice span { font-size: 9px; }
  .rounds { margin-bottom: 10px; }
  body:has(.scorecard) #table { gap: 4px; padding-top: 2px; padding-bottom: 2px; }
  body:has(.scorecard) .opponents { transform: scale(.78); margin: -5px 0 -15px; }
  body:has(.scorecard) .center { transform: scale(.78); margin: -20px 0; }
  body:has(.scorecard) .player-area { transform: scale(.82); margin: -18px 0; }
  .controls:has(.scorecard) { gap: 4px; padding-block: 7px; }
  .controls:has(.scorecard) .hint-wrap { min-height: 0; }
}

/* Hochskalierung auf iPad / breite Screens (die Spielspalte ist per #app auf 720px begrenzt). */
@media (min-width: 681px) {
  #table { gap: clamp(20px, 3.4vh, 42px); padding: 22px clamp(20px, 4vw, 40px) 28px; }
  .opponents { gap: clamp(20px, 4vw, 40px); }
  .seat { padding: 11px 13px; }
  .seat .name { margin-bottom: 10px; }
  .player-identity { font-size: 13px; }
  .avatar { width: 27px; height: 27px; }
  .mini-hand { gap: 7px; }
  .mini-hand .card { --w: 45px; --h: 64px; }
  .center { gap: clamp(44px, 8vw, 72px); }
  .card { --w: 94px; --h: 133px; }
  #deck::before, #deck::after { width: 94px; height: 133px; }
  .drawn { width: 94px; min-height: 152px; }
  .drawn-cap { font-size: 9px; }
  .player-label span { font-size: 16px; }
  .hint { font-size: 13px; }
  .buttons { gap: 10px; }
  button { min-height: 44px; padding: 11px 24px; font-size: 12px; }
}

/* Breite und hohe Fenster: mehr Tischbreite, aber keine kilometerlangen Leerflächen. */
@media (min-width: 900px) {
  #app { width: min(1040px, 100%); }
  .controls { width: min(920px, calc(100% - 18px)); }
  .player-label, .me { width: min(660px, 100%); }
  .seat { min-width: 230px; }
  .mini-hand .card { --w: 49px; --h: 70px; }
}

@media (min-width: 900px) and (min-height: 900px) {
  #app { min-height: min(100dvh, 1040px); }
  #table { flex: 0 0 clamp(650px, 76vh, 820px); width: 100%; gap: clamp(30px, 4vh, 48px); }
}

@media (max-height: 820px) and (min-width: 681px) {
  #app { padding-top: 10px; padding-bottom: 8px; }
  .topbar { min-height: 54px; }
  #table { min-height: 0; gap: 8px; padding-top: 8px; padding-bottom: 10px; }
  .mini-hand .card { --w: 40px; --h: 57px; }
  .card { --w: 82px; --h: 116px; }
  #deck::before, #deck::after { width: 82px; height: 116px; }
  .drawn { width: 82px; min-height: 134px; }
  .me .card { max-width: 108px; }
  .center { padding: 0; }
  .controls { margin-top: 6px; padding-block: 8px; }
  .signature { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (prefers-contrast: more) {
  :root { --muted: #c9c3df; --line: rgba(255,255,255,.32); }
  .seat, .controls, .modal-card, .start-card { border-color: rgba(255,255,255,.32); }
  .hint, .pile label small, .player-label i, .setting-row small, .rule-list p { color: #eee9fa; }
  .card.back { border-color: rgba(255,255,255,.72); }
  button:focus-visible, .card.selectable:focus-visible { outline-width: 4px; }
}
