* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #b9c8d4;
  font: 14px/1.4 system-ui, -apple-system, sans-serif;
  color: #1d2329;
}

#viewport { position: fixed; inset: 0; }

.panel {
  position: fixed;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

header { top: 16px; left: 16px; max-width: 320px; }
header h1 { margin: 0 0 4px; font-size: 22px; }
header p { margin: 0; color: #4a5560; }
header a { color: inherit; }

#loader {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, calc(100vw - 32px));
  text-align: center;
}
#loader.hidden { display: none; }
.bar { margin-top: 8px; height: 6px; background: #dde3e8; border-radius: 3px; overflow: hidden; }
#loader-bar { height: 100%; width: 0; background: #6b4f2a; transition: width 0.2s; }

#controls {
  bottom: 16px; left: 16px; right: 16px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  width: fit-content; max-width: calc(100vw - 32px);
}
#controls small { color: #4a5560; }

button {
  font: inherit;
  padding: 6px 12px;
  border: 1px solid #c3ccd4;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
button[aria-pressed="true"] { background: #6b4f2a; border-color: #6b4f2a; color: #fff; }
button:disabled { opacity: 0.5; cursor: default; }

.segmented { display: flex; }
.segmented button { border-radius: 0; margin-left: -1px; }
.segmented button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.segmented button:last-child { border-radius: 0 6px 6px 0; }

kbd {
  font: 11px ui-monospace, monospace;
  opacity: 0.6;
  margin-left: 2px;
}

#crosshair {
  position: fixed; top: 50%; left: 50%;
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

#resume {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

[hidden] { display: none !important; }

#sun-panel {
  top: 16px; right: 16px;
  width: 220px;
  display: grid; gap: 10px;
}
#sun-panel label, #comfort-panel label { display: grid; gap: 4px; }
#sun-panel span, #comfort-panel span { display: flex; justify-content: space-between; color: #4a5560; }
#sun-panel output, #comfort-panel output { font-variant-numeric: tabular-nums; color: #1d2329; font-weight: 600; }
#sun-panel input, #comfort-panel input { width: 100%; accent-color: #6b4f2a; }

#comfort-panel {
  right: 16px; bottom: 96px;
  width: 220px;
  display: grid; gap: 10px;
}
#comfort-reset { justify-self: start; }

@media (max-width: 640px) {
  #sun-panel { top: auto; bottom: 140px; left: 16px; right: 16px; width: auto; }
  #comfort-panel { display: none; }
}

#coords { font: 12px ui-monospace, monospace; color: #4a5560; }
#sun-play { justify-self: start; }

#stats {
  top: 16px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 10px;
  font: 12px ui-monospace, monospace;
  color: #1d2329;
}
#stats:empty { display: none; }
