*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d1e35;
  --surface: #18202e;
  --border: #283548;
  --accent: #ff6b3d;
  --text: #f0ede8;
  --text-muted: #9aa5b8;
  --state-fill: #1e2f48;
  --state-stroke: #2d3a50;
  --panel-width: 380px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}

/* Film grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* Vignette overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 48%, transparent 30%, rgba(6, 10, 18, 0.82) 100%);
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 16px 24px 8px;
  pointer-events: none;
}

header::before {
  content: '';
  position: absolute;
  inset: 0;
  height: 110px;
  background: linear-gradient(to bottom, rgba(10,16,28,0.96) 0%, transparent 100%);
  z-index: -1;
}

.header-inner {
  text-align: center;
}

.header-inner h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.header-inner .subtagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

/* Main layout */
main {
  height: 100vh;
}

/* Map */
#map-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

.state {
  fill: var(--state-fill);
  stroke: none;
}

.state-border {
  fill: none;
  stroke: #c49a28;
  stroke-width: 0.7px;
  filter: drop-shadow(0 0 4px rgba(210, 165, 35, 0.65));
  vector-effect: non-scaling-stroke;
}

.nation-border {
  fill: none;
  stroke: #a07c20;
  stroke-width: 1.5px;
  filter: drop-shadow(0 0 7px rgba(185, 145, 25, 0.55));
  vector-effect: non-scaling-stroke;
}

/* City markers */
.city-marker {
  cursor: pointer;
}

.city-hitarea {
  fill: transparent;
  stroke: none;
}

.city-dot {
  fill: var(--accent);
  stroke: rgba(255, 107, 61, 0.4);
  stroke-width: 6px;
  filter: drop-shadow(0 0 5px rgba(255, 107, 61, 0.85));
  transition: r 0.15s ease;
}

.city-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1px;
  opacity: 0;
  animation: pulse 2.5s ease-out infinite;
}

@keyframes pulse {
  0% { r: 6px; opacity: 0.8; }
  100% { r: 22px; opacity: 0; }
}

.city-marker:hover .city-dot {
  r: 8px;
  fill: #ff7a52;
}

.city-marker.active .city-dot {
  fill: #fff;
  stroke: var(--accent);
}

.city-marker.active .city-pulse {
  stroke: #fff;
}

.city-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 500;
  text-anchor: middle;
  pointer-events: none;
  opacity: 0.85;
  letter-spacing: 0.03em;
}

/* Map hint */
#map-hint {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.4s;
}

#map-hint.hidden {
  opacity: 0;
}

/* Player panel */
#player-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: var(--panel-width);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
}

#player-panel.hidden {
  transform: translateX(100%);
}

/* Player header */
#player-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 90px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  max-height: 42vh;
  overflow-y: auto;
}

#city-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#city-state {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#city-tagline-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 10px;
}

#city-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* Venues section */
#venues-section {
  display: none;
  margin-top: 10px;
}

#venues-section.visible {
  display: block;
}

#venues-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

#venues-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#venues-list a {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}

#venues-list a:hover {
  opacity: 0.75;
}

#close-player {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: 8px;
  transition: color 0.15s;
}

#close-player:hover {
  color: var(--text);
}

/* Spotify embed */
#spotify-embed {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
}

/* ── Mobile ─────────────────────────────────────────────────────────────────*/
@media (max-width: 768px) {
  /* Labels stay hidden by default (too crowded at the base zoom level) but
     reveal once zoomed in enough that they won't overlap — see the
     'label-visible' class toggled in app.js's zoom handler. */
  .city-label {
    display: none;
  }

  .city-marker.label-visible .city-label {
    display: block;
  }

  /* Smaller dots and tighter hit areas on mobile */
  .city-dot {
    r: 3.5px;
  }

  .city-pulse {
    r: 3.5px;
  }

  .city-hitarea {
    r: 10px;
  }

  /* Hint text — smaller and less prominent */
  #map-hint {
    font-size: 0.65rem;
    top: 16px;
    right: 16px;
  }

  /* Player panel becomes a bottom sheet instead of a side drawer */
  #player-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 78vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    transform: translateY(0);
  }

  #player-panel.hidden {
    transform: translateY(100%);
  }

  #player-header {
    padding: 20px 16px 16px;
  }

  /* Request button — move up so it clears the bottom sheet */
  #request-btn {
    bottom: 16px;
    left: 16px;
  }
}

/* Icon links (newsletter) */
#icon-links {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: opacity 0.2s ease;
}

#icon-links button,
#icon-links a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  opacity: 1;
  cursor: pointer;
  transition: opacity 0.3s ease, color 0.15s;
}

#icon-links svg {
  display: block;
}

.icon-link-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: inherit;
}

#icon-links button:hover,
#icon-links a:hover {
  color: var(--text);
}

#icon-links .hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 768px) {
  #icon-links {
    bottom: 16px;
    right: 16px;
    gap: 10px;
  }
}

/* Request button */
#request-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 20;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.2s ease;
}

/* Hide the floating action buttons whenever the player panel is open —
   both sit at fixed viewport corners and otherwise collide with the
   Spotify embed's own content (track rows, its login/upsell overlay, etc.) */
body.panel-open #request-btn,
body.panel-open #icon-links {
  opacity: 0;
  pointer-events: none;
}

#request-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  width: 480px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* Form */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.required {
  color: var(--accent);
}

input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.875rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

input:focus, select:focus {
  border-color: var(--accent);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
  cursor: pointer;
}

.form-error {
  font-size: 0.78rem;
  color: #e05a5a;
  margin-bottom: 12px;
}

.form-error.hidden {
  display: none;
}

.btn-submit {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 11px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 4px;
}

.btn-submit:hover {
  opacity: 0.88;
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-success {
  text-align: center;
  padding: 28px 0 8px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.form-success.hidden {
  display: none;
}

.modal-footer-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 16px;
}

.modal-footer-note a {
  color: var(--accent);
}
