:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0c0f;
  color: #f4f5f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(255,255,255,.07), transparent 32rem),
    #0b0c0f;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 22px 16px 48px;
}

.topbar,
.section-head,
.inline,
.main-actions {
  display: flex;
  align-items: center;
}

.topbar,
.section-head {
  justify-content: space-between;
  gap: 16px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.eyebrow {
  margin-bottom: 4px;
  font-size: .72rem;
  letter-spacing: .14em;
  font-weight: 800;
  color: #9ca3af;
}

.card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid #252831;
  border-radius: 20px;
  background: rgba(20,22,27,.92);
  box-shadow: 0 14px 40px rgba(0,0,0,.16);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
}

.status-pill.online {
  background: rgba(35,168,91,.14);
  color: #61d58f;
}

.status-pill.offline {
  background: rgba(220,74,74,.12);
  color: #ff8585;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.muted {
  color: #9ca3af;
}

.small {
  font-size: .84rem;
}

.auth-card.hidden {
  display: none;
}

.inline {
  gap: 10px;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: #f4f5f7;
  border: 1px solid #323640;
  border-radius: 12px;
  background: #0f1115;
}

button {
  min-height: 46px;
  padding: 0 15px;
  border-radius: 12px;
  font-weight: 800;
}

.primary {
  background: #f4f5f7;
  color: #101114;
}

.secondary {
  background: #282c34;
  color: #f4f5f7;
}

.danger {
  background: #c83d46;
  color: white;
}

.ghost {
  background: rgba(200,61,70,.12);
  color: #ff8b92;
  border: 1px solid rgba(200,61,70,.32);
}

.big {
  flex: 1;
  min-height: 58px;
  font-size: 1rem;
}

.main-actions {
  gap: 10px;
  margin-top: 18px;
}

.state-grid,
.coords {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.state-grid > div,
.coords > div {
  padding: 12px;
  border-radius: 14px;
  background: #0f1115;
}

.label,
.coords span {
  display: block;
  margin-bottom: 5px;
  color: #858b96;
  font-size: .72rem;
}

.field {
  margin-top: 16px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: #aeb3bd;
  font-size: .86rem;
}

.dpad-wrap {
  width: 220px;
  height: 220px;
  margin: 18px auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
}

.dpad {
  min-height: 0;
  font-size: 1.7rem;
  color: #f5f5f5;
  background: #292d35;
  user-select: none;
  -webkit-user-select: none;
}

.dpad:active {
  transform: scale(.96);
  background: #3a404b;
}

.dpad.up { grid-column: 2; grid-row: 1; }
.dpad.left { grid-column: 1; grid-row: 2; }
.dpad.center { grid-column: 2; grid-row: 2; }
.dpad.right { grid-column: 3; grid-row: 2; }
.dpad.down { grid-column: 2; grid-row: 3; }

.boundary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

pre {
  max-height: 290px;
  overflow: auto;
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 14px;
  background: #090a0d;
  color: #b9f6ca;
  font-size: .76rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.footer {
  margin: 22px 0 0;
  text-align: center;
  color: #646a75;
  font-size: .75rem;
}

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

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

  .main-actions {
    flex-direction: column;
  }

  .big {
    width: 100%;
  }
}

button:disabled,
select:disabled {
  opacity: .45;
  cursor: not-allowed;
}
