/* ladi play – 3D-Look für die klassischen DOM-Spiele (Karten, Brett, Rätsel, Sport).
   Nur Darstellung: keine Layout- oder Regeländerungen. Licht kommt einheitlich von oben links.
   Bühnen (.game-stage, .collection-panel) werden nie transformiert – die skaliert fullscreen-fit.js. */

:root {
  --d3-wood: repeating-linear-gradient(91deg, rgba(255, 236, 205, .06) 0 2px, transparent 2px 9px, rgba(40, 18, 4, .09) 9px 11px, transparent 11px 21px),
    linear-gradient(170deg, #b0743f 0%, #8a4f27 45%, #6a3a1b 100%);
  --d3-wood-light: repeating-linear-gradient(89deg, rgba(120, 70, 30, .07) 0 3px, transparent 3px 13px, rgba(255, 255, 255, .08) 13px 15px, transparent 15px 26px),
    linear-gradient(165deg, #f6e2bf 0%, #e7c896 55%, #d6ad78 100%);
  --d3-frame: inset 0 2px 0 rgba(255, 238, 214, .38), inset 0 -3px 0 rgba(30, 12, 2, .35),
    0 2px 0 #5a3015, 0 5px 0 #46240f, 0 7px 0 #351a0a, 0 9px 3px rgba(0, 0, 0, .22), 0 28px 40px -12px rgba(8, 18, 40, .55);
  --d3-plate: 0 2px 0 rgba(0, 0, 0, .16), 0 5px 0 rgba(0, 0, 0, .12), 0 22px 34px -12px rgba(8, 20, 50, .45);
  --d3-gloss: radial-gradient(circle at 34% 27%, rgba(255, 255, 255, .9) 0 5%, rgba(255, 255, 255, .42) 12%, rgba(255, 255, 255, 0) 33%),
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .08) 0 44%, rgba(0, 0, 0, .22) 76%, rgba(0, 0, 0, .38) 100%);
  --d3-tile: linear-gradient(160deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, .12) 38%, rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, .07) 100%);
  --d3-tilt: perspective(1400px) rotateX(10deg);
  --d3-lift: cubic-bezier(.2, .8, .3, 1.2);
}

/* ===================================================================== */
/* KARTEN                                                                */
/* ===================================================================== */

/* Karte mit Dicke (Stapelkante), weichem Schlagschatten und Glanz. */
.playing-card,
.playing-mini-card {
  isolation: isolate;
  box-shadow: 0 1px 0 #e6ddcf, 0 2px 0 #d2c6b3, 0 3px 0 #b9ab95, 0 4px 1px rgba(50, 36, 20, .35),
    0 9px 14px -4px rgba(0, 0, 0, .36), 0 18px 26px -14px rgba(0, 0, 0, .45);
}
.playing-card::before,
.playing-mini-card::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(152deg, rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, .14) 26%, rgba(255, 255, 255, 0) 46%, rgba(0, 0, 0, 0) 72%, rgba(60, 40, 20, .08) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -2px 0 rgba(90, 70, 50, .1), inset 0 0 0 1px rgba(60, 40, 30, .06);
}
.playing-mini-card { position: relative; }
/* Rückseiten: dunklere Kante, Glanz liegt über dem Muster. */
.playing-card.back,
.playing-card.card-back,
#patience-stock,
.playing-mini-card.back {
  box-shadow: 0 1px 0 #e9e4dc, 0 2px 0 #cfc7ba, 0 3px 0 #b4a996, 0 4px 1px rgba(10, 20, 50, .4),
    0 9px 14px -4px rgba(0, 0, 0, .4), 0 18px 26px -14px rgba(0, 0, 0, .5), inset 0 0 0 3px rgba(255, 255, 255, .92);
}
.playing-card.back::before,
.playing-card.card-back::before,
#patience-stock::before,
.playing-mini-card.back::before {
  z-index: 1;
  background: linear-gradient(152deg, rgba(255, 255, 255, .38) 0%, rgba(255, 255, 255, .08) 30%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, .16) 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .9), inset 0 0 0 4px rgba(0, 20, 60, .25);
}

/* Angehobene Karte: Hover (nur echte Zeiger) und Auswahl. */
button.playing-card:not(.skat-playing-card) { transition: transform .16s var(--d3-lift), box-shadow .16s ease, filter .16s ease; }
@media (hover: hover) {
  button.playing-card:not(.skat-playing-card):not(:disabled):hover {
    transform: translateY(-4px);
    box-shadow: 0 1px 0 #e6ddcf, 0 2px 0 #d2c6b3, 0 3px 0 #b9ab95, 0 5px 2px rgba(50, 36, 20, .3),
      0 16px 20px -6px rgba(0, 0, 0, .42), 0 28px 36px -16px rgba(0, 0, 0, .5);
  }
}
.playing-card.selected,
.card-slot.selected,
.patience-pyramid button.playing-card.pyramid-card.selected {
  transform: translateY(-9px);
  box-shadow: 0 1px 0 #e6ddcf, 0 2px 0 #d2c6b3, 0 3px 0 #b9ab95, 0 6px 3px rgba(50, 36, 20, .26),
    0 20px 24px -6px rgba(0, 0, 0, .45), 0 34px 40px -18px rgba(0, 0, 0, .5), 0 0 0 2px rgba(255, 214, 111, .45);
}
.skat-playing-card {
  box-shadow: 0 1px 0 #e6ddcf, 0 2px 0 #d2c6b3, 0 3px 0 #b9ab95, 0 4px 1px rgba(50, 36, 20, .35),
    0 10px 16px -4px rgba(0, 0, 0, .45), 0 20px 30px -14px rgba(0, 0, 0, .5);
}
.skat-hand .skat-playing-card:not(:disabled):hover,
.skat-hand .skat-playing-card:not(:disabled):focus-visible,
.skat-hand .skat-playing-card.selected {
  box-shadow: 0 1px 0 #e6ddcf, 0 2px 0 #d2c6b3, 0 3px 0 #b9ab95, 0 6px 3px rgba(50, 36, 20, .3),
    0 22px 26px -6px rgba(0, 0, 0, .5), 0 38px 44px -18px rgba(0, 0, 0, .5);
}
.patience-pyramid button.playing-card.pyramid-card { box-shadow: 0 1px 0 #e6ddcf, 0 2px 0 #d2c6b3, 0 3px 0 #b9ab95, 0 4px 1px rgba(20, 40, 30, .35), 0 9px 14px -4px rgba(0, 20, 10, .38); }
.patience-pyramid button.playing-card.pyramid-card.open-card { box-shadow: 0 1px 0 #e6ddcf, 0 2px 0 #d2c6b3, 0 3px 0 #b9ab95, 0 5px 2px rgba(20, 40, 30, .3), 0 14px 18px -5px rgba(0, 20, 10, .45), 0 24px 30px -14px rgba(0, 20, 10, .45); }
@media (hover: hover) {
  .patience-pyramid button.playing-card.pyramid-card.open-card:not(:disabled):hover { transform: translateY(-4px); }
}

/* Kartentisch: Filz mit Webstruktur, Lampenlicht, Vignette und Holzrand. */
.collection-dialog .card-table,
.collection-dialog .collection-panel:has(> #poker-board) {
  border-color: #3a1e0c;
  color: #fff;
  background-color: #0f4a35;
  background-image:
    radial-gradient(ellipse 75% 60% at 50% 32%, rgba(255, 250, 220, .16), rgba(255, 250, 220, 0) 70%),
    radial-gradient(ellipse 120% 95% at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(0, 10, 6, .5) 100%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .028) 0 2px, rgba(255, 255, 255, 0) 2px 4px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .04) 0 2px, rgba(0, 0, 0, 0) 2px 4px),
    linear-gradient(180deg, rgba(20, 96, 66, .86), rgba(9, 60, 42, .93)),
    var(--game-scene, linear-gradient(#174a3a, #0d3326));
  background-position: center;
  background-size: auto, auto, auto, auto, auto, cover;
  box-shadow:
    inset 0 0 0 9px #7a4420, inset 0 0 0 10px #b47a45, inset 0 2px 0 10px #4a240d, inset 0 0 0 12px #2a1406,
    inset 0 14px 26px 10px rgba(0, 0, 0, .35), inset 0 -10px 30px 6px rgba(0, 0, 0, .3),
    0 3px 0 #2a1406, 0 7px 0 #1d0e04, 0 26px 44px -12px rgba(4, 16, 12, .6);
}
.collection-dialog .collection-panel:has(> #poker-board) h3 { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.collection-dialog .collection-panel:has(> #poker-board) p { color: #d9f3e9; }
.collection-dialog .collection-panel:has(> #poker-board) .card-row,
.collection-dialog .collection-panel:has(> #poker-board) .poker-board {
  min-height: 92px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(0, 30, 18, .28);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, .35), inset 0 -1px 0 rgba(255, 255, 255, .08);
}
/* Ablagezonen und Reihen: in den Filz eingelassen. */
.card-table .card-row,
.card-table .trick-table {
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, .32), inset 0 -1px 0 rgba(255, 255, 255, .07);
}
.card-table .card-slot,
.card-table .tableau-pile .pile-target {
  background-color: rgba(0, 28, 18, .32);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .4), inset 0 -1px 0 rgba(255, 255, 255, .1);
}
.card-table .score-banner {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 3px 8px rgba(0, 0, 0, .25);
}
/* Stichtisch in leichter Draufsicht (nur Anzeige, keine Klickziele). */
.card-table .trick-table {
  transform: perspective(900px) rotateX(16deg);
  transform-origin: 50% 80%;
  background: radial-gradient(ellipse at 50% 45%, rgba(40, 120, 84, .4), rgba(0, 24, 16, .45));
}

/* Patience-Pyramide: Filztisch. */
#patience-dialog .patience-stage {
  background-color: #0f4a35 !important;
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 30%, rgba(255, 250, 220, .16), rgba(255, 250, 220, 0) 70%),
    radial-gradient(ellipse 120% 95% at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(0, 10, 6, .5) 100%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .028) 0 2px, rgba(255, 255, 255, 0) 2px 4px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .04) 0 2px, rgba(0, 0, 0, 0) 2px 4px),
    linear-gradient(180deg, #18664a, #0b3f2c) !important;
  background-size: auto !important;
  box-shadow: inset 0 0 0 9px #7a4420, inset 0 0 0 10px #b47a45, inset 0 0 0 12px #2a1406, inset 0 14px 30px 10px rgba(0, 0, 0, .35);
}
#patience-dialog .patience-stage::after { opacity: .3; }
/* Verdeckte Pyramidenkarten: deckend, nur etwas abgedunkelt (statt durchscheinend auf dem Filz). */
.patience-pyramid button.playing-card.pyramid-card:disabled { opacity: 1; filter: brightness(.8) saturate(.7); }

/* Skat-Raum: Tisch mit Vignette und Lampenlicht. */
.skat-visual-table {
  border-color: #6f3e1c;
  box-shadow: inset 0 0 0 2px #b47a45, inset 0 0 90px 24px rgba(0, 0, 0, .45), 0 4px 0 #3a1e0c, 0 8px 0 #2a1406, 0 26px 46px -12px rgba(10, 16, 23, .5);
}
#collection-dialog.skat-room-active .skat-visual-table { box-shadow: inset 0 0 120px 30px rgba(0, 0, 0, .45); }
.skat-trick,
.skat-scene-center .skat-trick {
  border-color: #8a5228;
  background-image:
    radial-gradient(ellipse 70% 60% at 50% 35%, rgba(255, 250, 220, .2), rgba(255, 250, 220, 0) 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .03) 0 2px, rgba(255, 255, 255, 0) 2px 4px),
    radial-gradient(circle, rgba(58, 138, 96, .96), rgba(24, 74, 52, .98));
  box-shadow: inset 0 0 0 3px #c08a52, inset 0 10px 30px rgba(0, 0, 0, .4), 0 5px 0 #4a260f, 0 9px 0 #2f1607, 0 22px 30px -10px rgba(0, 0, 0, .55);
}

/* ===================================================================== */
/* GEMEINSAM: Spielsteine (gewölbt, mit Glanzpunkt und Kante)            */
/* ===================================================================== */
.turn-disc {
  background-image: var(--d3-gloss);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 4px 0 rgba(0, 0, 0, .14), 0 8px 12px rgba(0, 0, 0, .28);
}

/* ===================================================================== */
/* VIERERREIHE – stehendes Brett mit Dicke, eingelassene Löcher          */
/* ===================================================================== */
#four-dialog .four-board {
  position: relative;
  background-color: var(--brand-navy, #07184d);
  background-image:
    linear-gradient(160deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .04) 30%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .3) 100%),
    linear-gradient(90deg, #1b3a97, #0c2470 50%, #081a55);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -4px 0 rgba(0, 0, 0, .35), inset 3px 0 0 rgba(255, 255, 255, .12),
    0 4px 0 #050f36, 0 8px 0 #030a26, 0 10px 3px rgba(0, 0, 0, .25), 0 30px 40px -12px rgba(3, 10, 40, .55);
}
#four-dialog .four-cell {
  background-color: #eef3fb;
  background-image: radial-gradient(circle at 50% 70%, #ffffff 0%, #e6edf8 55%, #c6d2e6 100%);
  box-shadow: inset 0 6px 10px rgba(2, 10, 45, .55), inset 0 -2px 2px rgba(255, 255, 255, .7), 0 1px 0 rgba(255, 255, 255, .22), 0 -1px 0 rgba(0, 0, 0, .35);
}
#four-dialog .four-cell.purple-piece,
#four-dialog .four-cell.coral-piece {
  background-image: var(--d3-gloss);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18), inset 0 -4px 6px rgba(0, 0, 0, .3), 0 3px 0 rgba(0, 0, 0, .35), 0 0 0 2px rgba(0, 0, 0, .3);
}
#four-dialog .four-cell.purple-piece { background-color: var(--purple); }
#four-dialog .four-cell.coral-piece { background-color: var(--coral); }
#four-dialog .four-cell.purple-piece::before,
#four-dialog .four-cell.coral-piece::before {
  content: '';
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .3), 0 1px 0 rgba(255, 255, 255, .35);
  pointer-events: none;
}
#four-dialog .column-controls button {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, .14));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 3px 0 color-mix(in srgb, var(--purple) 55%, #000), 0 7px 10px -3px rgba(0, 0, 0, .35);
  transition: transform .1s ease, box-shadow .1s ease;
}
#four-dialog .column-controls button:not(:disabled):active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 0 color-mix(in srgb, var(--purple) 55%, #000); }

/* ===================================================================== */
/* MÜHLE – Holzbrett in Perspektive, Mulden und gewölbte Steine          */
/* ===================================================================== */
#mills-dialog .mills-board {
  background: var(--d3-wood-light);
  border-radius: 22px;
  box-shadow: inset 0 0 0 10px #8c5530, inset 0 0 0 11px #c48f5c, inset 0 0 0 13px #5b3216, inset 0 2px 0 13px rgba(255, 230, 190, .3),
    inset 0 0 40px 14px rgba(90, 50, 20, .22), var(--d3-frame);
  transform: var(--d3-tilt);
  transform-origin: 50% 60%;
}
#mills-dialog .mills-lines {
  stroke: #4a2a12;
  filter: drop-shadow(0 1px 0 rgba(255, 240, 210, .7)) drop-shadow(0 -1px 0 rgba(60, 30, 10, .25));
}
#mills-dialog .mills-point {
  border-color: #f4e2c2;
  background-color: #6d4527;
  background-image: radial-gradient(circle at 50% 62%, #8a5a34 0%, #5a3418 60%, #3b2010 100%);
  box-shadow: inset 0 4px 6px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 245, 220, .8), 0 -1px 0 rgba(80, 40, 10, .35);
}
#mills-dialog .mills-point.purple-piece,
#mills-dialog .mills-point.coral-piece {
  border-color: rgba(255, 255, 255, .55);
  background-image: var(--d3-gloss);
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, .25), 0 3px 0 rgba(0, 0, 0, .3), 0 5px 0 rgba(0, 0, 0, .14), 0 10px 12px -2px rgba(40, 20, 5, .45);
}
#mills-dialog .mills-point.purple-piece { background-color: var(--purple); }
#mills-dialog .mills-point.coral-piece { background-color: var(--coral); }
#mills-dialog .mills-point.valid-target {
  border-color: var(--gold);
  background-color: #fff3cf;
  background-image: radial-gradient(circle at 50% 60%, #fffaf0, #ffe7a3 70%, #e9bd52);
  box-shadow: inset 0 3px 5px rgba(120, 80, 0, .35), 0 0 0 4px rgba(255, 214, 111, .45);
}
#mills-dialog .mills-point:active { transform: translate(-50%, -50%) scale(.94); }

/* ===================================================================== */
/* DAME – Holzrahmen, eingelegte Felder, Damesteine mit Rand             */
/* ===================================================================== */
#draughts-dialog .draughts-board {
  border-color: transparent;
  background: var(--d3-wood) border-box;
  box-shadow: inset 0 0 0 2px rgba(20, 8, 0, .45), var(--d3-frame);
  transform: var(--d3-tilt);
  transform-origin: 50% 60%;
  grid-template-rows: repeat(8, 1fr);
}
#draughts-dialog .draughts-cell.light {
  background-color: #f3e3c6;
  background-image: repeating-linear-gradient(88deg, rgba(150, 100, 50, .06) 0 2px, transparent 2px 9px), linear-gradient(160deg, rgba(255, 255, 255, .35), rgba(0, 0, 0, .04));
}
#draughts-dialog .draughts-cell.dark {
  background-color: #6e4b3a;
  background-image: repeating-linear-gradient(92deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 10px), linear-gradient(160deg, rgba(255, 255, 255, .1), rgba(0, 0, 0, .18));
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .3), inset 0 -1px 0 rgba(255, 255, 255, .1);
}
#draughts-dialog .draughts-cell.selected { box-shadow: inset 0 0 0 6px var(--gold), inset 0 0 14px rgba(255, 214, 111, .6); }
#draughts-dialog .draughts-piece {
  position: relative;
  border-color: rgba(255, 255, 255, .45);
  background-image: var(--d3-gloss);
  box-shadow: inset 0 0 0 5px rgba(0, 0, 0, .1), inset 0 -4px 6px rgba(0, 0, 0, .25), 0 3px 0 rgba(0, 0, 0, .35), 0 5px 0 rgba(0, 0, 0, .18), 0 10px 12px -2px rgba(0, 0, 0, .5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
#draughts-dialog .draughts-piece::before {
  content: '';
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .28), 0 1px 0 rgba(255, 255, 255, .35);
  pointer-events: none;
}
#draughts-dialog .draughts-piece.king { border-color: var(--gold); box-shadow: inset 0 0 0 5px rgba(0, 0, 0, .1), inset 0 -4px 6px rgba(0, 0, 0, .25), 0 3px 0 rgba(0, 0, 0, .35), 0 6px 0 rgba(120, 80, 0, .4), 0 9px 0 rgba(0, 0, 0, .2), 0 14px 14px -2px rgba(0, 0, 0, .5); }
#draughts-dialog .draughts-cell.valid-target::after {
  background-image: radial-gradient(circle at 35% 30%, #fff6d0, #f3be4e 60%, #c98f1a);
  box-shadow: 0 0 0 7px rgba(243, 190, 78, .3), 0 2px 4px rgba(0, 0, 0, .35);
}

/* ===================================================================== */
/* BACKGAMMON – Holzkoffer, Lederspielfeld, Steine mit Glanz             */
/* ===================================================================== */
#backgammon-dialog .backgammon-board {
  border-color: transparent;
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%, rgba(255, 248, 230, .25), rgba(0, 0, 0, 0) 70%) padding-box,
    linear-gradient(180deg, #ecdcbf, #dcc39b) padding-box,
    var(--d3-wood) border-box;
  box-shadow: inset 0 0 0 2px rgba(20, 8, 0, .45), inset 0 8px 22px rgba(60, 30, 5, .35), inset 0 -6px 18px rgba(60, 30, 5, .25), var(--d3-frame);
  transform: perspective(1500px) rotateX(9deg);
  transform-origin: 50% 60%;
}
/* Dreiecke als Pseudo-Element: Steine werden nicht mehr abgeschnitten, Klickfläche = ganze Zunge. */
#backgammon-dialog .backgammon-point {
  clip-path: none;
  background: none;
}
#backgammon-dialog .backgammon-point::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0 0 18% 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .18)), #b96862;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}
#backgammon-dialog .backgammon-point:nth-child(even)::before { background: linear-gradient(90deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .2)), #765278; }
#backgammon-dialog .backgammon-point.bottom::before { inset: 18% 0 0 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
#backgammon-dialog .backgammon-point:nth-child(12n+6) { margin-right: 22px; }
#backgammon-dialog .backgammon-point:nth-child(12n+7) { margin-left: 22px; }
#backgammon-dialog .backgammon-stack { position: relative; z-index: 2; }
#backgammon-dialog .bg-piece {
  position: relative;
  border-color: rgba(255, 255, 255, .55);
  background-color: #7b8794;
  background-image: var(--d3-gloss);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .1), 0 2px 0 rgba(0, 0, 0, .35), 0 6px 7px -1px rgba(30, 15, 0, .5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
#backgammon-dialog .bg-piece.purple-piece { background-color: var(--purple); }
#backgammon-dialog .bg-piece.coral-piece { background-color: var(--coral); }
#backgammon-dialog .backgammon-bar-button {
  background: var(--d3-wood);
  box-shadow: inset 2px 0 0 rgba(255, 230, 190, .25), inset -2px 0 0 rgba(0, 0, 0, .35), 0 0 12px rgba(0, 0, 0, .35);
}
#backgammon-dialog .die {
  border-color: #e7e0d6;
  background-image: linear-gradient(150deg, #ffffff 0%, #f6f1ea 50%, #e4dbcf 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0, 0, 0, .08), 0 3px 0 #c9bba8, 0 5px 0 #b3a38d, 0 12px 14px -4px rgba(30, 20, 10, .45);
}
.backgammon-off { box-shadow: 0 3px 0 rgba(0, 0, 0, .15), 0 8px 12px -4px rgba(0, 0, 0, .25); }

/* ===================================================================== */
/* BRETTSPIELE AUS boards.js (Kreuz & Kreis, farbwende, inselsprung, würfelweg) */
/* ===================================================================== */
/* Kreuz & Kreis: Holzbrett, Kacheln mit Wölbung, leichte Draufsicht. */
#collection-dialog .exp-grid.board-ttt {
  padding: 14px;
  border-radius: 24px;
  background: var(--d3-wood);
  box-shadow: inset 0 0 0 2px rgba(20, 8, 0, .4), inset 0 8px 18px rgba(0, 0, 0, .3), var(--d3-frame);
  transform: var(--d3-tilt);
  transform-origin: 50% 60%;
}
#collection-dialog .board-ttt .board-cell {
  border-color: #fffaf2 !important;
  background: linear-gradient(160deg, #ffffff 0%, #f4eee6 55%, #e3d9cc 100%) !important;
  box-shadow: inset 0 2px 0 #fff, inset 0 -3px 0 rgba(90, 60, 30, .12), 0 3px 0 #c9b9a3, 0 6px 0 #a9957b, 0 12px 14px -4px rgba(30, 15, 0, .5);
  transition: transform .14s ease, box-shadow .14s ease;
}
#collection-dialog .board-ttt .board-cell.you,
#collection-dialog .board-ttt .board-cell.ai {
  border-color: rgba(255, 255, 255, .5) !important;
  background-image: var(--d3-tile) !important;
  text-shadow: 0 2px 2px rgba(0, 0, 0, .35);
}
#collection-dialog .board-ttt .board-cell.you { background-color: var(--purple) !important; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 3px 0 color-mix(in srgb, var(--purple) 60%, #000), 0 6px 0 color-mix(in srgb, var(--purple) 40%, #000), 0 12px 14px -4px rgba(0, 0, 0, .5); }
#collection-dialog .board-ttt .board-cell.ai { background-color: var(--coral) !important; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 3px 0 color-mix(in srgb, var(--coral) 60%, #000), 0 6px 0 color-mix(in srgb, var(--coral) 40%, #000), 0 12px 14px -4px rgba(0, 0, 0, .5); }

/* farbwende: Filzbrett mit Holzrand, eingelassene Felder, gewölbte Scheiben. */
#collection-dialog .exp-reversi.board-reversi {
  padding: 12px;
  background: var(--d3-wood);
  box-shadow: inset 0 0 0 2px rgba(20, 8, 0, .4), var(--d3-frame);
  transform: var(--d3-tilt);
  transform-origin: 50% 60%;
}
#collection-dialog .board-reversi .exp-rev-cell {
  background-color: #2f8a5c !important;
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .035) 0 2px, rgba(255, 255, 255, 0) 2px 4px), radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .1), rgba(0, 0, 0, .14)) !important;
  border-color: rgba(0, 0, 0, .25) !important;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, .3), inset 0 -1px 0 rgba(255, 255, 255, .15);
}
#collection-dialog .board-reversi .exp-rev-cell i {
  background-image: var(--d3-gloss);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .06), 0 2px 0 rgba(0, 0, 0, .35), 0 4px 0 rgba(0, 0, 0, .15), 0 7px 8px -1px rgba(0, 0, 0, .5);
}
#collection-dialog .board-reversi .exp-rev-cell.legal::after { background: radial-gradient(circle at 35% 30%, #fff8d6, #ffe082 60%, #e0b33b); box-shadow: 0 0 0 4px rgba(255, 224, 130, .35), 0 2px 3px rgba(0, 0, 0, .35); }

/* inselsprung: Steinbrett mit Mulden und Murmeln. */
#collection-dialog .exp-grid.board-peg {
  padding: 16px;
  border-radius: 34px;
  background: radial-gradient(circle at 40% 30%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 60%), var(--d3-wood);
  box-shadow: inset 0 0 0 2px rgba(20, 8, 0, .4), inset 0 6px 14px rgba(255, 230, 190, .2), var(--d3-frame);
  transform: var(--d3-tilt);
  transform-origin: 50% 60%;
}
#collection-dialog .board-peg .exp-peg {
  position: relative;
  border-color: rgba(40, 18, 4, .35) !important;
  background: radial-gradient(circle at 50% 62%, #8a5a34 0%, #5a3418 60%, #3b2010 100%) !important;
  box-shadow: inset 0 5px 8px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 235, 200, .45);
}
#collection-dialog .board-peg .exp-peg.filled::after {
  background-image: var(--d3-gloss);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .3), 0 7px 8px -1px rgba(0, 0, 0, .5);
}
#collection-dialog .board-peg .exp-peg.target {
  background: radial-gradient(circle at 50% 55%, #fffbe6, #ffe68a 65%, #e7b93c) !important;
  box-shadow: inset 0 3px 6px rgba(120, 80, 0, .4), 0 0 0 4px rgba(240, 201, 91, .55);
}
#collection-dialog .board-peg .exp-peg.selected { background: radial-gradient(circle at 50% 55%, #ffe9a6, #e2a92b 70%, #a8740d) !important; }
#collection-dialog .board-peg .exp-peg.selected::after { background-image: var(--d3-gloss); box-shadow: 0 0 0 5px #efc659, 0 6px 0 rgba(0, 0, 0, .25), 0 12px 12px -2px rgba(0, 0, 0, .5); transform: translateY(-3px); }

/* würfelweg: Felder als Spielplatten mit Kante. */
#collection-dialog .race-track > span {
  background-image: var(--d3-tile), linear-gradient(145deg, #f6f2f8, #e7f1ed);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #cdbfd6, 0 4px 0 #b4a5c0, 0 8px 10px -4px rgba(30, 20, 60, .35);
}
#collection-dialog .board-race > span.special { background-image: var(--d3-tile), linear-gradient(145deg, #fff6c7, #e7f2ec); }
#collection-dialog .race-track > span:first-child,
#collection-dialog .race-track > span:last-child,
#collection-dialog .board-race > span.goal {
  background-image: var(--d3-tile), linear-gradient(145deg, var(--purple), #315f71);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 #0b2a63, 0 4px 0 #07184d, 0 8px 10px -4px rgba(0, 0, 0, .4);
}
.dice-result { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), inset 0 -3px 0 rgba(0, 0, 0, .2), 0 4px 0 #04124a, 0 12px 20px -4px rgba(3, 20, 70, .45); }

/* ===================================================================== */
/* PAARE FINDEN – dicke Karten mit Glanz, Tisch in leichter Draufsicht   */
/* ===================================================================== */
#pairs-dialog .pairs-board {
  transform: perspective(1500px) rotateX(8deg);
  transform-origin: 50% 60%;
}
#pairs-dialog .pair-card {
  isolation: isolate;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 color-mix(in srgb, var(--purple) 55%, #000), 0 4px 0 color-mix(in srgb, var(--purple) 35%, #000),
    0 6px 2px rgba(0, 0, 0, .2), 0 16px 22px -8px rgba(5, 20, 60, .55);
}
#pairs-dialog .pair-card::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(152deg, rgba(255, 255, 255, .4) 0%, rgba(255, 255, 255, .08) 30%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, .14) 100%);
  pointer-events: none;
}
#pairs-dialog .pair-card.revealed {
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #ddd5c8, 0 4px 0 #c3b8a7, 0 6px 2px rgba(0, 0, 0, .14), 0 18px 24px -8px rgba(5, 20, 60, .45);
  transform: translateY(-3px);
}
#pairs-dialog .pair-card.matched {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 0 color-mix(in srgb, var(--green) 60%, #000), 0 3px 0 color-mix(in srgb, var(--green) 40%, #000), 0 8px 12px -6px rgba(0, 0, 0, .4);
}
@media (hover: hover) {
  #pairs-dialog .pair-card:not(.revealed):not(.matched):hover { transform: translateY(-4px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 color-mix(in srgb, var(--purple) 55%, #000), 0 4px 0 color-mix(in srgb, var(--purple) 35%, #000), 0 8px 3px rgba(0, 0, 0, .18), 0 24px 28px -10px rgba(5, 20, 60, .6); }
}

/* ===================================================================== */
/* SUDOKU, WORTSUCHE, MINENFELD – Rätseltafeln mit Rahmen und Tiefe      */
/* (keine Perspektive: Zahlen und Buchstaben bleiben gestochen scharf)   */
/* ===================================================================== */
#sudoku-dialog .sudoku-board,
#wordsearch-dialog .wordsearch-board {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 2px 0 #2b4b6e, 0 5px 0 #20395a, 0 8px 0 #172b45, 0 10px 3px rgba(0, 0, 0, .2), 0 30px 40px -12px rgba(15, 40, 80, .5);
}
#sudoku-dialog .sudoku-cell {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .7) 0%, rgba(255, 255, 255, 0) 45%, rgba(30, 60, 100, .06) 100%);
}
#sudoku-dialog .sudoku-cell:not(.given) { box-shadow: inset 0 2px 3px rgba(30, 60, 100, .1); }
#sudoku-dialog .sudoku-cell.given {
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .85) 0%, rgba(255, 255, 255, .2) 45%, rgba(40, 70, 110, .1) 100%);
  text-shadow: 0 1px 0 #fff;
}
#sudoku-dialog .sudoku-cell.selected { box-shadow: inset 0 0 0 4px var(--gold), inset 0 3px 8px rgba(160, 110, 0, .25); }
#sudoku-dialog .sudoku-pad button {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, .05));
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #b9cce0, 0 4px 0 #9db4cc, 0 8px 10px -4px rgba(20, 50, 90, .35);
  transition: transform .1s ease, box-shadow .1s ease;
}
#sudoku-dialog .sudoku-pad button:active { transform: translateY(3px); box-shadow: inset 0 1px 0 #fff, 0 1px 0 #9db4cc; }

#wordsearch-dialog .word-cell {
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, 0) 50%, rgba(30, 60, 100, .07) 100%);
  box-shadow: inset 0 -2px 0 rgba(30, 60, 100, .07), inset 0 1px 0 #fff;
}
#wordsearch-dialog .word-cell.selected,
#wordsearch-dialog .word-cell.found {
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .4) 0%, rgba(255, 255, 255, .05) 45%, rgba(0, 0, 0, .12) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -3px 0 rgba(0, 0, 0, .18);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
}
#wordsearch-dialog .word-cell.selected { text-shadow: none; }

#mines-dialog .mines-board {
  border-color: #3f6658;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25), inset 0 0 0 3px rgba(255, 255, 255, .25), 0 2px 0 #2f4d42, 0 5px 0 #253e35, 0 8px 0 #1b2f28, 0 10px 3px rgba(0, 0, 0, .2), 0 30px 40px -12px rgba(15, 50, 40, .5);
}
#mines-dialog .mine-cell {
  border: 1px solid rgba(40, 70, 60, .25);
  border-radius: 4px;
  background-color: #c4d6ce;
  background-image: linear-gradient(150deg, rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, .1) 45%, rgba(0, 0, 0, .1) 100%);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .75), inset -2px -3px 0 rgba(30, 60, 50, .25);
}
#mines-dialog .mine-cell.revealed {
  border-radius: 0;
  background-color: #eef3f1;
  background-image: linear-gradient(180deg, rgba(30, 60, 50, .08), rgba(255, 255, 255, 0) 40%);
  box-shadow: inset 0 2px 4px rgba(20, 50, 40, .2);
}
#mines-dialog .mine-cell.mine {
  background-color: var(--coral);
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .25), rgba(0, 0, 0, .2));
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .3);
}

/* ===================================================================== */
/* LICHTLABYRINTH – Canvas im gerahmten Schaukasten                      */
/* ===================================================================== */
#maze-dialog #maze-canvas {
  border-color: #23305f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2), 0 0 0 2px #121a3a, 0 3px 0 #18214a, 0 6px 0 #10173a, 0 9px 0 #0a0f28, 0 11px 3px rgba(0, 0, 0, .25), 0 32px 44px -12px rgba(8, 14, 40, .6);
}
#maze-dialog .maze-controls button {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, .05));
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #b9cce0, 0 4px 0 #9db4cc, 0 8px 10px -4px rgba(20, 50, 90, .35);
}

/* ===================================================================== */
/* Ruhige Darstellung: keine Hebe-Animationen                            */
/* ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  button.playing-card:not(.skat-playing-card),
  #pairs-dialog .pair-card,
  #collection-dialog .board-ttt .board-cell,
  #four-dialog .column-controls button,
  #sudoku-dialog .sudoku-pad button { transition: none !important; }
  button.playing-card:not(.skat-playing-card):not(:disabled):hover,
  .patience-pyramid button.playing-card.pyramid-card.open-card:not(:disabled):hover,
  #pairs-dialog .pair-card:not(.revealed):not(.matched):hover { transform: none; }
}

/* patience: unterste Pyramidenreihe vollständig sichtbar */
.patience-pyramid { height: 500px; }
@media (max-width: 900px) { .patience-pyramid { height: 450px; } }

/* ===================================================================== */
/* Vollbild: Spielfläche erst zeigen, wenn fullscreen-fit.js sie         */
/* eingepasst hat. Vorher war für 1–3 Bilder die unskalierte Fläche       */
/* sichtbar und sprang dann an ihren Platz – ein Tipp in diesem Moment    */
/* (z. B. bei paare-finden) traf ins Leere. Fallback nach 0,6 s.          */
/* ===================================================================== */
@keyframes ladi-fs-fit-fallback { to { opacity: 1; } }
/* Nur für die feste .game-stage – Sammlungs-Panels werden je Zug neu gezeichnet und bleiben ausgenommen. */
.game-dialog.portal-fullscreen:not(#patience-dialog):not(#island-run-dialog):not(#worlds-dialog):not(:has(.motion-arena)) .game-layout > .game-stage:not([data-fit-scale]) {
  opacity: 0;
  animation: ladi-fs-fit-fallback .01s linear .6s forwards;
}

/* Minenfeld: langes Drücken markiert – ohne iOS-Textauswahl/Kontextblase */
#mines-dialog .mine-cell { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
#four-dialog .four-board { cursor: pointer; }
#collection-dialog .board-peg.peg-6 { grid-template-columns: repeat(6, 1fr); }

/* Vollbild mit Seitenleiste: Die Leiste darf beim Einblenden nicht animieren. fullscreen-fit.js misst
   ihre Lage sofort; mitten in der 0,2-s-Bewegung war die Messung falsch, die Spielfläche wurde zu groß
   eingepasst (unter der Leiste) und sprang beim ersten Tipp auf die richtige Größe. */
.game-dialog.fs-side-panel.portal-fullscreen .game-layout > .game-sidebar,
.game-dialog.fs-side-panel:fullscreen .game-layout > .game-sidebar { transition: none !important; }

/* Ausgegraute Aktionsknöpfe (z. B. Showdown nach Rundenende) klar als inaktiv erkennbar */
#collection-actions button:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.6); }
.ladi-key { display: none !important; }

/* Sportspiele mit Zeitleiste (korbserie, strikebahn, tischrally, bahnenzug …): Im Vollbild lag die
   Wurf-/Start-Taste unter dem Bildrand. Szene etwas niedriger, damit Leiste und Tasten sichtbar bleiben. */
.game-dialog.portal-fullscreen:has(.sport-motion-scene) .sport-panel .sport-motion-scene { min-height: clamp(260px, calc(100dvh - 400px), 560px) !important; }

/* iPad hochkant (≤ 900 px breit): Die Spielbühne der Brett-/Rätselspiele wurde auf die Resthöhe
   gestaucht (teils < 100 px, overflow hidden) – Mühle, Dame, Backgammon, Sudoku u. a. waren unten
   abgeschnitten. Mindesthöhe so groß wie das (quadratische) Brett. */
@media (max-width: 900px) {
  :is(#mills-dialog, #draughts-dialog, #backgammon-dialog, #four-dialog, #sudoku-dialog, #pairs-dialog, #wordsearch-dialog, #mines-dialog)[open]:not(.portal-fullscreen) .game-layout > .game-stage {
    min-height: min(calc(100vw - 24px), 680px) !important;
  }
  /* lichtlabyrinth: Spielfläche 15:11 plus Richtungstasten darunter */
  #maze-dialog[open]:not(.portal-fullscreen) .game-layout > .game-stage { min-height: calc((100vw - 60px) * .733 + 170px) !important; }
}
/* Sudoku hochkant: Brett etwas kleiner, damit das Zahlenfeld ohne Scrollen erreichbar ist */
@media (max-width: 900px) {
  #sudoku-dialog[open]:not(.portal-fullscreen) .game-layout > .game-stage { min-height: 0 !important; }
  #sudoku-dialog .sudoku-board { width: min(100%, 460px); }
}
