:root {
  color-scheme: dark light;
  --bg: #1c1e22;
  --panel: #25272d;
  --border: #2a2d35;
  --text: #e8e8ea;
  --text-dim: #9a9ca3;
  --accent-tps: #ffd75a;
  --accent-mspt: #5ab4ff;
  --good: #4caf6e;
  --warn: #e0a83b;
  --bad: #e05656;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f4f6;
    --panel: #ffffff;
    --border: #dcdde2;
    --text: #17181c;
    --text-dim: #5c5e66;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
}

header, main, footer, .live-status, .leaderboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  padding-top: 40px;
  padding-bottom: 8px;
}

.live-status {
  display: block;
  margin-top: 12px;
  font-size: 0.95rem;
}

.live-status .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}

.live-status .dot.awake { background: var(--good); box-shadow: 0 0 6px var(--good); }
.live-status .dot.starting { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.live-status .dot.asleep { background: var(--text-dim); }

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 14px;
}

.player-chip .swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.leaderboard {
  margin-top: 20px;
}

.leaderboard h2 {
  font-size: 1rem;
  margin: 0 0 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.9rem;
}

.leaderboard-list .player {
  min-width: 120px;
}

.leaderboard-list .hours {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 50px;
}

.leaderboard-list .last-login {
  color: var(--text-dim);
  font-size: 0.8rem;
}

h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
}

.meta {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0;
}

.server-address {
  margin: 8px 0 0;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.server-address .port {
  font-style: italic;
  color: var(--text-dim);
}

main {
  padding-top: 20px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dim {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.dim h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  text-transform: capitalize;
}

.dim-body {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 20px;
  align-items: start;
}

.dim-body.no-map-layout {
  grid-template-columns: 1fr;
}

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

.map-col {
  position: relative;
}

.map-col img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.map-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.map-switcher button {
  font: inherit;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.map-switcher button:hover {
  color: var(--text);
}

.map-switcher button.active {
  background: var(--accent-tps);
  border-color: var(--accent-tps);
  color: #1c1e22;
}

.spawn-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  line-height: 1;
  font-size: 20px;
  font-weight: 900;
  color: #ff4d4d;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 4px rgba(0, 0, 0, 0.6);
}

.spawn-marker::before {
  content: "+";
}

.player-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4d4d;
  border: 1.5px solid #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.no-map {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-style: italic;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 14px;
}

.stat {
  min-width: 70px;
}

.stat .label {
  display: block;
  color: var(--text-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.stat .value.good { color: var(--good); }
.stat .value.warn { color: var(--warn); }
.stat .value.bad { color: var(--bad); }

.chart-wrap {
  margin-top: 10px;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 140;
  display: block;
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}

.chart-legend .tps::before { background: var(--accent-tps); }
.chart-legend .mspt::before { background: var(--accent-mspt); }

.empty {
  color: var(--text-dim);
  font-style: italic;
}

footer {
  padding-bottom: 40px;
  color: var(--text-dim);
  font-size: 0.8rem;
}
