/* Sticker look: ink outlines, hard offset shadows, pills, heavy Bricolage headlines. Neutral palette:
   Ink #1b1a17, Bone #f1eee8 (background), Sand #e6e0d3 (highlight), Stone #8a857b (quiet text), Paper #fff. */
:root {
  --ink: #1b1a17;
  --bg: #f1eee8;
  --panel: #ffffff;
  --panel-2: #f1eee8;
  --hl: #e6e0d3;
  --line: var(--ink);
  --text: var(--ink);
  --muted: #6e6a62;
  --stone: #8a857b;
  --accent: var(--ink);
  --accent-ink: #ffffff;
  --grad: var(--ink);
  --rainbow: conic-gradient(#1b1a17, #57534e, #a8a29e, #57534e, #1b1a17);
  --danger: #b4410f;
  --ok: #22a06b;
  --edge: 2px solid var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --shadow: 3px 3px 0 var(--ink);
  --shadow-lg: 5px 5px 0 var(--ink);
  --radius: 18px;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
img { display: block; }

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.045em;
  color: var(--text);
  text-decoration: none;
}
.brand.big { font-size: 40px; gap: 10px; }
.disc {
  width: 0.9em;
  height: 0.9em;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, transparent 19%), var(--rainbow);
  animation: spin 3.5s linear infinite;
  animation-play-state: paused;
}
body.is-playing .disc, #gate .disc { animation-play-state: running; }
.domain { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: -6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons and inputs ---------- */
.btn {
  border: var(--edge);
  background: var(--panel);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--ink); color: #fff; box-shadow: 3px 3px 0 var(--stone); }
.btn.primary:hover { background: #33312c; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--text);
  transition: background 0.15s, transform 0.1s, color 0.15s;
  flex: none;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn.play { width: 56px; height: 56px; background: var(--ink); color: #fff; box-shadow: 3px 3px 0 var(--stone); }
.icon-btn.play:hover { background: #33312c; }
.icon-btn.play svg { width: 26px; height: 26px; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 18px; height: 18px; }

input[type='text'], input[type='search'], input:not([type]) {
  background: #fff;
  border: var(--edge);
  border-radius: 12px;
  padding: 11px 14px;
  outline: none;
  transition: box-shadow 0.15s, background 0.15s;
}
input:focus { box-shadow: var(--shadow-sm); }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--hl) var(--fill, 0%));
  outline: none;
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
}
input[type='range']::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--c, var(--accent));
  flex: none;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(46, 194, 126, 0.5);
  animation: live 1.8s ease-out infinite;
  vertical-align: 1px;
}
@keyframes live { 70%, 100% { box-shadow: 0 0 0 7px rgba(46, 194, 126, 0); } }

/* ---------- Map ---------- */
#map { position: fixed; inset: 0; z-index: 0; background: #f3f1ed; }
.maplibregl-map { font-family: var(--body); }
.maplibregl-ctrl-bottom-right { margin-bottom: 8px; }
.maplibregl-ctrl-group { border-radius: 14px !important; border: var(--edge); box-shadow: var(--shadow) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 40px; height: 40px; }
.maplibregl-ctrl-attrib { font-size: 10px; background: rgba(255, 255, 255, 0.75) !important; }

/* The 3D map (map-google.js): HTML markers and block names placed over the canvas every frame. */
.map3d-labels, .map3d-markers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.map3d-marker { position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; touch-action: none; }
.map3d-labels .label {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%);
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  background: #fff; border: 1.5px solid var(--ink);
  border-radius: 999px; padding: 3px 10px 3px 7px; font-size: 11.5px; font-weight: 700; color: var(--text);
  box-shadow: var(--shadow-sm); will-change: transform;
}
.map3d-labels .label i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #a8a29e); box-shadow: 0 0 0 1.5px var(--ink); }
.map3d-loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; color: var(--muted); pointer-events: none; }
.map3d-credits {
  position: absolute; left: 10px; bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 1;
  font-size: 10.5px; color: var(--muted); background: rgba(255, 255, 255, 0.75); padding: 2px 8px; border-radius: 6px; pointer-events: none;
}
.map3d-credits b { color: var(--text); }

.mapbar {
  position: fixed;
  z-index: 500;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.mapbar > * { pointer-events: auto; }
.mapbar .brand, .live-pill, .me-chip {
  background: #fff;
  border: var(--edge);
  box-shadow: var(--shadow);
  border-radius: 999px;
}
.mapbar .brand { padding: 8px 15px 8px 12px; }
.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
}
.live-pill .live-dot { background: #c8c4bc; animation: none; }
.live-pill.ok .live-dot { background: var(--ok); animation: live 1.8s ease-out infinite; }
.me-chip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 4px;
  font-size: 13px;
  font-weight: 700;
}
.me-chip .me-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hot {
  position: fixed;
  z-index: 500;
  top: 66px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hot-head {
  flex: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--hl);
  border: var(--edge);
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.hot-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px 10px;
  margin-bottom: -6px;
  pointer-events: auto;
}
.hot-list::-webkit-scrollbar { display: none; }
.hot-chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  border: var(--edge);
  background: #fff;
  border-radius: 999px;
  padding: 3px 5px 3px 3px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.12s, box-shadow 0.12s;
}
.hot-chip:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.hot-emoji { width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2.5px var(--c); display: grid; place-items: center; font-size: 14px; }
.hot-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-count { background: var(--hl); color: var(--text); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hot-chip.mine { background: var(--text); color: #fff; }
.hot-chip.mine .hot-count { background: rgba(255, 255, 255, 0.18); color: #fff; }
.hot-empty { background: #fff; border: var(--edge); border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; color: var(--muted); box-shadow: var(--shadow); white-space: nowrap; }

.map-tools {
  position: fixed;
  z-index: 500;
  right: 12px;
  bottom: 204px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.round-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: var(--edge);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
}
.round-btn:hover { background: var(--hl); }
.round-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.round-btn svg { width: 20px; height: 20px; fill: currentColor; }

.fab {
  position: fixed;
  z-index: 600;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  border: var(--edge);
  border-radius: 999px;
  padding: 11px 24px 11px 11px;
  background: var(--hl);
  color: var(--ink);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.12s, box-shadow 0.12s, bottom 0.2s;
}
.fab:hover { transform: translateX(-50%) translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.fab:active { transform: translateX(-50%) translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.fab-plus { width: 30px; height: 30px; display: grid; place-items: center; background: var(--ink); color: #fff; border-radius: 50%; font-size: 22px; line-height: 1; }
body:has(#mini:not(.hidden)) .fab { bottom: calc(100px + env(safe-area-inset-bottom)); }
body:has(#mini:not(.hidden)) .map-tools { bottom: 204px; }
body.creating .fab, body:has(#peek:not(.hidden)) .fab { display: none; }
body.creating #locateBtn, body.creating #campusBtn { display: none; }

/* Pins: white stickers with the playlist's color as a ring inside an ink outline. Fuller playlists are bigger; the top three pulse. */
.pin-wrap { cursor: pointer; }
.pin { position: relative; width: var(--s); height: var(--s); transition: transform 0.15s; }
.pin:hover { transform: scale(1.06); }
.pin-body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--c);
  box-shadow: 0 0 0 2px var(--ink), 3px 3px 0 2px var(--ink);
  display: grid;
  place-items: center;
}
.pin-emoji { font-size: calc(var(--s) * 0.44); line-height: 1; }
.pin-halo {
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 55%, transparent) 0 35%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.pin.live .pin-halo { animation: halo 2.6s ease-out infinite; }
.pin.hot .pin-halo { inset: -70%; animation: halo 1.8s ease-out infinite; }
@keyframes halo { 0% { opacity: 0.7; transform: scale(0.45); } 100% { opacity: 0; transform: scale(1); } }
.pin.hot .pin-body { border-width: 4px; box-shadow: 0 0 0 2px var(--ink), 4px 4px 0 2px var(--ink); }
.pin-count {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  border: 2px solid #fff;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pin.hot .pin-count { font-size: 12.5px; height: 26px; min-width: 26px; }
.pin-label {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 170px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--ink);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 5px;
}
.pin.hot .pin-label { font-size: 13px; font-weight: 700; padding: 4px 12px; }
.pin.mine .pin-label { background: var(--text); color: #fff; }
.pin.quiet .pin-body { border-width: 2.5px; border-color: color-mix(in srgb, var(--c) 60%, white); box-shadow: 0 0 0 1.5px var(--ink), 2px 2px 0 1.5px var(--ink); }
.pin.quiet .pin-label { font-size: 11px; font-weight: 500; color: var(--muted); }
.pin.new .pin-body { border-style: dashed; animation: bob 1.4s ease-in-out infinite; }
.pin.new .pin-halo { opacity: 0.5; animation: halo 1.8s ease-out infinite; }
.pin-wrap.placing { cursor: grab; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.eq { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 10px; flex: none; }
.eq b { width: 2.5px; background: var(--c); border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.pin.mine .eq b { background: #fff; }
.eq b:nth-child(2) { animation-delay: -0.3s; }
.eq b:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 10px; } }

/* You on the map: your bot */
.me-pin { position: relative; width: 44px; height: 52px; }
.me-pulse {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 46px;
  height: 16px;
  margin-left: -23px;
  border-radius: 50%;
  background: rgba(27, 26, 23, 0.22);
  animation: me-pulse 1.8s ease-out infinite;
}
@keyframes me-pulse { from { transform: scale(0.5); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.me-pin .bot { width: 44px; }
.me-tag {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  box-shadow: 1.5px 1.5px 0 var(--stone);
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Peek card ---------- */
.peek {
  position: fixed;
  z-index: 700;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(400px, calc(100% - 24px));
  background: #fff;
  border-radius: 22px;
  border: var(--edge);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise 0.22s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 16px); } }
.peek-head { display: flex; align-items: center; gap: 12px; }
.peek-emoji { width: 48px; height: 48px; border-radius: 15px; background: #fff; border: var(--edge); box-shadow: inset 0 0 0 3px var(--c); display: grid; place-items: center; font-size: 25px; flex: none; }
.peek-meta { flex: 1; min-width: 0; }
.peek-name { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-sub { font-size: 13px; color: var(--muted); }
.peek-now { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; background: var(--panel-2); border: 1.5px solid var(--ink); }
.peek-now img { width: 72px; height: 42px; object-fit: cover; border-radius: 8px; border: 1.5px solid var(--ink); flex: none; }
.peek-now-meta { min-width: 0; }
.peek-now-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.peek-now-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-now-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-now.empty-now { font-size: 13px; color: var(--muted); padding: 12px; }
.peek-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.peek-stats b { color: var(--text); font-size: 15px; }

/* ---------- Mini player ---------- */
.mini {
  position: fixed;
  z-index: 650;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 6px 6px;
  background: #fff;
  border-radius: 20px;
  border: var(--edge);
  box-shadow: var(--shadow-lg);
}
.mini-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; text-align: left; }
.mini-emoji { width: 42px; height: 42px; border-radius: 13px; background: #fff; border: var(--edge); box-shadow: inset 0 0 0 3px var(--c); display: grid; place-items: center; font-size: 21px; flex: none; }
.mini-meta { min-width: 0; display: flex; flex-direction: column; }
.mini-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-now { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.is-playing .mini-emoji { animation: bob 1.2s ease-in-out infinite; }
.mini.stuck #miniPlay { background: var(--grad); color: #fff; animation: pulse 1.6s ease-in-out infinite; }

/* ---------- Create sheet ---------- */
.sheet {
  position: fixed;
  z-index: 800;
  top: 112px;
  left: 12px;
  width: min(380px, calc(100% - 24px));
  max-height: calc(100% - 128px);
  overflow-y: auto;
  background: #fff;
  border-radius: 22px;
  border: var(--edge);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fade-in 0.2s ease-out;
}
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 800; letter-spacing: -0.04em; }
.place-note { font-size: 13px; font-weight: 600; padding: 10px 12px; border-radius: 12px; background: var(--hl); border: 1.5px solid var(--ink); color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.field em { text-transform: none; letter-spacing: 0; color: var(--muted); }
.field em { font-style: normal; font-weight: 400; }
.choice-row { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { border: 2px solid transparent; transition: transform 0.1s; }
.choice:hover { transform: scale(1.1); }
.choice.emoji { width: 38px; height: 38px; border-radius: 12px; background: var(--panel-2); font-size: 20px; padding: 0; border-color: var(--panel-2); }
.choice.emoji.sel { border-color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.choice.swatch { width: 32px; height: 32px; border-radius: 50%; background: var(--c); padding: 0; border-color: var(--ink); }
.choice.swatch.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }

/* ---------- Playlist panel ---------- */
.room {
  position: fixed;
  z-index: 900;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: var(--edge);
  transition: transform 0.28s cubic-bezier(0.3, 0.7, 0.2, 1);
}
/* Closed and minimized panels slide away but stay rendered, so the YouTube player keeps playing. */
.room.closed, .room.min { transform: translateX(105%); pointer-events: none; box-shadow: none; }
.room-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: #fff;
  border-bottom: var(--edge);
}
.room-emoji { width: 46px; height: 46px; border-radius: 15px; background: #fff; border: var(--edge); box-shadow: inset 0 0 0 3px var(--c, var(--text)); display: grid; place-items: center; font-size: 24px; flex: none; }
body.is-playing .room-emoji { animation: bob 1.2s ease-in-out infinite; }
.room-meta { flex: 1; min-width: 0; }
.room-name { font-family: var(--display); font-size: 23px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-scroll { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.stage { background: var(--panel); border-radius: var(--radius); overflow: hidden; border: var(--edge); box-shadow: var(--shadow); flex: none; }
.player-wrap { position: relative; aspect-ratio: 16 / 9; background: var(--ink); }
.player-wrap iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
  padding: 0 20px;
  background: var(--panel);
}
.empty p { margin: 0 0 30px; font-family: var(--display); font-size: 19px; font-weight: 800; }
.empty .muted { font-family: var(--body); font-size: 13px; font-weight: 400; }
.vinyl {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 9%, transparent 10%),
    radial-gradient(circle, transparent 0 26%, #1b1a17 27% 29%, transparent 30%),
    var(--rainbow);
  border: var(--edge);
  animation: spin 5s linear infinite;
}
.player-wrap::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(transparent, var(--panel));
  pointer-events: none;
}
.unlock {
  position: absolute;
  z-index: 3;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--hl);
  color: var(--ink);
  border: var(--edge);
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(27, 26, 23, 0.14); } }

/* Dance floor: one bot per listener, standing in front of the screen */
.floor {
  position: relative;
  z-index: 2;
  height: 118px;
  margin-top: -76px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(6px, 2vw, 18px);
  padding: 0 14px 8px;
  overflow: hidden;
  pointer-events: none;
}
/* Bots shrink when the playlist gets crowded */
.bot { position: relative; flex: 0 1 60px; min-width: 32px; display: flex; flex-direction: column; align-items: center; }
.bot svg { width: 100%; height: auto; aspect-ratio: 60 / 72; overflow: visible; }
.bot .bot-name { max-width: 100%; margin-top: 1px; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot.me .bot-name { color: var(--text); }
.bot .foot { fill: var(--c); filter: brightness(0.6); }
.bot .bot-fill { fill: var(--c); transition: fill 0.2s; }
.bot .bot-shadow { opacity: 0.16; }
.bot.me { pointer-events: auto; cursor: pointer; }
.bot.me .bot-name::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  vertical-align: 1px;
  background: var(--rainbow);
}
.bot.me:hover .bot-name { color: var(--accent); }
.bot .bot-body { transform-box: fill-box; transform-origin: 50% 100%; animation: bot-idle 3.2s ease-in-out infinite; animation-delay: var(--d, 0s); }
.bot .bot-shadow { transform-box: fill-box; transform-origin: center; animation: bot-idle-shadow 3.2s ease-in-out infinite; animation-delay: var(--d, 0s); }
.bot .eye { transform-box: fill-box; transform-origin: center; animation: bot-blink 4.6s infinite; animation-delay: var(--blink, 0s); }
.bot .mouth-happy { opacity: 0; }
.bot.dance .bot-body { animation: bot-dance 0.86s ease-in-out infinite; animation-delay: var(--d, 0s); }
.bot.dance .bot-shadow { animation: bot-dance-shadow 0.43s ease-in-out infinite alternate; }
.bot.dance .mouth-idle { opacity: 0; }
.bot.dance .mouth-happy { opacity: 1; }
/* Disliked the song: the bot droops, goes gray and shakes its head now and then. */
.bot.meh .bot-fill { filter: saturate(0.25) brightness(0.92); }
.bot.meh .bot-body { animation: bot-meh 2.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.bot.meh::after { content: '👎'; position: absolute; top: -4px; right: 2px; font-size: 14px; }
@keyframes bot-meh {
  0%, 60%, 100% { transform: translateY(2px) scaleY(0.94); }
  70% { transform: translateY(2px) scaleY(0.94) rotate(-7deg); }
  80% { transform: translateY(2px) scaleY(0.94) rotate(7deg); }
  90% { transform: translateY(2px) scaleY(0.94) rotate(-4deg); }
}
@keyframes bot-idle { 50% { transform: translateY(-2px); } }
@keyframes bot-idle-shadow { 50% { transform: scaleX(0.94); } }
@keyframes bot-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
@keyframes bot-dance {
  0%   { transform: translateY(0) scale(1.08, 0.9); }
  25%  { transform: translateY(-14px) rotate(-9deg) scale(0.96, 1.05); }
  50%  { transform: translateY(0) scale(1.08, 0.9); }
  75%  { transform: translateY(-14px) rotate(9deg) scale(0.96, 1.05); }
  100% { transform: translateY(0) scale(1.08, 0.9); }
}
@keyframes bot-dance-shadow { from { transform: scaleX(1.05); opacity: 0.2; } to { transform: scaleX(0.6); opacity: 0.08; } }

/* More dances: .d-pulinho uses the default above */
.bot.dance.d-balanco .bot-body { animation: bot-balanco 1.2s ease-in-out infinite; }
.bot.dance.d-balanco .bot-shadow { animation: none; }
@keyframes bot-balanco {
  0%, 100% { transform: rotate(-14deg) translateX(-3px); }
  50% { transform: rotate(14deg) translateX(3px); }
}
.bot.dance.d-robo .bot-body { animation: bot-robo 1.2s steps(1, end) infinite; }
.bot.dance.d-robo .bot-shadow { animation: none; }
@keyframes bot-robo {
  0%   { transform: translateX(0) rotate(0); }
  12.5% { transform: translateX(-5px) rotate(-12deg); }
  25%  { transform: translateX(-5px) translateY(-4px) rotate(0); }
  37.5% { transform: translateX(0) rotate(12deg); }
  50%  { transform: translateX(5px) rotate(12deg) scaleY(0.92); }
  62.5% { transform: translateX(5px) translateY(-4px) rotate(0); }
  75%  { transform: translateX(0) rotate(-12deg); }
  87.5% { transform: translateX(0) scale(1.06, 0.94); }
}
.bot.dance.d-headbang .bot-body { animation: bot-headbang 0.43s cubic-bezier(0.5, 0, 0.3, 1) infinite; }
.bot.dance.d-headbang .bot-shadow { animation: none; }
@keyframes bot-headbang {
  0%, 100% { transform: rotate(0) scale(1, 1); }
  40% { transform: rotate(16deg) translateY(4px) scale(1.06, 0.88); }
}
.bot.dance.d-giro .bot-body { animation: bot-giro 1.3s ease-in-out infinite; }
@keyframes bot-giro {
  0%   { transform: translateY(0) scaleX(1); }
  25%  { transform: translateY(-16px) scaleX(0.15); }
  50%  { transform: translateY(-16px) scaleX(-1); }
  75%  { transform: translateY(-4px) scaleX(-0.15); }
  100% { transform: translateY(0) scaleX(1); }
}
.bot.dance.d-rebolado .bot-body { animation: bot-rebolado 0.7s ease-in-out infinite; }
.bot.dance.d-rebolado .bot-shadow { animation: bot-dance-shadow 0.35s ease-in-out infinite alternate; }
@keyframes bot-rebolado {
  0%, 100% { transform: skewX(0) translateX(0); }
  25% { transform: skewX(14deg) translateX(-4px) translateY(-3px); }
  75% { transform: skewX(-14deg) translateX(4px) translateY(-3px); }
}

/* Bot picker: opened by clicking your own bot */
.bot-picker {
  position: fixed;
  z-index: 1000;
  width: 244px;
  transform: translate(-50%, -100%);
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  border: var(--edge);
  box-shadow: var(--shadow-lg);
}
.bp-title { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin: 0 0 8px; }
.bp-title:not(:first-child) { margin-top: 14px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--c);
  transition: transform 0.1s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.bp-custom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.bp-custom input { width: 44px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: none; cursor: pointer; }
.dance-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dance-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}
.dance-chip:hover { background: var(--hl); }
.dance-chip.sel { background: var(--ink); color: #fff; }
.note-fx { position: absolute; top: 4px; font-size: 15px; font-weight: 700; color: var(--c); animation: note-float 1.6s ease-out forwards; }
@keyframes note-float {
  from { opacity: 0; transform: translate(0, 6px) scale(0.6); }
  20% { opacity: 1; }
  to { opacity: 0; transform: translate(var(--x), -46px) scale(1.1) rotate(var(--r)); }
}

.like {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px 0 11px;
  border-radius: 999px;
  border: var(--edge);
  background: #fff;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  flex: none;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.like svg { width: 19px; height: 19px; }
.like:hover { background: var(--hl); }
.like:active { transform: scale(0.94); }
.like:disabled { opacity: 0.4; cursor: default; }
.like.on { background: var(--ink); color: #fff; box-shadow: 2px 2px 0 var(--stone); }
.like.dislike { padding: 0 12px 0 11px; gap: 5px; }
.like.dislike .count:empty { display: none; }
.like .count { font-weight: 500; opacity: 0.8; }

.now { padding: 6px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.now-row { display: flex; align-items: center; gap: 12px; }
.now-meta { flex: 1; min-width: 0; }
.now-title {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.now-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-sub .by, .row-sub .by { font-weight: 700; }
.controls { display: flex; align-items: center; justify-content: center; gap: 14px; }
.seek-row { display: flex; align-items: center; gap: 10px; }
.seek-row #seek { flex: 1; min-width: 0; }
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; }
.time:first-child { text-align: right; }
.volume { display: flex; align-items: center; gap: 2px; margin-left: 4px; }
.volume input { width: 72px; }

.src {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1px;
  color: #fff;
}
.src { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }
.src.spotify::before, .src.youtube::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.src.spotify::before { background: #1db954; }
.src.youtube::before { background: #ff0033; }
.src.mini-src { font-size: 9.5px; padding: 0 6px; }

/* Search */
.search { position: relative; z-index: 10; flex: none; }
.search form { position: relative; }
.search input { width: 100%; padding: 13px 16px 13px 42px; border-radius: 999px; background: #fff; font-size: 15px; box-shadow: var(--shadow); }
.search input:focus { box-shadow: 4px 4px 0 var(--ink); }
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 15px;
  height: 15px;
  margin-top: -9px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.search-icon::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 7px;
  background: var(--ink);
  right: -4px;
  bottom: -6px;
  transform: rotate(-45deg);
}
.results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 380px;
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  padding: 6px;
  border: var(--edge);
  box-shadow: var(--shadow-lg);
}
.results-note { padding: 14px; color: var(--muted); font-size: 14px; }
.import-note { color: var(--text); font-weight: 600; }
.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; margin-top: -4px; padding: 0 4px; }
.sources .src { margin-right: 0; }
.sources .muted { margin-left: 4px; }

/* Rows shared by search results and the queue */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border-radius: 12px;
}
.row:hover { background: var(--panel-2); }
.row-thumb { position: relative; flex: none; }
.row-thumb img { width: 76px; height: 43px; object-fit: cover; border-radius: 8px; background: #eee; border: 1.5px solid var(--ink); }
.thumb-ph { width: 76px; height: 43px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 18px; background: var(--panel-2); flex: none; }
.peek-now .thumb-ph { width: 72px; height: 42px; }
.finding { color: var(--muted); font-style: italic; }
.row-thumb .dur {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: rgba(24, 24, 27, 0.8);
  padding: 1px 4px;
  border-radius: 4px;
}
.row-meta { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 0; opacity: 0.5; transition: opacity 0.15s; }
.row:hover .row-actions, .row:focus-within .row-actions { opacity: 1; }
.row-actions .add { color: var(--accent); }
.q-idx { width: 18px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

/* Tabs and panels */
.tabs { display: flex; align-items: center; gap: 6px; flex: none; }
.tab {
  border: var(--edge);
  background: #fff;
  padding: 5px 14px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.tab.sel { background: var(--ink); color: #fff; }
.tab-count:not(:empty) { margin-left: 4px; font-family: var(--body); font-size: 11px; font-weight: 800; background: var(--hl); color: var(--text); padding: 1px 7px; border-radius: 999px; vertical-align: 2px; }
.tab.sel .tab-count:not(:empty) { background: #fff; color: var(--text); }
.tabs .btn { margin-left: auto; }
.panel { background: var(--panel); border-radius: var(--radius); padding: 8px; border: var(--edge); box-shadow: var(--shadow); flex: none; }
.queue { list-style: none; margin: 0; padding: 0; }
.queue-empty { padding: 16px 8px; color: var(--muted); font-size: 14px; }

/* Chat */
.chat { height: 380px; display: flex; flex-direction: column; padding: 12px 10px 10px; }
.messages { flex: 1; overflow-y: auto; padding: 0 6px; display: flex; flex-direction: column; gap: 8px; }
.msg { font-size: 14px; word-wrap: break-word; }
.msg-name { font-weight: 700; margin-right: 6px; }
.msg.system { font-size: 12px; color: var(--muted); }
.chat { position: relative; }
.chat.drop { outline: 2.5px dashed var(--ink); outline-offset: -8px; background: var(--hl); }
.chat-form { display: flex; align-items: center; gap: 4px; padding: 10px 0 0; }
.chat-form input { flex: 1; min-width: 0; border-radius: 999px; padding: 9px 14px; margin: 0 4px 0 2px; }
.msg-img-link { display: block; margin-top: 6px; width: fit-content; }
.msg-img { max-width: min(240px, 100%); max-height: 240px; border-radius: 12px; border: var(--edge); box-shadow: var(--shadow-sm); background: var(--panel-2); }
.emoji-panel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 58px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  background: #fff;
  border: var(--edge);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.emoji-pick { border: 0; background: none; border-radius: 10px; font-size: 21px; line-height: 1; padding: 6px 0; }
.emoji-pick:hover { background: var(--hl); }

/* ---------- Name gate ---------- */
.modal {
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(241, 238, 232, 0.6);
  backdrop-filter: blur(4px);
}
.gate-card {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 28px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 2.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}
.gate-card h1 { font-family: var(--display); font-weight: 800; font-size: 42px; line-height: 0.98; letter-spacing: -0.05em; margin: 14px 0 4px; }
/* A sand highlighter behind words, like a marker pass. */
.gate-card h1 mark { background: var(--hl); color: inherit; padding: 0 0.12em; border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.lede { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.gate-card label { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.gate-card .btn.primary { padding: 13px; font-size: 16px; margin-top: 4px; }
.fine { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translate(-50%, -20px);
  background: var(--ink);
  color: #fff;
  border: var(--edge);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1200;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 3px 3px 0 var(--stone);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); box-shadow: var(--shadow); }

/* ---------- Desktop: the panel sits on the right, the map stays usable on the left ---------- */
@media (min-width: 900px) {
  body.in-room .fab { left: calc((100% - 480px) / 2); }
  body.in-room .map-tools { right: 492px; }
  body.in-room .maplibregl-ctrl-bottom-right { right: 480px; }
  body.in-room .me-chip { margin-right: 480px; }
}

/* ---------- Phones ---------- */
@media (max-width: 899px) {
  .room { width: 100%; }
  body.in-room .mapbar, body.in-room .hot, body.in-room .fab { visibility: hidden; }
}
@media (max-width: 600px) {
  .mapbar .brand { font-size: 19px; padding: 7px 13px 7px 10px; }
  .mapbar { gap: 8px; }
  .live-pill { font-size: 12px; padding: 7px 11px; white-space: nowrap; min-width: 0; }
  #liveText { overflow: hidden; text-overflow: ellipsis; }
  .me-chip { flex: none; }
  .me-chip .me-name { display: none; }
  .me-chip { padding: 5px; }
  .hot { top: 60px; }
  .fab { font-size: 17px; padding: 13px 22px 13px 13px; }
  .sheet { top: auto; bottom: 0; left: 0; width: 100%; max-height: 64%; border-radius: 22px 22px 0 0; border-width: 2px 0 0; box-shadow: none; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .floor { height: 100px; margin-top: -62px; }
  .bot { flex-basis: 48px; }
  .volume { display: none; }
  .row-thumb img, .row-thumb .thumb-ph { width: 64px; height: 36px; }
  .row-actions { opacity: 1; }
  .gate-card { padding: 22px; }
  .gate-card h1 { font-size: 36px; }
}
