:root {
  --navy: #1F2A44;
  --gold: #C9A227;
  --tan: #8B7355;
  --cream: #F5F0E6;
  --white: #ffffff;
  --panel: rgba(31, 42, 68, 0.94);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: Montserrat, Arial, Helvetica, sans-serif;
  background: #0b1220;
  color: var(--white);
}
#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
#map {
  position: absolute;
  inset: 0;
  background: #1a1a1a;
}

/* Poster / lazy load */
#poster {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1220 center/cover no-repeat;
  cursor: pointer;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
#poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,18,32,0.25), rgba(11,18,32,0.55));
}
#poster .cta {
  position: relative;
  z-index: 1;
  background: rgba(201, 162, 39, 0.95);
  color: var(--navy);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 14px 22px;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.45);
  pointer-events: none;
}
#poster.hidden { display: none; }

.panel {
  position: absolute;
  z-index: 5;
  bottom: 18px;
  left: 18px;
  background: var(--panel);
  border: 1px solid rgba(201, 162, 39, 0.55);
  border-radius: 10px;
  padding: 14px 16px;
  max-width: min(300px, calc(100% - 36px));
  box-shadow: 0 6px 28px rgba(0,0,0,0.45);
}
.panel h1 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}
.panel .sub {
  margin: 0 0 10px;
  font-size: 11px;
  color: #d4c4a8;
  font-weight: 500;
  line-height: 1.35;
}
.legend { list-style: none; margin: 0; padding: 0; }
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 5px 0;
  color: #f5f0e6;
}
.swatch {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  border: 1.5px solid var(--gold);
  flex-shrink: 0;
  opacity: 0.9;
}
.brand {
  margin-top: 10px;
  font-size: 10px;
  color: var(--gold);
  font-weight: 600;
}

.controls {
  position: absolute;
  z-index: 5;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100% - 28px);
}
.controls button {
  font-family: Montserrat, Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(201,162,39,0.65);
  background: rgba(31,42,68,0.92);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.controls button:hover,
.controls button.active {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}

/* Presentation mode */
body.present .panel,
body.present .controls,
body.present .mapboxgl-ctrl-bottom-left,
body.present .mapboxgl-ctrl-bottom-right {
  display: none !important;
}
body.present .mapboxgl-ctrl-attrib {
  opacity: 0.35;
}

/* Popup */
.mapboxgl-popup-content {
  font-family: Montserrat, Arial, sans-serif;
  color: var(--navy);
  padding: 14px 16px 12px;
  border-radius: 8px;
  min-width: 180px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}
.mapboxgl-popup-close-button {
  font-size: 18px;
  color: var(--navy);
  padding: 4px 8px;
}
.popup-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.25;
}
.popup-type {
  font-size: 11px;
  color: var(--tan);
  margin: 0 0 10px;
  font-weight: 600;
}
.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.popup-actions a {
  display: block;
  text-align: center;
  text-decoration: none;
  background: var(--navy);
  color: #fff !important;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.popup-actions a.secondary {
  background: transparent;
  color: var(--navy) !important;
  border: 1.5px solid var(--navy);
}
.popup-actions a:hover {
  background: var(--gold);
  color: var(--navy) !important;
  border-color: var(--gold);
}
.popup-actions a.secondary:hover {
  background: var(--cream);
}

.mapboxgl-ctrl-attrib { font-size: 9px !important; }
.mapboxgl-ctrl-logo { margin: 0 0 4px 8px !important; }

@media (max-width: 640px) {
  .panel {
    bottom: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
    padding: 10px 12px;
  }
  .panel h1 { font-size: 13px; }
  .legend li { font-size: 11px; margin: 3px 0; }
  .controls { top: 10px; right: 10px; }
  .controls button { padding: 7px 10px; font-size: 10px; }
}

/* Token warning banner */
#token-warn {
  position: absolute;
  z-index: 30;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(201,162,39,0.95);
  color: var(--navy);
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-align: center;
  max-width: calc(100% - 24px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  display: none;
}
#token-warn.show { display: block; }
