:root {
  color-scheme: dark;
  --bg: #07080c;
  --bg-2: #101218;
  --card: #161922;
  --border: rgba(212, 184, 140, 0.18);
  --text: #f4efe6;
  --dim: #b7ad9c;
  --faint: #7d7466;
  --aurora: #c9e7d2;
  --aurora-deep: #8fd0a8;
  --gold: #d4b88c;
  --amber: #e6c99a;
  --red: #e08b84;
  --blue: #9ec4e8;
  --violet: #c4b4e6;
  --serif: "Cormorant Garamond", "Didot", "Times New Roman", serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 700px at 20% -10%, #1a1c24 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  overflow: hidden;
}

button, select { font: inherit; color: inherit; }

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-rows: 56px minmax(0, 1fr);
  height: 100%;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 8, 12, 0.82);
  backdrop-filter: blur(18px);
}

.brand h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 0;
}

.topbar .spacer { flex: 1; }

.seg {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  background: transparent;
  border: 0;
  color: var(--faint);
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
}
.seg button.on {
  background: #1c1f28;
  color: var(--gold);
}

.refresh {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.refresh:hover { border-color: var(--gold); color: var(--gold); }

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #03060e;
}
.map-slot {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.map-slot svg, .stage svg { display: block; width: 100%; height: 100%; }

.hud {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

.gps-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  border: 1px solid var(--gold);
  background: rgba(12, 12, 16, 0.82);
  color: var(--gold);
  border-radius: 999px;
  padding: 9px 16px;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(12px);
}
.gps-btn.on { background: rgba(212, 184, 140, 0.12); color: #f3e6cf; }

.photo-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  transform-origin: 0 0;
}
.photo-pin {
  position: absolute;
  pointer-events: auto;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #111 center / cover no-repeat;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45), 0 0 0 2px rgba(123,232,192,0.35);
  transform: translate(-50%, -50%);
  padding: 0;
  cursor: pointer;
}
.photo-pin.open {
  z-index: 16;
  box-shadow: 0 8px 28px rgba(0,0,0,0.55), 0 0 0 3px #7be8c0;
}
.photo-modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(4, 8, 16, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.photo-modal img {
  max-width: min(92vw, 720px);
  max-height: min(70vh, 720px);
  border-radius: 18px;
}
.photo-modal .meta { color: #dce6f8; margin-top: 10px; text-align: center; }

.zoom-btns {
  position: absolute;
  right: 16px;
  top: 58px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zoom-btns button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(12, 17, 34, 0.9);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chips, .hours {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip, .hour {
  background: rgba(12, 17, 34, 0.86);
  border: 1px solid var(--border);
  color: var(--faint);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.chip.on { color: var(--aurora); border-color: #2d6b55; background: rgba(18, 42, 36, 0.9); }
.chip.on.clouds { color: #dce6f8; border-color: #5d6788; }
.chip.on.dark { color: var(--blue); border-color: #355f88; }
.chip.on.places { color: var(--amber); border-color: #8a6a32; }
.chip.on.light { color: #ffb15a; border-color: #a86a32; }
.chip.on.roads { color: #f2e2b8; border-color: #b89a62; }

.light-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 4px;
  padding: 10px 12px;
  background: rgba(255, 138, 61, 0.08);
  border: 1px solid #a86a32;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}
.light-card:hover { border-color: #ffb15a; }
.light-bortle {
  font-size: 28px;
  font-weight: 200;
  color: #ffb15a;
  font-variant-numeric: tabular-nums;
}
.explain {
  margin: 14px 0 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.explain summary {
  cursor: pointer;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.explain p {
  margin: 10px 0 0;
  line-height: 1.45;
  color: var(--dim);
  font-size: 13px;
}
.explain b { color: var(--text); }
.hour.on { color: var(--text); border-color: var(--aurora); }

.legend-float {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(12, 17, 34, 0.86);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--dim);
  backdrop-filter: blur(10px);
  line-height: 1.55;
}
.legend-float b { color: var(--text); font-weight: 600; }

.side {
  border-left: 1px solid var(--border);
  background: linear-gradient(180deg, #0c0d12 0%, #07080c 100%);
  overflow: auto;
  padding: 24px 20px 32px;
}

.gps-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0 0 16px;
  padding: 14px 16px;
  text-align: left;
  background: linear-gradient(180deg, rgba(212, 184, 140, 0.1), rgba(212, 184, 140, 0.03));
  border: 1px solid rgba(212, 184, 140, 0.35);
  border-radius: 16px;
  color: inherit;
  cursor: pointer;
}
.gps-card.on { box-shadow: inset 0 0 0 1px var(--gold); }
.gps-card.idle { cursor: default; opacity: 0.85; }
.gps-score {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -1px;
  line-height: 1;
}

.score-block { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.score {
  font-family: var(--serif);
  font-size: 84px;
  font-weight: 400;
  letter-spacing: -2px;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}
.score-meta { padding-bottom: 10px; }
.score-meta .verdict { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.muted { color: var(--dim); }
.faint { color: var(--faint); }
.cap { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin: 20px 0 8px; }

.factors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.factor {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
}
.factor .n, .num { font-family: var(--serif); font-weight: 400; }
.factor .n { font-variant-numeric: tabular-nums; font-weight: 600; }

.best-card {
  margin-top: 14px;
  background: linear-gradient(180deg, rgba(40, 196, 139, 0.08), transparent);
  border: 1px solid #2d6b55;
  border-radius: 14px;
  padding: 12px;
}
.best-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(12, 17, 34, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  cursor: pointer;
  text-align: left;
}
.best-row.on { border-color: var(--aurora); background: rgba(18, 42, 36, 0.7); }
.best-row.best-time { margin-top: 12px; border-style: dashed; }
.best-row:hover { border-color: var(--aurora); }
.best-label { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.best-name { font-weight: 600; margin-top: 2px; }
.best-score {
  font-size: 28px;
  font-weight: 200;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.wind {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.wind .bz { grid-column: 1 / -1; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 18px; }
.south { color: var(--aurora); }
.north { color: var(--red); }
.spark { display: block; margin-top: 8px; }
.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 48px;
  margin-bottom: 4px;
}
.bar {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  background: #0a1020;
  border-radius: 3px;
  cursor: pointer;
  min-width: 0;
}
.bar-fill {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 3px;
}
.bar.on { outline: 1px solid var(--aurora); }
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
}
.hint { margin-top: 14px; line-height: 1.45; }

.fab-post {
  display: none;
}
.composer {
  position: absolute;
  right: 16px;
  bottom: 88px;
  z-index: 30;
  width: min(360px, calc(100% - 32px));
  background: rgba(8, 12, 24, 0.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.composer-head, .composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.composer-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

.place {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.nights { display: flex; flex-direction: column; gap: 8px; }
.night {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.degraded { color: var(--amber); font-size: 12px; margin-top: 12px; }

.promo {
  margin-top: 28px;
  padding: 16px;
  background: linear-gradient(160deg, #0f1a2e, #0a1020);
  border: 1px solid #2d4a6b;
  border-radius: 16px;
}
.promo-head { margin-bottom: 12px; }
.promo-brand { font-weight: 700; letter-spacing: -0.02em; font-size: 16px; }
.promo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
  color: inherit;
}
.promo-item:hover .promo-name { color: var(--aurora); }
.promo-name { font-weight: 600; }
.promo-price {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--aurora);
}
.promo-cta {
  display: block;
  margin-top: 12px;
  text-align: center;
  background: var(--aurora-deep);
  color: #04140e;
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 14px;
}
.promo-cta:hover { filter: brightness(1.08); }

.loading, .error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--dim);
}
.error { color: var(--amber); padding: 40px; text-align: center; }

@media (max-width: 960px) {
  .app {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-rows: 56px minmax(0, 1fr);
    height: 100%;
  }
  .topbar {
    padding: 0 12px;
    padding-top: env(safe-area-inset-top);
    gap: 8px;
    overflow-x: auto;
    background: rgba(7, 8, 12, 0.94);
  }
  .brand h1 { font-size: 22px; }
  .brand span { display: none; }
  .topbar .seg { display: flex; }
  .topbar .seg button { padding: 6px 9px; font-size: 12px; }
  .refresh { padding: 7px 12px; font-size: 12px; }
  .stage { min-height: 0; }
  .side {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: min(46vh, 420px);
    border-left: 0;
    border-top: 1px solid var(--gold);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
    padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #12141a 0%, #07080c 100%);
  }
  .side::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(212, 184, 140, 0.5);
    margin: -6px auto 14px;
  }
  .score { font-size: 56px; }
  .score-meta .verdict { font-size: 18px; }
  .gps-card { padding: 12px 14px; }
  .gps-score { font-size: 34px; }
  .fab-post {
    display: block;
    position: absolute;
    right: 12px;
    bottom: calc(min(46vh, 420px) + 12px);
    z-index: 35;
    border: 0;
    background: var(--gold);
    color: #1a140c;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 999px;
    padding: 12px 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  }
  .composer {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
  }
  .photo-pin { width: 52px !important; height: 52px !important; }
  .legend-float { display: none; }
  .hud {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(min(46vh, 420px) + 10px);
    z-index: 25;
    pointer-events: none;
    gap: 8px;
  }
  .hud > * { pointer-events: auto; }
  .hours {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .hours::-webkit-scrollbar { display: none; }
  .chip, .hour {
    flex-shrink: 0;
    padding: 9px 13px;
    font-size: 13px;
  }
  .gps-btn {
    top: 10px;
    right: 10px;
    padding: 10px 14px;
    font-size: 11px;
  }
  .zoom-btns {
    right: 10px;
    top: 58px;
  }
  .zoom-btns button {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }
  .promo { margin-top: 8px; }
}
