/* Schriften liegen im Projekt (art/fonts, variable Fonts): kein Umweg über Google, index.html lädt sie vor.
   latin-ext wird nur geladen, wenn ein Zeichen daraus vorkommt. */
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('../art/fonts/cinzel-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('../art/fonts/cinzel-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Emoji-Rückfall nur mit den Emojis des Spiels (tools/emoji-font.py); eine installierte Noto-Schrift geht vor */
@font-face { font-family: 'Noto Color Emoji'; font-display: swap;
  src: local('Noto Color Emoji'), url('../art/fonts/noto-emoji-subset.woff2') format('woff2'); }
@font-face { font-family: 'Alegreya'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('../art/fonts/alegreya-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Alegreya'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('../art/fonts/alegreya-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --tex-grunge: url('../art/textures/metal.webp') 0 0 / 200px;
  --tex-patina: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='pt'><feTurbulence type='fractalNoise' baseFrequency='.06' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .1  0 0 0 0 .25  0 0 0 0 .18  0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23pt)'/></svg>");
  --cur-default: url('../art/cursors/arrow.svg') 4 3, default;
  --cur-pointer: url('../art/cursors/hand.svg') 11 3, pointer;
  --cur-zoom-in: url('../art/cursors/zoom.svg') 12 12, zoom-in;
  --cur-zoom-out: url('../art/cursors/zoom-out.svg') 12 12, zoom-out;
  --cur-help: url('../art/cursors/help.svg') 4 3, help;
  --tex-paper: url('../art/textures/paper.webp') 0 0 / 220px;
  --tex-leather: url('../art/textures/leather.webp') 0 0 / 256px;
  --tex-wood: url('../art/textures/wood.webp') 0 0 / 260px;
  --side: 290px;                                  /* Breite der Seitenleiste */
  /* Kartenbreite: so groß, wie Höhe (Schlachtfeld + Hand übereinander) und Breite (3 Karten nebeneinander) es erlauben.
     Die Bedienelemente wachsen ab 190px mit, daher zwei Höhengrenzen: fester Rand bzw. anteilig.
     Neben der Hand brauchen Hinweis und Knöpfe je rund 250px – daher die zweite Breitengrenze. */
  --gap: clamp(10px, 2.2vh, 28px);                /* Abstand zwischen den Bereichen */
  --vh: 100vh;                                    /* sichtbare Höhe; auf dem Handy ohne die Adressleiste (dvh, s. u.) */
  --qw: clamp(96px, min((var(--vh) - 300px - 4 * var(--gap)) / 3, (var(--vh) - 4 * var(--gap)) / 4.75, (100vw - var(--side) - 180px) / 4.6, (100vw - var(--side) - 600px) / 3.2), 360px);
  --gold: #e2b85a;
  --gold-dark: #8a6a2a;
  --ink: #f3e6c8;
  --muted: #b9a57e;
  --bg: #120d09;
  --parchment: #f3e8cc;
  --p0: #4c8dff;    /* Farbe Spieler 1 / Du */
  --p1: #ff5f52;    /* Farbe Spieler 2 / Computer */
  --good: #58e06a;
  --display: 'Cinzel', 'Georgia', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', serif;
  /* System-Emojis zuerst – die eigene Emoji-Schrift (rund 90 KB) wird nur geladen, wenn das System keine hat */
  /* Fließtext: Alegreya (Serifen, leicht kalligrafisch) – der Name --sans bleibt aus historischen Gründen */
  --sans: 'Alegreya', 'Georgia', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', serif;
}

@supports (height: 100dvh) { :root { --vh: 100dvh; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* Unter Home-Balken und Safari-Leiste (viewport-fit=cover) schimmert das Dokument durch – nie weiß */
html { background-color: #120d09; }
body {
  background: radial-gradient(ellipse at 50% 35%, #2e1f13 0%, var(--bg) 75%);
  color: var(--ink); font-family: var(--sans); overflow: hidden;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation; /* kein Zoom per Doppeltipp */
}
input, textarea { user-select: text; -webkit-user-select: text; } /* Codes markieren und einfügen (iOS) */
.qcard, .terrain, .spied { -webkit-touch-callout: none; } /* langes Drücken zeigt die Großansicht statt des Bild-Menüs */
html, body { cursor: var(--cur-default); }
input { cursor: text; }
button { font-family: inherit; cursor: var(--cur-pointer); }
button:disabled { cursor: var(--cur-default); }
.hidden { display: none !important; }

/* =============================================================== Menü */
.screen { position: absolute; inset: 0; }
#menu { display: grid; place-items: center; overflow-y: auto; padding: 16px; }
.menu-box {
  width: min(640px, 100%); text-align: center; padding: 30px clamp(16px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(60, 40, 22, .92), rgba(30, 20, 12, .96));
  border: 2px solid var(--gold-dark); border-radius: 18px;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, .35), 0 30px 80px rgba(0, 0, 0, .7), inset 0 0 60px rgba(0, 0, 0, .5);
}
.menu-cards { display: flex; justify-content: center; margin-bottom: 8px; }
.menu-cards { --qw: 118px; height: 200px; align-items: flex-end; margin-bottom: 26px !important; }
.menu-cards .qcard { margin: 0 -18px; }
.menu-cards .qcard:nth-child(1) { transform: rotate(-12deg) translateY(14px); }
.menu-cards .qcard:nth-child(3) { transform: rotate(12deg) translateY(14px); }
.menu-cards .qcard:nth-child(2) { z-index: 1; transform: translateY(-4px) scale(1.08); }
.title {
  font-family: var(--display); font-weight: 900; margin: 6px 0 0; font-size: clamp(30px, 6vw, 52px);
  background: linear-gradient(180deg, #fff2c4, #e2b85a 55%, #9b6c1e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .6));
}
.subtitle { margin: 4px 0 14px; color: var(--muted); font-family: var(--display); letter-spacing: 3px; font-size: 14px; }
.menu-row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.label { color: var(--muted); font-size: 14px; }
.names label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); text-align: left; }
.names input {
  background: rgba(0, 0, 0, .4); border: 1px solid var(--gold-dark); border-radius: 8px; color: var(--ink);
  padding: 8px 10px; font: inherit; font-size: 16px; width: 160px; /* unter 16px zoomt iOS beim Antippen hinein */
}
.seg { display: inline-flex; border: 1px solid var(--gold-dark); border-radius: 10px; overflow: hidden; }
.seg button { background: rgba(0, 0, 0, .3); color: var(--muted); border: 0; padding: 10px 16px; font-size: 14px; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--gold-dark); }
.seg button.active { background: linear-gradient(180deg, #7a5424, #4a3014); color: #fff2c4; }
.btn-primary {
  background: linear-gradient(180deg, #f5cf6e, #c2891f); color: #2a1804; border: 2px solid #6e4a10; border-radius: 10px;
  padding: 12px 28px; font-size: 17px; font-weight: 800; font-family: var(--display);
  box-shadow: 0 4px 0 #6e4a10, 0 8px 20px rgba(0, 0, 0, .5);
}
@media (hover: hover) { .btn-primary:hover:not(:disabled) { filter: brightness(1.08); } }
.btn-primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #6e4a10; }
.btn-primary:disabled { background: linear-gradient(180deg, #6a6258, #3e3830); color: #bdb4a6; border-color: #2a2622; box-shadow: none; }
.btn-secondary { background: rgba(0, 0, 0, .35); color: var(--ink); border: 1px solid var(--gold-dark); border-radius: 10px; padding: 12px 20px; font-size: 15px; font-weight: 700; }
.btn-small { background: rgba(0, 0, 0, .35); color: var(--muted); border: 1px solid #4a3a24; border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
@media (hover: hover) { .btn-small:hover, .btn-secondary:hover { color: var(--ink); border-color: var(--gold-dark); } }

/* =============================================================== Spiel-Layout */
#game { display: grid; grid-template-columns: 1fr var(--side); }
.table {
  display: grid; grid-template-rows: auto auto 1fr auto auto; min-height: 0; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 220, 160, .1), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #4a3220, #5d4028 50%, #4a3220);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, .75);
}
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; gap: 10px; }
.round-info { font-family: var(--display); font-weight: 800; color: var(--gold); font-size: 15px; display: flex; gap: 14px; flex-wrap: wrap; }
.round-info .pot { color: var(--ink); font-family: var(--sans); font-size: 13px; background: rgba(0, 0, 0, .35); border-radius: 20px; padding: 2px 10px; }
.top-buttons { display: flex; gap: 6px; }
.only-narrow { display: none; }
.fs-toggle { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.fs-toggle[hidden] { display: none; }

/* Spielerleiste */
.player-bar {
  display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2vw, 22px); flex-wrap: wrap;
  margin: 0 auto; padding: 6px 16px; border-radius: 40px; background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(226, 184, 90, .2);
}
.player-bar .avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 60%, white), var(--pc) 60%, #000 150%);
  border: 2px solid var(--gold-dark);
}
.player-bar .pname { font-family: var(--display); font-weight: 800; font-size: 16px; }
.player-bar .pick-mark { font-size: 18px; filter: drop-shadow(0 0 6px rgba(255, 210, 80, .8)); animation: pick-mark .5s ease; }
@keyframes pick-mark { from { transform: scale(0) rotateY(540deg); } }
.player-bar .chip { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.player-bar .chip b { color: var(--ink); font-size: 15px; }
.quartet-slots { display: flex; gap: 4px; }
.qslot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px;
  border: 2px dashed rgba(226, 184, 90, .35); background: rgba(0, 0, 0, .25);
}
.qslot.filled { border: 2px solid var(--gold); background: radial-gradient(circle, #6a4a1a, #2a1a08); box-shadow: 0 0 10px rgba(226, 184, 90, .6); }
.horn { font-size: 20px; }
.horn { position: relative; display: inline-flex; flex-direction: column; align-items: center; line-height: 1; }
.horn.ready { filter: drop-shadow(0 0 6px rgba(255, 210, 80, .75)); }
.horn.charging { filter: grayscale(.6) brightness(.8); }
.horn .pips { display: flex; gap: 2px; margin-top: 2px; }
.horn .pips i { width: 5px; height: 5px; border-radius: 50%; background: rgba(0, 0, 0, .55); box-shadow: inset 0 0 0 1px rgba(226, 184, 90, .5); }
.horn .pips i.on { background: var(--gold); box-shadow: 0 0 4px rgba(255, 210, 80, .8); }
.status { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: rgba(0, 0, 0, .35); color: var(--muted); }
.status.done { color: var(--good); }

/* Schlachtfeld */
.battlefield { display: flex; justify-content: center; align-items: center; gap: clamp(10px, 3vw, 44px); padding: 10px; min-height: 0; }
.slot { width: var(--qw); height: calc(var(--qw) * 1.5); position: relative; flex: none; }
.slot .placeholder {
  position: absolute; inset: 0; border-radius: 12px; border: 2px dashed rgba(226, 184, 90, .3);
  display: grid; place-items: center; text-align: center; color: rgba(243, 230, 200, .45); font-size: 13px; padding: 10px;
}
.slot .who { position: absolute; top: -22px; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.slot .value {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; flex-direction: column; align-items: center; width: max-content; max-width: calc(var(--qw) + 28px);
  font-weight: 900; font-size: 20px; line-height: 1.1; color: #fff; text-shadow: 0 2px 4px #000;
}
.slot .value .num { font-weight: 900; transition: color .2s; }
.slot .value .num.up { color: #9cf08f; }
.slot .value .num.down { color: #ff9a8a; }
/* Was den Wert verändert hat, Zeile für Zeile (Duell-Animation) */
.slot .value .steps {
  list-style: none; margin: .2em 0 0; padding: 0; text-align: center;
  font-size: 13px; font-weight: 800; line-height: 1.25; text-shadow: 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, .8);
}
.slot .value .steps li { color: #f3e6c8; }
.slot .value .steps li.ability { color: #ffd76a; }
.slot .value .steps li.good { color: #8fe388; }
.slot .value .steps li.bad { color: #ff8f80; }
.slot .value .steps li.new { animation: step-in .35s ease-out; }
@keyframes step-in { from { opacity: 0; transform: translateY(-6px) scale(.9); } }
.slot.win .face { filter: drop-shadow(0 0 18px rgba(255, 210, 80, .9)); }
.slot.win::after {
  content: 'SIEG'; position: absolute; top: -14px; right: -14px; z-index: 3; transform: rotate(12deg);
  background: linear-gradient(180deg, #f5cf6e, #c2891f); color: #2a1804; font-family: var(--display); font-weight: 900;
  padding: 4px 10px; border-radius: 8px; border: 2px solid #6e4a10; box-shadow: 0 4px 10px rgba(0, 0, 0, .6);
  animation: pop .4s cubic-bezier(.2, 1.8, .4, 1);
}
.slot.lose .face { filter: grayscale(.7) brightness(.6); transition: filter .6s; }
@keyframes pop { from { transform: scale(0) rotate(12deg); } }

.center { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: calc(var(--qw) * 1.15); }
.center-rest { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.center .message { text-align: center; font-weight: 700; font-size: 14px; min-height: 20px; max-width: 260px; line-height: 1.35; }
.center .message.big { font-family: var(--display); font-size: 18px; color: #fff2c4; }
.stat-choice { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hand-title .result-line { color: var(--ink); font-weight: 700; text-align: center; }
.hand-title .result-line .big { font-family: var(--display); font-weight: 900; color: #fff2c4; font-size: 1.25em; }
.stat-choice button {
  background: linear-gradient(180deg, #7a5424, #4a3014); color: #fff2c4; border: 2px solid var(--gold-dark); border-radius: 10px;
  padding: 8px 10px; font-weight: 800; font-size: 14px;
}
@media (hover: hover) { .stat-choice button:hover { filter: brightness(1.2); border-color: var(--gold); } }

/* Schlachtfeld-Karte: gleiches Format wie die Quartettkarten, aber dunkel eingefärbt (nur der Goldrahmen bleibt), Farbe je nach Art */
.terrain {
  --fc: #5f7a44;
  position: relative; width: var(--qw); height: calc(var(--qw) * 1.5); flex: none; color: #f0e2bd; text-align: center; overflow: hidden;
  padding: calc(var(--qw) * .028); border-radius: 14px;
  animation: terrain-in .5s ease;
}
.terrain.low { --fc: #56687a; }
.terrain.choice { --fc: #6e5690; }
.terrain .frame {
  height: 100%; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
  background:
    var(--tex-paper),
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, .08), transparent 50%),
    radial-gradient(ellipse at 80% 95%, color-mix(in srgb, var(--fc) 35%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--fc) 22%, #2a1d10), color-mix(in srgb, var(--fc) 14%, #140d06));
  background-blend-mode: soft-light, normal, normal, normal;
  box-shadow: inset 0 0 0 2px #140c03, inset 0 0 0 3.5px var(--fc), inset 0 0 14px rgba(0, 0, 0, .6);
}
.terrain .head {
  /* so hoch wie die Kopfleiste der Quartettkarten: Code-Schild + Innenabstand oben/unten + 1px Kante (Werte siehe Containerabfragen) */
  display: flex; align-items: center; justify-content: center; padding: 3.5px 6px 0; flex: none; min-height: calc(var(--qw) * .137 + 1px);
  background:
    var(--tex-paper),
    linear-gradient(180deg, color-mix(in srgb, var(--fc) 55%, #1e140a), color-mix(in srgb, var(--fc) 40%, #0e0904));
  background-blend-mode: soft-light, normal;
  border-bottom: 1px solid color-mix(in srgb, var(--fc) 40%, #000);
  color: #d9b86a; font-weight: 800; font-size: calc(var(--qw) * .061); text-shadow: 0 1px 1px rgba(0, 0, 0, .6);
}
/* Der Buchstabenabstand hängt auch hinter dem letzten Zeichen an – links gleich viel einrücken, damit der Text mittig sitzt */
.terrain .kicker {
  font-family: var(--display); letter-spacing: calc(var(--qw) * .007); padding-left: calc(var(--qw) * .007);
  text-transform: uppercase; white-space: nowrap; overflow: hidden; line-height: 1; padding-top: .12em;
}
.terrain .art {
  position: relative; aspect-ratio: 7 / 5; flex: none; overflow: hidden; display: grid; place-items: center; font-size: calc(var(--qw) * .3);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--fc) 30%, white), color-mix(in srgb, var(--fc) 70%, #000));
}
.terrain .art img, .qcard .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.terrain .art::after, .qcard .art::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 230, 160, .35), inset 0 -18px 22px -12px rgba(0, 0, 0, .6), inset 0 10px 18px -12px rgba(0, 0, 0, .5);
}
.terrain .tname {
  position: relative; z-index: 2; flex: none; align-self: center; width: 96%; margin-top: calc(var(--qw) * -.075);
  font-family: var(--display); font-weight: 900; font-size: calc(var(--qw) * .074); line-height: 1.1;
  padding: 4px 12px; color: #fff2c4; text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
  background:
    var(--tex-paper),
    linear-gradient(180deg, color-mix(in srgb, var(--fc) 45%, #5a3d1c), color-mix(in srgb, var(--fc) 38%, #3a2610));
  clip-path: polygon(5% 0, 95% 0, 100% 50%, 95% 100%, 5% 100%, 0 50%);
  box-shadow: inset 0 1px 0 rgba(226, 184, 90, .7), inset 0 -1px 0 rgba(226, 184, 90, .7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.terrain .tname.long { font-size: calc(var(--qw) * .064); padding-top: 5px; padding-bottom: 5px; }
.terrain .tname.xlong { font-size: calc(var(--qw) * .056); padding: 6px 10px; }
/* Unterer Teil: zählende Eigenschaft und Sonderregel, mittig im freien Pergament */
.terrain .body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: calc(var(--qw) * .04); padding: 4px 8px 8px; }
.terrain .counts {
  padding: calc(var(--qw) * .025) 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .3); border: 1px solid rgba(226, 184, 90, .35);
  font-weight: 800; font-size: calc(var(--qw) * .08); color: #ffe6a8;
}
/* Neu markierte Eigenschaft (Umlenken, Gestaltwandel) leuchtet kurz auf */
.qcard .row.active.flash { animation: stat-flash 1s ease-out; }
@keyframes stat-flash {
  0%, 40% { box-shadow: 0 0 0 2px #ffe08a, 0 0 14px 4px rgba(255, 214, 110, .9); filter: brightness(1.35); }
  100% { box-shadow: 0 0 0 0 transparent; filter: none; }
}
.terrain .ttext {
  font-size: calc(var(--qw) * .064); font-weight: 700; color: #e8d8b0; line-height: 1.25;
  padding-top: calc(var(--qw) * .035); border-top: 1px solid rgba(226, 184, 90, .25);
}
@keyframes terrain-in { from { transform: rotateY(90deg) scale(.8); opacity: 0; } }

/* =============================================================== Quartettkarte */
.qcard {
  --fc: #8b7355;
  position: relative; width: var(--qw); height: calc(var(--qw) * 1.5); flex: none; color: #2a1a0a; text-align: left; overflow: hidden;
  padding: calc(var(--qw) * .028); border-radius: 14px;
  background: var(--tex-grunge), linear-gradient(135deg, #f7e3a0, #b8862b 28%, #f2d27a 52%, #8a5d17 78%, #e9c877);
  background-blend-mode: soft-light, normal;
  box-shadow: 0 0 0 1.5px #2a1804, inset 0 0 0 1px rgba(255, 255, 255, .55), 0 8px 18px rgba(0, 0, 0, .6);
}
.qcard .frame {
  height: 100%; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
  background:
    var(--tex-paper),
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, .5), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(150, 110, 50, .25), transparent 60%),
    linear-gradient(180deg, #f6ecd2, #e2cf9f);
  background-blend-mode: multiply, normal, normal, normal;
  box-shadow: inset 0 0 0 2px #3a2508, inset 0 0 0 3.5px var(--fc), inset 0 0 14px rgba(90, 60, 20, .35);
}
.qcard .head {
  display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 3px 6px 3px 4px; flex: none;
  background: var(--tex-paper), linear-gradient(180deg, color-mix(in srgb, var(--fc) 75%, white), var(--fc) 55%, color-mix(in srgb, var(--fc) 70%, black));
  background-blend-mode: soft-light, normal;
  color: #fff; font-weight: 800; font-size: calc(var(--qw) * .066); text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
  border-bottom: 1.5px solid #3a2508;
}
.qcard .code {
  display: grid; place-items: center; min-width: calc(var(--qw) * .16); height: calc(var(--qw) * .12); border-radius: 6px; padding: 0 4px;
  background: linear-gradient(180deg, #fff8e0, #e9cf8a); color: #3a2508; text-shadow: none; border: 1.5px solid #3a2508;
  font-family: var(--display); font-weight: 900; font-size: calc(var(--qw) * .08);
}
.qcard .art {
  position: relative; aspect-ratio: 7 / 5; flex: none; overflow: hidden; display: grid; place-items: center;
  font-size: calc(var(--qw) * .3);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--fc) 30%, white), color-mix(in srgb, var(--fc) 70%, #000));
}
.qcard .art .fallback { filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .45)); }
/* Bewegte Bildeffekte (siehe ART_FX in ui.js): die Ebene liegt deckungsgleich über dem 4:3-Bild */
.qcard .fx {
  position: absolute; left: 0; top: 50%; width: 100%; aspect-ratio: 4 / 3; margin-top: -37.5%;
  container-type: size; pointer-events: none; overflow: visible;
}
.fx i {
  position: absolute; display: block; border-radius: 50%; will-change: transform, opacity;
  left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: calc(var(--s) * 1cqw); aspect-ratio: 1; opacity: 0;
  animation-iteration-count: infinite; animation-timing-function: linear;
  background: radial-gradient(circle, rgba(255, 255, 240, .95) 0, rgba(var(--c), .9) 35%, rgba(var(--c), .35) 60%, transparent 72%);
}
/* Lichtflecken */
.fx .fx-glow {
  left: calc(var(--x) * 1% - var(--r) * 1cqw); top: calc(var(--y) * 1% - var(--r) * 1cqw);
  width: calc(var(--r) * 2cqw); mix-blend-mode: screen; opacity: .6;
  background: radial-gradient(circle, rgba(var(--c), .6), rgba(var(--c), .2) 40%, transparent 70%);
}
.fx-glow.flicker { animation-name: fx-flicker; }
.fx-glow.pulse { animation-name: fx-pulse; animation-timing-function: ease-in-out; animation-direction: alternate; }
.fx-glow.strike { animation-name: fx-strike; animation-timing-function: ease-out; }
.fx-glow.flash { animation-name: fx-flash; }
@keyframes fx-flicker {
  0%, 100% { opacity: .7; transform: scale(1); } 12% { opacity: .95; } 25% { opacity: .6; transform: scale(.96); }
  41% { opacity: 1; transform: scale(1.04); } 58% { opacity: .75; } 72% { opacity: .9; transform: scale(1.02); } 86% { opacity: .55; }
}
@keyframes fx-pulse { from { opacity: .3; } to { opacity: .9; } }
@keyframes fx-strike { 0% { opacity: 1; transform: scale(1.15); } 25%, 100% { opacity: .25; transform: scale(1); } }
/* Blitz: zweimal kurz hintereinander, dann lange Ruhe */
@keyframes fx-flash { 0%, 100% { opacity: 0; } 1.5% { opacity: 1; } 3.5% { opacity: .15; } 5.5% { opacity: .9; } 11% { opacity: 0; } }

/* Aufsteigende Teilchen (Glut, Seelen, Blasen), treiben dabei etwas zur Seite */
.fx-rise { animation-name: fx-rise; }
.fx-rise.bubble { background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, .9) 0 12%, transparent 18%), radial-gradient(circle, transparent 48%, rgba(var(--c), .85) 58%, transparent 70%); }
@keyframes fx-rise {
  0% { transform: translate(-50%, -50%); opacity: 0; }
  10% { opacity: 1; }
  30% { opacity: .6; }
  45% { transform: translate(calc(-50% + var(--dx) * .15cqw), calc(-50% + var(--dy) * .45cqh)); opacity: 1; }
  70% { opacity: .5; }
  100% { transform: translate(calc(-50% + var(--dx) * 1cqw), calc(-50% + var(--dy) * 1cqh)) scale(.5); opacity: 0; }
}
/* Schwebende Lichter: wandern zwischen zwei Punkten hin und her und glimmen dabei */
.fx .fx-drift { animation-name: fx-drift; animation-timing-function: ease-in-out; animation-direction: alternate; }
@keyframes fx-drift {
  0% { transform: translate(-50%, -50%); opacity: 0; }
  25% { opacity: .9; }
  50% { transform: translate(calc(-50% + var(--ax) * 1cqw), calc(-50% + var(--ay) * 1cqw)); opacity: .3; }
  75% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--bx) * 1cqw), calc(-50% + var(--by) * 1cqw)); opacity: .2; }
}
/* Schnee und Regen */
.fx .fx-fall { top: -4%; animation-name: fx-fall; }
.fx .fx-fall.rain { aspect-ratio: 1 / 14; border-radius: 1cqw; background: linear-gradient(180deg, transparent, rgba(var(--c), .7)); }
@keyframes fx-fall {
  0% { transform: translate(0, 0); opacity: 0; }
  8%, 88% { opacity: .85; }
  100% { transform: translate(calc(var(--dx) * 1cqw), 108cqh); opacity: 0; }
}
/* Funkeln: ein Lichtkreuz, das kurz aufgeht und wieder verschwindet */
.fx .fx-twinkle {
  border-radius: 0; animation-name: fx-twinkle; animation-timing-function: ease-in-out;
  background:
    radial-gradient(circle, #fff 0 8%, rgba(var(--c), .6) 14%, transparent 30%),
    linear-gradient(90deg, transparent 0, rgba(var(--c), .9) 50%, transparent 100%) center / 100% 7% no-repeat,
    linear-gradient(0deg, transparent 0, rgba(var(--c), .9) 50%, transparent 100%) center / 7% 100% no-repeat;
}
@keyframes fx-twinkle {
  0%, 22%, 100% { transform: translate(-50%, -50%) scale(0) rotate(0); opacity: 0; }
  11% { transform: translate(-50%, -50%) scale(1) rotate(45deg); opacity: 1; }
}
/* Nebelschwaden ziehen langsam hin und her */
.fx .fx-mist {
  width: calc(var(--w) * 1cqw); aspect-ratio: auto; height: calc(var(--h) * 1cqh); border-radius: 50%;
  animation-name: fx-mist; animation-timing-function: ease-in-out; animation-direction: alternate;
  background: radial-gradient(closest-side, rgba(var(--c), .35), rgba(var(--c), .12) 60%, transparent);
}
@keyframes fx-mist { 0% { transform: translateX(0); opacity: .4; } 50% { opacity: .9; } 100% { transform: translateX(calc(var(--dx) * 1cqw)); opacity: .5; } }
/* Windschlieren ziehen von rechts nach links durchs Bild */
.fx .fx-streak {
  left: 100%; width: calc(var(--w) * 1cqw); aspect-ratio: auto; height: .3cqw; border-radius: 1cqw;
  animation-name: fx-streak; background: linear-gradient(90deg, rgba(var(--c), .8), transparent);
}
@keyframes fx-streak {
  0% { transform: translateX(0); opacity: 0; }
  3% { opacity: .8; }
  30%, 100% { transform: translateX(-130cqw); opacity: 0; }
}
/* Funken im Takt: schnell hoch und zur Seite, dann fallen sie und verglühen. Der Funke ist ein Strich in Flugrichtung */
.fx .fx-spark { animation-name: fx-spark; background: none; }
.fx-spark::before {
  content: ''; position: absolute; left: -75%; top: 30%; width: 250%; height: 40%; border-radius: 50%; rotate: var(--a);
  background: linear-gradient(90deg, transparent, rgba(255, 140, 30, .6) 45%, #ffe890 80%, #fff);
  box-shadow: 0 0 .6cqw rgba(255, 170, 60, .8);
}
@keyframes fx-spark {
  0% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; animation-timing-function: ease-out; }
  2% { opacity: 1; }
  13% { transform: translate(calc(-50% + var(--dx) * .7cqw), calc(-50% + var(--dy) * 1cqw)); animation-timing-function: ease-in; }
  30%, 100% { transform: translate(calc(-50% + var(--dx) * 1cqw), calc(-50% + (var(--dy) + var(--g)) * 1cqw)) scale(.3); opacity: 0; }
}
.qcard .name {
  position: relative; z-index: 2; flex: none; align-self: center; width: 96%; margin-top: calc(var(--qw) * -.075);
  font-family: var(--display); font-weight: 900; text-align: center; font-size: calc(var(--qw) * .074); line-height: 1.1;
  padding: 4px 12px; color: #fff2c4; text-shadow: 0 1px 2px #000;
  background: var(--tex-paper), linear-gradient(180deg, color-mix(in srgb, var(--fc) 55%, #2a1804), color-mix(in srgb, var(--fc) 30%, #120a02));
  background-blend-mode: soft-light, normal;
  clip-path: polygon(5% 0, 95% 0, 100% 50%, 95% 100%, 5% 100%, 0 50%);
  box-shadow: inset 0 1.5px 0 var(--gold), inset 0 -1.5px 0 var(--gold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qcard .name.long { font-size: calc(var(--qw) * .062); padding-top: 5px; padding-bottom: 5px; }
.qcard .name.xlong { font-size: calc(var(--qw) * .054); padding: 6px 10px; }
.qcard .ability {
  flex: none; margin: 2px 6px 0; padding: 1px 6px; border-radius: 6px; text-align: center; line-height: 1.2;
  background: linear-gradient(180deg, rgba(58, 37, 8, .1), rgba(58, 37, 8, .18)); border: 1px solid rgba(58, 37, 8, .3);
  font-size: calc(var(--qw) * .058); color: #3a2508; white-space: nowrap;
}
.qcard .ability b { font-weight: 900; }
.qcard .ability.used { opacity: .55; text-decoration: line-through; }
/* Beschreibung erscheint beim Darüberfahren über dem Bild */
.qcard .ability .atext {
  position: absolute; left: 7%; right: 7%; top: calc(var(--qw) * .2); z-index: 5; pointer-events: none;
  white-space: normal; font-size: max(11px, calc(var(--qw) * .06)); font-weight: 600; line-height: 1.3; color: #fff2c4;
  background: rgba(20, 12, 4, .9); border: 1px solid var(--gold-dark); border-radius: 8px; padding: 6px 8px;
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
@media (hover: hover) { .qcard:hover .ability .atext { opacity: 1; transform: none; } }
/* Touch: die Beschreibung erscheint auf der ausgewählten Handkarte */
@media (hover: none) { .hand .qcard.selected .ability .atext { opacity: 1; transform: none; } }
.zoom .qcard .ability .atext, .gallery-grid .qcard .ability .atext, .menu-cards .qcard .ability .atext { display: none; }
.spy-line { color: #bfe3ff; font-weight: 700; margin-bottom: 2px; }
.spy-line.exposed { color: #ffc2a8; }
/* Eigene Karte, die der Gegner per Spion kennt: kleines Späher-Siegel in der Ecke */
.qcard.exposed { box-shadow: 0 0 0 1.5px #2a1804, 0 0 14px rgba(255, 150, 110, .55); }
.exposed-mark {
  position: absolute; top: calc(var(--qw) * .15); right: calc(var(--qw) * .06); z-index: 6; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; line-height: 1;
  background: radial-gradient(circle at 38% 32%, #c4735d, #6e2a1a 60%, #3a1208);
  box-shadow: 0 0 0 1.5px #2a0c04, 0 0 0 3px rgba(255, 190, 160, .45), 0 2px 6px rgba(0, 0, 0, .6);
}
.qcard .stats { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; padding: 2px 5px 4px; min-height: 0; }
.qcard .row {
  display: grid; grid-template-columns: calc(var(--qw) * .11) 1fr auto; align-items: center; gap: 4px;
  font-size: calc(var(--qw) * .066); padding: 1px 5px; border-radius: 6px;
}
.qcard .row .lbl { display: flex; flex-direction: column; gap: 1px; font-weight: 600; }
.qcard .row .bar { height: 3px; border-radius: 2px; background: rgba(42, 26, 10, .15); overflow: hidden; }
.qcard .row .bar i { display: block; height: 100%; background: linear-gradient(90deg, color-mix(in srgb, var(--fc) 60%, white), var(--fc)); }
.qcard .row .num { font-weight: 900; font-size: calc(var(--qw) * .085); min-width: 2ch; text-align: right; }
.qcard .row .bonus { color: #1d8a2c; font-weight: 900; font-size: calc(var(--qw) * .06); margin-left: 2px; cursor: var(--cur-help); }
.qcard .row .bonus.bad { color: #b3261e; } /* schadet dir (z. B. Zuschlag, wo der niedrigere Wert gewinnt) */
.qcard .row.active { background: linear-gradient(90deg, #ffe08a, #f2c14e); box-shadow: 0 0 0 1.5px #8a5a10, 0 0 10px rgba(255, 200, 60, .7); }
.qcard .row.active .lbl { font-weight: 900; }
.qcard .row.dim { opacity: .5; }
.card-back {
  width: var(--qw); height: calc(var(--qw) * 1.5); border-radius: 14px;
  background:
    url('../art/terrains/back.webp') center / 100% 100% no-repeat,
    radial-gradient(circle at 50% 50%, #e2b85a 0 14%, #6e4a10 15% 17%, transparent 18%),
    repeating-linear-gradient(45deg, #5a2a16 0 8px, #4a2010 8px 16px);
  box-shadow: 0 0 0 1.5px #2a1804, 0 0 0 3px var(--gold-dark) inset, 0 8px 18px rgba(0, 0, 0, .6);
}

/* Wendekarte */
.flipper { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, 1.3, .5, 1); }
.flipper .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flipper .front { transform: rotateY(180deg); }
.flipper.revealed { transform: rotateY(180deg); }
.flipper.enter { animation: slide-in .35s ease; }
@keyframes slide-in { from { transform: translateY(30px) scale(.9); opacity: 0; } }

/* Hand */
.hand-area { padding: 6px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hand-title { font-size: 13px; font-weight: 700; color: var(--muted); min-height: 18px; }
.hand { display: flex; gap: clamp(8px, 1.6vw, 20px); justify-content: center; min-height: calc(var(--qw) * 1.5); }
.hand .qcard { cursor: var(--cur-pointer); transition: transform .15s, box-shadow .15s; }
/* Jede Handkarte ist eine eigene Ebene: Siegel und Effekte darin liegen nie über einer vergrößerten Nachbarkarte */
.hand .qcard { isolation: isolate; }
@media (hover: hover) { .hand .qcard:hover { transform: translateY(-8px); } }
.hand .qcard:focus-visible { outline: 3px solid #ffd84d; outline-offset: 3px; }
.hand .qcard.selected { transform: translateY(-14px); box-shadow: 0 0 0 3px #ffd84d, 0 0 26px rgba(255, 216, 77, .8), 0 10px 20px rgba(0, 0, 0, .6); }
.hand.locked .qcard { cursor: var(--cur-default); }
@media (hover: hover) { .hand.locked .qcard:hover { transform: none; } }
.hand .card-back { width: calc(var(--qw) * .6); height: calc(var(--qw) * .9); }
.hand-actions { display: flex; gap: 10px; align-items: center; min-height: 48px; }
.horn-toggle {
  background: rgba(0, 0, 0, .35); color: var(--ink); border: 2px solid var(--gold-dark); border-radius: 10px;
  padding: 9px 14px; font-weight: 800; font-size: 14px;
}
.horn-toggle.on { background: linear-gradient(180deg, #ffe28a, #d49a1e); color: #3a2204; border-color: #6e4a10; box-shadow: 0 0 16px rgba(255, 200, 60, .6); }
.horn-toggle:disabled { opacity: .4; }

/* =============================================================== Seitenleiste */
.sidebar { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: linear-gradient(180deg, #24180e, #150e08); min-height: 0; }
.sidebar h3 { font-family: var(--display); color: var(--gold); font-size: 14px; margin: 4px 0 0; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.overview { display: flex; flex-direction: column; gap: 4px; }
.ov-row { display: grid; grid-template-columns: 1fr repeat(4, 34px); gap: 3px; align-items: center; font-size: 12px; }
.ov-row .fname { display: flex; gap: 5px; align-items: center; white-space: nowrap; overflow: hidden; }
.ov-row.done .fname { color: var(--gold); font-weight: 800; }
.cell {
  height: 22px; border-radius: 4px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800;
  background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .4);
}
.own-0 { background: color-mix(in srgb, var(--p0) 70%, #000); color: #fff; }
.own-1 { background: color-mix(in srgb, var(--p1) 70%, #000); color: #fff; }
.in-pot { background: #6a6258; color: #fff; }
.laid-0 { background: linear-gradient(180deg, #f5cf6e, #c2891f); color: #2a1804; box-shadow: inset 0 -3px 0 var(--p0); }
.laid-1 { background: linear-gradient(180deg, #f5cf6e, #c2891f); color: #2a1804; box-shadow: inset 0 -3px 0 var(--p1); }
.cell.played { outline: 2px solid #fff; }
.log {
  flex: 1; overflow-y: auto; min-height: 0; font-size: 12px; line-height: 1.35;
  background: rgba(0, 0, 0, .3); border: 1px solid #3a2a18; border-radius: 10px; padding: 8px;
}
.log div { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); color: #d9c9a6; }
.log .log-round { color: var(--gold); font-weight: 800; margin-top: 4px; }
.log .log-win { color: #fff; }
.log .log-quartet, .log .log-end { color: var(--good); font-weight: 800; }
.log .log-tie { color: #c9c0b0; }
.log .log-horn { color: #ffd76a; }

/* =============================================================== Effekte & Overlays */
/* Münzwurf auf Wahlfeldern: wer die Eigenschaft wählt */
.coin-toss {
  position: fixed; inset: 0; z-index: 85; display: grid; place-content: center; justify-items: center; gap: 22px; cursor: pointer;
  background: radial-gradient(circle, rgba(8, 5, 3, .92), rgba(8, 5, 3, .7) 50%, rgba(8, 5, 3, .45) 100%); animation: coin-in .3s ease;
}
.coin-toss.leaving { animation: coin-out .35s ease forwards; }
@keyframes coin-in { from { opacity: 0; } }
@keyframes coin-out { to { opacity: 0; } }
.coin-kicker { font-family: var(--display); font-weight: 900; color: var(--gold); letter-spacing: 3px; font-size: clamp(24px, 3.6vw, 44px); text-align: center; text-shadow: 0 2px 4px #000; padding: 0 16px; }
.coin-air { --size: clamp(140px, 20vw, 230px); perspective: 900px; animation: coin-air 1.45s cubic-bezier(.3, 0, .3, 1) both; transition: filter .3s ease; }
@keyframes coin-air {
  0% { transform: translateY(50px) scale(.6); }
  45% { transform: translateY(-80px) scale(1.15); }
  86% { transform: translateY(0) scale(1); }
  93% { transform: translateY(-12px) scale(1); }
  100% { transform: translateY(0) scale(1); }
}
.coin { width: var(--size); height: var(--size); position: relative; transform-style: preserve-3d; transform: rotateY(var(--end)); animation: coin-spin 1.45s cubic-bezier(.2, .55, .35, 1) both; }
@keyframes coin-spin { from { transform: rotateY(0deg); } to { transform: rotateY(var(--end)); } }
.coin-face {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden;
  font-size: calc(var(--size) * .48); line-height: 1;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #e2b85a 42%, #8a6a2a 100%);
  box-shadow: inset 0 0 0 calc(var(--size) * .045) #b58a3a, inset 0 0 0 calc(var(--size) * .085) var(--pc), inset 0 0 0 calc(var(--size) * .1) #6a4a1a, 0 12px 30px rgba(0, 0, 0, .6);
}
.coin-face.side-1 { transform: rotateY(180deg); }
.coin-face span { filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.coin-toss.landed .coin-air { filter: drop-shadow(0 0 22px var(--win)); }
.coin-result {
  font-family: var(--display); font-weight: 900; font-size: clamp(26px, 4.2vw, 48px); color: #fff2c4; text-align: center; padding: 0 16px;
  text-shadow: 0 3px 0 #3a2204, 0 0 20px rgba(226, 184, 90, .6); opacity: 0; transform: translateY(8px);
}
.coin-toss.landed .coin-result { opacity: 1; transform: none; transition: opacity .35s ease, transform .35s ease; }
@media (prefers-reduced-motion: reduce) { .coin-air, .coin, .player-bar .pick-mark { animation: none; } }
.toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 90; pointer-events: none;
  background: rgba(20, 12, 6, .95); border: 1px solid #ff5a4a; color: #ffd0c8; padding: 10px 18px; border-radius: 10px; font-weight: 600;
  animation: toast 2s ease forwards;
}
@keyframes toast { 0% { opacity: 0; } 10%, 80% { opacity: 1; } 100% { opacity: 0; } }
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(8, 5, 3, .8); display: grid; place-items: center; padding: 16px; }
.modal {
  width: min(560px, 100%); max-height: 90vh; max-height: 90dvh; overflow-y: auto; text-align: center;
  background: linear-gradient(180deg, #3c2816, #1e140b); border: 2px solid var(--gold-dark); border-radius: 16px;
  padding: 24px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .8);
}
.modal h2 { font-family: var(--display); color: var(--gold); margin: 0 0 12px; font-size: 28px; }
.modal h3 { font-family: var(--display); color: var(--gold); margin: 16px 0 6px; }
.modal p { color: var(--ink); line-height: 1.5; }
.modal .buttons { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.modal .big-emoji { font-size: 60px; }
.modal .overview { text-align: left; }
.rules { text-align: left; }
.rules h2, .rules h3 { text-align: center; }
.rules .btn-primary { display: block; margin: 18px auto 0; }
.rules-goal { font-size: 15px; margin: 0 0 4px; text-align: center; }
.rules-quick { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.rules-quick li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; font-size: 15px; line-height: 1.4; }
.rules-quick li > span { font-size: 24px; text-align: center; }
.final-score { display: flex; justify-content: center; gap: 30px; margin: 10px 0; }
.final-score div { display: flex; flex-direction: column; gap: 2px; }
.final-score b { font-size: 26px; color: #fff2c4; }

/* =============================================================== Schmale Bildschirme */
/* Ohne Seitenleiste schon auf dem Tablet quer – daneben bliebe für Hand und Knöpfe zu wenig Platz */
@media (max-width: 1200px) {
  :root { --side: 0px; }
  #game { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .only-narrow { display: inline-block; }
}


/* =============================================================== Zoom & Galerie */
.zoom { display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: var(--cur-zoom-out); --qw: min(60vh / 1.5, 86vw); }
.zoom .terrain { animation: none; }
.zoom .qcard { animation: none; }
.zoom-hint { color: var(--muted); font-size: 13px; margin: 0; }
.zoom-note { color: var(--gold); font-weight: 700; max-width: 420px; text-align: center; margin: 0; }
.modal.gallery { width: min(1200px, 100%); height: calc(100vh - 32px); height: calc(100dvh - 32px); max-height: none; overflow: hidden; display: flex; flex-direction: column; }
.gallery-tabs { margin-bottom: 6px; align-self: center; }
/* Feste Höhe, kein Scrollen: die Galerie rechnet aus, wie viele Karten pro Seite hineinpassen */
.gallery-grid {
  --qw: 150px; flex: 1; min-height: 0; padding: 10px 0; display: grid; align-content: center;
  grid-template-columns: repeat(auto-fill, calc(var(--qw) * 1.22)); justify-content: center; gap: 16px; justify-items: center;
}
.gallery-pager { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 4px; }
.gallery-pager.single { visibility: hidden; }
.pager-info { font-family: var(--display); color: var(--gold); font-size: 17px; letter-spacing: .06em; min-width: 9em; text-shadow: 0 1px 0 #000; }
.pager-info::before, .pager-info::after { content: '❦'; color: var(--gold-dark); margin: 0 .5em; }
.pager-info::before { display: inline-block; transform: scaleX(-1); }
.pager-arrow {
  width: 56px; height: 56px; padding: 0; border: 0; background: none; border-radius: 50%; cursor: var(--cur-pointer);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .7)); transition: transform .15s, filter .15s;
}
.pager-arrow svg { display: block; width: 100%; height: 100%; }
.pager-arrow.prev svg { transform: scaleX(-1); }
@media (hover: hover) { .pager-arrow:not(:disabled):hover { transform: scale(1.08); filter: drop-shadow(0 0 8px rgba(242, 210, 122, .55)) drop-shadow(0 3px 5px rgba(0, 0, 0, .7)); } }
.pager-arrow:not(:disabled):active { transform: scale(.96); }
.pager-arrow:disabled { opacity: .35; filter: grayscale(.7); cursor: var(--cur-default); }
.gallery-grid .qcard, .gallery-grid .terrain { cursor: var(--cur-zoom-in); transition: transform .15s; animation: none; }
@media (hover: hover) { .gallery-grid .qcard:hover, .gallery-grid .terrain:hover { transform: translateY(-4px) scale(1.03); } }
@media (max-width: 640px) { .gallery-grid { --qw: 128px; } }

/* =============================================================== Mitwachsende Bedienelemente */
/* Größen wachsen ab 190px Kartenbreite proportional mit, höchstens auf 150 %. */
.player-bar { gap: clamp(18px, calc(var(--qw) * 0.0947), 27px); padding: clamp(6px, calc(var(--qw) * 0.0316), 9px) clamp(16px, calc(var(--qw) * 0.0842), 24px); }
.player-bar .avatar { width: clamp(42px, calc(var(--qw) * 0.2211), 63px); height: clamp(42px, calc(var(--qw) * 0.2211), 63px); font-size: clamp(22px, calc(var(--qw) * 0.1158), 33px); }
.player-bar .pname { font-size: clamp(16px, calc(var(--qw) * 0.0842), 24px); }
.player-bar .pick-mark, .horn { font-size: clamp(19px, calc(var(--qw) * 0.1000), 28.5px); }
.player-bar .chip { font-size: clamp(13px, calc(var(--qw) * 0.0684), 19.5px); }
.player-bar .chip b { font-size: clamp(15px, calc(var(--qw) * 0.0789), 22.5px); }
.qslot { width: clamp(30px, calc(var(--qw) * 0.1579), 45px); height: clamp(30px, calc(var(--qw) * 0.1579), 45px); font-size: clamp(15px, calc(var(--qw) * 0.0789), 22.5px); }
.status { font-size: clamp(12px, calc(var(--qw) * 0.0632), 18px); }
.slot .who, .hand-title { font-size: clamp(13px, calc(var(--qw) * 0.0684), 19.5px); }
.slot .value { font-size: clamp(20px, calc(var(--qw) * 0.1053), 30px); }
.slot .value .steps { font-size: clamp(13px, calc(var(--qw) * 0.0684), 19px); }
.center .message { font-size: clamp(14px, calc(var(--qw) * 0.0737), 21px); }
.center .message .big { font-size: clamp(18px, calc(var(--qw) * 0.0947), 27px); }
.stat-choice button, .horn-toggle { font-size: clamp(14px, calc(var(--qw) * 0.0737), 21px); padding: clamp(9px, calc(var(--qw) * 0.0474), 13.5px) clamp(14px, calc(var(--qw) * 0.0737), 21px); }
#play-btn, #next-btn { font-size: clamp(17px, calc(var(--qw) * 0.0895), 25.5px); padding: clamp(12px, calc(var(--qw) * 0.0632), 18px) clamp(28px, calc(var(--qw) * 0.1474), 42px); }
.hand-actions { min-height: clamp(48px, calc(var(--qw) * 0.2526), 72px); }
.round-info { font-size: clamp(15px, calc(var(--qw) * 0.0789), 22.5px); }
.slot .who { top: -1.7em; }
.slot .value { top: calc(100% + .4em); }
.center .message { max-width: calc(var(--qw) * 1.3); }


/* =============================================================== Gesamtlayout */
/* Senkrecht: Kopfzeile · Gegner · Arena · Du · Hand – mit gleichmäßigem Abstand. */
.table { position: relative; grid-template-rows: auto 1fr auto auto; row-gap: var(--gap); padding: var(--gap) 0; }
/* Rundenanzeige und Knöpfe liegen in den oberen Ecken, neben der Gegnerleiste */
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; padding: 10px 14px; pointer-events: none; align-items: flex-start; }
.topbar > * { pointer-events: auto; }
/* Die Knöpfe bleiben rechts neben der Gegnerleiste – reicht der Platz nicht, brechen sie in eine zweite Reihe um */
.top-buttons { flex-wrap: wrap; justify-content: flex-end; max-width: calc((100vw - var(--side) - clamp(400px, var(--qw) * 2.1, 600px)) / 2 - 36px); }
.player-bar { position: relative; z-index: 2; }
/* Beide Leisten gleich breit – auch wenn die Krone wechselt oder ein Name länger ist */
.player-bar { width: clamp(400px, calc(var(--qw) * 2.1), 600px); justify-content: flex-start; }
/* Symbol und Name links, Karten, Quartette und Schlachtruf rechts */
.player-bar .quartet-slots { margin-left: auto; }
/* Die Arena: eine abgesetzte Spielfläche, auf der sich das Duell abspielt */
.battlefield {
  align-self: stretch; margin: 0 auto; width: min(100% - 2 * var(--gap), calc(var(--qw) * 4.5 + 220px));
  /* unten Platz für Wert und bis zu drei Zeilen der Duell-Animation */
  padding: calc(var(--gap) + 1.9em) var(--gap) calc(var(--gap) + 5.4em);
  gap: clamp(16px, 3vw, 56px); border-radius: 28px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 214, 140, .10), transparent 65%),
    linear-gradient(180deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, .12));
  box-shadow: inset 0 0 0 1px rgba(226, 184, 90, .18), inset 0 2px 30px rgba(0, 0, 0, .45);
  font-size: clamp(13px, calc(var(--qw) * .068), 19px);
}
.slot .who { top: -1.8em; }
.slot .value { top: calc(100% + .55em); }
/* Hand: links Hinweis/Ergebnis, Mitte Karten, rechts Knöpfe */
.hand-area {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  column-gap: clamp(16px, 2.5vw, 44px); padding: 0 var(--gap);
}
.hand-title { grid-column: 1; grid-row: 1; justify-self: end; text-align: right; max-width: 340px; line-height: 1.4; }
.hand { grid-column: 2; grid-row: 1; padding-top: 14px; }
.hand-actions {
  grid-column: 3; grid-row: 1; justify-self: start; flex-direction: column; align-items: stretch; gap: 10px;
  min-width: calc(var(--qw) * .9);
}
.hand-actions .stat-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hand-title .result-line { text-align: right; }

/* =============================================================== Kriegsbeute */
.center { position: relative; }
.pot {
  position: absolute; z-index: 3; right: calc(var(--qw) * -.2); top: calc(var(--qw) * .62);
  width: calc(var(--qw) * .32); height: calc(var(--qw) * .48); visibility: hidden;
}
.pot.has-cards { visibility: visible; }
.pot .pile { position: absolute; inset: 0; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .55)); }
.pot .pile .card-back {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px;
  box-shadow: 0 0 0 1px #2a1804, 0 0 0 2px var(--gold-dark) inset;
}
.pot .count {
  position: absolute; left: 50%; bottom: -.9em; transform: translateX(-50%); white-space: nowrap; z-index: 2;
  padding: 1px 7px; border-radius: 20px; font-weight: 900; font-size: .8em;
  background: linear-gradient(180deg, #f5cf6e, #c2891f); color: #2a1804; border: 1.5px solid #6e4a10;
}
.final-score .fs-name { font-family: var(--display); font-weight: 800; }
.final-score .fs-line { color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  /* Hinweise blenden sonst sofort wieder aus (Animation endet unsichtbar) – sie verschwinden per Skript */
  .toast { animation: none !important; }
}

/* =============================================================== Nachziehstapel */
.deck {
  position: relative; flex: none; width: calc(var(--qw) * .52); height: calc(var(--qw) * .78);
  align-self: center; margin: 0 calc(var(--qw) * -.05);
}
.deck .pile { position: absolute; inset: 0; }
.deck .pile .card-back {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px;
  box-shadow: 0 0 0 1px #2a1804, 0 0 0 2px var(--gold-dark) inset, 0 3px 6px rgba(0, 0, 0, .5);
}
.deck .empty {
  position: absolute; inset: 0; border-radius: 8px; border: 2px dashed rgba(226, 184, 90, .3);
  display: grid; place-items: center; color: rgba(243, 230, 200, .45); font-size: .8em;
}
.deck .count {
  position: absolute; left: 50%; bottom: -.8em; transform: translateX(-50%); z-index: 2; white-space: nowrap;
  min-width: 2.2em; padding: 1px 8px; border-radius: 20px; text-align: center; font-weight: 900; font-size: .95em;
  background: linear-gradient(180deg, #f5cf6e, #c2891f); color: #2a1804; border: 1.5px solid #6e4a10; box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.deck .label { position: absolute; top: -1.6em; left: 0; right: 0; text-align: center; font-size: .75em; font-weight: 800; color: var(--muted); white-space: nowrap; }
/* Fliegende Karte: Vorder- und Rückseite, dreht sich im Flug */
.ghost { position: fixed; z-index: 70; pointer-events: none; perspective: 1600px; }
.ghost-inner { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.ghost .gface { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.ghost .gback { transform: rotateY(180deg); }
.ghost .card-back { width: 100%; height: 100%; border-radius: 10px; box-shadow: 0 0 0 1px #2a1804, 0 0 0 2px var(--gold-dark) inset, 0 10px 24px rgba(0, 0, 0, .55); }
.ghost .qcard { box-shadow: 0 0 0 1.5px #2a1804, 0 16px 30px rgba(0, 0, 0, .6); }
.slot.emptying .flipper, .slot.emptying .value { visibility: hidden; }
/* Aufsetzen auf dem Stapel: kurz eindrücken */
.deck.bump .pile { animation: land .32s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes land { 0% { transform: scale(1); } 35% { transform: scale(1.06, .94) translateY(2px); } 100% { transform: none; } }

/* =============================================================== Hand des Gegners */
/* Die Gegnerleiste steht mittig über der eigenen, die Gegnerhand hängt links daneben (rechts liegen die Knöpfe) */
.opp-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: calc(var(--gap) * 1.2); }
.opp-row .player-bar { margin: 0; grid-column: 2; }
.opp-hand { grid-column: 1; grid-row: 1; justify-self: end; display: flex; align-items: center; justify-content: center; min-width: calc(var(--qw) * .55); height: calc(var(--qw) * .33); }
.opp-hand .ob {
  flex: none; width: calc(var(--qw) * .22); height: calc(var(--qw) * .33); border-radius: 6px;
  margin-left: calc(var(--qw) * -.07); transform: translateY(var(--y)) rotate(var(--r)); transform-origin: 50% 120%;
  box-shadow: 0 0 0 1px #2a1804, 0 0 0 2px var(--gold-dark) inset, 0 4px 8px rgba(0, 0, 0, .5);
}
.opp-hand .ob:first-child { margin-left: 0; }
/* Gesamtzahl nur auf dem Handy – sonst sieht man Stapel und Hand direkt */
.player-bar .total-chip { display: none; }
.opp-hand .ob.incoming { visibility: hidden; }

/* Innenabstände wachsen mit der Kartengröße (statt fester Pixel), damit alles bei jeder Größe passt */
.qcard .head { padding: calc(var(--qw) * .016) calc(var(--qw) * .032) calc(var(--qw) * .016) calc(var(--qw) * .02); }
.qcard .name { padding: calc(var(--qw) * .02) calc(var(--qw) * .06); }
.qcard .name.long { padding-top: calc(var(--qw) * .026); padding-bottom: calc(var(--qw) * .026); }
.qcard .name.xlong { font-size: calc(var(--qw) * .05); padding: calc(var(--qw) * .03) calc(var(--qw) * .05); }
.qcard .ability { margin: calc(var(--qw) * .01) calc(var(--qw) * .03) 0; padding: calc(var(--qw) * .004) calc(var(--qw) * .03); }
.qcard .stats { padding: calc(var(--qw) * .006) calc(var(--qw) * .026) calc(var(--qw) * .022); }
.qcard .row { padding: 0 calc(var(--qw) * .026); gap: calc(var(--qw) * .02); line-height: 1.15; }

/* Kleine Karten: kompakter Innenabstand, damit alle Werte hineinpassen (Containerabfrage auf die Karte) */
.qcard, .terrain { container-type: size; }
@container (max-width: 150px) {
  .terrain .head { min-height: calc(var(--qw) * .12 + 3px); }
  .qcard .head { padding: 1px 4px 1px 2px; }
  .qcard .name { padding: 2px 8px; }
  .qcard .ability { margin: 1px 3px 0; padding: 0 3px; }
  .qcard .stats { padding: 1px 3px 2px; }
  .qcard .row { padding: 0 3px; }
  .qcard .row .bar { display: none; }
}

/* Schmal: Kopfzeile wieder als eigene Zeile, damit nichts kollidiert */
@media (max-width: 1000px) {
  :root { --qw: clamp(92px, min((var(--vh) - 350px - 5 * var(--gap)) / 3, (100vw - 180px) / 4.6, (100vw - 600px) / 3.2), 300px); }
  .table { grid-template-rows: auto auto 1fr auto auto; padding-top: 0; }
  .topbar { position: static; padding-bottom: 0; }
  .top-buttons { max-width: none; }
}

.btn-small.off { opacity: .45; text-decoration: line-through; }

/* =============================================================== Materialien */
/* Holztisch */
.table {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 214, 150, .16), transparent 58%),
    var(--tex-wood),
    linear-gradient(180deg, #4a3220, #5d4028 50%, #45301e);
}
/* Arena: Leder mit Ziernaht */
.battlefield {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 210, 140, .22), transparent 65%),
    var(--tex-leather),
    linear-gradient(180deg, #5a3c22, #432c18);
  box-shadow: inset 0 0 0 1px rgba(226, 184, 90, .22), inset 0 3px 30px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 220, 160, .08);
}
.battlefield::before {
  content: ''; position: absolute; inset: 9px; border-radius: 20px; pointer-events: none;
  border: 1.5px dashed rgba(226, 184, 90, .28);
}
/* Spielerleisten: Leder, Goldkante, Naht */
.player-bar {
  background: var(--tex-leather), linear-gradient(180deg, #3d2a18, #24170c);
  border: 1px solid rgba(226, 184, 90, .45);
  box-shadow: inset 0 1px 0 rgba(255, 230, 170, .18), inset 0 -2px 6px rgba(0, 0, 0, .5), 0 6px 16px rgba(0, 0, 0, .45);
}
.player-bar::after {
  content: ''; position: absolute; inset: 4px; border-radius: inherit; pointer-events: none;
  border: 1px dashed rgba(226, 184, 90, .22);
}

/* Goldrahmen: polierter Glanz mit Fase */
.qcard, .terrain {
  background:
    linear-gradient(158deg, rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, 0) 16%, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, .35) 78%, rgba(255, 255, 255, 0) 92%),
    linear-gradient(135deg, #f7e3a0, #b8862b 28%, #f2d27a 52%, #8a5d17 78%, #e9c877);
  box-shadow:
    0 0 0 1.5px #2a1804,
    inset 1px 1px 0 rgba(255, 250, 225, .85), inset -1px -1px 0 rgba(70, 40, 5, .6),
    0 10px 22px rgba(0, 0, 0, .55), 0 2px 4px rgba(0, 0, 0, .4);
}
/* Pergament mit Papierstruktur */
.qcard .frame {
  background:
    var(--tex-paper),
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, .55), transparent 50%),
    radial-gradient(ellipse at 80% 95%, rgba(140, 95, 40, .28), transparent 60%),
    linear-gradient(180deg, #f6ecd2, #e0cc9a);
}
/* Kopfleiste: Emaille mit Lichtkante */
.qcard .head { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(0, 0, 0, .25); }
.qcard .code { box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, .35); }
/* Bild hinter Glas: Spiegelung und leichte Tiefe */
.qcard .art::before, .terrain .art::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, .26) 0%, rgba(255, 255, 255, .08) 26%, rgba(255, 255, 255, 0) 27%),
    linear-gradient(118deg, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, .07) 71%, rgba(255, 255, 255, 0) 82%);
}
.qcard .name { box-shadow: inset 0 1.5px 0 var(--gold), inset 0 -1.5px 0 var(--gold), inset 0 3px 4px rgba(255, 230, 170, .25); }
/* Aktive Eigenschaft: goldener Balken mit Glanzlinie */
.qcard .row.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 45%), linear-gradient(90deg, #ffe08a, #f2c14e);
}
/* Lichtreflex, der der Maus folgt (Position per JS in --mx/--my) */
.qcard::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 6; pointer-events: none;
  background: radial-gradient(circle at var(--mx, 30%) var(--my, 20%), rgba(255, 248, 225, .17), rgba(255, 248, 225, .05) 28%, transparent 55%);
  opacity: 0; transition: opacity .25s;
}
.zoom .qcard::before { mix-blend-mode: screen; }
@media (hover: hover) { .hand .qcard:hover::before, .gallery-grid .qcard:hover::before { mix-blend-mode: screen; } }
.zoom .qcard::before { opacity: 1; }
@media (hover: hover) { .hand .qcard:hover::before, .gallery-grid .qcard:hover::before { opacity: 1; } }
/* Neigen zur Maus */
.hand { perspective: 1100px; }
@media (hover: hover) { .hand .qcard:hover { transform: translateY(-8px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); } }
.hand .qcard.selected { transform: translateY(-14px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.zoom .qcard { transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .12s; }
/* Kartenrücken und Stapel: Glanz und Kanten */
.card-back { position: relative; }
.card-back::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(125deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, .08) 85%, rgba(255, 255, 255, 0) 100%);
}
.deck .pile .card-back:not(:last-child) { filter: brightness(.72); }
.deck .pile { filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .5)); }
/* Knöpfe: Goldmetall mit Glanzkante */
.btn-primary:not(:disabled) {
  background: linear-gradient(180deg, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, .12) 48%, rgba(255, 255, 255, 0) 52%), linear-gradient(180deg, #f5cf6e, #c2891f);
  text-shadow: 0 1px 0 rgba(255, 240, 200, .6);
}
.horn-toggle, .stat-choice button, .btn-secondary, .btn-small {
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 50%), rgba(0, 0, 0, .35);
}
.horn-toggle.on { background: linear-gradient(180deg, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, .1) 48%, rgba(255, 255, 255, 0) 52%), linear-gradient(180deg, #ffe28a, #d49a1e); }
/* Quartett-Plätze: eingelassene Mulden bzw. Goldmünzen */
.qslot { box-shadow: inset 0 2px 4px rgba(0, 0, 0, .6); }
.qslot.filled {
  background: radial-gradient(circle at 35% 30%, #fff1b0, #d9a22b 45%, #7a4f0e 100%);
  box-shadow: 0 0 10px rgba(226, 184, 90, .6), inset 0 1px 0 rgba(255, 255, 255, .7);
}

/* Tablet hochkant: Neben der Hand ist kein Platz für die Knöpfe – Hinweis, Hand und Knöpfe untereinander */
@media (min-width: 641px) and (max-width: 1200px) and (max-aspect-ratio: 1/1) {
  :root { --qw: clamp(92px, min((var(--vh) - 430px - 6 * var(--gap)) / 3, (100vw - 180px) / 4.6), 300px); }
  .table { grid-template-rows: auto auto 1fr auto auto; padding-top: env(safe-area-inset-top, 0px); }
  .topbar { position: static; padding-bottom: 0; }
  .top-buttons { max-width: none; }
  .hand-area { grid-template-columns: 1fr; row-gap: 8px; }
  .hand-title, .hand, .hand-actions { grid-column: 1; justify-self: center; text-align: center; max-width: none; }
  .hand-title { grid-row: 1; } .hand { grid-row: 2; padding-top: 4px; } .hand-actions { grid-row: 3; flex-direction: row; min-width: 0; }
  .hand-title .result-line { text-align: center; }
  .hand-title { min-height: 2.8em; display: flex; flex-direction: column; justify-content: flex-end; }
}

/* Handy: kompakte Größen (steht am Ende, damit es die mitwachsenden Werte überschreibt) */
@media (max-width: 640px) {
  :root { --qw: clamp(92px, 28vw, 130px); }
  .battlefield { gap: 8px; padding: 26px 4px 36px; }
  .center { min-width: 0; }
  .player-bar { border-radius: 14px; padding: 5px 10px; gap: 8px; }
  .player-bar .avatar { width: 32px; height: 32px; font-size: 17px; }
  .qslot { width: 24px; height: 24px; font-size: 12px; }
  .hand { gap: 6px; }
  .qcard .row .bar { display: none; }
  .qcard .ability { font-size: calc(var(--qw) * .07); margin: 2px 3px 0; padding: 1px 3px; }
  .deck { display: none; }
  .player-bar .total-chip { display: flex; }
  /* Die Gegnerhand behält ihre Breite, schrumpfen darf nur die Leiste – sonst ragen die Rückseiten über den Rand */
  .player-bar { width: auto; }
  .player-bar .total-chip { margin-left: auto; }
  .player-bar .quartet-slots { margin-left: 0; }
  .opp-row { display: flex; justify-content: center; gap: 8px; padding: 0 10px; }
  .opp-row .player-bar { min-width: 0; }
  .opp-hand { min-width: 0; flex: none; }
  .hand-area { grid-template-columns: 1fr; row-gap: 8px; }
  .hand-title, .hand, .hand-actions { grid-column: 1; justify-self: center; text-align: center; max-width: none; }
  .hand-title { grid-row: 1; } .hand { grid-row: 2; padding-top: 4px; } .hand-actions { grid-row: 3; flex-direction: row; min-width: 0; }
  .hand-title .result-line { text-align: center; }
  /* Eigenschaften in einer Reihe – so hoch wie die anderen Knöpfe, damit das Schlachtfeld nicht springt */
  .hand-actions .stat-choice { grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
  .hand-actions .stat-choice button {
    padding: 10px 2px; font-size: 12px; letter-spacing: 0; white-space: nowrap; min-width: 0;
    background: var(--tex-wood), linear-gradient(180deg, #4a3220, #34220f 55%, #24170a); /* ohne Nieten – zu schmal dafür */
  }
  /* Feste Höhe für zwei Zeilen Ergebnis, damit das Schlachtfeld darüber nicht springt; mehr (selten) ragt nach oben */
  .hand-title { height: 3.6em; display: flex; flex-direction: column; justify-content: flex-end; }
  /* Schlachtruf und Ausspielen teilen sich die Breite, statt über den Rand zu ragen */
  .hand-actions { width: 100%; }
  .hand-actions > button { flex: 1 1 auto; min-width: 0; padding: 10px 6px; }
  .horn-toggle { font-size: 12.5px; letter-spacing: 0; }
  #play-btn { font-size: 15px; letter-spacing: .5px; }
  .round-info span { white-space: nowrap; }
  .topbar .top-buttons { flex: 1; min-width: 0; }
  .battlefield { width: 100%; padding: calc(var(--gap) + 1.6em) 4px calc(var(--gap) + 2em); border-radius: 16px; }
}

/* =============================================================== Quartett-Präsentation */
.quartet-show {
  position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; cursor: var(--cur-pointer);
  background: radial-gradient(ellipse at center, rgba(20, 12, 4, .72), rgba(5, 3, 1, .9));
  animation: q-in .3s ease;
}
.quartet-show.leaving { animation: q-out .35s ease forwards; }
@keyframes q-in { from { opacity: 0; } }
@keyframes q-out { to { opacity: 0; } }
.q-plaque {
  --qw: clamp(96px, min(15vw, 22vh), 170px);
  position: relative; text-align: center; padding: 22px clamp(18px, 4vw, 48px) 18px; border-radius: 22px;
  background: var(--tex-leather), radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--fc) 35%, #4a3018), #1e1208 75%);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 5px rgba(0, 0, 0, .45), 0 0 60px color-mix(in srgb, var(--fc) 45%, transparent), 0 30px 80px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 230, 170, .35);
  animation: q-plaque .5s cubic-bezier(.2, 1.4, .4, 1);
}
.q-plaque::after { content: ''; position: absolute; inset: 7px; border-radius: 16px; border: 1px dashed rgba(226, 184, 90, .35); pointer-events: none; }
@keyframes q-plaque { from { transform: scale(.7); opacity: 0; } }
.q-kicker { font-weight: 800; letter-spacing: 1px; color: var(--muted); font-size: clamp(13px, 1.6vw, 16px); }
.q-title {
  font-family: var(--display); font-weight: 900; font-size: clamp(26px, 4vw, 48px); color: #fff2c4; margin: 4px 0 14px;
  text-shadow: 0 3px 0 #3a2204, 0 0 24px rgba(226, 184, 90, .55);
}
.q-cards { display: flex; justify-content: center; padding: 6px 0 10px; }
.q-card {
  margin: 0 calc(var(--qw) * -.04); transform-origin: 50% 110%;
  transform: rotate(calc((var(--i) - 1.5) * 7deg)) translateY(calc(max(var(--i) - 1.5, 1.5 - var(--i)) * 6px));
  animation: q-card .55s cubic-bezier(.2, 1.3, .4, 1) backwards; animation-delay: calc(var(--i) * .12s + .15s);
}
@keyframes q-card { from { transform: translateY(40px) rotate(0) scale(.6); opacity: 0; } }
.q-sub { font-family: var(--display); font-weight: 800; color: var(--gold); font-size: clamp(15px, 1.9vw, 20px); margin-top: 6px; }
.q-hint { color: var(--muted); font-size: 12px; margin-top: 6px; opacity: .8; }

/* =============================================================== Tooltips */
.tooltip {
  position: fixed; z-index: 200; pointer-events: none; max-width: 280px;
  padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--gold-dark);
  background: var(--tex-leather), linear-gradient(180deg, #3d2a18, #1e1309);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 230, 170, .22);
  color: var(--ink); font-size: 13px; line-height: 1.4; font-weight: 600; text-align: center;
  opacity: 0; transform: translateY(4px); transition: opacity .14s ease, transform .14s ease;
}
.tooltip.below { transform: translateY(-4px); }
.tooltip.show { opacity: 1; transform: none; }
.tooltip div + div { margin-top: 2px; padding-top: 2px; border-top: 1px solid rgba(226, 184, 90, .18); }
/* kleine Spitze zum Element */
.tooltip::after {
  content: ''; position: absolute; left: var(--ax, 50%); bottom: -7px; width: 12px; height: 12px; margin-left: -6px;
  background: #22160b; border-right: 1.5px solid var(--gold-dark); border-bottom: 1.5px solid var(--gold-dark);
  transform: rotate(45deg);
}
.tooltip.below::after { bottom: auto; top: -7px; transform: rotate(225deg); }
[data-tip] { cursor: var(--cur-help); }
button[data-tip] { cursor: var(--cur-pointer); }

/* Per Spion ausgespähte Karte: verdeckt mit Späher-Siegel und kühlem Schimmer, beim Überfahren dreht sie sich um */
.spied { position: absolute; inset: 0; perspective: 900px; }
.spied .flipper { transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
/* bleibt auch auf Touch: Antippen dreht die Karte um, Tippen daneben wieder zurück */
.spied:hover .flipper { transform: rotateY(180deg); }
/* die Fähigkeitsbeschreibung erscheint wie bei offenen Karten – erst, wenn die Karte umgedreht ist */
.spied:hover .ability .atext { opacity: 1; transform: none; transition-delay: .3s; }
/* nur die ruhende Hülle fängt die Maus – die drehende Karte würde sie beim Wenden verlieren */
.spied .flipper { pointer-events: none; }
.spied .back .card-back {
  overflow: hidden;
  box-shadow: 0 0 0 1.5px #2a1804, 0 0 0 3px #7fb4e0 inset, 0 0 16px rgba(120, 190, 255, .6), 0 8px 18px rgba(0, 0, 0, .6);
}
/* ein Lichtstreif wandert über die Rückseite – wie durch ein Fernrohr beobachtet */
.spied .back .card-back::before {
  content: ''; position: absolute; inset: -20% -60%; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(170, 215, 255, .35) 50%, transparent 60%);
  animation: spy-scan 3.2s ease-in-out infinite;
}
@keyframes spy-scan { 0%, 30% { transform: translateX(-45%); } 70%, 100% { transform: translateX(45%); } }
/* Siegel: Wachs mit Späher darauf */
.spy-seal {
  position: absolute; left: 50%; top: 50%; width: 34%; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(-12deg);
  display: grid; place-items: center; font-size: calc(var(--qw) * .16); line-height: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #5d8fc4, #23446e 55%, #10223c);
  box-shadow: 0 0 0 2px #0c1a2e, 0 0 0 4px rgba(170, 215, 255, .5), 0 3px 8px rgba(0, 0, 0, .6), inset 0 -3px 6px rgba(0, 0, 0, .45);
  filter: drop-shadow(0 0 6px rgba(120, 190, 255, .5));
}
/* In der Gegnerhand: eine lesbar große Karte, verkleinert auf Handkartengröße – beim Überfahren dreht sie sich groß nach unten */
.opp-hand { --ob: calc(var(--qw) * .22); --peek: 4; }
.opp-hand .ob.spied { position: relative; inset: auto; box-shadow: none; }
.opp-hand .ob.spied:hover { z-index: 20; }
.opp-hand .spied .flipper {
  inset: 0 auto auto 50%; width: calc(var(--ob) * var(--peek)); height: calc(var(--ob) * var(--peek) * 1.5);
  margin-left: calc(var(--ob) * var(--peek) / -2); transform-origin: 50% 0; transform: scale(calc(1 / var(--peek)));
}
.opp-hand .spied .face { --qw: calc(var(--ob) * var(--peek)); }
.opp-hand .spied .card-back { width: 100%; height: 100%; }
.opp-hand .spied:hover .flipper {
  transform: translateY(calc(var(--ob) * .4)) rotate(calc(var(--r) * -1)) rotateY(180deg);
  pointer-events: auto; /* die große Karte hält den Hover, solange die Maus auf ihr bleibt */
}

/* =============================================================== Knöpfe: gealtert */
/* Nieten links und rechts als eigene Hintergrundebenen */
:root {
  --rivets:
    radial-gradient(circle at 9px 50%, #f3dca0 0 1px, #9a7a3a 1.6px, #3a2508 2.8px, transparent 3.4px),
    radial-gradient(circle at calc(100% - 9px) 50%, #f3dca0 0 1px, #9a7a3a 1.6px, #3a2508 2.8px, transparent 3.4px);
  --rivets-iron:
    radial-gradient(circle at 8px 50%, #c9ccd0 0 .8px, #6a6e74 1.4px, #1c1e21 2.5px, transparent 3px),
    radial-gradient(circle at calc(100% - 8px) 50%, #c9ccd0 0 .8px, #6a6e74 1.4px, #1c1e21 2.5px, transparent 3px);
}
/* Hauptknöpfe: abgegriffenes Messing mit Patina */
.btn-primary:not(:disabled) {
  background:
    var(--rivets),
    var(--tex-grunge),
    var(--tex-patina),
    radial-gradient(ellipse at 30% 0%, rgba(255, 240, 190, .45), transparent 60%),
    linear-gradient(180deg, #d9b35e 0%, #b8862b 45%, #8e6118 80%, #6e4710 100%);
  border: 2px solid #3a2508; border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 190, .55), inset 0 -2px 0 rgba(40, 20, 0, .55),
    inset 0 0 0 1px rgba(255, 220, 150, .12), inset 0 0 14px rgba(40, 20, 0, .45),
    0 3px 0 #2a1804, 0 6px 14px rgba(0, 0, 0, .55);
  color: #2a1804; text-shadow: 0 1px 0 rgba(255, 236, 180, .55), 0 -1px 0 rgba(40, 20, 0, .35);
  letter-spacing: 1px; padding-left: 30px; padding-right: 30px;
  transition: filter .12s, transform .08s, box-shadow .08s;
}
@media (hover: hover) { .btn-primary:not(:disabled):hover { filter: brightness(1.08) saturate(1.05); } }
.btn-primary:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 6px rgba(40, 20, 0, .6), inset 0 0 14px rgba(40, 20, 0, .45), 0 1px 0 #2a1804, 0 2px 6px rgba(0, 0, 0, .5);
}
/* Gesperrt: angelaufenes Eisen */
.btn-primary:disabled {
  background: var(--rivets-iron), var(--tex-grunge), linear-gradient(180deg, #5c5750, #3b3833 60%, #2a2825);
  border: 2px solid #1a1816; border-radius: 8px; color: #8f887c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 0 12px rgba(0, 0, 0, .5), 0 3px 0 #141210;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .6); padding-left: 30px; padding-right: 30px;
}
/* Nebenknöpfe: dunkles Holz mit Eisenbeschlag */
.btn-secondary, .btn-small, .horn-toggle, .stat-choice button, .seg button {
  background:
    var(--rivets-iron),
    var(--tex-wood),
    linear-gradient(180deg, #4a3220, #34220f 55%, #24170a);
  border: 1.5px solid #15100a; color: #e9d9b4;
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, .14), inset 0 0 0 1px rgba(150, 150, 150, .18), inset 0 -2px 4px rgba(0, 0, 0, .5), 0 2px 0 #0e0a05, 0 4px 10px rgba(0, 0, 0, .45);
  text-shadow: 0 1px 1px #000; padding-left: 22px; padding-right: 22px;
  transition: filter .12s, transform .08s, box-shadow .08s;
}
.btn-small { padding: 7px 18px; }
.seg { border: 1.5px solid #15100a; border-radius: 9px; box-shadow: 0 2px 0 #0e0a05, 0 4px 10px rgba(0, 0, 0, .45); }
.seg button { border: 0; box-shadow: inset 0 1px 0 rgba(255, 220, 160, .12), inset 0 -2px 4px rgba(0, 0, 0, .5); }
.seg button + button { border-left: 1.5px solid #15100a; }
@media (hover: hover) { .btn-secondary:hover, .btn-small:hover, .horn-toggle:not(:disabled):hover, .stat-choice button:hover, .seg button:hover { filter: brightness(1.18); color: #fff2c4; } }
.btn-secondary:active, .btn-small:active, .horn-toggle:not(:disabled):active, .stat-choice button:active, .seg button:active {
  transform: translateY(1px); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .65), 0 1px 0 #0e0a05;
}
/* Gewählte Option: Messingbeschlag */
.seg button.active, .horn-toggle.on {
  background: var(--rivets), var(--tex-grunge), var(--tex-patina), linear-gradient(180deg, #caa252, #9a6d1f 60%, #6e4710);
  color: #2a1804; text-shadow: 0 1px 0 rgba(255, 236, 180, .5);
  box-shadow: inset 0 1px 0 rgba(255, 238, 190, .5), inset 0 -2px 3px rgba(40, 20, 0, .5), 0 2px 0 #2a1804;
}
.horn-toggle:disabled { filter: grayscale(.7) brightness(.7); }
.btn-small.off { opacity: .5; text-decoration: line-through; }

/* =============================================================== Hauptmenü */
#menu { display: grid; place-items: center; overflow: hidden auto; padding: 24px 16px; isolation: isolate; }
/* Hintergrund: ein Schlachtfeld, abgedunkelt, mit langsamer Kamerafahrt */
.menu-bg {
  position: fixed; inset: -6%; z-index: -2; background-size: cover; background-position: center;
  animation: kenburns 38s ease-in-out infinite alternate; will-change: transform;
}
@keyframes kenburns { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.1) translate(-2%, -1.5%); } }
#menu::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 0 35%, rgba(10, 6, 3, .75) 80%, rgba(5, 3, 1, .95) 100%),
    rgba(12, 8, 4, .58);
}
/* Wabernder Nebel: zwei nahtlose Schwaden-Kacheln ziehen gegeneinander und heben und senken sich */
.menu-bg .fog {
  position: absolute; left: 0; width: 200%; pointer-events: none; will-change: transform, opacity;
  background: url(../art/textures/fog.webp) repeat-x 0 0 / 50% 100%;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 65%, transparent);
  mask-image: linear-gradient(transparent, #000 30%, #000 65%, transparent);
}
.menu-bg .fog.high { top: 30%; height: 50%; --fo: .32; animation: fog-drift 150s linear infinite, fog-heave 19s ease-in-out infinite alternate; }
.menu-bg .fog.low {
  top: 58%; height: 38%; --fo: .42; background-size: 25% 100%; /* 50 % Weg = zwei Kacheln, nahtlos */
  animation: fog-drift 95s linear infinite reverse, fog-heave 13s ease-in-out -6s infinite alternate;
}
/* Langsames Gerät (Stufe aus watchFrames in ui.js): Nebel steht still */
[data-fx="2"] .menu-bg .fog { animation-play-state: paused; }
@keyframes fog-drift { from { translate: 0 0; } to { translate: -50% 0; } }
@keyframes fog-heave {
  from { transform: translateY(0) scaleY(1); opacity: var(--fo); }
  to { transform: translateY(-4%) scaleY(1.18); opacity: calc(var(--fo) * 1.7); }
}
.overlay-open .menu-bg .fog { animation-play-state: paused; }
/* Reh auf der Lichtung (js/deer.js) */
.deer-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
/* auf schmalen Bildschirmen verdeckt das Menü den Waldboden */
@media (max-width: 759px), (max-aspect-ratio: 1/1) { .deer-layer { display: none; } }
.deer-layer g { transform-box: view-box; transform-origin: 0 0; }
/* im dunklen Wald liegt auch das Reh im Schatten: deckend, aber dunkel */
.deer-layer .coat { fill: url(#deer-coat); }
.deer-legs.near path { fill: #2a1c12; }
.deer-legs.far path, .deer-layer .ear-far { fill: #1a110b; }
.deer-layer .hoof, .deer-layer .nose, .deer-layer .eye { fill: #0a0705 !important; }
.deer-layer .rump, .deer-layer .chin { fill: #6e6250; }
.deer-layer .ear-in { fill: #4a3526; }
.deer-shadow { fill: url(#deer-shade); } /* weich auslaufend */
/* ruhiges Atmen; das hintere Ohr dreht sich um seinen Ansatz */
.deer-layer .torso { transform-box: fill-box; transform-origin: 50% 100%; animation: deer-breathe 3.7s ease-in-out infinite alternate; }
.deer-layer .deer-ear2 { transform-box: fill-box; transform-origin: 40% 100%; }
/* nie ganz regungslos: kaum merkliches Pendeln des Kopfes, überlagert jede andere Bewegung */
.deer-layer .deer-sway { animation: deer-sway 5.3s ease-in-out infinite alternate; }
@keyframes deer-sway { 0% { transform: rotate(-1.5deg); } 40% { transform: rotate(.8deg); } 100% { transform: rotate(2deg); } }
@keyframes deer-breathe { from { transform: scaleY(1); } to { transform: scaleY(1.03); } }
.deer-body.walking { animation: deer-bob calc(var(--deer-step) / 2) ease-in-out infinite alternate; }
.deer-body.walking .deer-u { animation: deer-u var(--deer-step) linear infinite; animation-delay: calc(var(--deer-step) * var(--d)); }
.deer-body.walking .deer-l { animation: deer-l var(--deer-step) linear infinite; animation-delay: calc(var(--deer-step) * var(--d)); }
.deer-layer { --deer-step: 1.3s; } /* setzt js/deer.js je nach Gangart; --d ist die Versetzung der Beine */
@keyframes deer-u { 0% { transform: rotate(-18deg); } 60% { transform: rotate(18deg); } 100% { transform: rotate(-18deg); } }
@keyframes deer-l { 0%, 58% { transform: rotate(0deg); } 72% { transform: rotate(48deg); } 88% { transform: rotate(12deg); } 100% { transform: rotate(0deg); } }
@keyframes deer-bob { from { transform: translateY(0); } to { transform: translateY(-1.2px); } }
/* Liegt ein Fenster darüber (Galerie, Regeln …), ruhen Hintergrund und Glut – das spart viel Rechenzeit */
.overlay-open .menu-bg, .overlay-open .embers i { animation-play-state: paused; }
.overlay-open .embers { display: none; }
/* aufsteigende Glut */
.embers { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.embers i {
  position: absolute; bottom: -12px; width: 4px; height: 4px; border-radius: 50%;
  background: radial-gradient(circle, #ffe7a0, #ff9a2a 55%, transparent 70%); filter: drop-shadow(0 0 4px #ff8a1a);
  animation: ember 11s linear infinite; opacity: 0;
}
.embers i:nth-child(1) { left: 6%; animation-delay: 0s; }   .embers i:nth-child(2) { left: 14%; animation-delay: 3.5s; animation-duration: 13s; }
.embers i:nth-child(3) { left: 23%; animation-delay: 7s; }  .embers i:nth-child(4) { left: 31%; animation-delay: 1.8s; animation-duration: 9s; }
.embers i:nth-child(5) { left: 42%; animation-delay: 5.2s; } .embers i:nth-child(6) { left: 51%; animation-delay: 9s; animation-duration: 12s; }
.embers i:nth-child(7) { left: 60%; animation-delay: 2.6s; } .embers i:nth-child(8) { left: 68%; animation-delay: 6.4s; animation-duration: 14s; }
.embers i:nth-child(9) { left: 77%; animation-delay: 0.9s; } .embers i:nth-child(10) { left: 85%; animation-delay: 4.4s; animation-duration: 10s; }
.embers i:nth-child(11) { left: 92%; animation-delay: 8.1s; } .embers i:nth-child(12) { left: 97%; animation-delay: 2s; animation-duration: 12s; }
@keyframes ember {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  10% { opacity: .9; }
  60% { transform: translate(24px, -60vh) scale(.8); opacity: .7; }
  100% { transform: translate(-16px, -105vh) scale(.4); opacity: 0; }
}
/* Startbildschirm über dem Wald; das Menü blendet erst nach „Spiel betreten“ ein */
.intro {
  position: fixed; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px; text-align: center; transition: opacity .6s ease, visibility 0s .6s;
}
.intro .title { font-size: clamp(52px, 9vw, 120px); line-height: 1.05; animation: intro-in 1.6s ease-out both; }
.intro .subtitle { font-size: clamp(14px, 1.6vw, 20px); letter-spacing: 6px; margin: 8px 0 clamp(28px, 6vh, 56px); animation: intro-in 1.6s ease-out .4s both; }
.intro .btn-primary { font-size: 20px; padding: 14px 40px; animation: intro-in 1.2s ease-out 1s both; }
@keyframes intro-in { from { opacity: 0; transform: translateY(12px); } }
#menu:not(.intro-open) .intro { opacity: 0; visibility: hidden; pointer-events: none; }
.menu-layout, .menu-audio { transition: opacity .8s ease .2s; }
#menu.intro-open .menu-layout, #menu.intro-open .menu-audio { opacity: 0; visibility: hidden; transition: none; }

.menu-audio { position: fixed; top: 14px; right: 14px; z-index: 2; display: flex; gap: 8px; }
.menu-audio .btn-small { padding: 7px 16px; font-size: 15px; }

.menu-layout {
  position: relative; width: min(1180px, 100%);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); gap: clamp(24px, 5vw, 80px); align-items: center;
}
/* Linke Seite: Titel, schwebende Karten, Kurzregeln */
.menu-hero { text-align: center; }
.menu-cards { --qw: clamp(110px, 10.5vw, 168px); height: calc(var(--qw) * 1.75); margin-bottom: 8px !important; align-items: center; }
.menu-cards .qcard { margin: 0 calc(var(--qw) * -.14); animation: float 6s ease-in-out infinite; }
.menu-cards .qcard:nth-child(1) { --rot: -11deg; --dy: 18px; animation-delay: -2s; }
.menu-cards .qcard:nth-child(2) { --rot: 0deg; --dy: -6px; z-index: 1; animation-delay: -4s; }
.menu-cards .qcard:nth-child(3) { --rot: 11deg; --dy: 18px; animation-delay: 0s; }
@keyframes float {
  0%, 100% { transform: translateY(var(--dy)) rotate(var(--rot)); }
  50% { transform: translateY(calc(var(--dy) - 10px)) rotate(var(--rot)); }
}
.menu-hero .title { font-size: clamp(34px, 3.5vw, 58px); line-height: 1.1; white-space: nowrap; }
.menu-hero .subtitle { font-size: clamp(13px, 1.2vw, 17px); letter-spacing: 5px; margin: 6px 0 22px; }
.how { list-style: none; padding: 0; margin: 0 auto; max-width: 470px; display: grid; gap: 8px; text-align: left; }
.how li {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 10px; font-size: 15px; color: var(--ink);
  background: linear-gradient(90deg, rgba(20, 12, 5, .7), rgba(20, 12, 5, .35)); border: 1px solid rgba(226, 184, 90, .22);
}
.how b { color: #fff2c4; }
.how-icon {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 17px;
  background: radial-gradient(circle at 35% 30%, #6a4a22, #2a1a0a); border: 1.5px solid var(--gold-dark);
}
/* Rechte Seite: Tafel „Neues Spiel“ – Leder, Ziernaht, goldene Eckbeschläge */
#menu .menu-box {
  position: relative; width: auto; padding: 28px 28px 24px; text-align: center; border-radius: 16px;
  background: var(--tex-leather), linear-gradient(180deg, rgba(62, 42, 22, .96), rgba(30, 20, 11, .97));
  border: 2px solid #3a2508;
  box-shadow: 0 0 0 1px rgba(226, 184, 90, .45), 0 30px 80px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 230, 170, .2);
}
#menu .menu-box::before { content: ''; position: absolute; inset: 8px; border: 1.5px dashed rgba(226, 184, 90, .3); border-radius: 11px; pointer-events: none; }
#menu .menu-box::after {
  content: ''; position: absolute; inset: 4px; pointer-events: none; --c: #d9a948;
  background:
    linear-gradient(var(--c), var(--c)) top left / 28px 3px no-repeat, linear-gradient(var(--c), var(--c)) top left / 3px 28px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 28px 3px no-repeat, linear-gradient(var(--c), var(--c)) top right / 3px 28px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 28px 3px no-repeat, linear-gradient(var(--c), var(--c)) bottom left / 3px 28px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 28px 3px no-repeat, linear-gradient(var(--c), var(--c)) bottom right / 3px 28px no-repeat;
  filter: drop-shadow(0 1px 0 #3a2508);
}
.menu-heading {
  display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-family: var(--display); font-weight: 900;
  font-size: 22px; color: var(--gold); letter-spacing: 2px; text-transform: uppercase;
}
.menu-heading::before, .menu-heading::after { content: ''; flex: 1; height: 1.5px; background: linear-gradient(90deg, transparent, var(--gold-dark), transparent); }
.mode-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mode-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px 12px; border-radius: 12px;
  background: var(--tex-wood), linear-gradient(180deg, #4a3220, #2a1b0c);
  border: 1.5px solid #15100a; color: #e9d9b4; text-shadow: 0 1px 1px #000;
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, .14), inset 0 -3px 6px rgba(0, 0, 0, .5), 0 3px 0 #0e0a05, 0 6px 14px rgba(0, 0, 0, .45);
  transition: filter .12s, transform .12s;
}
@media (hover: hover) { .mode-tile:hover { filter: brightness(1.15); transform: translateY(-2px); } }
.mode-tile.active {
  background: var(--tex-grunge), var(--tex-patina), linear-gradient(180deg, #d0a855, #9a6d1f 60%, #6e4710);
  color: #2a1804; text-shadow: 0 1px 0 rgba(255, 236, 180, .5); border-color: #3a2508;
  box-shadow: inset 0 1px 0 rgba(255, 238, 190, .5), 0 0 0 2px rgba(255, 210, 90, .35), 0 0 22px rgba(255, 200, 70, .35), 0 3px 0 #2a1804;
}
.mode-icon { font-size: 30px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.mode-name { font-family: var(--display); font-weight: 900; font-size: 15px; }
.mode-desc { font-size: 12px; opacity: .85; line-height: 1.3; }
.mode-tile.active .mode-desc { opacity: 1; color: #3a2204; font-weight: 700; text-shadow: none; }
#menu .menu-row { margin: 16px 0; }
#difficulty-row { flex-direction: column; gap: 6px; }
#difficulty-row .label { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.names input {
  background: linear-gradient(180deg, #f3e6c4, #dcc998); color: #2a1804; border: 1.5px solid #6e4a10; font-weight: 700;
  box-shadow: inset 0 2px 4px rgba(90, 60, 20, .35);
}
.start-big { width: 100%; font-size: 22px; padding-top: 14px; padding-bottom: 14px; margin-top: 4px; }
.menu-links { margin-bottom: 0 !important; }
.menu-links .btn-secondary { flex: 1; }
@media (max-width: 900px) {
  .menu-layout { grid-template-columns: 1fr; gap: 20px; }
  .menu-cards { --qw: clamp(90px, 24vw, 130px); }
  .how { display: none; }
  .menu-hero .title { white-space: normal; }
}
@media (max-width: 480px) { .mode-tiles { grid-template-columns: 1fr; } }

.overlay.solid { background: radial-gradient(ellipse at 50% 40%, #2a1c10, #0c0805 75%); }
/* In der kleinen Galerie-Ansicht: Glasspiegelung und Innenschatten der Bilder weglassen (kaum sichtbar, aber teuer) */
.gallery-grid .qcard .art::before, .gallery-grid .qcard .art::after,
.gallery-grid .terrain .art::before, .gallery-grid .terrain .art::after { display: none; }
.gallery-grid .qcard:not(:hover)::before { display: none; }

/* =============================================================== Glühwürmchen im Menü */
.embers .fly {
  position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle, #fffff0 0 18%, #f0ff9a 38%, rgba(200, 255, 100, .55) 58%, transparent 72%);
  box-shadow: 0 0 calc(var(--s) * 2.6) calc(var(--s) * .9) rgba(205, 255, 115, .55);
  animation: fly-path var(--move) ease-in-out var(--delay) infinite alternate, fly-glow var(--glow) ease-in-out var(--delay) infinite;
  will-change: transform, opacity;
}
/* Langsames Gerät (Stufe aus watchFrames in ui.js): erst die Hälfte, dann ein Viertel der Glühwürmchen */
[data-fx="1"] .embers .fly:nth-child(2n), [data-fx="2"] .embers .fly:not(:nth-child(4n)) { display: none; }
/* nahe Glühwürmchen: weich und unscharf wirkend – per Verlauf statt teurem Unschärfefilter */
.embers .fly.near {
  background: radial-gradient(circle, rgba(255, 255, 230, .9) 0 10%, rgba(235, 255, 150, .6) 30%, rgba(200, 255, 100, .22) 55%, transparent 70%);
  box-shadow: 0 0 calc(var(--s) * 1.8) calc(var(--s) * .5) rgba(205, 255, 115, .3);
}
@keyframes fly-path {
  0% { transform: translate(0, 0); }
  35% { transform: translate(var(--dx1), var(--dy1)); }
  70% { transform: translate(var(--dx2), var(--dy2)); }
  100% { transform: translate(calc(var(--dx1) * -.6), calc(var(--dy2) * .5)); }
}
@keyframes fly-glow {
  0%, 100% { opacity: .15; }
  40% { opacity: 1; }
  60% { opacity: .9; }
}
.overlay-open .embers .fly { animation-play-state: paused; }

/* =============================================================== Ausgewählte Knöpfe: poliertes Gold */
:root {
  --gold-polished:
    linear-gradient(170deg, rgba(255, 255, 255, .7) 0%, rgba(255, 255, 255, 0) 22%, rgba(255, 255, 255, 0) 58%, rgba(255, 250, 220, .35) 72%, rgba(255, 255, 255, 0) 86%),
    linear-gradient(180deg, #fff1b0 0%, #f6cf55 22%, #e2a91f 55%, #b9800d 82%, #d9a52a 100%);
}
.seg button.active, .horn-toggle.on, .mode-tile.active {
  background: var(--tex-grunge), var(--gold-polished);
  color: #3a2204; text-shadow: 0 1px 0 rgba(255, 248, 210, .75);
  border-color: #7a4f0e;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 240, .9), inset 0 -2px 3px rgba(120, 70, 0, .45),
    0 0 0 1px rgba(255, 220, 120, .5), 0 0 18px rgba(255, 200, 60, .45), 0 2px 0 #5a3a06;
}
.mode-tile.active { box-shadow: inset 0 1px 0 rgba(255, 255, 240, .9), inset 0 -3px 5px rgba(120, 70, 0, .45), 0 0 0 2px rgba(255, 220, 120, .55), 0 0 26px rgba(255, 200, 60, .5), 0 3px 0 #5a3a06; }
.mode-tile.active .mode-desc { color: #4a2c05; }

/* =============================================================== Hauptknöpfe: geschmiedetes Eisen */
.btn-primary:not(:disabled) {
  background:
    var(--rivets-iron),
    var(--tex-grunge),
    linear-gradient(170deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 65%, rgba(200, 215, 230, .12) 80%, rgba(255, 255, 255, 0) 92%),
    linear-gradient(180deg, #6c737b 0%, #4a5058 38%, #33383e 70%, #24282c 100%);
  border: 2px solid #111316; border-radius: 8px;
  color: #eef1f4; text-shadow: 0 -1px 0 rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 255, 255, .12);
  box-shadow:
    inset 0 1px 0 rgba(230, 238, 246, .45), inset 0 -2px 0 rgba(0, 0, 0, .55),
    inset 0 0 0 1px rgba(160, 175, 190, .18), inset 0 0 16px rgba(0, 0, 0, .45),
    0 3px 0 #0c0d0f, 0 6px 14px rgba(0, 0, 0, .6);
}
@media (hover: hover) { .btn-primary:not(:disabled):hover { filter: brightness(1.15); } }
.btn-primary:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .7), inset 0 0 16px rgba(0, 0, 0, .45), 0 1px 0 #0c0d0f, 0 2px 6px rgba(0, 0, 0, .5);
}
/* Gesperrt: stumpfes, rostiges Eisen */
.btn-primary:disabled {
  background:
    var(--tex-grunge),
    radial-gradient(ellipse at 20% 70%, rgba(140, 70, 25, .35), transparent 55%),
    radial-gradient(ellipse at 85% 30%, rgba(120, 60, 20, .3), transparent 50%),
    linear-gradient(180deg, #3e3a36, #2a2724 60%, #1d1b19);
  color: #7d766c; opacity: .8;
}

/* =============================================================== Einheitliche Knopfschrift und -maße */
/* Alle Knöpfe: dieselbe Schrift (Cinzel) – und Zustände (aktiv, gesperrt, gedrückt) ändern nie die Größe */
button, .btn-primary, .btn-secondary, .btn-small, .horn-toggle, .stat-choice button, .seg button, .mode-tile, .mode-tile * {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: .5px;
}
.btn-primary, .btn-primary:disabled, .btn-primary:not(:disabled) { letter-spacing: 1px; border-width: 2px; }
.mode-desc { font-weight: 700; letter-spacing: .2px; }
button { white-space: nowrap; }
.menu-links .btn-secondary { font-size: 14px; padding-left: 14px; padding-right: 14px; min-width: 0; }
.mode-tile, .mode-tile * { white-space: normal; }
@media (max-width: 640px) {
  /* Luft statt Enge: Inhalt mit Abstand zur Ziernaht (inset 8px) und zwischen den Blöcken */
  #menu .menu-box { padding: 26px 22px 24px; }
  .menu-heading { margin-bottom: 22px; }
  .mode-tiles { gap: 16px; }
  .mode-tile { padding: 16px 12px 14px; gap: 6px; }
  #menu .menu-row { margin: 24px 0; }
  #difficulty-row { gap: 10px; }
  #difficulty-select { display: flex; width: 100%; }
  #difficulty-select button { flex: 1; min-width: 0; padding-left: 8px; padding-right: 8px; }
  .start-big { margin-top: 2px; }
  .menu-cards { margin-bottom: 16px !important; }
  .start-big { font-size: 18px; }
  .menu-links .btn-secondary { font-size: 12px; padding-left: 10px; padding-right: 10px; }
  .top-buttons .btn-small { padding: 6px 9px; font-size: 11px; }
  .top-buttons :is(.sfx-toggle, .music-toggle, .fs-toggle) { padding-left: 6px; padding-right: 6px; }
  .top-buttons { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
}

/* =============================================================== Hauptknöpfe: poliertes Gold (ersetzt die Eisen-Optik) */
.btn-primary:not(:disabled) {
  background: var(--rivets), var(--tex-grunge), var(--gold-polished);
  border: 2px solid #6e4a10;
  color: #3a2204; text-shadow: 0 1px 0 rgba(255, 248, 210, .75), 0 -1px 0 rgba(120, 70, 0, .25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 240, .9), inset 0 -2px 3px rgba(120, 70, 0, .45),
    0 0 0 1px rgba(255, 220, 120, .35), 0 0 18px rgba(255, 200, 60, .3),
    0 3px 0 #5a3a06, 0 6px 14px rgba(0, 0, 0, .55);
}
@media (hover: hover) { .btn-primary:not(:disabled):hover { filter: brightness(1.07) saturate(1.05); } }
.btn-primary:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 6px rgba(120, 70, 0, .55), 0 0 12px rgba(255, 200, 60, .25), 0 1px 0 #5a3a06, 0 2px 6px rgba(0, 0, 0, .5);
}

/* =============================================================== Dezentere Kartenbeschriftung */
/* Ab normaler Kartengröße etwa 12–15 % kleinere Schrift; kleine Karten (Handy) bleiben unverändert lesbar */
@container (min-width: 150px) {
  .qcard .head { font-size: calc(var(--qw) * .056); }
  .qcard .code { font-size: calc(var(--qw) * .07); min-width: calc(var(--qw) * .14); height: calc(var(--qw) * .105); }
  .qcard .name { font-size: calc(var(--qw) * .064); }
  .qcard .name.long { font-size: calc(var(--qw) * .055); }
  .qcard .name.xlong { font-size: calc(var(--qw) * .046); }
  .qcard .ability { font-size: calc(var(--qw) * .05); }
  .qcard .row { font-size: calc(var(--qw) * .057); }
  .qcard .row .num { font-size: calc(var(--qw) * .074); }
  .qcard .row .bonus { font-size: calc(var(--qw) * .052); }
}

/* Alegreya hat kleinere Kleinbuchstaben als die bisherige Schrift – Kartentexte leicht größer, Zahlen gleich hoch */
.qcard .row, .qcard .ability, .qcard .head { font-weight: 700; }
.qcard .row .num, .qcard .row .bonus, .deck .count, .pot .count, .slot .value, .round-info, .final-score b {
  font-variant-numeric: lining-nums tabular-nums;
}
@container (min-width: 150px) {
  .qcard .head { font-size: calc(var(--qw) * .061); }
  .qcard .ability { font-size: calc(var(--qw) * .055); }
  .qcard .row { font-size: calc(var(--qw) * .062); }
  .qcard .row .num { font-size: calc(var(--qw) * .078); }
}

/* =============================================================== Foto-Texturen (ambientCG, CC0) */
/* Holztisch */
.table {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 214, 150, .14), transparent 58%),
    linear-gradient(rgba(30, 16, 6, .18), rgba(30, 16, 6, .18)),
    url('../art/textures/table.webp') center / 640px;
}

/* =============================================================== Farbflächen wie aufgedruckt */
/* Gedämpfte Druckfarben, durch die das Pergament (Papierstruktur) durchscheint – ohne Glanz und Wölbung */
.qcard .head {
  background:
    var(--tex-paper),
    linear-gradient(180deg, color-mix(in srgb, var(--fc) 62%, #e8d8b0), color-mix(in srgb, var(--fc) 70%, #b89a64));
  box-shadow: none; border-bottom: 1px solid color-mix(in srgb, var(--fc) 50%, #3a2508);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
.qcard .code {
  background: var(--tex-paper), #f1e5c6; border: 1px solid color-mix(in srgb, var(--fc) 40%, #3a2508);
  box-shadow: none; color: #3a2508;
}
.qcard .name {
  background:
    var(--tex-paper),
    linear-gradient(180deg, color-mix(in srgb, var(--fc) 45%, #5a3d1c), color-mix(in srgb, var(--fc) 38%, #3a2610));
  box-shadow: inset 0 1px 0 rgba(226, 184, 90, .7), inset 0 -1px 0 rgba(226, 184, 90, .7);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
}
.qcard .ability {
  background: var(--tex-paper), rgba(120, 85, 35, .12);
  border: 1px solid rgba(90, 60, 20, .35); box-shadow: none;
}
.qcard .row.active {
  background: var(--tex-paper), linear-gradient(90deg, rgba(222, 170, 60, .55), rgba(222, 170, 60, .38));
  box-shadow: inset 0 0 0 1px rgba(140, 95, 20, .6);
}
.qcard .row .bar { background: rgba(90, 60, 20, .12); }
.qcard .row .bar i { background: color-mix(in srgb, var(--fc) 70%, #b89a64); opacity: .8; }

/* =============================================================== Zählende Eigenschaft: Lesezeichen-Band */
/* Ein Band in der Volksfarbe ragt links aus dem Kartenrand und läuft nach rechts aus */
.qcard .frame, .qcard .stats { overflow: visible; }
/* Ohne Beschnitt durch den Rahmen braucht die Kopfleiste dessen Rundung selbst */
.qcard .head { border-radius: 10px 10px 0 0; }
.qcard .row.active {
  margin-left: calc(var(--qw) * -.075); padding-left: calc(var(--qw) * .075 + 5px);
  background: linear-gradient(90deg, color-mix(in srgb, var(--fc) 85%, #000) 0%, color-mix(in srgb, var(--fc) 70%, #000) 45%,
    color-mix(in srgb, var(--fc) 40%, transparent) 80%, transparent 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, calc(var(--qw) * .03) 50%);
  border-radius: 0; box-shadow: none;
}
.qcard .row.active .lbl, .qcard .row.active > span:first-child { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.qcard .row.active .lbl { font-weight: 800; }
.qcard .row.active .bar { background: rgba(255, 255, 255, .2); }
.qcard .row.active .bar i { background: rgba(255, 255, 255, .75); opacity: 1; }
.qcard .row.active .num { font-size: calc(var(--qw) * .095); color: #2a1804; text-shadow: 0 1px 0 rgba(255, 245, 220, .6); }
.qcard .row.dim { opacity: .55; }
/* keine verblassten Zeilen; Band links mit deutlicher halbrunder Aussparung */
.qcard .row.dim { opacity: 1; }
.qcard .row.active {
  clip-path: none;
  -webkit-mask: radial-gradient(circle at 0 50%, transparent 0 calc(var(--qw) * .042), #000 calc(var(--qw) * .042 + .5px));
  mask: radial-gradient(circle at 0 50%, transparent 0 calc(var(--qw) * .042), #000 calc(var(--qw) * .042 + .5px));
}

/* Online-Lobby: Codes zum Austauschen */
.lobby { text-align: left; }
.lobby h2, .lobby .big-emoji { text-align: center; }
.lobby .net-step { margin: 14px 0 6px; }
.net-code {
  width: 100%; box-sizing: border-box; resize: vertical; font: 12px/1.35 ui-monospace, Menlo, Consolas, monospace; word-break: break-all;
  background: linear-gradient(180deg, #f3e6c4, #dcc998); color: #2a1804; border: 1.5px solid #6e4a10; border-radius: 8px; padding: 8px 10px;
  box-shadow: inset 0 2px 4px rgba(90, 60, 20, .35);
}
.net-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.net-status { color: var(--muted); font-style: italic; min-height: 1.5em; text-align: center; }
.net-status.error { color: #ffb3a8; font-style: normal; }

.net-invite { display: flex; gap: 18px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 10px 0 4px; }
.net-qr { width: 190px; height: 190px; padding: 8px; background: #fff8e6; border-radius: 12px; border: 2px solid var(--gold-dark); box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
.net-qr svg { display: block; width: 100%; height: 100%; }
.net-qr svg path, .net-qr svg rect[fill="black"] { fill: #1e140b; }
.net-room { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.net-label { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.net-roomcode { font-family: var(--display); font-size: 34px; letter-spacing: 3px; color: var(--gold); text-shadow: 0 2px 0 #000; }
.net-room .net-actions { flex-direction: column; align-items: stretch; justify-content: center; }
.net-actions.center { justify-content: center; }
.net-form { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.net-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.net-form input {
  width: 170px; padding: 9px 12px; border-radius: 8px; font-family: inherit; font-size: 17px; font-weight: 700;
  background: linear-gradient(180deg, #f3e6c4, #dcc998); color: #2a1804; border: 1.5px solid #6e4a10; box-shadow: inset 0 2px 4px rgba(90, 60, 20, .35);
}
#room-code { font-family: var(--display); letter-spacing: 2px; text-transform: uppercase; }
.net-alt { text-align: center; margin: 14px 0 0; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; box-shadow: none; }
@media (hover: hover) { .link-btn:hover { color: var(--gold); } }
.net-warn { background: rgba(120, 40, 20, .35); border: 1px solid #a0522d; border-radius: 10px; padding: 10px 14px; font-size: 14px; line-height: 1.45; }

/* =============================================================== Automatisch weiter */
/* Der Balken unten im „Weiter“-Knopf schrumpft, bis es von selbst weitergeht (--auto: 1 → 0) */
#next-btn { position: relative; overflow: hidden; }
#next-btn::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgba(58, 34, 4, .55); transform-origin: left; transform: scaleX(var(--auto, 0));
}

/* Online: Der Gegner lässt auf sich warten */
.center .stall {
  display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 4px;
  color: var(--muted); font-size: 13px; font-weight: 700; text-align: center;
}
.center .stall b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Handy quer: zu niedrig zum Stapeln – die Hand rückt neben Schlachtfeld und eigene Leiste */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --gap: 6px; --qw: clamp(60px, min((var(--vh) - 210px) / 1.5, (100vw - 110px) / 8.4), 130px); }
  .table {
    grid-template-columns: 1fr auto; grid-template-rows: auto auto 1fr auto;
    grid-template-areas: "top top" "opp opp" "field hand" "me hand"; column-gap: 10px; padding: 4px 10px 6px;
  }
  .topbar { position: static; grid-area: top; padding: 2px 4px; }
  .opp-row { grid-area: opp; }
  .battlefield { grid-area: field; padding: 1.5em 4px 1.9em; gap: 8px; }
  .player-bar.me { grid-area: me; }
  .player-bar { padding: 3px 12px; border-radius: 14px; }
  .player-bar .avatar { width: 30px; height: 30px; font-size: 16px; }
  .qslot { width: 22px; height: 22px; font-size: 11px; }
  .hand-area { grid-area: hand; align-self: center; padding: 0; grid-template-columns: 1fr; row-gap: 4px; }
  .hand-title, .hand, .hand-actions { grid-column: 1; justify-self: center; text-align: center; max-width: calc(var(--qw) * 3 + 12px); }
  .hand-title { grid-row: 1; } .hand { grid-row: 2; padding-top: 10px; gap: 6px; }
  .hand-actions { grid-row: 3; flex-direction: row; width: 100%; min-width: 0; }
  .hand-title .result-line { text-align: center; }
  .hand-actions > button { flex: 1 1 auto; min-width: 0; padding: 8px 6px; }
  .horn-toggle, #play-btn, #next-btn { font-size: 12px; letter-spacing: 0; white-space: nowrap; }
  .qcard .row .bar { display: none; }
  /* Unter den Duellkarten ist nur Platz für den Wert: Die Zeilen der Duell-Animation wachsen nach oben über die Karte */
  .slot .value { top: auto; bottom: -1.7em; }
  .slot .value .steps {
    order: -1; margin: 0 0 .25em; padding: 2px 7px; border-radius: 8px;
    background: rgba(20, 12, 6, .88); box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
  }
}

/* =============================================================== Notch und Home-Balken (viewport-fit=cover) */
/* Als installierte App reicht die Seite unter Statusleiste und Home-Balken – die Bedienelemente rücken davon weg */
.table {
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: max(var(--gap), env(safe-area-inset-bottom, 0px));
}
.topbar { top: env(safe-area-inset-top, 0px); }
@media (max-width: 1000px) { .table { padding-top: env(safe-area-inset-top, 0px); } }
@media (orientation: landscape) and (max-height: 500px) {
  .table {
    padding: max(4px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px))
      max(6px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  }
}
#menu {
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.menu-audio { top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); }
.overlay, .quartet-show {
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.modal.gallery { height: calc(100dvh - max(16px, env(safe-area-inset-top, 0px)) - max(16px, env(safe-area-inset-bottom, 0px))); }

/* =============================================================== Handy hochkant */
@media (max-width: 640px) {
  /* Kopfleiste in einer Zeile: Ton, Musik, Vollbild und Regeln liegen im Spielmenü (☰) */
  .top-buttons .in-menu { display: none; }
  .top-buttons { flex-wrap: nowrap; }
  .top-buttons .btn-small { min-height: 36px; padding: 6px 12px; font-size: 12px; }
  .topbar { align-items: center; padding-top: 6px; }
  /* Spielmenü: Schalter über der Frage, ob man gehen will */
  .game-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 18px; }
  .game-menu .btn-secondary { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
  .game-menu .off { opacity: .5; }
  /* Menü: die Ton-Knöpfe scrollen mit, statt über Karten und Titel zu liegen */
  .menu-audio { position: absolute; }
  #menu { padding-top: max(84px, calc(env(safe-area-inset-top, 0px) + 72px)); }
  /* Quartett: vier Karten passen nebeneinander, stärker aufgefächert */
  .q-plaque { --qw: min(96px, (100vw - 110px) / 3.1); padding-left: 12px; padding-right: 12px; }
  .q-card { margin: 0 calc(var(--qw) * -.11); }
  .q-title { font-size: 24px; }
}
/* Schlachtfeld: Gelände und Duellkarten richten sich nach der Höhe, die zwischen den Leisten bleibt –
   sonst ragen sie unter die Gegnerleiste. Wird der Text über der Hand länger (Rundenergebnis), schrumpfen sie sanft. --qw-fit ist als Länge registriert, damit 100cqh hier ausgerechnet
   wird (die Karten sind selbst Container und würden es sonst auf ihre eigene Höhe beziehen) */
@property --qw-fit { syntax: '<length>'; inherits: true; initial-value: 0px; }
@media (max-width: 640px) {
  /* Unter den Duellkarten stehen Wert und bis zu drei Zeilen der Duell-Animation: Wo die Höhe reicht, rücken die Karten
     dafür nach oben – auf kleinen Bildschirmen nicht, dort würden sie sonst schrumpfen */
  .battlefield {
    container-type: size; --qw-max: var(--qw);
    padding: calc(1.6em + 6px) 4px clamp(calc(2em + 6px), calc(2em + 6px + (100dvh - 690px) / 2), calc(5.4em + 6px));
  }
  .battlefield > * { --qw-fit: clamp(60px, (100cqh - 16px) / 1.5, var(--qw-max)); --qw: var(--qw-fit); transition: --qw-fit .35s ease; }
  /* Leisten in einer Zeile: „Karten“ weglassen, lange Namen kürzen */
  .table { grid-template-columns: minmax(0, 1fr); } /* eine zu breite Leiste darf das Spielfeld nicht verbreitern */
  .player-bar { flex-wrap: nowrap; gap: 4px; padding: 4px 8px; }
  .player-bar .avatar { width: 28px; height: 28px; font-size: 15px; }
  .player-bar .pname { font-size: 14px; }
  .opp-row { gap: 6px; padding: 0 6px; }
  .player-bar .total-chip .unit { display: none; }
  .player-bar .pname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .player-bar .qslot { width: 22px; height: 22px; }
}

/* =============================================================== Großansicht per Touch */
/* Gedrückt halten: die Karte wächst sichtbar an, bis sich nach 0,35 s die Großansicht öffnet
   (eigene scale-Eigenschaft, damit Anheben und Neigen der Handkarte erhalten bleiben) */
.pressing { scale: 1.08; filter: brightness(1.12); transition: scale .35s ease-out, filter .35s ease-out; z-index: 30; }
@media (prefers-reduced-motion: reduce) { .pressing { scale: 1; } }

/* App vom Homescreen: Dort sind 100 % und dvh/svh um die Statusleiste zu kurz (iPhone 13 mini: 762 statt 812 px),
   nur lvh ist die volle Höhe. In Safari bleibt dvh – mit lvh lägen die Knöpfe hinter der Leiste. */
@media (display-mode: standalone), (display-mode: fullscreen) {
  :root { --vh: 100lvh; }
  html, body { height: 100lvh; }
  :is(.screen, .overlay, .quartet-show, .coin-toss, .embers, .intro), #menu::before { bottom: auto; height: 100lvh; }
  .modal.gallery { height: calc(100lvh - max(16px, env(safe-area-inset-top, 0px)) - max(16px, env(safe-area-inset-bottom, 0px))); }
}

/* =============================================================== Handy: gewählte Handkarte groß */
/* Antippen wählt die Karte und hebt sie vergrößert an – ohne Fenster davor, Schlachtfeld und
   „Karte ausspielen“ bleiben sichtbar. Sie wächst von unten nach oben über Titel und eigene Leiste. */
@media (hover: none) and (max-width: 640px) {
  .hand .qcard { transform-origin: 50% 100%; transition: transform .2s ease-out, box-shadow .2s; }
  .hand-area { position: relative; z-index: 3; } /* über der eigenen Leiste */
  .hand .qcard.selected { z-index: 5; transform: translateY(-10px) scale(1.5); }
  /* Außenkarten wachsen nach innen, damit sie nicht über den Bildschirmrand ragen */
  .hand .qcard:first-child:not(:only-child) { transform-origin: 12% 100%; }
  .hand .qcard:last-child:not(:only-child) { transform-origin: 88% 100%; }
  /* Fähigkeit klein am unteren Bildrand, damit das Bild sichtbar bleibt */
  .hand .qcard.selected .ability .atext {
    top: auto; bottom: calc(var(--qw) * .76); left: 5%; right: 5%;
    font-size: calc(var(--qw) * .075); line-height: 1.2; padding: 3px 5px; border-radius: 5px;
  }
}
