* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #10131a;
  color: #e6e8ec;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app {
  display: flex;
  height: 100vh;
}

#mesh-canvas {
  flex: 1;
  display: block;
  min-width: 0;
  min-height: 0;
  background: #10131a;
  cursor: crosshair;
}

#sidebar {
  flex: 0 0 280px;
  width: 280px;
  padding: 16px;
  background: #171b24;
  border-left: 1px solid #262c3a;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #3a4356 #171b24;
}
#sidebar::-webkit-scrollbar {
  width: 8px;
}
#sidebar::-webkit-scrollbar-track {
  background: #171b24;
}
#sidebar::-webkit-scrollbar-thumb {
  background: #3a4356;
  border-radius: 4px;
}
#sidebar::-webkit-scrollbar-thumb:hover {
  background: #4a5568;
}

/* Embed mode (?embed=1): keep the activity log and legend (informational,
   explains what's happening) but hide every interactive control (vessel
   type/demand-generator fields, click-to-summon instructions, cancel
   button) — this is a passive viewer, e.g. embedded via iframe on the
   marketing site, not something visitors are meant to operate. The ID/class
   selectors below beat the "hidden" attribute's UA display:none regardless
   of whether ui.js later un-hides the instructions/cancel button. */
body.embed-mode #sidebar h1,
body.embed-mode #connection-status,
body.embed-mode .field,
body.embed-mode .sidebar-divider,
body.embed-mode #summon-instructions,
body.embed-mode #cancel-summon {
  display: none;
}

#sidebar h1 {
  font-size: 16px;
  margin: 0 0 12px;
}

.status {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 4px;
  background: #2a2f3d;
  margin-bottom: 16px;
}

.status.connected { background: #1f3d2a; color: #7fe3a0; }
.status.disconnected { background: #3d1f22; color: #e37f7f; }

.sidebar-divider {
  border: none;
  border-top: 1px solid #3a3a3a;
  margin: 4px 0 16px;
}

/* Compound selectors (.field.checkbox-field) beat the plain .field rules
   below regardless of source order, since both are class+element specificity. */
.field.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #e6e8ec;
  cursor: pointer;
  margin-bottom: 0;
}

.field.checkbox-field input {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
  order: -1;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  color: #9aa2b1;
}

.field select, .field input {
  width: 100%;
  padding: 6px;
  background: #10131a;
  color: #e6e8ec;
  border: 1px solid #2a2f3d;
  border-radius: 4px;
}

.instructions {
  font-size: 12px;
  color: #9aa2b1;
  background: #1c2130;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 12px;
}

#cancel-summon {
  width: 100%;
  padding: 6px;
  margin-bottom: 12px;
  background: #3d1f22;
  color: #e6e8ec;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#summon-log {
  margin-top: 16px;
  border-top: 1px solid #262c3a;
  padding-top: 12px;
  font-size: 11px;
  color: #9aa2b1;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: #3a4356 #171b24;
}
#summon-log::-webkit-scrollbar {
  width: 8px;
}
#summon-log::-webkit-scrollbar-track {
  background: #171b24;
}
#summon-log::-webkit-scrollbar-thumb {
  background: #3a4356;
  border-radius: 4px;
}
#summon-log::-webkit-scrollbar-thumb:hover {
  background: #4a5568;
}

#summon-log div {
  padding: 4px 6px;
  border-radius: 3px;
  background: #1c2130;
}

#summon-log div.error { color: #e37f7f; }
#summon-log div.success { color: #7fe3a0; }

.legend {
  font-size: 11px;
  color: #9aa2b1;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.legend-vessel {
  flex-wrap: wrap;
}

.fleet-count {
  margin-left: auto;
  color: #6f7686;
  font-variant-numeric: tabular-nums;
  font-size: 9px;
  white-space: nowrap;
}

/* The vessel-type rows' counts (active/parked/charging) are wider than the
   parking/charging-lot rows' -- always drop them to their own line under the
   label instead of relying on a hopeful single-line fit that wraps mid-word. */
.legend-vessel .fleet-count {
  flex-basis: 100%;
  margin-left: 20px;
}

.swatch {
  display: inline-block;
  width: 16px;
  height: 4px;
}

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

.road-large { background: #6fa8ff; }
.road-small { background: #757b89; }
.road-trip { background: #f0d868; }
.road-retrieval { background: #7fe3a0; }
.road-return { background: #e37f7f; }
.dot.parking { background: #e3c56f; border-radius: 2px; }
.dot.individual { background: #6fa8ff; }
.dot.group { background: #7fe3a0; }
.dot.static { background: #e39a5c; }

.tooltip {
  position: fixed;
  z-index: 1000;
  background: #1c2130;
  border: 1px solid #2a2f3d;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.5;
  color: #e6e8ec;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
