:root {
  color-scheme: only light;
  --paper: #f6f5f1;
  --glass: #fffef9;
  --glass-strong: var(--glass);
  --glass-border: #9d9b92;
  --glass-highlight: #fff;
  --hover: #e7e6de;
  --divider: #c4c1b6;
  --text: #211f1b;
  --text-2: #423f37;
  --text-3: #56534b;
  --accent: #145c97;
  --ok: #17673a;
  --warn: #804800;
  --bad: #a82418;
}
html, body, #loading-overlay { background: var(--paper) }
#loading-overlay { color: var(--text); font-size: 1rem; font-weight: 600 }
:focus-visible { outline-color: var(--accent) }

#release-3d[hidden], #release-3d [hidden], #release-3d-spot[hidden] { display: none !important }
#release-3d {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: min(25rem, calc(100vw - 24px));
  max-height: 65dvh;
  overflow: auto;
  overscroll-behavior: contain;
  z-index: 40;
  padding: .75rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: .8rem;
  background: var(--glass);
  color: var(--text);
  font: 400 .875rem/1.4 Inter, system-ui, sans-serif;
}
#release-3d h1 { font-size: 1rem; margin: 0 0 .2rem }
#release-3d p { margin: .45rem 0 }
#release-3d p:empty { display: none }
#release-3d a { color: var(--accent); text-decoration: underline }
#release-3d > a { display: inline-flex; align-items: center; min-width: 24px; min-height: 24px; vertical-align: middle }
#release-3d > #release-3d-facts { min-width: 44px; min-height: 44px; margin-inline-end: .65rem }
#release-3d label { display: grid; gap: .2rem; min-width: 0 }
#release-3d label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: .4rem; min-height: 44px; padding-block: .4rem; cursor: pointer }
#release-3d select, #release-3d input:not([type="checkbox"]), #release-3d button {
  width: 100%;
  min-height: 44px;
  padding: .35rem .55rem;
  border: 1px solid #767369;
  border-radius: .4rem;
  background: #f2f1ea;
  color: inherit;
  font: inherit;
}
#release-3d-search::placeholder, .release-3d-mode #place-search::placeholder { color: var(--text-3); opacity: 1 }
#release-3d button:disabled { opacity: .55 }
#release-3d summary { min-height: 44px; padding-top: .65rem; cursor: pointer }
#release-3d :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.release-3d-sample-rows { padding-inline-start: 1.25em }
.release-3d-sample-rows > li + li { margin-block-start: .6rem }
.release-3d-row { display: flex; flex-wrap: wrap; align-items: end; gap: .4rem .55rem; margin: .45rem 0 }
.release-3d-row > * { flex: 1 1 6rem }
.release-3d-orbit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: .4rem;
  margin: .45rem 0;
}
.release-3d-notice { color: var(--warn) }
#release-3d-spot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 8;
  pointer-events: none;
  font: 24px/1 system-ui, sans-serif;
  color: #bfc7cb;
  text-shadow: 0 0 3px #080f14, 0 0 2px #080f14;
}
#release-3d-spot[data-sun="sun"] { color: #ffe488 }
#release-3d-spot[data-sun="shade"] { color: #ad94f6 }
.release-3d-mode .hud-top-right { top: auto; bottom: max(14px, env(safe-area-inset-bottom)) }
.release-3d-mode :is(#btn-help, .mode-btn), dialog.help-modal #help-close { min-width: 44px; min-height: 44px }
.release-3d-mode .mode-btn.active kbd { color: white }
@media (max-width: 1080px) {
  .release-3d-mode .mode-btn { flex-direction: column; justify-content: center; gap: 2px }
  .release-3d-mode .mode-label { display: block; font-size: 11px }
}
.release-3d-mode #search-box { background: var(--glass) }
.release-3d-mode #search-box:has(#place-search:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow);
}
.release-3d-mode #search-results .ac-item.active {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.release-3d-mode :is(.hint-label, .location-place, .location-near) {
  color: var(--text);
  background: var(--glass);
  box-shadow: 0 0 0 2px var(--glass);
  border-radius: 2px;
  text-shadow: none;
}
.release-3d-mode #btn-open-map kbd {
  color: var(--text-3);
  background: #f2f1ea;
}
.release-3d-mode :is(.time-switch, #mode-car,
  #btn-teleport, #btn-sound, #hud-cluster, #btn-toggle-hud) { display: none }
.release-3d-mode #release-3d { z-index: 101 }
.release-3d-mode #release-3d:has(#release-3d-controls:not([hidden])) { z-index: 40 }
.release-3d-failed #loading-overlay,
.release-3d-failed .hud,
.release-3d-failed #canvas-container,
.release-3d-failed #touch-controls { display: none }
dialog.help-modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  color: inherit;
}
dialog.help-modal .help-card { background: var(--glass) }
dialog.help-modal .help-foot { color: var(--text-3) }
dialog.help-modal .help-foot a { color: var(--accent); text-decoration: underline }
@media (max-width: 640px) {
  #release-3d { max-height: 49dvh; font-size: .9rem }
  #release-3d select, #release-3d input:not([type="checkbox"]) { font-size: 16px }
}

#release-3d-status-legend ul { padding-inline-start: 1.25em; margin-block: .4rem }
#release-3d-status-legend li + li { margin-block-start: .3rem }


#release-3d-sunlight {
  margin-block: .4rem;
  padding-block: .4rem .55rem;
  border-block: 1px solid var(--glass-border);
}
.sunlight-heading {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.sunlight-heading strong { flex: 1; font-size: 1rem }
#release-3d .sunlight-heading button { width: auto; min-width: 44px }
#release-3d .sunlight-heading button[aria-pressed="true"] { border-color: var(--accent) }
.sunlight-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .35rem }
.sunlight-fields label { font-weight: 600 }
#release-3d .sunlight-fields input[type="range"] {
  display: block;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}
.sunlight-scale { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-3) }
@media (max-width: 640px) {
  .sunlight-fields { grid-template-columns: minmax(0, 42fr) minmax(0, 58fr) }
  #release-3d .sunlight-fields input[type="date"] { min-width: 0; padding-inline: .35rem }
}
@media (max-width: 370px) {
  .sunlight-fields { grid-template-columns: minmax(0, 1fr) }
}

#release-3d-status-legend strong::before {
  content: "";
  display: inline-block;
  width: .8em;
  height: .8em;
  margin-inline-end: .4em;
  background: var(--status-color);
  border: 1px solid #625f56;
}
.release-3d-mode :is(#btn-locate, #btn-directions) { color: var(--accent) }
.release-3d-mode #btn-help:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px }
#release-3d-site-pin {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  transform: translate(-50%, 9px);
  padding: .32rem .6rem;
  border: 2px solid white;
  border-radius: .35rem;
  background: #7d280b;
  color: white;
  font: 700 .88rem/1.2 system-ui, sans-serif;
  box-shadow: 0 1px 4px #34251a66;
}
#release-3d-site-pin::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 10px;
  height: 10px;
  border: 2px solid white;
  border-width: 2px 0 0 2px;
  background: inherit;
  transform: translate(-50%, 35%) rotate(45deg);
}

#mode-project[hidden], #project-compass[hidden] { display: none }
#mode-project { flex-shrink: 0; font-weight: 700 }
#mode-switch.project-framed .mode-indicator { visibility: hidden }
#mode-switch.project-framed #mode-project { background: var(--accent); color: white }
#project-compass {
  align-self: center;
  display: flex;
  align-items: center;
  gap: .5rem;
  max-width: min(28rem, 90vw);
  padding: .35rem .7rem;
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  background: var(--glass);
  color: var(--text);
  font-size: .85rem;
  font-weight: 650;
  pointer-events: none;
}
#project-compass strong { display: block; font-size: .75rem; color: var(--text-2) }
.project-compass-dial {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid var(--text);
  border-radius: 50%;
  background: var(--paper);
}
.project-compass-arrow {
  width: 1rem;
  height: 2rem;
  background: linear-gradient(to bottom, #982c12 66%, #8c8880 66%);
  clip-path: polygon(50% 0, 100% 75%, 50% 63%, 0 75%);
}

@media (max-width: 480px) {
  body.release-3d-mode .hud-bottom-center { left: max(6px, env(safe-area-inset-left)); transform: none; align-items: flex-start }
  body.release-3d-mode .hud-top-right { top: auto; right: max(6px, env(safe-area-inset-right)); bottom: max(var(--edge), env(safe-area-inset-bottom)) }
  body.release-3d-mode #hud-toolbar { width: auto; flex-wrap: nowrap; gap: 0; padding: 3px }
  body.release-3d-mode #hud-toolbar :is(.toolbar-divider, kbd, .tool-label) { display: none }
  body.release-3d-mode #btn-open-map { min-width: 44px; padding: 0; justify-content: center }
  body.release-3d-mode .mode-btn { width: 44px; padding: 0; font-size: 11px }
  #project-compass { align-self: flex-start; max-width: calc(100vw - 12px) }
}

.yard-dialog {
  box-sizing: border-box; width: min(43rem, calc(100vw - 1.5rem)); max-height: 88dvh;
  padding: clamp(1rem, 3vw, 2rem); border: 1px solid #827e74; border-radius: .75rem;
  overflow: auto; color: #202722; background: white;
}
.yard-dialog::backdrop { background: rgb(18 27 33 / 65%) }
.yard-dialog button {
  min-height: 44px; padding: .4rem .75rem; border: 1px solid #847f73; border-radius: .35rem;
  color: #193b54; background: #fff; cursor: pointer;
}
.yard-dialog > button { margin-bottom: .8rem }
.yard-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem }
.yard-actions button:last-child { color: white; background: #145c97 }
.yard-dialog [hidden] { display: none !important }
.yard-dialog.yard-replay {
  position: fixed; inset: auto 0 0; margin: 0 auto 1rem; max-height: 45dvh;
  padding: .7rem 1rem; box-shadow: 0 .25rem 1.25rem #0004;
}
.yard-dialog.yard-replay::backdrop { background: transparent }
.yard-replay > button { float: right }
.yard-dock button, .yard-dock select { margin: .25rem; min-height: 44px }
.yard-dock [aria-pressed="true"] { background: #145c97; color: white }

/* Phone HUD: the centre of the screen belongs to the map. */
.project-hud-toggle { display: none }
body.project-phone:not(.release-3d-failed) {
  --phone-top: max(6px, env(safe-area-inset-top));
  --phone-bottom: max(6px, env(safe-area-inset-bottom));
  --phone-left: max(6px, env(safe-area-inset-left));
  --phone-right: max(6px, env(safe-area-inset-right));
}
body.project-phone:not(.release-3d-failed) #release-3d {
  inset: var(--phone-top) var(--phone-right) auto var(--phone-left);
  width: auto; max-height: min(65dvh, calc(100dvh - 78px));
  padding: 0 .5rem; border-radius: .7rem;
}
.project-phone .project-hud-header {
  display: flex; align-items: center; gap: 2px; position: sticky; top: 0;
  z-index: 1; background: var(--glass);
}
.project-phone #release-3d-title {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: .9rem; margin: 0 .25rem 0 0;
}
.project-phone:not(.release-3d-failed) #release-3d .project-hud-toggle {
  display: block; width: auto; min-width: 44px; min-height: 44px; padding: 0 .3rem;
  font-weight: 650; font-size: .82rem; color: var(--accent);
  background: transparent; border-color: transparent;
}
.project-phone #release-3d .project-hud-toggle[aria-expanded="true"] {
  background: #e2eef7; border-color: var(--accent);
}
.project-phone:not(.release-3d-failed):not([data-project-tray="project"]) #release-3d > :not(.project-hud-header, #release-3d-sunlight, #yard-study),
.project-phone:not([data-project-tray="sun"]) #release-3d > :is(#release-3d-sunlight, #yard-study),
.project-phone:not([data-project-tray="search"]) .hud-top-left,
.project-phone .touch-look-hint, .project-phone .touch-caption,
.project-phone:has(.project-framed) :is(#touch-controls, #project-compass),
.project-phone:not([data-project-tray=""]) :is(#project-compass, #touch-controls),
.project-phone .hud-bottom-left { display: none }
body.project-phone[data-project-tray="search"] .hud-top-left {
  inset: calc(var(--phone-top) + 50px) var(--phone-right) auto var(--phone-left);
  width: auto; max-height: calc(100dvh - 124px); overflow-y: auto;
}
body.project-phone .hud-bottom-center {
  left: var(--phone-left); bottom: var(--phone-bottom); transform: none; align-items: flex-start;
}
body.project-phone .hud-top-right {
  inset: auto var(--phone-right) var(--phone-bottom) auto;
}
body.project-phone #hud-toolbar { width: auto; gap: 0; padding: 3px; flex-wrap: nowrap }
body.project-phone #btn-open-map { min-width: 44px; padding: 0; justify-content: center }
body.project-phone .mode-btn { width: 44px; height: 44px; min-height: 44px; padding: 0 }
body.project-phone #project-compass {
  position: fixed; top: calc(var(--phone-top) + 52px); left: var(--phone-left);
  padding: 3px 8px 3px 4px; max-width: calc(100vw - var(--phone-left) - var(--phone-right));
  font-size: .75rem; border-radius: 1.2rem;
}
.project-phone #project-compass strong { display: none }
.project-phone .project-compass-dial { width: 1.6rem; height: 1.6rem }
.project-phone .project-compass-arrow { height: 1.15rem; width: .65rem }
body.project-phone #touch-controls {
  left: var(--phone-left); right: var(--phone-right); bottom: calc(var(--phone-bottom) + 61px);
}
.project-phone #touch-stick { width: 90px; height: 90px }
.project-phone #touch-stick-knob { width: 36px; height: 36px }
.project-phone .touch-actions { grid-template-columns: repeat(2, 48px); padding: 0; gap: 4px }
.project-phone .touch-action { width: 48px; height: 48px }

.project-hud-heading { flex: 1; min-width: 0 }
.project-parcel-key {
  display: flex; align-items: center; gap: .35rem;
  font-size: .75rem; line-height: 1.25; color: var(--text-2);
}
.project-parcel-key::before {
  content: ""; width: 1.1rem; height: 3px;
  background: #ffad34; border: 1px solid #592405; border-radius: 3px;
}
