:root {
  --bg: #0b0d14; --bg2: #12151f; --bg3: #1a1e2c; --border: #262b3d;
  --text: #e8eaf1; --muted: #8b92a8; --gold: #f5c542; --gold2: #d9a923;
  --red: #ff3b5c; --green: #2ecc71; --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg3); padding: 2px 6px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); } .small { font-size: .85em; }
h1, h2 { margin: 0 0 .6em; } h2 { font-size: 1.15rem; }

/* ---------- Nav ---------- */
.nav { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px; background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--text); display: flex; gap: 6px; align-items: center; }
.brand span { background: linear-gradient(90deg, var(--gold), #fff0b3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links a { color: var(--muted); font-weight: 600; margin-right: 16px; }
.nav-links a.active, .nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--text); cursor: pointer; font: inherit; }
.avatar-btn img, .avatar-fallback { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; background: var(--gold); color: #000; font-weight: 700; }
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; right: 0; top: 40px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); min-width: 170px; padding: 6px; box-shadow: 0 10px 30px #0008; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: block; width: 100%; text-align: left; padding: 8px 12px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; border-radius: 6px; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg2); text-decoration: none; }

/* ---------- Buttons / Forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn-primary { background: var(--gold); color: #111; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: .85em; } .btn-lg { padding: 12px 26px; font-size: 1.05em; } .btn-block { width: 100%; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9em; }
.form label small { font-weight: 400; }
.form input:not([type=checkbox]), .form select, .form textarea { padding: 9px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; }
.form input:focus, .form textarea:focus, .form select:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.check { flex-direction: row !important; align-items: center; font-weight: 400 !important; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1; }
.auth-box { max-width: 440px; margin: 40px auto; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.auth-box.wide { max-width: 720px; }
.oauth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-oauth { border: 1px solid var(--border); background: var(--bg3); color: var(--text); }
.btn-oauth span { font-weight: 800; width: 18px; }
.btn-oauth.google span { color: #4285f4; } .btn-oauth.discord { border-color: #5865f2; } .btn-oauth.twitch { border-color: #9146ff; } .btn-oauth.kick { border-color: #53fc18; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85em; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.flash { max-width: 1400px; margin: 12px auto 0; padding: 10px 16px; border-radius: 8px; }
.flash-error { background: #3a1522; color: #ffb3c0; } .flash-ok { background: #123a26; color: #a5f0c2; }
.linked { list-style: none; padding: 0; margin: 0 0 14px; }
.linked li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.prov { text-transform: capitalize; font-weight: 600; } .ok { color: var(--green); }

/* ---------- Layout ---------- */
.main { max-width: 1400px; margin: 0 auto; padding: 20px; min-height: calc(100vh - 56px - 60px); }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85em; }
.hero { text-align: center; padding: 40px 20px 30px; }
.hero h1 { font-size: 2.2rem; margin-bottom: 8px; }
.hero p { color: var(--muted); max-width: 600px; margin: 0 auto 20px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; font-size: 1.1rem; }
.page-title { margin: 6px 0 18px; }
.dot-live { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); }
.empty { padding: 30px; text-align: center; background: var(--bg2); border-radius: var(--radius); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { padding: 5px 12px; border-radius: 20px; background: var(--bg3); color: var(--text); font-size: .9em; }
.chip.active { background: var(--gold); color: #111; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); transition: transform .15s; }
.card:hover { transform: translateY(-3px); text-decoration: none; border-color: var(--gold2); }
.card-thumb { aspect-ratio: 16/9; background: radial-gradient(circle at 30% 30%, #2a2145, #0f1220); position: relative; display: flex; align-items: center; justify-content: center; }
.card-thumb.live { background: radial-gradient(circle at 30% 30%, #3b2a10, #14110a); }
.thumb-icon { font-size: 3rem; opacity: .5; }
.badge-live, .badge-live-inline { background: var(--red); color: #fff; font-size: .72em; font-weight: 800; padding: 2px 7px; border-radius: 4px; letter-spacing: .5px; }
.badge-live { position: absolute; top: 8px; left: 8px; }
.badge-offline { position: absolute; top: 8px; left: 8px; background: #0008; color: var(--muted); font-size: .72em; padding: 2px 7px; border-radius: 4px; }
.badge-viewers { position: absolute; bottom: 8px; left: 8px; background: #000a; font-size: .8em; padding: 2px 7px; border-radius: 4px; }
.badge-cam { position: absolute; top: 8px; right: 8px; background: #000a; font-size: .75em; padding: 2px 7px; border-radius: 4px; }
.card-body { display: flex; gap: 10px; padding: 10px 12px; align-items: center; }
.card-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.card-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--muted); font-size: .85em; }

/* ---------- Kanalseite ---------- */
.channel-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.player-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.game-video { width: 100%; height: 100%; display: block; background: #000; }
.cam-box { position: absolute; right: 2%; bottom: 12%; width: 24%; aspect-ratio: 16/9; border: 2px solid var(--gold); border-radius: 8px; overflow: hidden; background: #000; box-shadow: 0 6px 24px #000a; z-index: 5; }
.cam-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-handle { position: absolute; inset: 0; cursor: move; }
.cam-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, var(--gold) 50%); }
.offline-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #0b0d14; z-index: 4; }
.player-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: linear-gradient(transparent, #000c); z-index: 10; opacity: 0; transition: opacity .2s; }
.player-wrap:hover .player-controls, .player-wrap:focus-within .player-controls { opacity: 1; }
.pc-btn { background: none; border: 0; color: #fff; font-size: 1.1rem; cursor: pointer; }
.vol { display: flex; align-items: center; gap: 6px; }
.vol input { width: 80px; accent-color: var(--gold); }
.pc-spacer { flex: 1; }
.pc-toggle { display: flex; align-items: center; gap: 4px; font-size: .85em; cursor: pointer; }
.pc-select { background: #0009; color: #fff; border: 1px solid #fff3; border-radius: 6px; font-size: .8em; padding: 3px 6px; }
.pc-info { font-size: .8em; color: var(--gold); }
.channel-info { display: flex; gap: 14px; align-items: center; padding: 14px 4px; }
.ch-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; font-size: 1.4rem; }
.ch-text { flex: 1; min-width: 0; }
.ch-text h1 { font-size: 1.25rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-meta { color: var(--muted); font-size: .9em; }
.ch-desc { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; white-space: pre-wrap; }

/* ---------- Chat ---------- */
.chat-col { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; height: calc(100vh - 56px - 40px); position: sticky; top: 76px; }
.chat-head { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .9em; }
.chat-messages { flex: 1; overflow-y: auto; padding: 8px 12px; font-size: .92em; overscroll-behavior: contain; }
.msg { padding: 3px 0; word-wrap: break-word; line-height: 1.4; position: relative; }
.msg:hover .msg-del { opacity: 1; }
.msg-time { color: var(--muted); font-size: .8em; margin-right: 6px; }
.msg-name { font-weight: 700; cursor: pointer; }
.msg.role-owner .msg-name { color: var(--gold) !important; }
.msg.system { color: var(--muted); font-style: italic; }
.msg-del { position: absolute; right: 0; top: 2px; opacity: 0; background: var(--bg3); border: 0; color: var(--red); cursor: pointer; border-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; }
.chat-error { padding: 6px 12px; background: #3a1522; color: #ffb3c0; font-size: .85em; }

/* ---------- Emotes ---------- */
.emote { height: 28px; vertical-align: middle; margin: 0 1px; }
.chat-input { position: relative; }
.emote-picker { position: absolute; bottom: 100%; right: 8px; width: 300px; max-height: 260px; overflow-y: auto; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 8px; box-shadow: 0 10px 30px #000a; z-index: 20; }
.ep-title { font-size: .75em; color: var(--muted); font-weight: 700; text-transform: uppercase; margin: 6px 4px 4px; }
.ep-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.ep-grid img { width: 32px; height: 32px; object-fit: contain; cursor: pointer; padding: 3px; border-radius: 6px; }
.ep-grid img:hover { background: var(--bg2); }
.emote-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.emote-item { display: flex; align-items: center; gap: 6px; background: var(--bg3); border-radius: 8px; padding: 4px 8px; font-size: .85em; margin: 0; }
.emote-item img { width: 28px; height: 28px; object-fit: contain; }
.emote-del { background: none; border: 0; color: var(--red); cursor: pointer; font-size: .9em; }
.overlay-table code.ov { user-select: all; }

/* ---------- Dashboard / Admin ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.panel { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { flex: 1; min-width: 100px; background: var(--bg3); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; }
.stat b { font-size: 1.4rem; } .stat span { color: var(--muted); font-size: .8em; }
.kv { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.kv th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 10px 6px 0; width: 150px; vertical-align: top; }
.kv td { padding: 6px 0; word-break: break-all; }
.secret { font-family: monospace; }
.howto { margin: 10px 0 14px; } .howto summary { cursor: pointer; font-weight: 600; }
.howto ol { padding-left: 20px; } .howto li { margin: 6px 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92em; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table .actions form { display: flex; gap: 6px; }
.cam-preview { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); margin-bottom: 12px; }

/* ---------- Age-Gate ---------- */
.age-gate { position: fixed; inset: 0; background: #000c; backdrop-filter: blur(8px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.age-box { background: var(--bg2); border: 1px solid var(--gold); border-radius: 14px; padding: 30px; max-width: 460px; text-align: center; }
.age-box form { display: flex; gap: 10px; justify-content: center; }

@media (max-width: 960px) {
  .channel-layout { grid-template-columns: 1fr; }
  .chat-col { height: 420px; position: static; }
  .nav-links { display: none; }
  .hero h1 { font-size: 1.6rem; }
  .player-controls { opacity: 1; }
  .vol input { width: 56px; }
}
