/* The media player. Its colours follow syad-kit ui-kit's theme (dark by default, light
   with the phone, or as chosen under Settings), so the player's own names point at ui-kit's. */
:root {
  --mp-bg: var(--ui-bg); --mp-surface: var(--ui-surface);
  --mp-text: var(--ui-text); --mp-text-muted: var(--ui-dim);
  --mp-fill: color-mix(in srgb, var(--ui-text) 6%, transparent);
  --mp-fill-md: color-mix(in srgb, var(--ui-text) 8%, transparent);
  --mp-fill-hi: color-mix(in srgb, var(--ui-text) 13%, transparent);
  --mp-border-md: color-mix(in srgb, var(--ui-text) 12%, transparent);
  --mp-accent: var(--ui-accent); --mp-accent-fill: var(--ui-accent-dim);
  --mp-accent-mid: color-mix(in srgb, var(--ui-accent) 25%, transparent);
  --mp-danger: var(--ui-danger);
  --panel-w: 270px;
  --panel-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --panel-dur: 0.35s;
  --mp-text-xs: 12px;
  --mp-text-sm: 14px;
  --mp-text-md: 16px;
}
/* The player fills the screen: ui-kit's page column and header aren't used here. */
.ui-header { display: none; }
.ui-main { flex: 1; display: flex; flex-direction: column; min-height: 0; max-width: none; margin: 0; padding: 0; }

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

body {
  font-family: var(--ui-font);
  padding: 0;
  background: var(--mp-bg);
  color: var(--mp-text);
  /* 1.0.1: the screen's height at every text size (ui-kit-express 1.4.0); a plain 100dvh is zoomed
     with the page and pushed the controls off screen at Large and above. */
  height: var(--ui-screen-h, 100dvh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* ═══════════════ LANDSCAPE ═══════════════ */
@media (orientation: landscape) {
  #app { flex-direction: row; }
  #panel {
    display: flex; flex-direction: column;
    background: var(--mp-surface);
    width: var(--panel-w); height: 100%; overflow: hidden; flex-shrink: 0;
    /* Both properties must animate together: transform slides the panel,
       margin-right hands its space back to the player. Animating only one
       makes the video snap to its new width before the slide begins. */
    transform: translateX(0);
    margin-right: 0;
    transition: transform var(--panel-dur) var(--panel-ease),
                margin-right var(--panel-dur) var(--panel-ease);
    position: relative; z-index: 1;
    will-change: transform;
  }
  #panel.panel-hidden {
    transform: translateX(calc(-1 * var(--panel-w)));
    margin-right: calc(-1 * var(--panel-w));
  }
  #player { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--mp-bg); overflow: hidden; }
  #video-wrap { flex: 1; min-height: 0; }
  #portrait-scroll { display: none; }
}

/* ═══════════════ PORTRAIT ═══════════════ */
@media (orientation: portrait) {
  #app { flex-direction: column; }
  #panel { display: none; }
  #player { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--mp-bg); }
  #video-wrap { width: 100%; aspect-ratio: 16/9; flex-shrink: 0; }
  #portrait-scroll {
    flex: 1; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
    display: flex; flex-direction: column;
  }
  #portrait-scroll::after { content: ''; display: block; height: 24px; }
}

/* ═══════════════ VIDEO WRAP ═══════════════ */
#video-wrap { position: relative; background: #000; -webkit-tap-highlight-color: transparent; }

#video-el, #video-el-b { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#yt-frame { display: none; position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
#audio-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: none; background-size: cover; background-position: center;
  transition: background-image 0.5s ease;
}
#audio-art-wallpaper { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
#audio-art-wallpaper svg { width: 100%; height: 100%; }
#audio-art::before {
  content: ""; position: absolute; inset: 0;
  background: rgba(0,0,0,0.5); pointer-events: none;
  opacity: 0; transition: opacity 0.5s ease;
}
#audio-art.has-wallpaper::before { opacity: 1; }
#viz-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ═══════════════ OVERLAY CONTROLS ═══════════════ */
#video-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end;
  background: linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.12) 35%, rgba(0,0,0,0.12) 55%, rgba(0,0,0,0.55) 100%);
  opacity: 1; transition: opacity 0.3s ease; cursor: pointer;
}
#video-overlay.hidden { opacity: 0; pointer-events: none; }
#video-overlay.hidden #play-btn-overlay { pointer-events: none; }

#overlay-mid {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; gap: 20px;
  pointer-events: none;
}
#overlay-mid > * { pointer-events: all; }
#overlay-bottom { display: flex; align-items: center; gap: 4px; padding: 8px 12px 10px; }

.overlay-btn {
  background: none; border: none; color: rgba(255,255,255,0.9);
  width: 44px; height: 44px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background 0.15s; flex-shrink: 0;
}
.overlay-btn:active { background: rgba(255,255,255,0.2); }

.overlay-btn-sm {
  background: none; border: none; color: rgba(255,255,255,0.8);
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.12s, color 0.12s; flex-shrink: 0;
}
.overlay-btn-sm:hover { background: rgba(255,255,255,0.15); color: #fff; }
.overlay-btn-sm.on { color: var(--mp-accent); }

#play-btn-overlay {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--mp-accent); border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s, transform 0.1s;
}
#play-btn-overlay:active { transform: scale(0.92); }

/* ═══════════════ PROGRESS ═══════════════ */
#overlay-progress { display: flex; flex-direction: column; gap: 6px; padding: 6px 12px 10px; }
#time-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#progress-row { display: flex; align-items: center; width: 100%; }
.time-label {
  font-size: 13px; color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85);
}
#fullscreen-btn {
  width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0;
  background: none; color: rgba(255,255,255,0.95);
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.75));
}
#fullscreen-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
#progress {
  width: 100%; height: 4px; background: var(--mp-fill-hi);
  border-radius: 2px; cursor: pointer; position: relative; touch-action: none;
  padding: 12px 0; margin: -12px 0; box-sizing: content-box; background-clip: content-box;
}
#progress-fill { height: 100%; background: var(--mp-accent); border-radius: 2px; width: 0%; pointer-events: none; }
#progress-thumb {
  position: absolute; top: 50%; transform: translate(-50%,-50%);
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  left: 0%; pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ═══════════════ TRACK INFO BAR ═══════════════ */
#track-info {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 10px 160px 8px 14px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
  z-index: 11; display: none; pointer-events: none;
  transition: opacity 0.3s ease;
}
#track-title {
  font-size: var(--mp-text-sm); font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#track-sub {
  font-size: var(--mp-text-xs); color: rgba(255,255,255,0.7); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════════════ VOLUME ═══════════════ */
#vol-control {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 130px; margin-bottom: -130px;
}
#vol-slider-wrap {
  display: none; flex-direction: column; align-items: center;
  background: rgba(0,0,0,0.55); border-radius: 50px; padding: 16px 10px;
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%);
}
#vol-control:hover #vol-slider-wrap { display: flex; }
#vol-slider {
  width: 4px; height: 80px; background: transparent;
  border-radius: 2px; cursor: pointer; position: relative; touch-action: none;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
}
#vol-track { position: absolute; inset: 0; border-radius: 2px; background: rgba(255,255,255,0.25); pointer-events: none; }
#vol-fill { width: 100%; border-radius: 2px; background: rgba(255,255,255,0.8); pointer-events: none; position: relative; z-index: 1; height: 80%; }

/* ═══════════════ SHUFFLE/LOOP PILL ═══════════════ */
.pill-group { display: flex; align-items: center; background: rgba(0,0,0,0.3); border-radius: 50px; overflow: hidden; }
.pill-left { border-radius: 50px 0 0 50px !important; padding: 0 16px !important; width: auto !important; }
.pill-right { border-radius: 0 50px 50px 0 !important; padding: 0 16px !important; width: auto !important; }

/* ═══════════════ PANEL TOGGLE ═══════════════ */
#panel-toggle-btn {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%); z-index: 30;
  background: rgba(0,0,0,0.3); border: none; color: rgba(255,255,255,0.8);
  width: 20px; height: 60px; border-radius: 0 6px 6px 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.12s, opacity 0.3s ease;
}
#panel-toggle-btn:hover { background: rgba(0,0,0,0.6); color: #fff; }
@media (orientation: portrait) { #panel-toggle-btn { display: none; } }

/* ═══════════════ VISUALIZER BUTTONS ═══════════════ */
#viz-picker {
  position: absolute; top: 10px; right: 10px; z-index: 25;
  display: flex; gap: 8px; align-items: center; transition: opacity 0.3s ease;
}
/* Sized and spaced like YouTube's own top-right controls: 38px targets,
   no chip background, the icon carried by a drop shadow instead. */
#viz-picker .viz-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: none; color: rgba(255,255,255,0.95);
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.75));
}
#viz-picker .viz-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
#viz-picker .viz-btn:active { background: rgba(255,255,255,0.3); }
.viz-btn {
  background: rgba(0,0,0,0.3); border: none; color: rgba(255,255,255,0.6);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s; flex-shrink: 0;
}
.viz-btn:hover { background: rgba(0,0,0,0.75); color: #fff; }
.viz-btn.active { background: color-mix(in srgb, var(--ui-accent) 80%, transparent); color: var(--ui-accent-text); }
#viz-more {
  display: flex; gap: 4px; white-space: nowrap;
  max-width: 120px; transition: max-width 0.35s ease;
  /* Scrollable so every visualizer is reachable on a narrow screen —
     max-width alone just clipped the tail of the list. */
  overflow-x: auto; overflow-y: hidden;
  flex-shrink: 1; min-width: 0;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
#viz-more::-webkit-scrollbar { display: none; }
#viz-more.expanded { max-width: 600px; }
#viz-more > .viz-btn { flex: 0 0 auto; }

#overlay-bottom > #viz-btns { flex-shrink: 1; min-width: 0; }
#overlay-bottom > .pill-group { flex-shrink: 0; }
#sleep-btn { width: auto; padding: 0 8px; flex-shrink: 0; }
#sleep-btn.on { color: var(--mp-accent); }



/* ── DIRECT OUTPUT MODE ──
   No AudioContext exists, so the EQ and every visualizer are inert. Hide
   them rather than leave controls that cannot do anything. */
/* #eq-btn deliberately stays visible: it now hosts the Bypass DSP toggle, so
   hiding it would make Direct output a one-way door. */
#video-wrap.direct-mode #viz-btns { display: none; }
#direct-badge { display: none; }
#video-wrap.direct-mode #direct-badge {
  display: block; position: absolute; left: 10px; top: 12px; z-index: 26;
  font-size: 10px; letter-spacing: 0.08em; font-weight: 600;
  color: rgba(255,255,255,0.75); text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9); pointer-events: none;
  transition: opacity 0.3s ease;
}
#video-wrap.controls-hidden #direct-badge { opacity: 0; }

/* ── YOUTUBE MODE ──
   The iframe brings its own title bar and transport, so ours would sit on
   top of them. Volume and EQ act on our audio graph, which the iframe never
   uses, so they're hidden rather than left as dead controls. Only Settings
   survives, moved clear of YouTube's own chrome. */
#video-wrap.yt-mode #vol-control,
#video-wrap.yt-mode #eq-btn,
#video-wrap.yt-mode #viz-btns { display: none; }
#video-wrap.yt-mode #viz-picker {
  top: auto; right: auto;
  bottom: 52px; left: 6px;
  z-index: 35;              /* above #yt-edge-strip, which would eat the tap */
  opacity: 0.5;
}
#video-wrap.yt-mode #viz-picker:hover,
#video-wrap.yt-mode #viz-picker:active { opacity: 1; }

/* Driven by an explicit class, not :has() — one source of truth that JS
   sets, so hit-testing can never disagree with what's on screen. */
#video-wrap.controls-hidden #track-info,
#video-wrap.controls-hidden #viz-picker,
#video-wrap.controls-hidden #panel-toggle-btn { opacity: 0; pointer-events: none; }

/* THE TAP SHIELD.
   While the controls are hidden this sits above every control and physically
   absorbs the first tap — pointerdown, pointerup and click all land here, so
   no button can receive any part of that gesture. It disappears only once the
   controls are up, making the reveal tap and the press two separate gestures. */
#tap-shield { position: absolute; inset: 0; z-index: 60; display: none; cursor: pointer; }
#video-wrap.controls-hidden #tap-shield { display: block; }
#video-wrap.yt-mode #tap-shield { display: none; }   /* YouTube owns its own chrome */
/* In YouTube mode the overlay is display:none rather than .hidden, so the
   selector above doesn't match and these stay reachable over the iframe. */
#video-wrap.yt-mode #panel-toggle-btn { opacity: 1; pointer-events: all; }

/* ═══════════════ LISTS / PANELS ═══════════════ */
#panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--mp-surface); min-height: 48px; flex-shrink: 0;
}
#panel-title, #portrait-nav-title {
  flex: 1; font-size: var(--mp-text-sm); font-weight: 600;
  color: var(--mp-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
#list::after { content: ''; display: block; height: 16px; }

#portrait-nav {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; min-height: 44px;
  background: var(--mp-surface);
  border-bottom: 1px solid var(--mp-border-md);
  position: sticky; top: 0; z-index: 5; flex-shrink: 0;
}
#portrait-list { flex: 1; }

.search-bar { display: none; align-items: center; gap: 6px; padding: 6px 8px; min-height: 48px;
  border-bottom: 1px solid var(--mp-border-md); background: var(--mp-surface); flex-shrink: 0; }
.search-bar.on { display: flex; }
.search-bar input {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px;
  border: 1.5px solid var(--mp-border-md); background: var(--mp-fill);
  color: var(--mp-text); font-size: max(16px, var(--mp-text-sm)); box-sizing: border-box;
}
.search-bar input:focus { outline: 2px solid var(--mp-accent); }
#p-search-bar { position: sticky; top: 0; z-index: 6; }

/* Searching on a phone: the keyboard needs the room more than the artwork does */
@media (orientation: portrait) {
  #player.searching #video-wrap { display: none; }
}

.row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; min-height: 52px; transition: background 0.1s;
}
.row:active { background: var(--mp-fill-hi); }
.row.active { background: var(--mp-accent-fill); }
.row-icon {
  width: 38px; height: 38px; border-radius: 8px; background: var(--mp-fill-md);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}
.row-icon.yt { background: rgba(255,0,0,0.12); }
.row-icon.num {
  width: 28px; height: auto; background: none; border-radius: 0;
  font-size: var(--mp-text-xs); font-weight: 600;
  color: var(--mp-text-muted); font-variant-numeric: tabular-nums;
  text-align: right; flex-shrink: 0; padding-right: 4px;
}
.row-cover { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.row-info { flex: 1; min-width: 0; }
.row-title { font-size: var(--mp-text-xs); color: var(--mp-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.active .row-title { color: var(--mp-accent); }
.row-sub { font-size: calc(var(--mp-text-xs) - 1px); color: var(--mp-text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mp-accent); flex-shrink: 0; display: none; }
.row.active .playing-dot { display: block; }
.list-hdr { padding: 6px 12px 2px; font-size: var(--mp-text-xs); color: var(--mp-text-muted); }
.state-msg { padding: 32px 16px; text-align: center; color: var(--mp-text-muted); font-size: var(--mp-text-xs); line-height: 1.6; }

.icon-btn {
  background: none; border: none; color: var(--mp-text-muted); cursor: pointer;
  padding: 6px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; transition: background 0.12s, color 0.12s; flex-shrink: 0;
}
.icon-btn:active, .icon-btn:hover { background: var(--mp-fill-hi); color: var(--mp-text); }

/* ═══════════════ MODALS ═══════════════ */
.modal-bg {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--mp-surface); border-radius: 14px; padding: 20px;
  width: min(360px, calc(100vw / var(--ui-zoom, 1) - 32px)); display: flex; flex-direction: column; gap: 10px;
}
.modal h2 { font-size: var(--mp-text-md); font-weight: 600; color: var(--mp-text); }
.modal label { font-size: var(--mp-text-xs); color: var(--mp-text-muted); margin-bottom: -4px; }
.modal .hint { font-size: var(--mp-text-xs); color: var(--mp-text-muted); line-height: 1.5; }
.modal input[type=text], .modal input[type=url], .modal input[type=password], .modal select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--mp-border-md);
  background: var(--mp-fill); color: var(--mp-text);
  font-size: max(16px, var(--mp-text-sm)); box-sizing: border-box;
}
.modal input:focus, .modal select:focus { outline: 2px solid var(--mp-accent); }
.modal select { cursor: pointer; }

/* Native dropdown popups are drawn by the OS and inherit nothing from the
   styled <select>, so the options came out white-on-white. These have to be
   set explicitly, and the background must be OPAQUE — the --mp-fill tokens
   are translucent, which is what produced white behind white text. */
select {
  background-color: var(--mp-surface);
  color: var(--mp-text);
}
select option,
select optgroup {
  background-color: var(--mp-surface);
  color: var(--mp-text);
}
select option:checked,
select option:hover {
  background-color: var(--mp-accent);
  color: #fff;
}
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.modal-btn { padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer; font-size: var(--mp-text-sm); min-height: 44px; font-weight: 500; }
.modal-btn.cancel { background: var(--mp-fill-hi); color: var(--mp-text); }
.modal-btn.primary { background: var(--mp-accent); color: #fff; }
.modal-btn:active { opacity: 0.85; }

#eq-modal { width: min(520px, calc(100vw / var(--ui-zoom, 1) - 32px)); overflow: visible; }
#eq-footer {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--mp-border-md);
}
#eq-footer label {
  display: flex; align-items: center; gap: 6px; margin: 0;
  font-size: var(--mp-text-xs); color: var(--mp-text-muted);
  cursor: pointer; white-space: nowrap;
}
#eq-footer input[type=checkbox] {
  width: 16px; height: 16px; accent-color: var(--mp-accent); cursor: pointer; margin: 0;
}
#eq-footer select {
  width: auto; padding: 4px 8px; font-size: var(--mp-text-xs); min-width: 0;
  background-color: var(--mp-surface); color: var(--mp-text);
  border: 1.5px solid var(--mp-border-md); border-radius: 6px;
}
#eq-footer .modal-btn { min-height: 38px; }
/* Bypass makes the bands meaningless — dim them rather than let them lie */
#eq-modal.bypassed #eq-bands { opacity: 0.35; pointer-events: none; }
#eq-modal.bypassed #eq-preset,
#eq-modal.bypassed #eq-reset-btn { opacity: 0.4; pointer-events: none; }
#eq-modal.bypassed #eq-rate-wrap { opacity: 0.4; pointer-events: none; }

/* ═══════════════ CONTEXT MENU ═══════════════ */
#ctx-menu { display: none; position: fixed; inset: 0; z-index: 2000; }
#ctx-menu.open { display: block; }
#ctx-menu-inner {
  position: absolute; background: var(--mp-surface); border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  padding: 4px; min-width: 180px; border: 1px solid var(--mp-border-md);
}
.ctx-item { padding: 10px 14px; border-radius: 7px; font-size: var(--mp-text-sm); color: var(--mp-text); cursor: pointer; user-select: none; }
.ctx-item:hover { background: var(--mp-fill-hi); }
.ctx-item.danger { color: var(--mp-danger); }
.ctx-sep { height: 1px; background: var(--mp-border-md); margin: 4px 8px; }
.modal-btn.danger { background: var(--mp-danger); color: #fff; }

/* ═══════════════ EQUALIZER ═══════════════ */
#eq-bands {
  display: flex; gap: 4px; align-items: center; justify-content: space-between;
  height: 180px; padding: 8px 0; overflow: visible;
}
.eq-band { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; overflow: visible; }
.eq-slider-wrap { height: 140px; width: 100%; position: relative; overflow: visible; }
.eq-band input[type=range] {
  position: absolute; top: 50%; left: 50%;
  width: 130px; height: 20px;
  transform: translate(-50%, -50%) rotate(-90deg); transform-origin: center center;
  accent-color: var(--mp-accent); cursor: pointer; margin: 0; padding: 0;
}
.eq-band-label { font-size: 10px; color: var(--mp-text-muted); }
.eq-band-val { font-size: 9px; color: var(--mp-accent); font-variant-numeric: tabular-nums; min-width: 32px; text-align: center; }

/* ═══════════════ TOAST ═══════════════ */
#toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(30,30,30,0.92); color: #fff; padding: 8px 16px;
  border-radius: 20px; font-size: 13px; z-index: 3000; white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.12); pointer-events: none;
  opacity: 0; transition: opacity 0.2s ease;
}
#toast.on { opacity: 1; }

/* ═══════════════ MISC ═══════════════ */
#list::-webkit-scrollbar, #portrait-scroll::-webkit-scrollbar { width: 4px; }
#list::-webkit-scrollbar-thumb, #portrait-scroll::-webkit-scrollbar-thumb { background: var(--mp-border-md); border-radius: 2px; }
.row, .icon-btn, .modal-btn { user-select: none; -webkit-user-select: none; }

/* ═══════════════ FULLSCREEN ═══════════════
   Fullscreen removes the status and navigation bars, so the app now owns
   the notch/cutout area too — keep controls clear of it. */
:fullscreen { background: var(--mp-bg); }
:-webkit-full-screen { background: var(--mp-bg); }
body.is-fullscreen #track-info { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
body.is-fullscreen #viz-picker { top: calc(8px + env(safe-area-inset-top, 0px)); }
body.is-fullscreen #overlay-bottom { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
/* The top inset belongs only to whatever is actually topmost on screen.
   Landscape: the sidebar header. Portrait: the artwork, whose own overlay
   controls are already inset above — the nav sits below it and needs none. */
@media (orientation: landscape) {
  body.is-fullscreen #panel-header,
  body.is-fullscreen #search-bar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  body.is-fullscreen #panel { padding-left: env(safe-area-inset-left, 0px); }
}
@media (orientation: portrait) {
  /* Searching hides the artwork, so the search bar becomes topmost. */
  body.is-fullscreen #player.searching #p-search-bar { padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  body.is-fullscreen #portrait-scroll {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --panel-dur: 0.01s; }
  #video-overlay, #viz-picker, #track-info, #panel-toggle-btn { transition: none; }
}

@media (hover: hover) {
  .row:hover { background: var(--mp-fill-md); }
  .row.active:hover { background: var(--mp-accent-mid); }
  #play-btn-overlay:hover { background: #5254cc; }
  .modal-btn.cancel:hover { background: var(--mp-fill-hi); }
}

/* ui-kit's Theme and Text size, inside the player's Settings. */
.mp-ui-settings .ui-theme { margin: 4px 0 10px; }
.mp-ui-settings .ui-text-size { margin: 0 0 10px; }
.mp-ui-settings .ui-label { margin: 0; }

/* Phones and tablets: every control is at least 44px to tap (Rule 6). */
@media (pointer: coarse) {
  .icon-btn, .viz-btn, #fullscreen-btn, .overlay-btn-sm { min-width: 44px; min-height: 44px; }
  .overlay-btn-sm.pill-left, .overlay-btn-sm.pill-right { min-width: 52px; }
  #viz-more { max-width: 132px; }
}
