:root{
    --bg: #0b0f14;
    --bg2: #080b10;
    --panel: rgba(18,22,30,0.9);
    --panel-border: #2a3142;
    --text: #e9eef7;
    --muted: #9aa6b2;
    --accent: #3aa3ff;
    --shadow: 0 8px 30px rgba(0,0,0,0.35);

    /* Toolbar: 2 Reihen à 44px + 8px Zeilenabstand + 16px Padding vertikal */
    --tb: 112px;
    --tbh: 42px;  /* Tabs-Höhe */

    /* wird per JS aktualisiert, damit die Stärkepunkte farblich mitgehen */
    --stroke: #111111;
}

html, body {
    margin: 0; padding: 0; height: 100%; width: 100%;
    overflow: hidden;
    background:
            radial-gradient(1200px 1200px at 50% -20%, #0f1420 0%, #0b0f14 45%, #080b10 100%);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* Toolbar (max. 2 Zeilen, nie höher) */
#toolbar{
    position: sticky; top: 0; left: 0; right: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    z-index: 30;
    -webkit-user-select: none; user-select: none;

    /* Grid: füllt spaltenweise, exakt 2 Reihen à 44px */
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    grid-template-rows: repeat(2, 44px);
    align-content: start;
    gap: 8px 8px;            /* row col */
    padding: 8px 10px;
    height: var(--tb);       /* fixiert → wächst nie über 2 Zeilen hinaus */
    overflow: hidden;        /* keine Scrollbar */
}

#toolbar .group { display: inline-flex; align-items: center; gap: 8px; }

.tool, .actions button {
    appearance: none; -webkit-appearance: none;
    background: #141a25; border: 1px solid #273045;
    color: var(--text); padding: 6px 10px; border-radius: 10px; cursor: pointer;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.03);
}
.tool.active, .actions button:hover { border-color: var(--accent); }

.pen-only {
    color: var(--muted); font-size: 12px;
    display: inline-flex; align-items: center; gap: 6px;
}
.pen-only input { accent-color: var(--accent); }

/* Farben */
.colors { display: inline-flex; gap: 8px; }
.colors .color{
    appearance: none; -webkit-appearance: none;
    width: 28px; height: 28px; border-radius: 50%;
    border: 2px solid #20283a; background: var(--c); cursor: pointer;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18), 0 1px 0 rgba(255,255,255,0.06);
}
.colors .color.active{ outline: 2px solid var(--accent); outline-offset: 2px; }

/* Strichstärken – nebeneinander, Punkt nimmt aktuelle Farbe an */
.sizes { display: inline-flex; gap: 8px; }
.sizes .size{
    appearance: none; -webkit-appearance: none;
    background: #141a25; border: 1px solid #273045; border-radius: 999px;
    width: 44px; height: 28px; cursor: pointer; display: grid; place-items: center;
}
.sizes .size span{
    display: block; width: 22px; height: var(--w);
    background: var(--stroke); border-radius: 999px;
}
.sizes .size.active{ border-color: var(--accent); }

/* Tabs-Bar */
#tabs{
    position: sticky; top: var(--tb);
    height: var(--tbh);
    background: rgba(8,12,18,0.85);
    border-bottom: 1px solid #1c2331;
    z-index: 25;
}
#tabs .tabs-scroll{
    height: 100%;
    display: flex; align-items: center; gap: 8px;
    padding: 0 10px;
    overflow-x: auto; white-space: nowrap;
    scrollbar-width: thin;
}
.tab{
    appearance: none; -webkit-appearance: none;
    background: #0f1622; border: 1px solid #243149; color: var(--text);
    padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.tab.active{ background: #172235; border-color: var(--accent); }
.add-tab{
    appearance: none; -webkit-appearance: none;
    background: #132035; color: #cfe2ff;
    border: 1px dashed #2b3d5a;
    padding: 6px 12px; border-radius: 999px; cursor: pointer;
}

/* Stage = Bereich unter Toolbar+Tabs */
#stage{
    position: relative;
    height: calc(100dvh - var(--tb) - var(--tbh));
    overflow-y: auto;
    overflow-x: hidden;
    background: radial-gradient(1000px 1000px at 50% 50%, rgba(0,0,0,0.18), rgba(0,0,0,0.45));
}

/* Board (Canvas) – helle Schreibfläche mit Grid */
#board {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    display: block;
    background:
            radial-gradient(circle at 24px 24px, #d0d0d0 2px, transparent 2px) 0 0/48px 48px,
            linear-gradient(#f0f0f0, #f0f0f0);
    border: 1px solid #111721;
    border-radius: 12px;
    box-shadow: var(--shadow);
    touch-action: none; /* wir handeln Touch selbst (1 Finger zeichnen, 2 Finger manueller Scroll) */
}

/* Verbindungs-LED */
.dot{ width: 10px; height: 10px; border-radius: 50%; border: 1px solid #475066; display: inline-block; }
.dot.offline{ background: #8a2c2c; }
.dot.online { background: #2b9a4c; }
