/* mtproxprint: Spieltisch-Filz, Thermopapier, ein Messing-Akzent für "Drucken". */
:root {
  --felt: #12302a;
  --felt-2: #19403a;
  --felt-3: #22524a;
  --line: #2f6157;
  --ink: #eaf2ee;
  --muted: #a3bdb4;
  --brass: #d6b25a;
  --brass-ink: #241a04;
  --paper: #fbfbf7;
  --slot: #0b1f1b;
  --ok: #7fd3a1;
  --warn: #f0c060;
  --bad: #f08b7d;
  --radius-s: 8px;
  --radius-l: 16px;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--felt);
  /* feines Filzkorn */
  background-image: radial-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 3px 3px;
  color: var(--ink);
  font: 17px/1.45 var(--font);
}
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; margin: 28px 0 10px; }
p { margin: 0 0 10px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
.tiny { font-size: .82rem; color: var(--muted); margin-top: 18px; }
main { max-width: 760px; margin: 0 auto; padding: 0 16px calc(32px + var(--safe-b)); }

/* Kopfzeile mit Druckerstatus */
.statusbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(18, 48, 42, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--felt-3);
}
.wordmark-small { font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--felt-2); border: 1px solid var(--line);
  text-decoration: none; font-size: .88rem; min-height: 36px;
  max-width: calc(100vw - 150px);
}
.pill-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.pill[data-state="bereit"] .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(127,211,161,.18); }
.pill[data-state="problem"] .dot { background: var(--warn); }
.pill[data-state="offline"] .dot { background: var(--bad); }

/* Knöpfe */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--felt-2);
  text-decoration: none; cursor: pointer; font-weight: 700;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); }
.btn-primary:active { transform: translateY(1px); }
.btn-quiet { background: transparent; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Anmeldung */
.login { max-width: 380px; margin: 14vh auto 0; }
.wordmark {
  font-size: 2.6rem; letter-spacing: -.02em; margin-bottom: 14px;
}
.login-form { display: grid; gap: 10px; margin-top: 24px; }
.login-form label { font-weight: 700; }
input[type="password"], input[type="search"], select {
  width: 100%; min-height: 52px; padding: 0 14px;
  border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--felt-2);
}
input::placeholder { color: var(--muted); }

/* Startseite */
.home { padding-top: 16px; }
.search { display: flex; gap: 10px; }
.search input { flex: 1; font-size: 1.05rem; }
.mic {
  flex: none; width: 56px; height: 52px; border-radius: var(--radius-s);
  border: 0; background: var(--brass); cursor: pointer;
  display: grid; place-items: center;
}
.mic svg { width: 26px; height: 26px; fill: none; stroke: var(--brass-ink); stroke-width: 2.2; stroke-linecap: round; }
.mic svg rect { fill: var(--brass-ink); stroke: none; }
.hint { color: var(--muted); font-size: .9rem; margin: 10px 2px 0; }
.search-bar { display: flex; gap: 10px; margin-top: 12px; align-items: stretch; }
.seg-mode { flex: 1; }
.stepper-small { flex: none; }
.stepper-small button { width: 40px; height: 46px; }
.stepper-small .count { min-width: 34px; }
.quick-tokens { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.quick-tokens[hidden] { display: none; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--felt-2); font-weight: 700; font-size: .92rem;
}
.chip:active { background: var(--felt-3); }
.own-card {
  display: flex; gap: 14px; align-items: center; margin-top: 22px; padding: 14px 16px;
  border-radius: var(--radius-l); border: 1px solid var(--brass); background: var(--felt-2);
  text-decoration: none; line-height: 1.35;
}
.own-card .muted { font-size: .88rem; }
.own-icon { flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--brass); display: grid; place-items: center; }
.own-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--brass-ink); stroke-width: 1.8; stroke-linejoin: round; }
.results {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 18px;
}
@media (min-width: 560px) { .results { grid-template-columns: repeat(3, 1fr); } }
.results > p, .results .wide { grid-column: 1 / -1; }
.tile { display: grid; gap: 6px; }
.tile-card { display: block; border-radius: 4.5% / 3.2%; overflow: hidden; background: var(--felt-2); aspect-ratio: 63 / 88; }
.tile-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-noimg { display: grid; place-items: center; height: 100%; padding: 8px; text-align: center; }
.tile-row { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.tile-name { flex: 1; font-size: .88rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-print {
  flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--brass); background: transparent; color: var(--brass);
  font-weight: 700; font-size: .85rem; cursor: pointer;
}
.home-extra { margin-top: 10px; }
.home-extra[hidden] { display: none; }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recent-item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  min-height: 56px; padding: 6px 12px 6px 6px; border-radius: var(--radius-s);
  border: 1px solid var(--felt-3); background: var(--felt-2); cursor: pointer;
}
.recent-item img, .thumb-blank { width: 34px; height: 47px; border-radius: 3px; object-fit: cover; flex: none; background: var(--felt-3); }
.recent-title { flex: 1; }
.recent-item em { font-style: normal; font-size: .8rem; color: var(--muted); margin-left: 4px; }
.again { color: var(--brass); font-weight: 700; font-size: .88rem; }
.quick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* Kartenansicht */
.card-view { padding-top: 14px; }
.card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.card-head p { margin: 2px 0 0; font-size: .88rem; }
.back {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  font-size: 2rem; line-height: 1; text-decoration: none; border-radius: 50%;
  background: var(--felt-2); border: 1px solid var(--line); cursor: pointer; padding-bottom: 4px;
}

/* Das Etikett kommt aus dem Druckerschlitz: das eine auffällige Element der Seite. */
.printer-out { position: relative; display: grid; justify-items: center; padding-top: 4px; }
.slot {
  width: min(calc(330px * var(--paper-ratio, 1)), 98%); height: 18px; border-radius: 9px;
  background: var(--slot);
  box-shadow: inset 0 3px 6px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.06);
}
.label {
  /* Papierstreifen: beim M04AS 80 mm breit, die Karte (63 mm) sitzt mittig */
  width: min(calc(290px * var(--paper-ratio, 1)), var(--paper-w, 74%));
  margin-top: -9px;
  padding: 3.2% var(--paper-side, 2.3%) 3.2%;
  background: var(--paper);
  border-radius: 2px 2px 3px 3px;
  box-shadow: 0 14px 30px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.25);
  clip-path: inset(9px 0 -40px 0);
  animation: feed .7s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes feed { from { transform: translateY(-30%); clip-path: inset(30% 0 -40px 0); } }
.preview { width: 100%; height: auto; display: block; aspect-ratio: 694 / 969; transition: opacity .2s; }
.preview.busy { opacity: .45; }
.label-note { font-size: .82rem; color: var(--muted); margin-top: 12px; text-align: center; }

.controls { display: grid; gap: 14px; margin-top: 18px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg[hidden] { display: none; }
.seg button {
  flex: 1; min-height: 46px; border: 0; background: transparent; cursor: pointer; font-weight: 700;
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button[hidden] { display: none; }
.seg button[aria-pressed="true"] { background: var(--felt-3); box-shadow: inset 0 -3px 0 var(--brass); }
.field { display: grid; gap: 6px; }
.field > span { font-size: .88rem; color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--brass); min-height: 32px; }
.edited-note { display: flex; gap: 10px; align-items: center; font-size: .9rem; }
.edited-note[hidden] { display: none; }

.actionbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 10px; align-items: center;
  margin: 20px -16px 0; padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(18, 48, 42, .95); backdrop-filter: blur(8px);
  border-top: 1px solid var(--felt-3);
}
.actionbar .btn-primary { flex: 1; font-size: 1.05rem; min-height: 54px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-s); }
.stepper button { width: 44px; height: 52px; border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; }
.copies { min-width: 22px; text-align: center; font-weight: 700; }

/* Editor */
body.editing main { max-width: none; padding: 0; }
body.editing .statusbar { display: none; }
.editor-view { display: grid; grid-template-rows: auto 1fr; height: 100dvh; }
.editor-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  border-bottom: 1px solid var(--felt-3);
}
.editor-head h1 { flex: 1; font-size: 1rem; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor { display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.ed-stage { position: relative; overflow: hidden; touch-action: none; background: var(--slot); }
.ed-paper { position: absolute; left: 0; top: 0; width: 694px; height: 969px; transform-origin: 0 0; background: var(--paper); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.ed-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ed-tools {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  padding: 10px 12px calc(10px + var(--safe-b));
  border-top: 1px solid var(--felt-3); background: var(--felt);
}
.ed-group { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; }
.ed-tool, .ed-act, .ed-size {
  min-width: 48px; height: 48px; border: 0; border-radius: 9px; background: transparent; cursor: pointer;
  display: grid; place-items: center; padding: 2px 6px;
}
.ed-tool { grid-template-rows: 24px auto; gap: 1px; font-size: .68rem; }
.ed-tool svg, .ed-act svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ed-white svg { stroke: var(--paper); fill: var(--paper); fill-opacity: .25; }
.ed-tool[aria-pressed="true"], .ed-size[aria-pressed="true"] { background: var(--felt-3); box-shadow: inset 0 -3px 0 var(--brass); }
.ed-act:disabled { opacity: .35; }
.ed-size i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); }

/* Untere Leiste für die Spracheingabe */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30; background: rgba(4, 14, 12, .6);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: min(560px, 100%); background: var(--felt-2); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius-l) var(--radius-l) 0 0; padding: 20px 16px calc(16px + var(--safe-b));
  animation: rise .22s ease-out both;
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.sheet-listen { display: flex; align-items: center; gap: 14px; min-height: 48px; }
.heard { font-size: 1.25rem; font-weight: 700; margin: 0; }
.pulse { width: 18px; height: 18px; border-radius: 50%; background: var(--brass); animation: pulse 1.1s ease-in-out infinite; flex: none; }
.pulse[hidden] { display: none; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: .5; } }
.sheet-body { margin-top: 12px; }
.voice-result { display: flex; gap: 14px; align-items: flex-start; }
.voice-preview { width: 110px; height: auto; aspect-ratio: 694 / 969; background: var(--paper); padding: 4px; border-radius: 3px; flex: none; }
.voice-what { font-size: 1.15rem; font-weight: 700; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--brass); }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; flex-wrap: wrap; }
.sheet-actions .btn-primary { flex: 1; min-width: 150px; }
.btn-count { position: relative; overflow: hidden; }
.countbar { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--brass-ink); opacity: .5; }
.btn-count.counting .countbar { animation: count 1.8s linear forwards; }
@keyframes count { to { width: 100%; } }

/* Drucker-Seite */
.panel { padding-top: 14px; }
.state-line { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.state-line::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); }
.state-line[data-state="bereit"]::before { background: var(--ok); }
.state-line[data-state="problem"]::before { background: var(--warn); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.printer-actions { display: flex; gap: 10px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hist { display: flex; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--felt-3); border-radius: var(--radius-s); background: var(--felt-2); }
.hist img { width: 34px; height: 47px; border-radius: 3px; object-fit: cover; }
.hist div { flex: 1; display: grid; }
.hist .muted { font-size: .85rem; }
.hist[data-status="fehler"] .muted { color: var(--bad); }

/* Meldungen */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(92px + var(--safe-b)); z-index: 40; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 520px; padding: 12px 16px; border-radius: var(--radius-s);
  background: var(--paper); color: #16231f; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.35);
  transition: opacity .3s, transform .3s;
}
body.editing .toasts { bottom: calc(150px + var(--safe-b)); }
.toast-ok { border-left: 6px solid #2f9a5f; }
.toast-error { border-left: 6px solid #c2463a; }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  /* Der Countdown bleibt als statischer Balken sichtbar */
  .btn-count.counting .countbar { width: 100%; }
}

/* Eigene Karte */
.own-view { padding-top: 14px; }
.own-preview { cursor: grab; }
.photo-buttons { display: flex; gap: 10px; margin-top: 16px; }
.photo-buttons .btn { flex: 1; }
.zoom-field { margin-top: 14px; }
.zoom-field[hidden], .stats-pt[hidden], .stats-loyalty[hidden] { display: none; }
.own-form { display: grid; gap: 14px; margin-top: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field small { color: var(--muted); font-size: .8rem; }
.own-form input[type="text"], .own-form select, .own-form textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--felt-2);
}
.own-form textarea { resize: vertical; line-height: 1.4; }

/* ---------- Würfel ---------- */
.dice-view { padding-top: 14px; }
.dice-kinds { margin-top: 4px; }
.dice-count { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.dice-count .chip { min-width: 46px; }
.chip[aria-pressed="true"] { background: var(--felt-3); border-color: var(--brass); box-shadow: inset 0 -3px 0 var(--brass); }
.tray {
  position: relative; margin-top: 16px; min-height: 250px; border-radius: 22px; overflow: hidden; cursor: pointer;
  border: 6px solid #5a3f22; box-shadow: inset 0 0 0 2px #7a5a33, inset 0 18px 40px rgba(0,0,0,.45), 0 10px 24px rgba(0,0,0,.35);
  background: radial-gradient(120% 90% at 50% 40%, #1d4a40 0%, #10302a 70%, #0a221d 100%);
}
.tray-felt { position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px); background-size: 3px 3px; pointer-events: none; }
.tray-dice { position: relative; display: flex; flex-wrap: wrap; gap: 14px 18px; justify-content: center; align-items: flex-end; padding: 18px 12px 26px; min-height: 250px; }
.dice-result { display: flex; align-items: baseline; justify-content: center; gap: 12px; margin: 14px 0 10px; min-height: 76px; }
.total { font-family: "Crimson Pro", Georgia, serif; font-weight: 700; font-size: 4.2rem; line-height: 1; color: var(--paper); }
.total.pop { animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.total.crit { color: var(--brass); text-shadow: 0 0 24px rgba(214,178,90,.7); }
.total.fumble { color: var(--bad); }
.detail { color: var(--muted); font-size: 1rem; }
@keyframes pop { from { transform: scale(.6); opacity: .3; } }
.roll-btn { width: 100%; min-height: 58px; font-size: 1.15rem; }
.dice-options { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.dice-history { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dice-history li { padding: 4px 10px; border-radius: 999px; background: var(--felt-2); color: var(--muted); font-size: .85rem; }
.dice-history li:first-child { color: var(--ink); border: 1px solid var(--line); }

/* 3D-Würfel */
.die-scene { --s: 96px; position: relative; width: var(--s); height: calc(var(--s) * 1.35); perspective: 700px; display: grid; place-items: end center; }
.die-toss { width: var(--s); height: var(--s); transform-style: preserve-3d; position: relative; z-index: 1; }
.die { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.face { position: absolute; inset: 0; border-radius: 17%; backface-visibility: hidden; display: grid; place-items: center; }
.f1 { transform: translateZ(calc(var(--s) / 2)); }
.f2 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.f3 { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.f4 { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.f5 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.f6 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.die-shadow { position: absolute; bottom: -6px; width: calc(var(--s) * .9); height: calc(var(--s) * .22); border-radius: 50%; background: radial-gradient(rgba(0,0,0,.55), transparent 70%); opacity: .55; }
.skin-bone .face {
  background: radial-gradient(circle at 30% 25%, #fffaf0 0%, #f1e8d4 55%, #d9ccb0 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), inset -6px -8px 14px rgba(120,95,60,.28), inset 5px 6px 10px rgba(255,255,255,.7);
}
.pips { width: 72%; height: 72%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: center; }
.pips i { width: 64%; aspect-ratio: 1; border-radius: 50%; }
.pips i.on { background: radial-gradient(circle at 35% 30%, #4a3a2a, #120d08 70%); box-shadow: inset 0 2px 2px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.6); }
.die-scene.landed .die-shadow { animation: thud .35s ease-out; }
@keyframes thud { 50% { transform: scale(1.15); opacity: .7; } }

/* W20 */
.d20 { position: relative; width: 190px; height: 190px; margin: 10px auto 18px; filter: drop-shadow(0 14px 14px rgba(0,0,0,.45)); }
.d20 svg { width: 100%; height: 100%; display: block; }
.d20-face { fill: rgba(255,255,255,.07); stroke: var(--brass); stroke-width: 2.5; stroke-linejoin: round; }
.d20-edges line { stroke: rgba(214,178,90,.55); stroke-width: 2; }
.d20-body { stroke: #0a1f1b; stroke-width: 3; stroke-linejoin: round; }
.d20-num { position: absolute; left: 0; right: 0; top: 47%; text-align: center; font-family: "Crimson Pro", Georgia, serif; font-weight: 700; font-size: 46px; line-height: 1; color: var(--brass); }
.d20.crit { filter: drop-shadow(0 0 22px rgba(214,178,90,.9)); animation: glow 1.2s ease-in-out 2; }
.d20.fumble .d20-num { color: var(--bad); }
@keyframes glow { 50% { transform: scale(1.06); } }

/* Münze */
.coin-scene { position: relative; width: 150px; height: 230px; perspective: 800px; display: grid; place-items: end center; margin: 0 auto; --s: 130px; }
.coin-toss { width: 130px; height: 130px; transform-style: preserve-3d; z-index: 1; }
.coin { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; }
.coin-face { position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #f6dc8f, #c99a3a 60%, #8a6420); box-shadow: inset 0 0 0 6px rgba(120,85,25,.6), inset 0 0 0 9px rgba(255,235,170,.4); }
.coin-face span { font-family: "Crimson Pro", Georgia, serif; font-weight: 700; font-size: 1.6rem; color: #4a3209; text-shadow: 0 1px 0 rgba(255,240,190,.6); }
.coin-face.tails { transform: rotateX(180deg); }

/* ---------- Startseite: Planechase und Würfel ---------- */
.fun-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.fun-tile {
  position: relative; display: grid; gap: 2px; padding: 14px; min-height: 120px; align-content: end;
  border-radius: var(--radius-l); border: 1px solid var(--line); background: var(--felt-2); text-decoration: none; overflow: hidden;
}
.fun-tile .muted { font-size: .82rem; }
.fun-art { position: absolute; top: 12px; right: 12px; width: 52px; height: 52px; }
.tile-planechase .fun-art i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent;
  border-top-color: #7fd3c3; border-right-color: rgba(214,178,90,.8); animation: spin 3.5s linear infinite; }
.tile-planechase .fun-art i + i { inset: 9px; animation-duration: 2.2s; animation-direction: reverse; border-top-color: var(--brass); border-right-color: rgba(127,211,195,.6); }
.tile-dice .fun-art { border-radius: 12px; display: grid; place-items: center; transform: rotate(-12deg);
  background: radial-gradient(circle at 30% 25%, #fffaf0, #e3d7bd); box-shadow: inset -4px -5px 8px rgba(120,95,60,.3), 0 6px 12px rgba(0,0,0,.3); }
.tile-dice .pips { width: 70%; height: 70%; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Planechase ---------- */
body.planechase {
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 72% 12%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1.5px 1.5px at 85% 64%, rgba(127,211,195,.5), transparent 60%),
    radial-gradient(1px 1px at 28% 82%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1px 1px at 48% 46%, rgba(214,178,90,.45), transparent 60%),
    radial-gradient(120% 80% at 50% 30%, #143a33 0%, #0a1f1b 60%, #050f0d 100%);
  background-attachment: fixed;
}
.pc-view { padding-top: 10px; }
.pc-loading { padding: 40px 0; text-align: center; }

.pc-start { position: relative; min-height: 78dvh; display: grid; justify-items: center; align-content: center; gap: 14px; text-align: center; padding: 20px 0; }
.pc-start .back { position: absolute; top: 4px; left: 0; }
.pc-title { font-family: "Crimson Pro", Georgia, serif; font-weight: 700; font-size: 3.4rem; letter-spacing: .02em; position: relative; text-shadow: 0 0 30px rgba(127,211,195,.35); }
.pc-sub { max-width: 34ch; color: var(--muted); position: relative; }
.pc-check { position: relative; }
.pc-go { position: relative; min-width: 240px; min-height: 58px; font-size: 1.15rem; }

/* Portal: drei sich drehende Ringe */
.pc-portal { position: absolute; left: 50%; top: 50%; width: 120%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(.3); opacity: 0; pointer-events: none; transition: opacity .35s, transform .7s cubic-bezier(.2,.8,.3,1); }
.pc-portal i { position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 8%, rgba(127,211,195,.55) 14%, transparent 24%, rgba(214,178,90,.5) 40%, transparent 52%, rgba(127,211,195,.4) 66%, transparent 78%, rgba(214,178,90,.45) 90%, transparent);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 40%, #000 62%, transparent 70%);
          mask: radial-gradient(circle, transparent 38%, #000 40%, #000 62%, transparent 70%);
  filter: blur(2px); animation: spin 6s linear infinite; }
.pc-portal i:nth-child(2) { inset: 12%; animation-duration: 3.6s; animation-direction: reverse; opacity: .8; }
.pc-portal i:nth-child(3) { inset: 26%; animation-duration: 2.2s; opacity: .7;
  background: radial-gradient(circle, rgba(214,178,90,.35), rgba(127,211,195,.15) 40%, transparent 65%); -webkit-mask: none; mask: none; filter: blur(6px); }
.pc-portal.idle { width: min(90vw, 460px); top: 40%; opacity: .9; transform: translate(-50%, -50%) scale(1); }
.pc-portal.open { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }

.pc-game { display: grid; gap: 14px; }
.pc-head { position: relative; display: flex; align-items: center; gap: 12px; }
.pc-count { flex: 1; font-size: 1.05rem; }
.pc-count strong { font-family: "Crimson Pro", Georgia, serif; font-size: 1.6rem; }
.pc-menu-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--felt-2); font-size: 1.4rem; cursor: pointer; }
.pc-menu { position: absolute; right: 0; top: 52px; z-index: 20; display: grid; min-width: 220px; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--line); background: var(--felt-2); box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.pc-menu button { text-align: left; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--felt-3); background: transparent; cursor: pointer; font-weight: 700; }
.pc-menu button:last-child { border-bottom: 0; color: var(--bad); }

.pc-stage { position: relative; width: 100%; aspect-ratio: 88 / 63; perspective: 900px; }
.plane-card { position: absolute; inset: 0; border-radius: 4.5% / 6.3%; overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px rgba(214,178,90,.35), 0 0 36px rgba(127,211,195,.25), 0 18px 40px rgba(0,0,0,.5); }
.plane-card.phenomenon { box-shadow: 0 0 0 2px var(--brass), 0 0 44px rgba(214,178,90,.45), 0 18px 40px rgba(0,0,0,.5); }
.plane-img-wrap { position: absolute; inset: 0; }
.plane-img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.plane-img.rot { position: absolute; left: 50%; top: 50%; width: 71.59%; height: 139.68%; transform: translate(-50%, -50%) rotate(var(--rot, 90deg)); object-fit: cover; }
.plane-missing { display: grid; place-items: center; height: 100%; font-family: "Crimson Pro", Georgia, serif; font-size: 1.6rem; }
.plane-glare { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.12) 47%, transparent 58%); background-size: 260% 100%; animation: glare 7s ease-in-out infinite; mix-blend-mode: screen; }
@keyframes glare { 0%, 60% { background-position: 130% 0; } 100% { background-position: -130% 0; } }
.pc-stage.flash::after { content: ""; position: absolute; inset: -10%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.75), rgba(127,211,195,.35) 30%, transparent 65%); animation: flash .6s ease-out forwards; }
@keyframes flash { from { opacity: 1; transform: scale(.4); } to { opacity: 0; transform: scale(1.3); } }

.pc-die { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; background: radial-gradient(circle, rgba(5,15,13,.55), transparent 70%); }
.skin-planar .face { color: var(--brass);
  background: radial-gradient(circle at 30% 25%, #3a4148 0%, #1e2328 55%, #0f1215 100%);
  box-shadow: inset 0 0 0 2px rgba(214,178,90,.35), inset -6px -8px 14px rgba(0,0,0,.5), inset 5px 6px 10px rgba(255,255,255,.08); }
.skin-planar .face svg { width: 66%; height: 66%; filter: drop-shadow(0 0 6px rgba(214,178,90,.55)); }
.blank-mark { width: 40%; height: 40%; border-radius: 50%; border: 2px solid rgba(214,178,90,.18); }
.pc-roll-label { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); z-index: 6; padding: 8px 18px; border-radius: 999px;
  font-family: "Crimson Pro", Georgia, serif; font-weight: 700; font-size: 1.5rem; background: rgba(5,15,13,.85); border: 1px solid var(--line); white-space: nowrap; }
.pc-roll-label.is-walk { color: #9fe6d8; border-color: #7fd3c3; box-shadow: 0 0 24px rgba(127,211,195,.5); }
.pc-roll-label.is-chaos { color: var(--brass); border-color: var(--brass); box-shadow: 0 0 24px rgba(214,178,90,.55); }
.pc-roll-label.is-blank { color: var(--muted); }
.pc-sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 6; pointer-events: none; }
.pc-sparks i { position: absolute; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 10px var(--brass);
  animation: spark .9s cubic-bezier(.1,.7,.3,1) forwards; }
@keyframes spark { from { transform: translate(0,0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }

.pc-info { display: grid; gap: 4px; }
.pc-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pc-name { font-family: "Crimson Pro", Georgia, serif; font-size: 1.9rem; }
.pc-badge { padding: 2px 10px; border-radius: 999px; background: var(--brass); color: var(--brass-ink); font-weight: 700; font-size: .85rem; }
.pc-type { margin: 0; font-size: .92rem; }
.pc-text { margin-top: 6px; padding: 12px 14px; border-radius: var(--radius-s); background: rgba(5,15,13,.45); border: 1px solid var(--felt-3); line-height: 1.5; }
.pc-text p { margin: 0 0 8px; }
.pc-text p:last-child { margin-bottom: 0; }
.chaos-line { padding-left: 10px; border-left: 3px solid rgba(214,178,90,.5); }
.chaos-line.active { animation: chaosline 2.4s ease-out; }
@keyframes chaosline { 0% { background: rgba(214,178,90,.45); box-shadow: 0 0 22px rgba(214,178,90,.5); } 100% { background: transparent; box-shadow: none; } }
.chaos-inline { color: var(--brass); font-weight: 700; }

.pc-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.pc-actions .btn { min-height: 60px; font-size: 1.1rem; }
.pc-roll { flex-direction: column; gap: 0; line-height: 1.1; }
.pc-roll small { font-weight: 400; font-size: .78rem; color: var(--muted); }
.pc-walk { box-shadow: 0 0 24px rgba(214,178,90,.35); }
.pc-sub-actions { display: flex; justify-content: space-between; }
.pc-sub-actions .link-btn:disabled { opacity: .4; }
.pc-trail { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; }
.trail-item { padding: 3px 10px; border-radius: 999px; background: var(--felt-2); color: var(--muted); }

@media (orientation: landscape) and (min-width: 700px) {
  body.planechase main { max-width: 1200px; }
  .pc-game { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); grid-template-areas: "head head" "stage info" "stage actions" "stage sub" "stage ." "trail trail"; grid-template-rows: auto auto auto auto 1fr auto; align-items: start; column-gap: 22px; }
  .pc-head { grid-area: head; } .pc-stage { grid-area: stage; } .pc-info { grid-area: info; }
  .pc-actions { grid-area: actions; } .pc-sub-actions { grid-area: sub; } .pc-trail { grid-area: trail; }
  .pc-stage { width: min(100%, calc((100dvh - 150px) * 88 / 63)); justify-self: center; }
  .pc-name { font-size: 1.5rem; }
  .pc-text { max-height: calc(100dvh - 330px); min-height: 90px; overflow: auto; }
}
@media (orientation: landscape) and (max-height: 500px) {
  body.planechase .statusbar { display: none; }
  .pc-game { padding-top: 4px; }
  .pc-stage { width: min(100%, calc((100dvh - 80px) * 88 / 63)); }
  .pc-text { max-height: calc(100dvh - 270px); }
  .pc-actions .btn { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .pc-portal i, .fun-art i, .plane-glare { animation: none; }
}
