/* Schlacht – Oberfläche im Stil einer Militär-Akte / Lagebesprechung.
   Alles ist unter body.g eingehängt, damit die Sandbox (?sandbox=1) unberührt bleibt. */

/* Pixelschrift Monogram (CC0, web/fonts/LIZENZ.txt). Der Mittelpunkt „·“ sitzt in ihr zu hoch und
   kommt deshalb aus der Ersatzschrift (unicode-range ohne U+00B7). */
@font-face { font-family: "Monogram"; src: url("fonts/monogram-extended.ttf") format("truetype"); font-display: swap;
  unicode-range: U+0000-00B6, U+00B8-FFFF; }

:root {
  --ink: #121412;
  --gun-900: #171a1b;
  --gun-800: #1f2324;
  --gun-700: #2a2f30;
  --gun-600: #3a4142;
  --gun-500: #4f5758;
  --olive-900: #1c2016;
  --olive-800: #262c1d;
  --olive-700: #363e28;
  --olive-600: #4a5434;
  --olive-400: #7d8a55;
  --sand-50: #f1e9d2;
  --sand-100: #e4d8b8;
  --sand-300: #bfb08a;
  --sand-500: #968e74;
  --paper: #d3c59e;
  --paper-2: #c4b48a;
  --paper-ink: #2a281f;
  --paper-mute: #554e38;
  --signal: #d13b24;
  --blue: #4578e6;
  --red: #db4538;
  --gold: #e3b94d;
  --ok: #9fb36a;
  /* Papier: glatte Fläche ohne Linien (Linien passen nie zu allen Zeilenhöhen); Kante nach
     docs/pixelart.md §4.5 in festen Stufen der Sand-Rampe, Licht oben links */
  --paper-edge: inset 0 0 0 2px var(--paper-2), inset 2px 2px 0 2px var(--sand-100), inset -2px -2px 0 2px var(--paper-2);
  /* Pixelschrift (docs/pixelart.md §8): nur Überschriften, Werte, Zahlen; nur 32, 48 oder 64 px */
  --head: "Monogram", "Arial Narrow", sans-serif;
  --text: "Avenir Next", system-ui, sans-serif;
  /* Pixel-Ecke: die äußeren 2×2 Bildpunkte jeder Ecke fehlen */
  --px: polygon(0 2px, 2px 2px, 2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px, 100% calc(100% - 2px),
    calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 2px calc(100% - 2px), 0 calc(100% - 2px));
  --px4: polygon(0 4px, 2px 4px, 2px 2px, 4px 2px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 2px, calc(100% - 2px) 2px,
    calc(100% - 2px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 2px) calc(100% - 4px), calc(100% - 2px) calc(100% - 2px),
    calc(100% - 4px) calc(100% - 2px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 2px), 2px calc(100% - 2px),
    2px calc(100% - 4px), 0 calc(100% - 4px));
}

body.g { margin: 0; height: 100vh; overflow: hidden; background: var(--gun-900); color: var(--sand-100);
  font: 15px/1.45 var(--text); -webkit-font-smoothing: antialiased; }
.g *, .g *::before, .g *::after { box-sizing: border-box; }
.g h1, .g h2, .g h3, .g h4 { font-family: var(--head); font-weight: 400; margin: 0; line-height: 1; font-size: 32px; letter-spacing: 0; -webkit-font-smoothing: none; font-smooth: never; }
.g p { margin: 0; }
.g .muted { color: var(--sand-500); }
.g .small { font-size: 13px; }
.g .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.g .gold { color: var(--gold); }

/* ---------- Bühne: Schlachtansicht hinter allem ---------- */
.g canvas.stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: pixelated; }
.g .layer { position: fixed; inset: 0; overflow: auto; }
.g[data-screen="battle"] .layer { overflow: hidden; pointer-events: none; }
.g[data-screen="battle"] .layer .hud, .g[data-screen="battle"] .layer .dialog-wrap { pointer-events: auto; }
.g .minimap { display: none; position: fixed; right: 14px; bottom: 14px; padding: 4px; background: var(--gun-800);
  border: 2px solid var(--ink); clip-path: var(--px); box-shadow: inset 0 0 0 2px var(--gun-600); z-index: 2; }
.g[data-screen="battle"] .minimap { display: block; }
.g .minimap canvas { display: block; image-rendering: pixelated; cursor: crosshair; }

/* ---------- Grundbausteine ---------- */
.g .panel { background: var(--gun-800); border: 2px solid var(--ink); clip-path: var(--px);
  box-shadow: inset 2px 2px 0 var(--gun-700), inset -2px -2px 0 var(--gun-900); }

.g .btn { font: 600 14px/1 var(--text); color: var(--sand-100); background: var(--olive-700); border: 2px solid var(--ink);
  clip-path: var(--px); padding: 9px 14px; cursor: pointer; letter-spacing: .01em;
  box-shadow: inset 2px 2px 0 var(--olive-600), inset -2px -2px 0 var(--olive-900); }
.g .btn:hover { background: var(--olive-600); box-shadow: inset 2px 2px 0 var(--olive-400), inset -2px -2px 0 var(--olive-900); }
.g .btn:active { box-shadow: inset 2px 2px 0 var(--olive-900), inset -2px -2px 0 var(--olive-600); transform: translateY(1px); }
.g .btn:disabled { cursor: not-allowed; color: var(--sand-500); background: var(--gun-700); box-shadow: inset 2px 2px 0 var(--gun-600), inset -2px -2px 0 var(--gun-800); transform: none; }
.g .btn.primary { background: var(--sand-100); color: var(--paper-ink); box-shadow: inset 2px 2px 0 var(--sand-50), inset -2px -2px 0 var(--sand-300); }
.g .btn.primary:hover { background: var(--sand-50); }
.g .btn.primary:active { box-shadow: inset 2px 2px 0 var(--sand-300), inset -2px -2px 0 var(--sand-50); }
.g .btn.danger { background: var(--signal); color: #fff; box-shadow: inset 2px 2px 0 #e8644d, inset -2px -2px 0 #8e2414; }
.g .btn.ghost { background: transparent; box-shadow: none; border-color: var(--gun-600); color: var(--sand-300); }
.g .btn.ghost:hover { border-color: var(--sand-500); color: var(--sand-100); }
.g .btn.big { font-size: 16px; padding: 13px 22px; }
.g .btn.small { font-size: 12px; padding: 5px 9px; }
.g .btn.tiny { font: 700 15px/1 var(--text); padding: 3px 8px; }
.g .btn.wide { width: 100%; }
.g .btn .price { font-weight: 500; opacity: .8; }

/* Sichtbarer Fokus: innen liegend, weil clip-path alles außerhalb abschneidet */
.g :focus { outline: none; }
.g :focus-visible { outline: 2px solid var(--sand-50); outline-offset: 2px; }
.g .btn:focus-visible, .g .chip:focus-visible, .g .seg:focus-visible, .g .menu-item:focus-visible {
  outline: none; box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 4px var(--sand-50); }
.g .btn.primary:focus-visible { box-shadow: inset 0 0 0 2px var(--sand-50), inset 0 0 0 4px var(--signal); }

.g input:not([type="radio"]) { font: 500 16px/1.2 var(--text); color: var(--sand-50); background: var(--ink); border: 2px solid var(--gun-500);
  clip-path: var(--px); padding: 9px 10px; width: 100%; box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .5); }
.g input:not([type="radio"]):focus-visible { outline: none; border-color: var(--sand-100); }
.g input::placeholder { color: var(--gun-500); }
.g label { display: block; font-size: 13px; font-weight: 600; color: var(--sand-300); margin: 0 0 5px; }

.g .bar { height: 10px; background: var(--ink); border: 2px solid var(--ink); position: relative; overflow: hidden; }
.g .bar > i { position: absolute; inset: 0 auto 0 0; background: var(--sand-300);
  background-image: repeating-linear-gradient(90deg, transparent 0 6px, rgba(0, 0, 0, .25) 6px 8px); }
.g .bar.blue > i { background-color: var(--blue); }
.g .bar.red > i { background-color: var(--red); }
.g .bar.sand > i { background-color: var(--sand-100); }
.g .bar.ink { background: var(--paper-2); border-color: var(--paper-ink); }
.g .bar.ink > i { background-color: var(--paper-ink); background-image: none; }

.g canvas.portrait { image-rendering: pixelated; display: block; width: 100%; height: auto; aspect-ratio: 1; }
.g canvas.unit-icon { image-rendering: pixelated; display: block; flex: none; }
.g canvas.unit-icon.dim { filter: grayscale(1) brightness(.6); opacity: .55; }

.g .photo { background: var(--ink); padding: 4px; border: 2px solid var(--ink); box-shadow: inset 0 0 0 2px var(--gun-500); }
.g .photo.big { width: min(272px, 60vw); padding: 6px; }
.g .photo-caption { font: 400 32px/24px var(--head); color: var(--sand-50); text-align: center; margin: 12px 0 10px; }
.g .kicker { font-weight: 600; color: var(--sand-500); margin-bottom: 6px; }
.g .link { color: var(--sand-300); text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 600; }
.g .link:hover { color: var(--sand-50); }
.g .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Login ---------- */
.g .login { position: absolute; inset: 0; display: flex; align-items: center; }
.g .login-shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(14, 16, 13, .96) 0, rgba(14, 16, 13, .86) 30%, rgba(14, 16, 13, .35) 62%, rgba(14, 16, 13, .55) 100%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 4px); }
.g .login-col { position: relative; margin-left: clamp(24px, 8vw, 140px); width: min(400px, calc(100vw - 48px)); }
.g .brand-title { font: 400 64px/72px var(--head); color: var(--sand-50); letter-spacing: 0; display: block;
  text-shadow: 4px 4px 0 var(--ink); }
.g .brand-title.small { font-size: 48px; text-shadow: 2px 2px 0 var(--ink); }
.g .brand-sub { font: 400 32px/24px var(--head); color: var(--sand-300); margin: 12px 0 34px; }
.g .brand-sub::before { content: ""; display: inline-block; width: 18px; height: 6px; background: var(--signal); margin-right: 10px; vertical-align: 4px; }
.g .login-card { padding: 22px 22px 18px; display: grid; gap: 4px; background: rgba(31, 35, 36, .94); }
.g .login-card h2 { font-size: 48px; color: var(--sand-50); margin-bottom: 12px; }
.g .login-card input { margin-bottom: 12px; }
.g .login-card .btn { margin-top: 6px; }
.g .hint { font-size: 12px; color: var(--sand-500); margin-top: 12px; }
.g .login-live { position: absolute; right: 18px; bottom: 14px; font-size: 12px; color: var(--sand-300); text-shadow: 1px 1px 0 var(--ink); }
.g .login-live::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--signal); margin-right: 8px; vertical-align: 0; }

/* ---------- Erschaffen und Erbfolge ---------- */
.g[data-screen="create"] .layer, .g[data-screen="succession"] .layer {
  background: var(--olive-900);
  background-image: linear-gradient(rgba(255, 255, 255, .025) 2px, transparent 2px), linear-gradient(90deg, rgba(255, 255, 255, .025) 2px, transparent 2px);
  background-size: 48px 48px; }
.g .screen-pad { max-width: 1040px; margin: 0 auto; padding: 48px 32px 64px; }
.g .create-head h1, .g .succ-head h1 { font-size: 64px; color: var(--sand-50); }
.g .create-body { display: grid; grid-template-columns: auto 1fr; gap: 48px; margin-top: 36px; align-items: start; }
.g .create-photo { display: flex; flex-direction: column; align-items: center; }
.g .create-form, .g .erbe-form { display: grid; gap: 22px; align-content: start; }
.g .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.g .field { display: grid; gap: 6px; justify-items: start; }
.g .field input { margin: 0; }
.g .field label { margin: 0; }
.g .origins { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.g .origins legend { font: 400 32px/24px var(--head); color: var(--sand-50); padding: 0; margin-bottom: 12px; }
.g .origin { position: relative; display: grid; gap: 6px; align-content: start; margin: 0; cursor: pointer; padding: 14px 14px 14px;
  background: var(--gun-800); border: 2px solid var(--ink); clip-path: var(--px); box-shadow: inset 0 0 0 2px var(--gun-700); color: var(--sand-100); font-weight: 400; }
.g .origin input { position: absolute; opacity: 0; pointer-events: none; }
.g .origin-name { font: 400 32px/24px var(--head); color: var(--sand-50); }
.g .origin-text { font-size: 13px; color: var(--sand-300); }
.g .origin-bonus { font-size: 13px; font-weight: 700; color: var(--ok); }
.g .origin:hover { box-shadow: inset 0 0 0 2px var(--gun-500); }
.g .origin:has(input:checked) { background: var(--olive-700); box-shadow: inset 0 0 0 2px var(--sand-100); }
.g .origin:has(input:checked) .origin-name::after { content: "  ✓"; color: var(--sand-100); }
.g .origin:has(input:focus-visible) { box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 4px var(--sand-50); }
.g .create-form > .btn.primary, .g .erbe-form > .btn.primary { justify-self: start; }

.g .succ-head h1 { font-size: 64px; max-width: 900px; }
.g .fallen-name { color: var(--sand-50); text-decoration: line-through 3px var(--signal); }
.g .succ-head .ahnen { margin-top: 22px; }
.g .name-row { display: flex; gap: 12px; align-items: center; }
.g .name-row input { width: 240px; }
.g .nachname { font: 400 32px/24px var(--head); color: var(--sand-300); }
.g .erbe h2 { font-size: 32px; color: var(--sand-50); margin-bottom: 10px; }
.g .erbe-table { border-collapse: collapse; min-width: 420px; }
.g .erbe-table th { text-align: left; font-weight: 600; color: var(--sand-300); padding: 5px 16px 5px 0; }
.g .erbe-table td { padding: 5px 8px; }
.g .erbe-table tr + tr { border-top: 2px solid rgba(0, 0, 0, .3); }
.g .num { text-align: right; font-variant-numeric: tabular-nums; }
.g .strong { font-weight: 700; color: var(--sand-50); }
.g .arrow { color: var(--sand-500); }

/* ---------- Ahnenreihe ---------- */
.g .ahnen { list-style: none; margin: 0; padding: 0; display: flex; gap: 12px; flex-wrap: wrap; }
.g .ahnen li { display: grid; grid-template-columns: 48px auto; grid-template-rows: auto auto auto; column-gap: 9px; align-items: center; min-width: 0; }
.g .ahnen canvas.portrait { grid-row: 1 / 4; width: 48px; border: 2px solid var(--ink); }
.g .ahn-name { font-weight: 700; font-size: 13px; line-height: 1.2; }
.g .ahn-ort, .g .ahn-meta { font-size: 12px; line-height: 1.25; opacity: .75; }

/* ---------- Akte, Einheitenlisten ---------- */
.g .stat { display: grid; gap: 2px; }
.g .stat-label { font-size: 12px; color: var(--sand-500); font-weight: 600; }
.g .stat-value { white-space: nowrap; font: 400 48px/48px var(--head); color: var(--sand-50); font-variant-numeric: tabular-nums; }
.g .col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
/* Akte: Papier auf dem Tisch */
.g .akte { position: relative; background: var(--paper); color: var(--paper-ink); padding: 20px 20px 22px; margin-top: 18px;
  clip-path: var(--px4); box-shadow: var(--paper-edge); }
.g .akte-tab { position: absolute; top: 0; right: 18px; font: 400 32px/24px var(--head); color: var(--paper-mute); padding: 6px 10px 4px;
  border: 2px solid var(--paper-mute); border-top: 0; }
.g .akte h2 { color: var(--paper-ink); font-size: 48px; }
.g .akte h3 { font-size: 32px; color: var(--paper-ink); display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.g .akte .muted { color: var(--paper-mute); }
.g .akte-head { display: grid; grid-template-columns: 184px 1fr; gap: 18px; align-items: end; margin-top: 8px; }
.g .akte .photo { background: var(--ink); padding: 4px; border: 0; box-shadow: 4px 4px 0 var(--paper-2); }
.g .akte-id { display: grid; gap: 6px; padding-bottom: 4px; }
.g .akte-id h2 { font-size: 48px; line-height: 1; }
.g .ahnen-block .ahnen { gap: 10px 18px; }
.g .akte-origin { font-weight: 600; color: var(--paper-mute); }
.g .akte-level { font-size: 13px; }
.g .akte-siege { font: 400 32px/24px var(--head); margin-top: 4px; }
.g .akte-block { margin-top: 20px; padding-top: 14px; border-top: 2px dashed var(--sand-500); }
.g .attrs { width: 100%; border-collapse: collapse; }
.g .attrs th { text-align: left; font-weight: 600; padding: 4px 0; }
.g .attrs td { padding: 4px 6px; }
.g .attrs td.num { font: 400 32px/24px var(--head); width: 36px; }
.g .attrs .effect { color: var(--paper-mute); font-size: 13px; }
.g .attrs .plus { width: 40px; text-align: right; }
.g .attrs .btn.tiny { background: var(--paper-ink); color: var(--paper); box-shadow: none; }
.g .attrs .btn.tiny:hover { background: #000; }
.g .attrs .btn.tiny:focus-visible { box-shadow: inset 0 0 0 2px var(--paper-ink), inset 0 0 0 4px var(--paper); }
.g .stamp-mini { font: 400 32px/24px var(--head); color: var(--signal); border: 2px solid var(--signal); padding: 4px 6px 2px; }
.g .akte .ahnen li { color: var(--paper-ink); }
.g .akte .ahnen canvas.portrait { border-color: var(--paper-ink); }

.g .units { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.g .units li { display: flex; align-items: flex-end; gap: 0; }
.g .units .n { font: 400 32px/24px var(--head); color: var(--sand-50); margin-left: 2px; padding-bottom: 2px; }
.g .units .n::before { content: "×"; font-size: 32px; color: var(--sand-500); margin-right: 1px; }

/* Truppe: Stärkemeldung */
.g .truppe { padding: 18px 18px 18px; background: var(--gun-800); border: 2px solid var(--ink); clip-path: var(--px);
  box-shadow: inset 0 2px 0 var(--gun-600); }
.g .truppe > .bar { margin-bottom: 8px; }
.g .truppe > p { margin-bottom: 12px; }
.g .limit { font: 400 32px/24px var(--head); color: var(--sand-50); font-variant-numeric: tabular-nums; }
.g .limit.full { color: var(--signal); }
.g .trupp-list { list-style: none; margin: 0; padding: 0; display: grid; }
.g .trupp { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; }
.g .trupp + .trupp { border-top: 2px solid var(--gun-700); }
.g .trupp-name { font-weight: 600; }
.g .trupp-n { font: 400 32px/24px var(--head); color: var(--sand-50); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.g .trupp:not(.has) .trupp-n { color: var(--gun-500); }
.g .trupp .btn { padding: 7px 10px; font-size: 13px; }
.g .trupp .unit-icon { justify-self: center; }
.g .trupp.locked { grid-template-columns: 64px 1fr auto; color: var(--gun-500); }
.g .trupp-lock { color: var(--sand-500); font-weight: 600; }

/* ---------- Gefecht ---------- */
.g .battle { position: absolute; inset: 0; }
.g .hud { position: absolute; left: 0; right: 0; top: 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center;
  padding: 10px 16px 12px; background: linear-gradient(rgba(12, 14, 12, .92), rgba(12, 14, 12, .78)); border-bottom: 2px solid rgba(0, 0, 0, .6); }
.g .hud-side { display: flex; align-items: center; gap: 12px; min-width: 0; }
.g .hud-side.foe { justify-content: flex-end; text-align: right; }
.g .hud-side canvas.portrait { width: 36px; border: 2px solid var(--blue); }
.g .hud-who { flex: 1; max-width: 420px; display: grid; gap: 5px; }
.g .hud-name-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.g .hud-name { font: 400 32px/24px var(--head); color: var(--sand-50); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g .hud-side.own .hud-name { color: #9fbaf5; }
.g .hud-side.foe .hud-name { color: #f19a8f; }
.g .hud-n { font: 400 32px/24px var(--head); font-variant-numeric: tabular-nums; color: var(--sand-50); }
.g .hud .bar { background: rgba(58, 65, 66, .8); border-color: var(--ink); height: 12px; }
.g .hud-side.foe .bar > i { left: auto; right: 0; }
.g .hud-mid { display: grid; justify-items: center; gap: 4px; }
.g .speed { display: flex; }
.g .seg { font: 400 32px/24px var(--head); color: var(--sand-300); background: var(--gun-700); border: 2px solid var(--ink); padding: 8px 16px 5px; min-width: 54px; cursor: pointer; }
.g .seg + .seg { border-left: 0; }
.g .seg:first-child { clip-path: polygon(0 2px, 2px 2px, 2px 0, 100% 0, 100% 100%, 2px 100%, 2px calc(100% - 2px), 0 calc(100% - 2px)); }
.g .seg:last-child { clip-path: polygon(0 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 100%, 0 100%); }
.g .seg[aria-pressed="true"] { background: var(--sand-100); color: var(--paper-ink); }
.g .seg:hover:not([aria-pressed="true"]) { background: var(--gun-600); color: var(--sand-50); }
.g .hud-status { font-size: 12px; color: var(--sand-300); min-height: 1.2em; }
.g .hud-help { position: absolute; left: 16px; bottom: 12px; font-size: 12px; color: var(--sand-300); text-shadow: 1px 1px 0 var(--ink); }

/* ---------- Bericht ---------- */
.g .dialog-wrap { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 12, 10, .55); padding: 24px; z-index: 4; overflow: auto; }
.g .dialog.report { width: min(860px, 100%); background: var(--paper); color: var(--paper-ink); padding: 26px 28px 22px; clip-path: var(--px4);
  box-shadow: var(--paper-edge);
  animation: report-in .2s steps(4) both; }
@keyframes report-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.g .report-head { display: flex; gap: 22px; align-items: center; }
.g .stamp { font: 400 64px/72px var(--head); padding: 8px 14px 2px; border: 4px solid currentColor; }
.g .stamp.win { color: #3d5a1e; }
.g .stamp.loss { color: var(--signal); }
.g .stamp.draw { color: var(--paper-mute); }
.g .dialog.report.win .stamp { animation: stamp .2s .2s steps(4) both; }
@keyframes stamp { from { opacity: 0; } to { opacity: 1; } }
.g .report-sub { font-size: 16px; font-weight: 600; max-width: 520px; }
.g .aufstieg { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; margin-top: 20px; padding: 12px 16px; background: var(--paper-ink); color: var(--paper); }
.g .aufstieg-k { font: 400 32px/24px var(--head); color: var(--gold); }
.g .aufstieg-name { font: 400 48px/48px var(--head); color: var(--sand-50); }
.g .report-grid { display: grid; grid-template-columns: 200px 1fr 1fr; gap: 24px; margin-top: 22px; padding-top: 18px; border-top: 2px dashed var(--sand-500); }
.g .report h3 { font-size: 32px; margin-bottom: 10px; }
.g .report h4 { font-size: 32px; margin: 14px 0 6px; }
.g .report .muted { color: var(--paper-mute); }
.g .beute-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 8px; align-items: baseline; }
.g .beute-list dt { font-weight: 600; color: var(--paper-mute); }
.g .beute-list dd { margin: 0; font: 400 32px/24px var(--head); text-align: right; }
.g .beute-list dd.gold { color: #8a6312; }
.g .beute-list dd.up { color: #3d5a1e; }
.g .loss-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.g .loss-list .unit-icon { justify-self: center; }
.g .loss-list li { display: grid; grid-template-columns: 64px 36px 1fr; align-items: center; gap: 6px; }
.g .loss-list .n { font: 400 32px/24px var(--head); text-align: right; }
.g .loss-list .kind { font-size: 14px; }
.g .report-foot { display: flex; justify-content: flex-end; margin-top: 22px; }
.g .report .btn.primary { background: var(--paper-ink); color: var(--paper); box-shadow: inset 2px 2px 0 #4a473a, inset -2px -2px 0 #000; }
.g .report .btn.primary:hover { background: #000; }
.g .report .btn.primary:focus-visible { box-shadow: inset 0 0 0 2px var(--paper-ink), inset 0 0 0 4px var(--paper), inset 0 0 0 6px var(--paper-ink); }

/* ---------- schmale Fenster ---------- */
@media (max-width: 800px) {
  .g .report-grid, .g .field-row, .g .origins { grid-template-columns: 1fr; }
  .g .brand-title { font-size: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .g *, .g *::before, .g *::after { animation: none !important; transition: none !important; }
}

/* ---------- Kritische Treffer (Pop-up über der Einheit, auch in der Sandbox) ---------- */
.crit { position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap; z-index: 3;
  font: 400 32px/24px "Monogram", "Arial Narrow", sans-serif; text-transform: uppercase;
  padding: 3px 5px 1px; color: #fff; background: #121412; border: 2px solid currentColor; image-rendering: pixelated;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .55); }
.crit.head { color: #f6d44a; }
.crit.weak { color: #ff8a3c; }

/* ---------- Welt: Lagekarte ---------- */
.g[data-screen="map"] canvas.stage, .g[data-screen="succession"] canvas.stage { visibility: hidden; }
.g[data-screen="map"] .layer { background: var(--gun-900); overflow: hidden; }
.g[data-screen="succession"] .layer {
  background: var(--olive-900);
  background-image: linear-gradient(rgba(255, 255, 255, .025) 2px, transparent 2px), linear-gradient(90deg, rgba(255, 255, 255, .025) 2px, transparent 2px);
  background-size: 48px 48px; }
.g:not([data-screen="battle"]) .crit-layer { display: none; }
.g .crit-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.g .world { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.g .top { display: flex; align-items: center; gap: 22px; padding: 8px 16px; background: var(--ink); border-bottom: 2px solid var(--gun-600); }
.g .top-who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.g .top-who canvas.portrait { width: 36px; border: 2px solid var(--blue); }
.g .top-who strong { display: block; font: 400 32px/24px var(--head); color: var(--sand-50); }
.g .top-stats { display: flex; gap: 22px; align-items: center; flex: 1; }
.g .top-stats .stat-value { font-size: 32px; line-height: 24px; }
.g .stat-value.gold { color: var(--gold); }
.g .stat-value small { font: 600 12px/1 var(--text); color: var(--sand-300); }
.g .stat-ruf { display: grid; gap: 3px; min-width: 110px; }
.g .top .bar { height: 8px; background: var(--gun-700); border-color: var(--gun-700); }
.g .alarm { display: grid; gap: 3px; min-width: 170px; text-align: left; background: none; border: 0; padding: 2px; color: inherit; cursor: pointer; font: inherit; }
.g .alarm .alarm-n { font: 400 32px/24px var(--head); color: var(--sand-300); }
.g .alarm.warn .stat-label { color: #f0a050; }
.g .alarm.due .stat-label { color: #fff; background: var(--signal); padding: 2px 4px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.g .top-nav { display: flex; gap: 6px; }
.g .badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 2px 4px 1px; background: var(--signal); color: #fff; font: 700 12px/1 var(--text); text-align: center; }
.g .world-main { display: grid; grid-template-columns: 1fr minmax(340px, 400px); min-height: 0; }
.g .region-map { position: relative; min-height: 0; min-width: 0; overflow: hidden; background: #121510;
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 4px); }
.g .region-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; cursor: grab; touch-action: none; }
.g .region-canvas.dragging { cursor: grabbing !important; }
.g .region-canvas:focus-visible { outline: 2px solid var(--sand-50); outline-offset: -4px; }
.g .map-tools { position: absolute; top: 10px; right: 10px; left: 110px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; align-items: center; z-index: 2; pointer-events: none; }
.g .map-tools > * { pointer-events: auto; }
.g .map-tool { min-width: 32px; }
.g .map-zoom { font: 400 32px/24px var(--head); color: var(--sand-300); min-width: 34px; text-align: center; padding: 6px 2px 4px; background: var(--ink); border: 2px solid var(--gun-600); }
.g .map-legend-host { position: absolute; left: 10px; bottom: 10px; z-index: 2; max-height: calc(100% - 20px); display: flex; }
.g .map-legend { background: var(--ink); border: 2px solid var(--gun-600); clip-path: var(--px); font-size: 12px; color: var(--sand-100);
  max-height: 100%; overflow: auto; width: 300px; }
.g .map-legend:not([open]) { width: auto; }
.g .map-legend summary { cursor: pointer; padding: 6px 10px 5px; font: 400 32px/24px var(--head); color: var(--sand-50); list-style: none; }
.g .map-legend summary::-webkit-details-marker { display: none; }
.g .map-legend summary::before { content: "▸ "; color: var(--sand-500); }
.g .map-legend[open] summary::before { content: "▾ "; }
.g .legend-body { padding: 0 10px 10px; display: grid; gap: 4px; }
.g .legend-body h4 { font-size: 32px; line-height: 24px; color: var(--sand-300); margin-top: 8px; }
.g .legend-kinds { grid-template-columns: 1fr 1fr; column-gap: 8px; }
.g .legend-body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.g .legend-body li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; line-height: 1.25; }
.g .legend-note { color: var(--sand-500); line-height: 1.35; margin-top: 4px; }
.g .legend-icon { width: 18px; height: 18px; image-rendering: pixelated; justify-self: center; }
.g .legend-sw { width: 18px; height: 12px; justify-self: center; border: 2px solid var(--ink); }
.g .legend-sw.multi { display: flex; padding: 0; }
.g .legend-sw.multi i { flex: 1; }
.g .legend-sw.fog { background: repeating-conic-gradient(var(--olive-900) 0 25%, var(--olive-800) 0 50%) 0 0 / 4px 4px; }
.g .legend-sw.brackets { --c: var(--sand-50); border: 0; height: 14px; background:
  linear-gradient(var(--c), var(--c)) 0 0 / 5px 2px, linear-gradient(var(--c), var(--c)) 0 0 / 2px 5px,
  linear-gradient(var(--c), var(--c)) 100% 0 / 5px 2px, linear-gradient(var(--c), var(--c)) 100% 0 / 2px 5px,
  linear-gradient(var(--c), var(--c)) 0 100% / 5px 2px, linear-gradient(var(--c), var(--c)) 0 100% / 2px 5px,
  linear-gradient(var(--c), var(--c)) 100% 100% / 5px 2px, linear-gradient(var(--c), var(--c)) 100% 100% / 2px 5px; background-repeat: no-repeat; }
.g .legend-sw.brackets.gold { --c: #f6d44a; }
.g .legend-sw.dot { width: 8px; height: 8px; border: 0; }
.g .legend-sw.dot.red { background: var(--signal); }
.g .legend-sw.dot.sand { background: var(--sand-100); box-shadow: inset 0 0 0 3px var(--sand-100), inset 0 0 0 4px var(--ink); }
.g .legend-sw.canal { background: repeating-linear-gradient(0deg, var(--gun-800) 0 3px, var(--gun-600) 3px 4px); border-right-color: var(--steel-400, #6e727c); }
.g .legend-sw.wild { background: repeating-linear-gradient(45deg, var(--gun-900) 0 4px, var(--gun-700) 4px 5px); }
.g .legend-sw.road { border: 0; height: 2px; background: repeating-linear-gradient(90deg, var(--sand-500) 0 4px, transparent 4px 6px); }
.g .map-mini { position: absolute; right: 10px; bottom: 10px; z-index: 2; padding: 4px; background: var(--ink); border: 2px solid var(--gun-600); clip-path: var(--px); line-height: 0; }
.g .map-mini[hidden] { display: none; }
.g .map-mini-canvas { display: block; width: 48px; height: 160px; cursor: crosshair; touch-action: none; }
.g .map-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.g .map-label { position: absolute; left: 0; top: 0; white-space: nowrap; font: 600 12px/16px var(--text); padding: 0 4px; background: var(--ink); color: var(--sand-300); }
.g .map-label.own { color: var(--sand-50); border-left: 4px solid var(--blue); }
.g .map-label.att { color: #f6d44a; }
.g .map-label.sel { color: var(--sand-50); }
.g .map-label.ring { color: var(--sand-100); }
.g .map-label.ring.locked { color: var(--sand-500); }
.g .map-label.ring { font: 700 11px/16px var(--text); letter-spacing: .08em; text-transform: uppercase; padding: 1px 6px; }
.g .map-label.ring { white-space: pre; text-align: center; }
.g .map-label.ring::first-line { letter-spacing: .08em; }
.g .map-label.section { background: none; padding: 0; font: 400 32px/24px var(--head); letter-spacing: 0; text-transform: uppercase; color: var(--sand-100);
  text-shadow: 2px 2px 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 2px 0 0 var(--ink); }
.g .map-label.section.empty { color: var(--sand-500); }
.g .map-label.torch { color: #ff9e2e; }
.g .map-hints { position: absolute; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: calc(100% - 240px); pointer-events: none; }
.g .map-hints.up { top: 88px; }
.g .map-hints.down { bottom: 12px; }
.g .map-hint { pointer-events: auto; font: 600 12px/16px var(--text); padding: 3px 8px; background: var(--ink); color: var(--sand-100); border: 2px solid var(--gun-600); cursor: pointer; white-space: nowrap; }
.g .map-hint:hover, .g .map-hint:focus-visible { border-color: var(--sand-300); color: var(--sand-50); }
.g .map-hint.home { border-left: 4px solid var(--blue); }
.g .map-hint.torch { color: #ff9e2e; }
.g .map-tip-hint { color: var(--sand-500); font-size: 11px; margin-top: 2px; }
.g .actions { display: grid; gap: 8px; }

/* Logbuch (logbook.ts): oben links auf der Karte */
.g .logbook { position: absolute; top: 10px; left: 10px; z-index: 3; display: grid; gap: 6px; justify-items: start; width: min(340px, calc(100% - 20px)); pointer-events: none; }
.g .logbook > * { pointer-events: auto; }
.g .logbook-panel { width: 100%; max-height: min(420px, 55vh); overflow: auto; background: var(--ink); border: 2px solid var(--gun-600); clip-path: var(--px); }
.g .logbook-panel[hidden] { display: none; }
.g .logbook-head { display: grid; gap: 2px; padding: 8px 10px 6px; border-bottom: 2px solid var(--gun-700); }
.g .logbook-head strong { font: 400 32px/24px var(--head); color: var(--sand-50); }
.g .log-empty { padding: 10px; }
.g .log-list { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; }
.g .log-item, .g .logbook-pop { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; width: 100%; text-align: left; font: 13px/1.3 var(--text);
  color: var(--sand-100); background: transparent; border: 0; border-left: 4px solid var(--sand-500); padding: 6px 8px; }
.g button.log-item { cursor: pointer; }
.g button.log-item:hover, .g button.log-item:focus-visible { background: var(--gun-700); outline: none; }
.g .log-kind { font: 400 32px/24px var(--head); text-transform: uppercase; letter-spacing: 0; color: var(--sand-300); }
.g .log-time { justify-self: end; font-size: 11px; color: var(--sand-500); }
.g .log-text { grid-column: 1 / -1; }
.g .log-act { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--gold); }
.g .k-win { border-left-color: var(--ok); } .g .k-win .log-kind { color: var(--ok); }
.g .k-loss, .g .k-lost, .g .k-attacked, .g .k-alarm { border-left-color: var(--signal); }
.g .k-loss .log-kind, .g .k-lost .log-kind, .g .k-attacked .log-kind, .g .k-alarm .log-kind { color: #f08a75; }
.g .k-gate { border-left-color: var(--gold); } .g .k-gate .log-kind { color: var(--gold); }
.g .k-chat { border-left-color: var(--blue); } .g .k-chat .log-kind { color: #9fbaf5; }
.g .logbook-pops { display: grid; gap: 6px; width: 100%; }
.g .logbook-pop { position: relative; cursor: pointer; padding-right: 26px; background: var(--ink); border-top: 2px solid var(--gun-600);
  border-right: 2px solid var(--gun-600); border-bottom: 2px solid var(--gun-600); box-shadow: 4px 4px 0 var(--gun-900); animation: pop-in .2s steps(4) both; }
.g .logbook-pop:hover { background: var(--gun-800); }
@keyframes pop-in { from { opacity: 0; transform: translateX(-16px); } }
.g .logbook-pop-x { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; background: none; border: 0; color: var(--sand-500); font: 700 16px/1 var(--text); cursor: pointer; }
.g .logbook-pop-x:hover { color: var(--sand-50); }

/* ---------- Kontextmenü (eigener Baustein, context-menu.ts) ---------- */
.ctx-menu { position: fixed; left: 0; top: 0; z-index: 50; min-width: 220px; max-width: 300px; padding: 4px; display: grid;
  background: var(--ink); border: 2px solid var(--gun-500); color: var(--sand-100); font: 14px/1.3 "Avenir Next", system-ui, sans-serif;
  box-shadow: 4px 4px 0 var(--gun-900); animation: ctx-in .1s steps(2) both; }
@keyframes ctx-in { from { opacity: 0; } }
.ctx-head { display: grid; gap: 2px; padding: 6px 8px; border-bottom: 2px solid var(--gun-700); margin-bottom: 4px; }
.ctx-head strong { font: 400 32px/24px var(--head); color: var(--sand-50); }
.ctx-head span { font-size: 12px; color: var(--sand-500); }
.ctx-item { display: grid; gap: 1px; text-align: left; font: inherit; color: inherit; background: transparent; border: 0; padding: 6px 8px; cursor: pointer; }
.ctx-item:hover:not(:disabled), .ctx-item:focus-visible { background: var(--olive-700); outline: none; box-shadow: inset 2px 0 0 var(--sand-100); }
.ctx-item:disabled { color: var(--sand-500); cursor: not-allowed; }
.ctx-item .ctx-label { font-weight: 600; }
.ctx-item .ctx-hint { font-size: 12px; color: var(--sand-500); }
.ctx-item.primary .ctx-label { color: var(--gold); }
.ctx-item.danger .ctx-label { color: #ff7a5c; }
.ctx-item.primary:disabled .ctx-label, .ctx-item.danger:disabled .ctx-label { color: var(--sand-500); }
.ctx-sep { height: 2px; background: var(--gun-700); margin: 4px 2px; }
.g .map-tip { position: absolute; left: 0; top: 0; display: grid; gap: 2px; padding: 6px 8px; background: var(--ink); border: 2px solid var(--gun-500);
  pointer-events: none; font-size: 12px; z-index: 2; max-width: 260px; }
.g .map-tip strong { font: 400 32px/24px var(--head); color: var(--sand-50); }
.g .map-tip[hidden] { display: none; }
.g .map-tip em { color: var(--gold); font-style: normal; font-weight: 700; }
.g .side { overflow: auto; background: var(--gun-800); border-left: 2px solid var(--ink); box-shadow: inset 2px 0 0 var(--gun-600); }
.g .side-body { padding: 16px 18px 24px; display: grid; gap: 12px; align-content: start; }
.g .side-head h2 { font-size: 48px; color: var(--sand-50); }
.g .side-head .kicker { margin-bottom: 6px; }
.g .side h3 { font-size: 32px; color: var(--sand-50); margin-top: 4px; }
.g .role { color: var(--sand-300); font-size: 13px; border-left: 4px solid var(--olive-400); padding-left: 8px; }
.g .note { background: var(--gun-700); border-left: 4px solid var(--sand-500); padding: 8px 10px; font-size: 13px; }
.g .note.ok { border-left-color: var(--ok); }
.g .odds { display: grid; gap: 8px; padding: 12px; background: var(--ink); clip-path: var(--px); }
.g .odds-head { display: flex; justify-content: space-between; align-items: baseline; }
.g .odds-win { font: 400 48px/48px var(--head); color: var(--sand-50); }
.g .odds-head.good .odds-win { color: var(--ok); }
.g .odds-head.bad .odds-win { color: #f08a75; }
.g .facts { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 14px; }
.g .facts dt { color: var(--sand-300); }
.g .facts dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--sand-50); }
.g .facts dd.gold { color: var(--gold); }
.g .facts dd.up { color: var(--ok); }
.g .facts dd.warn { color: #f08a75; }
.g .limit-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.g .side .trupp { grid-template-columns: 44px 1fr auto auto; }
.g .side .trupp-name { font-weight: 600; }
.g .trupp-btns { display: flex; gap: 4px; }
.g .trupp-btns .btn { padding: 5px 7px; }
.g .waves { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.g .waves li { background: var(--ink); padding: 8px 10px; display: grid; gap: 6px; }
.g .wave-head { display: flex; justify-content: space-between; }
.g .wave-odds { color: var(--gold); font-weight: 700; font-size: 13px; }
.g .gains { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 2px; }
.g .renown { display: grid; gap: 4px; }
.g .toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 6px; z-index: 9; pointer-events: none; }
.g .toast { background: var(--ink); border: 2px solid var(--signal); color: var(--sand-50); padding: 8px 14px; font-weight: 600; box-shadow: 4px 4px 0 rgba(0, 0, 0, .5);
  animation: report-in .2s steps(4) both; }
.g .toast.ok { border-color: var(--ok); }

/* Dialoge */
.g .dialog.panel { width: min(640px, 100%); padding: 22px 24px; display: grid; gap: 14px; }
.g .dialog.prompt h2, .g .dialog.inbox h2 { font-size: 48px; color: var(--sand-50); }
.g .vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.g .vs h3 { font-size: 32px; margin-bottom: 6px; color: var(--sand-50); }
.g .vs-x { font: 400 32px/24px var(--head); color: var(--sand-500); }
.g .inbox-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.g .inbox-item { width: 100%; display: grid; grid-template-columns: 92px 1fr; grid-template-rows: auto auto; gap: 2px 12px; text-align: left; align-items: center;
  background: var(--gun-700); border: 2px solid var(--ink); color: var(--sand-100); padding: 8px 10px; cursor: pointer; font: inherit; }
.g .inbox-item:hover { background: var(--gun-600); }
.g .inbox-item .mini-stamp { grid-row: 1 / 3; }
.g .inbox-title { font-weight: 700; color: var(--sand-50); }
.g .chat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 30vh; overflow: auto; }
.g .chat-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; background: var(--gun-800, var(--gun-700)); border-left: 4px solid var(--sand-500); padding: 6px 10px; }
.g .chat-from { font-weight: 700; color: var(--sand-50); }
.g .chat-text { grid-column: 1 / 3; color: var(--sand-100); font-style: italic; }
.g .mini-stamp { font: 400 32px/24px var(--head); padding: 4px 6px 2px; border: 2px solid currentColor; text-align: center; }
.g .mini-stamp.win { color: var(--ok); }
.g .mini-stamp.loss { color: #f08a75; }
.g .mini-stamp.draw { color: var(--sand-300); }
.g .dialog.akte.leader { width: min(1240px, 100%); max-height: calc(100vh - 48px); overflow: auto; margin: 0; }
.g .tabs { display: flex; gap: 4px; align-items: flex-end; border-bottom: 2px solid var(--paper-ink); margin-bottom: 18px; }
.g .tabs .btn { margin-left: auto; margin-bottom: 6px; }
.g .tab { font: 400 32px/24px var(--head); background: var(--paper-2); border: 2px solid var(--sand-500); border-bottom: 0; color: var(--paper-mute); padding: 8px 14px 6px; cursor: pointer;
  clip-path: polygon(0 2px, 2px 2px, 2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px, 100% 100%, 0 100%); }
.g .tab:hover:not([aria-selected="true"]) { color: var(--paper-ink); background: var(--sand-300); }
.g .tab[aria-selected="true"] { background: var(--paper-ink); color: var(--paper); }
/* Knotenkarte der Bäume (ui/skill-map.ts): dunkle Fläche, Kacheln 32×32 ×2, Linien 2 px */
.g .akte-line { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: baseline; }
.g .akte-line .bar { grid-column: 1 / -1; }
.g .skill-map { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; margin: 16px 0 12px; }
.g .sm-stage { position: relative; min-width: 0; }
.g .sm-viewport { position: relative; height: 560px; overflow: hidden; background: var(--gun-900); border: 2px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--gun-700); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.g .sm-viewport.dragging { cursor: grabbing; }
.g .sm-plane { position: absolute; left: 0; top: 0; }
.g .sm-lines { position: absolute; left: 0; top: 0; }
.g .sm-tile { position: absolute; width: 72px; height: 72px; padding: 2px; margin: 0; background: var(--gun-800); border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px var(--gun-600), inset 2px 2px 0 var(--gun-700); cursor: pointer; color: inherit; font: inherit; }
.g .sm-tile canvas { display: block; width: 64px; height: 64px; image-rendering: pixelated; }
.g .sm-tile .sm-count { position: absolute; left: 0; right: 0; bottom: -14px; width: max-content; margin: 0 auto; padding: 0 4px;
  font: 400 32px/24px var(--head); -webkit-font-smoothing: none; color: var(--sand-100); background: var(--ink); border: 2px solid var(--gun-600); pointer-events: none; }
.g .sm-tile:hover { box-shadow: 0 0 0 2px var(--sand-300), inset 2px 2px 0 var(--gun-700); }
.g .sm-tile.open { box-shadow: 0 0 0 2px var(--sand-500), inset 2px 2px 0 var(--gun-700); }
.g .sm-tile.owned { background: var(--olive-800); box-shadow: 0 0 0 2px var(--gold), inset 2px 2px 0 var(--olive-700); }
.g .sm-tile.owned .sm-count { color: var(--gold); border-color: var(--gold); }
.g .sm-tile.maxed { background: var(--olive-800); box-shadow: 0 0 0 2px var(--gold), inset 2px 2px 0 var(--olive-700); }
.g .sm-tile.maxed .sm-count { color: var(--ink); background: var(--gold); border-color: var(--ink); }
.g .sm-tile.locked, .g .sm-tile.excluded, .g .sm-tile.hidden { background: var(--gun-900); box-shadow: 0 0 0 2px var(--gun-700); }
.g .sm-tile.locked .sm-count, .g .sm-tile.excluded .sm-count { color: var(--sand-500); border-color: var(--gun-700); }
.g .sm-tile.excluded .sm-count { text-decoration: line-through 2px; }
.g .sm-tile.center { background: var(--ink); box-shadow: 0 0 0 2px var(--sand-100), 0 0 0 4px var(--ink); }
.g .sm-tile.center .sm-count { color: var(--sand-50); border-color: var(--sand-100); }
.g .sm-tile.selected { box-shadow: 0 0 0 2px var(--sand-50), 0 0 0 4px var(--ink), 0 0 0 6px var(--sand-50); }
.g .sm-tile:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--sand-50), 0 0 0 4px var(--ink), 0 0 0 6px var(--sand-50); }
.g .sm-label { position: absolute; display: grid; gap: 2px; white-space: nowrap; pointer-events: none; }
.g .sm-label.left { transform: translate(-36px, -50%); }
.g .sm-label.right { transform: translate(calc(36px - 100%), -50%); text-align: right; }
.g .sm-label.center { transform: translate(-50%, -50%); text-align: center; }
.g .sm-label strong { font: 400 32px/24px var(--head); -webkit-font-smoothing: none; color: var(--sand-100); text-transform: uppercase; }
.g .sm-label span { font-size: 12px; line-height: 1.2; color: var(--sand-500); }
.g .sm-label.center:only-child, .g .sm-label.center strong:only-child { background: var(--gun-900); padding: 2px 4px; }
.g .sm-hud { position: absolute; top: 10px; right: 10px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.g .sm-hud .btn { pointer-events: auto; background: var(--gun-800); }
.g .sm-points { font: 400 32px/24px var(--head); -webkit-font-smoothing: none; color: var(--sand-50); background: var(--ink); border: 2px solid var(--gun-600); padding: 2px 8px; }
.g .sm-detail { background: var(--gun-800); color: var(--sand-100); border: 2px solid var(--ink); box-shadow: inset 2px 2px 0 var(--gun-700), inset -2px -2px 0 var(--gun-900);
  padding: 16px; display: grid; align-content: start; gap: 8px; clip-path: var(--px); min-height: 160px; }
.g .sm-detail-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.g .sm-detail-head strong { font: 400 32px/24px var(--head); -webkit-font-smoothing: none; color: var(--sand-50); }
.g .sm-detail-count { font: 400 32px/24px var(--head); -webkit-font-smoothing: none; color: var(--gold); white-space: nowrap; }
.g .sm-sub { margin: 0; font-size: 12px; font-weight: 600; color: var(--sand-500); text-transform: uppercase; letter-spacing: .04em; }
.g .sm-line, .g .sm-idle { margin: 0; font-size: 13px; line-height: 1.4; color: var(--sand-100); }
.g .sm-line.muted, .g .sm-idle { color: var(--sand-300); }
.g .sm-line.good { color: var(--ok); }
.g .sm-line.good::before { content: "✓ "; }
.g .sm-line.warn { color: var(--sand-300); }
.g .sm-line.warn::before { content: "○ "; }
.g .akte .sm-detail .btn.small { justify-self: start; background: var(--olive-700); color: var(--sand-100); box-shadow: inset 2px 2px 0 var(--olive-600), inset -2px -2px 0 var(--olive-800); }
.g .akte .sm-detail .btn[aria-disabled="true"] { cursor: not-allowed; transform: none; }
.g .akte .sm-detail .btn[aria-disabled="true"], .g .akte .sm-detail .btn:disabled { background: var(--gun-700); color: var(--sand-500); border-color: var(--ink); box-shadow: none; }
@media (max-width: 900px) {
  /* Handy: der Detailkasten liegt unten über der Karte und erscheint nur bei einer Auswahl. */
  .g .skill-map { grid-template-columns: 1fr; }
  .g .sm-stage, .g .sm-detail { grid-area: 1 / 1; }
  .g .sm-viewport { height: 60vh; }
  .g .sm-detail { align-self: end; z-index: 1; margin: 8px; min-height: 0; max-height: 50%; overflow: auto; padding: 12px; }
  .g .sm-detail.idle { display: none; }
  .g .akte-line { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .g .dialog-wrap:has(.dialog.akte.leader) { padding: 8px; }
  .g .dialog.akte.leader { padding: 12px; max-height: calc(100vh - 16px); }
  .g .tabs { flex-wrap: wrap; }
  .g .tab { padding: 6px 8px 4px; }
}
.g .chronicle { border-top: 2px solid var(--paper-ink); padding-top: 10px; margin: 14px 0; }
.g .chronicle ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.g .deed .effect { display: block; font-size: 12px; color: var(--paper-mute); }
.g .deed:not(.done) { color: var(--paper-mute); }
.g .relic { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border: 2px solid var(--paper-ink); }
.g .relic .effect { font-size: 12px; color: var(--paper-mute); }
.g .relic .legend { font-size: 12px; }
.g .relic.shown { box-shadow: 4px 4px 0 var(--paper-ink); }
.g .relic.unknown { border-style: dashed; border-color: var(--paper-mute); color: var(--paper-mute); }
.g .relic .btn { align-self: flex-start; margin-top: 4px; }
.g .honor-roll { width: 100%; border-collapse: collapse; }
.g .honor-roll td, .g .honor-roll th { padding: 5px 8px; text-align: left; border-bottom: 2px solid var(--paper-2); }
.g .honor-roll .num { text-align: right; }
.g .honor-roll tr.me { font-weight: 700; }
.g .akte .btn.tiny, .g .akte .btn.small { background: var(--paper-ink); color: var(--paper); box-shadow: none; }
.g .akte .btn:disabled { background: transparent; color: var(--paper-mute); border-color: var(--paper-2); }
.g .akte .bar.ink { margin: 4px 0; }

/* Gefecht über WATCH */
.g .wave-banner { position: absolute; top: 92px; left: 50%; transform: translateX(-50%); font: 400 48px/48px var(--head); color: var(--sand-50); text-shadow: 3px 3px 0 var(--ink); pointer-events: none; }
.g .hud-leave { position: absolute; right: 270px; bottom: 14px; pointer-events: auto; }

/* Gründung und Erbfolge */
.g .create-card { width: min(720px, calc(100vw - 48px)); }
.g .create-row { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: start; margin: 8px 0 12px; }
.g .create-photo { display: grid; gap: 6px; justify-items: center; }
.g .create-photo .photo { width: 150px; }
.g .create-photo .photo-caption { font-size: 20px; margin: 4px 0; }
.g .origins { grid-template-columns: 1fr; }
.g .succ-grid { display: grid; grid-template-columns: 300px 1fr; gap: 40px; margin-top: 28px; }
.g .succession h2 { font-size: 32px; color: var(--sand-50); margin-bottom: 10px; }
.g .succession h2.mt { margin-top: 24px; }
.g .succession .kicker { margin-bottom: 10px; }
.g .succ-foot { margin-top: 30px; }
@media (max-width: 900px) {
  .g .top { gap: 10px 16px; padding: 8px 10px; }
  .g .top-stats { flex-wrap: wrap; gap: 8px 16px; }
  .g .top-nav { flex-wrap: wrap; }
  .g .map-zoom { display: none; }
  .g .map-mini-canvas { width: 36px; height: 110px; }
  .g .map-hints { max-width: calc(100% - 150px); }
  .g .map-legend { width: min(300px, calc(100vw - 40px)); }
  .g .world-main { grid-template-columns: 1fr; grid-template-rows: 60vh auto; overflow: auto; }
  .g .top { flex-wrap: wrap; }
  .g .succ-grid, .g .create-row { grid-template-columns: 1fr; }
}
.g .succ-head + p { margin-top: 18px; }

/* ---------- Leiste „Nächster Schritt“ (ui/next-step.ts) ---------- */
.g .next-step { display: flex; align-items: center; gap: 12px; padding: 6px 16px; background: var(--olive-900);
  border-bottom: 2px solid var(--gun-600); }
.g .next-step-label { font: 700 12px/1 var(--head); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); white-space: nowrap; }
.g .next-step p { flex: 1; font-size: 14px; }
.g .dialog.diplo { width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto; }
.g .diplo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g .diplo-item { display: grid; grid-template-columns: minmax(120px, auto) 1fr auto auto; gap: 4px 12px; align-items: center; background: var(--gun-700); padding: 6px 10px; }
.g .diplo-form { display: grid; gap: 6px; border-top: 2px solid var(--gun-600); padding-top: 10px; }
.g .diplo-form input[type="text"] { flex: 1 1 240px; }
.g .diplo-form input[type="number"] { width: 90px; }
.g .chat-item.mine { border-left-color: var(--gun-500, var(--sand-300)); }
.g .diplo-lists { display: grid; gap: 8px; }
.g .diplo-lists h3 { margin: 6px 0 0; }
.g .diplo-form input:disabled { opacity: .45; }
.g .diplo-form input[type="number"] { padding: 2px 6px; }

/* Ton-Knopf unten rechts (audio/control.ts) und Klangprobe (?klang=1, audio/probe.ts) */
.audio-ctl { position: fixed; right: 8px; bottom: 8px; z-index: 40; display: grid; gap: 4px; justify-items: end; }
.g .audio-toggle.off { color: var(--sand-500); background: var(--gun-700); box-shadow: inset 2px 2px 0 var(--gun-600), inset -2px -2px 0 var(--gun-800); }
.g .audio-panel { width: 220px; padding: 10px; display: grid; gap: 8px; background: var(--gun-800); border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--gun-600), inset -2px -2px 0 var(--gun-900); }
.g .audio-panel[hidden] { display: none; }
.g .audio-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; font-size: 13px; color: var(--sand-100); }
.g .audio-row input { width: 100%; accent-color: var(--gold); }
.g .audio-panel p { margin: 0; }
.g.probe { overflow: auto; background: var(--gun-900); color: var(--sand-100); }
.g .probe-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 96px; display: grid; gap: 16px; }
.g .probe-main h1 { font: 48px/48px var(--head); margin: 0; }
.g .probe-sec h2 { font: 32px/24px var(--head); margin: 0 0 8px; color: var(--sand-300); }
.g .probe-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.g .probe-line { min-height: 24px; margin: 0; }
.g .probe-meter { width: 240px; }
.g[data-screen="battle"] .audio-ctl { right: 360px; bottom: 14px; }
/* Aufgaben (ui/quests.ts) */
.g .k-quest { border-left-color: var(--gold); } .g .k-quest .log-kind { color: var(--gold); }
.g .dialog.quests { width: min(640px, 100%); max-height: calc(100vh - 48px); overflow: auto; }
.g .quest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.g .quest { display: grid; gap: 4px; background: var(--gun-700); padding: 8px 10px; }
.g .quest.lead { border-left: 4px solid var(--gold); }
.g .quest-area { font: 700 12px/1 var(--head); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.g .quest-text { margin: 0; font-size: 14px; }
.g .quest-line { margin: 0; font-size: 14px; color: var(--sand-300); }
.g .quest-line strong { color: var(--sand-100); }
.g .quest .row { justify-content: space-between; align-items: center; gap: 8px; }
.g .quest .row > span { flex: 1; }
.g .probe-wrap { flex-wrap: wrap; }

/* ---------- Kompakte Kopfleiste für iPad und Handy (ui/map.ts, ui/next-step.ts) ----------
   Ziel: Die Karte bekommt den Großteil des Bildschirms. Kopfleiste in einer Zeile (iPad) bzw.
   zwei Zeilen (Handy), Menü quer wischbar statt umgebrochen, „Nächster Schritt“ einzeilig. */
@media (max-width: 1280px) {
  .g .top { flex-wrap: nowrap; gap: 14px; padding: 4px 10px; }
  .g .top-brand, .g .top-who .muted { display: none; }
  .g .top-who strong { white-space: nowrap; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
  .g .top-stats { flex: 0 1 auto; gap: 14px; flex-wrap: nowrap; min-width: 0; }
  .g .top .stat-label { font-size: 11px; }
  .g .stat-ruf { min-width: 70px; }
  .g .alarm { min-width: 90px; }
  .g .top-nav { margin-left: auto; flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .g .top-nav::-webkit-scrollbar { display: none; }
  .g .top-nav .btn { flex: 0 0 auto; white-space: nowrap; padding: 7px 9px; }
  .g .next-step { padding: 3px 10px; gap: 8px; }
  .g .next-step p { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
}
/* iPad hochkant: Karte und Ortsansicht nebeneinander, die Ortsansicht schmaler */
@media (min-width: 701px) and (max-width: 900px) {
  .g .world { grid-template-columns: minmax(0, 1fr); }
  .g .world-main { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: none; overflow: hidden; }
  .g .side-body { padding: 12px; }
}
/* Handy: Kennzahlen oben, Menü als wischbare Zeile darunter; die Karte füllt den Rest, von der
   Ortsansicht schaut nur der Kopf heraus (nach oben wischen zeigt sie ganz). */
@media (max-width: 1280px) { .g .top-stats > * { flex-shrink: 0; } }
@media (max-width: 900px) {
  .g .top { flex-wrap: wrap; row-gap: 4px; padding: 4px 8px; }
  .g .top-who strong { display: none; }
  .g .top-stats { gap: 10px; }
  .g .top-stats .stat-value { font-size: 32px; line-height: 20px; }
  .g .stat-ruf { min-width: 54px; }
  .g .alarm { min-width: 64px; }
  .g .alarm .alarm-n { font-size: 32px; line-height: 20px; }
  .g .top-nav { flex: 1 0 100%; margin-left: 0; gap: 4px; }
  .g .top-nav .btn { padding: 6px 8px; font-size: 12px; }
  .g .next-step-label { display: none; }
}
@media (max-width: 700px) {
  .g .world { grid-template-columns: minmax(0, 1fr); }
  .g .world-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: calc(100% - 56px) auto; overflow: auto; }
}
