/* Superfreundinnen-TCG · Oberfläche. Mobile first, ohne Hover- oder Drag-Pflicht. */
:root {
  --bg: #0e0f1f;
  --felt: #17193a;
  --felt-2: #1f2250;
  --gold: #e8c66f;
  --gold-2: #f6e2a4;
  --gold-dim: #9c8549;
  --text: #f3eee0;
  --muted: #b8b3c9;
  --hero: #2b3a8f;
  --hero-2: #1a2563;
  --villain: #6d1a2c;
  --villain-2: #3e0d19;
  --ok: #6fe0a5;
  --warn: #ffb35c;
  --bad: #ff6b7d;
  --target: #5ff0ff;
  --chosen: #ffe066;
  --radius: 10px;
  --display: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, 'Times New Roman', serif;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* Feldkarten aus der Resthöhe berechnen: 2 Felder à (1,72·Breite + Werte) neben Leisten und Hand */
  --field-w: clamp(44px, min(15vw, calc((100dvh - 20.5rem - var(--hand-w) * 1.4) / 3.5)), 230px);
  --hand-w: clamp(72px, min(23vw, 14vh), 180px);
  --bar-h: 44px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Automatische Skalierung: Schrift (und alles in rem) wächst mit der Auflösung – Handy ~15px, Laptop ~16px, Full-HD+ ~19px */
html { font-size: clamp(15px, calc(9px + 0.4vw + 0.25vh), 21px); }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--ui); }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
img { display: block; }
.boot { display: grid; place-items: center; height: 100vh; font-family: var(--display); color: var(--gold); font-size: 1.3rem; }

/* ───────── Knöpfe ───────── */
.btn {
  min-height: 2.75rem; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--gold-dim);
  background: linear-gradient(#2a2d5e, #1c1e45); color: var(--gold-2); font-weight: 600; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(#f3d98c, #c9a24b); color: #2a1b00; border-color: #f6e2a4; }
.btn.danger { border-color: #a5404f; color: #ffc9d0; background: linear-gradient(#4a1622, #2e0c15); }
.btn.ghost { background: transparent; border-color: #4a4c7a; color: var(--text); }
.btn.small { min-height: 2.25rem; padding: 0 .75rem; font-size: .88rem; }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.btn .sub { font-weight: 400; opacity: .8; font-size: .85em; }
.iconbtn { min-width: 2.75rem; min-height: 2.75rem; border-radius: 10px; border: 1px solid #3a3c6a; background: #1b1d40; display: inline-grid; place-items: center; font-size: 1.15rem; }

/* ───────── Startbildschirm ───────── */
.start {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 20% -10%, #2a3a9a55, transparent), radial-gradient(1000px 600px at 110% 110%, #7a1a3055, transparent), var(--bg);
}
.start-card { width: min(640px, 100%); background: #15173acc; border: 1px solid #3c3f78; border-radius: 18px; padding: 22px; box-shadow: 0 30px 80px #0008; }
.start h1 { font-family: var(--display); font-weight: 700; color: var(--gold); margin: 0 0 2px; font-size: clamp(1.45rem, 5vw, 2.1rem); line-height: 1.1; }
.start h1 .vs { display: block; font-size: .55em; color: var(--muted); font-style: italic; margin: 4px 0; }
.start .tag { color: var(--muted); margin: 6px 0 18px; font-size: .92rem; }
.backs { display: flex; gap: 10px; justify-content: center; margin: 4px 0 16px; }
.backs img { width: 74px; border-radius: 6px; box-shadow: 0 8px 24px #0009; }
.backs img:first-child { transform: rotate(-6deg); }
.backs img:last-child { transform: rotate(6deg); }
.field-row { display: grid; gap: 6px; margin-bottom: 14px; }
.field-row label { font-size: .85rem; color: var(--muted); }
.modes { display: grid; gap: 8px; }
.mode { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid #3a3c6a; background: #1a1c42; }
.mode input { margin-top: 3px; accent-color: var(--gold); width: 18px; height: 18px; }
.mode b { display: block; }
.mode small { color: var(--muted); }
.mode:has(input:checked) { border-color: var(--gold); background: #24275a; }
.inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
input[type=text], textarea, select {
  width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid #3a3c6a; background: #0f1030; color: var(--text); padding: 8px 12px; font: inherit;
}
textarea { min-height: 120px; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.seedline { display: flex; gap: 8px; }
.start-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.note { font-size: .8rem; color: var(--muted); margin-top: 14px; line-height: 1.45; }

/* ───────── Spieltisch ───────── */
.table {
  height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
  background: radial-gradient(900px 500px at 50% 50%, var(--felt-2), var(--felt) 60%, var(--bg));
}
.layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; min-width: 0; }
.table > *, .board > *, .layout > * { min-width: 0; }
.handwrap { min-width: 0; overflow: hidden; }
@media (min-width: 1180px) { .layout { grid-template-columns: minmax(0, 1fr) clamp(300px, 20vw, 440px); } }
.board { display: grid; grid-template-rows: auto 1fr 1fr auto; min-height: 0; padding: 0 8px; gap: 4px; overflow-y: auto; }

.topbar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); background: #0c0d22d9; border-bottom: 1px solid #2c2e5c; }
.turninfo { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.turnpill { font-family: var(--display); font-weight: 700; padding: 6px 12px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--gold-dim); }
.turnpill.superfreundinnen { background: linear-gradient(90deg, var(--hero), var(--hero-2)); }
.turnpill.schattenkabinett { background: linear-gradient(90deg, var(--villain), var(--villain-2)); }
.turnno { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* Spielerleiste */
.pbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px; border-radius: 12px; font-size: .88rem; border: 1px solid #ffffff14; }
.pbar.superfreundinnen { background: linear-gradient(90deg, #2b3a8fcc, #1a256399); }
.pbar.schattenkabinett { background: linear-gradient(90deg, #6d1a2ccc, #3e0d1999); }
.pbar.active { box-shadow: 0 0 0 2px var(--gold), 0 0 18px #e8c66f55; }
.pname { font-family: var(--display); font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 6px; }
.pname .you { font-family: var(--ui); font-size: .7rem; font-weight: 700; background: var(--gold); color: #2a1b00; padding: 1px 6px; border-radius: 999px; }
.pname .live { font-family: var(--ui); font-size: .7rem; font-weight: 700; background: var(--ok); color: #002b14; padding: 1px 6px; border-radius: 999px; }
.score { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.scorebar { width: clamp(60px, 18vw, 140px); height: 8px; border-radius: 99px; background: #0007; overflow: hidden; }
.scorebar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: #0005; border: 1px solid #ffffff1a; white-space: nowrap; }
.chip.energy b { color: #ffe680; }
.chip.btnchip { min-height: 2rem; }
.pbar .spacer { flex: 1; }

/* Felder */
.zone { position: relative; display: flex; justify-content: safe center; gap: clamp(6px, 1vw, 16px); overflow-x: auto; overflow-y: hidden; padding: 8px 4px; min-height: calc(var(--field-w) * 1.72 + 34px); scrollbar-width: thin; }
/* Beide Felder rücken zur Tischmitte: Figuren stehen sich direkt gegenüber */
.zone.opp { align-items: flex-end; }
.zone.own { align-items: flex-start; }
.zone.empty { align-items: center; }
.zone.empty::after { content: attr(data-empty); align-self: center; color: #ffffff40; font-style: italic; font-size: .85rem; padding-left: 8px; }
.zone.opp { border-bottom: 1px solid #e8c66f2e; box-shadow: 0 1px 0 #0006; }
.supports { display: flex; gap: 4px; }

/* Karte im Feld */
.fig { position: relative; flex: 0 0 auto; width: var(--field-w); display: flex; flex-direction: column; }
.zone.opp .fig { flex-direction: column-reverse; }
.fig .art { padding: 0; border: 0; position: relative; z-index: 1; }
/* Ausrüstung: echte Karte, unter den Charakter geschoben; das Namensbanner ragt heraus */
.tuck { position: relative; z-index: 0; align-self: center; width: 90%; height: calc(var(--field-w) * 0.3); margin-top: -5px; padding: 0; border: 1px solid #e8c66f88; border-top: 0; border-radius: 0 0 7px 7px; overflow: hidden; background: #000; box-shadow: 0 4px 10px #0009; }
.tuck img { width: 100%; height: auto; display: block; margin-top: 3px; }
.zone.opp .tuck { margin-top: 0; margin-bottom: -5px; border-top: 1px solid #e8c66f88; border-bottom: 0; border-radius: 7px 7px 0 0; }
.zone.opp .tuck img { margin-top: 0; }
.tuck.none { visibility: hidden; }
.zone.opp .stats { margin: 0 0 3px; }
.fig .art { position: relative; width: var(--field-w); height: calc(var(--field-w) * 1.4); border-radius: 7px; overflow: hidden; background: #000; box-shadow: 0 4px 12px #0008; transition: transform .2s; }
.fig .art img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s, filter .25s; }
.fig.exhausted .art img { transform: rotate(90deg) scale(.715); filter: saturate(.55) brightness(.8); }
.fig.exhausted .art { background: #1b1630; }
.fig .flag { position: absolute; left: 2px; right: 2px; font-size: clamp(.5rem, calc(var(--field-w) * .085), 1rem); font-weight: 800; text-transform: uppercase; letter-spacing: 0; overflow: hidden; white-space: nowrap; text-align: center; padding: 2px 3px; border-radius: 4px; pointer-events: none; }
.fig .flag.top { top: 3px; }
.fig .flag.bottom { bottom: 3px; }
.flag.exh { background: #000c; color: #ffd38a; }
.flag.sick { background: #1d2fa8e6; color: #dfe6ff; }
.flag.haste { background: #0a6b4ae6; color: #d6ffef; }
.stats { display: flex; justify-content: space-between; gap: 2px; margin-top: 3px; font-size: clamp(.6rem, calc(var(--field-w) * .105), 1.25rem); font-weight: 700; }
.stats span { flex: 1; text-align: center; padding: 1px 0; border-radius: 4px; background: #0008; }
.stats .up { color: var(--ok); }
.stats .down { color: var(--bad); }
.stats .stress { background: #5a0d1acc; color: #ffd0d6; }
.stats .stress.zero { background: #0008; color: var(--muted); }
.attach { margin-top: 3px; font-size: .62rem; line-height: 1.15; padding: 3px 4px; border-radius: 5px; border: 1px solid #e8c66f66; background: #2a250f; color: var(--gold-2); width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 22px; }
.attach.none { visibility: hidden; }

/* Markierungen: spielbar, Aktion möglich, Ziel */
.can-act .art { box-shadow: 0 0 0 2px var(--ok), 0 0 14px #6fe0a588; }
.targetable .art, .attach.targetable, .tuck.targetable { box-shadow: 0 0 0 3px var(--target), 0 0 18px #5ff0ffaa; animation: pulse 1.2s ease-in-out infinite; }
.chosen .art, .attach.chosen, .tuck.chosen { box-shadow: 0 0 0 4px var(--chosen), 0 0 22px #ffe066cc !important; animation: none; }
.selecting .fig:not(.targetable):not(.chosen) .art, .selecting .handcard:not(.targetable) { opacity: .45; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--target), 0 0 4px #5ff0ff44; } }
.actmarks { position: absolute; top: -6px; right: -6px; display: flex; gap: 2px; pointer-events: none; }
.actmarks i { font-style: normal; width: 1.4rem; height: 1.4rem; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; background: var(--ok); color: #003018; box-shadow: 0 2px 6px #0008; }

/* Hand */
.handwrap { background: linear-gradient(#0c0d22aa, #0c0d22f2); border-top: 1px solid #2c2e5c; }
.handhead { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 0; font-size: .8rem; color: var(--muted); }
.hand { display: flex; justify-content: safe center; gap: 8px; overflow-x: auto; padding: 8px 12px 10px; scroll-snap-type: x proximity; }
.handcard { position: relative; flex: 0 0 auto; width: var(--hand-w); border: 0; padding: 0; background: none; scroll-snap-align: start; }
.handcard img { width: 100%; height: calc(var(--hand-w) * 1.4); object-fit: contain; border-radius: 8px; background: #000; box-shadow: 0 6px 16px #000a; }
.handcard.playable img { box-shadow: 0 0 0 2px var(--gold), 0 0 16px #e8c66f88; }
.handcard.unplayable img { filter: saturate(.5) brightness(.65); }
.handcard .cost { position: absolute; top: -6px; left: -6px; min-width: 1.65rem; height: 1.65rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: #ffe680; color: #3a2a00; box-shadow: 0 2px 6px #0009; padding: 0 4px; }
.handcard .cost.disc { background: var(--ok); color: #003018; }
.handcard.unplayable .cost { background: #777; color: #222; }
.back-row { display: flex; align-items: center; gap: 2px; }
.back-row img { width: 18px; border-radius: 2px; margin-left: -8px; box-shadow: 0 1px 3px #000; }
.back-row img:first-child { margin-left: 0; }

/* Aktionsleiste */
.actionbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: #0a0b1d; border-top: 1px solid #2c2e5c; min-height: 3.75rem; }
.actionbar .hint { flex: 1; min-width: 0; font-size: .86rem; color: var(--muted); line-height: 1.25; }
.actionbar .hint b { color: var(--text); }
.actionbar.selecting { background: linear-gradient(90deg, #0b3b47, #0a1d33); border-top-color: var(--target); }
.actionbar.selecting .hint { color: #d9fbff; }
.btnrow { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Protokoll */
.logpanel { display: none; min-height: 0; border-left: 1px solid #2c2e5c; background: #0b0c1ee6; flex-direction: column; }
@media (min-width: 1180px) { .logpanel { display: flex; } }
.loghead { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid #2c2e5c; font-family: var(--display); color: var(--gold); }
.loglist { flex: 1; overflow-y: auto; padding: 6px 10px 20px; font-size: .82rem; line-height: 1.35; }
.loglist p { margin: 0 0 5px; padding: 4px 6px; border-radius: 6px; background: #ffffff06; }
.loglist p.turn { background: #e8c66f1f; color: var(--gold-2); font-weight: 700; margin-top: 10px; }
.loglist p.score { border-left: 3px solid var(--gold); }
.loglist p.defeat { border-left: 3px solid var(--bad); }
.loglist p.distract, .loglist p.stress { border-left: 3px solid #ff8f6b; }
.loglist p.win { background: #e8c66f40; color: #fff; font-weight: 700; }
.loglist p.skip { color: var(--muted); font-style: italic; }
.loglist .priv { display: block; color: #9fe3ff; font-size: .75rem; }
.loglist .p0 { --c: #7f92ff; } .loglist .p1 { --c: #ff7f99; }

/* ───────── Overlays ───────── */
.overlay { position: fixed; inset: 0; z-index: 50; background: #05060fcc; backdrop-filter: blur(4px); display: grid; place-items: center; padding: 12px; }
.sheet { width: min(980px, 100%); max-height: calc(100dvh - 24px); overflow: auto; background: #15173a; border: 1px solid #3c3f78; border-radius: 16px; box-shadow: 0 30px 80px #000b; }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #15173af2; border-bottom: 1px solid #2c2e5c; }
.sheet-head h2 { flex: 1; margin: 0; font-family: var(--display); font-size: 1.15rem; color: var(--gold); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 14px; }

.detail { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .detail { grid-template-columns: minmax(280px, 400px) 1fr; } }
.detail .big { width: 100%; max-height: 70dvh; object-fit: contain; border-radius: 14px; background: #000; }
.facts { display: grid; gap: 10px; align-content: start; }
.facts .meta { color: var(--muted); font-size: .9rem; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.statgrid div { background: #0c0d24; border: 1px solid #2c2e5c; border-radius: 10px; padding: 6px; text-align: center; }
.statgrid b { display: block; font-size: 1.25rem; }
.statgrid small { color: var(--muted); }
.rules { background: #0c0d24; border: 1px solid #2c2e5c; border-radius: 12px; padding: 10px 12px; line-height: 1.45; }
.rules h4 { margin: 0 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-dim); }
.rules p { margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: #2a2d5e; border: 1px solid #44478a; }
.badge.warn { background: #4a2d0a; border-color: #a87523; }
.badge.ok { background: #0a3b28; border-color: #2c9a68; }
.actions { display: grid; gap: 8px; }
.action { display: grid; gap: 3px; }
.action .why { font-size: .8rem; color: var(--warn); padding-left: 6px; }

.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.pick { position: relative; border: 0; padding: 0; background: none; text-align: center; font-size: .75rem; color: var(--muted); }
.pick img { width: 100%; aspect-ratio: 756 / 1056; object-fit: contain; border-radius: 8px; background: #000; margin-bottom: 4px; }
.pick.chosen img { box-shadow: 0 0 0 4px var(--chosen), 0 0 18px #ffe066aa; }
.pick.selectable img { box-shadow: 0 0 0 2px var(--target); }
.pick .num { position: absolute; top: 6px; right: 6px; background: var(--chosen); color: #3a2a00; font-weight: 800; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.sheet-foot { position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 10px 12px; background: #15173af2; border-top: 1px solid #2c2e5c; }
.sheet-foot .grow { flex: 1; align-self: center; color: var(--muted); font-size: .88rem; min-width: 160px; }

.handoff { text-align: center; padding: 30px 18px; }
.handoff h2 { font-family: var(--display); color: var(--gold); font-size: clamp(1.4rem, 5vw, 2rem); margin: 10px 0; }
.handoff .btn, .winner .btn, .sheet-foot .btn { white-space: normal; text-align: center; max-width: 100%; }
.handoff .shield { width: 120px; margin: 0 auto; border-radius: 10px; box-shadow: 0 10px 30px #000a; }
.handoff .recap { text-align: left; max-width: 560px; margin: 16px auto; background: #0c0d24; border: 1px solid #2c2e5c; border-radius: 12px; padding: 10px 14px; font-size: .85rem; max-height: 34dvh; overflow: auto; }
.handoff .recap p { margin: 0 0 4px; }
.handoff .warn { color: var(--muted); font-size: .85rem; }

.winner { text-align: center; padding: 26px 18px; }
.winner h2 { font-family: var(--display); color: var(--gold); font-size: clamp(1.6rem, 6vw, 2.4rem); margin: 6px 0; }
.winner .final { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.winner .final div { min-width: 150px; padding: 10px; border-radius: 12px; background: #0c0d24; border: 1px solid #2c2e5c; }
.winner .final b { display: block; font-size: 1.6rem; }
.winner .btnrow { justify-content: center; }

.mulligan { padding: 14px; }
.mulligan p { color: var(--muted); }
.mulligan .pickgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.textblock { line-height: 1.5; font-size: .92rem; }
.textblock h3 { font-family: var(--display); color: var(--gold); margin: 14px 0 4px; }
.textblock .ass { padding: 8px 10px; border-radius: 10px; background: #0c0d24; border: 1px solid #2c2e5c; margin-bottom: 8px; }
.textblock .ass b { color: var(--gold-2); }
.textblock .ass small { display: block; color: var(--muted); margin-top: 2px; }

#toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%) translateY(-12px); z-index: 80; max-width: min(92vw, 560px); padding: 10px 16px; border-radius: 12px; background: #3a1020f2; border: 1px solid #ff6b7d; color: #ffe3e7; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; box-shadow: 0 10px 30px #000a; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.info { background: #0e2f3af2; border-color: var(--target); color: #e3fbff; }

.piles { display: flex; gap: 6px; }
.menu-list { display: grid; gap: 8px; }
.menu-list .btn { justify-content: flex-start; border-radius: 12px; }
.muted { color: var(--muted); }

@media (max-width: 520px) {
  .pbar { font-size: .78rem; padding: 4px 8px; gap: 4px 6px; }
  .pname { font-size: .9rem; }
  .chip { padding: 2px 6px; }
  .topbar .btn { padding: 0 10px; }
  .actionbar .btn { padding: 0 12px; }
  .mulligan .pickgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Niedrige Bildschirme (kleine Handys, Querformat): Hand und Leisten kompakter, damit Ressourcen sichtbar bleiben */
@media (max-height: 700px) {
  :root { --hand-w: clamp(52px, min(20vw, 11vh), 100px); }
  .handhead { display: none; }
  .hand { padding: 6px 10px; }
  .pbar { padding: 3px 8px; gap: 3px 6px; font-size: .74rem; }
  .actionbar { min-height: 48px; padding-top: 5px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
  .actionbar .hint { font-size: .76rem; }
  .topbar { padding-top: max(3px, env(safe-area-inset-top)); padding-bottom: 3px; }
  .iconbtn { min-height: 38px; min-width: 40px; }
  .stats { font-size: .6rem; }
}
@media (max-height: 700px) { :root { --field-w: clamp(40px, min(15vw, calc((100dvh - 250px - var(--hand-w) * 1.4) / 3.5)), 190px); } }

/* Breite Bildschirme: Aktionsleiste rechts neben der Hand → mehr Höhe für die Felder */
.bottom { min-width: 0; }
@media (min-width: 1180px) and (min-aspect-ratio: 4/3) {
  .bottom { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 17vw, 400px); border-top: 1px solid #2c2e5c; }
  .bottom .handwrap { border-top: 0; }
  .bottom .actionbar { flex-direction: column; align-items: stretch; justify-content: center; gap: 10px; border-top: 0; border-left: 1px solid #2c2e5c; }
  .bottom .actionbar .btnrow { justify-content: stretch; }
  .bottom .actionbar .btnrow .btn { flex: 1; }
  .bottom .actionbar .btn.primary:not(.small) { min-height: 3.4rem; font-size: 1.1rem; }
}

.phasechip { font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid #ffffff33; }
.phasechip.play { background: #2a3f8a; color: #e3e9ff; }
.phasechip.actions { background: #0a5b40; color: #d6ffef; }
@media (max-width: 520px) { .turnno { display: none; } .phasechip { font-size: .7rem; padding: 3px 8px; } }

/* Erweiterung 0.7: Hauptquartier-Chip mit Miniatur, gedimmte Karten in Auswahldialogen */
.chip.hqchip { gap: 6px; padding-left: 3px; border-color: #e9c46a66; background: #2a1d0599; }
.chip.hqchip img { height: 1.7rem; aspect-ratio: 756 / 1056; object-fit: cover; border-radius: 3px; }
.pick.dim img { filter: grayscale(.7) brightness(.6); }

/* Online-Lobby */
.online-box { border: 1px solid #9fe3ff55; border-radius: 12px; padding: 12px; background: #0b2a3a55; }
@media (max-width: 600px) { .netchip .netwide { display: none; } .netchip { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; } }

/* ═════════════ Querformat-Tisch („Arena“) – PC, Tablet und Handy quer ═════════════ */
.arena {
  --fancard-w: clamp(64px, min(10.5vw, 23vh), 230px);
  --fan-step: calc(var(--fancard-w) * .64);
  --fan-h: calc(var(--fancard-w) * .92);
  --tint-top: #6d1a2c; --tint-bottom: #2b3a8f;
  position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  background:
    radial-gradient(60% 46% at 50% 50%, #f6e2a41a, transparent 70%),
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--tint-top) 70%, transparent), transparent 60%),
    radial-gradient(120% 60% at 50% 110%, color-mix(in srgb, var(--tint-bottom) 75%, transparent), transparent 60%),
    radial-gradient(140% 120% at 50% 50%, #1d2050, #0b0c1c 75%);
}
.arena.superfreundinnen-opp { --tint-top: #2b3a8f; }
.arena.schattenkabinett-me { --tint-bottom: #6d1a2c; }
/* Lebendiger Tisch: Ornament-Oval in der Mitte + langsam treibende Lichtpunkte */
.a-glow { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.a-glow::before { content: ''; position: absolute; left: 8%; right: 8%; top: 16%; bottom: 18%; border-radius: 50%; border: 1px solid #e8c66f30; box-shadow: inset 0 0 60px #e8c66f12, 0 0 0 10px #e8c66f08, 0 0 0 11px #e8c66f20; }
.a-glow::after { content: ''; position: absolute; inset: -50%; opacity: .55;
  background-image: radial-gradient(2px 2px at 10% 20%, #f6e2a4aa, transparent 60%), radial-gradient(1.5px 1.5px at 30% 70%, #9fe3ffaa, transparent 60%),
    radial-gradient(2px 2px at 55% 35%, #f6e2a488, transparent 60%), radial-gradient(1.5px 1.5px at 75% 80%, #ffb3c6aa, transparent 60%),
    radial-gradient(2px 2px at 90% 15%, #f6e2a499, transparent 60%), radial-gradient(1.5px 1.5px at 45% 90%, #9fe3ff88, transparent 60%);
  background-size: 420px 420px; animation: motes 60s linear infinite; }
@keyframes motes { to { transform: translate(140px, -210px); } }

.a-top { position: relative; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 10px 4px; }
.a-top .oppfan { flex: 1; }
.a-topright { display: flex; align-items: center; gap: 6px; }
.oppfan { position: relative; height: 3.4rem; display: grid; place-items: start center; }
.oppfan img { position: absolute; top: -1.2rem; width: 2.5rem; border-radius: 4px; box-shadow: 0 3px 8px #000b; transform-origin: 50% 0; }

/* Spielerplakette */
.plate { display: flex; align-items: center; gap: 10px; padding: 5px 16px 5px 5px; border-radius: 999px; overflow: visible; border: 1px solid #ffffff1c; backdrop-filter: blur(6px); min-width: 0; max-width: 40vw; }
.plate.superfreundinnen { background: linear-gradient(90deg, #2b3a8fe6, #1a256399); }
.plate.schattenkabinett { background: linear-gradient(90deg, #6d1a2ce6, #3e0d1999); }
.plate.active { box-shadow: 0 0 0 2px var(--gold), 0 0 26px #e8c66f66; }
.medal { position: relative; flex: 0 0 auto; width: 4.2rem; height: 4.2rem; border-radius: 50%; display: grid; place-items: center; }
/* nur der Ring, der sich mit den Punkten füllt – innen durchsichtig */
.medal::before { content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--gold-2), var(--gold) var(--pct), #ffffff26 var(--pct));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); }
.medal b { position: absolute; font-family: var(--display); font-size: 1.55rem; color: #fff; text-shadow: 0 2px 6px #000; line-height: 1; margin-top: -.2rem; }
.medal-wrap { position: relative; }
.medal small { position: absolute; bottom: .55rem; font-size: .62rem; color: var(--gold-2); font-weight: 700; }
.medal.pop { animation: pop .7s ease-out; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.22); box-shadow: 0 0 34px #ffe680; } 100% { transform: scale(1); } }
.pinfo { min-width: 0; display: grid; gap: 3px; }
.plate .pname { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .82rem; }
.pres .res { display: inline-flex; align-items: center; gap: 4px; }
.pres .res b { color: #ffe680; margin-left: 2px; }
.pres.small { color: var(--muted); gap: 8px; }
.linkbtn { border: 0; background: none; padding: 0; color: inherit; font: inherit; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: .62rem; height: .62rem; border-radius: 50%; background: #ffffff22; border: 1px solid #ffffff33; }
.pips.energy i.on { background: radial-gradient(circle at 35% 35%, #fff6b0, #ffc93a); border-color: #ffe680; box-shadow: 0 0 6px #ffd54a; }
.pips.ap i.on { background: radial-gradient(circle at 35% 35%, #c9f7ff, #3ec6ff); border-color: #9fe3ff; box-shadow: 0 0 6px #3ec6ff; }

/* Spielfeld */
.arena .a-field { position: relative; z-index: 2; display: grid; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); padding: 0 12px; gap: 2px; overflow: hidden; }
.arena .zone { border: 0; box-shadow: none; min-height: 0; padding: 4px 4px; gap: clamp(8px, 1.4vw, 22px); }
.arena .zone.empty::after { font-size: .8rem; }
.a-mid { display: flex; align-items: center; gap: 12px; padding: 0 6%; }
.midline { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #e8c66f88, transparent); }
.midinfo { font-family: var(--display); color: var(--gold-2); font-size: .9rem; white-space: nowrap; display: flex; align-items: center; gap: 6px; text-shadow: 0 2px 6px #000; }
/* Feldkarten im Querformat: Werte liegen als Plakette auf der Karte, Ausrüstung schaut kürzer heraus */
.arena .fig { width: var(--field-w); }
.arena .fig .stats { position: absolute; left: 4%; right: 4%; z-index: 3; margin: 0; padding: 2px 4px; border-radius: 6px; background: #0b0c1ed9; border: 1px solid #ffffff1f; font-size: clamp(.55rem, calc(var(--field-w) * .1), 1.1rem); }
.arena .zone.own .fig .stats { top: calc(var(--field-w) * 1.4 - 1.6em); }
.arena .zone.opp .fig .stats { bottom: 3px; }
.arena .tuck { height: calc(var(--field-w) * .2); }
.arena .fig .art { box-shadow: 0 8px 22px #000a; transition: transform .2s; }
.arena .fig .art:hover { transform: translateY(-3px) scale(1.03); }
.fig.enter .art { animation: enterField .6s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes enterField { 0% { transform: translateY(40px) scale(.55); opacity: 0; filter: brightness(2); } 60% { opacity: 1; } 100% { transform: none; filter: none; } }
.fig.hit .art { animation: hit .5s ease-out; }
@keyframes hit { 0%, 100% { transform: none; } 20% { transform: translateX(-6px) rotate(-2deg); box-shadow: 0 0 24px #ff4d6d; } 40% { transform: translateX(5px) rotate(2deg); } 60% { transform: translateX(-3px); } }

/* Unten: eigene Plakette · Hand als Fächer · Zug beenden */
.a-bottom { position: relative; z-index: 6; display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto); align-items: end; gap: 10px; padding: 0 10px max(6px, env(safe-area-inset-bottom)); height: var(--fan-h); }
.a-bottom .plate { margin-bottom: 8px; align-self: end; }
.a-hand { position: relative; height: 100%; min-width: 0; overflow-x: clip; overflow-y: visible; }
.fan { position: absolute; inset: 0; }
.fanempty { position: absolute; left: 50%; bottom: 30%; transform: translateX(-50%); }
.fancard { position: absolute; left: 50%; bottom: calc(var(--fancard-w) * -.5); width: var(--fancard-w); border: 0; padding: 0; background: none;
  transform: translateX(-50%) translateX(var(--x)) translateY(var(--y)) rotate(var(--r)); transform-origin: 50% 120%; transition: transform .22s ease, filter .2s; }
.fancard img { width: 100%; aspect-ratio: 756 / 1056; object-fit: cover; border-radius: 9px; background: #000; box-shadow: 0 10px 24px #000c; }
.fancard.playable img { box-shadow: 0 0 0 2px var(--gold), 0 0 18px #e8c66faa, 0 10px 24px #000c; }
.fancard.unplayable img { filter: saturate(.55) brightness(.7); }
.fancard .cost { position: absolute; top: -8px; left: -8px; z-index: 2; min-width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: #ffe680; color: #3a2a00; box-shadow: 0 2px 6px #0009; }
.fancard .cost.disc { background: var(--ok); color: #003018; }
.fancard.unplayable .cost { background: #777; color: #222; }
.fancard:hover, .fancard:focus-visible, .fancard.focus { z-index: 99 !important; transform: translateX(-50%) translateX(var(--x)) translateY(calc(var(--fancard-w) * -.52)) rotate(0) scale(1.12); }
.fancard.targetable img { box-shadow: 0 0 0 3px var(--target), 0 0 18px #5ff0ffaa; }
.fancard.chosen img { box-shadow: 0 0 0 4px var(--chosen), 0 0 22px #ffe066cc; }
.arena.selecting .fancard:not(.targetable):not(.chosen) { opacity: .45; }
.a-actions { display: grid; justify-items: end; gap: 6px; padding-bottom: 6px; max-width: 30vw; }
.a-hint { font-size: .8rem; color: var(--muted); text-align: right; line-height: 1.25; text-shadow: 0 1px 4px #000; }
.a-hint b { color: var(--text); }
.a-hint.sel { color: #d9fbff; background: #0b3b47e6; border: 1px solid var(--target); border-radius: 10px; padding: 6px 10px; text-align: left; }
.a-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn.big { min-height: 3.3rem; padding: 0 1.6rem; font-size: 1.05rem; font-family: var(--display); }
.btn.endturn.ready { animation: ready 2.4s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 0 0 3px #f6e2a455, 0 0 24px #e8c66f88; } }

/* Seitenpanel mit Kartendetails */
.a-panel { position: absolute; z-index: 20; right: 10px; top: 4.4rem; bottom: calc(var(--fan-h) + 6px); width: clamp(260px, 27vw, 480px); display: flex; flex-direction: column;
  background: #121433f2; border: 1px solid #4b4e8a; border-radius: 14px; box-shadow: 0 20px 60px #000c; backdrop-filter: blur(8px); animation: slideIn .2s ease-out; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.a-panel-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid #2c2e5c; }
.a-panel-head h2 { flex: 1; margin: 0; font-family: var(--display); color: var(--gold); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-panel-body { overflow-y: auto; padding: 10px 12px 14px; }
.a-panel .detail { grid-template-columns: 1fr; gap: 10px; }
.a-panel .detail .big { max-height: 42vh; }

/* Zugwechsel-Banner */
.turnbanner { position: absolute; z-index: 40; left: 50%; top: 45%; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
  font-family: var(--display); font-size: clamp(1.6rem, 4.5vw, 3.6rem); color: var(--gold-2); text-shadow: 0 0 24px #e8c66f, 0 4px 14px #000;
  padding: .3em 1.4em; border-radius: 999px; background: radial-gradient(closest-side, #0b0c1ecc, transparent); animation: banner 1.8s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

/* Handy quer (geringe Höhe): alles kompakter */
@media (orientation: landscape) and (max-height: 520px) {
  .arena { --fancard-w: clamp(56px, 19vh, 110px); --fan-h: calc(var(--fancard-w) * .78); }
  .a-top { padding: 3px 8px; gap: 6px; }
  .medal { width: 2.7rem; height: 2.7rem; padding: 3px; }
  .medal b { font-size: 1.05rem; } .medal small { display: none; }
  .plate { gap: 6px; padding: 3px 10px 3px 3px; }
  .plate .pname { font-size: .82rem; } .pname .you, .pname .live { font-size: .6rem; }
  .pres { font-size: .7rem; gap: 6px; } .pips i { width: .45rem; height: .45rem; }
  .pres.small { display: none; }
  .hqrow .chip { min-height: 1.5rem; padding: 1px 6px; font-size: .66rem; } .hqrow .chip img { height: 1.1rem; }
  .oppfan { height: 2.2rem; } .oppfan img { width: 1.7rem; top: -.9rem; }
  .iconbtn { min-width: 36px; min-height: 36px; }
  .midinfo { font-size: .72rem; } .phasechip { font-size: .65rem; padding: 2px 6px; }
  .btn.big { min-height: 2.6rem; padding: 0 1rem; font-size: .9rem; }
  .a-hint { font-size: .68rem; }
  .a-panel { top: 3rem; width: clamp(240px, 34vw, 380px); }
  .a-panel .detail .big { max-height: 34vh; }
  .fancard .cost { min-width: 1.35rem; height: 1.35rem; font-size: .72rem; top: -5px; left: -5px; }
}
@media (prefers-reduced-motion: reduce) { .a-glow::after { animation: none; } }

.hqrow { gap: 4px; } .hqrow .chip { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }

/* ── Schauplatz (gemeinsam, Tischmitte) & Nachziehstapel ── */
.venue { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 10px; border: 1px solid var(--gold); background: linear-gradient(90deg, #1b1f44ee, #2a1530ee); color: var(--gold-2); font-family: var(--display); font-size: .82rem; cursor: pointer; box-shadow: 0 0 18px #e8c66f40; max-width: 22rem; text-align: left; }
.venue img { height: 3.2rem; border-radius: 4px; box-shadow: 0 2px 6px #000; }
.venue span { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; }
.venue small { font-family: inherit; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: #e8c66fbb; }
.venue.empty { border-style: dashed; border-color: #e8c66f55; background: transparent; color: #e8c66f77; padding: 6px 12px; font-size: .7rem; box-shadow: none; cursor: default; }
.venuerow { display: flex; justify-content: center; padding: 4px 0; }
.deckpile { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 3.3rem; flex: none; }
.deckpile img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 4px; box-shadow: 0 2px 6px #000a; }
.deckpile b { position: relative; z-index: 2; font-family: var(--display); color: #fff; font-size: .8rem; background: #000b; border-radius: 999px; padding: 0 6px; }
.deckpile.empty { border: 1px dashed #ffffff33; border-radius: 4px; }
@media (max-height: 520px) {
  .venue img { height: 2.3rem; } .venue { font-size: .7rem; } .deckpile { width: 1.8rem; height: 2.5rem; }
}
.venuerow { flex: none !important; min-height: 0 !important; height: auto !important; }
.venuerow .venue { height: auto; flex: none; }
.layout > .board { grid-template-rows: auto 1fr auto 1fr auto; }
