:root {
  --bg: #0d1117;
  --bg-raised: #161b22;
  --line: #262d38;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #55ff55;
  --accent-dim: #2ea043;
  --danger: #f8746a;
  --warn: #e3b341;
  --radius: 14px;
  --shadow: 0 10px 30px rgb(0 0 0 / 45%);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -200px, #1b2735 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: min(1200px, 100% - 3rem);
  margin-inline: auto;
}

@media (max-width: 640px) {
  .wrap { width: min(1200px, 100% - 1.75rem); }
}

/* ---------------------------------------------------------------- header */

.site-header {
  padding: 3rem 0 2rem;
  text-align: center;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.totals {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin: 1.75rem 0 0;
}

.totals div { text-align: center; }

.totals dt {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.totals dd {
  margin: 0.15rem 0 0;
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ grid */

main { flex: 1; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  padding-bottom: 2rem;
}

@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  transition: transform 140ms ease, border-color 140ms ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #3d4756;
}

.card-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: #1c2430;
  background-size: cover;
  background-position: center;
}

/* Keeps text legible over any background image. */
.card-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(13 17 23 / 62%) 0%, rgb(13 17 23 / 88%) 55%, rgb(13 17 23 / 96%) 100%);
}

.card.is-offline .card-bg { filter: grayscale(1) brightness(0.55); }

.card-body {
  padding: 1.25rem 1.35rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 200px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.card-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  image-rendering: pixelated;
  flex: none;
}

.card-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1.25;
  flex: 1;
  text-shadow: 0 1px 6px rgb(0 0 0 / 80%);
  overflow-wrap: anywhere;
}

.pill {
  flex: none;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.pill.online { color: var(--accent); background: rgb(46 160 67 / 14%); }
.pill.offline { color: var(--danger); background: rgb(248 116 106 / 12%); }
.pill.unconfigured { color: var(--warn); background: rgb(227 179 65 / 12%); }

/* ------------------------------------------------------------------ motd */

.motd {
  font-family: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #c9d1d9;
  text-shadow: 0 1px 4px rgb(0 0 0 / 90%);
  min-height: 1.2em;
}

.motd:empty::before {
  content: "No message of the day";
  color: var(--muted);
  font-style: italic;
}

.motd .bold { font-weight: 700; }
.motd .italic { font-style: italic; }
.motd .underline { text-decoration: underline; }
.motd .strikethrough { text-decoration: line-through; }
.motd .underline.strikethrough { text-decoration: underline line-through; }

/* ------------------------------------------------------------------ meta */

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.address {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  font-family: "Cascadia Mono", Consolas, monospace;
  color: var(--text);
  background: rgb(255 255 255 / 7%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: background 120ms ease;
}

.address:hover { background: rgb(255 255 255 / 13%); }
.address:disabled { cursor: default; opacity: 0.6; }

.copy-hint {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.address.copied .copy-hint { color: var(--accent); }

.version {
  font-size: 0.75rem;
  color: var(--muted);
}

/* --------------------------------------------------------------- players */

.players-count {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.players-count strong { color: var(--text); font-variant-numeric: tabular-nums; }

.players-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
  padding: 0;
}

.players-list li {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgb(46 160 67 / 18%);
  border: 1px solid rgb(46 160 67 / 45%);
}

.players-list li.more {
  background: rgb(255 255 255 / 6%);
  border-color: var(--line);
  color: var(--muted);
}

/* --------------------------------------------------------------- notices */

.notice {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

.notice.error { color: var(--danger); }

.notice code {
  background: rgb(255 255 255 / 8%);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.refresh {
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

.refresh:hover { background: rgb(255 255 255 / 8%); }
.refresh:disabled { opacity: 0.5; cursor: progress; }

@media (prefers-reduced-motion: reduce) {
  .card, .card:hover { transition: none; transform: none; }
}
