/* Dungeonslayers 4 — Digitaler Charakterbogen */

:root {
    /* Papier & Tinte. Die Vorlage ist das gedruckte Regelwerk, nicht eine
       dunkle Fantasy-Website: helles Blatt, schwarze Tinte, EIN Akzent
       (Stempelrot) fuer alles, was blutet oder danebengeht. Georgia bleibt,
       weil das DS4-Regelwerk selbst in Georgia gesetzt ist. */
    --bg: #ddd6c6;              /* Tischplatte rundherum */
    --bg-alt: #d3cbb9;
    --panel: #f3eee2;           /* das Blatt */
    --panel-border: #1b1714;    /* gezogene Linie, kein Schimmer */
    --panel-border-strong: #1b1714;
    --text: #1b1714;            /* Tinte */
    --text-dim: #6f6558;        /* Bleistift */
    --accent: #a3342b;          /* Stempelrot */
    --accent-bright: #8c2b22;
    --blood: #a3342b;
    --success: #3f6b2e;
    --fail: #a3342b;
    --crit: #1b1714;            /* Immersieg wirkt durch Gewicht, nicht durch Farbe */
    --patzer: #8c2b22;
    --shadow: 3px 3px 0 rgba(var(--tint-rgb), 0.0375);
    --radius: 0px;

    /* Druck statt Leuchten: harter Versatz wie ein gesetzter Block, keine
       Verlaeufe, kein Glow. --ink hiess frueher "tiefer als bg" und meint
       jetzt die leicht abgesetzte, eingelassene Flaeche. */
    /* Grundtoene als Zahlentripel, damit rgba() sie mit eigener Deckung nutzen
       kann. --tint kippt im Nachtmodus (Tinte auf Papier wird Licht auf Tinte),
       --schatten bleibt in beiden Modi dunkel. */
    --tint-rgb: 27, 23, 20;
    --papier-rgb: 243, 238, 226;
    --schatten-rgb: 27, 23, 20;

    /* Leinwandfarben — battlemap.js liest genau diese Namen aus. */
    --karte-blatt: #f3eee2;
    --karte-tinte: #1b1714;
    --karte-stempel: #a3342b;
    --karte-mess: #3f6b2e;
    --karte-raster: rgba(27, 23, 20, 0.18);
    --karte-schleier: rgba(27, 23, 20, 0.10);
    --karte-beschriftung: rgba(243, 238, 226, 0.92);
    --karte-umriss: rgba(27, 23, 20, 0.7);
    --karte-nebelVoll: #b7afa0;
    --karte-nebelHalb: rgba(150, 142, 128, 0.66);

    --schrift: Georgia, 'Times New Roman', serif;
    --schrift-eng: 'Courier New', Courier, monospace;

    --ink: #e4ddcd;
    --sheen: rgba(var(--tint-rgb), 0.0125);
    --gold-line: #1b1714;
    --glow-gold: none;
    --shadow-panel: 3px 3px 0 rgba(var(--tint-rgb), 0.14);
    --inset-deep: inset 0 1px 3px rgba(var(--tint-rgb), 0.10);
}

/* ---------- Nachtmodus: dieselbe Typografie, dasselbe Raster, dieselben
   Symbole — nur andere Tinte. Am abgedunkelten Spieltisch blendet ein helles
   Blatt; hier liegt derselbe Bogen dann in dunklem Papier vor. Umgeschaltet
   wird ueber <html data-ton="nacht">, gesetzt von ton.js. ---------- */

html[data-ton="nacht"] {
    --bg: #131110;
    --bg-alt: #1a1715;
    --panel: #1c1917;
    --panel-border: #3a332c;
    --panel-border-strong: #4d443a;
    --text: #e9e1d3;
    --text-dim: #8a8175;
    --accent: #c0392b;
    --accent-bright: #d8543f;
    --blood: #c0392b;
    --success: #6a9c4e;
    --fail: #c0392b;
    --crit: #e9e1d3;
    --patzer: #d8543f;
    --shadow: 3px 3px 0 rgba(0, 0, 0, 0.40);
    --shadow-panel: 3px 3px 0 rgba(0, 0, 0, 0.38);
    --inset-deep: inset 0 1px 3px rgba(0, 0, 0, 0.45);
    --ink: #16130f;
    --sheen: rgba(233, 225, 211, 0.05);
    --gold-line: #4d443a;

    --tint-rgb: 233, 225, 211;
    --papier-rgb: 28, 25, 23;
    --schatten-rgb: 0, 0, 0;

    --karte-blatt: #16130f;
    --karte-tinte: #e9e1d3;
    --karte-stempel: #c0392b;
    --karte-mess: #6a9c4e;
    --karte-raster: rgba(233, 225, 211, 0.16);
    --karte-schleier: rgba(233, 225, 211, 0.08);
    --karte-beschriftung: rgba(20, 17, 15, 0.92);
    --karte-umriss: rgba(233, 225, 211, 0.55);
    --karte-nebelVoll: #0d0b09;
    --karte-nebelHalb: rgba(10, 8, 6, 0.66);
}

/* Das Kopfbild traegt nachts einen dunklen Schleier statt eines hellen. */
html[data-ton="nacht"] .hero {
    background:
        linear-gradient(90deg, var(--panel) 0 24%, rgba(28, 25, 23, 0.86) 46%, rgba(28, 25, 23, 0.42) 100%),
        url('img/titelbild.jpg?v=20260830l') 25% 70% / cover no-repeat,
        var(--panel);
}


* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--schrift);
    background: var(--bg);
    /* Papiernarbe statt Vignette: feine Laufrichtung wie bei geschoepftem
       Papier, so schwach, dass sie nur als Textur wirkt. */
    background-image:
        repeating-linear-gradient(0deg, rgba(var(--tint-rgb), 0.014) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 0%, rgba(var(--tint-rgb), 0.03), transparent 60%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

h1, h2, h3, h4 { font-family: var(--schrift); font-weight: 600; letter-spacing: 0.02em; }

::selection { background: rgba(163, 52, 43, 0.35); color: var(--text); }

/* Wer Bewegung reduziert haben will, bekommt keine Animationen */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dunkle, schmale Scrollbalken mit Goldakzent */
* { scrollbar-width: thin; scrollbar-color: rgba(163, 52, 43, 0.45) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
    background: rgba(163, 52, 43, 0.12);
    border-radius: 0;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(163, 52, 43, 0.55); background-clip: padding-box; }

button { font-family: inherit; cursor: pointer; }

input, select, textarea {
    font-family: inherit;
    background: rgba(var(--tint-rgb), 0.14);
    border: 1px solid var(--panel-border);
    color: var(--text);
    padding: 0.4rem 0.55rem;
    border-radius: 0;
    outline: none;
    font-size: 0.92rem;
    box-shadow: inset 0 1px 4px rgba(var(--schatten-rgb), 0.126);
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: inset 0 1px 4px rgba(var(--schatten-rgb), 0.126), 0 0 0 3px rgba(163, 52, 43, 0.18);
}
input[type=number] { width: 100%; }
/* Die winzigen nativen Hoch/Runter-Pfeile sind schlecht lesbar und je nach
   Browser anders — überall aus. Wo ±1 die eigentliche Bedienung ist, steht
   stattdessen ein .num-stepper mit − / + davor und dahinter. */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select option { background: var(--panel); }

/* Einheitlicher Gold-Chevron statt des Browser-Standardpfeils */
select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    padding-right: 1.9rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23d4a24c' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
}
select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23f0c069' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* Die winzigen, dicht gepackten Selects im Kampf-Tracker behalten den
   nativen Pfeil — dort ist kein Platz für Extra-Padding. */
.combat-row select { appearance: auto; -webkit-appearance: auto; -moz-appearance: auto; padding-right: 0.3rem; background-image: none; }

.num-stepper { display: inline-flex; align-items: stretch; }
.num-stepper button {
    flex: none; width: 1.7rem; padding: 0; line-height: 1; font-size: 1rem;
    background: rgba(var(--tint-rgb), 0.12); border: 1px solid var(--panel-border);
    color: var(--text); cursor: pointer;
}
.num-stepper button:hover:not(:disabled) { background: rgba(120, 92, 46, 0.9); }
.num-stepper button:disabled { opacity: 0.3; cursor: not-allowed; }
.num-stepper button:first-child { border-radius: 0 0 0 4px; }
.num-stepper button:last-child { border-radius: 0 4px 4px 0; }
.num-stepper input[type=number] {
    width: auto; min-width: 2.4rem; flex: 1;
    border-radius: 0; border-left: 0; border-right: 0; text-align: center;
}
/* In einem .field (Flex-Spalte) soll der Stepper die volle Breite nehmen */
.field > .num-stepper { display: flex; width: 100%; }

/* ---------- Layout ---------- */

/* Kopfbild der Spieleransicht: gemaltes Titelbild, Text als scharfes HTML
   darüber. Verläufe halten den Namen lesbar, egal wie hell das Bild ist. */
.hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: clamp(112px, 14vw, 150px);
    padding: 1rem 1.4rem 0.9rem;
    /* Die Illustration wird behandelt wie ein gedruckter Holzschnitt: gegen den
       Papierton entfaerbt (luminosity), nach links hin unter einem Papierschleier
       weggeblendet. So steht der Kopf auf Papier statt im Bild. */
    background:
        linear-gradient(90deg, var(--panel) 0 24%, rgba(var(--papier-rgb), 0.86) 46%, rgba(var(--papier-rgb), 0.40) 100%),
        url('img/titelbild.jpg?v=20260830l') 25% 70% / cover no-repeat,
        var(--panel);
    background-blend-mode: normal, luminosity, normal;
    border-bottom: 2px solid var(--panel-border);
}
.hero-text h1 {
    font-size: clamp(1.6rem, 4.2vw, 2.6rem);
    color: var(--text);
    line-height: 1.05;
    letter-spacing: 0.01em;
}
.hero-text p {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--accent);
    display: inline-block;
    font-size: clamp(0.62rem, 1.4vw, 0.78rem);
    color: var(--text-dim);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-family: var(--schrift);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1.1rem;
    background: var(--panel);
    border-bottom: 1px solid var(--gold-line);
    box-shadow: 0 6px 20px rgba(var(--schatten-rgb), 0.126);
    position: sticky;
    top: 0;
    z-index: 50;
    flex-wrap: wrap;
}
.topbar .btn { padding: 0.38rem 0.72rem; font-size: 0.82rem; }
/* Im Dashboard trägt die Leiste selbst das Titelbild (stark abgedunkelt),
   weil dort kein Platz für ein eigenes Kopfbild-Band ist. */
#gm-dashboard .topbar {
    background:
        linear-gradient(rgba(var(--schatten-rgb), 0.72), rgba(var(--schatten-rgb), 0.72)),
        url('img/titelbild.jpg?v=20260830l') center 32% / cover no-repeat;
}
.topbar h1 {
    font-size: 1.25rem;
    color: var(--accent-bright);
    white-space: nowrap;
}
.topbar h1 small { display: block; font-size: 0.65rem; color: var(--text-dim); letter-spacing: 0.14em; text-transform: uppercase; font-family: var(--schrift); font-weight: normal; }
.topbar-actions { margin-left: auto; display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

.btn {
    background: var(--panel);
    border: 1px solid var(--panel-border-strong);
    color: var(--text);
    padding: 0.45rem 0.85rem;
    border-radius: 0;
    font-size: 0.85rem;
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.05), 0 1px 3px rgba(var(--schatten-rgb), 0.112);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.42em;
}
.btn:hover {
    background: linear-gradient(180deg, rgba(126, 96, 48, 0.97), rgba(var(--tint-rgb), 0.12));
    border-color: var(--accent);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.07), 0 2px 8px rgba(var(--schatten-rgb), 0.126);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.btn-primary {
    background: var(--text);
    border-color: var(--text);
    color: var(--panel);
    font-weight: 600;
}
.btn-primary:hover { background: var(--text-dim); border-color: var(--text-dim); }
.btn-danger { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.btn-danger:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.78rem; }
.btn-ghost { background: var(--ink); border-color: var(--panel-border); box-shadow: none; }
.btn-ghost:hover { background: var(--ink); }

.app { max-width: 1500px; margin: 0 auto; padding: 1.2rem; display: grid; grid-template-columns: 1fr 340px; gap: 1.2rem; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 1.2rem; min-width: 0; }
.col-side { display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 4.5rem; }

@media (max-width: 1100px) {
    .app { grid-template-columns: 1fr; }
    .col-side { position: static; }
}

.panel {
    position: relative;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"),
        var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel), inset 0 1px 0 var(--sheen);
    overflow: hidden;
}
.panel-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.62rem 0.95rem;
    background: linear-gradient(180deg, rgba(var(--tint-rgb), 0.12), rgba(var(--tint-rgb), 0.075));
    border-bottom: 1px solid var(--gold-line);
}
.panel-head h2, .panel-head h3 {
    font-size: 1.02rem;
    color: var(--accent-bright);
    letter-spacing: 0.035em;
    display: inline-flex;
    align-items: center;
}
.panel-head h2::before, .panel-head h3::before {
    content: "";
    width: 3px;
    height: 0.95em;
    margin-right: 0.55rem;
    border-radius: 0;
    background: var(--accent);
    box-shadow: none;
}
.panel-head .panel-actions { margin-left: auto; display: flex; gap: 0.4rem; }
.panel-body { padding: 0.9rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.7rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.7rem; }

.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }

/* Einmaliger Wurf-Bonus: fällt auf, solange er scharf ist */
#f-wurfbonus.wurfbonus-aktiv {
    border-color: var(--accent-bright);
    box-shadow: 0 0 0 2px rgba(200, 143, 56, 0.35);
    color: var(--accent-bright);
    font-weight: 600;
}

/* ---------- Attribute & Eigenschaften ---------- */

.attr-block {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 0.7rem;
    background:
        var(--panel);
    box-shadow: var(--inset-deep);
}
.attr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.attr-name {
    font-family: var(--schrift); font-size: 1.08rem; color: var(--accent-bright);
    letter-spacing: 0.03em;
}
.attr-value-wrap { display: flex; align-items: center; gap: 0.35rem; }
.attr-value {
    width: 3rem; text-align: center; font-size: 1.3rem; font-weight: bold;
    background: var(--ink); border: 1px solid var(--panel-border-strong);
    padding: 0.15rem; border-radius: 0; color: var(--accent-bright);
    box-shadow: inset 0 2px 6px rgba(var(--schatten-rgb), 0.168);
}
.eig-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.28rem 0; }
.eig-name { flex: 1; font-size: 0.88rem; }
.eig-abbr { font-size: 0.68rem; color: var(--text-dim); margin-left: 0.3rem; }
.eig-value {
    width: 3.4rem; text-align: center; font-weight: bold;
    display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1;
}
/* Herkunft des Wertes, z.B. "4+1" — bewusst klein und unter dem Zahlenwert,
   damit die große Zahl eindeutig der Rechenwert bleibt. */
.eig-herkunft { font-size: 0.62rem; font-weight: normal; color: var(--accent); opacity: 0.9; }
.eig-cap { font-size: 0.7rem; color: var(--text-dim); width: 2.4rem; text-align: right; }

.stepper { display: inline-flex; }
.stepper button {
    width: 1.5rem; height: 1.5rem; line-height: 1;
    background: rgba(var(--tint-rgb), 0.12); border: 1px solid var(--panel-border);
    color: var(--text); font-size: 0.95rem; border-radius: 0;
}
.stepper button:hover:not(:disabled) { background: rgba(120, 92, 46, 0.9); }
.stepper button:disabled { opacity: 0.3; cursor: not-allowed; }

.budget {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.82rem; padding: 0.4rem 0.7rem; border-radius: 0;
    background: var(--ink);
    border: 1px solid var(--panel-border);
    box-shadow: var(--inset-deep);
}
.budget strong { color: var(--accent-bright); font-size: 1rem; }
.budget.over { border-color: var(--fail); color: var(--accent); }
.budget.over strong { color: var(--fail); }
.budget.done { border-color: var(--success); }
.budget.done strong { color: var(--success); }

/* ---------- Kampfwerte ---------- */

.kampfwerte { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; }
.kw-card {
    background:
        var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 0.6rem;
    text-align: center;
    box-shadow: var(--inset-deep);
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.kw-card.rollable { cursor: pointer; }
.kw-card.rollable:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--inset-deep), 0 6px 18px rgba(var(--schatten-rgb), 0.126), var(--glow-gold);
}
.kw-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); }
.kw-value {
    font-size: 1.8rem; font-weight: bold; font-family: var(--schrift); line-height: 1.2;
    color: var(--accent-bright);
}
.kw-formula { font-size: 0.65rem; color: var(--text-dim); opacity: 0.75; }
/* Herkunft des Zauberbonus unter dem Wert — sonst sieht ein fehlender ZB
   wie ein Rechenfehler aus, obwohl er zum Zaubertyp schlicht nicht passt. */
.kw-zb {
    font-size: 0.62rem;
    line-height: 1.25;
    color: var(--text-dim);
    margin-top: 0.2rem;
}
.kw-talent { color: var(--accent); opacity: 1; font-weight: 600; }

/* Lebenskraft */
.lk-panel { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.lk-bar-wrap { flex: 1; min-width: 160px; }
.lk-bar-track {
    height: 16px; border-radius: 0; overflow: hidden;
    background: var(--ink);
    border: 1px solid var(--panel-border);
    box-shadow: inset 0 2px 5px rgba(var(--schatten-rgb), 0.18);
}
.lk-bar-fill {
    height: 100%;
    background: var(--accent);
    box-shadow:
        inset 0 7px 7px -6px rgba(var(--tint-rgb), 0.1),
        inset 0 -6px 8px -6px rgba(var(--tint-rgb), 0.154);
    transition: width 0.35s ease, background 0.35s ease;
}
.lk-numbers { display: flex; align-items: center; gap: 0.3rem; }
.lk-numbers input { width: 3.6rem; text-align: center; font-size: 1.15rem; font-weight: bold; }
.lk-danger .lk-bar-fill { animation: pulse-danger 1s infinite; }
@keyframes pulse-danger { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------- Würfel ---------- */

.dice-display {
    position: relative;
    text-align: center;
    padding: 1.15rem 0.8rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--panel-border-strong);
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23f0c069' stroke-opacity='0.14' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M50 6 89 28v44L50 94 11 72V28z'/%3E%3Cpath d='M50 6V94M11 28 89 72M89 28 11 72'/%3E%3Cpath d='M50 6 11 72 89 72z'/%3E%3C/g%3E%3C/svg%3E") center 44% / 116px no-repeat,
        radial-gradient(ellipse at 50% 42%, rgba(163, 52, 43, 0.14), transparent 62%),
        var(--panel);
    box-shadow: var(--inset-deep);
    transition: border-color 0.25s, box-shadow 0.25s;
}
.dice-result-number {
    position: relative;
    font-size: 3.5rem; font-weight: bold; font-family: var(--schrift); line-height: 1;
    color: var(--accent-bright);
}
.dice-result-label { font-size: 0.82rem; color: var(--text-dim); margin-top: 0.25rem; letter-spacing: 0.04em; }
.dice-result-status { font-size: 1.05rem; font-weight: bold; margin-top: 0.45rem; letter-spacing: 0.05em; }
.dice-detail { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.3rem; }
.dice-display.erfolg { border-color: var(--success); box-shadow: var(--inset-deep); }
.dice-display.erfolg .dice-result-number { color: var(--success); }
.dice-display.fehlschlag { border-color: var(--fail); }
.dice-display.fehlschlag .dice-result-number { color: var(--fail); }
.dice-display.immersieg {
    border-color: var(--crit);
    box-shadow: var(--inset-deep);
    animation: dice-flash 1.4s ease-out;
}
.dice-display.immersieg .dice-result-number { color: var(--crit); }
.dice-display.patzer {
    border-color: var(--patzer);
    box-shadow: var(--inset-deep);
    animation: dice-flash 1.4s ease-out;
}
.dice-display.patzer .dice-result-number { color: var(--accent); }
@keyframes dice-flash {
    0% { transform: scale(1.04); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* --- Der Würfel "rollt" ------------------------------------------------ */
/* Ein hellerer W20 dreht sich hinter der Zahl, solange gewürfelt wird. */
.dice-display::before {
    content: "";
    position: absolute;
    left: 50%; top: 42%;
    width: 120px; height: 120px;
    margin: -60px 0 0 -60px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23f0c069' stroke-opacity='0.55' stroke-width='2.5' stroke-linejoin='round'%3E%3Cpath d='M50 6 89 28v44L50 94 11 72V28z'/%3E%3Cpath d='M50 6V94M11 28 89 72M89 28 11 72'/%3E%3Cpath d='M50 6 11 72 89 72z'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.dice-display.is-rolling {
    border-color: var(--accent);
    box-shadow: var(--inset-deep);
    animation: dice-schuettel 0.28s ease-in-out infinite;
}
.dice-display.is-rolling::before {
    opacity: 0.75;
    animation: dice-drehen 0.5s linear infinite;
}
.dice-display.is-rolling .dice-result-number {
    color: var(--accent);
    opacity: 0.65;
    filter: blur(1.2px);
    animation: dice-tumble 0.13s linear infinite;
}
@keyframes dice-schuettel {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-2px) rotate(-0.5deg); }
    75% { transform: translateX(2px) rotate(0.5deg); }
}
@keyframes dice-drehen {
    from { transform: rotate(0) scale(0.9); }
    to { transform: rotate(360deg) scale(1.06); }
}
@keyframes dice-tumble {
    0% { transform: translateY(0) rotate(-7deg) scale(0.95); }
    50% { transform: translateY(-4px) rotate(6deg) scale(1.04); }
    100% { transform: translateY(0) rotate(-7deg) scale(0.95); }
}
/* Aufschlag: die Zahl "landet" federnd */
.dice-display.landed .dice-result-number {
    animation: dice-aufschlag 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes dice-aufschlag {
    0% { transform: scale(0.4) rotate(-12deg); opacity: 0.2; }
    55% { transform: scale(1.22) rotate(4deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.status-erfolg { color: var(--success); }
.status-fehlschlag { color: var(--fail); }
.status-immersieg { color: var(--crit); }
.status-patzer { color: var(--patzer); }

/* Ziel-Auswahl nach einem Treffer im Multiplayer-Kampf */
.dice-ziel {
    display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
    margin-top: 0.6rem; padding: 0.5rem 0.6rem;
    border-radius: var(--radius); font-size: 0.82rem;
    background: rgba(163, 52, 43, 0.12);
    border: 1px solid var(--panel-border-strong);
}
.dice-ziel select { flex: 1; min-width: 6rem; }

.quick-probe { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem; align-items: end; }
/* Ohne min-width:0 schrumpft die 1fr-Spalte nicht unter die Breite des längsten
   Auswahleintrags — der Knopf daneben wird dann aus dem Panel geschoben. */
.quick-probe > * { min-width: 0; }
.quick-probe select, .quick-probe input { width: 100%; }
.quick-probe .btn { white-space: nowrap; }

/* Kampfmodifikatoren stecken in der schmalen rechten Spalte — die Zeilen
   müssen umbrechen, sonst werden "Runden gezielt" und "Zurücksetzen" am
   rechten Rand abgeschnitten. */
.combat-mods > div { flex-wrap: wrap; }
.combat-mods .field { min-width: 8.5rem; }
.combat-mods select { min-width: 8.5rem; }

.log-list { list-style: none; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4rem; }
.log-list li {
    background: linear-gradient(90deg, rgba(var(--tint-rgb), 0.015), transparent 60%), rgba(var(--tint-rgb), 0.0896);
    border-left: 3px solid var(--panel-border-strong);
    padding: 0.4rem 0.6rem;
    border-radius: 0 3px 3px 0;
    font-size: 0.82rem;
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.015);
}
.log-list li.immersieg { border-left-color: var(--crit); }
.log-list li.patzer { border-left-color: var(--patzer); }
.log-list li.erfolg { border-left-color: var(--success); }
.log-list li.fehlschlag { border-left-color: var(--fail); }
.log-time { font-size: 0.7rem; color: var(--text-dim); }

/* ---------- Listen (Inventar, Talente, Zauber) ---------- */

.list-row {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.42rem 0.55rem; border-radius: 0;
    background: var(--ink);
    border: 1px solid var(--panel-border);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.015);
    transition: border-color 0.15s, background 0.15s;
}
.list-row + .list-row { margin-top: 0.35rem; }
.list-row:hover { border-color: var(--panel-border-strong); background: rgba(var(--tint-rgb), 0.1); }
.list-row input[type=text] { flex: 1; min-width: 0; }
.list-row .row-sub { font-size: 0.75rem; color: var(--text-dim); }
.icon-btn {
    background: transparent; border: none; color: var(--text-dim);
    padding: 0.2rem 0.4rem; border-radius: 0; font-size: 0.9rem;
}
.icon-btn:hover { color: var(--fail); background: rgba(184, 70, 47, 0.15); }

.empty-hint { color: var(--text-dim); font-style: italic; font-size: 0.85rem; text-align: center; padding: 0.8rem; }

.tag {
    display: inline-block; padding: 0.14rem 0.55rem; border-radius: 0;
    font-size: 0.72rem; letter-spacing: 0.02em;
    background: var(--panel);
    border: 1px solid var(--panel-border-strong); color: var(--text);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.04);
}
.tag-warn { background: rgba(163, 52, 43, 0.12); border-color: var(--fail); color: var(--accent); }

.hint { font-size: 0.78rem; color: var(--text-dim); }
.hint-rule { font-size: 0.75rem; color: var(--text-dim); font-style: italic; border-left: 2px solid var(--panel-border); padding-left: 0.5rem; }

.sl-eigene-sounds { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.4rem; }
.sl-eigene-sounds:empty { margin-top: 0; }
.eigen-sound-zeile { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.82rem; }
.eigen-sound-zeile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal ---------- */

.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 260;
    background: radial-gradient(ellipse at 50% 30%, rgba(var(--tint-rgb), 0.12), rgba(var(--tint-rgb), 0.18));
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    align-items: center; justify-content: center; padding: 1rem;
    opacity: 0; transition: opacity 0.25s;
}
.modal-overlay.active { opacity: 1; }
.modal {
    background:
        var(--bg-alt);
    border: 1px solid var(--panel-border-strong);
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(var(--schatten-rgb), 0.18), 0 0 0 1px rgba(var(--schatten-rgb), 0.14), inset 0 1px 0 var(--sheen);
    max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto;
    transform: translateY(8px) scale(0.985);
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 900px; }
/* Die Kopfzeile mit dem ✕ bleibt beim Scrollen langer Modale (Anleitung,
   Bestiarium, Talent-/Zauberauswahl) oben stehen — sonst muss man durch die
   ganze Liste scrollen, um das Fenster wieder schliessen zu koennen. */
.modal > .panel-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bg-alt);
}

/* Begrüßungsfenster beim ersten Besuch */
.welcome-rollen { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin: 1rem 0; }
.welcome-rollen > div {
    background: var(--ink);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 0.7rem 0.85rem;
}
.welcome-rollen h4 { color: var(--accent-bright); font-size: 0.95rem; margin-bottom: 0.3rem; }
.welcome-rollen p { font-size: 0.86rem; margin: 0; }
.welcome-aktionen { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
@media (max-width: 560px) { .welcome-rollen { grid-template-columns: 1fr; } }

/* ---------- GM Dashboard ---------- */

#gm-dashboard { display: none; padding: 1.2rem; max-width: 1700px; margin: 0 auto; }
.gm-grid { display: grid; grid-template-columns: 1fr 360px; gap: 1.2rem; align-items: start; }
@media (max-width: 1100px) { .gm-grid { grid-template-columns: 1fr; } }
.gm-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.gm-player-card { border-top: 3px solid var(--accent); }
.gm-player-card > .panel-head { border-bottom-color: var(--gold-line); }
.gm-stat-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.gm-stat {
    background: var(--ink);
    border: 1px solid var(--panel-border);
    border-radius: 0; padding: 0.28rem 0.5rem; font-size: 0.78rem; text-align: center; flex: 1; min-width: 62px;
    box-shadow: var(--inset-deep);
}
.gm-stat span { display: block; font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.gm-stat strong { font-size: 1.05rem; color: var(--accent-bright); }
.room-code {
    font-family: var(--schrift-eng); font-size: 1.6rem; letter-spacing: 0.35em;
    color: var(--accent-bright);
    background: var(--ink);
    padding: 0.35rem 1rem 0.35rem 1.35rem; border-radius: 0;
    border: 1px solid var(--panel-border-strong);
    box-shadow: var(--inset-deep);
}
.status-dot { font-size: 0.78rem; display: inline-flex; align-items: center; gap: 0.35rem; }

/* ---------- Wizard ---------- */

.wizard-steps { display: flex; gap: 0.3rem; padding: 0.7rem 0.9rem; flex-wrap: wrap; border-bottom: 1px solid var(--panel-border); }
.wizard-step {
    font-size: 0.72rem; padding: 0.24rem 0.65rem; border-radius: 0;
    background: linear-gradient(180deg, rgba(var(--tint-rgb), 0.1), rgba(var(--tint-rgb), 0.098));
    border: 1px solid var(--panel-border); color: var(--text-dim);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.02);
}
.wizard-step.active {
    background: var(--text);
    border-color: var(--panel); color: var(--panel);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.1);
}
.wizard-step.done { border-color: var(--success); color: var(--success); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.7rem; }
.choice-card {
    border: 1px solid var(--panel-border); border-radius: var(--radius);
    padding: 0.8rem;
    background: var(--ink);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.02);
    cursor: pointer; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.choice-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.03), 0 6px 16px rgba(var(--schatten-rgb), 0.112), var(--glow-gold); }
.choice-card.selected { border-color: var(--accent-bright); background: rgba(163, 52, 43, 0.12); box-shadow: 0 0 18px rgba(163, 52, 43, 0.28), inset 0 1px 0 rgba(var(--schatten-rgb), 0.05); }
.choice-card h4 { color: var(--accent-bright); font-size: 1rem; margin-bottom: 0.25rem; }
.choice-card p { font-size: 0.78rem; color: var(--text-dim); }
.choice-card ul { font-size: 0.75rem; color: var(--text-dim); margin: 0.4rem 0 0 1rem; }

.radio-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.radio-pill {
    padding: 0.3rem 0.75rem; border-radius: 0; font-size: 0.82rem;
    background: linear-gradient(180deg, rgba(var(--tint-rgb), 0.1), rgba(var(--tint-rgb), 0.098)); border: 1px solid var(--panel-border);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.025);
    cursor: pointer; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.radio-pill:hover { border-color: var(--accent); }
.radio-pill.selected {
    background: var(--text);
    border-color: var(--text); color: var(--panel);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.1);
}

/* ---------- Multiplayer-Statusanzeige ---------- */

/* Standardmäßig unsichtbar — erst ein Zustandsklassenname blendet sie ein. */
.mp-badge { display: none; }
.mp-badge.visible {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.32rem 0.75rem;
    border-radius: 0;
    font-size: 0.82rem;
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--panel-border);
    background: var(--ink);
    transition: border-color 0.2s, background 0.2s;
}
.mp-badge.visible:hover { background: rgba(var(--tint-rgb), 0.14); }
.mp-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mp-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--text-dim);
    flex: none;
}

.mp-badge.connected { border-color: rgba(111, 168, 74, 0.6); color: var(--success); }
.mp-badge.connected .mp-dot { background: var(--success); box-shadow: none; }

.mp-badge.connecting { border-color: rgba(163, 52, 43, 0.55); color: var(--accent-bright); }
.mp-badge.connecting .mp-dot { background: var(--accent); animation: mp-pulse 1.1s infinite; }

.mp-badge.lost { border-color: rgba(184, 70, 47, 0.7); color: var(--accent); }
.mp-badge.lost .mp-dot { background: var(--fail); animation: mp-pulse 1.1s infinite; }

@keyframes mp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

@media (max-width: 620px) {
    /* Auf schmalen Schirmen bleibt nur der Punkt, der Text würde die Zeile sprengen */
    .mp-badge.visible { padding: 0.32rem 0.5rem; }
    #mp-badge-text { display: none; }
}

/* ---------- Talente ---------- */

.talent-entry {
    background: var(--ink);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 0.55rem 0.7rem;
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.02);
}
.talent-entry + .talent-entry { margin-top: 0.45rem; }
.talent-entry-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.talent-rank { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: auto; }
.talent-rank .rank-value { font-size: 0.85rem; color: var(--accent-bright); min-width: 5.5rem; text-align: center; }
.talent-effect { font-size: 0.82rem; color: var(--text-dim); margin-top: 0.35rem; }
.talent-perrank { font-size: 0.76rem; color: var(--accent); margin-top: 0.2rem; }

.talent-picker-list { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.45rem; padding-right: 0.3rem; }
.talent-option {
    background: var(--ink);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 0.55rem 0.7rem;
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.02);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.talent-option:hover { border-color: var(--accent); box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.03), var(--glow-gold); }
.talent-option.locked { opacity: 0.5; }

/* ---------- Kampf-Tracker ---------- */

.combat-row {
    position: relative;
    display: flex; gap: 0.7rem; align-items: stretch;
    padding: 0.55rem 0.6rem 0.55rem 0.75rem; border-radius: var(--radius);
    background: var(--ink);
    border: 1px solid var(--panel-border);
    box-shadow: inset 0 1px 0 rgba(var(--schatten-rgb), 0.02);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
}
.combat-row + .combat-row { margin-top: 0.45rem; }
.combat-row.active-turn {
    border-color: var(--accent-bright);
    background: rgba(163, 52, 43, 0.12);
    box-shadow: 0 0 22px rgba(163, 52, 43, 0.28), inset 0 1px 0 rgba(var(--schatten-rgb), 0.06);
}
.combat-row.active-turn::before {
    content: "";
    position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
    border-radius: 0;
    background: var(--accent);
    box-shadow: none;
}
.combat-row.defeated { opacity: 0.4; filter: grayscale(0.4); }
.combat-row.defeated .combat-name { text-decoration: line-through; }
.combat-init {
    min-width: 2.6rem; display: flex; align-items: center; justify-content: center;
    font-family: var(--schrift); font-size: 1.45rem; font-weight: bold;
    color: var(--accent-bright);
    background: var(--ink);
    border-radius: 0; border: 1px solid var(--panel-border-strong);
    box-shadow: var(--inset-deep);
}
.combat-main { flex: 1; min-width: 0; }
.combat-name { display: flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; flex-wrap: wrap; }
.combat-stats { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.35rem; display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.combat-stats input { padding: 0.1rem 0.3rem; font-size: 0.78rem; }
.combat-actions { display: flex; gap: 0.3rem; margin-top: 0.4rem; flex-wrap: wrap; align-items: center; }

/* Zustände (Vergiftet, Brennt, Liegend …) */
.combat-zustaende { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; margin-top: 0.4rem; }
.zustand-chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.1rem 0.2rem 0.1rem 0.5rem;
    border-radius: 0; font-size: 0.74rem; line-height: 1.6;
    color: var(--accent);
    background: linear-gradient(180deg, rgba(150, 46, 38, 0.55), rgba(var(--tint-rgb), 0.12));
    border: 1px solid rgba(184, 70, 47, 0.6);
    box-shadow: inset 0 1px 0 rgba(255, 220, 210, 0.12);
}
.zustand-chip b {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.1rem; height: 1.1rem; padding: 0 0.15rem;
    border-radius: 50%; font-size: 0.68rem; font-weight: 700;
    background: rgba(var(--tint-rgb), 0.112); color: var(--accent);
}
.zustand-chip button {
    border: none; background: transparent; color: var(--accent);
    font-size: 0.9rem; line-height: 1; padding: 0 0.25rem; cursor: pointer;
    border-radius: 0;
}
.zustand-chip button:hover { background: var(--ink); color: var(--text); }
.zustand-chip.mini {
    padding: 0.02rem 0.4rem; font-size: 0.68rem; line-height: 1.5; gap: 0.25rem;
}
.zustand-chip.mini b { min-width: 0.95rem; height: 0.95rem; font-size: 0.62rem; }
.zustand-plus {
    border: 1px dashed var(--panel-border-strong);
    background: var(--ink); color: var(--text-dim);
    font-size: 0.72rem; padding: 0.12rem 0.5rem; border-radius: 0; cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.zustand-plus:hover { color: var(--accent-bright); border-color: var(--accent); }
.kampf-eigene-zustaende { margin-top: 0.4rem; font-size: 0.8rem; display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }

/* ---------- Einblendungen ---------- */

.gm-toast {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 140%);
    z-index: 300; max-width: min(460px, 92vw);
    background: var(--panel);
    border: 1px solid var(--accent-bright);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(var(--schatten-rgb), 0.18);
    padding: 0.8rem 1.1rem;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.3s;
    opacity: 0;
}
.gm-toast.visible { transform: translate(-50%, 0); opacity: 1; }
.gm-toast-head {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--accent-bright); margin-bottom: 0.3rem;
}

.round-indicator {
    /* unten rechts statt oben — die Kopfzeile bricht auf schmalen Fenstern um,
       dann lag die Anzeige sonst über den Knöpfen */
    position: fixed; bottom: 1rem; right: 1rem; z-index: 120;
    background: rgba(var(--tint-rgb), 0.12);
    border: 1px solid var(--accent);
    border-radius: 0; padding: 0.3rem 0.9rem;
    font-size: 0.85rem; color: var(--accent-bright);
    box-shadow: var(--shadow);
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}
.round-indicator.visible { opacity: 1; transform: translateY(0); }

/* Handout des Spielleiters */
#handout-body { text-align: center; }
#handout-body img { max-width: 100%; max-height: 72vh; border-radius: 0; display: inline-block; }
.handout-text {
    white-space: pre-wrap;
    text-align: left;
    font-size: 1.02rem;
    line-height: 1.6;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--text);
}
.handout-wieder {
    position: fixed; bottom: 1rem; left: 1rem; z-index: 120;
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 0; padding: 0.4rem 0.9rem;
    font-size: 0.85rem; color: var(--accent-bright);
    box-shadow: var(--shadow-panel);
    cursor: pointer;
}
.handout-wieder:hover { border-color: var(--accent-bright); box-shadow: var(--shadow-panel), var(--glow-gold); }

/* ---------- Charakterbild ---------- */

.portrait-row { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; flex-wrap: wrap; }
.portrait-frame {
    width: 84px; height: 84px; flex: none;
    border-radius: 50%;
    border: 2px solid var(--panel-border-strong);
    background: var(--ink);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; cursor: pointer;
    color: var(--text-dim); text-align: center; font-size: 1.3rem; line-height: 1.1;
    transition: border-color 0.15s;
}
.portrait-frame:hover { border-color: var(--accent); color: var(--accent); }
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }
.portrait-frame small { font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* Bild auf der Spielerkarte im Dashboard */
.gm-portrait {
    width: 34px; height: 34px; flex: none;
    border-radius: 50%; border: 2px solid var(--accent);
    object-fit: cover;
}
.gm-portrait-leer {
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--tint-rgb), 0.112);
    font-size: 0.75rem; font-weight: bold;
}

/* ---------- Karte ---------- */

#map-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: var(--bg);
    flex-direction: column;
}

/* Einhängepunkte: eingebettet feste Höhe, im Vollbild der ganze Rest */
.map-host { padding: 0; height: 420px; overflow: hidden; transition: height 0.2s ease; }
.map-host.zugeklappt { height: 0; }
#map-host-overlay { flex: 1; height: auto; padding: 0; }

#map-widget { display: flex; flex-direction: column; height: 100%; }

@media (max-width: 700px) { .map-host { height: 300px; } }

.map-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.62rem 0.95rem;
    background: linear-gradient(180deg, rgba(var(--tint-rgb), 0.12), rgba(var(--tint-rgb), 0.075));
    border-bottom: 1px solid var(--gold-line);
    flex: none;
}
.map-head h3 {
    font-size: 1.02rem; color: var(--accent-bright); white-space: nowrap;
    letter-spacing: 0.035em;
}
.map-tools {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex: none;
    min-width: 0;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid var(--panel-border);
    background: var(--ink);
}
.map-tools .radio-pill { padding: 0.22rem 0.6rem; font-size: 0.78rem; }
.map-tools input[type=number] { padding: 0.2rem 0.35rem; font-size: 0.8rem; }
.map-tools .num-stepper button { width: 1.4rem; font-size: 0.85rem; }
.map-tools .hint { white-space: nowrap; }

#map-canvas {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: block;
    cursor: grab;
    touch-action: none;
}
#map-canvas:active { cursor: grabbing; }

.werkzeug-gruppe {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.15rem 0.35rem;
    border: 1px solid var(--panel-border);
    border-radius: 0;
    background: var(--ink);
}
.mal-farbe {
    width: 17px; height: 17px; border-radius: 50%;
    cursor: pointer; border: 2px solid transparent;
    transition: transform 0.12s;
}
.mal-farbe:hover { transform: scale(1.15); }
.mal-farbe.aktiv { border-color: var(--text); }

/* Angebot, eine frühere Sitzung wiederherzustellen */
#gm-sitzung:empty { display: none; }
.sitzung-hinweis {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
    max-width: 1700px; margin: 0 auto 1.2rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.87rem;
    background: rgba(168, 118, 44, 0.18);
    border: 1px solid var(--panel-border-strong);
    border-radius: var(--radius);
}

/* Vorgemerkte Nebelbereiche, die noch freigegeben werden müssen */
#map-nebel:empty { display: none; }
.nebel-freigabe {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
    background: rgba(111, 168, 74, 0.16);
    border-bottom: 1px solid var(--panel-border);
}

/* Offene Zugvorschläge beim Spielleiter */
.map-zuege { flex: none; }
.map-zuege:empty { display: none; }
.zug-vorschlag {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
    background: rgba(168, 118, 44, 0.18);
    border-bottom: 1px solid var(--panel-border);
}
.zug-vorschlag.zu-weit { background: rgba(168, 52, 44, 0.22); }

/* Kartenauswahl des Spielleiters (mehrere Battlemaps) */
.map-karten { flex: none; }
.map-karten:empty { display: none; }
.map-karten {
    display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
    padding: 0.45rem 0.7rem;
    font-size: 0.83rem;
    border-bottom: 1px solid var(--panel-border);
    background: var(--ink);
}
.map-karten select { max-width: 14rem; padding: 0.2rem 1.9rem 0.2rem 0.35rem; font-size: 0.83rem; }
.map-karten .btn { padding: 0.2rem 0.5rem; }
.map-karten .map-karten-titel { color: var(--text-dim); white-space: nowrap; }

/* Zuweisung Spieler → Karte (geteilte Gruppe) */
.map-zuweisung { flex: none; }
.map-zuweisung:empty { display: none; }
.map-zuweisung {
    display: flex; align-items: center; gap: 0.5rem 0.7rem; flex-wrap: wrap;
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(74, 108, 168, 0.14);
}
.map-zuweisung .zuw-spieler { display: inline-flex; align-items: center; gap: 0.3rem; }
.map-zuweisung select { padding: 0.15rem 1.7rem 0.15rem 0.3rem; font-size: 0.8rem; }

.map-status {
    flex: none;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    color: var(--text-dim);
    border-top: 1px solid var(--panel-border);
    background: var(--ink);
    min-height: 1.9rem;
}

/* ---------- Fußbereich ---------- */

.site-footer {
    border-top: 1px solid var(--panel-border);
    background: var(--ink);
    margin-top: 2rem;
    padding: 2rem 1.2rem 2.5rem;
}
.footer-inner {
    max-width: 1500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}
/* Der Fußtext liegt zweisprachig vor: die deutschen Abschnitte und ein
   englischer. Sichtbar ist der zur aktuellen Oberflächensprache — für
   Suchmaschinen steht der jeweils andere weiter im HTML. */
.footer-inner > section[lang="en"] { display: none; }
html[lang="en"] .footer-inner > section:not([lang]) { display: none; }
html[lang="en"] .footer-inner > section[lang="en"] { display: block; }

/* Allgemein: prosalastige Blöcke (Willkommen, Multiplayer-Hilfe) liegen
   zweisprachig parallel vor. i18n.js setzt <html lang>. */
[data-only-lang="en"] { display: none; }
html[lang="en"] [data-only-lang="de"] { display: none; }
html[lang="en"] [data-only-lang="en"] { display: block; }
.site-footer h2 {
    font-size: 1rem;
    color: var(--accent-bright);
    margin-bottom: 0.5rem;
}
.site-footer p {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.6rem;
    max-width: 62ch;
}
.site-footer a { color: var(--accent); }
.site-footer a:hover { color: var(--accent-bright); }

/* Slayerpunkte (optionale Regel) */
.slayer-pips { display: inline-flex; gap: 0.2rem; }
.slayer-pip {
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.28;
    filter: grayscale(1);
    transition: opacity 0.15s, filter 0.15s, transform 0.15s;
}
.slayer-pip.full {
    opacity: 1;
    filter: none;
    transform: scale(1.15);
}

/* Abwartehandlung im Kampf-Tracker */
.combat-abwarten {
    font-size: 0.62rem;
    margin-left: 0.15rem;
    vertical-align: super;
}

/* Fanwerk-Hinweisbild im Fußbereich (Klasse ohne "banner", weil Brave & Co.
   Elemente mit diesem Wort im Klassennamen kosmetisch ausblenden) */
.fanwerk-marke {
    display: block;
    width: 100px;
    margin: 0 auto 0.9rem;
    line-height: 0;
    opacity: 0.85;
    transition: opacity 0.15s;
}
.fanwerk-marke:hover { opacity: 1; }
.fanwerk-marke img {
    display: block;
    width: 100px;
    height: 46px;
    border-radius: 0;
}

/* Einladung auf den Discord-Server, auf dem die Tools entstehen */
.footer-discord {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid #5865f2;
    border-radius: 0;
    background: rgba(88, 101, 242, 0.12);
    color: #aab4ff !important;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.footer-discord:hover {
    background: rgba(88, 101, 242, 0.26);
    border-color: #7983f5;
    color: #ffffff !important;
}

.footer-disclaimer {
    max-width: 1500px;
    margin: 1.8rem auto 0;
    padding-top: 1.2rem;
    border-top: 1px solid var(--panel-border);
    font-size: 0.76rem;
    line-height: 1.7;
    color: var(--text-dim);
    text-align: center;
}

.footer-tester {
    font-size: 0.72rem;
    opacity: 0.6;
}
.footer-tester strong { font-weight: 600; }

.footer-lang {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    opacity: 0.75;
}
.lang-btn {
    background: none;
    border: 1px solid var(--panel-border);
    border-radius: 0;
    color: inherit;
    font: inherit;
    font-size: 0.72rem;
    padding: 0.1rem 0.5rem;
    cursor: pointer;
}
.lang-btn:hover { border-color: var(--accent); }
.lang-btn.aktiv {
    background: var(--text);
    border-color: var(--panel);
    color: var(--panel);
    font-weight: 600;
}


/* ---------- Hilfe: "?"-Symbole und Popover ---------- */

.help-btn {
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: 1px solid var(--panel-border-strong);
    border-radius: 50%;
    background: var(--ink);
    color: var(--accent);
    font-family: 'Georgia', serif;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.help-btn:hover, .help-btn:focus-visible, .help-btn.active {
    background: var(--text);
    border-color: var(--accent-bright);
    color: var(--panel);
}
/* Im Fließtext nur als Symbol, nicht als Knopf */
.help-btn-inline { cursor: default; }

.help-pop {
    position: fixed;
    z-index: 400;
    display: none;
    width: min(360px, calc(100vw - 1.6rem));
    max-height: 72vh;
    overflow-y: auto;
    background: var(--bg-alt);
    border: 1px solid var(--panel-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity 0.15s;
}
.help-pop.active { opacity: 1; }
.help-pop-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem 0.45rem 0.7rem;
    background: linear-gradient(180deg, rgba(var(--tint-rgb), 0.12), rgba(var(--tint-rgb), 0.1));
    border-bottom: 1px solid var(--panel-border);
    font-family: 'Georgia', serif;
    font-size: 0.9rem;
    color: var(--accent-bright);
}
.help-pop-head span { flex: 1; }
.help-pop-body { padding: 0.7rem 0.8rem; font-size: 0.83rem; line-height: 1.55; }
.help-pop-foot {
    padding: 0.4rem 0.6rem;
    border-top: 1px solid var(--panel-border);
    text-align: right;
}

/* Gemeinsame Textauszeichnung in Popover und Anleitung */
.help-pop-body p, .help-guide-body p { margin-bottom: 0.55rem; }
.help-pop-body p:last-child, .help-guide-body p:last-child { margin-bottom: 0; }
.help-pop-body ul, .help-pop-body ol,
.help-guide-body ul, .help-guide-body ol { margin: 0 0 0.55rem 1.1rem; }
.help-pop-body li, .help-guide-body li { margin-bottom: 0.3rem; }
.help-pop-body strong, .help-guide-body strong { color: var(--accent-bright); font-weight: 600; }
.help-pop-body em, .help-guide-body em { color: var(--text); }
.help-pop-body a, .help-guide-body a { color: var(--accent); }

/* Gesamtanleitung im Modal */
.help-guide-group {
    font-size: 0.95rem;
    color: var(--accent-bright);
    margin: 1.1rem 0 0.45rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--panel-border);
}
.help-guide-group:first-of-type { margin-top: 0.2rem; }
.help-guide-item {
    border: 1px solid var(--panel-border);
    border-radius: 0;
    margin-bottom: 0.4rem;
    background: var(--ink);
}
.help-guide-item > summary {
    cursor: pointer;
    padding: 0.45rem 0.6rem;
    font-size: 0.88rem;
    color: var(--text);
}
.help-guide-item > summary:hover { color: var(--accent-bright); }
.help-guide-item[open] > summary { color: var(--accent-bright); border-bottom: 1px solid var(--panel-border); }
.help-guide-body { padding: 0.6rem 0.75rem; font-size: 0.83rem; line-height: 1.55; }

/* Aufklappbare Abschnitte (Werte & Ausrüstung, Zauber, Inventar, Hilfe …) */
details > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
    content: "\25B8";
    color: var(--accent);
    font-size: 0.8em;
    flex: none;
    transition: transform 0.15s;
}
details[open] > summary::before { transform: rotate(90deg); }
details > summary:hover { color: var(--accent-bright); }

/* ---------- Gruppe & Kampf (Spieleransicht im Multiplayer) ---------- */

.kampf-kopf {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--panel-border);
    border-radius: 0;
    background: var(--ink);
    font-size: 0.85rem;
}
.kampf-kopf.ich-dran {
    border-color: var(--accent-bright);
    background: linear-gradient(180deg, rgba(var(--tint-rgb), 0.12), rgba(var(--tint-rgb), 0.1));
}
.kampf-dran {
    color: var(--accent-bright);
    font-weight: 600;
    margin-top: 0.2rem;
}
.kampf-reihenfolge {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.kampf-eintrag {
    font-size: 0.8rem;
    padding: 0.25rem 0.45rem;
    border-radius: 0;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.kampf-eintrag.am-zug { background: rgba(163, 52, 43, 0.18); color: var(--accent-bright); }
.kampf-eintrag.ich { font-weight: 600; color: var(--text); }
.kampf-eintrag.ich.am-zug { color: var(--accent-bright); }

.gruppen-eintrag { margin-bottom: 0.55rem; }
.gruppen-eintrag:last-child { margin-bottom: 0; }
.gruppen-kopf {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.82rem;
    margin-bottom: 0.2rem;
    flex-wrap: wrap;
}


/* ---------- Gezeichnete Symbole (icons.js) ---------- */

.ico {
    width: 1.05em;
    height: 1.05em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.15em;
    overflow: visible;
}
.ico-gross { width: 1.35em; height: 1.35em; stroke-width: 1.25; }

/* In Ueberschriften sitzt das Symbol etwas ruhiger und duenner */
h1 .ico, h2 .ico, h3 .ico, h4 .ico { stroke-width: 1.15; margin-right: 0.15em; }

/* Knoepfe ohne Text (nur Symbol) bleiben quadratisch statt breitzulaufen */
.btn > .ico:only-child { margin: 0 0.1em; }


/* ---------- Papier / Nacht ---------- */

.ton-schalter { display: inline-flex; align-items: center; gap: 0.3rem; }
