main {
  align-items: center;
}

#map-box {
  position: relative;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 8192 / 6196;
  margin: 1rem auto 0;
  border: 2px solid var(--gold-dark);
  border-radius: 4px;
  overflow: hidden;
  background: #0a0800;
  box-sizing: content-box;
}

#map {
  width: 100%;
  height: 100%;
  background: #0d0d0a;
}

aside {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
}

aside.open {
  display: flex;
}

aside article {
  position: relative;
  background: rgba(5, 5, 2, 0.97);
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
  padding: 1.5rem;
  width: 580px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  margin: 0;
}

aside article h3 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--gold-dark);
  padding-bottom: 0.4rem;
}
aside article p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  font-style: italic;
}

aside article section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.5rem;
  font-size: 0.78rem;
  line-height: 1.6;
  margin: 0;
  max-width: 100%;
}

aside article section .row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.1rem;
}
aside article section .row .label {
  color: var(--gold-dark);
  font-family: var(--font-title);
  font-size: 0.65rem;
  text-transform: uppercase;
  min-width: 80px;
  padding-top: 1px;
}
aside article section .row .value {
  color: var(--text);
}
aside article section hr {
  border-top: 1px solid #2a1e00;
  margin: 0.4rem 0;
  grid-column: 1 / -1;
  max-width: 100%;
}
aside article section .full {
  grid-column: 1 / -1;
}

.danger-bar {
  display: flex;
  gap: 2px;
}
.danger-bar span {
  width: 10px;
  height: 8px;
  border-radius: 1px;
  background: #2a1e00;
}
.danger-bar span.filled[data-level="1"] {
  background: #2d6a2d;
}
.danger-bar span.filled[data-level="2"] {
  background: #8a8a00;
}
.danger-bar span.filled[data-level="3"] {
  background: #c47a00;
}
.danger-bar span.filled[data-level="4"] {
  background: #c43a00;
}
.danger-bar span.filled[data-level="5"] {
  background: #8a0000;
}

aside article footer {
  display: inline-block;
  margin-top: 0.8rem;
  background: var(--gold-deep);
  border: 1px solid var(--gold-dark);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-size: 0.65rem;
  color: #666;
  font-family: monospace;
}

aside article > button {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  background: none;
  border: none;
}
aside article > button:hover {
  color: var(--text);
}

.road-entry {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.3rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--gold-dark);
}
.road-entry b {
  font-family: var(--font-title);
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: normal;
}
.road-entry small {
  font-size: 0.7rem;
  color: #888;
}

#controls {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 100%;
  max-width: 500px;
  margin: 0.6rem auto 0;
}

#controls label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

#controls input[type="range"] {
  width: 90px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--gold-deep);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
#controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 1px solid var(--gold-light);
  cursor: pointer;
}
#controls input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 1px solid var(--gold-light);
  cursor: pointer;
}
#controls input[type="range"]::-moz-range-track {
  background: var(--gold-deep);
  height: 4px;
  border-radius: 2px;
}

#controls input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--gold-dark);
  border-radius: 2px;
  background: #0a0800;
  cursor: pointer;
  position: relative;
}
#controls input[type="checkbox"]:checked {
  background: var(--gold);
}
#controls input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  color: #000;
  font-size: 10px;
  top: -1px;
  left: 2px;
}

output {
  margin-left: auto;
  font-family: monospace;
  color: #444;
  font-size: 0.7rem;
}

#fs-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1000;
  background: rgba(5, 5, 2, 0.85);
  border: 1px solid var(--gold-dark);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 1rem;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#fs-btn:hover {
  color: var(--text);
  border-color: var(--gold);
}

#map-box.fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  aspect-ratio: unset !important;
  z-index: 9999;
  border-radius: 0;
  margin: 0;
}

#mobile-map-btn {
  display: none;
  margin: 1rem auto;
  padding: 0.6rem 1.4rem;
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--text);
  background: var(--gold-deep);
  border: 1px solid var(--gold-dark);
  border-radius: 4px;
  cursor: pointer;
}
#mobile-map-btn:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

#mobile-close-map {
  display: none;
}

.leaflet-container {
  background: #0d0d0a !important;
}
.leaflet-control-zoom {
  display: none;
}
.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.6) !important;
  color: #444 !important;
  font-size: 0.6rem !important;
}
.leaflet-control-attribution a {
  color: #555 !important;
}
.hex-label {
  font-family: var(--font-title);
  font-size: 9px;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  width: 80px;
  text-shadow:
    0 0 4px #000,
    0 0 8px #000;
  pointer-events: none;
  white-space: normal;
}
@media (max-width: 600px) {
  #map-box {
    display: block;
  }
  #map-box.mobile-open {
    display: block;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    aspect-ratio: unset !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    border: none;
  }
  #controls {
    display: flex;
  }
  aside {
    z-index: 10001;
  }
  aside article {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0;
    padding: 1.5rem 1rem;
    margin: 1rem;
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
  }
}
