/* ===========================================================================
   FuxelSMP Panel. Aufbau wie im Monitoring-POC: Seitenleiste, Kopfzeile mit Kennzahlen, Karten.
   Alle Farben stehen hier oben als Variablen, im Rest der Datei gibt es keine eigenen Farbwerte.

   Farbregeln (07.10.):
   - Grau trägt den Aufbau: Flächen, Linien, Kopfzeilen von Karten und Tabellen, Hover, Nebensachen.
     Die Grautöne sind neutral, ohne Braun- oder Blaustich, damit das Orange als einzige Farbe auffällt.
   - Orange heißt "hier passiert etwas": Hauptknöpfe, die gewählte Seite, gewählte Schalter und Zeilen,
     Fokus, Fortschritt und Links. Was nur angefasst wird (Hover), bleibt grau.
   - Ampelfarben nur für Zustände (läuft, wird eng, kaputt), nie als Schmuck.
   Keine Schriften von außen und nichts von einem CDN: Die Content-Security-Policy erlaubt nur
   eigene Dateien, und das Panel soll auch ohne fremde Dienste vollständig laden.
   =========================================================================== */

:root {
    /* Grau, von ganz hinten nach ganz vorne */
    --bg: #0f1012;
    --bg-sidebar: #141517;
    --surface: #191a1d;
    --surface-head: #1d1e21;
    --surface-2: #212225;
    --surface-3: #2a2c30;
    --surface-4: #34363b;
    --border: #2f3135;
    --border-soft: #25262a;
    --border-strong: #44474d;

    --text: #ececee;
    --text-muted: #a3a6ad;
    --text-dim: #6f727a;
    /* Alter Name, linechart.js liest ihn noch. */
    --muted: var(--text-muted);

    /* Orange von FuxelSMP. accent-2 ist ein helleres Orange für Verläufe, Links und Markierungen, kein Gelb mehr,
       sonst verwechselt man es mit der Warnfarbe. */
    --accent: #fb701f;
    --accent-2: #ff9a4a;
    --accent-strong: #ff8536;
    --accent-gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
    --accent-soft: rgba(251, 112, 31, .13);
    --accent-line: rgba(251, 112, 31, .45);
    --accent-glow: rgba(251, 112, 31, .25);
    --accent-text: #ffbf94;
    --on-accent: #1a0d03;

    --ok: #3fb950;
    --warn: #d2a21a;
    --danger: #e5484d;
    --ok-soft: rgba(63, 185, 80, .12);
    --warn-soft: rgba(210, 162, 26, .12);
    --danger-soft: rgba(229, 72, 77, .1);

    /* Diagramme: die Hauptlinie orange, Vergleichslinien grau. panel.js liest sie. */
    --chart-1: #fb701f;
    --chart-2: #c6c9cf;
    --chart-3: #80848c;
    --chart-grid: #26282b;

    /* Lag-Karte: vier Stützstellen von ruhig bis überlastet, heatmap.js liest sie. Als Hex, common.js rechnet
       damit. */
    --heat-0: #1a3a2c;
    --heat-1: #3fb950;
    --heat-2: #d2a21a;
    --heat-3: #e5484d;
    --map-bg: #0b0c0d;
    --map-axis: rgba(251, 112, 31, .2);
    --map-grid: rgba(0, 0, 0, .35);
    --map-hover: rgba(236, 236, 238, .75);
    --map-pinned: #ff9a4a;
    /* Schleier über der Karte unter der Lag-Ebene, damit die Felder darüber gewinnen. */
    --map-veil: rgba(11, 12, 13, .3);

    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 236px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .28);
    /* Feine helle Oberkante auf Karten, damit sie sich vom grauen Grund abheben, ohne stärkeren Rand. */
    --edge: inset 0 1px 0 rgba(255, 255, 255, .035);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Eigene display-Angaben schlagen sonst die Regel des Browsers für [hidden]. Ein- und ausgeblendet wird überall
   mit dem Attribut, also muss es gewinnen. */
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    scrollbar-color: var(--surface-4) transparent;
}

.nav, .content, .table-wrap, .inspector { scrollbar-width: thin; }

::selection { background: var(--accent-line); color: var(--text); }

/* Fokus nur bei Tastatur, dann aber deutlich und immer orange. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

svg { stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

a { color: var(--accent-2); }
a:hover { color: var(--accent-text); }

code {
    font-family: var(--mono);
    font-size: .92em;
    background: var(--surface-3);
    border-radius: 4px;
    padding: 1px 5px;
}

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.good, .is-ok { color: var(--ok); }
.warn, .is-warn { color: var(--warn); }
.bad, .is-danger { color: var(--danger); }

/* ------------------------------- Grundraster ------------------------------ */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100%;
}

/* -------------------------------- Seitenleiste ---------------------------- */

.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform .18s ease;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 20px; }

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent-gradient);
    color: var(--on-accent);
    font-weight: 800;
    display: grid;
    place-items: center;
    flex: none;
    box-shadow: 0 2px 10px var(--accent-glow);
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 14px; letter-spacing: .2px; }
.brand-text span { font-size: 11.5px; color: var(--text-dim); }

.nav { flex: 1; padding: 0 10px; overflow-y: auto; }

.nav-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 14px 10px 7px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    text-decoration: none;
}

.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }

.nav-item.is-active {
    background: var(--accent-soft);
    color: var(--accent-text);
    box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item.is-active svg { color: var(--accent); }

.sidebar-foot {
    padding: 14px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12.5px;
}

.viewer-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------- Kopfzeile ------------------------------ */

.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    min-height: 58px;
    flex: none;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

.page-title { font-size: 15px; font-weight: 600; margin: 0; }

.icon-btn {
    width: 32px;
    height: 32px;
    display: none;
    place-items: center;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    flex: none;
}

.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border); }

.pills { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; padding: 8px 0; }

.pill {
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding: 5px 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12.5px;
    white-space: nowrap;
}

.pill-key { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.pill-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.pill.is-ok .pill-value { color: var(--ok); }
.pill.is-warn .pill-value { color: var(--warn); }
.pill.is-danger .pill-value { color: var(--danger); }
.pill.is-danger { border-color: var(--danger); background: var(--danger-soft); }

.pill-status { align-items: center; }
.pill-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.pill-status.is-live .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* ---------------------------------- Inhalt -------------------------------- */

.content { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }

.view { display: flex; flex-direction: column; gap: 16px; }
.view-map { flex: 1; min-height: 520px; }

.banner {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--danger-soft);
    border: 1px solid var(--danger);
    color: var(--text);
}

.banner-info { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }

/* ---------------------------------- Karten -------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--edge), var(--shadow);
    overflow: hidden;
}

/* Die graue Kopfzeile trennt Titel und Inhalt, ohne dass jede Karte einen farbigen Rand braucht. */
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: var(--surface-head);
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

/* Der kleine orange Balken ist das wiederkehrende Erkennungszeichen: Jede Karte hat einen, sonst ist nichts dort
   orange. */
.card-head h2 { font-size: 14px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 9px; }
.card-head h2::before {
    content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); flex: none;
}
.card-head .card-sub { padding-left: 12px; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.card-body { padding: 16px 18px; }
.card-foot {
    padding: 10px 18px; border-top: 1px solid var(--border-soft); font-size: 12.5px; color: var(--text-muted);
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Kacheln je Server */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.server-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.server-name { font-weight: 650; font-size: 15px; }

.values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; margin-top: 14px; }
.value-number { font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.value-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
}

.badge-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.badge-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.badge-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.badge-dim { color: var(--text-dim); border-color: var(--border); background: var(--surface-3); }

/* -------------------------------- Diagramme ------------------------------- */

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border-soft); }
.chart { margin: 0; background: var(--surface); padding: 12px 14px 8px; }
.chart figcaption { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.chart canvas { width: 100%; height: 200px; display: block; }

/* ----------------------------- Bedienelemente ----------------------------- */

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.select, .input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    padding: 6px 10px;
    min-width: 0;
}

.select { cursor: pointer; }
.select:hover, .input:hover { border-color: var(--border-strong); }
.select:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }

.segmented {
    display: flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.segmented button {
    background: none;
    border: 0;
    border-radius: 6px;
    color: var(--text-muted);
    font: inherit;
    font-size: 12.5px;
    padding: 4px 11px;
    cursor: pointer;
}

.segmented button:hover { color: var(--text); background: var(--surface-3); }
.segmented button.is-active {
    background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-line);
}

.btn {
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    white-space: nowrap;
}

.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary {
    background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-quiet { background: none; color: var(--text-muted); padding: 4px 0; border: 0; text-align: left; }
.btn-quiet:hover:not(:disabled) { color: var(--text); }

/* Filter für Chatlog und CoreProtect */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    align-items: end;
}

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.field-wide { grid-column: span 2; }
.field-actions { display: flex; gap: 8px; align-items: end; }

.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; grid-column: 1 / -1; font-size: 12.5px; }
.checks label { display: flex; align-items: center; gap: 5px; color: var(--text-muted); cursor: pointer; }
.checks input { accent-color: var(--accent); }

/* Schalter in einem Feld (Kristalle: Gutschreiben/Abziehen). Die Karte schneidet ab, was übersteht, deshalb dürfen
   die Knöpfe umbrechen und teilen sich die Breite. */
.field .segmented { flex-wrap: wrap; }
.field .segmented button { flex: 1 1 auto; white-space: nowrap; }

/* Filter, die in einer Karte untereinander stehen, ohne Trennlinie dazwischen (Chatfilter). */
.filters-flat { border-bottom: 0; padding-bottom: 6px; }
.filter-penalty-hint { margin: 0; padding: 0 18px 10px; font-size: 12px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* --------------------------------- Tabellen ------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 10px 14px;
    background: var(--surface-head);
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    vertical-align: top;
}

.table td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 260px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }
.table .mono { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.table .empty-row td { text-align: center; color: var(--text-dim); padding: 26px; white-space: normal; }
.row-cancelled td { color: var(--text-dim); }

.heat-cell { display: flex; align-items: center; gap: 9px; }
.heat-swatch { width: 9px; height: 22px; border-radius: 3px; flex: none; }

/* ---------------------------------- Lag-Karte ----------------------------- */

.card-flush { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.map-body { display: grid; grid-template-columns: 1fr 272px; flex: 1; min-height: 420px; }
.map-canvas-wrap { position: relative; background: var(--map-bg); overflow: hidden; min-height: 420px; }
/* touch-action: Auf dem Handy verschiebt ein Wischen die Karte, nicht die Seite. */
.map-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    position: absolute;
    inset: 0;
    touch-action: none;
}
.map-canvas-wrap canvas.is-panning { cursor: grabbing; }

.map-hud, .scale-legend {
    position: absolute;
    left: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 11.5px;
    color: var(--text-muted);
    pointer-events: none;
}

.map-hud {
    top: 12px;
    font-family: var(--mono);
    max-width: calc(100% - 70px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scale-legend { bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--text-dim); }

.scale-bar {
    width: 118px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--heat-0) 0%, var(--heat-1) 22%, var(--heat-2) 60%, var(--heat-3) 100%);
}

.map-zoom {
    position: absolute;
    right: 12px;
    top: 12px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
    background: var(--border);
}

.map-zoom button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
}

.map-zoom button svg { width: 15px; height: 15px; }
.map-zoom button:hover { background: var(--surface-3); color: var(--accent-text); }

.inspector { border-left: 1px solid var(--border-soft); background: var(--surface-2); padding: 16px; overflow-y: auto; }

.inspector-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
    text-align: center;
    font-size: 12.5px;
    padding: 0 12px;
}

.insp-title { font-size: 13px; font-weight: 600; margin: 0 0 2px; }
.insp-coords { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); margin-bottom: 14px; }
.insp-gauge { margin-bottom: 16px; }
.insp-gauge .value { font-size: 27px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.insp-gauge .label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); }
.insp-bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 7px; }
.insp-bar > i { display: block; height: 100%; border-radius: 3px; }

.insp-section {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-dim);
    margin: 16px 0 7px;
}

.insp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: 12.5px;
    border-bottom: 1px solid var(--border-soft);
}

.insp-row:last-child { border-bottom: 0; }
.insp-row span { color: var(--text-muted); }
.insp-row b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------- Karte --------------------------------- */

/* Ziehen verschiebt die Karte, ein Klick hält eine Stelle fest. */
#map-canvas { cursor: grab; }
#map-canvas.is-panning { cursor: grabbing; }
.btn[aria-pressed="true"] { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-soft); }

/* -------------------------------- Eingebettet ----------------------------- */

.frame {
    width: 100%; flex: 1; min-height: 640px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface);
}

.server-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

.server-row:last-child { border-bottom: 0; }
.server-row .state { flex: 1; min-width: 200px; font-size: 12.5px; }

/* --------------------------------- Anmeldung ------------------------------ */

.notice-page { display: grid; place-items: center; min-height: 100%; padding: 24px; }

.notice {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    text-align: center;
}

.notice .brand-mark { margin: 0 auto 16px; width: 42px; height: 42px; font-size: 20px; border-radius: 11px; }
.notice h1 { font-size: 17px; margin: 0 0 8px; }
.notice p { margin: 0; color: var(--text-muted); font-size: 13.5px; }

.spinner {
    width: 22px;
    height: 22px;
    margin: 18px auto 0;
    border: 3px solid var(--surface-3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------- Spieler und Kristalle ------------------------ */

/* Mehrere Karten untereinander innerhalb eines Bereichs, etwa die Spielerakte unter der Suche. */
.stack { display: flex; flex-direction: column; gap: 16px; }
.mono-sub { font-family: var(--mono); font-size: 11.5px; }
/* Kleiner Balken in Tabellenzellen, etwa Buchungen je Tag. Die Breite setzt players.js. */
.cell-bar { width: 120px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.cell-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.table td a { text-decoration: none; }
.table td a:hover { text-decoration: underline; }

/* --------------------------------- Turniere ------------------------------- */

.tour-countdown { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent-text); }
.tour-board { display: grid; grid-template-columns: minmax(260px, 1fr) 1.4fr; }
.tour-side { padding: 16px 18px; border-right: 1px solid var(--border-soft); }
.tour-h3 {
    margin: 18px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-dim);
}
.tour-goal { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-bottom: 10px; font-size: 13px; }
.tour-goal .muted { font-size: 12px; }
.tour-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.tour-bar > i { display: block; height: 100%; background: var(--accent-gradient); }
.tour-bar.is-done > i { background: var(--ok); }
.tour-prizes { display: flex; flex-wrap: wrap; gap: 6px; }
.tour-ranking .table td:first-child { color: var(--text-muted); }
.tour-correct { border-top: 1px solid var(--border-soft); border-bottom: 0; }
.tour-template { min-width: 220px; }
.tour-now { grid-column: auto; align-self: end; padding-bottom: 7px; }

/* Zeitleiste: Die Lage der Balken setzt tournaments.js über style.left und style.width, als Prozent. */
.tour-timeline {
    position: relative; height: 44px; border-radius: var(--radius-sm); background: var(--surface-2);
    border: 1px solid var(--border-soft);
}
.tour-slot {
    position: absolute; top: 6px; bottom: 6px; min-width: 6px; border-radius: 6px; padding: 0 8px;
    background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text);
    font-size: 12px; line-height: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tour-slot.is-running { background: var(--ok-soft); border-color: var(--ok); color: var(--text); }
.tour-now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent-2); }
.tour-axis { position: relative; height: 18px; margin-top: 4px; font-size: 11px; color: var(--text-dim); }
.tour-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tour-problems { margin: 0; padding-left: 18px; color: var(--danger); }
.tour-problems li { margin: 2px 0; }

/* ------------------------------- Moderation ------------------------------- */
/* Strafen, Reports, Notizen und Teamprotokoll (moderation.js). Nur Variablen von oben, keine eigenen Farben. */

.banner-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--text); }
a.btn { display: inline-block; text-decoration: none; }

.mod-subhead {
    padding: 10px 18px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-dim);
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}

.mod-split { border-top: 1px solid var(--border-soft); }
.mod-inline { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; }
.field-grow { flex: 1 1 260px; }
.mod-hint { margin: 8px 0 0; font-size: 12.5px; }
.mod-label { margin: 0 0 8px; font-size: 12px; color: var(--text-muted); }

.mod-offences { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 12px; }
.mod-offence {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.mod-offence.is-chosen { border-color: var(--accent-line); background: var(--accent-soft); }
.mod-offence label { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.mod-offence input { accent-color: var(--accent); }
.mod-offence .select { padding: 3px 6px; font-size: 12px; }
.mod-points { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.mod-options { margin-top: 12px; }
.mod-preview { border-top: 1px solid var(--border-soft); background: var(--surface-2); }

.facts dd.wrap { overflow-wrap: anywhere; white-space: pre-wrap; }
.table tbody tr.is-link { cursor: pointer; }
.table tbody tr.is-selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

/* ---------------------------------- Schmied ------------------------------- */

.smith-tools { display: flex; flex-direction: column; gap: 16px; }
.smith-table td { vertical-align: top; }
.smith-default { margin-top: 2px; font-size: 12px; color: var(--text-dim); }
.smith-actions { display: flex; gap: 6px; justify-content: flex-end; }
.smith-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.smith-item { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.smith-item .input:first-child { flex: 1 1 220px; }
.smith-amount { width: 90px; }

/* ---------------------------------- Schmal -------------------------------- */

@media (max-width: 1080px) {
    .map-body { grid-template-columns: 1fr; }
    .inspector { border-left: 0; border-top: 1px solid var(--border-soft); max-height: 280px; }
    .pair, .charts { grid-template-columns: 1fr; }
    .tour-board { grid-template-columns: 1fr; }
    .tour-side { border-right: 0; border-bottom: 1px solid var(--border-soft); }
}

@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 30; width: var(--sidebar-w); height: 100%; transform: translateX(-100%); }
    .app.is-open .sidebar { transform: none; box-shadow: var(--shadow); }
    .icon-btn { display: grid; }
    .content { padding: 14px; }
    .pills .pill:not(.pill-status):not(#pill-tps) { display: none; }
    .field-wide { grid-column: auto; }
}

/* ------------------------- Spielerköpfe, Rechtsklick ---------------------- */
/* Köpfe kommen über /api/players/head (HeadCache). Pixelig gerendert, wie in Minecraft. */

.head { display: block; width: 24px; height: 24px; image-rendering: pixelated; object-fit: contain; }
.head-large { width: 48px; height: 48px; }
.table th.head-col, .table td.head-col { width: 40px; padding-right: 0; }
.file-title { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Nur für Vorleseprogramme, etwa der Kopf der Spalte mit den Köpfen. */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Rechtsklick-Menue auf den Karten (common.js) */
.context-menu {
    position: fixed;
    z-index: 50;
    min-width: 200px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.context-menu button {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.context-menu button:hover, .context-menu button:focus-visible { background: var(--surface-3); outline: none; }
.context-menu-sub { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }
/* Gesperrter Eintrag im Rechtsklick-Menü, etwa wenn das Teammitglied nicht online ist (V052). */
.context-menu button:disabled { cursor: default; color: var(--text-muted); }
.context-menu button:disabled:hover { background: none; }

/* "Hierher teleportieren" im Inspektor von Karte und Lag-Karte (common.js, V052) */
.teleport-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.teleport-button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; white-space: normal; }
.teleport-where { font-family: var(--mono); font-size: 11.5px; font-weight: 500; opacity: .85; }
.teleport-reason { margin: 0; font-size: 12px; color: var(--text-muted); }
.context-menu .teleport-reason { color: var(--warn); }

/* Gefährliche Knöpfe, etwa Bannen (ban.js). */
.btn-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Ein Name als Knopf, sieht aus wie ein Link (OreSpy). */
.link-button {
    background: none; border: 0; padding: 0; font: inherit; color: var(--accent-2); cursor: pointer; text-align: left;
}
.link-button:hover { text-decoration: underline; }

/* Schmale Eingabe für eine Zahl in einer Tabelle (Einstellungen). */
.input-narrow { width: 7.5em; }
.smith-actions .input-narrow { margin-right: 6px; }

/* Dialog "Bannen" (ban.js) */
.dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 18px 20px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { margin: 0; font-size: 16px; }
.dialog .card-sub { margin: 0; }
.dialog textarea { resize: vertical; }
.dialog .banner { margin: 0; }
.dialog-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
