/* ============================================================
   JFM — Y2K / Winamp revival × hacker mono
   Accent #ff5b3a · Space Mono (UI/wordmark) + Space Grotesk (body)
   ============================================================ */
:root {
  --bg: #0e0e10;
  --panel: #15151a;
  --panel-2: #0a0a0c;
  --sunk: #060608;
  --line: #000;
  --ink: #e9e9ec;
  --muted: #888;
  --dim: #555;
  --faint: #2a2a32;
  --accent: #ff5b3a;
  --accent-soft: rgba(255, 91, 58, 0.18);
  --mono: 'Space Mono', ui-monospace, monospace;
  --sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --grad-accent: linear-gradient(180deg, #ff8a5a, #ff5b3a 50%, #e63a10);
  --grad-word: linear-gradient(180deg, #ffb088, #ff5b3a 60%, #c93a10);
  --bevel: inset 0 1px 0 rgba(255,255,255,0.1), inset -1px -1px 0 rgba(0,0,0,0.5);
}

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

html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
.hidden { display: none !important; }
.desktop-only { display: flex; }
.mobile-only { display: none; }

/* CRT scanline overlay */
.scanlines { position: relative; }
.scanlines::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
}

/* ---------- Window chrome ---------- */
.win {
  background: var(--bg); border-radius: 2px; overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.titlebar {
  height: 28px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; background: linear-gradient(180deg, #2a2a32, #16161b);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: #9a9aa6; position: relative; z-index: 3;
}
.tb-dot { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.tb-dot.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.tb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-btns { margin-left: auto; display: flex; gap: 4px; }
.tb-btn {
  width: 18px; height: 16px; display: grid; place-items: center; font-style: normal;
  font-size: 10px; color: #888; background: linear-gradient(180deg, #33333c, #1d1d23);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.12), inset -1px -1px 0 rgba(0,0,0,0.6);
}
.tb-btn.close { background: linear-gradient(180deg, #5a2018, #2a0a05); color: #ff8866;
  box-shadow: inset 1px 1px 0 rgba(255,120,80,0.3), inset -1px -1px 0 rgba(0,0,0,0.6); }

/* ---------- Wordmark ---------- */
.wordmark {
  font-family: var(--mono); font-weight: 700; line-height: 0.9; letter-spacing: -0.03em;
  background: var(--grad-word); -webkit-background-clip: text; background-clip: text;
  color: transparent; filter: drop-shadow(0 0 12px rgba(255,91,58,0.2));
}
.wordmark-xl { font-size: 104px; letter-spacing: -0.04em;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.6)) drop-shadow(0 0 24px rgba(255,91,58,0.25)); }
.wordmark-md { font-size: 38px; }
.wordmark-sm { font-size: 24px; letter-spacing: -0.02em; }
.wordmark-sub { font-family: var(--sans); font-style: italic; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- Form controls ---------- */
.field {
  width: 100%; height: 44px; padding: 0 14px; color: #fff; outline: none;
  font-family: var(--mono); font-size: 14px;
  background: linear-gradient(180deg, var(--panel-2), #15151a);
  border: 1px solid var(--line); border-radius: 2px;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.8), inset -1px -1px 0 rgba(255,255,255,0.04);
}
.field:focus { border-color: var(--accent); box-shadow: inset 1px 1px 2px rgba(0,0,0,0.8), 0 0 0 2px rgba(255,91,58,0.18); }
.field-sm { height: 32px; font-size: 12px; padding: 0 10px; }
.field-label {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--muted); text-transform: uppercase;
}
.field-label .field { margin-top: 6px; }

/* Buttons */
.btn-accent {
  height: 44px; padding: 0 24px; cursor: pointer; color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: 0.2em;
  text-transform: uppercase; text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
  background: var(--grad-accent); border: 1px solid #8a2a08; border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -1px 0 rgba(0,0,0,0.3), 0 2px 0 rgba(0,0,0,0.6);
}
.btn-accent:hover { filter: brightness(1.08); }
.btn-accent:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), inset 0 -1px 0 rgba(0,0,0,0.4); }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; flex: none; padding: 0; font-size: 16px; letter-spacing: 0; }
.btn-bevel {
  height: 34px; cursor: pointer; color: #aaa;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  background: linear-gradient(180deg, #2a2a32, #16161b); border: 1px solid var(--line);
  border-radius: 2px; box-shadow: var(--bevel);
}
.btn-bevel:hover { color: var(--ink); }

/* ============ LOGIN ============ */
.login-view { height: 100vh; height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-window { width: min(480px, 100%); display: flex; flex-direction: column; }
.login-body {
  height: 660px; max-height: calc(100vh - 80px); padding: 0 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.login-brand { text-align: center; margin-bottom: 44px; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.4em; color: #666; margin-bottom: 14px; }
.login-brand .wordmark-sub { font-size: 16px; margin-top: 6px; color: #8a8a96; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 2; }
.login-form .btn-accent { height: 50px; letter-spacing: 0.22em; font-size: 14px; margin-top: 8px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -1px 0 rgba(0,0,0,0.3), 0 2px 0 rgba(0,0,0,0.6), 0 0 24px rgba(255,91,58,0.2); }
.login-error { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.05em; min-height: 14px; }
.login-error:not(:empty)::before { content: '› '; }
.login-foot { margin-top: 28px; font-family: var(--mono); font-size: 10px; color: #444; letter-spacing: 0.16em; text-align: center; }

/* ============ APP SHELL ============ */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.workspace { flex: 1; min-height: 0; display: flex; position: relative; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 264px; flex: none; padding: 20px 16px; display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--bg));
  border-right: 1px solid var(--line); box-shadow: inset -1px 0 0 rgba(255,255,255,0.04);
  z-index: 2;
}
.brand { position: relative; z-index: 2; }
.section-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--dim);
  text-transform: uppercase; margin-bottom: 8px; display: flex; justify-content: space-between;
}
.new-playlist { margin-top: 4px; position: relative; z-index: 2; }
.np-row { display: flex; gap: 6px; }

.playlist-list { list-style: none; display: flex; flex-direction: column; gap: 2px; position: relative; z-index: 2; }
.playlist-list li {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; cursor: pointer;
  border-radius: 2px; border-left: 2px solid transparent;
}
.playlist-list li::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: transparent; border: 1px solid #444;
}
.playlist-list li:hover { background: rgba(255,255,255,0.03); }
.playlist-list li.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(255,91,58,0.04));
  border-left-color: var(--accent); box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.playlist-list li.active::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 6px var(--accent); }
.playlist-list .name { flex: 1; font-size: 13px; color: #bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist-list li.active .name { color: #fff; font-weight: 600; }
.playlist-list .count {
  font-family: var(--mono); font-size: 11px; color: #666;
  background: rgba(0,0,0,0.4); padding: 1px 6px; border-radius: 2px;
}
/* rename + delete: always visible (hover-only is invisible on touch) */
.playlist-list .edit, .playlist-list .del {
  flex: none; background: transparent; border: 0; cursor: pointer;
  font-size: 12px; line-height: 1; padding: 4px; color: #5a5a5a;
}
.playlist-list .edit:hover, .playlist-list .edit:active { color: var(--ink); }
.playlist-list .del:hover, .playlist-list .del:active { color: var(--accent); }

.playlist-list li.empty { display: block; cursor: default; border-left: 0; padding: 18px 14px; }
.playlist-list li.empty::before { display: none; }
.playlist-list li.empty:hover { background: none; }

.sidebar-spacer { flex: 1; }
.session {
  font-family: var(--mono); font-size: 10px; color: var(--dim); line-height: 1.6;
  padding: 10px; background: rgba(0,0,0,0.3); border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); position: relative; z-index: 2;
}
.session-head { color: #888; }
.session-accent { color: var(--accent); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; padding: 24px 32px; display: flex; flex-direction: column; gap: 18px; overflow: hidden; }
.searchbar { display: flex; gap: 10px; flex: none; }
.search-wrap { flex: 1; position: relative; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-family: var(--mono); color: #666; font-size: 13px; pointer-events: none; }
.search-wrap .field { padding-left: 34px; }

/* Search results */
.search-results {
  flex: none; max-height: 300px; overflow-y: auto;
  background: linear-gradient(180deg, var(--panel), var(--bg));
  border: 1px solid var(--line); border-radius: 2px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.results-head {
  padding: 8px 14px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  color: #666; text-transform: uppercase; border-bottom: 1px solid var(--line);
}
.result { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid rgba(0,0,0,0.5); }
.result:last-child { border-bottom: 0; }
.result img, .result .art {
  width: 48px; height: 48px; flex: none; border-radius: 2px; object-fit: cover;
  background: linear-gradient(135deg, #3a2c4a, var(--accent));
  background-size: cover; background-position: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.result .meta { flex: 1; min-width: 0; }
.result .meta .t { font-weight: 600; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .meta .u { font-family: var(--mono); font-size: 11px; color: #888; margin-top: 2px; }
.result button {
  height: 32px; padding: 0 16px; cursor: pointer; flex: none;
  font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #fff; background: var(--grad-accent); border: 1px solid #8a2a08; border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -1px 0 rgba(0,0,0,0.3), 0 1px 0 rgba(0,0,0,0.5);
}
.result button:hover:not(:disabled) { filter: brightness(1.08); }
.result button.ripping {
  background: linear-gradient(180deg, #1d1d23, var(--bg)); color: var(--accent);
  border-color: var(--faint); cursor: default; display: flex; align-items: center; gap: 8px;
  box-shadow: none;
}
.result button.ripping::before {
  content: ''; width: 8px; height: 8px; border: 2px solid var(--accent);
  border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite;
}
.result button.added {
  background: linear-gradient(180deg, #1d2a1d, #0e150e); color: #9aff9a;
  border-color: #2a4a2a; cursor: default; box-shadow: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Playlist header */
.playlist-head { flex: none; display: flex; align-items: baseline; gap: 14px; }
.playlist-title {
  font-family: var(--mono); font-weight: 700; font-size: 32px; letter-spacing: -0.02em; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.playlist-title::after { content: '_'; color: var(--accent); }

/* Song list */
.song-list { list-style: none; display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; min-height: 0; }
.song-list li { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 2px; cursor: pointer; }
.song-list li:hover { background: rgba(255,255,255,0.03); }
.song-list .idx { width: 28px; flex: none; text-align: center; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.song-list .art {
  width: 36px; height: 36px; flex: none; border-radius: 2px;
  background: linear-gradient(135deg, #3a3a6a, #1a1a3a); box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.song-list .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.song-list .info .t { font-weight: 500; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-list .info .u { font-family: var(--mono); font-size: 11px; color: #888; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-list .dur { font-family: var(--mono); font-size: 12px; color: #888; flex: none; }
/* remove-track: always visible (hover-only is invisible on touch) */
.song-list .rm { background: transparent; border: 0; color: #555; font-size: 15px; cursor: pointer; padding: 4px 6px; flex: none; }
.song-list .rm:hover, .song-list .rm:active { color: var(--accent); }
.song-list li.playing { background: linear-gradient(90deg, rgba(255,91,58,0.16), rgba(255,91,58,0.02)); box-shadow: inset 2px 0 0 var(--accent); }
.song-list li.playing .info .t { color: var(--accent); font-weight: 600; }
/* EQ bars (injected into .idx for the playing row) */
.eq { display: inline-flex; gap: 2px; align-items: flex-end; justify-content: center; height: 16px; }
.eq i { width: 3px; background: var(--accent); animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(1) { height: 14px; animation-delay: -0.2s; }
.eq i:nth-child(2) { height: 8px; animation-delay: -0.5s; }
.eq i:nth-child(3) { height: 16px; animation-delay: 0s; }
.eq i:nth-child(4) { height: 6px; animation-delay: -0.35s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

/* Empty states */
.empty {
  border: 1px dashed var(--faint); border-radius: 2px; padding: 32px 20px; text-align: center;
  font-family: var(--mono); font-size: 13px; color: #888; line-height: 1.6;
  background: radial-gradient(60% 60% at 50% 40%, rgba(255,91,58,0.06), transparent 70%);
}
.empty strong { display: block; font-size: 22px; color: #fff; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.01em; }

/* ============ PLAYER BAR ============ */
.player-bar {
  flex: none; height: 92px; display: flex; align-items: center; gap: 20px; padding: 0 20px;
  background: linear-gradient(180deg, #1c1c22, var(--panel-2));
  border-top: 2px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 -8px 24px rgba(0,0,0,0.5);
  z-index: 4;
}
.np { display: flex; align-items: center; gap: 14px; width: 300px; min-width: 0; }
.np-art {
  width: 60px; height: 60px; flex: none; border-radius: 2px;
  background: linear-gradient(135deg, #3a2c4a, var(--accent));
  box-shadow: 0 4px 12px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
}
.np-meta { min-width: 0; }
.np-title { font-weight: 600; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-uploader { font-family: var(--mono); font-size: 11px; color: #888; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.transport { flex: 1; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.transport-btns { display: flex; align-items: center; gap: 18px; }
.ctl {
  width: 38px; height: 38px; flex: none; cursor: pointer; color: #ddd; font-size: 14px;
  font-family: var(--mono); display: grid; place-items: center;
  background: linear-gradient(180deg, #2a2a32, #16161b); border: 1px solid var(--line);
  border-radius: 50%; box-shadow: var(--bevel);
}
.ctl:hover { color: #fff; }
.ctl:active { transform: translateY(1px); }
.ctl-sm { width: 34px; height: 34px; font-size: 12px; }
.ctl-flat { background: transparent; border: 0; box-shadow: none; color: #888; }
.ctl.on { color: var(--accent); }
.decorative { opacity: 0.85; }

.play-btn {
  width: 52px; height: 52px; flex: none; cursor: pointer; display: grid; place-items: center;
  border: 1px solid #8a2a08; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #ffb088, #ff5b3a 50%, #b53a10 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), inset 0 -3px 6px rgba(0,0,0,0.4), 0 4px 12px rgba(255,91,58,0.4), 0 2px 0 rgba(0,0,0,0.5);
}
.play-btn:active { transform: translateY(1px); }
.play-btn .ico-pause { display: flex; gap: 4px; }
.play-btn .ico-pause i { width: 5px; height: 18px; background: #fff; }
.play-btn .ico-play { width: 0; height: 0; margin-left: 4px;
  border-left: 18px solid #fff; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.play-btn .ico-play { display: none; }
.play-btn.paused .ico-pause { display: none; }
.play-btn.paused .ico-play { display: block; }

.seek-row { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 620px; }
.time { font-family: var(--mono); font-size: 11px; color: #aaa; min-width: 36px; }
.time:first-child { text-align: right; }

/* Range sliders styled as recessed CRT bars with a metal nub */
.seek, .vol-slider {
  -webkit-appearance: none; appearance: none; height: 8px; border-radius: 2px; cursor: pointer;
  border: 1px solid var(--line); box-shadow: inset 0 1px 2px rgba(0,0,0,0.9);
}
.seek { --pct: 0%; flex: 1;
  background: linear-gradient(90deg, var(--accent) 0, var(--accent) var(--pct), var(--sunk) var(--pct), var(--sunk) 100%); }
.vol-slider { --pct: 100%; width: 80px; height: 6px;
  background: linear-gradient(90deg, #aaa 0, #aaa var(--pct), var(--sunk) var(--pct), var(--sunk) 100%); }
.seek::-webkit-slider-thumb, .vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff, #d8d8dc 50%, #888 100%);
  box-shadow: inset 0 -2px 3px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.7);
}
.vol-slider::-webkit-slider-thumb { width: 10px; height: 10px; }
.seek::-moz-range-thumb, .vol-slider::-moz-range-thumb {
  width: 14px; height: 14px; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff, #d8d8dc 50%, #888 100%);
  box-shadow: inset 0 -2px 3px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.7);
}

.player-extras { display: flex; align-items: center; gap: 14px; width: 200px; justify-content: flex-end; }
.vol { display: flex; align-items: center; gap: 6px; }
.vol-label { font-family: var(--mono); font-size: 11px; color: #888; }

/* ---------- Mobile bar / drawer ---------- */
.mobile-bar { height: 56px; align-items: center; gap: 12px; padding: 0 16px;
  background: linear-gradient(180deg, #16161b, var(--bg)); border-bottom: 1px solid var(--line); }
.hamburger { width: 40px; height: 36px; flex: none; display: grid; gap: 4px; align-content: center; justify-items: center;
  background: linear-gradient(180deg, #2a2a32, #16161b); border: 1px solid var(--line); border-radius: 2px;
  box-shadow: var(--bevel); cursor: pointer; padding: 0; }
.hamburger span { width: 16px; height: 2px; background: #ccc; }
.hamburger span:first-child { background: var(--accent); }
.drawer-backdrop { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .desktop-only { display: none; }
  .mobile-only { display: flex; }

  .sidebar {
    position: absolute; top: 0; left: 0; bottom: 0; width: 280px; max-width: 86vw;
    transform: translateX(-100%); transition: transform 0.22s ease; will-change: transform;
    box-shadow: 8px 0 32px rgba(0,0,0,0.6);
  }
  .app.drawer-open .sidebar { transform: translateX(0); }
  .app.drawer-open .drawer-backdrop {
    display: block; position: absolute; inset: 0; z-index: 1; background: rgba(0,0,0,0.55);
  }

  .main { padding: 16px; gap: 14px; }
  .playlist-title { font-size: 24px; }
  .search-results { max-height: 240px; }

  /* compact mobile player bar */
  .player-bar { height: 72px; gap: 12px; padding: 0 12px; }
  .np { width: auto; flex: 1; }
  .np-art { width: 46px; height: 46px; }
  .transport { flex: none; }
  .transport .seek-row { display: none; }
  .transport-btns { gap: 10px; }
  .ctl, .transport-btns .decorative { display: none; }
  .play-btn { width: 46px; height: 46px; }
  .player-extras { display: none; }

  /* tapping the mini now-playing opens the detail view */
  .np { cursor: pointer; }
}

/* ============ MOBILE PLAYER DETAIL (frame 05) ============ */
.player-detail {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(100%); transition: transform 0.28s ease; will-change: transform;
}
.player-detail.open { transform: translateY(0); }
.pd-glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 50% at 50% 30%, rgba(255,91,58,0.18), transparent 70%); }
@media (min-width: 721px) { .player-detail { display: none; } }

.pd-chip {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; cursor: pointer;
  color: #ccc; font-family: var(--mono); font-size: 14px;
  background: linear-gradient(180deg, #2a2a32, #16161b); border: 1px solid var(--line);
  border-radius: 2px; box-shadow: var(--bevel);
}
.pd-chip:active { transform: translateY(1px); }

.pd-header { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px; }
.pd-from { flex: 1; text-align: center; min-width: 0; }
.pd-from-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: #666; text-transform: uppercase; }
.pd-from-name { font-family: var(--mono); font-weight: 700; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pd-art-wrap { position: relative; z-index: 2; padding: 8px 30px 22px; }
.pd-art {
  position: relative; width: 100%; aspect-ratio: 1/1; border-radius: 6px; overflow: hidden;
  background: linear-gradient(135deg, #3a2c4a 0%, #7a3a6a 40%, var(--accent) 100%);
  box-shadow: 0 24px 48px rgba(255,91,58,0.35), 0 8px 24px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.1);
}
.pd-art-stripes { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 18px, rgba(255,255,255,0.04) 18px 19px); }
.pd-art-label { position: absolute; left: 24px; bottom: 20px; font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,0.75); letter-spacing: 0.16em; text-transform: uppercase; }

.pd-title-block { position: relative; z-index: 2; padding: 0 30px 14px; }
.pd-title { font-family: var(--sans); font-weight: 700; font-size: 26px; color: #fff; letter-spacing: -0.02em; line-height: 1.08;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pd-uploader { font-family: var(--mono); font-size: 13px; color: #aaa; margin-top: 8px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pd-seek { position: relative; z-index: 2; padding: 0 30px 14px; }
.seek-lg { width: 100%; height: 10px; }
.seek-lg::-webkit-slider-thumb { width: 18px; height: 18px; }
.seek-lg::-moz-range-thumb { width: 18px; height: 18px; }
.pd-times { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 11px; color: #888; }

.pd-transport { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 32px; padding: 10px 30px 6px; }
.pd-skip { width: 56px; height: 56px; background: transparent; border: 0; color: #ccc; font-size: 26px; cursor: pointer; font-family: var(--mono); }
.pd-skip:active { color: #fff; transform: translateY(1px); }
.play-btn-lg { width: 76px; height: 76px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), inset 0 -3px 6px rgba(0,0,0,0.4), 0 6px 24px rgba(255,91,58,0.5), 0 2px 0 rgba(0,0,0,0.6); }
.play-btn-lg .ico-pause i { width: 6px; height: 24px; }
.play-btn-lg .ico-play { margin-left: 5px; border-left-width: 24px; border-top-width: 14px; border-bottom-width: 14px; }

.pd-secondary { position: relative; z-index: 2; display: flex; justify-content: space-between; padding: 16px 38px 0; }
.pd-2nd { background: transparent; border: 0; cursor: pointer; color: #666;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.pd-2nd.on { color: var(--accent); }

.pd-upnext { position: relative; z-index: 2; margin-top: auto; padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); }
.pd-upnext-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: #666; text-transform: uppercase; margin-bottom: 8px; }
.pd-upnext-card { display: flex; align-items: center; gap: 10px; padding: 10px;
  background: linear-gradient(180deg, #16161b, var(--bg)); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06); }
.pd-upnext-card .art { width: 36px; height: 36px; flex: none; border-radius: 2px; background: linear-gradient(135deg, #3a3a6a, #1a1a3a); }
.pd-upnext-card .info { flex: 1; min-width: 0; }
.pd-upnext-card .t { font-weight: 600; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-upnext-card .u { font-family: var(--mono); font-size: 11px; color: #888; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-upnext-card .dur { font-family: var(--mono); font-size: 11px; color: #666; flex: none; }

/* ============ IMPORT FROM SCREENSHOT ============ */
.import-shot-btn { margin-top: 8px; }

.import-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.import-modal.hidden { display: none; }
.im-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.66); backdrop-filter: blur(2px); }
.import-window {
  position: relative; z-index: 1; width: min(680px, 100%);
  max-height: min(86vh, 860px); display: flex; flex-direction: column;
  border: 1px solid var(--line);
}
.import-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; background: var(--bg); }
.im-step.hidden { display: none; }

/* dropzone */
.im-drop {
  border: 1.5px dashed var(--faint); border-radius: 4px; padding: 36px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.im-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.im-drop-ico { font-size: 40px; line-height: 1; color: var(--accent); }
.im-drop-text { font-size: 15px; color: var(--ink); }
.im-drop-sub { font-family: var(--mono); font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.14em; }
.im-drop-note { font-family: var(--mono); font-size: 11px; color: var(--muted); max-width: 380px; line-height: 1.5; margin-top: 4px; }

/* working */
.im-spin { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 12px; font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: 0.08em; }
.im-spin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--faint); border-top-color: var(--accent); animation: im-spin 0.7s linear infinite; }
@keyframes im-spin { to { transform: rotate(360deg); } }

/* review */
.im-review-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.im-count { font-family: var(--mono); font-size: 12px; color: var(--ink); letter-spacing: 0.04em; }
.im-allrow { font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }

.im-rows { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.im-row {
  display: grid; grid-template-columns: auto 1fr 1.3fr; gap: 10px; align-items: center;
  padding: 8px; background: var(--panel); border: 1px solid var(--faint); border-radius: 3px;
}
.im-row.matching { opacity: 0.7; }
.im-chk { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.im-track { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.im-track .im-artist { color: var(--muted); }
.im-match { display: flex; align-items: center; gap: 8px; min-width: 0; }
.im-match .art { width: 30px; height: 30px; flex: none; border-radius: 2px; background-size: cover; background-position: center; background-color: var(--sunk); }
.im-cand { flex: 1; min-width: 0; }
.im-research { flex: none; width: 28px; height: 28px; cursor: pointer; color: var(--muted); background: linear-gradient(180deg, #2a2a32, #16161b); border: 1px solid var(--line); border-radius: 2px; box-shadow: var(--bevel); font-size: 13px; }
.im-research:hover { color: var(--accent); }
.im-status { flex: none; width: 16px; text-align: center; font-size: 13px; font-weight: 700; }
.im-status.ok { color: #3ddc84; }
.im-status.bad { color: var(--accent); }
.im-status.work { color: var(--muted); }

/* destination + actions */
.im-dest { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--faint); display: flex; flex-direction: column; gap: 10px; }
.im-radio { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink); }
.im-radio input[type="radio"] { accent-color: var(--accent); }
.im-radio .field-sm { flex: 1; max-width: 280px; }
.im-actions { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.im-actions .btn-accent { min-width: 150px; }
.im-progress { font-family: var(--mono); font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
  .im-row { grid-template-columns: auto 1fr; }
  .im-match { grid-column: 2; }
  .im-actions { flex-direction: column-reverse; align-items: stretch; }
  .im-actions .btn-accent { width: 100%; }
}
