/* Console – App-Styles. Ausschließlich var(--...)-Farben, kein Hardcoding. */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
}

body {
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); }

h1, h2, h3, .display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.mono { font-family: var(--font-mono); }

.text-dim { color: var(--text-dim); }

::selection { background: var(--accent-deep); color: var(--text); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.topbar .brand {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}
.topbar .brand:hover { color: var(--accent); }

.topbar .spacer { flex: 1; }

.topbar-link {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 4px 2px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.topbar-link:hover { color: var(--text); border-color: var(--accent); }
.topbar-link.danger:hover { color: var(--err); border-color: var(--err); }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    font-size: 0.85rem;
}

.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ok);
}
.status-dot.off { background: var(--err); }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent-deep);
    color: var(--text);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Layout container ───────────────────────────────── */
.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
}

.panel.glow::before {
    content: "";
    position: absolute;
    inset: -40px;
    z-index: -1;
    background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 70%);
    pointer-events: none;
}

.panel + .panel { margin-top: 16px; }

.grid-session {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 960px) {
    .grid-session { grid-template-columns: 1fr; }
}

/* ── Buttons / Forms ────────────────────────────────── */
button, .btn {
    font-family: var(--font-body);
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s ease, transform 0.1s ease;
}
button:hover, .btn:hover { background: var(--line); }
button:active, .btn:active { transform: scale(0.98); }

.btn-accent {
    background: var(--accent);
    border-color: var(--accent-deep);
    color: #fff;
}
.btn-accent:hover { background: var(--accent-deep); }

.btn-danger {
    background: var(--err);
    border-color: var(--err);
    color: #1a0708;
    font-weight: 600;
}

.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }

input, select, textarea {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.95rem;
    width: 100%;
}

label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--text-dim); }
.field { margin-bottom: 14px; }

.form-narrow { max-width: 380px; margin: 60px auto; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    border: 1px solid var(--line);
}
.alert-err { border-color: var(--err); color: var(--err); }
.alert-ok { border-color: var(--ok); color: var(--ok); }

/* ── Tabs ───────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.tab {
    padding: 8px 16px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
}
.tab.active {
    background: var(--panel-2);
    border-color: var(--line);
    border-bottom-color: var(--panel-2);
    color: var(--text);
}
.tab.tab-stop {
    margin-left: auto;
    color: var(--err);
    border-color: var(--err);
}
.tab.tab-stop:hover { background: var(--err); color: #1a0708; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Cam ────────────────────────────────────────────── */
.cam-wrap {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4 / 3;
}
.cam-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cam-pip {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 28%;
    max-width: 180px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--line);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--bg) 60%, transparent);
}
.cam-controls {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

/* ── Chat ───────────────────────────────────────────── */
.chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 420px;
}

.punishment-alert {
    border-color: var(--err);
}
.punishment-alert h3 { color: var(--err); }
.chat-log {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
    max-height: 420px;
}
.chat-msg {
    background: var(--panel-2);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    max-width: 85%;
}
.chat-msg.own {
    align-self: flex-end;
    background: var(--accent-deep);
    color: #fff;
}
.chat-msg .meta {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 2px;
    font-family: var(--font-mono);
}
.chat-msg.own .meta { color: rgba(255,255,255,0.75); }
.chat-input-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.chat-input-row input { flex: 1; }

/* ── Faders ─────────────────────────────────────────── */
.fader-row {
    margin-bottom: 18px;
}
.fader-row .fader-label {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 6px;
}
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--line);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--accent-deep);
    cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--accent-deep);
    cursor: pointer;
}

.preset-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.battery {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ── Points / progress ──────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 14px;
    background: var(--panel-2);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.progress-bar .fill {
    height: 100%;
    background: var(--accent);
}
.points-readout {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

/* ── Cards ──────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.card {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.card h4 { margin: 0 0 6px; font-family: var(--font-display); }
.card p { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

/* ── Theme picker ───────────────────────────────────── */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.theme-tile {
    border-radius: var(--radius-sm);
    border: 2px solid var(--line);
    padding: 12px;
    cursor: pointer;
    background: var(--tile-bg, #222);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.theme-tile.selected { border-color: var(--tile-accent, var(--accent)); }
.theme-tile .swatch {
    height: 36px;
    border-radius: 8px;
    background: var(--tile-accent, var(--accent));
}
.theme-tile .name { font-size: 0.85rem; color: var(--tile-text, #eee); }

/* ── Utility ────────────────────────────────────────── */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table th { color: var(--text-dim); font-weight: 500; font-size: 0.85rem; }

.footer-note {
    text-align: center;
    padding: 16px;
    color: var(--text-dim);
    font-size: 0.8rem;
}
