/* Vision AI — mini music player docked at the bottom of the right
   panel (#vai-panel). Kelvin's order 2026-11-03.
   Styled to the app design system (DESIGN.md): near-solid card
   surface, hairline borders, gold primary control, Inter, signature
   easing. Token-driven (--card/--fg/--muted/--gold/--line), so light
   theme inverts with the app. All selectors are scoped to the panel
   with ID-level specificity to hold against the worker's injected
   panel styles regardless of injection order. */

#vai-panel .vmp {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  flex-shrink: 0;
  z-index: 3;
  background: var(--card);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .06);
  padding: 12px 14px 13px;
  font-family: Inter, system-ui, sans-serif;
  color: var(--fg);
}

/* ---------- search ---------- */
#vai-panel .vmp-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(var(--fg-rgb), .06);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0 8px 0 12px;
  height: 38px;
  transition: border-color .25s cubic-bezier(.16, 1, .3, 1);
}
#vai-panel .vmp-search:focus-within {
  border-color: rgba(227, 183, 122, .55);
}
#vai-panel .vmp-search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
#vai-panel .vmp-search-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--fg);
  font: 500 16px Inter, system-ui, sans-serif;
  height: 100%;
}
#vai-panel .vmp-search-input::placeholder { color: var(--muted-2); }
#vai-panel .vmp-search-input::-webkit-search-cancel-button { display: none; }
#vai-panel .vmp-search-x {
  flex: none;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(var(--fg-rgb), .1);
  color: var(--fg);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
#vai-panel .vmp-search-x:active { transform: scale(.94); }

/* ---------- results popover (opens upward, player sits at bottom) ---------- */
#vai-panel .vmp-results {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  max-height: 288px;
  overflow-y: auto;
  background: var(--card-solid);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .42);
  padding: 8px;
  z-index: 5;
}
#vai-panel .vmp-results::-webkit-scrollbar { width: 6px; }
#vai-panel .vmp-results::-webkit-scrollbar-thumb { background: rgba(var(--fg-rgb), .18); border-radius: 3px; }
#vai-panel .vmp-group {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 5px;
}
#vai-panel .vmp-none {
  font-size: 13px;
  color: var(--muted);
  padding: 2px 10px 9px;
  line-height: 1.45;
}
#vai-panel .vmp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--fg);
  font: inherit;
  transition: background .2s cubic-bezier(.16, 1, .3, 1);
}
#vai-panel .vmp-row:hover,
#vai-panel .vmp-row:focus-visible { background: rgba(var(--fg-rgb), .08); outline: none; }
#vai-panel .vmp-row:active { transform: scale(.985); }
#vai-panel .vmp-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#vai-panel .vmp-row-main strong {
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#vai-panel .vmp-row-main small {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#vai-panel .vmp-row-tag { flex: none; color: var(--gold); font-size: 12px; }
#vai-panel .vmp-row-thumb {
  flex: none;
  width: 40px;
  height: 30px;
  object-fit: cover;
  border-radius: 7px;
}

/* ---------- now playing ---------- */
#vai-panel .vmp-main {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 11px;
}
#vai-panel .vmp-cover {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(227, 183, 122, .14);
  border: 1px solid rgba(227, 183, 122, .3);
  display: flex;
  align-items: center;
  justify-content: center;
}
#vai-panel .vmp-cover img { width: 100%; height: 100%; object-fit: cover; }
#vai-panel .vmp-cover-note { color: var(--gold); font-size: 18px; line-height: 1; }
#vai-panel .vmp-meta { flex: 1; min-width: 0; }
#vai-panel .vmp-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#vai-panel .vmp-artist {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* ---------- progress ---------- */
#vai-panel .vmp-progress {
  position: relative;
  height: 16px;
  margin-top: 7px;
  cursor: pointer;
  touch-action: none;
}
#vai-panel .vmp-progress::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 4px;
  transform: translateY(-50%);
  border-radius: 99px;
  background: rgba(var(--fg-rgb), .14);
}
#vai-panel .vmp-progress-fill {
  position: absolute;
  left: 0; top: 50%;
  height: 4px;
  width: 0;
  transform: translateY(-50%);
  border-radius: 99px;
  background: var(--gold);
  pointer-events: none;
}
#vai-panel .vmp-progress:focus-visible { outline: 2px solid var(--sage-light); outline-offset: 2px; border-radius: 8px; }
#vai-panel .vmp-times {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  margin-top: -3px;
  font-variant-numeric: tabular-nums;
}

/* ---------- controls ---------- */
#vai-panel .vmp-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
#vai-panel .vmp-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s cubic-bezier(.16, 1, .3, 1), transform .15s cubic-bezier(.34, 1.56, .64, 1);
}
#vai-panel .vmp-btn svg { width: 19px; height: 19px; }
#vai-panel .vmp-btn:hover { background: rgba(var(--fg-rgb), .09); }
#vai-panel .vmp-btn:active { transform: scale(.94); }
#vai-panel .vmp-btn.vmp-play {
  width: 42px;
  height: 42px;
  background: var(--gold);
  color: #211709;
  box-shadow: 0 6px 18px rgba(227, 183, 122, .3);
}
#vai-panel .vmp-btn.vmp-play:hover { background: var(--gold); filter: brightness(1.06); }
#vai-panel .vmp-btn.vmp-play svg { width: 20px; height: 20px; }

/* ---------- volume ---------- */
#vai-panel .vmp-vol {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: 10px;
  min-width: 0;
}
#vai-panel .vmp-vol svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
#vai-panel .vmp-vol-range {
  --p: 80%;
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold) var(--p), rgba(var(--fg-rgb), .16) var(--p));
  outline: none;
  cursor: pointer;
}
#vai-panel .vmp-vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--fg);
  border: none;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .4);
}
#vai-panel .vmp-vol-range::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--fg);
  border: none;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .4);
}
#vai-panel .vmp-vol-range:focus-visible { outline: 2px solid var(--sage-light); outline-offset: 4px; }
#vai-panel .vmp-vol-range:disabled { opacity: .45; cursor: default; }
#vai-panel .vmp-vol.is-fixed svg { opacity: .45; }
#vai-panel .vmp-volhint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 7px;
}

@media (prefers-reduced-motion: reduce) {
  #vai-panel .vmp-btn, #vai-panel .vmp-row, #vai-panel .vmp-search { transition: none; }
}

/* Always-visible chat box (2026-11-04): the composer stays on screen in every
   view, so users can message Vision AI without reopening the menu to pick
   Chat. Sending from another view jumps to Chat first (js/app.js de()).
   Bottom spacing on non-chat views reserves room for the composer + the
   mini-player stacked above it, mirroring the chat view's own rules. */
body:not([data-view="chat"]) .main {
  padding-bottom: calc(var(--comp-live, var(--comp-h)) + var(--mini-h, 0px) + 20px);
}
body:not([data-view="chat"]) .mini-player {
  bottom: calc(var(--comp-live, var(--comp-h)) + 4px);
}
body:not([data-view="chat"]) .toast {
  bottom: calc(var(--comp-live, var(--comp-h)) + var(--mini-h, 0px) + 12px);
}
