:root {
  --ink: #0c0c0b;
  --panel: #151513;
  --panel-2: #1c1c19;
  --line: #2b2a26;
  --line-strong: #3d3b35;
  --text: #ede7da;
  --muted: #8e887b;
  --signal: #ff6b2c;
  --signal-dim: #ff6b2c22;
  --ok: #c8f53a;
  --danger: #ff5247;
  --radius: 14px;
  --display: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, #ff6b2c14, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #c8f53a0a, transparent 60%),
    var(--ink);
  color: var(--text);
  font: 400 15px/1.5 var(--display);
  -webkit-font-smoothing: antialiased;
}

/* Körnung über allem */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .06; mix-blend-mode: overlay;
  background-image: 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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mono { font-family: var(--mono); }
.kicker { margin: 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.02em; }
a { color: var(--signal); }
img { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--panel-2); color: var(--text); font: 600 14px var(--display);
  cursor: pointer; text-decoration: none; transition: transform .12s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn--signal { background: var(--signal); border-color: var(--signal); color: #160700; }
.btn--signal:hover { background: #ff8550; border-color: #ff8550; }
.btn--danger { color: var(--danger); }
.btn--ghost { background: transparent; }
.btn--big { padding: 16px 26px; font-size: 17px; border-radius: 12px; }
.btn--icon { padding: 8px 11px; font-size: 16px; line-height: 1; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.login__card { max-width: 560px; position: relative; z-index: 1; animation: rise .7s cubic-bezier(.2,.8,.2,1) both; }
.login__title { font-size: clamp(44px, 8vw, 84px); line-height: .95; font-weight: 800; margin: 14px 0 22px; }
.login__title span { color: var(--signal); }
.login__text { color: var(--muted); font-size: 17px; max-width: 46ch; margin: 0 0 30px; }
.login__text strong { color: var(--text); font-weight: 600; }
.login__error { color: var(--danger); margin-top: 18px; font-size: 13px; }
.login__deco {
  position: absolute; right: -2vw; bottom: -4vh; display: grid; grid-template-columns: repeat(2, auto);
  gap: 0 3vw; font-size: clamp(60px, 14vw, 190px); font-weight: 600; line-height: .9;
  color: transparent; -webkit-text-stroke: 1px var(--line-strong); opacity: .7; user-select: none;
}

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 84px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 16px 0; border-right: 1px solid var(--line); background: #0f0f0ecc; backdrop-filter: blur(8px);
}
.rail__bot { width: 48px; height: 48px; border-radius: 14px; outline: 2px solid var(--signal); outline-offset: 3px; }
.rail__divider { width: 32px; height: 1px; background: var(--line-strong); margin: 6px 0; }
.rail__guilds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.rail__guild { position: relative; }
.rail__guild button {
  width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; cursor: pointer;
  background: var(--panel-2); color: var(--text); font: 600 15px var(--display);
  transition: border-radius .2s;
}
.rail__guild button img { width: 100%; height: 100%; object-fit: cover; }
.rail__guild button:hover, .rail__guild.is-active button { border-radius: 14px; }
.rail__guild::before {
  content: ''; position: absolute; left: -18px; top: 50%; width: 5px; height: 0; border-radius: 0 4px 4px 0;
  background: var(--signal); transform: translateY(-50%); transition: height .2s;
}
.rail__guild:hover::before { height: 18px; }
.rail__guild.is-active::before { height: 36px; }
.rail__add {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
  border: 1px dashed var(--line-strong); color: var(--ok); font-size: 24px; transition: border-radius .2s, background .2s;
}
.rail__add:hover { border-radius: 14px; background: #c8f53a14; }
.rail__spacer { flex: 1; }
.rail__user { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; position: relative; }
.rail__user img { width: 40px; height: 40px; border-radius: 50%; }
.rail__user:hover::after {
  content: '⏻'; position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%;
  background: #000a; color: var(--danger);
}

.main { min-width: 0; padding: 28px clamp(16px, 4vw, 48px) 80px; }
.head { display: flex; flex-direction: column; gap: 22px; margin-bottom: 28px; }
.head__title { display: flex; align-items: center; gap: 18px; }
.head__icon { width: 64px; height: 64px; border-radius: 18px; background: var(--panel-2); object-fit: cover; }
.head h1 { font-size: clamp(30px, 4.5vw, 52px); font-weight: 800; line-height: 1; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab {
  flex: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: 10px 14px 12px; font: 600 14px var(--display); position: relative; white-space: nowrap;
}
.tab span { font: 400 10px var(--mono); margin-right: 6px; opacity: .7; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--signal); }

/* ---------- Panels ---------- */
.view { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 18px; align-items: start; }
.view > * { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.view > *:nth-child(2) { animation-delay: .05s; } .view > *:nth-child(3) { animation-delay: .1s; }
.view > *:nth-child(4) { animation-delay: .15s; } .view > *:nth-child(5) { animation-delay: .2s; }
.view > *:nth-child(6) { animation-delay: .25s; }
.span-all { grid-column: 1 / -1; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel__head h2 { font-size: 20px; font-weight: 800; }
.panel__num { font: 400 11px var(--mono); color: var(--signal); letter-spacing: .1em; }
.panel__hint { color: var(--muted); font-size: 13px; margin: -6px 0 16px; }
.panel__hint code, .hint code { font-family: var(--mono); font-size: 12px; color: var(--text); background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.panel__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }

/* ---------- Formularfelder ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .label { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=number], select, textarea {
  width: 100%; background: var(--ink); color: var(--text); border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 10px 12px; font: 400 14px var(--display); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .tab:focus-visible, .switch input:focus-visible + span {
  outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-dim);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

/* Kippschalter mit LED */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-of-type { border-bottom: 0; }
.switch-row + .field { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.switch-row p { margin: 0; }
.switch-row small { display: block; color: var(--muted); font-size: 12px; }
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  display: block; width: 54px; height: 28px; border-radius: 8px; background: var(--ink); border: 1px solid var(--line-strong);
  position: relative; transition: background .2s, border-color .2s;
}
.switch span::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 5px;
  background: linear-gradient(#4a4740, #33312c); box-shadow: 0 1px 0 #ffffff14 inset; transition: transform .2s cubic-bezier(.3,1.4,.5,1);
}
.switch span::after {
  content: ''; position: absolute; right: 9px; top: 50%; width: 6px; height: 6px; border-radius: 50%;
  background: #3a3832; transform: translateY(-50%); transition: background .2s, box-shadow .2s, right .2s;
}
.switch input:checked + span { border-color: #c8f53a66; }
.switch input:checked + span::before { transform: translateX(26px); }
.switch input:checked + span::after { right: 37px; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* Chips (Wortfilter) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-height: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 999px; font: 400 12px var(--mono); }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.chip button:hover { color: var(--danger); }

/* Emoji-Auswahl */
.emoji-picker { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; max-height: 132px; overflow-y: auto; padding: 6px; background: var(--ink); border: 1px solid var(--line); border-radius: 9px; }
.emoji-picker button {
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0; font-size: 20px; line-height: 1;
  background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer; transition: background .12s, border-color .12s, transform .12s;
}
.emoji-picker button:hover { background: var(--panel-2); transform: scale(1.12); }
.emoji-picker button.is-picked { border-color: var(--signal); background: var(--signal-dim); }
.emoji-picker img { width: 24px; height: 24px; object-fit: contain; }

/* Zeilen-Editoren */
.rows { display: grid; gap: 8px; margin-bottom: 10px; }
.row { display: grid; gap: 8px; align-items: center; grid-template-columns: 90px 1fr auto; }
.row--punish { grid-template-columns: 80px 1fr 100px auto; }
.row .unit { font: 400 11px var(--mono); color: var(--muted); }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; }
.inline > .btn { flex: none; }

/* ---------- Übersicht ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--panel); padding: 18px 20px; }
.stat b { display: block; font: 600 clamp(28px, 3.4vw, 40px)/1 var(--mono); letter-spacing: -.04em; margin: 8px 0 2px; }
.stat:first-child b { color: var(--signal); }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.led { width: 8px; height: 8px; border-radius: 50%; background: #3a3832; flex: none; }
.led.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.checklist .go { margin-left: auto; font: 400 12px var(--mono); color: var(--muted); background: none; border: 0; cursor: pointer; }
.checklist .go:hover { color: var(--signal); }
.meter { height: 6px; border-radius: 4px; background: var(--ink); overflow: hidden; margin: 4px 0 14px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--signal), var(--ok)); border-radius: 4px; transition: width .6s; }

/* Tabellen / Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.tag { font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted); flex: none; }
.tag--live { color: #160700; background: var(--signal); border-color: var(--signal); }
.tag--warn { color: var(--signal); border-color: #ff6b2c55; }
.tag--ban { color: var(--danger); border-color: #ff524755; }
.rank { font: 600 13px var(--mono); color: var(--muted); width: 28px; flex: none; }
.rank.top { color: var(--signal); }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.empty-note { color: var(--muted); font-size: 14px; padding: 8px 0; margin: 0; }

/* Musik */
.player { display: grid; grid-template-columns: 132px 1fr; gap: 20px; align-items: center; }
.player__art { width: 132px; aspect-ratio: 1; border-radius: 12px; object-fit: cover; background: var(--panel-2); }
.player__art.spin { animation: spin 14s linear infinite; border-radius: 50%; }
.player h3 { font-size: 22px; font-weight: 800; line-height: 1.15; margin-bottom: 4px; }
.player .by { color: var(--muted); margin: 0 0 14px; }
.progress { height: 4px; background: var(--ink); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.progress i { display: block; height: 100%; background: var(--signal); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.controls input[type=range] { accent-color: var(--signal); width: 140px; }
.eq { display: inline-flex; gap: 3px; align-items: flex-end; height: 14px; margin-right: 6px; }
.eq i { width: 3px; background: var(--signal); animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; } .eq i:nth-child(3) { animation-delay: .4s; }
.paused .eq i { animation-play-state: paused; }

/* Toast */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 10px; background: var(--text); color: var(--ink); font-weight: 600;
  transform: translateY(calc(100% + 40px)); visibility: hidden;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility 0s .3s; box-shadow: 0 10px 40px #000a;
}
.toast.show { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.toast.error { background: var(--danger); color: #fff; }

.empty { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 12px; padding: 16px; }
.empty h2 { font-size: 32px; }
.empty p { color: var(--muted); margin: 0 0 8px; }
.empty .btn { justify-self: center; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Mobil ---------- */
@media (max-width: 720px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; z-index: 10; height: auto; flex-direction: row; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .rail__bot { width: 38px; height: 38px; }
  .rail__divider { width: 1px; height: 28px; margin: 0 2px; }
  .rail__guilds { flex-direction: row; overflow: visible; }
  .rail__guild button, .rail__add { width: 40px; height: 40px; }
  .rail__guild::before { left: 50%; top: auto; bottom: -10px; height: 4px !important; width: 0; transform: translateX(-50%); border-radius: 4px 4px 0 0; transition: width .2s; }
  .rail__guild.is-active::before { width: 24px; }
  .rail__spacer { display: none; }
  .main { padding-top: 20px; }
  .head__icon { width: 48px; height: 48px; border-radius: 14px; }
  .player { grid-template-columns: 1fr; }
  .player__art { width: 96px; }
  .row--punish { grid-template-columns: 56px minmax(0, 1fr) 64px auto; gap: 6px; }
}
