/* ==========================================================================
   Manipoliri – Gestaltung
   Pastell-Neon mit hellem und dunklem Modus (html[data-theme="light|dark"]).
   ========================================================================== */

/* --- Farbwerte: hell ----------------------------------------------------- */
:root {
  color-scheme: light;
  --bg-1: #f6f3fd;
  --bg-2: #e8e2f8;
  --surface: #ffffff;
  --surface-2: #f7f5fd;
  --surface-3: #eeeaf9;
  --line: #e3ddf2;
  --ink: #26233d;
  --muted: #7a7696;
  --accent: #ff9cbf;
  --accent-hover: #ff86b0;
  --on-accent: #3d0f24;
  --accent-2: #c3b4ff;
  --accent-2-hover: #b3a1ff;
  --on-accent-2: #22184a;
  --mint: #8fe6c0;
  --peach: #ffc49b;
  --sky: #a9dcff;
  --butter: #ffe28f;
  --danger-bg: #ffe6ee;
  --danger-ink: #a8244c;
  --toast-bg: #26233d;
  --toast-ink: #ffffff;
  --overlay: rgba(38, 30, 70, .45);
  --shadow: 0 12px 34px rgba(70, 50, 140, .13);
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Brett */
  --board-bg: #ddd6f3;
  --board-glow: 0 24px 60px rgba(90, 70, 170, .22);
  --tile: #ffffff;
  --tile-hover: #fbfaff;
  --tile-ink: #26233d;
  --tile-muted: #8a86a8;
  --tile-mortgaged: #efecf7;
  --center-bg:
    radial-gradient(circle at 25% 20%, rgba(255, 156, 191, .28), transparent 50%),
    radial-gradient(circle at 80% 85%, rgba(143, 230, 192, .3), transparent 50%),
    radial-gradient(circle at 75% 25%, rgba(195, 180, 255, .3), transparent 45%),
    #fdfcff;
  --center-ink: #26233d;
  --center-muted: #7a7696;
  --dot: rgba(38, 35, 61, .07);
  --logo-ink: #26233d;
  --logo-glow: 0 .4cqi 2cqi rgba(195, 180, 255, .55);
}

/* --- Farbwerte: dunkel --------------------------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-1: #1a1532;
  --bg-2: #08070f;
  --surface: #17162b;
  --surface-2: #1f1d38;
  --surface-3: #2a2850;
  --line: #312e58;
  --ink: #efedff;
  --muted: #a19dca;
  --accent: #ff9ec4;
  --accent-hover: #ffb6d3;
  --on-accent: #2a0716;
  --accent-2: #b9a7ff;
  --accent-2-hover: #cbbdff;
  --on-accent-2: #1a1238;
  --danger-bg: #3a1528;
  --danger-ink: #ffb3cd;
  --toast-bg: #efedff;
  --toast-ink: #17162b;
  --overlay: rgba(4, 3, 12, .65);
  --shadow: 0 14px 40px rgba(0, 0, 0, .45);

  --board-bg: #06060d;
  --board-glow: 0 24px 60px rgba(0, 0, 0, .5);
  --tile: #15142a;
  --tile-hover: #1d1b38;
  --tile-ink: #ebe9ff;
  --tile-muted: #8f8bba;
  --tile-mortgaged: #0e0d1d;
  --center-bg:
    radial-gradient(circle at 28% 22%, rgba(255, 158, 196, .2), transparent 55%),
    radial-gradient(circle at 78% 82%, rgba(143, 240, 208, .16), transparent 55%),
    radial-gradient(circle at 80% 22%, rgba(185, 167, 255, .16), transparent 45%),
    #0b0a16;
  --center-ink: #ffffff;
  --center-muted: #a19dca;
  --dot: rgba(255, 255, 255, .06);
  --logo-ink: #ffffff;
  --logo-glow: 0 0 .5cqi #fff, 0 0 2cqi #ff9ec4, 0 0 4.5cqi rgba(185, 167, 255, .9);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(ellipse at top, var(--bg-1) 0%, var(--bg-2) 100%) fixed;
  background-color: var(--bg-2);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

/* --- Kopfzeile ----------------------------------------------------------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; color: var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 900; letter-spacing: -.03em; }
.brand-icon { width: 28px; height: 28px; color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-room { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .12em; }
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: var(--shadow);
}
.theme-toggle svg { width: 20px; height: 20px; display: block; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* --- Karten / Ansichten -------------------------------------------------- */
#app { padding: 8px 16px 40px; }
.card {
  max-width: 460px; margin: 16px auto; background: var(--surface);
  border-radius: 20px; padding: 26px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card h1 { font-size: 1.75rem; font-weight: 850; letter-spacing: -.03em; margin: 0 0 6px; }
.card h2 { font-size: 1rem; font-weight: 750; margin: 22px 0 10px; }
.lead { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* --- Formulare ----------------------------------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: .85rem; font-weight: 650; margin-bottom: 6px; }
.field input, .num, .select {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px; color: var(--ink);
  border: 2px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.num, .select { font-size: 1rem; padding: 9px 10px; border-radius: 10px; min-width: 0; width: auto; }
.field input:focus, .num:focus, .select:focus { outline: none; border-color: var(--accent-2); }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-variant-numeric: tabular-nums; text-align: center; }
.share-input { width: 100%; }

.btn {
  font: inherit; font-weight: 700; font-size: 1rem; border: 0; border-radius: 12px; color: var(--ink);
  padding: 12px 18px; cursor: pointer; transition: transform .05s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { display: block; width: 100%; margin-top: 8px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--accent-2); color: var(--on-accent-2); }
.btn-secondary:hover:not(:disabled) { background: var(--accent-2-hover); }
.btn-ghost { background: transparent; border: 2px solid var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-sm { font-size: .85rem; padding: 7px 11px; border-radius: 9px; }
.btn-roll { font-size: 1.1rem; padding: 13px 22px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; }
.link-danger { color: var(--muted); font-size: .85rem; display: block; margin: 8px auto 0; }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.error { color: var(--danger-ink); background: var(--danger-bg); padding: 10px 12px; border-radius: 10px; margin: 14px 0 0; }

/* --- Warteraum ----------------------------------------------------------- */
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-3); border-radius: 14px; padding: 14px 16px; }
.room-code { font-size: 2rem; font-weight: 900; letter-spacing: .16em; }
.player-list { list-style: none; padding: 0; margin: 0; }
.player-list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 6px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.player-list li.is-away { opacity: .6; }
.player-list li.empty { border-style: dashed; background: transparent; color: var(--muted); justify-content: center; }
.token { width: 22px; height: 22px; border-radius: 50%; flex: none; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.player-name { flex: 1; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { font-size: .72rem; font-weight: 750; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge-host { background: var(--butter); color: #3d2e00; }
.badge-you { background: var(--accent-2); color: var(--on-accent-2); }
.badge-turn { background: var(--mint); color: #0d3d2a; }
.badge-jail { background: var(--peach); color: #4a2100; }
.badge-card { background: var(--sky); color: #0d2e4a; }
.badge-away, .badge-out { background: var(--surface-3); color: var(--muted); }

/* --- Toast --------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--toast-bg); color: var(--toast-ink); padding: 10px 16px; border-radius: 12px;
  box-shadow: var(--shadow); font-size: .95rem; font-weight: 600; max-width: calc(100% - 32px);
}
.toast-error { background: var(--danger-bg); color: var(--danger-ink); border: 1px solid var(--danger-ink); }
body.busy .turn-actions .btn, body.busy .modal .btn { cursor: progress; }

/* ==========================================================================
   Spielansicht
   ========================================================================== */
body.in-game #app { padding: 0 12px 24px; }
.game {
  display: grid; gap: 20px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 360px; max-width: 1400px; margin: 0 auto;
}
.board-wrap { display: flex; justify-content: center; position: sticky; top: 8px; }

/* --- Brett --------------------------------------------------------------- */
.board {
  --gap: .28cqi;
  --r: .9cqi;
  position: relative; width: min(100%, calc(100dvh - 76px)); aspect-ratio: 1;
  display: grid; container-type: inline-size; gap: var(--gap); padding: var(--gap);
  grid-template-columns: 1.42fr repeat(9, 1fr) 1.42fr;
  grid-template-rows: 1.42fr repeat(9, 1fr) 1.42fr;
  background: var(--board-bg); border-radius: 2.2cqi; box-shadow: var(--board-glow);
  font-size: 1.15cqi; user-select: none;
}
.cell {
  position: relative; display: flex; background: var(--tile); color: var(--tile-ink); cursor: pointer;
  border-radius: var(--r); overflow: hidden; min-width: 0; min-height: 0; outline: none;
  transition: background .15s, transform .15s;
}
:root[data-theme="dark"] .cell { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); }
.cell:hover { background: var(--tile-hover); transform: translateY(-.15cqi); z-index: 1; }
.cell:focus-visible { box-shadow: 0 0 0 .35cqi var(--accent-2); z-index: 1; }

/* Besitz: Ring in Spielerfarbe plus Punkt in der Ecke */
.cell.owned { box-shadow: 0 0 0 .32cqi var(--owner); z-index: 1; }
:root[data-theme="dark"] .cell.owned { box-shadow: 0 0 0 .3cqi var(--owner), 0 0 1.4cqi -.2cqi var(--owner); }
.cell.owned::before {
  content: ""; position: absolute; width: 1.1cqi; height: 1.1cqi; border-radius: 50%; z-index: 2;
  background: var(--owner); box-shadow: 0 0 0 .2cqi var(--tile);
}
.side-bottom.owned::before { bottom: .6cqi; right: .6cqi; }
.side-top.owned::before { top: .6cqi; right: .6cqi; }
.side-left.owned::before { left: .6cqi; bottom: .6cqi; }
.side-right.owned::before { right: .6cqi; bottom: .6cqi; }
.cell.mortgaged { background: var(--tile-mortgaged); }
.cell.mortgaged::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(-45deg, var(--dot) 0 .35cqi, transparent .35cqi 1.1cqi);
}
.cell.mortgaged .cell-body { opacity: .5; }

.side-bottom { flex-direction: column; }
.side-top { flex-direction: column-reverse; }
.side-left { flex-direction: row-reverse; }
.side-right { flex-direction: row; }

/* Farbgruppe: Leiste in Pastell, im Dunkelmodus leuchtend */
.band {
  flex: 0 0 22%; display: flex; align-items: center; justify-content: center; gap: .3cqi;
  margin: .35cqi; border-radius: .5cqi; background: var(--g);
}
:root[data-theme="dark"] .band { box-shadow: 0 0 1.5cqi -.1cqi var(--g); }
.side-left .band, .side-right .band { flex-direction: column; flex-basis: 15%; }
.bld { display: block; }
.bld.house { width: 1.1cqi; height: 1.1cqi; background: #fff; border-radius: .25cqi; box-shadow: 0 .12cqi .3cqi rgba(30, 20, 60, .35); }
.bld.hotel { width: 2.7cqi; height: 1.3cqi; background: #fff; border-radius: .3cqi; position: relative; box-shadow: 0 .12cqi .3cqi rgba(30, 20, 60, .35); }
.bld.hotel::after { content: ""; position: absolute; inset: .3cqi; border-radius: .15cqi; background: #ff6f9c; }
.side-left .bld.hotel, .side-right .bld.hotel { width: 1.3cqi; height: 2.7cqi; }

.cell-body {
  flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; text-align: center; padding: 5% 2% 6%; gap: 2%;
}
.cell-name { font-weight: 650; line-height: 1.12; font-size: .8em; letter-spacing: -.01em; overflow-wrap: break-word; hyphens: manual; }
.cell-short { display: none; font-weight: 650; line-height: 1.05; overflow-wrap: anywhere; hyphens: manual; }
.cell-price { font-size: .82em; font-weight: 600; color: var(--tile-muted); font-variant-numeric: tabular-nums; }
.cell-icon { display: block; width: 3cqi; height: 3cqi; color: var(--tile-ink); opacity: .8; }
.cell-icon svg, .corner-icon svg, .pile-icon svg, .stock-icon svg, .gc-icon svg, .go-arrow svg { width: 100%; height: 100%; display: block; }
.icon-bulb { color: #ffc84a; opacity: 1; }
.icon-drop { color: #7cc4ff; opacity: 1; }
.chance-mark {
  display: grid; place-items: center; width: 4.2cqi; height: 4.2cqi; border-radius: 50%;
  background: var(--peach); color: #4a2100; font-size: 2.8cqi; font-weight: 900; line-height: 1;
}
.type-community .icon-chest { width: 4.2cqi; height: 4.2cqi; padding: .8cqi; border-radius: 50%; background: var(--sky); color: #0d2e4a; opacity: 1; }
:root[data-theme="dark"] .chance-mark { box-shadow: 0 0 1.4cqi rgba(255, 196, 155, .55); }
:root[data-theme="dark"] .type-community .icon-chest { box-shadow: 0 0 1.4cqi rgba(169, 220, 255, .5); }
.type-chance .cell-body, .type-community .cell-body { justify-content: center; gap: 8%; }

/* --- Ecken: hell = Pastellfläche, dunkel = Neonrahmen --------------------- */
.type-go { --cc: #ff9cbf; --cc-ink: #6b1533; }
.type-jail { --cc: #ffd38a; --cc-ink: #5c3a00; }
.type-parking { --cc: #8fe6c0; --cc-ink: #0d4a33; }
.type-gotojail { --cc: #c3b4ff; --cc-ink: #2e2270; }
.type-go, .type-jail, .type-parking, .type-gotojail { background: var(--cc); color: var(--cc-ink); }
.type-go:hover, .type-jail:hover, .type-parking:hover, .type-gotojail:hover { background: var(--cc); filter: brightness(1.04); }
:root[data-theme="dark"] .type-go, :root[data-theme="dark"] .type-jail,
:root[data-theme="dark"] .type-parking, :root[data-theme="dark"] .type-gotojail {
  background: var(--tile); color: var(--cc);
  box-shadow: inset 0 0 0 .3cqi var(--cc), 0 0 1.8cqi -.2cqi var(--cc);
  text-shadow: 0 0 1cqi var(--cc);
}
.corner-body { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8%; gap: 4%; }
.corner-big { font-size: 4.4cqi; font-weight: 900; letter-spacing: -.03em; line-height: .9; }
.corner-small { font-weight: 700; font-size: .85em; line-height: 1.15; }
.corner-icon { display: block; width: 5cqi; height: 5cqi; }
.go { gap: 2%; padding: 6%; }
.go .corner-big { font-size: 3.8cqi; }
.go .corner-small { white-space: nowrap; font-size: .78em; }
.go .go-arrow { width: 5.5cqi; height: 2cqi; }
/* seitliche Felder sind flacher: Symbole und Namen etwas kleiner */
.side-left .cell-name, .side-right .cell-name { font-size: .76em; }
.side-left .chance-mark, .side-right .chance-mark { width: 3.3cqi; height: 3.3cqi; font-size: 2.2cqi; }
.side-left.type-community .icon-chest, .side-right.type-community .icon-chest { width: 3.3cqi; height: 3.3cqi; padding: .6cqi; }
.side-left .cell-body, .side-right .cell-body { padding: 5% 3%; }
.go-arrow { display: block; width: 7cqi; height: 2.6cqi; transform: rotate(180deg); }
.jail { padding: 0; }
/* Gefängnis: Zelle oben rechts, Schriftzug darunter, „Nur zu Besuch“ links */
.jail-box {
  position: absolute; top: 7%; right: 7%; width: 64%; height: 52%; border-radius: 1cqi;
  background-color: color-mix(in srgb, var(--cc-ink) 10%, transparent);
  background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--cc-ink) 38%, transparent) 0 .22cqi, transparent .22cqi 1.2cqi);
  box-shadow: inset 0 0 0 .22cqi color-mix(in srgb, var(--cc-ink) 55%, transparent);
}
:root[data-theme="dark"] .jail-box {
  background-color: color-mix(in srgb, var(--cc) 7%, transparent);
  background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--cc) 42%, transparent) 0 .22cqi, transparent .22cqi 1.2cqi);
  box-shadow: inset 0 0 0 .22cqi var(--cc);
}
.jail-label {
  position: absolute; top: 64%; right: 7%; width: 64%; text-align: center;
  font-weight: 850; font-size: .7em; line-height: 1; letter-spacing: -.01em;
}
.jail-visit {
  position: absolute; left: 4%; top: 7%; bottom: 7%; display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl; transform: rotate(180deg); font-size: .7em; font-weight: 750; line-height: 1; white-space: nowrap; opacity: .85;
}
.gotojail .corner-small { font-size: .78em; }
.gotojail .corner-icon, .parking .corner-icon { width: 4.2cqi; height: 4.2cqi; }
.pot-badge {
  font-weight: 800; font-size: .9em; padding: .2cqi .8cqi; border-radius: 99px; text-shadow: none;
  background: var(--cc-ink); color: var(--cc);
}
:root[data-theme="dark"] .pot-badge { background: var(--cc); color: #0b0a16; }

/* --- Mitte ----------------------------------------------------------------*/
.center {
  grid-row: 2 / 11; grid-column: 2 / 11; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.2cqi;
  padding: 3cqi; text-align: center; border-radius: 1.4cqi; color: var(--center-ink); background: var(--center-bg);
}
.center::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--dot) .14cqi, transparent .16cqi); background-size: 2.2cqi 2.2cqi;
}
.center > * { position: relative; }
.center-logo { font-weight: 900; font-size: 7cqi; letter-spacing: -.045em; line-height: 1; color: var(--logo-ink); text-shadow: var(--logo-glow); }
.center-logo::after {
  content: ""; display: block; height: .55cqi; width: 40%; margin: 1.4cqi auto 0; border-radius: 99px;
  background: linear-gradient(90deg, #ff9cbf, #ffd38a, #8fe6c0, #a9dcff, #c3b4ff);
}
:root[data-theme="dark"] .center-logo::after { box-shadow: 0 0 1.4cqi rgba(195, 180, 255, .8); }
.center-turn {
  font-weight: 700; font-size: 1.9cqi; padding: .7cqi 2.2cqi .7cqi 1.6cqi; border-radius: 99px;
  display: inline-flex; align-items: center; gap: 1cqi;
  background: color-mix(in srgb, var(--center-ink) 7%, transparent);
  box-shadow: inset 0 0 0 .15cqi color-mix(in srgb, var(--center-ink) 12%, transparent);
}
.center-turn::before { content: ""; width: 1.4cqi; height: 1.4cqi; border-radius: 50%; background: var(--c, #888); box-shadow: 0 0 1cqi var(--c, #888); }
.dice { display: flex; gap: 2cqi; }
.die {
  width: 8.4cqi; height: 8.4cqi; background: linear-gradient(160deg, #ffffff, #eeebf8); border-radius: 1.8cqi; padding: 1.1cqi;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: center;
  box-shadow: 0 1cqi 2.4cqi rgba(40, 25, 90, .25), inset 0 -.4cqi 0 rgba(38, 35, 61, .1);
}
:root[data-theme="dark"] .die { box-shadow: 0 0 2.2cqi rgba(195, 180, 255, .35), inset 0 -.4cqi 0 rgba(38, 35, 61, .12); }
.die i { width: 1.55cqi; height: 1.55cqi; border-radius: 50%; background: transparent; }
.die i.on { background: #26233d; }
.die.rolling { animation: shake .42s ease-in-out; }
@keyframes shake {
  0% { transform: rotate(0) translateY(0); } 25% { transform: rotate(-14deg) translateY(-1cqi); }
  50% { transform: rotate(10deg) translateY(.4cqi); } 75% { transform: rotate(-6deg) translateY(-.4cqi); }
  100% { transform: rotate(0) translateY(0); }
}
.center-roll { font-weight: 600; font-size: 1.7cqi; min-height: 1.2em; color: var(--center-muted); }
.piles { display: flex; gap: 3cqi; }
.pile {
  width: 12.5cqi; height: 8cqi; border-radius: 1.2cqi; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .4cqi; font-weight: 700;
}
.pile small { font-size: 1.35cqi; font-weight: 750; }
.pile-chance { background: var(--peach); color: #4a2100; transform: rotate(-5deg); box-shadow: .6cqi .6cqi 0 color-mix(in srgb, var(--peach) 45%, transparent); }
.pile-chance span { font-size: 3.6cqi; font-weight: 900; line-height: 1; }
.pile-community { background: var(--sky); color: #0d2e4a; transform: rotate(4deg); box-shadow: .6cqi .6cqi 0 color-mix(in srgb, var(--sky) 45%, transparent); }
:root[data-theme="dark"] .pile-chance { background: var(--tile); color: var(--peach); box-shadow: inset 0 0 0 .3cqi var(--peach), 0 0 2cqi rgba(255, 196, 155, .4); }
:root[data-theme="dark"] .pile-community { background: var(--tile); color: var(--sky); box-shadow: inset 0 0 0 .3cqi var(--sky), 0 0 2cqi rgba(169, 220, 255, .4); }
.pile-icon { display: block; width: 3.4cqi; height: 3.4cqi; }
.center-pot {
  display: inline-flex; align-items: baseline; gap: .8cqi; font-size: 1.7cqi; font-weight: 650;
  padding: .7cqi 1.8cqi; border-radius: 99px; background: var(--mint); color: #0d3d2a;
}
.center-pot b { font-size: 2.3cqi; font-weight: 900; }
:root[data-theme="dark"] .center-pot { background: transparent; color: var(--mint); box-shadow: inset 0 0 0 .2cqi var(--mint), 0 0 1.6cqi rgba(143, 230, 192, .35); }
.center-pot.bump { animation: bump .5s ease-out; }
@keyframes bump { 40% { transform: scale(1.12); } }
.bank-stock { display: flex; gap: 1.6cqi; align-items: center; font-size: 1.5cqi; color: var(--center-muted); }
.bank-stock b { color: var(--center-ink); }
.bank-stock > span { display: inline-flex; align-items: center; gap: .4cqi; }
.stock-icon { display: block; width: 2cqi; height: 2cqi; }
.stock-house .stock-icon { color: var(--center-ink); }
.stock-hotel .stock-icon { color: #ff6f9c; }

/* --- Spielfiguren -------------------------------------------------------- */
.token-layer { position: absolute; inset: 0; pointer-events: none; }
.piece {
  position: absolute; left: 0; top: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .65), transparent 50%), var(--c);
  border: .28cqi solid #fff; box-shadow: 0 .5cqi 1cqi rgba(30, 20, 60, .4);
  display: flex; align-items: center; justify-content: center;
  color: #1d1a33; font-weight: 900; font-size: 1.5cqi;
  transition: transform .12s ease-out; z-index: 3;
}
.piece.active { z-index: 4; animation: pulse 1.6s ease-in-out infinite; }
.piece.gone { display: none; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 85%, transparent), 0 .5cqi 1cqi rgba(30, 20, 60, .4); }
  50% { box-shadow: 0 0 0 1cqi transparent, 0 .5cqi 1cqi rgba(30, 20, 60, .4); }
}
@media (prefers-reduced-motion: reduce) {
  .piece.active, .die.rolling, .center-pot.bump { animation: none; }
  .cell:hover { transform: none; }
}

/* Kleine Bretter: Kurznamen */
@container (max-width: 640px) {
  .board { font-size: 2cqi; --gap: .5cqi; }
  .cell-name { display: none; }
  .cell-short { display: block; font-size: 1.05em; letter-spacing: -.02em; }
  .cell-body { padding: 4% 2%; }
  .cell-price, .corner-small { font-size: .78em; }
  .jail-visit { font-size: .62em; }
  .jail-label { font-size: .68em; }
  .cell-icon { width: 3.6cqi; height: 3.6cqi; }
  .type-tax .cell-icon { display: none; }
  .band { margin: .5cqi; }
  .cell.owned::before { width: 1.6cqi; height: 1.6cqi; }
  .go .corner-small { display: none; }
}
@container (max-width: 420px) {
  .cell-price { display: none; }
  .bank-stock .muted { display: none; }
}

/* ==========================================================================
   Seitenleiste
   ========================================================================== */
.sidebar { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.panel h2 { font-size: .95rem; font-weight: 800; margin: 0 0 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.tool-row { display: flex; gap: 6px; flex-wrap: wrap; }

.turn-panel { border-left: 6px solid var(--line); }
.turn-panel[data-tone="mine"] { border-left-color: var(--mint); }
.turn-panel[data-tone="alert"] { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.turn-panel[data-tone="done"] { border-left-color: var(--butter); }
.turn-status { font-size: .98rem; line-height: 1.45; }
.turn-status .hint { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.turn-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.turn-actions .btn { flex: 1 1 auto; }

.players { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pl { border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; background: var(--surface-2); }
.pl.is-turn { border-color: var(--mint); box-shadow: 0 0 0 2px color-mix(in srgb, var(--mint) 45%, transparent); }
.pl.is-out { opacity: .5; }
.pl.is-away { opacity: .75; }
.pl-top { display: flex; align-items: center; gap: 10px; }
.pl-name { flex: 1; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-money { font-weight: 800; font-variant-numeric: tabular-nums; }
.pl-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.pl-badges:empty { display: none; }
.mini-btn {
  margin-left: auto; font: inherit; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.mini-btn:hover { background: var(--surface-3); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; border-radius: 6px; background: var(--chip, #ccc);
  border: 0; color: #1d1a33; font-size: .68rem; font-weight: 900; padding: 0; cursor: pointer;
}
.chip-mortgaged { opacity: .35; }

.trades { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.trade { border-radius: 12px; padding: 10px; font-size: .9rem; border: 1px solid var(--line); background: var(--surface-2); }
.trade-in { border-color: var(--butter); background: color-mix(in srgb, var(--butter) 14%, var(--surface)); }
.trade-head { font-weight: 750; margin-bottom: 4px; }
.trade-line { margin: 2px 0; }
.trade-buttons { display: flex; gap: 6px; margin-top: 8px; }

.log { list-style: none; padding: 0; margin: 0; font-size: .85rem; max-height: 280px; overflow: auto; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); line-height: 1.35; }
.log li:first-child { font-weight: 650; }

/* ==========================================================================
   Dialoge
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 40; backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease-out;
}
.overlay.closing { animation: fade .15s ease-in reverse forwards; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); color: var(--ink); border-radius: 20px; box-shadow: var(--shadow); border: 1px solid var(--line);
  width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow: auto; position: relative; animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(12px) scale(.97); } to { transform: none; } }
.modal-wide { max-width: 640px; }
.modal-small { max-width: 360px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.modal-head h3 { margin: 0; font-size: 1.2rem; font-weight: 850; letter-spacing: -.02em; }
.modal-close { background: none; border: 0; font-size: 1.7rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; margin-left: auto; }
.modal > .modal-close { position: absolute; top: 8px; right: 10px; z-index: 2; color: #1d1a33; }
.modal-body { padding: 14px 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 0 18px 16px; flex-wrap: wrap; }

/* Besitzrechtkarte */
.modal-deed { max-width: 340px; }
.modal-deed .modal-body { padding: 0; }
.deed-head { background: var(--deed); color: #1d1a33; padding: 18px 16px 14px; text-align: center; }
.deed-head small { display: block; font-size: .75rem; font-weight: 700; opacity: .75; }
.deed-head strong { font-size: 1.45rem; font-weight: 900; letter-spacing: -.02em; }
.deed-table { width: calc(100% - 32px); margin: 12px 16px 4px; border-collapse: collapse; font-size: .92rem; }
.deed-table td { padding: 4px 0; }
.deed-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.deed-table tr.cur td { background: color-mix(in srgb, var(--butter) 55%, transparent); }
.deed-table tr.cur td:first-child { padding-left: 6px; border-radius: 6px 0 0 6px; }
.deed-table tr.cur td:last-child { padding-right: 6px; border-radius: 0 6px 6px 0; }
.deed-table tr.sep td { border-top: 1px solid var(--line); padding: 3px 0 0; }
.deed p { margin: 8px 16px; line-height: 1.45; }
.deed-owner { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 650; }
.deed .manage-btns { padding: 4px 16px 16px; }
.manage-btns { display: flex; flex-wrap: wrap; gap: 6px; }

/* Verwalten */
.mg-cash { margin: 0 0 12px; }
.mg-group { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.mg-head { display: flex; align-items: center; gap: 8px; font-weight: 750; margin-bottom: 6px; }
.mg-head .chip { cursor: default; }
.mg-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line); }
.mg-row:first-of-type { border-top: 0; }
.mg-row .manage-btns { grid-column: 1 / -1; }
.mg-name { background: none; border: 0; padding: 0; font: inherit; font-weight: 650; text-align: left; cursor: pointer; color: var(--ink); }
.mg-bld { font-size: .82rem; color: var(--muted); }
.is-mortgaged .mg-name { color: var(--muted); text-decoration: line-through; }

/* Handel */
.field-inline { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.field-inline span { margin: 0; white-space: nowrap; }
.field-inline .select, .field-inline .num { flex: 1; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trade-col { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface-2); min-width: 0; }
.trade-col h4 { margin: 0 0 8px; }
.picks { display: flex; flex-direction: column; gap: 4px; max-height: 230px; overflow: auto; }
.pick { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; padding: 3px 0; }
.pick input { width: 18px; height: 18px; flex: none; accent-color: var(--accent-2); }
.pick .chip { width: 14px; height: 14px; cursor: inherit; }
.pick-disabled { opacity: .45; cursor: not-allowed; }
.trade-col .field-inline { flex-direction: column; align-items: stretch; gap: 4px; margin-bottom: 0; }
.trade-col .field-inline span { font-size: .8rem; }

/* Versteigerung */
.auc-prop { border-radius: 14px; padding: 12px 14px; color: #1d1a33; background: var(--deed); display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.auc-prop strong { font-size: 1.3rem; font-weight: 900; flex: 1 1 100%; }
.auc-prop .link { margin-left: auto; }
.auc-high { margin: 14px 0 4px; font-size: 1.05rem; }
.auc-timer { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.auc-bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 6px 0 12px; }
.auc-bar i { display: block; height: 100%; background: var(--mint); transition: width .25s linear; }
.auc-bar.urgent i { background: var(--accent); }
.auc-people { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.auc-people li { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px 4px 6px; font-size: .85rem; font-weight: 650; }
.auc-people li .token { width: 14px; height: 14px; }
.auc-people li small { color: var(--muted); font-weight: 400; }
.auc-people li.is-out { opacity: .45; }
.auc-controls { display: flex; flex-direction: column; gap: 8px; }
.auc-quick { display: flex; gap: 6px; }
.auc-quick .btn { flex: 1; }
.auc-bid { display: flex; gap: 8px; }
.auc-bid .num { flex: 1; }

/* Ereignis-/Gemeinschaftskarte */
.modal-card { max-width: 340px; background: transparent; box-shadow: none; border: 0; }
.modal-card .modal-actions { justify-content: center; padding-top: 12px; }
.game-card { border-radius: 20px; padding: 24px 20px 18px; text-align: center; color: #1d1a33; animation: flip .45s ease-out; }
@keyframes flip { from { transform: perspective(800px) rotateY(90deg); } to { transform: none; } }
.card-chance .game-card { background: #fff1e6; box-shadow: inset 0 0 0 6px var(--peach), 0 20px 50px rgba(0, 0, 0, .3); }
.card-community .game-card { background: #ecf7ff; box-shadow: inset 0 0 0 6px var(--sky), 0 20px 50px rgba(0, 0, 0, .3); }
:root[data-theme="dark"] .card-chance .game-card { box-shadow: inset 0 0 0 6px var(--peach), 0 0 40px rgba(255, 196, 155, .45); }
:root[data-theme="dark"] .card-community .game-card { box-shadow: inset 0 0 0 6px var(--sky), 0 0 40px rgba(169, 220, 255, .45); }
.gc-head { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .9rem; font-weight: 800; }
.gc-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--peach); color: #4a2100; font-size: 2rem; font-weight: 900; }
.gc-icon { display: block; width: 52px; height: 52px; padding: 11px; border-radius: 50%; background: var(--sky); color: #0d2e4a; }
.gc-text { font-size: 1.15rem; font-weight: 650; line-height: 1.45; margin: 14px 0; }
.gc-by { color: #5a5675; }

.win-trophy { font-size: 3.2rem; text-align: center; }
.win-text { text-align: center; font-size: 1.3rem; font-weight: 800; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1000px) {
  .game { grid-template-columns: 1fr; gap: 12px; }
  .board-wrap { position: static; }
  .board { width: min(100%, 720px); }
  body.in-game #app { padding: 0 8px calc(150px + env(safe-area-inset-bottom)); }
  .turn-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 20px 20px 0 0;
    border-left: 0; border-top: 5px solid var(--line);
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(20, 10, 50, .25);
  }
  .turn-panel[data-tone="mine"] { border-top-color: var(--mint); }
  .turn-panel[data-tone="alert"] { border-top-color: var(--accent); }
  .turn-panel[data-tone="done"] { border-top-color: var(--butter); }
  .turn-actions { margin-top: 10px; }
  .turn-status { font-size: .92rem; }
}
@media (max-width: 520px) {
  .topbar { padding: 8px 12px; }
  .brand { font-size: 1.15rem; }
  .topbar-room { letter-spacing: .06em; font-size: .8rem; }
  .card { padding: 20px; margin: 8px auto; }
  .room-code { font-size: 1.6rem; }
  .trade-cols { grid-template-columns: 1fr; }
  .modal-body { padding: 12px 14px; }
  .overlay { padding: 10px; align-items: flex-end; }
  .modal-card, .modal-deed { margin-top: auto; margin-bottom: auto; }
  .turn-actions .btn { padding: 10px 12px; font-size: .92rem; }
}
