* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  display: flex;
  flex-direction: column;
  /* Kiosk display: never show a pointer over the map. */
  cursor: none;
}

/* The scoreboard keeps a clamped height on every screen shape; the 2:1
   map letterboxes into whatever space remains. On a 16:9 screen the
   map fills the width exactly (1080p: ~119px bar; 4K: 150px bar). */
:root {
  --scoreboard-height: clamp(72px, 11vh, 150px);
}

#scoreboard {
  height: var(--scoreboard-height);
}

#map-area {
  height: calc(100vh - var(--scoreboard-height));
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fill-first: the map always spans the full width. A full-screen 16:9
   display fits the 2:1 map exactly (uncropped). Shorter windows crop
   the top and bottom symmetrically up to 10% of the map's height; past
   that, the map squashes vertically to fit. Taller windows letterbox. */
#map-stack {
  position: relative;
  overflow: hidden;
  width: 100vw;
  height: min(50vw, calc(100vh - var(--scoreboard-height)));
}

#map,
#markers {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: block;
  width: 100%;
  height: min(50vw, calc((100vh - var(--scoreboard-height)) / 0.9));
}

#scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2vw;
  padding: 0 1vw;
  color: #fff;
  font-family: system-ui, sans-serif;
}

.city-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 10vw;
}

.city-name {
  font-size: calc(var(--scoreboard-height) * 0.2);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9aa7b5;
}

.city-time {
  font-size: calc(var(--scoreboard-height) * 0.4);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.city-weekday {
  font-size: calc(var(--scoreboard-height) * 0.17);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #6b7683;
}

/* Cities living in a different calendar day than home (Leeds). */
.city-tile.other-day .city-weekday {
  color: #ffb347;
}

/* Day-part indicator: sun, half-disc twilight, or moon per city,
   driven by the actual solar altitude. */
.city-daypart {
  margin-right: 0.5em;
}

.daypart-day {
  color: #ffd75e;
}

.daypart-twilight {
  color: #ff9d5c;
}

.daypart-night {
  color: #8fa7ff;
}

/* Home is highlighted in Keller Solutions yellow. */
.city-tile.home .city-name {
  color: #ffd500;
}

/* Keller Solutions attribution, mirroring the RampScope footer badge:
   logo mark + copyright, bottom-left, never intercepting input. */
#attribution {
  position: fixed;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#attribution .ks-logo {
  width: 28px;
  height: 28px;
}

#attribution .copyright {
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: #9aa7b5;
}

/* Settings gear: bottom-right, faint until hovered so it never fights
   the map. Interactive chrome restores the cursor the kiosk hides. */
#settings-button {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 60px;
  height: 60px;
  padding: 8px 16px 16px 8px;
  border: none;
  background: transparent;
  color: #9aa7b5;
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

#settings-button:hover,
#settings-button:focus-visible {
  opacity: 1;
  color: #ffffff;
}

#settings-button svg {
  display: block;
  width: 100%;
  height: 100%;
  padding: 7px;
  border-radius: 50%;
  background: rgba(10, 14, 22, 0.55);
  box-sizing: border-box;
}

#settings-dialog {
  margin: auto;
  min-width: min(680px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px;
  border: 1px solid rgba(154, 167, 181, 0.35);
  border-radius: 12px;
  background: #0d1420;
  color: #fff;
  font-family: system-ui, sans-serif;
  cursor: auto;
}

#settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

#settings-dialog h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9aa7b5;
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd500;
  margin-bottom: 12px;
}

.settings-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.settings-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa7b5;
}

.settings-fields input {
  padding: 8px 10px;
  border: 1px solid rgba(154, 167, 181, 0.35);
  border-radius: 6px;
  background: #060a12;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
}

.settings-fields input:focus {
  outline: 2px solid #ffd500;
  outline-offset: 1px;
}

.settings-hint {
  font-size: 0.78rem;
  color: #9aa7b5;
  margin-bottom: 12px;
}

.settings-locations {
  margin-top: 24px;
}

.location-row {
  grid-template-columns: 1.2fr 1fr 1fr 1.4fr auto auto;
  align-items: end;
  margin-bottom: 10px;
}

.location-find {
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(154, 167, 181, 0.35);
  border-radius: 6px;
  background: transparent;
  color: #9aa7b5;
  font-size: 0.75rem;
  font-family: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.location-find:hover,
.location-find:focus-visible {
  color: #ffd500;
  border-color: #ffd500;
}

.location-find:disabled {
  opacity: 0.5;
  cursor: default;
}

.lookup-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: #9aa7b5;
}

.lookup-results:empty {
  margin: 0;
}

.lookup-candidate {
  text-align: left;
  padding: 7px 10px;
  border: 1px solid rgba(154, 167, 181, 0.35);
  border-radius: 6px;
  background: #060a12;
  color: #d5dce4;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.lookup-candidate:hover,
.lookup-candidate:focus-visible {
  border-color: #ffd500;
  color: #ffffff;
}

.location-clear {
  height: 36px;
  width: 36px;
  border: 1px solid rgba(154, 167, 181, 0.35);
  border-radius: 6px;
  background: transparent;
  color: #9aa7b5;
  cursor: pointer;
}

.location-clear:hover {
  color: #ff8a80;
  border-color: #ff8a80;
}

.settings-mode {
  margin-top: 20px;
  border: none;
}

.settings-mode legend {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd500;
  margin-bottom: 12px;
}

.mode-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 24px;
  font-size: 0.9rem;
  color: #d5dce4;
  cursor: pointer;
}

.mode-option input {
  accent-color: #ffd500;
}

#settings-error {
  margin-top: 14px;
  font-size: 0.85rem;
  color: #ff8a80;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.settings-actions button {
  padding: 8px 18px;
  border: 1px solid rgba(154, 167, 181, 0.35);
  border-radius: 6px;
  background: transparent;
  color: #9aa7b5;
  font-size: 0.85rem;
  font-family: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.settings-actions #settings-save {
  background: #ffd500;
  border-color: #ffd500;
  color: #0d1420;
  font-weight: 600;
}
