:root {
  color-scheme: dark;
  --page: #08111f;
  --surface: #0e1a2b;
  --surface-raised: #142238;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --border: rgba(176, 205, 238, 0.16);
  --border-strong: rgba(176, 205, 238, 0.28);
  --text: #f2f7fd;
  --muted: #9eb0c5;
  --accent: #55c5ff;
  --accent-strong: #8bd8ff;
  --online: #4ee39a;
  --offline: #ff6b78;
  --unknown: #aebdce;
  --warning: #ffc968;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f5f8fc;
  --surface: #ffffff;
  --surface-raised: #f8fbff;
  --surface-soft: rgba(10, 42, 75, 0.045);
  --border: rgba(25, 65, 103, 0.14);
  --border-strong: rgba(25, 65, 103, 0.24);
  --text: #102237;
  --muted: #5c7086;
  --accent: #0079b8;
  --accent-strong: #005f91;
  --online: #087d4d;
  --offline: #c52b3c;
  --unknown: #61768d;
  --warning: #9a6300;
  --shadow: 0 22px 60px rgba(35, 69, 101, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% -10%, rgba(42, 148, 210, 0.2), transparent 32rem),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

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

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.65rem 0.9rem;
  border-radius: 0.6rem;
  background: var(--text);
  color: var(--page);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.site-footer,
main {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid rgba(85, 197, 255, 0.5);
  border-radius: 0.7rem;
  background: linear-gradient(145deg, rgba(85, 197, 255, 0.22), rgba(85, 197, 255, 0.04));
  color: var(--accent-strong);
}

.icon-button,
.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
}

.icon-button:hover,
.refresh-button:hover {
  border-color: rgba(85, 197, 255, 0.55);
  background: rgba(85, 197, 255, 0.1);
}

.theme-icon,
.refresh-button svg {
  width: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon--sun,
:root[data-theme="light"] .theme-icon--moon {
  display: none;
}

:root[data-theme="light"] .theme-icon--sun {
  display: block;
}

main {
  padding-block: clamp(3.5rem, 8vw, 7rem) 5rem;
}

.hero {
  max-width: 760px;
  margin-bottom: clamp(4rem, 9vw, 7.5rem);
}

.eyebrow,
.section-heading__kicker {
  margin: 0 0 0.7rem;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 1.3rem;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.hero__copy {
  max-width: 65ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.status-section {
  scroll-margin-top: 1rem;
}

.section-heading {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-heading h2,
.community h2 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  letter-spacing: -0.035em;
}

.section-heading__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
}

.summary-pill,
.refresh-button {
  min-height: 2.65rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

.refresh-button {
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.status-notice {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.92rem;
}

.status-notice[data-tone="warning"] {
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
  color: var(--warning);
}

.status-notice[data-tone="error"] {
  border-color: color-mix(in srgb, var(--offline) 42%, transparent);
  color: var(--offline);
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.server-card {
  position: relative;
  min-height: 15rem;
  overflow: hidden;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 1.15rem;
  background: linear-gradient(145deg, var(--surface-raised), var(--surface));
  box-shadow: var(--shadow);
}

.server-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--unknown);
  content: "";
  opacity: 0.8;
}

.server-card[data-tone="online"]::before {
  background: var(--online);
}

.server-card[data-tone="offline"]::before {
  background: var(--offline);
}

.server-card[data-stale="true"]::after {
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.server-card__header,
.server-card__title-group,
.server-card__footer {
  display: flex;
  align-items: center;
}

.server-card__header {
  gap: 0.8rem;
  justify-content: space-between;
}

.server-card__title-group {
  min-width: 0;
  gap: 0.65rem;
}

.server-card__mark {
  flex: 0 0 auto;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--unknown);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--unknown) 14%, transparent);
}

.server-card[data-tone="online"] .server-card__mark {
  background: var(--online);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--online) 14%, transparent);
}

.server-card[data-tone="offline"] .server-card__mark {
  background: var(--offline);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--offline) 14%, transparent);
}

.server-card__title {
  overflow: hidden;
  margin: 0;
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge,
.stale-badge {
  flex: 0 0 auto;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-badge {
  background: color-mix(in srgb, var(--unknown) 13%, transparent);
  color: var(--unknown);
}

.status-badge[data-tone="online"] {
  background: color-mix(in srgb, var(--online) 13%, transparent);
  color: var(--online);
}

.status-badge[data-tone="offline"] {
  background: color-mix(in srgb, var(--offline) 13%, transparent);
  color: var(--offline);
}

.server-card__details {
  display: grid;
  gap: 0.75rem;
  margin: 2rem 0 1.5rem;
}

.server-card__detail {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.server-card__term,
.server-card__value {
  margin: 0;
  font-size: 0.85rem;
}

.server-card__term {
  color: var(--muted);
}

.server-card__value {
  text-align: right;
}

.server-card__footer {
  gap: 0.55rem;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
}

.stale-badge {
  background: color-mix(in srgb, var(--warning) 13%, transparent);
  color: var(--warning);
}

.server-card--skeleton {
  background:
    linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 45%, transparent 70%) 0 0 / 220% 100%,
    var(--surface);
  animation: shimmer 1.5s infinite linear;
}

.server-card--skeleton::before {
  display: none;
}

@keyframes shimmer {
  to { background-position: -220% 0, 0 0; }
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  border: 1px dashed var(--border-strong);
  border-radius: 1.15rem;
  text-align: center;
}

.empty-state__title {
  margin-bottom: 0.4rem;
}

.empty-state__copy {
  margin-bottom: 0;
  color: var(--muted);
}

.community {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(360px, 1.2fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  margin-top: clamp(5rem, 10vw, 9rem);
  padding-top: clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--border);
}

.community p:last-child {
  max-width: 42ch;
  margin: 1rem 0 0;
  color: var(--muted);
}

.discord-widget {
  width: 100%;
  height: 25rem;
  border: 1px solid var(--border);
  border-radius: 1.15rem;
  background: var(--surface);
}

.site-footer {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

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

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

@media (max-width: 600px) {
  .site-header,
  .site-footer,
  main {
    width: min(100% - 1.25rem, 1120px);
  }

  main {
    padding-top: 3.5rem;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading__actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .server-card {
    min-height: 0;
  }

  .community {
    margin-top: 5rem;
  }

  .discord-widget {
    height: 22rem;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .server-card--skeleton {
    animation: none;
  }
}
