/* Basis: Reset, Bühne (Canvas), Screens, Typografie, Buttons, Formularfelder, Dialoge, Toasts. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 500 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
::selection { background: rgb(var(--acc-rgb) / .35); }

/* WebGL-Bühne + Scanlines */
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: var(--z-gl); background: radial-gradient(120% 90% at 50% 40%, #071b2b 0%, #02060c 65%); touch-action: none; }
.scanlines { position: fixed; inset: 0; z-index: var(--z-scan); pointer-events: none; opacity: .5; mix-blend-mode: multiply;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / .28) 0, rgb(0 0 0 / .28) 1px, transparent 1px, transparent 3px); }
.scanlines::after { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 100% at 50% 50%, transparent 55%, rgb(0 0 0 / .55) 100%); }

#app { position: fixed; inset: 0; z-index: var(--z-screen); pointer-events: none; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; pointer-events: none; }
.screen[hidden] { display: none; }
.screen > * { pointer-events: auto; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; background: transparent; border: 1px solid var(--line-dim); color: var(--accent); transition: var(--t); }
.icon-btn:hover { border-color: var(--accent); background: rgb(var(--acc-rgb) / .1); box-shadow: var(--glow); }

/* Verbindungsanzeige */
.conn { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 6px 14px; font: 600 12px var(--font-mono); letter-spacing: .08em;
  background: var(--panel-solid); border: 1px solid var(--red); color: #ffd0d8; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: vb-pulse 1s infinite; }
.conn.ok { border-color: var(--green); color: #cffff0; } .conn.ok .dot { background: var(--green); animation: none; }

/* Buttons – abgeschrägte Ecken (clip-path), Rahmen als Pseudo-Layer */
.btn {
  --c: var(--accent);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 22px;
  font: 700 13px/1 var(--font-ui); letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
  color: var(--c); background: transparent; border: 0;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  transition: color var(--t), transform 120ms, text-shadow var(--t);
}
.btn::before { content: ''; position: absolute; inset: 0; z-index: -2; background: var(--c); opacity: .5; clip-path: inherit; transition: opacity var(--t); }
.btn::after { content: ''; position: absolute; inset: 1px; z-index: -1;
  background: linear-gradient(180deg, rgb(var(--acc-rgb) / .16), rgb(var(--acc-rgb) / .04)), #03111d;
  clip-path: polygon(calc(var(--cut) - .5px) 0, 100% 0, 100% calc(100% - var(--cut) + .5px), calc(100% - var(--cut) + .5px) 100%, 0 100%, 0 calc(var(--cut) - .5px));
  transition: background var(--t); }
.btn:hover:not(:disabled) { text-shadow: 0 0 10px currentColor; }
.btn:hover:not(:disabled)::before { opacity: 1; }
.btn:hover:not(:disabled)::after { background: linear-gradient(180deg, rgb(var(--acc-rgb) / .3), rgb(var(--acc-rgb) / .1)), #04182a; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; } .btn:focus-visible::before { opacity: 1; background: var(--accent-hi); } .btn:focus-visible::after { inset: 2.5px; }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.5); }
.btn-primary { color: #02141c; }
.btn-primary::before { opacity: 1; }
.btn-primary::after { background: linear-gradient(180deg, var(--accent-hi), var(--accent) 60%, var(--accent-dim)); }
.btn-primary:hover:not(:disabled)::after { background: linear-gradient(180deg, #fff, var(--accent-hi) 60%, var(--accent)); }
.btn-primary:hover:not(:disabled) { text-shadow: none; filter: drop-shadow(0 0 12px rgb(var(--acc-rgb) / .8)); }
.btn-secondary { --c: var(--accent); }
.btn-ghost { --c: var(--muted); min-height: 38px; padding: 0 16px; }
.btn-ghost::before { opacity: 0; } .btn-ghost::after { background: transparent; }
.btn-ghost:hover:not(:disabled) { --c: var(--accent); } .btn-ghost:hover:not(:disabled)::before { opacity: .6; } .btn-ghost:hover:not(:disabled)::after { background: rgb(var(--acc-rgb) / .08); }
.btn-cta { --c: var(--amber); color: #1c1200; }
.btn-cta::before { opacity: 1; }
.btn-cta::after { background: linear-gradient(180deg, #ffe39c, var(--amber) 55%, #c98400); }
.btn-cta:hover:not(:disabled) { filter: drop-shadow(0 0 14px rgb(255 176 32 / .85)); text-shadow: none; }
.btn-cta:hover:not(:disabled)::after { background: linear-gradient(180deg, #fff2c8, #ffc44d 55%, var(--amber)); }
.btn-danger { --c: var(--red); }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 11.5px; --cut: 7px; }
.btn-xl { min-height: 54px; padding: 0 34px; font-size: 15px; letter-spacing: .2em; }

/* Felder */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font: 600 11px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.input {
  width: 100%; min-height: 44px; padding: 0 14px; color: var(--text);
  background: rgb(0 12 22 / .7); border: 1px solid var(--line-dim); border-bottom-color: var(--line); border-radius: var(--r);
  font: 500 16px var(--font-ui); letter-spacing: .04em; transition: border-color var(--t), box-shadow var(--t);
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--glow); }
.input-lg { min-height: 52px; font-size: 18px; font-family: var(--font-display); font-weight: 500; letter-spacing: .08em; }
.input-code { font-family: var(--font-mono); font-size: 20px; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.input:disabled { opacity: .6; }

/* Segment-Auswahl */
.seg { display: flex; flex-wrap: wrap; gap: 5px; }
.seg-btn { min-height: 34px; padding: 0 13px; background: rgb(0 12 22 / .6); border: 1px solid var(--line-dim); color: var(--muted); font: 600 13px var(--font-ui); letter-spacing: .06em; transition: var(--t); }
.seg-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.seg-btn.active { background: rgb(var(--acc-rgb) / .2); border-color: var(--accent); color: var(--accent-hi); box-shadow: inset 0 0 12px rgb(var(--acc-rgb) / .2), var(--glow); }
.seg.readonly .seg-btn { cursor: default; }
.seg-btn:disabled { cursor: default; }
.slider { width: 100%; accent-color: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font: 600 12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--line-dim); background: rgb(var(--acc-rgb) / .07); }
.pill .icon { width: 13px; height: 13px; }
.pill.live { color: var(--amber); border-color: rgb(255 176 32 / .5); background: rgb(255 176 32 / .08); }
.pill.warn { color: var(--amber); border-color: rgb(255 176 32 / .5); }
.pill.bad { color: var(--red); border-color: rgb(255 77 109 / .5); }

/* Top-Leiste (Listen/Lobby) */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: linear-gradient(180deg, rgb(2 8 14 / .92), rgb(2 8 14 / .55)); border-bottom: 1px solid var(--line-dim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.topbar-title { font: 700 18px var(--font-display); letter-spacing: .18em; text-transform: uppercase; color: var(--accent-hi); text-shadow: var(--glow); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.panel-title { display: flex; align-items: center; gap: 8px; font: 700 13px var(--font-display); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }

/* Dialoge */
dialog { padding: 0; color: var(--text); border: 0; background: transparent; max-width: calc(100vw - 24px); pointer-events: auto; }   /* #app erbt pointer-events:none – Dialoge müssen klickbar bleiben */
dialog::backdrop { background: rgb(0 4 9 / .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog { position: fixed; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 30px); overflow: auto; padding: 20px 22px 22px;
  background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 0 0 1px rgb(var(--acc-rgb) / .12), 0 20px 70px rgb(0 0 0 / .7), var(--glow); animation: vb-in 200ms var(--ease); }
.dialog-wide { width: min(860px, calc(100vw - 24px)); }
.dialog-xl { width: min(1100px, calc(100vw - 24px)); }
.dialog-vote { width: min(460px, calc(100vw - 24px)); }
.vote-text { margin-top: 10px; line-height: 1.45; }
.vote-timer { height: 4px; margin-top: 16px; background: rgb(var(--acc-rgb) / .15); overflow: hidden; }
.vote-timer i { display: block; height: 100%; width: 100%; background: var(--accent); box-shadow: var(--glow); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.dialog h3 { font: 700 16px var(--font-display); letter-spacing: .2em; text-transform: uppercase; color: var(--accent-hi); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.opts-body { display: flex; flex-direction: column; gap: 14px; }
.opt { display: flex; flex-direction: column; gap: 7px; }
.opt-head { display: flex; justify-content: space-between; align-items: baseline; }
.opt-label { font: 600 12px var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.opt-desc { font-size: 13px; color: var(--faint); line-height: 1.35; }
.opt-group { display: flex; flex-direction: column; gap: 14px; padding-top: 12px; margin-top: 4px; border-top: 1px dashed var(--line-dim); }
.opt-group-title { font: 700 11px var(--font-display); letter-spacing: .22em; text-transform: uppercase; color: var(--accent-dim); }

/* Handbuch */
.rules-body { display: grid; gap: 16px; font-size: 15px; }
.rules-body h4 { font: 700 13px var(--font-display); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.rules-body p, .rules-body li { color: var(--text); opacity: .92; }
.rules-body ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.rules-body kbd { display: inline-block; padding: 0 6px; min-width: 22px; text-align: center; font: 600 12px var(--font-mono); color: var(--accent-hi); border: 1px solid var(--line); background: rgb(var(--acc-rgb) / .08); }
.rules-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rules-body th, .rules-body td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-faint); }
.rules-body th { font: 600 11px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* Toasts */
.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(560px, calc(100vw - 24px)); }
.toast { padding: 10px 18px; font: 600 14px var(--font-ui); letter-spacing: .04em; color: var(--text); background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--glow); animation: vb-in 180ms var(--ease); }
.toast.error { border-color: var(--red); color: #ffd6de; box-shadow: 0 0 14px rgb(255 77 109 / .4); }
.toast.good { border-color: var(--green); color: #d2ffee; box-shadow: 0 0 14px rgb(56 255 176 / .3); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgb(var(--acc-rgb) / .4) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: rgb(var(--acc-rgb) / .35); } ::-webkit-scrollbar-track { background: transparent; }
