:root {
  --bg: #16181d;
  --card: #23262e;
  --card-hover: #2a2e38;
  --text: #f5f5f7;
  --text-dim: #9ca0ab;
  --accent: #2f6fed;
  --accent-hover: #4480f5;
  --green: #3ddc84;
  --blue: #5ac8fa;
  --grey: #8a8a8e;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 48px 24px;
  min-height: 100vh;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

h1 {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.health-btn {
  padding: 8px 16px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid #ffffff1f;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
}
.health-btn:hover { color: var(--text); border-color: #ffffff3d; }

#robot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
}

.robot-card {
  background: var(--card);
  border: 1px solid #ffffff14;
  border-radius: 18px;
  padding: 36px 28px;
  width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease, border-color 0.18s ease,
              background 0.18s ease;
}
.robot-card:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: #ffffff2e;
}

.robot-name {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-align: center;
}

/* Which signaling server holds this robot ("Seoul" / "N. California").
   Rendered for every card once the server is region-configured, so the
   badge reads as fleet metadata rather than a warning; the muted
   outline on `.remote` is the only hint that connecting will hand the
   browser to another origin. Hidden entirely on a single-region
   deployment, where the server sends no region at all. */
.robot-region {
  margin-top: -12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #ffffff1f;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: #ffffff0a;
}
.robot-region.remote {
  border-style: dashed;
  color: var(--grey);
}
.robot-region[hidden] { display: none; }

.robot-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--grey);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.robot-status.status-active   { color: var(--green); }
.robot-status.status-standby  { color: var(--blue); }
.robot-status.status-charging { color: var(--charging, #f5a623); }
.robot-status.status-docked   { color: var(--charging, #f5a623); }
.robot-status.status-offline  { color: var(--grey); }

/* Battery indicator inline with the status word: "● Standby · 87%".
   Uses dimmer text so the state word stays primary. */
.robot-battery {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.92rem;
}
.robot-battery[hidden] { display: none; }

/* "Location: <zone>" line fed by the 1 Hz robot_locations digest
   (server_teleop) + a client-side zone resolver against map.json.
   Hidden until we have a fresh pose so a robot that never localizes
   doesn't reserve vertical space. */
.robot-location {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--text-dim);
  max-width: 100%;
  min-width: 0;
}
.robot-location[hidden] { display: none; }
.robot-location-label { color: var(--grey); }
.robot-location-value {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.robot-location.stale .robot-location-value { color: var(--grey); }

.btn-connect {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-connect:hover:not(:disabled) { background: var(--accent-hover); }
.btn-connect:disabled {
  background: #2c2f37;
  color: var(--text-dim);
  cursor: not-allowed;
}
/* Admin-only "Take over" — amber to flag that clicking boots a live
   operator, distinct from the normal blue Connect. */
.btn-connect.btn-takeover { background: #b45309; }
.btn-connect.btn-takeover:hover:not(:disabled) { background: #92400e; }

/* Fallback for the config-error "Reload" button. */
button {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 14px;
  border: 1px solid #ffffff1f;
  border-radius: 8px;
  background: #2c2f37;
  color: var(--text);
  cursor: pointer;
}

.empty-state {
  width: 100%;
  text-align: center;
  font-size: 1rem;
  color: var(--text-dim);
}
