:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #111716;
  --panel-strong: #162120;
  --text: #f4f1e6;
  --muted: #b6c0ba;
  --line: rgba(244, 241, 230, 0.16);
  --gold: #d7b76a;
  --red: #d84434;
  --orange: #df8a2e;
  --yellow: #d2bd3f;
  --gray: #737a76;
  --water: #16363d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body {
  position: fixed;
  inset: 0;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.conditions-bar {
  position: fixed;
  inset: env(safe-area-inset-top) 0 auto 0;
  z-index: 900;
  min-height: 80px;
  padding: 8px 12px 8px;
  background: rgba(10, 10, 10, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.condition-row {
  display: flex;
  min-height: 21px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.condition-row.primary {
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
}

.condition-row span {
  min-width: 0;
}

.offline-banner {
  margin-top: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(215, 183, 106, 0.45);
  background: rgba(215, 183, 106, 0.15);
  color: #f6dda2;
  font-size: 12px;
  line-height: 1.2;
}

.map-stage {
  position: fixed;
  inset: 80px 0 182px 0;
  background: var(--water);
}

#map {
  width: 100%;
  height: 100%;
  background: #102b31;
}

.leaflet-container {
  background: #102b31;
  font-family: inherit;
}

.leaflet-control-attribution {
  background: rgba(10, 10, 10, 0.78);
  color: var(--muted);
}

.map-action {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 600;
  min-width: 88px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 23, 22, 0.92);
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
}

.spot-marker {
  width: 48px;
  height: 48px;
  transform: translate(-24px, -24px);
}

.marker-inner {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.marker-inner.operator {
  border-color: var(--gold);
  color: #1d1603;
  clip-path: polygon(50% 0%, 61% 31%, 96% 35%, 69% 55%, 78% 90%, 50% 72%, 22% 90%, 31% 55%, 4% 35%, 39% 31%);
}

.marker-inner.crowd {
  border-radius: 999px;
}

.marker-inner.structure {
  transform: rotate(45deg) scale(0.86);
  border-radius: 6px;
}

.marker-inner.structure span {
  transform: rotate(-45deg);
}

.score-red {
  background: var(--red);
}

.score-orange {
  background: var(--orange);
}

.score-yellow {
  background: var(--yellow);
  color: #1b1b10;
}

.score-gray {
  background: var(--gray);
}

.spot-dock {
  position: fixed;
  inset: auto 0 78px 0;
  z-index: 850;
  max-height: 162px;
  background: rgba(10, 10, 10, 0.96);
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.dock-handle {
  width: 42px;
  height: 4px;
  margin: 7px auto 5px;
  border-radius: 99px;
  background: rgba(244, 241, 230, 0.3);
}

.dock-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 12px 5px;
}

.dock-header h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.1;
}

.dock-header span {
  color: var(--muted);
  font-size: 12px;
}

.spot-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 68vw);
  gap: 8px;
  overflow-x: auto;
  padding: 0 12px 12px;
  scrollbar-width: thin;
}

.spot-row {
  min-height: 72px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.spot-row:focus-visible,
.map-action:focus-visible,
.snap-row button:focus-visible,
.close-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.spot-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.2;
}

.spot-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.mini-bar {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(244, 241, 230, 0.14);
}

.mini-bar > i {
  display: block;
  height: 100%;
}

.time-control {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 880;
  min-height: 78px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 10, 10, 0.97);
  border-top: 1px solid var(--line);
}

.time-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.time-meta strong {
  color: var(--text);
}

#timeSlider {
  width: 100%;
  min-height: 24px;
  accent-color: var(--gold);
}

.snap-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.snap-row button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.spot-dialog {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.spot-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  max-height: 84vh;
  overflow-y: auto;
  padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  border-radius: 8px 8px 0 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.close-button {
  position: sticky;
  top: 0;
  float: right;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 24px;
}

.detail-title {
  margin: 0 52px 4px 0;
  font-size: 20px;
  line-height: 1.2;
}

.detail-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.score-block {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
}

.score-number {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 26px;
  font-weight: 900;
}

.ci-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(244, 241, 230, 0.14);
}

.ci-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: inherit;
  background: rgba(215, 183, 106, 0.82);
}

.layer-list,
.source-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.layer-row {
  display: grid;
  grid-template-columns: 84px 1fr 58px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.layer-track {
  height: 8px;
  border-radius: 99px;
  background: rgba(244, 241, 230, 0.12);
  overflow: hidden;
}

.layer-track > i {
  display: block;
  height: 100%;
  background: var(--gold);
}

.section-title {
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid rgba(215, 183, 106, 0.5);
  border-radius: 6px;
  color: #f6dda2;
  font-size: 12px;
  font-weight: 760;
}

.source-card {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  line-height: 1.4;
}

.source-card a {
  color: #95d3df;
  overflow-wrap: anywhere;
}

.profile-chart {
  width: 100%;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1c1d;
}

.navigate-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  margin-top: 10px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--gold);
  color: #111;
  font-weight: 820;
  text-decoration: none;
}

@media (min-width: 720px) {
  .conditions-bar {
    left: 50%;
    width: min(760px, 100%);
    transform: translateX(-50%);
  }

  .spot-dock,
  .time-control {
    left: 50%;
    width: min(760px, 100%);
    transform: translateX(-50%);
  }

  .map-stage {
    inset-bottom: 176px;
  }
}
