:root {
  --bg: #0a0c11;
  --surface: #11141b;
  --surface-2: #171b24;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #e9ecf2;
  --muted: #8a91a2;
  --faint: #5b6273;
  --online: #22c55e;
  --offline: #ef4444;
  --pending: #a1a1aa;
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  inset: -20vh -10vw auto;
  height: 70vh;
  pointer-events: none;
  background:
    radial-gradient(40% 60% at 15% 20%, rgba(255, 122, 26, 0.13), transparent 70%),
    radial-gradient(35% 55% at 50% 0%, rgba(95, 191, 90, 0.10), transparent 70%),
    radial-gradient(40% 60% at 85% 15%, rgba(74, 163, 255, 0.14), transparent 70%);
  filter: blur(20px);
  z-index: 0;
  animation: glow-drift 18s ease-in-out infinite alternate;
}

@keyframes glow-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
  50% { transform: translate3d(4vw, 3vh, 0) scale(1.08); opacity: 1; }
  100% { transform: translate3d(-3vw, 1vh, 0) scale(0.96); opacity: 0.8; }
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
}

.hero,
.grid,
.footer {
  position: relative;
  z-index: 1;
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
}

/* ---------- Hero ---------- */

.hero { padding: 56px 0 32px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--online);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.brand span { color: var(--text); }
.brand-mark { width: 30px; height: 30px; }

h1 {
  margin: 22px 0 6px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 750;
}

.lead { margin: 0; color: var(--muted); font-size: 1.05rem; }

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(17, 20, 27, 0.7);
  backdrop-filter: blur(10px);
}
.chip-value { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.chip-label { color: var(--muted); font-size: 0.9rem; }

.chip-refresh { align-items: center; }
.ring { width: 18px; height: 18px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring-track { stroke: var(--border-strong); }
.ring-bar {
  stroke: var(--online);
  stroke-linecap: round;
  stroke-dasharray: 94.25;
  stroke-dashoffset: 94.25;
}

/* ---------- Grid ---------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 40px;
}

.card {
  --accent: #888;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 140px),
    rgba(17, 20, 27, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); transform: translateY(-2px); }
.card.is-offline { --accent: #6b7280; }

.card-head { display: flex; align-items: center; gap: 14px; }

.game-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.game-icon svg { width: 24px; height: 24px; }

.game-meta { min-width: 0; flex: 1; }
.game-label { margin: 0; font-size: 1.08rem; font-weight: 650; letter-spacing: -0.01em; }
.game-sub { margin: 0; color: var(--muted); font-size: 0.85rem; }

.status {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--pending);
  background: rgba(161, 161, 170, 0.1);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.online { color: var(--online); background: rgba(34, 197, 94, 0.1); }
.status.online .dot { animation: pulse 2s infinite; }
.status.offline { color: var(--offline); background: rgba(239, 68, 68, 0.1); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.server-name {
  margin: 0;
  min-height: 2.9em;
  font-size: 0.95rem;
  font-weight: 550;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.server-name.placeholder { color: var(--faint); font-weight: 450; }

/* Spieler */

.players-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.players-count { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.players-count small { font-size: 1rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.players-label { color: var(--muted); font-size: 0.85rem; }

.bar {
  height: 6px;
  margin-top: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(.2, .8, .2, 1);
}

/* Verlauf */

.spark { display: block; width: 100%; height: 44px; }
.spark-area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-caption { display: flex; justify-content: space-between; margin-top: 2px; color: var(--faint); font-size: 0.74rem; }

/* Details */

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.fact {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  min-width: 0;
}
.fact dt { color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.fact dd { margin: 2px 0 0; font-size: 0.88rem; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Spielerliste */

.player-list summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  list-style: none;
  user-select: none;
}
.player-list summary::-webkit-details-marker { display: none; }
.player-list summary::before { content: "▸ "; display: inline-block; transition: transform 0.2s; }
.player-list[open] summary::before { transform: rotate(90deg); }
.player-list ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  max-height: 140px;
  overflow-y: auto;
}
.player-list li {
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.8rem;
}

/* Aktionen */

.actions { display: flex; gap: 8px; margin-top: auto; }

.btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  background: var(--accent);
  color: #0a0c11;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.2s, transform 0.1s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }

button:focus-visible,
a:focus-visible,
summary:focus-visible { outline: 2px solid var(--accent, var(--online)); outline-offset: 2px; }

/* Skeleton */

.skeleton .server-name,
.skeleton .players-count,
.skeleton .fact dd {
  color: transparent;
  background: linear-gradient(90deg, var(--surface-2) 25%, #1f2430 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Footer */

.footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 48px;
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

/* Discord & Hilfe */

.chip-discord {
  align-items: center;
  color: #c9cdfb;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-color: rgba(88, 101, 242, 0.45);
  background: rgba(88, 101, 242, 0.16);
  transition: background 0.2s, border-color 0.2s;
}
.chip-discord:hover { background: rgba(88, 101, 242, 0.28); border-color: rgba(88, 101, 242, 0.7); color: #fff; }
.chip-discord svg { width: 18px; height: 18px; align-self: center; }

.btn-help {
  flex: 1;
  justify-content: center;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-help svg { color: var(--accent); }
.btn-help:hover { filter: none; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }

.btn-discord { background: #5865f2; color: #fff; }

.modal {
  --accent: var(--online);
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 160px),
    var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal::backdrop { background: rgba(5, 6, 10, 0.7); backdrop-filter: blur(4px); }
.modal[open] { animation: modal-in 0.22s cubic-bezier(.2, .8, .2, 1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

.modal-inner { display: flex; flex-direction: column; gap: 20px; padding: 22px; }
.modal-head { display: flex; align-items: center; gap: 14px; }
.modal-kicker { margin: 0; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.help-title { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.modal-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

.steps { counter-reset: step; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: step; position: relative; padding-left: 40px; color: #cfd3dc; font-size: 0.93rem; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.steps code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.84em;
  color: var(--text);
}
.steps a, .modal-discord p a { color: #a5adff; }

.modal-discord {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.1);
}
.modal-discord p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.modal-discord strong { display: block; color: var(--text); font-weight: 600; }

@media (max-width: 520px) {
  .modal-discord { flex-direction: column; align-items: stretch; }
  .modal-discord .btn { justify-content: center; }
}

@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .hero { padding-top: 36px; }
  .card { padding: 18px; }
  .actions { flex-wrap: wrap; }
  .btn { flex: 1; justify-content: center; }
}

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