/* Stil C "Graphit & Gold": sehr dunkel, Gold führt, Grün nur für den Status, feste Kanten.
   Pixel-Optik nur bei Icons, Köpfen und Logo. Alles lokal, nur Systemschriften. */
:root {
  color-scheme: dark;
  --g: #141518; --kopf: #1c1e22; --k: #23262b; --k2: #2d3037; --t: #f6f7f9; --l: #bcc2cd; --rand: #565c69;
  --gold: #f5b83d; --gold-t: #1c1303; --gruen: #4ade80; --gruen-t: #06230f; --rot: #ff7a6b; --rot-t: #ffb8ae;
  --java: #17324f; --java-t: #bcdcff; --bedrock: #123b2a; --bedrock-t: #a7f3d0; --log: #0e0f11; --r: 3px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --nav-hoehe: 66px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--g); }
body { margin: 0; background: var(--g); color: var(--t); font: 16px/1.5 var(--schrift); min-height: 100vh; }
h2 { margin: 0; font-size: 18px; line-height: 1.3; }
p { margin: 0; }
.leise { color: var(--l); font-size: 14px; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Kopfzeile */
.kopfzeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px)); background: var(--kopf); position: sticky; top: 0; z-index: 5; }
.marke { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; flex: none; }
.marke canvas { width: 24px; height: 24px; image-rendering: pixelated; }
.ich { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ich-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #5865f2; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.rolle { color: var(--gold); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; flex: none; }

/* Grundgerüst: am Handy Leiste unten, ab Tablet Icon-Leiste links */
.schale { display: block; }
.inhalt { max-width: 1100px; margin: 0 auto; padding: 12px max(12px, env(safe-area-inset-right, 0px)) calc(var(--nav-hoehe) + 20px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); min-width: 0; }
.tab { display: grid; gap: 12px; min-width: 0; }
nav { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; gap: 2px; padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); background: var(--kopf); border-top: 1px solid var(--rand); }
nav button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font: 600 12px var(--schrift); color: var(--l); background: transparent; border: 0; border-radius: var(--r); cursor: pointer; white-space: nowrap; }
nav button[aria-current="true"] { color: var(--gold-t); background: var(--gold); }
nav svg { width: 22px; height: 22px; shape-rendering: crispEdges; flex: none; }
@media (max-width: 359px) { nav button { font-size: 11px; } .marke span { display: none; } }
@media (max-width: 480px) { #abmelden { padding: 4px 8px; font-size: 13px; } .rolle { display: none; } }
@media (min-width: 760px) {
  .schale { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: start; }
  nav { position: sticky; top: 52px; bottom: auto; flex-direction: column; gap: 4px; padding: 10px 8px; border-top: 0; min-height: calc(100vh - 52px); }
  nav button { flex: none; padding: 10px 2px; }
  .inhalt { padding: 16px; width: 100%; }
}

/* Karten */
.karte { background: var(--k); border: 1px solid var(--rand); border-top: 3px solid var(--gold); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; min-width: 0; }
.titel { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; font-size: 13px; font-weight: 700; border-radius: var(--r); white-space: nowrap; }
.badge.an { color: var(--gruen-t); background: var(--gruen); }
.badge.an::before, .badge.aus::before, .badge.warte::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.badge.aus { color: #fff; background: #c8382a; }
.badge.warte { color: var(--gold-t); background: var(--gold); }
.badge.java { color: var(--java-t); background: var(--java); }
.badge.bedrock { color: var(--bedrock-t); background: var(--bedrock); }

.zahlen { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.zahl span { display: block; color: var(--l); font-size: 14px; }
.zahl strong { display: block; font-size: 28px; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 359px) { .zahl strong { font-size: 22px; } }
.wahl { display: flex; gap: 6px; }
.wahl button { font: 600 13px var(--schrift); padding: 3px 10px; color: var(--l); background: transparent; border: 1px solid var(--rand); border-radius: var(--r); cursor: pointer; }
.wahl button[aria-pressed="true"] { color: var(--gold-t); background: var(--gold); border-color: var(--gold); }
.graph { width: 100%; height: 124px; display: block; }
.graph text { fill: var(--l); font: 12px var(--schrift); }
.graph .linie { stroke: var(--gold); fill: none; stroke-width: 2.5; }
.graph .flaeche { fill: var(--gold); fill-opacity: .16; }
.graph .raster { stroke: var(--rand); }
.graph .ende { fill: var(--gold); }

.reihe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.knopf { font: 600 15px var(--schrift); padding: 8px 14px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; color: var(--gold-t); background: var(--gold); white-space: nowrap; text-decoration: none; display: inline-block; text-align: center; }
.knopf.zweit { color: var(--t); background: transparent; border-color: var(--rand); }
.knopf.gefahr { color: var(--rot-t); background: transparent; border-color: var(--rot); }
.knopf.klein { padding: 4px 10px; font-size: 14px; }
.knopf:hover:not(:disabled) { filter: brightness(1.12); }
.knopf:disabled, button:disabled { opacity: .55; cursor: wait; }

/* Spieler- und Nutzerzeilen: Kopf | Name | Badge | Knopf, immer einzeilig */
.liste { display: grid; gap: 6px; min-width: 0; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.zeile { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 10px; background: var(--k2); border-radius: var(--r); min-width: 0; min-height: 50px; }
.zeile.ohne { grid-template-columns: 28px minmax(0, 1fr) auto; }
.zeile.nutzer { grid-template-columns: minmax(0, 1fr) auto; }
.name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nutzer-text { min-width: 0; }
.unterzeile { display: block; color: var(--l); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-icon { width: 28px; height: 28px; image-rendering: pixelated; display: block; }
.kurz { display: none; }
@media (max-width: 440px) {
  .zeile { gap: 8px; padding: 8px; }
  .zeile .badge { padding: 2px 8px; font-size: 12px; }
  .zeile .knopf { padding: 6px 10px; }
  .zeile .lang { display: none; }
  .zeile .kurz { display: inline; }
  .zeile.nutzer { grid-template-columns: minmax(0, 1fr); }
}

/* Formulare */
.eingabe { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.eingabe .knopf { flex: none; }
input, select { font: inherit; color: var(--t); background: var(--k2); border: 1px solid var(--rand); border-radius: var(--r); padding: 8px 10px; min-width: 0; }
input { flex: 1 1 200px; }
input::placeholder { color: var(--l); opacity: .85; }
select { flex: 0 1 auto; max-width: 100%; }
.nutzer-form { display: grid; gap: 10px; min-width: 0; }
.haken { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 4px 12px; }
.haken label { display: flex; gap: 8px; align-items: center; min-width: 0; }
.haken input { flex: none; accent-color: var(--gold); }

/* Backups */
.backups { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.backup { background: var(--k2); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 4px; min-width: 0; align-content: start; }
.backup b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup .meta { color: var(--l); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup .notiz { color: var(--gold); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.backup .reihe { margin-top: 6px; }
.backup .knopf { padding: 6px 10px; font-size: 14px; }
.link { padding: 10px 12px; background: var(--k2); border-left: 4px solid var(--gold); overflow-wrap: anywhere; }
.link a { color: var(--gold); font-weight: 600; }
.lade { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--gold) 40%, transparent 40%); background-size: 200% 100%; animation: lauf 1.2s linear infinite; }
@keyframes lauf { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.platzhalter { height: 50px; background: linear-gradient(90deg, var(--k2) 40%, var(--k) 50%, var(--k2) 60%); background-size: 300% 100%; border-radius: var(--r); animation: schimmer 1.4s linear infinite; }
@keyframes schimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Log */
.log { background: var(--log); color: #e8eaee; border-radius: var(--r); padding: 10px; font: 13px/1.5 var(--mono); height: 52vh; overflow: auto; min-width: 0; }
.log div { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: start; }
.log .kopf-icon { width: 16px; height: 16px; margin-top: 2px; }
.log span { overflow-wrap: anywhere; min-width: 0; }
.antwort { margin: 0; background: var(--log); border-radius: var(--r); padding: 10px; font: 13px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow: auto; }

/* Verwaltung */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; background: var(--k2); border-radius: var(--r); font: 14px var(--mono); }
.chip button { font: 600 14px var(--schrift); color: var(--rot-t); background: transparent; border: 0; padding: 2px 6px; cursor: pointer; }
.audit { display: grid; gap: 6px; min-width: 0; }
.audit-zeile { background: var(--k2); border-radius: var(--r); padding: 8px 10px; min-width: 0; font-size: 14px; display: grid; gap: 2px; }
.audit-zeile b { overflow-wrap: anywhere; }
.audit-zeile span { color: var(--l); overflow-wrap: anywhere; }

/* Anmeldung, Dialog, Toasts */
.anmeldung { max-width: 420px; margin: 48px auto; padding: 0 16px; }
.anmeldung .karte { text-align: center; }
dialog { background: var(--k); color: var(--t); border: 1px solid var(--rand); border-top: 3px solid var(--gold); border-radius: var(--r); max-width: min(460px, calc(100vw - 32px)); }
dialog p { margin-bottom: 14px; overflow-wrap: anywhere; }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
#toasts { position: fixed; z-index: 20; right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(var(--nav-hoehe) + 12px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; width: min(340px, calc(100vw - 24px)); }
@media (min-width: 760px) { #toasts { bottom: 16px; } }
.toast { padding: 10px 14px; background: var(--k2); color: var(--t); border-radius: var(--r); border-left: 5px solid var(--gruen); box-shadow: 0 6px 20px rgba(0, 0, 0, .5); overflow-wrap: anywhere; animation: rein .18s ease-out; }
.toast.fehler { border-left-color: var(--rot); }
.toast.warte { border-left-color: var(--gold); }
@keyframes rein { from { transform: translateY(10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lade, .platzhalter, .toast { animation: none; } }
