:root {
  color-scheme: dark;
  --bg: #0d1015;
  --panel: #151a21;
  --panel-2: #1b212a;
  --line: #262e39;
  --text: #dde3ea;
  --muted: #8b95a4;
  --accent: #5eead4;
  --accent-ink: #062a25;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --hp: #ef6b6b;
  --food: #e0a84a;
  --xp: #7bd88f;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
body { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 3rem; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; letter-spacing: 0.02em; }
.brand svg { flex: none; }
.nav a {
  display: block; padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side .spacer { flex: 1; }
.side .who { padding: 8px 10px; color: var(--muted); font-size: 12px; }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1280px; width: 100%; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 15px; margin: 28px 0 10px; font-weight: 650; }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 70ch; }

@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .brand { padding: 0 8px 0 4px; }
  .nav { display: flex; gap: 2px; flex-wrap: wrap; }
  .side .spacer { display: none; }
  .side .who { margin-left: auto; padding: 0; }
}

/* ---------- Bausteine ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.tile .value { font-size: 26px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td:has(> .dot) { white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; line-height: 1.2;
}
.btn:hover { border-color: #3a4554; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input[type="text"], input[type="password"], input[type="search"], input[type="datetime-local"], select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 240px; max-width: 420px; min-width: 0; }

.dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 8px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); font-size: 12px; margin: 0 4px 4px 0; color: var(--muted);
}
.chip.on { color: var(--accent); border-color: rgba(94, 234, 212, 0.4); }
button.chip { cursor: pointer; }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; margin-right: 10px;
  font-weight: 650; font-size: 13px; color: #0b0e12; vertical-align: middle; flex: none;
}
.avatar.big { width: 52px; height: 52px; border-radius: 12px; font-size: 22px; margin-right: 0; }
.player-name { display: inline-flex; align-items: center; font-weight: 550; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; margin-left: 8px; }

.alert { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); margin-bottom: 16px; }
.alert.bad { border-color: rgba(248, 113, 113, 0.5); color: var(--bad); }
.alert.warn { border-color: rgba(251, 191, 36, 0.5); }
.alert.ok { border-color: rgba(74, 222, 128, 0.5); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.login .brand { padding: 0 0 16px; font-size: 18px; }

/* ---------- Spielerdetail ---------- */
.head { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.head .grow { flex: 1 1 280px; min-width: 0; }
.head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 10px; display: inline-block; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 24px 0 18px; overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.bar { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; border-radius: 99px; }
.meter { margin-bottom: 14px; }
.meter .row { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 13px; }

.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 200px 130px 1fr; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); align-items: baseline; }
.tl li:last-child { border-bottom: 0; }
.tl .t { color: var(--muted); font-family: var(--mono); font-size: 12.5px; }
.tl .k { font-weight: 550; }
.tl .k.state { color: var(--muted); font-weight: 400; }
.tl .d { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 700px) { .tl li { grid-template-columns: 1fr; gap: 2px; } }

.plot-wrap { position: relative; }
canvas.plot { width: 100%; height: 460px; display: block; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); }
.tip {
  position: absolute; pointer-events: none; background: #0a0d11; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px; font-size: 12px; font-family: var(--mono); white-space: nowrap; display: none; z-index: 3;
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 10px; align-items: center; }
.legend .grad { width: 90px; height: 6px; border-radius: 99px; background: linear-gradient(90deg, #284a47, var(--accent)); }

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a, .tile { transition: background-color 0.12s, border-color 0.12s, filter 0.12s; }
}

/* ---------- Inventar-Timeline ---------- */
.chip.on { color: var(--accent); border-color: rgba(94, 234, 212, 0.4); }
.inv-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 14px; align-items: start; }
@media (max-width: 980px) { .inv-layout { grid-template-columns: minmax(0, 1fr); } }
.inv-when { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; margin-bottom: 10px; }
.inv-slider { width: 100%; margin: 4px 0 12px; accent-color: var(--accent); }
.inv-controls { margin-bottom: 16px; }
.inv-board-box { overflow-x: auto; padding-bottom: 4px; }
.inv-board { display: inline-flex; gap: 14px; align-items: flex-start; }
.inv-side, .inv-main { display: flex; flex-direction: column; gap: 4px; }
.inv-side .gap { height: 10px; }
.inv-main .hotbar { margin-top: 10px; }
.slot-row { display: flex; gap: 4px; }
.slot {
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 7px;
  background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden;
}
.slot.full { background: hsl(var(--hue) 38% 24%); border-color: hsl(var(--hue) 40% 38%); }
.slot .ab { font-size: 13px; font-weight: 650; color: hsl(var(--hue) 70% 86%); letter-spacing: 0.02em; }
.slot .cnt { position: absolute; right: 3px; bottom: 1px; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000; }
.slot .dmg { position: absolute; left: 3px; top: 0; font-size: 11px; font-weight: 700; color: var(--warn); }
.slot.ench { box-shadow: inset 0 0 0 1px #a78bfa; }
.slot.chg { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.45); }
.slot.chg.ench { box-shadow: inset 0 0 0 1px #a78bfa, 0 0 0 2px rgba(94, 234, 212, 0.45); }
.slot.chg-empty { border: 1px dashed var(--accent); }
.inv-changes { margin-top: 16px; min-height: 40px; }
.inv-changes ul { margin: 0; padding-left: 18px; }
.inv-steps { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; position: relative; }
.inv-steps li { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 2px 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.inv-steps li:hover { background: var(--panel-2); }
.inv-steps li.cur { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.inv-steps .t { grid-row: span 2; color: var(--muted); font-family: var(--mono); font-size: 12.5px; }
.inv-steps .r { font-weight: 550; }
.inv-steps .c { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.custom-range input { width: auto; }

/* ---------- Minecraft-Icons ---------- */
.slot.has-icon { background: var(--panel-2); border-color: #333c49; }
.slot img.ico { width: 34px; height: 34px; image-rendering: pixelated; user-select: none; pointer-events: none; }
.hint { font-size: 12.5px; margin-bottom: 10px; }

/* Phase C: Bloecke und Kampf */
.named { display: inline-flex; align-items: center; gap: 8px; }
.mini { width: 20px; height: 20px; image-rendering: pixelated; flex: none; }
tr.click { cursor: pointer; }
tr.click:hover, tr.click:focus-visible { background: rgba(94, 234, 212, 0.08); outline: none; }
.tl .k.placed { color: var(--accent); }
.tl .d.dflex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Phase D: Karten */
canvas.plot.map { height: 540px; touch-action: none; cursor: crosshair; }
canvas.plot.map.grab { cursor: grabbing; }
canvas.plot.map:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-coord { position: absolute; left: 8px; top: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); background: rgba(13, 16, 21, 0.8); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.map-btns { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.rp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .rp-layout { grid-template-columns: 1fr; } }
.rp-main { min-width: 0; }
.rp-bar { display: flex; gap: 12px; align-items: center; margin: 12px 0 8px; }
.rp-slider { flex: 1; min-width: 0; accent-color: var(--accent); }
.rp-time { font-family: var(--mono); font-size: 13px; min-width: 170px; text-align: right; }
.rp-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rp-side { max-height: 640px; overflow-y: auto; }
.plist { display: flex; flex-direction: column; gap: 2px; }
.prow { display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; border-radius: 6px; }
.prow:hover { background: rgba(255, 255, 255, 0.04); }
.prow.off .pname { color: var(--muted); }
.prow .pname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.prow .pstate { font-size: 11.5px; }
.swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.ramp { width: 140px; height: 8px; border-radius: 99px; display: inline-block; }
.range-picker { display: flex; flex-direction: column; gap: 8px; }
.warn-text { color: var(--warn); }

/* ---- Seite Server: Diagramme ---- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; margin-top: 16px; }
.chart { min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; }
.chart-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.legend-item i.dash { height: 0; background: none !important; border-top: 2px dashed; }
.chart canvas.plot { width: 100%; display: block; cursor: crosshair; }
.chart .plot-wrap { position: relative; }
.plot-tip { position: absolute; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; z-index: 2; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
@media (max-width: 560px) { .chart-grid { grid-template-columns: 1fr; } }

/* ---- Hub: Teamangabe in der Spielerliste ---- */
.pteam { font-size: 12px; }

/* Auswertung eines Archivs */
.crumbs { margin: 0 0 4px; }
.linkbtn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; text-transform: inherit; }
.linkbtn:hover, .linkbtn.active { color: var(--accent, #5eead4); }
.barlist { display: grid; gap: 6px; }
.barrow { display: grid; grid-template-columns: minmax(90px, 35%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.barrow .barlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .barvalue { font-variant-numeric: tabular-nums; color: var(--muted); }

.tl li.hit { background: rgba(94, 234, 212, 0.07); }
.open-adv { margin-top: 8px; }
.open-adv summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
.tl.advl li { grid-template-columns: 110px minmax(160px, 260px) 1fr; }
@media (max-width: 700px) { .tl.advl li { grid-template-columns: 1fr; gap: 2px; } }
