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

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #02040a;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#sky:active { cursor: grabbing; }

#controls {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  width: min(25rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.1rem;
  border: 1px solid rgba(155, 197, 255, 0.24);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(9, 18, 34, 0.94), rgba(2, 5, 12, 0.86));
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
}

header { margin-bottom: 1rem; }

.eyebrow {
  margin: 0 0 0.2rem;
  color: #7fb8ff;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  font-weight: 680;
  letter-spacing: -0.04em;
}

#status {
  min-height: 2.6em;
  margin: 0.4rem 0 0;
  color: #b8c8df;
  font-size: 0.88rem;
  line-height: 1.35;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.55rem;
}

button, select, input, .button-link {
  font: inherit;
}

button, .button-link {
  min-height: 2.9rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(145, 185, 241, 0.35);
  border-radius: 0.65rem;
  background: rgba(35, 55, 82, 0.72);
  color: #edf5ff;
  font-weight: 650;
}

.button-link {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  text-align: center;
  text-decoration: none;
}

.button-link.lunar {
  border-color: rgba(238, 190, 126, 0.5);
  background: linear-gradient(135deg, rgba(111, 61, 29, 0.9), rgba(69, 58, 49, 0.9));
  color: #fff1df;
}

.button-link.galaxy {
  border-color: rgba(106, 189, 255, 0.52);
  background: linear-gradient(135deg, rgba(19, 73, 112, 0.92), rgba(45, 48, 104, 0.9));
  color: #e4f4ff;
}

button.primary {
  border-color: rgba(111, 208, 255, 0.75);
  background: linear-gradient(135deg, #176bc4, #3d46a8);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.instruction {
  margin: 0.7rem 0 1rem;
  color: #9eb0c8;
  font-size: 0.78rem;
  line-height: 1.45;
}

.pairing-controls {
  display: grid;
  gap: 0.5rem;
}

.pairing-controls label {
  color: #ccd9e9;
  font-weight: 620;
}

#owner-code {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(141, 178, 226, 0.3);
  border-radius: 0.5rem;
  background: rgba(4, 10, 20, 0.82);
  color: #eef6ff;
}

#owner-status[data-state="paired"] { color: #70e3be; }
#owner-status[data-state="error"] { color: #ffad91; }

.settings {
  display: grid;
  gap: 0.75rem;
}

.settings label {
  display: grid;
  gap: 0.3rem;
  color: #ccd9e9;
  font-size: 0.8rem;
  font-weight: 620;
}

select, input[type="datetime-local"], input[type="number"] {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(141, 178, 226, 0.3);
  border-radius: 0.5rem;
  background: rgba(4, 10, 20, 0.82);
  color: #eef6ff;
}

input[type="range"] {
  width: 100%;
  accent-color: #64b9ff;
}

output {
  justify-self: end;
  margin-top: -1.25rem;
  color: #8ecaff;
  font-variant-numeric: tabular-nums;
}

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

@media (max-width: 27rem) {
  .coordinates { grid-template-columns: 1fr 1fr; }
}

.settings label.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 520;
}

.check input { width: 1.1rem; height: 1.1rem; }

details {
  margin-top: 1rem;
  border-top: 1px solid rgba(140, 174, 217, 0.19);
  padding-top: 0.75rem;
  color: #9fb0c6;
  font-size: 0.76rem;
  line-height: 1.45;
}

summary { cursor: pointer; color: #cbd9ec; font-weight: 650; }
details p { margin: 0.65rem 0; }
dl { margin: 0; }
dt { margin-top: 0.55rem; color: #d8e7fa; font-weight: 650; }
dd { margin: 0.08rem 0 0; }

#vr-hint {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(5, 12, 24, 0.82);
  color: #a9bdd8;
  font-size: 0.75rem;
}

@media (max-width: 640px) {
  #controls { max-height: 62vh; }
  .actions { grid-template-columns: 1fr; }
}

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