* {
  box-sizing: border-box;
}
html,
body,
#world {
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
}
body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: #29454a;
  color: #fff;
}
#world {
  position: relative;
  isolation: isolate;
  --accent: #efc982;
}
button,
a,
label {
  user-select: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 3px solid #fff1b5;
  outline-offset: 4px;
}
.scene {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
  cursor: grab;
}
.scene:active {
  cursor: grabbing;
}
#world:before,
#world:after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
#world:before {
  background: linear-gradient(
    180deg,
    #10242c77 0,
    transparent 17%,
    transparent 62%,
    #102026a8 100%
  );
}
.hud,
.restore {
  position: absolute;
  z-index: 2;
}
.head {
  top: max(24px, env(safe-area-inset-top));
  left: clamp(18px, 3vw, 46px);
  right: clamp(18px, 3vw, 46px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 0.21em;
  font:
    600 12px/1.3 "Segoe UI",
    sans-serif;
  letter-spacing: 0.22em;
  text-shadow: 0 2px 8px #13222b;
}
.brand i {
  display: grid;
  place-items: center;
  color: var(--accent);
  width: 32px;
  height: 32px;
  border: 1px solid #e9d6a89c;
  transform: rotate(45deg);
  font: 26px Georgia;
  background: #142d3380;
}
.brand a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  pointer-events: auto;
  text-underline-offset: 4px;
}
.tools {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.tools button,
.restore,
.touch button {
  display: grid;
  place-items: center;
  border: 1px solid #e8e0c766;
  background: #162e32c9;
  color: #fff;
  border-radius: 8px;
  width: 42px;
  height: 42px;
}
.tools svg,
.restore svg,
.touch svg,
.route-btn svg {
  width: 19px;
  height: 19px;
}
.compass {
  top: 20px;
  left: 50%;
  width: 190px;
  transform: translateX(-50%);
  text-align: center;
  overflow: hidden;
  text-shadow: 0 1px 5px #16292d;
}
.tape {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 22px;
  gap: 0;
  font:
    600 11px "Segoe UI",
    sans-serif;
}
.tape span {
  min-width: 30px;
}
.compass b {
  display: block;
  margin: 0 auto;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-bottom: 5px solid var(--accent);
}
.compass output {
  font:
    600 11px/2.1 Consolas,
    monospace;
  letter-spacing: 0.13em;
}
.place {
  left: clamp(18px, 3vw, 46px);
  bottom: clamp(20px, 5vh, 50px);
  max-width: 60vw;
  text-shadow: 0 2px 12px #10242c66;
}
.zone,
.map > div {
  display: flex;
  align-items: center;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.19em;
}
.zone i {
  width: 28px;
  height: 1px;
  background: var(--accent);
  margin-right: 10px;
}
.zone {
  color: #fbe9bf;
}
.place h1 {
  font:
    normal clamp(30px, 4.4vw, 68px)/1.04 Georgia,
    "Times New Roman",
    serif;
  letter-spacing: -0.045em;
  margin: 8px 0;
}
.location {
  font-size: 12px;
  letter-spacing: 0.03em;
  color: #e1e5dc;
}
.route-btn {
  margin-top: 18px;
  border: 1px solid #d6d6c977;
  background: #193337d9;
  padding: 9px 16px;
  display: flex;
  gap: 9px;
  align-items: center;
  border-radius: 5px;
  font-weight: 600;
  font-size: 12px;
}
.route-btn svg {
  color: var(--accent);
}
.map {
  right: clamp(18px, 3vw, 46px);
  bottom: clamp(20px, 5vh, 50px);
  width: 167px;
  padding: 13px 15px 10px;
  border: 1px solid #e1d6b852;
  border-radius: 8px;
  background: #132f33e6;
  box-shadow: 0 6px 22px #17323822;
}
.map > div {
  justify-content: space-between;
  letter-spacing: 0.12em;
  font-size: 9px;
}
.map b {
  color: var(--accent);
}
.map svg {
  display: block;
  width: 100%;
  height: 105px;
  margin: 7px 0;
  background-image:
    linear-gradient(#d3e7d512 1px, transparent 1px),
    linear-gradient(90deg, #d3e7d512 1px, transparent 1px);
  background-size: 14px 14px;
}
.map output,
.status {
  font:
    10px Consolas,
    monospace;
  color: #d4dfcf;
}
.restore,
.touch {
  display: none;
}
.minimal .hud,
.minimal:before {
  display: none;
}
.minimal .restore {
  display: grid;
  top: 18px;
  right: 18px;
}
.touch {
  gap: 4px;
  grid-template-columns: repeat(3, 42px);
  bottom: 22px;
  right: 18px;
  touch-action: none;
}
.touch button:first-child {
  grid-column: 2;
}
.touch button:nth-child(2) {
  grid-column: 1;
}
.touch button:active {
  background: #7c7653;
}
.touch button {
  touch-action: none;
}
.place button:hover,
.tools button:hover,
dialog button:hover {
  background: #345255;
}
dialog {
  color: #ebece2;
  background: #183236;
  border: 1px solid #a8b6a77a;
  border-radius: 12px;
  padding: 23px;
  width: min(420px, calc(100% - 30px));
  max-height: 90dvh;
  box-shadow: 0 18px 80px #11222366;
}
dialog::backdrop {
  background: #0d202687;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-title h2 {
  font: 32px Georgia;
  margin: 0;
}
.panel-title button {
  font-size: 24px;
  padding: 2px 10px;
}
dialog p {
  color: #c7d6cc;
  font-size: 14px;
  line-height: 1.5;
}
dialog button,
.import {
  border: 1px solid #627a76;
  background: #234246;
  border-radius: 5px;
  padding: 8px 12px;
  color: #f4f1df;
  font-size: 13px;
}
.stations {
  display: grid;
  gap: 5px;
}
.stations button {
  display: flex;
  gap: 14px;
  align-items: center;
  text-align: left;
}
.stations small {
  color: var(--accent);
  font:
    11px Consolas,
    monospace;
}
summary {
  padding: 12px 0;
  cursor: pointer;
  font-size: 14px;
}
details {
  border-top: 1px solid #ffffff21;
  margin-top: 10px;
}
.steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.import {
  display: block;
  margin: 8px 0;
}
.import input {
  display: block;
  margin-top: 5px;
  max-width: 100%;
}
.pano {
  color: var(--accent);
  font-size: 13px;
}
.status {
  display: block;
  margin-top: 8px;
}
.scene[hidden],
[hidden] {
  display: none !important;
}
@media (pointer: coarse), (max-width: 650px) {
  .touch {
    display: grid;
  }
  .map {
    top: 85px;
    right: 16px;
    bottom: auto;
    width: 98px;
    padding: 8px;
  }
  .map svg {
    height: 63px;
  }
  .map output {
    font-size: 8px;
  }
  .head {
    top: 18px;
  }
  .brand {
    font-size: 10px;
    gap: 8px;
  }
  .brand i {
    height: 23px;
    width: 23px;
    font-size: 19px;
  }
  .tools button {
    width: 34px;
    height: 34px;
  }
  .compass {
    width: 98px;
    top: 12px;
  }
  .place {
    bottom: 24px;
    max-width: 55vw;
  }
  .place h1 {
    font-size: 30px;
  }
  .route-btn {
    margin-top: 10px;
  }
  .map > div {
    font-size: 8px;
  }
}
@media (max-height: 470px) {
  .map {
    top: 68px;
  }
  .place h1 {
    font-size: 28px;
  }
  .map svg {
    height: 49px;
  }
  .place {
    bottom: 12px;
  }
}

.render-options label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  font-size: 14px;
}
.render-options select {
  max-width: 58%;
  padding: 4px 8px;
  color: inherit;
  background: #234246;
  border: 1px solid #627a76;
  border-radius: 4px;
}

.network-map {
  display: block;
  width: 100%;
  height: 310px;
  margin: 10px 0;
  background: #18313b;
  border-radius: 6px;
}

.tools [data-sound] {
  width: auto;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
}
.sound-panel {
  position: absolute;
  z-index: 9;
  right: 1rem;
  top: 4rem;
  width: min(19rem, calc(100% - 2rem));
  max-height: 73vh;
  overflow: auto;
  padding: 1rem;
  background: #142631f5;
  color: #f6e8ce;
  border: 1px solid #84734f;
  border-radius: 8px;
  pointer-events: auto;
}
.sound-panel[hidden],
[data-board][hidden] {
  display: none !important;
}
.sound-panel > div:first-child,
.sound-panel label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0.45rem 0;
}
.sound-panel button,
.sound-panel select {
  color: #f6ead4;
  background: #213c46;
  border: 1px solid #7d785d;
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
}
.sound-panel input[type="range"] {
  width: 44%;
  accent-color: #dabc85;
}
.sound-panel details {
  margin: 0.7rem 0;
}
.sound-panel output {
  font-size: 0.8rem;
}
.place [data-board] {
  margin-left: 0.35rem;
}
.place [data-board]:disabled {
  opacity: 0.8;
}

.crossing {
  box-sizing: border-box;
  inset: 0;
  margin: auto;
  width: min(1440px, 97vw);
  height: fit-content;
  max-height: 92dvh;
  padding: 1.25rem;
  color: #edf3ef;
  background: #132c33;
  border: 1px solid #bba477;
  border-radius: 8px;
  z-index: 20;
}
.crossing::backdrop {
  background: #10232ccf;
}
.crossing h2 {
  margin: 0.2em 0;
  font-family: Georgia, serif;
}
.crossing iframe {
  display: block;
  margin: 0.7rem 0;
  width: 100%;
  height: min(70dvh, 900px);
  border: 0;
}
.crossing button {
  min-height: 40px;
}
.crossing[open] {
  animation: crossfade 0.3s ease-out;
}
@keyframes crossfade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .crossing[open] {
    animation: none;
  }
}
