@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;
  --font: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font, '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 .accent { 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); }

/* Style von dem Footer */
.site-footer {
  max-width: 1040px; margin: 0 auto; padding: 24px 16px 40px;
  text-align: center; font-size: 12px; color: var(--line);
}
.stealth-link { color: inherit; text-decoration: none; cursor: default; transition: color .3s; }
.stealth-link:hover, .stealth-link:focus-visible { color: var(--muted); }

/* Anmeldung */
.wrap.narrow { max-width: 620px; }
.price-card { text-align: center; margin-bottom: 20px; }
.price-label { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.price { font-size: clamp(40px, 10vw, 64px); font-weight: 700; line-height: 1.1; color: var(--accent); letter-spacing: -0.03em; }
.price-card .hint { margin: 8px auto 0; max-width: 440px; }
.payment { background: var(--panel-2); border-radius: 10px; padding: 10px 14px; margin: 14px 0 0; white-space: pre-line; }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.field input { color: var(--text); font-size: 16px; }
.mc-input { display: flex; gap: 10px; align-items: center; }
.mc-input input { flex: 1; font-family: 'JetBrains Mono', monospace; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.check b { color: var(--text); }
.cancel-link { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.cancel-link p { margin: 0 0 10px; font-size: 14px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.notice { text-align: center; margin-top: 16px; }
button:disabled { opacity: .6; cursor: default; }

/* Anmeldung: Login-Reiter und Status */
nav.auth-tabs { margin-bottom: 20px; }
nav.auth-tabs a { flex: 1; text-align: center; }
#doneView .card + .card { margin-top: 20px; }
.status-badge {
  display: grid; gap: 2px; margin-top: 18px; padding: 14px 16px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.status-badge b { font-size: 22px; letter-spacing: -0.01em; }
.status-badge span { color: var(--muted); font-size: 14px; }
.status-badge.unpaid b { color: var(--muted); }
.status-badge.paid { border-color: var(--accent); }
.status-badge.paid b { color: var(--accent); }
.status-badge.whitelisted { border-color: var(--good); }
.status-badge.whitelisted b { color: var(--good); }
.steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.steps li {
  padding: 8px 10px; border-radius: 10px; background: var(--panel-2); color: var(--muted);
  font-size: 13px; text-align: center; border: 1px solid var(--line);
}
.steps li.done { color: var(--good); border-color: rgba(87, 214, 141, .35); }
.steps li.done::before { content: '✓ '; }
.steps li.current { color: var(--accent); border-color: var(--accent); }
.badge-status { border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 500; background: var(--panel-2); color: var(--muted); }
.badge-status.paid { color: var(--accent); }
.badge-status.whitelisted { color: var(--good); }

/* Admin: Anmeldungen */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
table.regs tbody tr { cursor: default; }
table.regs td.paid { color: var(--good); }
.regs .actions { display: flex; gap: 6px; justify-content: flex-end; }
.regs button { padding: 6px 10px; font-size: 13px; }
.hooks { list-style: none; margin: 0 0 14px; padding: 0; }
.hooks li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hooks li.off .url { opacity: .45; }
.hooks .url { font-family: 'JetBrains Mono', monospace; font-size: 13px; word-break: break-all; }
.hooks .meta { color: var(--muted); font-size: 12px; }
.hooks .actions { display: flex; gap: 6px; flex-shrink: 0; }
.hooks button { padding: 6px 10px; font-size: 13px; }
.ev-registered { color: var(--good); }
.ev-cancelled, .ev-removed { color: var(--bad); }

@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%; }
}

/* "Ich habe bezahlt" (Spieler) und offene Aufgaben (Admin) */
.pay-box { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--panel-2); display: grid; gap: 10px; justify-items: start; }
.pay-box p { margin: 0; font-size: 14px; color: var(--muted); }
.pay-box .error { margin-top: 0; min-height: 0; }
.badge-status.in_progress { color: var(--accent); }
table.regs tr.needs-action td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.regs tr.needs-action .badge-status { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* Admin-Panel: mehr Platz für die Tabelle */
.wrap.wide { max-width: 1320px; }

/* Webhooks: Ereignis-Gruppen */
.hook-groups { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; }
.hook-chips { margin: 8px 0 0; gap: 6px; }
.hooks .hook-chips .chip { padding: 3px 10px; font-size: 12px; }

/* Discord-Login */
a.button.discord-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: #5865f2; color: #fff; justify-self: start;
}
.discord-logo { width: 20px; height: 20px; flex-shrink: 0; }
.discord-me {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel-2); border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--muted);
}
.discord-me b { color: var(--text); }
.verified { color: var(--good); font-size: 13px; }
button.small { padding: 5px 10px; font-size: 13px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 4px 0 2px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Umfragen */
.polls { display: grid; gap: 14px; }
.poll { background: var(--panel-2); border-radius: 12px; padding: 14px 16px; display: grid; gap: 8px; }
.poll-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.poll-head .badge-status { background: var(--panel); flex-shrink: 0; }
.poll .error { margin-top: 0; min-height: 0; }
.poll-options { display: grid; gap: 6px; margin-top: 4px; }
.poll-option {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 10px;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer;
}
.poll-option.readonly { grid-template-columns: 1fr auto; cursor: default; }
.poll-option input { margin: 0; accent-color: var(--accent); }
.poll-option:has(input:checked) { border-color: var(--accent); }
.poll-label { font-size: 15px; }
.poll-label .mine { color: var(--accent); font-size: 12px; margin-left: 4px; }
.poll-count { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--muted); white-space: nowrap; }
.poll-bar { grid-column: 1 / -1; height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.poll-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.poll-voters { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-family: 'JetBrains Mono', monospace; word-break: break-word; }
.poll-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.poll-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.poll-form textarea { font: inherit; }

/* Umfragen: automatisches Ende */
.poll-ends { color: var(--accent); }
.poll-end { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.poll-end .hint b { color: var(--text); font-weight: 500; }
.date-input { color-scheme: dark; padding: 6px 10px; font-size: 14px; }
.field .date-input { justify-self: start; font-size: 15px; padding: 9px 12px; }

/* Texte aus dem Oberadmin-Panel: Zeilenumbrüche übernehmen */
[data-t] { white-space: pre-line; }

/* Footer-Links (Admin, Oberadmin, Fixes) */
.footer-links { display: flex; justify-content: center; gap: 6px 14px; flex-wrap: wrap; margin-top: 6px; }
.footer-links a { color: var(--muted); opacity: .7; text-decoration: none; transition: opacity .3s, color .3s; }
.footer-links a:hover, .footer-links a:focus-visible { opacity: 1; color: var(--text); }

/* Fixes-Seite */
.fixes { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.fix { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.fix-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fix-head h2 { margin: 0; font-size: 17px; }
.fix-head time { color: var(--muted); font-size: 13px; font-family: 'JetBrains Mono', monospace; }
.fix p { margin: 8px 0 0; color: var(--muted); white-space: pre-line; }
.fix-tag { display: inline-block; margin-right: 8px; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; background: var(--accent); color: var(--accent-ink); vertical-align: 2px; }
.fix-tag.fix-bug { background: var(--bad); color: #fff; }
.fix-tag.fix-neu { background: var(--good); color: #0e0c12; }

/* Oberadmin-Panel */
nav.oa-tabs { margin-bottom: 20px; max-width: 520px; }
nav.oa-tabs a { flex: 1; text-align: center; }
.oa-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 460px); gap: 20px; align-items: start; }
.oa-main .card + .card, .oa-panel > .card + div > .card:first-child { margin-top: 20px; }
#textGroups .card { margin-top: 20px; }
.oa-search { width: 100%; margin-top: 10px; }
.oa-texts { display: grid; gap: 14px; }
.oa-text { display: grid; gap: 6px; padding-left: 10px; border-left: 3px solid transparent; }
.oa-text.changed { border-left-color: var(--accent); }
.oa-text-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.oa-text-head code { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.oa-text-head button { margin-left: auto; }
.oa-changed { display: none; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 8px; font-size: 11px; font-weight: 700; }
.oa-text.changed .oa-changed { display: inline-block; }
.oa-text textarea, .oa-fix textarea { width: 100%; resize: vertical; }
.oa-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 20px; }
.oa-color { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.oa-color code { font-family: 'JetBrains Mono', monospace; font-size: 11px; margin-left: 4px; }
.oa-color-inputs { display: flex; gap: 8px; align-items: center; }
.oa-color-inputs input[type="color"] { width: 44px; height: 40px; padding: 3px; cursor: pointer; }
.oa-color-inputs input[data-kind="hex"] { width: 110px; }
.oa-code { width: 100%; font-family: 'JetBrains Mono', monospace; font-size: 13px; resize: vertical; }
.oa-fixes { display: grid; gap: 12px; margin: 14px 0; }
.oa-fix { background: var(--panel-2); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.oa-fix-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.oa-grow { flex: 1 1 200px; }
.oa-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.oa-savebar {
  position: sticky; bottom: 0; z-index: 5; margin-top: 20px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
}
.oa-savebar .error { margin: 0; min-height: 0; }
.oa-preview { position: sticky; top: 16px; }
.oa-preview iframe { width: 100%; height: min(78vh, 900px); border: 1px solid var(--line); border-radius: 10px; background: var(--bg); margin-top: 8px; }
@media (max-width: 980px) {
  .oa-layout { grid-template-columns: 1fr; }
  .oa-preview { position: static; }
}
