:root {
  --bg: #0b111c;
  --panel: #142035;
  --edge: #263a5c;
  --text: #eaf1fb;
  --muted: #94a7c6;
  --aqua: #55ffff;
  --gold: #ffcc33;
  --green: #55ff55;
  --red: #ff5555;
  --notch: 4px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Kaestchen mit abgeschnittenen Pixel-Ecken */
.px {
  --n: var(--notch);
  background: var(--panel);
  box-shadow: inset 0 0 0 2px var(--edge), inset 4px 4px 0 rgb(255 255 255 / 0.04), inset -4px -4px 0 rgb(0 0 0 / 0.25);
  clip-path: polygon(0 var(--n), var(--n) var(--n), var(--n) 0, calc(100% - var(--n)) 0,
    calc(100% - var(--n)) var(--n), 100% var(--n), 100% calc(100% - var(--n)),
    calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%, var(--n) 100%,
    var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n)));
}

/* Kopf: Himmel, Pixelwolken, Grasblock-Kante */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 16px 80px;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(180deg, #3b86d1 0%, #2565a8 55%, #1b4f88 100%);
}
.hero > * { position: relative; }
.hero::before {
  content: "";
  position: absolute;
  top: 56px;
  left: 6%;
  width: 112px;
  height: 24px;
  background: #cfe4fa;
  box-shadow: 24px -16px 0 #cfe4fa, 72vw 48px 0 #8fbbe9, calc(72vw + 32px) 32px 0 #8fbbe9;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32px;
  background:
    repeating-linear-gradient(90deg, #6cc644 0 12px, #5aae38 12px 20px, #7bd34f 20px 32px, #5aae38 32px 40px) top / 100% 10px no-repeat,
    repeating-conic-gradient(#7a5532 0 25%, #684828 0 50%) 0 0 / 16px 16px;
}

.logo {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 rgb(0 0 0 / 0.35));
}
.title {
  font-size: clamp(2.5rem, 9vw, 4.75rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 4px 4px 0 rgb(0 0 0 / 0.4);
}
.pixel { color: var(--aqua); }
.craft { color: var(--gold); }
.tagline { color: #e6f2ff; font-weight: 600; text-shadow: 2px 2px 0 rgb(0 0 0 / 0.25); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgb(0 0 0 / 0.3);
  font-size: 0.95rem;
  font-weight: 700;
}
.dot { width: 10px; height: 10px; background: var(--muted); }
.status[data-state="online"] .dot { background: var(--green); box-shadow: 0 0 10px var(--green); animation: blink 2s steps(2) infinite; }
.status[data-state="offline"] .dot { background: var(--red); }
@keyframes blink { 50% { opacity: 0.35; } }

.join { display: flex; max-width: 100%; }
.address {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 10px 16px;
  background: var(--bg);
  color: var(--text);
  font: 600 1.05rem/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace;
  border: 3px solid #000;
  border-right: 0;
  overflow-wrap: anywhere;
}
.hint { max-width: 36rem; color: rgb(255 255 255 / 0.8); font-size: 0.85rem; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.links:not(:has(a:not([hidden]))) { display: none; }

/* Knoepfe wie im Spiel */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 3px solid #000;
  background: #6f6f6f;
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  text-shadow: 2px 2px 0 rgb(0 0 0 / 0.35);
  cursor: pointer;
  box-shadow: inset 3px 3px 0 rgb(255 255 255 / 0.25), inset -3px -4px 0 rgb(0 0 0 / 0.3);
}
.btn:hover { filter: brightness(1.12); }
.btn:active { box-shadow: inset -3px -3px 0 rgb(255 255 255 / 0.2), inset 3px 4px 0 rgb(0 0 0 / 0.3); }
.btn-green { background: #3c8527; }
.btn-discord { background: #5865f2; }
.btn:focus-visible, .search:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }

main {
  display: grid;
  gap: 40px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 16px 16px;
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 18px 8px; text-align: center; }
.stat-value { color: var(--aqua); font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat:first-child .stat-value { color: var(--green); }
.stat-label { margin-top: 4px; color: var(--muted); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.block { display: grid; gap: 16px; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
h2 { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 900; }
.count { padding: 0 8px; background: var(--edge); font-size: 0.9rem; }
.count:empty { display: none; }
.empty { color: var(--muted); }

.search {
  width: min(100%, 320px);
  padding: 9px 12px;
  border: 2px solid var(--edge);
  border-radius: 0;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}
.search::placeholder { color: var(--muted); }

/* Gerade online */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 10px 16px; text-align: center; }
.card::after { content: ""; position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; background: var(--green); box-shadow: 0 0 8px var(--green); }
.card .name { font-size: 1rem; font-weight: 800; overflow-wrap: anywhere; }
.card .chips { justify-content: center; }

/* Alle Spieler */
.rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; }
.info { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.row .name { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.seen { flex-shrink: 0; color: var(--muted); font-size: 0.8rem; text-align: right; }
.seen.is-online { color: var(--green); font-weight: 800; }

.head { flex-shrink: 0; background: var(--bg); image-rendering: pixelated; }
.head-lg { width: 72px; height: 72px; box-shadow: 4px 4px 0 rgb(0 0 0 / 0.35); }
.head-sm { width: 40px; height: 40px; box-shadow: 3px 3px 0 rgb(0 0 0 / 0.35); }
.head-fallback { display: grid; place-items: center; background: var(--edge); color: var(--muted); font-weight: 900; }
.head-lg.head-fallback { font-size: 2rem; }
.head-sm.head-fallback { font-size: 1.1rem; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  --c: #94a7c6;
  padding: 0 7px;
  background: color-mix(in srgb, var(--c) 20%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent);
  color: color-mix(in srgb, var(--c) 55%, white);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.6;
  white-space: nowrap;
}

.footer { padding: 32px 16px 40px; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* Akten-Seite */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 12px 16px 18px;
  background: linear-gradient(180deg, #2565a8 0%, #1b4f88 100%);
  box-shadow: inset 0 -6px 0 #5aae38;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-shadow: 2px 2px 0 rgb(0 0 0 / 0.35);
}
.brand img { image-rendering: pixelated; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 12px; color: #e6f2ff; font-weight: 800; text-decoration: none; }
.topnav a[aria-current="page"], .topnav a:hover { background: rgb(0 0 0 / 0.25); }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; color: rgb(255 255 255 / 0.85); font-size: 0.85rem; }
.btn-small { padding: 4px 10px; border-width: 2px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.page-title { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 900; }
.hint-line { color: var(--muted); }
.hint-line code { color: var(--aqua); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  padding: 7px 14px;
  background: var(--panel);
  box-shadow: inset 0 0 0 2px var(--edge);
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab.is-admin { color: var(--gold); }
.tab[aria-current="true"] { background: var(--edge); color: var(--text); box-shadow: inset 0 -3px 0 var(--aqua); }
.tab:focus-visible, .who:focus-visible, .back:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }

.entries { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.entry {
  --k: var(--muted);
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 140px 176px;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 14px 12px 16px;
}
.entry.px { box-shadow: inset 4px 0 0 var(--k), inset 0 0 0 2px var(--edge), inset -4px -4px 0 rgb(0 0 0 / 0.25); }
.entry.is-highlight { background: #1f3354; box-shadow: inset 4px 0 0 var(--gold), inset 0 0 0 2px var(--gold); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none; }
.who .name { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
a.who:hover .name { color: var(--aqua); }
.what { display: grid; gap: 2px; min-width: 0; }
.reason { font-weight: 700; overflow-wrap: anywhere; }
.detail { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.meta { display: flex; flex-direction: column; align-items: flex-end; color: var(--muted); font-size: 0.8rem; text-align: right; white-space: nowrap; }
.case { color: #6d82a6; }
.state { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.pager-info { color: var(--muted); font-size: 0.85rem; }

.back { justify-self: start; color: var(--aqua); font-weight: 800; text-decoration: none; }
.profile { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 20px; }
.profile-info { display: grid; gap: 8px; min-width: 0; }
.profile h2 { font-size: 1.8rem; overflow-wrap: anywhere; }
.head-xl { width: 96px; height: 96px; box-shadow: 4px 4px 0 rgb(0 0 0 / 0.35); }
.head-xl.head-fallback { font-size: 2.6rem; }
.access-groups { display: grid; gap: 28px; }
.access-group { display: grid; gap: 10px; }

.notice { display: grid; min-height: 100vh; place-items: center; padding: 16px; }
.notice-box { display: grid; justify-items: center; gap: 14px; max-width: 28rem; padding: 28px; text-align: center; }
.notice-box h1 { font-size: 1.6rem; }

@media (max-width: 720px) {
  .entry { grid-template-columns: minmax(0, 1fr) auto; }
  .who { order: 0; }
  .state { order: 1; }
  .what { order: 2; grid-column: 1 / -1; }
  .meta { order: 3; grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 2px 12px; align-items: center; text-align: left; }
  .account { margin-left: 0; }
}

@media (max-width: 480px) {
  .hero { padding-top: 36px; }
  .join { flex-direction: column; width: 100%; }
  .address { justify-content: center; border-right: 3px solid #000; border-bottom: 0; }
  .stat-label { font-size: 0.68rem; letter-spacing: 0.04em; }
}

@media (prefers-reduced-motion: reduce) {
  .status .dot { animation: none !important; }
}
