@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #0e0c12;
  --panel: #17141d;
  --panel-2: #1f1b27;
  --line: #2c2636;
  --text: #ece8f2;
  --muted: #9a92a8;
  --accent: #f5b43c;
  --accent-ink: #1a1305;
  --good: #57d68d;
  --bad: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 'Space Grotesk', system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); }
.mono, .num { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.hidden { display: none !important; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; }

header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 28px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.brand h1 span { color: var(--accent); }
.brand small { color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.dot.on { background: var(--good); box-shadow: 0 0 10px var(--good); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}
.card + .card, .section + .section { margin-top: 20px; }
.card h2 { margin: 0 0 14px; font-size: 18px; }

/* NNN-Fortschritt */
.hero { display: grid; gap: 14px; }
.hero .day { font-size: clamp(34px, 7vw, 56px); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.hero .day em { font-style: normal; color: var(--accent); }
.hero .sub { color: var(--muted); }
.progress { height: 12px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, #f5b43c, #ff7a45); border-radius: 999px; transition: width .6s; }

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 20px; }
.stat { background: var(--panel-2); border-radius: 12px; padding: 14px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 700; }

/* Formulare */
form.inline { display: flex; gap: 10px; flex-wrap: wrap; }
input, select, textarea {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input.code {
  font-family: 'JetBrains Mono', monospace; font-size: 24px; letter-spacing: .3em; text-transform: uppercase;
  width: 220px; text-align: center;
}
button {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px;
  padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer;
}
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); font-weight: 500; }
button:hover { filter: brightness(1.08); }
.error { color: var(--bad); margin-top: 10px; min-height: 1.5em; }
.hint { color: var(--muted); font-size: 14px; }
kbd {
  font-family: 'JetBrains Mono', monospace; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px; color: var(--accent);
}

/* Spieler */
.me { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.me img, .avatar { border-radius: 6px; image-rendering: pixelated; }
.me h2 { margin: 0; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { flex: 1 1 180px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.num, th.num { text-align: right; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel-2); }
tr.self td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.player-cell { display: flex; align-items: center; gap: 10px; }
.online-badge { color: var(--good); font-size: 12px; }

/* Detail-Dialog */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
  width: min(560px, calc(100vw - 32px)); padding: 22px;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.deaths { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow-y: auto; }
.deaths li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.deaths time { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* Admin */
.quotes { list-style: none; padding: 0; margin: 0; }
.quotes li {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.quotes li.off .q { opacity: .45; }
.quotes .q p { margin: 0; }
.quotes .q small { color: var(--muted); }
.quotes .actions { display: flex; gap: 8px; flex-shrink: 0; }
.stack { display: grid; gap: 10px; }

/* Web-App: Navigation, Login, Geräte */
nav.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
nav.tabs a {
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 9px; font-size: 14px; font-weight: 500;
}
nav.tabs a.active { background: var(--panel-2); color: var(--text); }
.header-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.login-lead { font-size: 18px; margin: 0 0 18px; }
a.button {
  display: inline-block; background: var(--accent); color: var(--accent-ink); border-radius: 10px;
  padding: 10px 16px; font-weight: 700; text-decoration: none;
}
a.button:hover { filter: brightness(1.08); }

.back { color: var(--muted); text-decoration: none; font-size: 14px; display: inline-block; margin-bottom: 12px; }
.back:hover { color: var(--text); }
.stat .cmp { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ranks { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 0; }
.rank { background: var(--panel-2); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--muted); }
.rank b { color: var(--accent); }

.devices { list-style: none; margin: 0; padding: 0; }
.devices li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.devices .meta { color: var(--muted); font-size: 13px; }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; margin-left: 6px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between h2 { margin: 0; }
/* Spieler-Seite: Filter, sortierbare Tabelle */
.select-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font-weight: 500; font-size: 14px;
}
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
table.board th.sortable { cursor: pointer; user-select: none; }
table.board th.sortable:hover { color: var(--text); }
table.board th.active { color: var(--accent); }
table.board td.active { color: var(--accent); font-weight: 700; }
table.board .sticky { position: sticky; left: 0; background: var(--panel); z-index: 1; }
table.board tbody tr:hover .sticky { background: var(--panel-2); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.grid-2 .card + .card { margin-top: 0; }
.deaths .in { color: var(--good); }
.deaths .out { color: var(--muted); }

@media (max-width: 600px) {
  nav.tabs { order: 3; width: 100%; }
  nav.tabs a { flex: 1; text-align: center; padding: 7px 6px; }
  .hide-sm { display: none; }
  input.code { width: 100%; }
}
