* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #242628;
  --panel: rgba(18, 21, 24, 0.88);
  --panel-strong: rgba(34, 39, 44, 0.94);
  --line: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: #c7d0d8;
  --good: #42d77d;
  --bad: #ff647c;
  --warn: #ffd166;
  --accent: #ffb264;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Helvetica Neue", Arial, sans-serif;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 28px;
}

.hero,
.panel,
.metric,
footer {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
}

.hero {
  border-radius: 8px;
  padding: 26px;
}

.server-id,
.status-row,
.notice-title,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 1;
  font-weight: 750;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 1rem;
}

.server-id p,
.status-meta {
  margin-top: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.server-icon {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  image-rendering: pixelated;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.hidden {
  display: none;
}

.status-row {
  justify-content: flex-start;
  margin-top: 26px;
}

.dot {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 28px currentColor;
}

.dot.online {
  background: var(--good);
  color: var(--good);
}

.dot.offline {
  background: var(--bad);
  color: var(--bad);
}

.dot.degraded {
  background: var(--warn);
  color: var(--warn);
}

.dot.unknown {
  background: var(--warn);
  color: var(--warn);
}

.status-text {
  font-size: clamp(2.1rem, 9vw, 5.8rem);
  line-height: 0.9;
  font-weight: 900;
}

.metrics,
.uptime-grid {
  display: grid;
  gap: 14px;
}

.metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.metric,
.panel,
footer {
  border-radius: 8px;
  padding: 18px;
}

.metric span,
.uptime-grid span,
footer span,
.incident-time {
  color: var(--muted);
  font-size: 0.88rem;
}

.metric strong,
.uptime-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.panel {
  margin-top: 14px;
}

.motd {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.uptime-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.uptime-grid > div,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-strong);
}

.uptime-grid > div.has-warning {
  border-color: rgba(255, 209, 102, 0.44);
}

.uptime-breakdown {
  width: 100%;
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.uptime-breakdown svg {
  display: block;
  width: 100%;
  height: 10px;
}

.uptime-breakdown rect {
  display: block;
  cursor: default;
}

.uptime-breakdown .normal {
  fill: var(--good);
}

.uptime-breakdown .degraded {
  fill: var(--warn);
}

.uptime-breakdown .offline {
  fill: var(--bad);
}

.uptime-breakdown.empty span {
  display: block;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.18);
}

.history-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4px, 1fr));
  gap: 3px;
  margin-top: 14px;
  min-height: 26px;
}

.history-cell {
  min-height: 26px;
  border-radius: 2px;
  background: var(--warn);
}

.history-cell.online {
  background: var(--good);
}

.history-cell.degraded {
  background: var(--warn);
}

.history-cell.offline {
  background: var(--bad);
}

.history-cell.unknown {
  background: rgba(255, 255, 255, 0.18);
}

.history-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.player-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4px, 1fr));
  align-items: end;
  gap: 3px;
  min-height: 104px;
  padding: 10px 0 2px;
}

.player-bar {
  display: block;
  min-height: 8px;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, rgba(66, 215, 125, 0.95), rgba(66, 215, 125, 0.42));
}

.player-bar.h-1 {
  height: 10%;
}

.player-bar.h-2 {
  height: 20%;
}

.player-bar.h-3 {
  height: 30%;
}

.player-bar.h-4 {
  height: 40%;
}

.player-bar.h-5 {
  height: 50%;
}

.player-bar.h-6 {
  height: 60%;
}

.player-bar.h-7 {
  height: 70%;
}

.player-bar.h-8 {
  height: 80%;
}

.player-bar.h-9 {
  height: 90%;
}

.player-bar.h-10 {
  height: 100%;
}

.player-bar.offline {
  background: linear-gradient(180deg, rgba(255, 100, 124, 0.95), rgba(255, 100, 124, 0.42));
}

.player-bar.degraded {
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.95), rgba(255, 209, 102, 0.42));
}

.player-bar.unknown {
  background: rgba(255, 255, 255, 0.18);
}

.player-bar.empty {
  background: rgba(255, 255, 255, 0.18);
}

.recent-list {
  display: grid;
  gap: 8px;
}

.recent-row,
.incident-note,
.maintenance-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recent-row {
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel-strong);
}

.recent-row span {
  color: var(--muted);
  font-size: 0.88rem;
}

.recent-row strong {
  color: var(--good);
}

.recent-row.offline strong {
  color: var(--bad);
}

.recent-row.degraded strong {
  color: var(--warn);
}

.recent-row.unknown strong {
  color: var(--muted);
}

.chart-tooltip {
  position: fixed;
  z-index: 40;
  max-width: min(320px, calc(100vw - 24px));
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(10, 12, 14, 0.96);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 80ms ease, transform 80ms ease;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
}

.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.incident-summary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.incident-note {
  justify-content: space-between;
  border: 1px solid rgba(66, 215, 125, 0.28);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(66, 215, 125, 0.08);
  color: var(--muted);
  font-size: 0.9rem;
}

.incident-note.ongoing {
  border-color: rgba(255, 100, 124, 0.38);
  background: rgba(255, 100, 124, 0.1);
}

.incident-note strong {
  color: var(--text);
}

.maintenance-meta {
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.maintenance-meta span {
  border: 1px solid rgba(255, 209, 102, 0.3);
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(255, 209, 102, 0.1);
  color: var(--warn);
  font-size: 0.82rem;
  font-weight: 700;
}

.notice + .notice {
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(246, 130, 31, 0.16);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.notice-title {
  margin-bottom: 8px;
  font-weight: 800;
}

.list-text {
  color: var(--text);
}

.api-error {
  color: var(--bad);
}

footer {
  margin-top: 14px;
  flex-wrap: wrap;
}

footer > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.legacy-note {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1040px);
    padding: 14px 0;
  }

  .hero {
    padding: 18px;
  }

  .server-id {
    align-items: flex-start;
  }

  .server-icon {
    width: 56px;
    height: 56px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .uptime-grid {
    grid-template-columns: 1fr;
  }

  .recent-row,
  .incident-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .player-chart {
    min-height: 86px;
  }
}

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