/* ============ ENCORE · gen-z dark aesthetic ============ */
:root {
  --bg: #0a0a0f;
  --ink: #f4f4f7;
  --muted: #8b8b9a;
  --card: rgba(22, 22, 30, 0.72);
  --stroke: rgba(255, 255, 255, 0.08);
  --grad: linear-gradient(135deg, #ff2e9a 0%, #8a4bff 50%, #2ec5ff 100%);
  --grad-soft: linear-gradient(135deg, rgba(255,46,154,.18), rgba(46,197,255,.18));
  --accent: #ff2e9a;
  --accent2: #2ec5ff;
  --radius: 20px;
  --blur: blur(18px);
  font-family: "Space Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- intro splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 5000;
  background: #05050a; overflow: hidden;
  display: grid; place-items: center;
  transition: opacity .8s ease;
}
.splash.gone { opacity: 0; pointer-events: none; }
.splash-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: opacity 1s ease, transform 8s ease;
  transform: scale(1.05);
}
.splash-bg.cassette { opacity: .55; }
.splash-bg.stage { opacity: 0; }
.splash[data-phase="stage"] .splash-bg.cassette { opacity: 0; }
.splash[data-phase="stage"] .splash-bg.stage { opacity: .6; transform: scale(1.12); }
.splash-grain {
  position: absolute; inset: 0; opacity: .5; mix-blend-mode: overlay;
  background-image: var(--noise); background-size: 180px;
  animation: grainshift .6s steps(2) infinite;
}
.splash-content {
  position: relative; z-index: 2; text-align: center;
  background: radial-gradient(ellipse at center, rgba(5,5,10,.55), transparent 70%);
  padding: 60px;
}
.splash-spark { position: absolute; color: #fff; opacity: .9; font-size: 22px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: twinkle 2.2s ease-in-out infinite; }
.splash-spark.s1 { top: 6%; left: 12%; }
.splash-spark.s2 { bottom: 12%; right: 14%; font-size: 30px; animation-delay: .7s; }
.splash-spark.s3 { top: 20%; right: 22%; font-size: 16px; animation-delay: 1.3s; }
@keyframes twinkle { 0%,100% { transform: scale(.7); opacity: .4; } 50% { transform: scale(1.1); opacity: 1; } }
.splash-kicker {
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent2);
  margin-bottom: 10px; animation: blink 1.4s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .35; } }
.splash-word {
  font-family: "Archivo Black", sans-serif; font-size: clamp(56px, 14vw, 140px);
  letter-spacing: 4px; line-height: .9;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255,46,154,.4));
}
.splash-tag { color: var(--ink); opacity: .85; margin-top: 8px; font-size: clamp(14px,2.6vw,18px); letter-spacing: 1px; }
.splash-play {
  margin-top: 28px; padding: 15px 34px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--grad); color: #fff; font: inherit; font-weight: 700; font-size: 17px;
  box-shadow: 0 10px 40px rgba(255,46,154,.5); transition: transform .15s;
}
.splash-play:hover { transform: scale(1.06); }
.splash-skip { margin-top: 14px; font-size: 12px; color: var(--muted); cursor: pointer; }

/* ---------- global grain ---------- */
:root { --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.grain-overlay {
  position: fixed; inset: 0; z-index: 1500; pointer-events: none;
  background-image: var(--noise); background-size: 160px; opacity: .045;
  mix-blend-mode: overlay;
}
@keyframes grainshift { to { transform: translate(8px, -6px); } }

/* ---------- map ---------- */
#map { position: fixed; inset: 0; z-index: 1; background: #0a0a0f; }
.leaflet-container { background: #0a0a0f; }
.leaflet-control-attribution { background: rgba(0,0,0,.4) !important; color: #555 !important; font-size: 9px; }
.leaflet-control-attribution a { color: #777 !important; }
.leaflet-control-zoom { display: none; }
.leaflet-tooltip.sp-tip {
  background: #0d160f; color: #eafff1; border: 1px solid rgba(29,185,84,.5);
  border-radius: 8px; font-family: inherit; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.leaflet-tooltip.sp-tip::before { border-top-color: rgba(29,185,84,.5); }

/* ---------- topbar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(10,10,15,.85) 0%, rgba(10,10,15,0) 100%);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  font-size: 18px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.brand-word { font-family: "Archivo Black", sans-serif; letter-spacing: 2px; font-size: 18px; }

.search { flex: 0 1 320px; }
.search input {
  width: 100%; padding: 11px 16px; border-radius: 999px;
  background: var(--card); backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); color: var(--ink); font: inherit; font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,46,154,.15); }

.filters { display: flex; gap: 8px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; padding: 8px 14px; border-radius: 999px;
  background: var(--card); backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer; transition: all .18s;
}
.chip:hover { color: var(--ink); border-color: rgba(255,255,255,.2); }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; font-weight: 600; }

.profile-btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad); border: none; color: #fff; font-size: 18px; cursor: pointer;
  box-shadow: 0 4px 20px rgba(255,46,154,.4);
}

/* ---------- spotify button ---------- */
:root { --spotify: #1db954; }
.spotify-btn {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0; white-space: nowrap;
  padding: 9px 16px; border-radius: 999px; border: 1px solid rgba(29,185,84,.5);
  background: rgba(29,185,84,.12); color: #51e07a; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .18s;
}
.spotify-btn:hover { background: rgba(29,185,84,.22); }
.spotify-btn.on { background: var(--spotify); color: #04210f; border-color: transparent; }
.sp-logo { color: var(--spotify); font-size: 15px; }
.spotify-btn.on .sp-logo { color: #04210f; }

/* ---------- feed rail ---------- */
.feed {
  position: fixed; top: 76px; left: 20px; bottom: 20px; z-index: 900;
  width: 300px; display: flex; flex-direction: column;
  background: var(--card); backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); border-radius: var(--radius);
  overflow: hidden;
}
.feed-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px;
}
.feed-head h2 { font-size: 14px; font-weight: 600; text-transform: lowercase; letter-spacing: .5px; }
.feed-count {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--grad-soft); border: 1px solid var(--stroke); color: var(--accent2);
}
.feed-list { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.feed-list::-webkit-scrollbar { width: 6px; }
.feed-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 999px; }

.card {
  position: relative; border-radius: 16px; overflow: hidden; cursor: pointer; flex-shrink: 0;
  border: 1px solid var(--stroke); background: #14141c;
  transition: transform .18s, border-color .18s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-thumb { aspect-ratio: 16/10; width: 100%; object-fit: cover; display: block; background: #1c1c28; }
.card-body { padding: 10px 12px 12px; }
.card-artist { font-weight: 600; font-size: 15px; }
.card-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.card-genre {
  font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  padding: 3px 8px; border-radius: 999px; background: var(--grad-soft); color: var(--accent2);
}
.card-likes { margin-left: auto; font-size: 12px; color: var(--muted); }
.card-play {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.55); backdrop-filter: blur(8px); display: grid; place-items: center;
  font-size: 11px; color: #fff;
}

/* ---------- custom map pin ---------- */
.pin {
  position: relative; width: 40px; height: 40px;
}
.pin-dot {
  position: absolute; inset: 8px; border-radius: 50%;
  background: var(--grad); border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.5); cursor: pointer; z-index: 2;
}
.pin-ring {
  position: absolute; inset: 8px; border-radius: 50%;
  border: 2px solid var(--accent); animation: pulse 2.4s ease-out infinite; z-index: 1;
}
@keyframes pulse {
  0% { transform: scale(.7); opacity: .8; }
  100% { transform: scale(2.6); opacity: 0; }
}
.pin-thumb {
  position: absolute; top: 6px; left: 6px; width: 28px; height: 28px;
  border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; z-index: 3; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.6);
}

/* ---------- FAB ---------- */
.fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 950;
  display: flex; align-items: center; gap: 8px;
  padding: 14px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--grad); color: #fff; font: inherit; font-weight: 600; font-size: 15px;
  box-shadow: 0 8px 30px rgba(255,46,154,.45); transition: transform .15s;
}
.fab:hover { transform: scale(1.04); }
.fab span { font-size: 20px; line-height: 0; }

/* ---------- modal ---------- */
.modal-scrim, .sheet-scrim {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(5,5,9,.7); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal-card {
  width: min(720px, 100%); max-height: 90vh; overflow: hidden;
  background: #101018; border: 1px solid var(--stroke); border-radius: 24px;
  position: relative; display: flex; flex-direction: column;
  animation: pop .25s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,.55); color: #fff; font-size: 14px; backdrop-filter: blur(8px);
}
.modal-video { aspect-ratio: 16/9; width: 100%; background: #000; }
.modal-video iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-fallback {
  width: 100%; height: 100%; border: 0; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(ellipse at center, #1a1a26, #0a0a0f),
              linear-gradient(135deg, rgba(255,46,154,.25), rgba(46,197,255,.25));
  background-blend-mode: overlay; font: inherit;
}
.video-fallback .vf-play {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad); font-size: 24px; margin-bottom: 6px;
  box-shadow: 0 8px 30px rgba(255,46,154,.5);
}
.video-fallback .vf-main { font-weight: 600; font-size: 17px; }
.video-fallback small { color: var(--muted); font-size: 12px; }
.modal-body { padding: 20px 24px 24px; overflow-y: auto; }
.modal-tags { display: flex; gap: 6px; margin-bottom: 8px; }
.modal-body h2 { font-size: 26px; }
.modal-meta { color: var(--muted); margin-top: 4px; font-size: 14px; }
.modal-story {
  margin-top: 16px; padding: 14px 16px; border-left: 3px solid var(--accent);
  background: var(--grad-soft); border-radius: 0 12px 12px 0; font-size: 15px; line-height: 1.5;
}
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

.btn-ghost, .btn-save {
  padding: 11px 18px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer;
  border: 1px solid var(--stroke); background: rgba(255,255,255,.04); color: var(--ink);
  transition: all .15s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,.25); }
.btn-save { background: var(--grad); border: none; color: #fff; font-weight: 600; margin-left: auto; }
.btn-save:hover { filter: brightness(1.1); }

/* ---------- add sheet ---------- */
.sheet-scrim { align-items: flex-end; }
.sheet-card {
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: #101018; border: 1px solid var(--stroke);
  border-radius: 24px 24px 0 0; padding: 12px 24px 24px;
  animation: slideup .3s cubic-bezier(.2,.9,.3,1);
}
@media (min-width: 600px) { .sheet-scrim { align-items: center; } .sheet-card { border-radius: 24px; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }
.sheet-grab { width: 40px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.2); margin: 6px auto 14px; }
.sheet-card h2 { font-size: 22px; }
.sheet-sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.sheet-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.sheet-row { display: flex; gap: 12px; }
.sheet-row label { flex: 1; }
.sheet-card input, .sheet-card select, .sheet-card textarea {
  width: 100%; margin-top: 5px; padding: 10px 12px; border-radius: 12px;
  background: #181820; border: 1px solid var(--stroke); color: var(--ink); font: inherit; font-size: 14px;
  resize: vertical;
}
.sheet-card input:focus, .sheet-card select:focus, .sheet-card textarea:focus {
  outline: none; border-color: var(--accent);
}
.sheet-hint { font-size: 12px; color: var(--accent2); margin: 4px 0 16px; }
.sheet-hint.set { color: #43e07a; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn-ghost { margin-right: auto; }

/* ---------- spotify connect modal ---------- */
.sp-card {
  width: min(440px, 100%); position: relative; text-align: center;
  background: #0d160f; border: 1px solid rgba(29,185,84,.25); border-radius: 24px;
  padding: 40px 30px 26px; animation: pop .25s cubic-bezier(.2,.9,.3,1.3);
}
.sp-logo-big {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--spotify); color: #04210f; font-size: 34px; display: grid; place-items: center;
  box-shadow: 0 8px 30px rgba(29,185,84,.5);
}
.sp-card h2 { font-size: 24px; }
.sp-card-sub { color: var(--muted); font-size: 14px; margin: 10px 0 22px; line-height: 1.5; }
.sp-connect {
  width: 100%; padding: 14px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--spotify); color: #04210f; font: inherit; font-weight: 700; font-size: 16px;
  transition: transform .15s;
}
.sp-connect:hover { transform: scale(1.03); }
.sp-demo-note { color: #5a6b60; font-size: 11px; margin-top: 16px; line-height: 1.4; }

/* ---------- sound map panel ---------- */
.soundpanel {
  position: fixed; top: 76px; right: 20px; bottom: 96px; z-index: 940;
  width: 320px; display: flex; flex-direction: column;
  background: rgba(10,18,12,.82); backdrop-filter: var(--blur);
  border: 1px solid rgba(29,185,84,.3); border-radius: var(--radius); overflow: hidden;
}
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 18px 8px; }
.sp-head h2 { font-size: 16px; display: flex; align-items: center; gap: 7px; }
.sp-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sp-close { background: none; border: none; color: var(--muted); font-size: 15px; cursor: pointer; }
.sp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 14px 12px; }
.sp-stat { background: rgba(29,185,84,.1); border: 1px solid rgba(29,185,84,.2); border-radius: 12px; padding: 10px 12px; }
.sp-stat .n { font-size: 20px; font-weight: 700; color: #51e07a; }
.sp-stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sp-list { flex: 1; overflow-y: auto; padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; }
.sp-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.03); cursor: pointer; transition: background .15s; }
.sp-row:hover { background: rgba(29,185,84,.12); }
.sp-rank { font-size: 13px; color: var(--muted); width: 18px; }
.sp-info { flex: 1; min-width: 0; }
.sp-info .a { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-info .o { font-size: 11px; color: var(--muted); }
.sp-bar { height: 5px; border-radius: 999px; background: var(--spotify); flex-shrink: 0; }

/* ---------- spotify origin pins ---------- */
.sp-pin { position: relative; display: grid; place-items: center; }
.sp-pin .glow {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(29,185,84,.55), transparent 70%);
  animation: pulse 2.6s ease-out infinite;
}
.sp-pin .core {
  width: 14px; height: 14px; border-radius: 50%; background: var(--spotify);
  border: 2px solid #eafff1; box-shadow: 0 2px 10px rgba(0,0,0,.5); z-index: 2;
}
.sp-pin.big .core { width: 20px; height: 20px; }

body.sound-on .feed { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 680px) {
  .feed { display: none; }
  .filters { display: none; }
  .soundpanel { left: 12px; right: 12px; width: auto; }
  .spotify-btn { padding: 9px; font-size: 0; gap: 0; }
  .spotify-btn .sp-logo { font-size: 18px; }
  .search { flex: 1; }
}
