:root {
  --ink: #f0f4e9;
  --muted: #88928a;
  --faint: #58625b;
  --ground: #101412;
  --surface: #171c19;
  --surface-raised: #1d231f;
  --line: #303932;
  --lime: #c9f45a;
  --aqua: #6de8c5;
  --amber: #f4bd57;
  --red: #ff7d67;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ground);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--ground);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

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

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.brand b {
  color: var(--lime);
  font-weight: 700;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--lime);
  transform: rotate(45deg);
}

.brand-mark span {
  width: 8px;
  height: 8px;
  display: block;
  background: var(--lime);
}

.controller-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.signal {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(244, 189, 87, 0.1);
}

.controller-state[data-state="online"] .signal {
  background: var(--aqua);
  box-shadow: 0 0 0 4px rgba(109, 232, 197, 0.1);
}

.controller-state[data-state="offline"] .signal {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 125, 103, 0.1);
}

.hero {
  padding: 88px 0 34px;
}

.eyebrow,
.section-index,
.state-kicker,
label,
footer {
  font-family: var(--mono);
  letter-spacing: 0.08em;
}

.eyebrow {
  margin-bottom: 40px;
  color: var(--muted);
  font-size: 11px;
}

.eyebrow span,
.section-index {
  color: var(--lime);
}

.hero-grid {
  min-height: 315px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: center;
  gap: 60px;
}

.state-kicker {
  margin: 0 0 15px;
  color: var(--aqua);
  font-size: 12px;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(52px, 8vw, 104px);
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: 0.92;
}

.terminal-cursor {
  color: var(--lime);
  animation: blink 1.05s steps(2, jump-none) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero-copy {
  max-width: 580px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.server-orbit {
  position: relative;
  width: 300px;
  height: 300px;
  justify-self: end;
}

.orbit-ring,
.orbit-core {
  position: absolute;
  border-radius: 50%;
}

.orbit-ring {
  border: 1px solid var(--line);
}

.orbit-ring::before,
.orbit-ring::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.orbit-ring-large {
  inset: 8px;
  animation: turn 18s linear infinite;
}

.orbit-ring-large::before {
  top: 31px;
  right: 42px;
}

.orbit-ring-large::after {
  bottom: 12px;
  left: 93px;
}

.orbit-ring-small {
  inset: 46px;
  border-style: dashed;
  animation: turn 12s linear infinite reverse;
}

.orbit-ring-small::before {
  top: -4px;
  left: 50%;
}

.orbit-ring-small::after {
  bottom: 17px;
  right: 18px;
}

.orbit-core {
  inset: 97px;
  display: grid;
  place-items: center;
  border: 1px solid var(--faint);
  background: var(--surface);
}

.orbit-core span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 36px rgba(244, 189, 87, 0.28);
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.server-orbit[data-state="online"] .orbit-core span {
  background: var(--aqua);
  box-shadow: 0 0 44px rgba(109, 232, 197, 0.38);
}

.server-orbit[data-state="offline"] .orbit-core span {
  background: var(--red);
  box-shadow: 0 0 36px rgba(255, 125, 103, 0.26);
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-path {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr) 54px minmax(0, 1fr);
  align-items: center;
  margin: 18px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-node {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.status-node > span:last-child {
  min-width: 0;
}

.status-node small,
.status-node strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
}

.status-node small {
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.status-node strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border: 2px solid var(--faint);
  border-radius: 50%;
}

.status-node[data-state="online"] .status-dot {
  border-color: var(--aqua);
  background: var(--aqua);
  box-shadow: 0 0 0 4px rgba(109, 232, 197, 0.08);
}

.status-node[data-state="online"] strong {
  color: var(--aqua);
}

.status-node[data-state="warning"] .status-dot {
  border-color: var(--amber);
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(244, 189, 87, 0.08);
}

.status-node[data-state="warning"] strong {
  color: var(--amber);
}

.status-node[data-state="offline"] .status-dot {
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 125, 103, 0.08);
}

.status-node[data-state="offline"] strong {
  color: var(--red);
}

.path-line {
  height: 1px;
  margin: 0 14px;
  background: var(--line);
}

.metric {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-right: 1px solid var(--line);
}

.metric:first-child {
  padding-left: 0;
}

.metric:last-child {
  border-right: 0;
  padding-right: 0;
}

.metric span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.metric strong {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.85fr);
  gap: 20px;
  padding: 20px 0 72px;
}

.panel {
  min-height: 360px;
  padding: 34px;
  border: 1px solid var(--line);
  background: rgba(23, 28, 25, 0.94);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.section-index {
  margin: 0 0 11px;
  font-size: 10px;
}

h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.count-badge {
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.roster-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.player-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 64px;
  border-top: 1px solid var(--line);
}

.player-row:last-child {
  border-bottom: 1px solid var(--line);
}

.player-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 0 4px rgba(109, 232, 197, 0.08);
}

.player-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 540;
}

.empty-state {
  min-height: 185px;
  display: grid;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  margin: 8px 0 0;
  font-size: 14px;
}

.empty-glyph {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 32px;
  letter-spacing: 0.2em;
}

.action-copy p {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
}

.action-copy .fine-print {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

form {
  margin-top: 36px;
}

label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
}

input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: var(--ground);
  color: var(--ink);
}

input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 1px var(--lime);
}

input::placeholder {
  color: var(--faint);
}

button {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  border: 1px solid var(--lime);
  border-radius: 0;
  background: var(--lime);
  color: #101412;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: background-color 150ms ease, color 150ms ease;
}

button:hover:not(:disabled) {
  background: transparent;
  color: var(--lime);
}

button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

button:disabled {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--faint);
  cursor: not-allowed;
}

.form-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-message[data-kind="error"] {
  color: var(--red);
}

.form-message[data-kind="success"] {
  color: var(--aqua);
}

footer {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}

.footer-rule {
  width: 24px;
  height: 1px;
  background: var(--faint);
}

@media (max-width: 850px) {
  .page-shell {
    width: min(100% - 28px, 700px);
  }

  .hero {
    padding-top: 64px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .server-orbit {
    display: none;
  }

  .metrics,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .status-path {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .path-line {
    width: 1px;
    height: 18px;
    margin: -9px 0 -9px 4px;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 20px 0;
  }

  .metric:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 520px) {
  .topbar {
    height: 74px;
  }

  .brand {
    font-size: 11px;
  }

  #controller-label {
    display: none;
  }

  .hero {
    padding-top: 48px;
  }

  .eyebrow {
    margin-bottom: 30px;
  }

  h1 {
    font-size: clamp(44px, 15vw, 68px);
  }

  .hero-copy {
    font-size: 15px;
  }

  .panel {
    min-height: 0;
    padding: 26px 20px;
  }

  .password-row {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .player-row {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
