/* Lucky — Weather → Music · v1.1.1 */

:root {
  --bg: #030508;
  --glass: rgba(255, 255, 255, .028);
  --border: rgba(255, 255, 255, .065);
  --border-acc: rgba(250, 235, 146, .18);
  --fg: #f1f5f9;
  --dim: #b0bec5;
  --mut: #78909c;
  --sub: #546e7a;
  --acc: #FAEB92;
  --acc-hi: rgba(250, 235, 146, .22);
  --acc-glow: rgba(250, 235, 146, .10);
  --radius: 14px;
  --gap: clamp(10px, 2vw, 20px);
  --fs: clamp(13.5px, 1.2vw, 15px);
  --pulse: 1.9s;
}

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

html {
  height: 100%;
}

body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--fs)/1.6 'Inter', system-ui, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(ellipse 120% 55% at 50% -5%, rgba(56, 189, 248, .12) 0%, transparent 100%);
}

/* ─── Welcome overlay ─── */

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(3, 5, 8, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}

.welcome-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.welcome-card {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 55%),
    rgba(8, 13, 24, 0.96);
  border: 1px solid rgba(56, 189, 248, .16);
  border-radius: 20px;
  padding: clamp(28px, 5vw, 52px) clamp(24px, 5vw, 48px);
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  max-height: 90svh;
  overflow-y: auto;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .07),
    0 0 0 1px rgba(56, 189, 248, .04),
    0 0 80px rgba(56, 189, 248, .07),
    0 40px 80px rgba(0, 0, 0, .55);
  flex-shrink: 0;
}

.welcome-logo {
  font-size: clamp(2.2em, 6vw, 3em);
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--fg);
  margin-bottom: 4px;
}

.welcome-tagline {
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--acc);
  margin-bottom: 24px;
}

.welcome-body {
  font-size: 1em;
  color: #c8d4e0;
  line-height: 1.65;
  margin-bottom: 20px;
}

.param-box {
  background: rgba(56, 189, 248, .06);
  border: 1px solid rgba(56, 189, 248, .18);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.param-box-label {
  font-size: 0.66em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--acc);
  margin-bottom: 10px;
  text-align: left;
}

.param-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  text-align: left;
}

.param-key {
  font-size: 0.82em;
  color: #c8d4e0;
  white-space: nowrap;
}

.param-val {
  font-size: 0.82em;
  color: #7fb3cc;
}

.welcome-facts {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.welcome-facts li {
  font-size: 0.85em;
  color: #94a3b8;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.welcome-facts li::before {
  content: '→';
  color: var(--acc);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: .05em;
}

.welcome-cta {
  width: 100%;
  padding: 13px 24px;
  font-size: 0.95em;
  font-weight: 700;
  border-radius: 999px;
  background: var(--acc);
  color: #001824;
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: box-shadow .15s, transform .1s;
}

.welcome-cta:hover {
  box-shadow: 0 0 0 3px var(--acc-hi), 0 0 28px var(--acc-glow);
}

.welcome-cta:active {
  transform: scale(0.97);
}

/* ─── Shell ─── */

.shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ─── Topbar ─── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(16px, 3vw, 32px);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 100%),
    rgba(5, 8, 14, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03);
  flex-shrink: 0;
}

.brand {
  font-size: 1.05em;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: .65em;
}

.brand-sub {
  font-size: 0.7em;
  font-weight: 400;
  color: var(--mut);
  letter-spacing: 0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Controls bar ─── */

.controls-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px clamp(16px, 3vw, 32px);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.018) 0%, transparent 100%),
    rgba(4, 7, 12, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

/* ─── Main ─── */

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Map section — the dominant element ─── */

.map-section {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;        /* creates stacking context — contains all Leaflet internal z-indexes */
  background: #020406;
}

/* Leaflet overrides */
.leaflet-container {
  background: #020406 !important;
  font-family: inherit;
}

.leaflet-tile-pane {
  opacity: 0.85;
}

/* ─── Map overlays (glass) ─── */

.map-overlay {
  position: absolute;
  z-index: 10;
  /* Glass: semi-transparent, sheen gradient simulates light refraction */
  background:
    linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 55%),
    rgba(7, 12, 22, 0.62);
  /* Directional border — brighter on top/left, subtle on bottom/right */
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-bottom-color: rgba(255, 255, 255, 0.04);
  border-right-color:  rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 2px 6px  rgba(0, 0, 0, 0.25);
}

/* Location info — bottom-left, floating text only (no panel) */
.location-overlay {
  bottom: 110px;
  left: 48px;
  padding: 0;
  max-width: 420px;
  background: none;
  border: none;
  box-shadow: none;
}

/* Parameters — right side, scrollable */
.params-overlay {
  top: 16px;
  right: 16px;
  width: 272px;
  max-height: calc(100% - 90px);
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, .2) transparent;
}

.params-overlay::-webkit-scrollbar {
  width: 4px;
}

.params-overlay::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, .2);
  border-radius: 999px;
}

/* .params-section-label no longer needed — music panel starts directly */

/* Waveform — full-width bottom strip on map */
.waveform-overlay {
  bottom: 0;
  left: 0;
  right: 0;
  height: 54px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: rgba(3, 5, 8, 0.80);
}

.waveform-overlay canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* ─── Zoom controls overlay ─── */

.zoom-overlay {
  bottom: 62px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
}

.zoom-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.3em;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  min-height: unset;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--dim);
  line-height: 1;
}

/* ─── City marker tooltips ─── */

.leaflet-tooltip.map-city-tip {
  background: rgba(7, 12, 22, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #e2e8f0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.leaflet-tooltip-top.map-city-tip::before {
  border-top-color: rgba(56, 189, 248, 0.22);
}

/* ─── Location overlay text ─── */

/* Chips are redundant — readout is shown instead */
.loc-chips { display: none; }

.hero-eyebrow {
  font-size: 0.66em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--acc);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
}

/* Weather data grid — floating text under city name */
.location-weather {
  margin-top: 10px;
  font-size: 1.05em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.7);
}

.location-weather span {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 700;
}

.location-weather b {
  color: #ffffff;
  font-weight: 700;
}

.loc-name {
  font-size: clamp(1.4em, 2.8vw, 2.1em);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  text-shadow:
    0 1px 12px rgba(0, 0, 0, 0.9),
    0 0  28px rgba(0, 0, 0, 0.7);
}

.loc-genre {
  font-size: 0.85em;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.4;
  margin-top: 3px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
}

/* ─── Content fade-in ─── */

@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.kv > span,
.kv > b {
  animation: contentFadeIn .3s ease both;
}

ul.clean > li {
  animation: contentFadeIn .3s ease both;
}

.chip {
  font-size: 0.75em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, .07);
  border: 1px solid rgba(56, 189, 248, .16);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  animation: contentFadeIn .35s ease both;
}

/* ─── Key-value grid ─── */

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.87em;
}

.kv span {
  color: var(--mut);
}

.kv b {
  color: var(--fg);
  font-weight: 500;
}

.traits-kv {
  margin-top: 2px;
}

/* ─── Panel label ─── */

.panel-label {
  font-size: 0.69em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mut);
  flex-shrink: 0;
}

/* ─── Mapping list ─── */

ul.clean {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.86em;
  color: var(--dim);
}

ul.clean li::before {
  content: '→';
  color: var(--acc);
  margin-right: .45em;
  font-weight: 600;
}

/* ─── About blurb ─── */

.about-blurb {
  font-size: 0.82em;
  color: var(--sub);
  line-height: 1.55;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ─── Location select ─── */

select {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 180px;
  min-width: 0;
  background-color: rgba(10, 14, 20, 0.78);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 8px 34px 8px 16px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.88em;
  cursor: pointer;
  min-height: 38px;
  transition: border-color .15s, box-shadow .15s;
  animation: selectPulse 2s ease-in-out infinite;
}

select option {
  background: #0d1117;
  color: #f1f5f9;
}

select:focus,
select:hover {
  animation: none;
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-hi);
}

@keyframes selectPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(56, 189, 248, .18); }
  50%       { box-shadow: 0 0 0 3px rgba(56, 189, 248, .38), 0 0 12px rgba(56, 189, 248, .12); }
}

/* ─── Transport buttons ─── */

.transport {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.88em;
  font-weight: 600;
  padding: 8px 20px;
  min-height: 38px;
  border: 1px solid transparent;
  transition: box-shadow .15s, transform .1s, background .15s, color .15s;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

button:active {
  transform: scale(0.95);
}

button.primary {
  background: var(--acc);
  color: #001824;
  border-color: var(--acc);
}

button.primary:hover {
  box-shadow: 0 0 0 3px var(--acc-hi), 0 0 24px var(--acc-glow);
}

button:not(.primary) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--dim);
  border-color: rgba(255, 255, 255, 0.09);
}

button:not(.primary):hover {
  background: rgba(255, 255, 255, .10);
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.14);
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--fg);
}

/* ─── Volume row ─── */

.vol-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.vol-row label {
  font-size: 0.8em;
  color: var(--mut);
  white-space: nowrap;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 3px;
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  border: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--acc);
  cursor: pointer;
  box-shadow: 0 0 6px var(--acc-hi);
  transition: box-shadow .15s;
}

input[type="range"]:hover::-webkit-slider-thumb {
  box-shadow: 0 0 12px var(--acc-hi), 0 0 20px var(--acc-glow);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--acc);
}

.volread {
  font-size: 0.8em;
  color: var(--mut);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}

/* ─── Badge ─── */

.badge {
  font: 600 10px/1 'Inter', system-ui;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--mut);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
}

/* ─── Radio wave ─── */

.rwave {
  position: relative;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  opacity: .5;
  transition: opacity .2s;
}

.rwave span {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--acc);
  border-radius: 50%;
  opacity: 0;
  transform: scale(.45);
  animation: ping var(--pulse) linear infinite;
}

.rwave span:nth-child(2) { animation-delay: calc(var(--pulse) / 3); }
.rwave span:nth-child(3) { animation-delay: calc(2 * var(--pulse) / 3); }

.rwave::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acc);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px var(--acc);
}

body:not(.is-playing) .rwave { opacity: .2; }
body:not(.is-playing) .rwave span { animation-play-state: paused; }

@keyframes ping {
  0%   { opacity: .65; transform: scale(.45); }
  70%  { opacity: .08; }
  100% { opacity: 0;   transform: scale(1.75); }
}

/* ─── Footer ─── */

.footer {
  display: none;
}

/* ─── Medium screens ─── */

@media (max-width: 900px) {
  .location-overlay {
    left: 24px;
    bottom: 80px;
  }
  .location-weather {
    font-size: 0.95em;
  }
}

@media (max-width: 760px) {
  .params-overlay {
    width: 210px;
    font-size: 0.92em;
  }
  .location-overlay {
    left: 16px;
    bottom: 72px;
    max-width: 260px;
  }
  .location-weather {
    font-size: 0.88em;
  }
  .loc-name {
    font-size: clamp(1.1em, 3.5vw, 1.6em);
  }
}

/* ─── Mobile ─── */

@media (max-width: 600px) {
  .brand-sub { display: none; }

  .controls-bar {
    gap: 8px;
    padding: 8px 16px;
  }

  select {
    flex: 1 1 100%;
    order: -1;
    border-radius: 10px;
  }

  .transport {
    flex: 1;
  }

  button {
    flex: 1;
    text-align: center;
  }

  /* Vol: keep slider, drop label + readout to save space */
  .vol-row label,
  .volread { display: none; }

  .vol-row {
    margin-left: 0;
  }

  input[type="range"] {
    width: 80px;
  }

  /* Mobile: map is clean — no overlays, city is already in select */
  .params-overlay,
  .zoom-overlay { display: none; }

  .location-overlay {
    left: 12px;
    bottom: 60px;
    max-width: 200px;
  }

  .location-overlay .hero-eyebrow {
    font-size: 0.65em;
  }

  .loc-name {
    font-size: clamp(0.95em, 4vw, 1.2em);
  }

  .loc-genre {
    font-size: 0.72em;
  }

  .location-weather {
    font-size: 0.72em;
  }
}

@media (max-width: 380px) {
  .brand { font-size: 0.95em; }
}
