/* --- Unified pill buttons for radio controls --- */
.btn.btn-xs,
#radio-love-btn,
#radio-love,
.btn-tune,
.btn-identify {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px !important;
  font-size: 13px;
  line-height: 1.25;
  border-radius: 999px !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  color: #fff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: transform .08s ease, box-shadow .15s ease, background-color .2s ease;
  cursor: pointer;
}

/* Variants */
.btn-tune { background: linear-gradient(180deg, rgba(46, 204, 113, 0.95), rgba(33, 150, 83, 0.95)) !important; }
.btn-identify { background: linear-gradient(180deg, rgba(0, 123, 255, 0.95), rgba(0, 92, 191, 0.95)) !important; }
#radio-love-btn,
#radio-love { background: linear-gradient(180deg, rgba(255, 71, 87, 0.95), rgba(200, 40, 52, 0.95)) !important; }

.btn.btn-xs:hover,
.btn-tune:hover,
.btn-identify:hover,
#radio-love-btn:hover,
#radio-love:hover {
  box-shadow: 0 3px 14px rgba(0,0,0,0.35), 0 0 10px rgba(255,255,255,0.08);
}

.btn.btn-xs:active,
.btn-tune:active,
.btn-identify:active,
#radio-love-btn:active,
#radio-love:active { transform: translateY(1px) scale(0.98); }

/* Icon spacing inside */
#radio-love-btn i,
#radio-love i { margin-right: 6px; }

:root {
    /* Controls vertical space reserved for the absolute-positioned header */
    --header-height: 100px; /* will be synced at runtime */
    /* Height of the now playing subheader */
    --subheader-height: 64px;
}

/* Allow controls injected into #radio-title to be visible */
#radio-title {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: visible !important; /* override inline hidden */
    white-space: normal !important; /* allow wrapping if needed */
}
/* Top Loading Equalizer under header */
.top-loader {
    position: absolute;
    top: 82px; /* just below header */
    left: 0;
    right: 0;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 210;
}
.top-eq { display:inline-flex; gap:6px; height:18px; align-items:flex-end; }
.top-eq .bar { width:5px; background:#00ff88; border-radius:3px; animation: top-eq-bounce 1s ease-in-out infinite; animation-delay: calc(var(--d) * 0.12s); box-shadow: 0 0 8px rgba(0,255,136,0.6); }
@keyframes top-eq-bounce { 0%,100% { height: 4px; } 50% { height: 18px; } }
/* Globe Explorer Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* Header */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500; /* above .modal (300) so header stays visible */
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 10px; /* compact header */
    height: var(--header-height); /* ensure consistent reserved space */
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.title {
    font-size: 1.6rem; /* smaller title */
    font-weight: 700;
    background: linear-gradient(45deg, #00ff88, #00ccff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0; /* reset default h1 margins */
    line-height: 1; /* tighten vertical spacing */
}

.title i {
    margin-right: 8px;
    color: #00ff88;
    -webkit-text-fill-color: #00ff88;
}

/* Compact logo image inside header title */
.header .title img {
    height: 36px !important; /* override any inline height */
    width: auto;
    display: block;
}

.logo-wordmark {
    letter-spacing: 0.2px;
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
}

/* Ensure the wordmark next to the SVG is visible (override title's transparent fill) */
.logo-wordmark {
    color: #eafff5;
    -webkit-text-fill-color: initial; /* override transparent from .title */
    background: none !important;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Add breathing room at the very top so header isn't clipped */
header,
header.site-header,
header.app-header {
    padding-top: 20px; /* further increased */
    margin-top: 1px;    /* add real gap from top edge */
    overflow: visible;
}

/* Global safe top spacing for browser chrome / notches */
html, body { height: 100%; }
body {
    padding-top: calc(env(safe-area-inset-top, 0px));
}

/* Safer alignment for header contents */
header .title,
header h1 {
    margin-top: 2px;
    line-height: 1.2;
}

header img {
    vertical-align: middle;
    margin-top: 4px; /* slight nudge down to avoid top crop on some browsers */
}

/* Custom basemap combobox */
.basemap-combobox {
    position: relative;
}

.bm-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 136, 0.45);
    color: #eafff5;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    font-size: 0.95rem;
}

.bm-button:hover {
    background: rgba(0, 255, 136, 0.06);
    border-color: rgba(0, 255, 136, 0.6);
}

.bm-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.25);
    border-color: #00ff88;
}

.bm-caret {
    color: #00ff88;
}

.bm-listbox {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: rgba(5, 8, 12, 0.96);
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 8px;
    padding: 4px;
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}

.bm-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    color: rgba(255,255,255,0.95);
    cursor: pointer;
}


.bm-option:hover,
.bm-option[aria-selected="true"],
.bm-option.is-active {
    background: rgba(0, 255, 136, 0.1);
}

.bm-option[aria-disabled="true"] {
    opacity: 0.5;
    pointer-events: none;
}

/* Hide native select visually but keep in DOM for a11y/noscript (already inlined style in HTML) */

/* Globe Container */
#globe-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Cesium viewer styling */
.cesium-viewer {
    width: 100% !important;
    height: 100% !important;
}

/* Hide Cesium's default UI elements we don't want */
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-bottom {
    display: none !important;
}

/* Style the Cesium credit display */
.cesium-widget-credits {
    display: none !important;
}

/* Global page scrollbar (so the bottom bar matches theme) */
html {
    /* Firefox */
    scrollbar-color: #00ff88 rgba(255,255,255,0.08);
    scrollbar-width: thin;
}
/* WebKit/Blink page scrollbar */
html::-webkit-scrollbar {
    height: 10px; /* horizontal bar height */
    width: 10px;  /* vertical bar width */
}
html::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.08);
}
html::-webkit-scrollbar-thumb {
    background: #00ff88;
    border-radius: 999px;
}
html::-webkit-scrollbar-thumb:hover {
    background: rgba(0,255,136,0.85);
}
body::-webkit-scrollbar {
    height: 10px; /* horizontal bar height */
    width: 10px;  /* vertical bar width */
}
body::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.08);
}
body::-webkit-scrollbar-thumb {
    background: #00ff88;
    border-radius: 999px;
}
body::-webkit-scrollbar-thumb:hover {
    background: rgba(0,255,136,0.85);
}

/* Floating address search box (top-right) */
.address-search {
  position: fixed;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(18, 18, 24, 0.65);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  z-index: 1000;
}

.address-input {
  width: 200px;
  max-width: 34vw;
  background: rgba(255,255,255,0.06);
  color: #eaeaea;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.address-input::placeholder { color: #b9c1c9; }
.address-input:focus {
  border-color: #00ff88;
  box-shadow: 0 0 0 3px rgba(0,255,136,0.18);
}

.address-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  width: 36px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #00ff88, #00ccff);
  color: #0b0b10;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.address-btn:hover { filter: brightness(1.08); box-shadow: 0 6px 18px rgba(0,255,136,0.25); }
.address-btn:active { transform: translateY(1px); }
.address-btn.is-loading { opacity: 0.7; cursor: progress; }

/* Address search when placed inside header */
.header .address-search {
  position: static;
  top: auto;
  right: auto;
  background: rgba(18, 18, 24, 0.45);
  padding: 6px 8px;
  box-shadow: none;
}
.header .address-input {
  width: clamp(160px, 32vw, 260px);
  max-width: 60vw;
}
@media (max-width: 768px) {
  .header .address-input { width: clamp(140px, 48vw, 220px); max-width: 60vw; }
}

/* Make search expand a bit on small screens but keep it compact in header */
@media (max-width: 768px) {
  .address-search { top: 12px; right: 8px; padding: 6px 8px; }
  .address-input { width: 56vw; max-width: 56vw; }
}

/* Address search when placed inside the How to Use info panel */
.info-content .address-search {
  position: static;           /* not fixed; flows in document */
  top: auto; right: auto;     /* clear floating coords */
  background: transparent;    /* blend with panel */
  border: none;
  padding: 0;                 /* align with controls */
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;         /* space below paragraph, above buttons */
}
.info-content .address-input {
  width: 100%;                /* full row width */
  max-width: 100%;
}
.info-content .address-btn {
  height: 36px;               /* match control button height */
  width: 40px;
}

/* Collapsible How to Use panel */
.info-content .info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
}
.info-content .info-header .collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  width: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #eaeaea;
  cursor: pointer;
}
.info-content .info-header .collapse-btn:hover {
  background: rgba(255,255,255,0.1);
}
.info-content .info-body.collapsed {
  display: none;
}

/* Screen reader only helper */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: #ffffff;
}

.loading-content i {
    font-size: 3rem;
    color: #00ff88;
    margin-bottom: 20px;
}

.loading-content p {
    font-size: 1.2rem;
    font-weight: 300;
}

/* Utility */
body.hidden, .hidden { display: none !important; }

/* Top loader equalizer bar */
.top-loader {
    position: absolute;
    top: calc(var(--header-height) + var(--subheader-height)); /* below both headers */
    left: 0;
    right: 0;
    height: 3px; /* thinner bar */
    background: linear-gradient(90deg, #00ff88 0%, #00ccff 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
}

.top-loader.active {
    transform: scaleX(1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45); /* was 0.8: let globe show through */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300; /* keep below header and now-playing bar */
    /* Remove backdrop blur so header/subheader behind are crisp */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Keep Now Playing subheader above modal overlay */
#now-playing-bar {
    position: fixed; /* act as a true second header */
    top: calc(var(--header-height) + 12px); /* small cushion below header */
    left: 0;
    right: 0;
    z-index: 500; /* above .modal */
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    min-height: var(--subheader-height); /* allow bar to grow if content wraps */
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.55);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal.hidden {
    display: none;
}

.modal-content {
    /* Glassmorphism: semi-transparent panel so globe remains visible */
    background: rgba(12, 18, 32, 0.58);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: #00ff88;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

.modal-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-loading {
    text-align: center;
    padding: 40px 20px;
}

.modal-loading i {
    font-size: 2.5rem;
    color: #00ff88;
    margin-bottom: 20px;
}

.modal-loading p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Song List */
.song-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.song-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.song-item:hover {
    background: rgba(0, 255, 136, 0.05);
    border-color: rgba(0, 255, 136, 0.3);
    transform: translateY(-2px);
}

.song-number {
    color: #00ff88;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.song-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 5px;
}

/* City Photos */
.city-photos {
    margin: 10px 0 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.photos-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.photos-header i {
    color: #00ff88;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
}

@media (max-width: 560px) {
    .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

.photo-card {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.photo-card img {
    width: 100%;
    height: 100%;
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.35s ease, filter 0.35s ease;
}

.photo-card:hover img {
    transform: scale(1.03);
    filter: brightness(1.05);
}

.photo-card a {
    position: static; /* was absolute; caused zero-height cards */
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    text-decoration: none;
}

.song-artist {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    margin-bottom: 8px;
}

.song-description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Song item actions */
.song-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

.song-youtube {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ff0000;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

/* Deezer/Apple embed inside playlist cards */
.pl-embed {
    margin-top: 6px;
    width: 100%;
    border-radius: 10px;
    overflow: hidden; /* keep rounded corners */
    background: rgba(0,0,0,0.12);
    height: 150px; /* reserve space for scaled iframe so it doesn't crop */
}
.pl-embed iframe {
    display: block;
    width: 118% !important; /* compensate width when scaling */
    height: 180px !important; /* base widget height */
    transform: scale(0.85);
    transform-origin: top left;
    border: 0;
}
.pl-embed-loading {
    padding: 10px 12px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
}

.song-youtube:hover {
    background: #e60000;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 0, 0, 0.35);
}

.song-youtube i {
    font-size: 1rem;
}

/* Info Panel */
.info-panel {
    position: absolute;
    bottom: 300px; /* move up a bit */
    left: 20px;
    max-width: 420px;
    padding: 18px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.75); /* more opaque */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 180;
    transform: scale(0.75);
    transform-origin: bottom left; /* scale proportionally from its anchored corner */
}

.info-content h3 {
    color: #00ff88;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.info-content h3 i {
    margin-right: 8px;
}

.info-content p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
}


/* Controls wrapper: two buttons side-by-side on row 1; controls bar below spanning both columns */
.controls {
    display: grid;
    grid-template-columns: 1fr 1fr; /* two equal columns for buttons */
    column-gap: 8px;
    row-gap: 8px;
    align-items: start;
}

/* Place each button in the left column, stack top to bottom */
/* First two buttons occupy row 1, columns 1 and 2 */
.controls > .control-btn {
    width: 100%;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.1;
}
.controls > .control-btn:first-of-type {
    grid-column: 1;
    grid-row: 1;
}
.controls > .control-btn:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;
}

/* Move the controls bar to the right column and remove its old left margin in this grid context */
/* Controls bar sits below the two buttons, spanning full width */
.controls .controls-bar {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-left: 0;
}

/* Controls layout (right side): dropdown on row 1 (full width); checkboxes on row 2; slider on row 3 */
.controls-bar {
    display: grid;
    grid-template-columns: 1fr 1fr; /* two columns for the checkbox row */
    row-gap: 4px;   /* tighter vertical spacing */
    column-gap: 8px; /* tighter horizontal spacing */
    align-items: center;
    margin-left: 0; /* no extra offset */
}

/* Basemap combobox spans full width on row 1 */
.controls-bar .basemap-label {
    grid-column: 1 / -1;
    grid-row: 1;
}

/* Place the two checkboxes on row 2, side by side (robust via nth-of-type) */
.controls-bar > label.checkbox-inline:nth-of-type(2) {
    grid-column: 1;
    grid-row: 2;
}
.controls-bar > label.checkbox-inline:nth-of-type(3) {
    grid-column: 2;
    grid-row: 2;
}

/* Range slider spans full width on row 3 */
.controls-bar .range-inline {
    grid-column: 1 / -1;
    grid-row: 3;
}

.basemap-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
}

/* Themed dropdown */
.basemap-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.35);
    color: #fff;
    padding: 8px 34px 8px 12px; /* room for chevron */
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2300ff88' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.basemap-select:hover {
    background: rgba(0, 255, 136, 0.06);
    border-color: rgba(0, 255, 136, 0.55);
}

.basemap-select:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.2);
}

.checkbox-inline,
.range-inline {
    display: flex;
    align-items: center;
    gap: 4px; /* tighter checkbox spacing */
}

/* Minor alignment polish for checkbox + label text */
.checkbox-inline input[type="checkbox"] {
    transform: translateY(1px);
}
.checkbox-inline span {
    line-height: 1;
}

.control-btn {
    background: linear-gradient(45deg, #00ff88, #00ccff);
    border: none;
    color: #000;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.3);
}

.control-btn i {
    margin-right: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .header {
        padding: 15px;
    }
    
    .info-panel {
        bottom: 120px; /* extra room above mobile playlist */
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
}

/* Custom scrollbar */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.5);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.7);
}

/* Controls theming (green) */
.info-panel label span {
    color: rgba(255, 255, 255, 0.9);
}

/* Green checkboxes (Capitals / Major Cities) */
.info-panel input[type="checkbox"] {
    accent-color: #00ff88; /* modern browsers */
}

/* Green range slider for population threshold */
.info-panel input[type="range"] {
    width: 180px;
    height: 6px;
    background: transparent;
    accent-color: #00ff88; /* fallback coloring */
}

/* WebKit */
.info-panel input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #00ff88;
    border-radius: 999px;
}
.info-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -5px; /* center on 6px track */
    background: #0b0b0b;
    border: 2px solid #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(0,255,136,0.15);
}

/* Firefox */
.info-panel input[type="range"]::-moz-range-track {
    height: 6px;
    background: #00ff88;
    border-radius: 999px;
}
.info-panel input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #0b0b0b;
    border: 2px solid #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(0,255,136,0.15);
}

/* Slider value text */
#pop-threshold-value {
    color: #00ff88;
    font-weight: 700;
}

/* Playlist Panel */
.playlist-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 220; /* above .info-panel (180) so playlist overlays the How to Use panel */
    background: rgba(10, 15, 25, 0.85);
    border-top: 1px solid rgba(0, 255, 136, 0.25);
    backdrop-filter: blur(10px);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
    transition: transform 0.35s ease;
}

.playlist-panel.collapsed {
    transform: translateY(calc(100% - 48px));
}

.playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
}

.playlist-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    color: #00ff88;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.playlist-toggle:hover {
    background: rgba(0, 255, 136, 0.1);
}

.playlist-count {
    color: rgba(255,255,255,0.8);
    font-weight: 600;
}

.playlist-controls .btn-icon {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.playlist-controls .btn-icon:hover {
    border-color: rgba(255, 71, 87, 0.5);
    color: #ff4757;
    background: rgba(255, 71, 87, 0.08);
}

.playlist-body {
    padding: 8px 16px 16px 16px;
    max-height: 40vh;
    /* Turn into horizontal scroller */
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    min-height: 110px; /* accommodate taller multi-line cards */
    /* Firefox scrollbar colors */
    scrollbar-color: #00ff88 rgba(255,255,255,0.08);
    scrollbar-width: thin;
}

/* WebKit scrollbars for playlist scroller */
.playlist-body::-webkit-scrollbar {
    height: 10px; /* horizontal bar height */
}
.playlist-body::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
}
.playlist-body::-webkit-scrollbar-thumb {
    background: #00ff88;
    border-radius: 999px;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.25) inset;
}
.playlist-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0,255,136,0.85);
}

.playlist-list {
    display: flex;
    flex-direction: row; /* horizontal cards */
    gap: 14px;
    scroll-snap-type: x mandatory;
    align-items: stretch;
    min-height: 100px; /* ensure some height for small lists */
}

/* Favorite Stations: compact two-row grid with vertical header */
#fav-header {
    writing-mode: vertical-rl; /* make header sideways */
    text-orientation: mixed;
    transform: rotate(180deg); /* read bottom-to-top */
    font-weight: 800;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0.4px;
    margin: 0 2px; /* tighter since it is vertical */
}

#fav-grid {
    display: grid !important;
    grid-auto-flow: column;            /* fill rows first, then new column */
    grid-template-rows: repeat(3, 60px) !important; /* three fixed tracks */
    grid-auto-rows: 60px !important;              /* implicit tracks match */
    grid-auto-columns: 112px;         /* narrower columns */
    gap: 16px;                        /* clearer vertical separation */
    align-items: stretch;             /* items stretch to row height */
    align-content: start;
}

@media (max-width: 680px) {
  /* keep rows fixed but shorter on mobile to avoid overlap */
  #fav-grid { grid-auto-columns: 96px; grid-template-rows: repeat(3, 100px) !important; grid-auto-rows: 80px !important; gap: 12px; }
}

.playlist-item {
    position: relative;
    display: flex;
    flex-direction: column; /* stack info, then embed */
    align-items: stretch;
    gap: 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 8px 10px 36px 10px; /* extra bottom space for actions */
    min-width: 300px;
    max-width: 440px;
    scroll-snap-align: start;
}

/* Optional album cover slot (hidden until populated) */
.pl-cover {
    width: 0;
    flex: 0 0 auto;
    overflow: hidden;
}
.playlist-item.has-cover .pl-cover {
    width: 56px;
}
.pl-cover img {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.pl-info {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0; /* allow text to wrap instead of overflow */
}

.pl-title {
    font-weight: 700;
    color: #ffffff;
    font-size: 0.9rem; /* more compact */
    line-height: 1.15;
    white-space: normal;
    word-break: break-word;
}

.pl-artist {
    font-size: 0.78rem;
    color: #00ff88; /* theme green */
    line-height: 1.1;
    white-space: normal;
    word-break: break-word;
}

.pl-actions {
    position: absolute;
    right: 10px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
}
.pl-actions i { font-size: 14px; line-height: 1; }

/* Duration appended to artist line */
.pl-duration {
    color: rgba(255,255,255,0.65);
    font-size: 0.8rem;
}

/* Deezer button (use music icon with Deezer teal if brand icon not available) */
.pl-deezer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #30b3f2; /* Deezer-ish */
    color: #0b0b0b;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}
.pl-deezer:hover {
    background: #25a4e3;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(48, 179, 242, 0.35);
}

.pl-youtube {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #ff0000;
    color: #fff;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.pl-youtube:hover {    
    background: #e60000;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 0, 0, 0.35);
}

.pl-remove {
    background: none;
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.85);
    width: 26px;
    height: 26px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pl-remove:hover {
    color: #ff4757;
    border-color: rgba(255, 71, 87, 0.5);
    background: rgba(255, 71, 87, 0.08);
}

/* Loved Stations strip */
#loved-cards-wrap {
  overflow: hidden;
}

#loved-cards {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 4px;
  scrollbar-width: thin;
  cursor: grab; /* drag to scroll */
}
#loved-cards.is-dragging { cursor: grabbing; }

.loved-card {
  /* slightly larger to show more metadata; ~5 visible in 60vw */
  flex: 0 0 calc((60vw - 4 * 8px) / 5);
  max-width: 220px;
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  backdrop-filter: blur(2px);
}

.loved-card-name {
  flex: 1 1 auto;
  overflow: hidden;
  white-space: normal; /* allow wrapping */
  display: -webkit-box;           /* multiline clamp */
  -webkit-line-clamp: 2;          /* show up to 2 lines */
  -webkit-box-orient: vertical;
  line-clamp: 2;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 1.25;
  max-height: calc(1.25em * 2);
}

.loved-card-date { display: none !important; }

.loved-card-play,
.loved-card-remove {
  flex: 0 0 auto;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.25;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  cursor: pointer;
}

.loved-card-play:hover { background: rgba(0, 110, 255, 0.3); }
.loved-card-remove:hover { background: rgba(255, 0, 0, 0.3); }

/* Make it behave well on very small screens */
@media (max-width: 600px) {
  .loved-card { flex-basis: calc((60vw - 3 * 8px) / 4); }
}

/* Love button in modal */
.song-love {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 77, 109, 0.15);
    color: #ff4d6d;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    border: 1px solid rgba(255, 77, 109, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.song-love:hover {
    background: rgba(255, 77, 109, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 77, 109, 0.2);
}

@media (max-width: 768px) {
    .playlist-panel.collapsed {
        transform: translateY(calc(100% - 44px));
    }
}
