/* jubeat 谱面确认 — design tokens
   void/cabinet ink amber hold flash muted pad */

:root {
  --void: #07090f;
  --cabinet: #11151e;
  --cabinet-2: #171c28;
  --line: #252c3c;
  --ink: #e6ebf5;
  --muted: #7a8499;
  --amber: #ffb020;
  --amber-dim: #a86f12;
  --hold: #5b8cff;
  --flash: #f2f7ff;
  --pad-idle: #1c2233;
  --pad-edge: #2a3348;
  --danger: #ff4d6a;
  --ok: #3ddc97;
  --bsc: #46B13E;
  --adv: #F6A300;
  --ext: #EB4C4E;
  --radius: 10px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Menlo", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  /* 手机端锁死页面缩放：pan-x pan-y 只保留滚动，掐掉 pinch-zoom 和双击缩放。
     iOS Safari 并不理会 viewport 里的 user-scalable=no，所以这里再压一层；
     双指手势另外由 app.js 的 gesturestart / 多指 touchmove 兜底。 */
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;   /* 横屏 / 窄屏时别自动放大字号 */
}

button, input, select {
  font: inherit;
  color: inherit;
}

#app {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  height: 100vh;
  /* iOS Safari：100vh 是「工具栏收起后」的高度，比看得见的区域高，
     于是整页能上下滑动、顶部的曲库栏会被顶出屏幕。dvh 才是当前可视高度。 */
  height: 100dvh;
  min-height: 0;
}

/* —— sidebar —— */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--cabinet);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 36px;
  height: 36px;
  padding: 4px;
  border-radius: 8px;
  background: #0a0d14;
  border: 1px solid var(--pad-edge);
}

.brand-mark span {
  border-radius: 3px;
  background: var(--pad-idle);
  box-shadow: inset 0 0 0 1px var(--pad-edge);
}

.brand-mark span:nth-child(1) {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255, 176, 32, 0.55);
}

.brand-text h1 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.brand-text p {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* 关于和友链：收纳在侧栏标题右侧，不增加标题高度。 */
.brand { position: relative; }
.brand-mark { flex: 0 0 36px; }
.brand-text { flex: 1 1 auto; min-width: 0; }
.brand-about { flex: 0 0 auto; }
.brand-about > summary {
  display: flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 8px; color: var(--muted); background: var(--cabinet-2);
  cursor: pointer; font-size: 12px; list-style: none;
}
.brand-about > summary::-webkit-details-marker { display: none; }
.brand-about[open] > summary, .brand-about > summary:hover { color: var(--ink); border-color: var(--muted); }
.brand-about > summary:focus-visible, .brand-about-panel a:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.brand-about-panel {
  position: absolute; z-index: 10; top: calc(100% - 8px); right: 12px;
  width: min(220px, calc(100% - 24px)); padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--cabinet);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}
.brand-about-title { padding: 3px 7px 7px; color: var(--ink); font-size: 12px; font-weight: 650; }
.brand-about-label { padding: 9px 7px 3px; color: var(--muted); font-size: 11px; }
.brand-about-panel a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 7px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 12px; }
.brand-about-panel a:hover { color: var(--amber); background: var(--cabinet-2); }
.brand-about-panel a span { color: var(--muted); }
@media (max-width: 380px) { .brand { gap: 8px; padding-left: 12px; padding-right: 12px; } }

/* 前端版本号：做成「标签」而不是标题的一部分 */
.brand-ver {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

/* 本地开发没有 ?v=：app.js 会留空，别在标题后面挂一个空框 */
.brand-ver:empty {
  display: none;
}

.brand-text .brand-credit {
  margin-top: 4px;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: none;
}

.search-block {
  display: grid;
  gap: 8px;
  padding: 12px 12px 8px;
}

.search-block input,
.search-block select,
.library-filter-row select,
.ctl select,
.ctl input[type="number"] {
  width: 100%;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}

.search-block input:focus-visible,
.search-block select:focus-visible,
.library-filter-row select:focus-visible,
.ctl select:focus-visible,
.ctl input:focus-visible,
button:focus-visible,
.song-item:focus-visible,
.diff-btn:focus-visible,
.pad:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.list-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 14px 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  color: var(--muted);
  cursor: pointer;
}

.ghost-btn:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.song-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 16px;
  overflow-y: auto;
  overflow-x: hidden;     /* 曲目项不横向撑开：竖着滚就行，别让人把列表左右拖走 */
  touch-action: pan-y;
  flex: 1;
  min-height: 0;
}

.song-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

/* 封面缩略图 */
.song-item .cv {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--cabinet-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}

.song-item .cv img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.song-item .cv.ph::after {
  content: "♪";
  font-size: 15px;
  color: var(--muted);
  opacity: 0.6;
}

.song-item .tx {
  min-width: 0;
  display: grid;
  /* 这一列必须写死 minmax(0, 1fr)：隐式列是 auto，而曲名和作曲都带 white-space: nowrap，
     它们的 min-content 就是整行文字的宽度，会把这一列撑到几百 px，整个列表跟着能横向拖 */
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}

/* 难度单独一行，避免版本/作曲/难度挤在一起把宽度搞乱 */
.song-item .lvset {
  display: flex;
  gap: 4px;
  min-width: 0;
}

.song-item:hover {
  background: var(--cabinet-2);
  border-color: var(--line);
}

.song-item.active {
  background: #1a2030;
  border-color: var(--amber-dim);
  box-shadow: inset 3px 0 0 var(--amber);
}

.song-item .st {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-item .sm {
  display: flex;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.song-item .sm .ver {
  color: var(--amber);
  opacity: 0.85;
  white-space: nowrap;
}

.song-item .sm .ar {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* —— stage —— */
.stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(255, 176, 32, 0.06), transparent 60%),
    radial-gradient(800px 400px at 80% 100%, rgba(91, 140, 255, 0.05), transparent 50%),
    var(--void);
}

.now-playing {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
  padding: 16px 24px 10px;
  align-items: stretch;
}

.cover-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  align-self: center;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cabinet-2);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* 第一列：版本 / 曲名 / 作曲 / 难度 */
.np-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.np-main h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 第二列：note 统计 + 连击 */
.np-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}


/* 难度配色 */
.lv-bsc { --lv-color: var(--bsc); }
.lv-adv { --lv-color: var(--adv); }
.lv-ext { --lv-color: var(--ext); }

.lv-chip {
  min-width: 26px;
  padding: 1px 6px;
  border-radius: 5px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #0c0f16;
  background: var(--lv-color, var(--muted));
  opacity: 0.92;
}

.diff-btn.lv-bsc.active { background: var(--bsc); border-color: var(--bsc); color: #0c0f16; }
.diff-btn.lv-adv.active { background: var(--adv); border-color: var(--adv); color: #0c0f16; }
.diff-btn.lv-ext.active { background: var(--ext); border-color: var(--ext); color: #0c0f16; }
.diff-btn.lv-bsc .lv, .diff-btn.lv-adv .lv, .diff-btn.lv-ext .lv { color: inherit; opacity: .8; }

.diff-btn.lv-bsc:not(.active) { border-color: rgba(70,177,62,.45); }
.diff-btn.lv-adv:not(.active) { border-color: rgba(246,163,0,.45); }
.diff-btn.lv-ext:not(.active) { border-color: rgba(235,76,78,.45); }

.cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.cover-wrap img.on { display: block; }

.cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
  background:
    linear-gradient(135deg, #151a26 0%, #0c1018 100%);
}

.cover-wrap img.on + .cover-fallback { display: none; }

.np-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--amber);
  text-transform: uppercase;
}

.np-artist {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.diff-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.diff-btn {
  background: var(--cabinet);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.diff-btn:hover { border-color: var(--muted); }

.diff-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #14100a;
  font-weight: 700;
}

.diff-btn .lv {
  opacity: 0.8;
  margin-left: 4px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 12px 18px;
}

.stat label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.stat value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

/* —— panel —— */
.panel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 4px 24px 6px;
}

.panel-bezel {
  position: relative;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(180deg, #151a26, #0c1018);
  border: 1px solid #2a3144;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  width: min(48vh, 460px, 58vw);
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 14px;
  background: #05070c;
  border: 1px solid #1a2030;
}

.panel-glow {
  pointer-events: none;
  position: absolute;
  inset: -2px;
  border-radius: 24px;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(242, 247, 255, 0.35), transparent 65%);
  transition: opacity 0.08s linear;
}

.panel-glow.on { opacity: 1; }

/* —— marker 动画画布（压在 pad 上面，pointer-events 关掉） —— */
.marker-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: 14px;
}

/* —— 选项区（可折叠）——
   桌面端也做成控制条上方的浮层：选项在正常流里时，展开/收起会让控制条
   高度差约 200px，中间的铺面跟着一高一矮，矮窗口下还会把面板挤到没地方放。 */
.options {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  z-index: 40;
  display: grid;
  gap: 8px;
  max-height: min(56vh, 420px);
  overflow-y: auto;
  padding: 14px 28px;
  background: var(--cabinet);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.65);
  transform: translateY(0);
  opacity: 1;
  transition: transform .2s ease, opacity .2s ease;
}

.transport.collapsed .options {
  transform: translateY(105%);
  opacity: 0;
  pointer-events: none;
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}

.ctl-vol input[type="range"] {
  width: 110px;
}

/* —— 物量显示 / 进度条 —— */
.chart-overview { position: relative; margin-top: 10px; }
.chart-overview .density-wrap { margin-top: 0; }
.timeline-wrap {
  height: 112px;
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a0d14;
}
.timeline-wrap.timeline-flattened { height: 136px; }
.timeline-wrap[hidden] { display: none; }
#timelineCanvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#timelineCanvas:active { cursor: grabbing; }
#timelineCanvas:focus-visible { outline: 2px solid #66dcff; outline-offset: -2px; }
@media (max-width: 600px) {
  .timeline-wrap { position: absolute; inset: 0; height: auto; margin: 0; z-index: 1; }
  .timeline-wrap.timeline-flattened { height: auto; }
  .timeline-open .density-wrap { visibility: hidden; pointer-events: none; }
}
.density-wrap {
  position: relative;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a0d14;
  /* 高度不写死：由 app-density.js 按官方物量图的比例算（宽 × 39/768 + 留白 + 时间刻度） */
  height: auto;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}

#densityCanvas {
  display: block;
  width: 100%;
  height: 36px;   /* 兜底：脚本没跑起来时用这个高度，正常由内联样式覆盖 */
}

.density-hud {
  position: absolute;
  right: 8px;
  top: 2px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}

.sidebar-toggle { display: none; }

.ctl-wide select { min-width: 150px; }

/* marker 素材还在下载时的提示：「选了没反应」和「在等贴图」要分得出来。
   用 [hidden] 兜住 —— .ctl 是 inline-flex，直接给 display 会顶掉 hidden 行为。 */
.ctl-hint {
  font-size: 11px;
  color: var(--amber, #f0b429);
  white-space: nowrap;
}

.ctl-hint[hidden] { display: none; }

.pad {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--pad-edge);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--pad-idle);
  cursor: pointer;
  transition: background 0.04s linear, border-color 0.04s linear, box-shadow 0.04s linear;
  overflow: hidden;
  padding: 0;
}

.pad .idx {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-family: var(--mono);
  font-size: 9px;
  color: rgba(122, 132, 153, 0.55);
}

.pad::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.85), transparent 70%);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.12s ease-out, transform 0.18s ease-out;
}

.pad.hit {
  background: linear-gradient(180deg, #ffffff, #d7e6ff);
  border-color: #ffffff;
  /* 只保留「白」这一圈：以前第三层是 48px 的蓝色散光（rgba(120,180,255,.35)），
     而 .pad 不在任何 overflow 容器里，它会从四角的格子一路透到面板外面 ——
     用户看到的那圈「面板周围的蓝色光晕」就是它。 */
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4),
    0 0 24px rgba(242, 247, 255, 0.75);
}

.pad.hit::after {
  opacity: 1;
  transform: scale(1);
}

.pad.armed {
  /* slight pre-glow shortly before note */
  border-color: rgba(255, 176, 32, 0.55);
}

.pad.click {
  animation: padClick 0.18s ease-out;
}

@keyframes padClick {
  0% { background: #fff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
  100% { background: var(--pad-idle); box-shadow: none; }
}


/* —— transport —— */
.transport {
  position: relative;
  z-index: 6;              /* 面板 canvas 是 z-index:2，控件要压在它上面 */
  min-width: 0;
  /* 必须 visible：加载进度是浮在控制条上方的浮层（pop），裁掉就看不见了 */
  overflow: visible;
  padding: 12px 28px 18px;
  border-top: 1px solid var(--line);
  background: rgba(17, 21, 30, 0.72);
  backdrop-filter: blur(8px);
}

.transport-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* —— 音源加载进度（换歌 / 缓冲） —— */
.load-row {
  /* 浮层：挂在控制条上方，**不占布局**。
     早先是放在流里的，出现/消失会把下面的东西顶来顶去，整页高度一直变。 */
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 45;             /* 要压过手机上那个选项浮层（40） */
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, calc(100vw - 32px));
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  pointer-events: none;    /* 纯提示，别挡住面板 / 物量条的点击 */
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.load-row[hidden] { display: none; }

.load-label {
  flex-shrink: 0;
  color: var(--ink);
  white-space: nowrap;
}

.load-bar {
  position: relative;
  flex: 1;
  min-width: 60px;
  height: 6px;
  border-radius: 99px;
  background: var(--void);
  border: 1px solid var(--line);
  overflow: hidden;
}

.load-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--amber-dim), var(--amber));
  transition: width 0.18s linear;
}

/* 总长度未知（服务器没给 Content-Length）：来一条来回跑的条子 */
.load-row.indeterminate .load-fill {
  width: 38%;
  transition: none;
  animation: load-sweep 1.1s ease-in-out infinite;
}

@keyframes load-sweep {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(370%); }
}

.load-pct {
  flex-shrink: 0;
  min-width: 46px;
  text-align: right;
  color: var(--amber);
}

/* 播放按钮上的加载环：按钮还能点（会排队等数据），但一眼看得出在加载 */
.play-btn { position: relative; }

.play-btn.is-loading::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 15px;
  border: 2px solid rgba(255, 176, 32, 0.2);
  border-top-color: var(--amber);
  animation: play-spin 0.9s linear infinite;
  pointer-events: none;
}

@keyframes play-spin {
  to { transform: rotate(360deg); }
}

.spacer { flex: 1; }

.icon-btn,
.play-btn {
  border: 1px solid var(--line);
  background: var(--cabinet);
  border-radius: 10px;
  cursor: pointer;
  height: 40px;
  min-width: 40px;
}

.icon-btn:hover { border-color: var(--muted); }

/* A–B 段落循环：没打点=普通按键，只打了 A=琥珀框，A、B 都有=绿框常亮 */
.ab-btn {
  font: 700 12px var(--mono);
  letter-spacing: 0.04em;
  padding: 0 10px;
}
.ab-btn.armed {
  border-color: var(--amber);
  color: var(--amber);
}
.ab-btn.on {
  border-color: var(--ok);
  color: var(--ok);
  background: rgba(61, 220, 151, 0.14);
}

.play-btn {
  width: 52px;
  background: var(--amber);
  border-color: var(--amber);
  color: #14100a;
  font-size: 16px;
  font-weight: 700;
}

.play-btn:hover {
  filter: brightness(1.06);
}

/* 音源没加载完：按钮禁用（还在转圈的 .is-loading 环照常显示） */
.play-btn:disabled {
  cursor: progress;
  opacity: 0.55;   /* 用透明度而不是去色：外圈那个「加载中」的环要保持琥珀色 */
}

.time-block {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  margin-left: 6px;
}

.time-sep { color: var(--muted); margin: 0 4px; }

.ctl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.ctl select,
.ctl input[type="number"] {
  width: auto;
  min-width: 72px;
  padding: 6px 8px;
  background: var(--void);
}

.ctl input[type="number"] { width: 72px; }

.ctl input[type="color"] {
  width: 38px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--void);
  cursor: pointer;
}

.ctl input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.ctl input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

/* 同押光晕的配色对预览：两个色块，一眼看出主色 / 副色对比够不够 */
.pair-chips {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pair-chips i {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.pair-chips i:last-child { border-radius: 50%; }

.ctl .unit {
  font-family: var(--mono);
  font-size: 11px;
}

.ctl.checkbox {
  user-select: none;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
  height: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1a2030;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 50;
  max-width: min(90vw, 480px);
}

.toast.err { border-color: var(--danger); }

.empty-list {
  padding: 24px 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pad, .pad::after, .panel-glow, .diff-btn, .pad.click {
    transition: none !important;
    animation: none !important;
  }
  /* 加载指示保留，但放慢（它是状态提示，不是装饰，不能直接关掉） */
  .play-btn.is-loading::after,
  .load-row.indeterminate .load-fill { animation-duration: 2.6s; }
}

/* —— 抽屉遮罩 —— */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

/* 手机上用来打开曲库的整条按钮：桌面端不显示（桌面端曲库常驻在左边） */
.mobile-bar { display: none; }

/* —— 移动端：曲库变抽屉，面板占满，控件加大 —— */
@media (max-width: 900px) {
  /* 抽屉默认收起，这个按钮是唯一入口 */
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    /* 顶部要避开刘海/状态栏（viewport-fit=cover 时页面会伸到状态栏下面） */
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--cabinet);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  .mobile-bar:active { background: var(--cabinet-2); }
  .mobile-bar-icon { font-size: 18px; line-height: 1; color: var(--ink); }
  .mobile-bar-title {
    font-size: 12px;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
  }
  .mobile-bar-hint {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--amber);
  }
  .stage { grid-template-rows: auto auto minmax(0, 1fr) auto; }

  #app {
    grid-template-columns: 1fr;
    /* 窄屏只有 .stage 一个在流里的子元素（侧栏是 fixed，不占格）。
       以前写成 auto + 1fr 两行，stage 落在 auto 行、第二行空着，
       于是整块内容缩在顶部、下面留一大片黑（iPad 竖屏特别明显）。 */
    grid-template-rows: minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;      /* iOS：按当前可视高度，工具栏弹出/收起都不会把页面顶出屏幕 */
    min-height: 0;
    overflow: hidden;
    overflow: clip;      /* 禁止一切滚动（含 scrollIntoView 带动的），避免整页被顶掉 */
  }
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(88vw, 360px);
    z-index: 30;
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
    transition: transform 0.2s ease;
  }
  .sidebar.hidden { transform: translateX(-104%); }
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    min-width: 34px;
  }

  .stage .now-playing {
    /* 封面利用两行信息的现有高度，不能反过来撑高顶部。 */
    grid-template-columns: clamp(76px, 28vw, 128px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 5px 10px;
    padding: 8px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
    align-items: center;
  }
  .stage .cover-wrap {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    grid-row: span 2;
    align-self: stretch;
    contain: size;
    overflow: visible;
    background: none;
    border: 0;
    box-shadow: none;
  }
  .stage .cover-wrap img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  }
  .stage .cover-fallback {
    width: 52px;
    height: 52px;
    margin: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .np-main { gap: 1px; }
  .np-main h2 { font-size: 16px; }
  .np-kicker { font-size: 9px; letter-spacing: 0.1em; }
  .np-artist { font-size: 11px; margin-bottom: 0; }
  .diff-row { gap: 6px; margin-bottom: 0; }
  .stage .diff-row { gap: 4px; flex-wrap: nowrap; }
  .stage .diff-btn { padding-inline: clamp(4px, 1.5vw, 10px); white-space: nowrap; }
  .diff-btn { padding: 3px 10px; font-size: 11px; }
  .np-side { grid-column: 2; }
  /* 四个统计压成一行，别占两行 */
  .np-side .stat-row {
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    gap: 0 clamp(6px, 2vw, 14px);
  }
  .stat label { font-size: 9px; letter-spacing: 0.08em; }
  .stat value { font-size: 14px; line-height: 1.15; }

  .panel-stage { padding: 2px 12px 4px; }

  /* iPhone 底部有 home indicator：把播放控制往上抬一点，别被盖住 */
  .transport { padding: 8px 12px max(10px, env(safe-area-inset-bottom)); }
  .transport { overflow: visible; }   /* 浮层要能伸到控件上方，别被 overflow 裁掉 */
  .transport-top { gap: 8px; }
  .load-row { font-size: 9px; padding: 6px 12px; }
  .load-pct { min-width: 40px; }
  .icon-btn, .play-btn { height: 44px; min-width: 44px; }
  .play-btn { width: 58px; }
  .time-block { font-size: 12px; }
  /* 物量条的高度不在这里写死：它跟着条子宽度走（见 app-density.js 的 densityHeight） */
  .opt-row { gap: 10px; }
  .ctl select, .ctl input[type="number"] { padding: 8px 10px; }

  /* 手机上选项做成底部浮层：不挤压面板，展开时可以内部滚动 */
  .options {
    position: absolute;
    left: 0;                /* 绝对定位的包含块是 padding box，这里是全宽 */
    right: 0;
    bottom: 100%;           /* 贴在播放控制上方，控制条始终可见 */
    z-index: 40;
    max-height: 56vh;
    overflow-y: auto;
    padding: 14px;
    background: var(--cabinet);
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.65);
    transform: translateY(0);
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .transport.collapsed .options {
    max-height: 56vh;
    transform: translateY(105%);
    opacity: 0;
  }
}

/* —— 超窄屏：再压一档 —— */
@media (max-width: 560px) {
  .panel-bezel { padding: 10px; border-radius: 16px; }   /* 小屏再省一圈，把高度留给面板 */
  .np-main h2 { font-size: 15px; }
  .panel-inner { width: min(96vw, 380px); }
}

/* —— 特别矮的屏（老机型、或浏览器工具栏吃掉很多高度）：再压一档，保证面板不被裁 —— */
@media (max-height: 620px) {
  .mobile-bar { padding: calc(4px + env(safe-area-inset-top)) 12px 4px; }
  .mobile-bar .icon-btn { height: 34px; min-width: 34px; }
  .np-kicker { display: none; }        /* 版本那行省掉 */
  .np-artist { display: none; }        /* 作曲那行省掉 */
  .diff-btn { padding: 2px 9px; font-size: 10px; }
  .transport { padding: 6px 10px max(8px, env(safe-area-inset-bottom)); }
}

.song-list.virtual { overflow-anchor: none; }
.song-list.virtual .song-row { height: 80px; }
.song-list.virtual .song-item { height: 76px; }
.song-list .song-spacer { pointer-events: none; padding: 0; margin: 0; }

.brand-source a { color: inherit; font-weight: 600; text-decoration: none; }
.brand-source a:hover { color: var(--text); text-decoration: underline; }

/* Compact settings keep labels beside controls and wrap by available width. */
.options {
  display: block;
  max-height: min(60vh, 420px);
  max-height: min(60dvh, 420px);
  padding: 4px 14px 8px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.settings-group + .settings-group { border-top: 1px solid var(--line); }
.settings-group > summary {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 34px; padding: 6px 2px;
  color: var(--ink); font-size: 12px; font-weight: 600;
  list-style: none; cursor: pointer; user-select: none;
}
.settings-group > summary::-webkit-details-marker { display: none; }
.settings-group > summary::after {
  content: ""; width: 6px; height: 6px; margin: 0 5px 3px 10px;
  border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.settings-group[open] > summary { color: var(--amber); }
.settings-group[open] > summary::after { margin-bottom: -3px; transform: rotate(225deg); }
.settings-group > summary:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; border-radius: 6px; }
.settings-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 2px 2px 10px; }
.settings-fields, .settings-switches { display: contents; }
.settings-fields > .ctl { display: inline-flex; align-items: center; flex: 0 1 244px; gap: 7px; min-width: 0; max-width: 100%; }
.settings-fields > .setting-wide { flex-basis: 450px; }
.setting-label { flex-shrink: 0; font-size: 12px; }
.setting-control { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; }
.options .setting-control > select, .options .setting-control > input[type="number"] {
  width: 100%; min-width: 0; min-height: 30px; padding: 5px 7px; font-size: 12px; text-overflow: ellipsis;
}
.options .setting-control > .unit { flex-shrink: 0; min-width: 20px; font-size: 11px; }
.options .setting-control > [hidden] { display: none; }
.options .setting-control > input[type="color"] { width: 46px; height: 30px; }
.settings-switches .checkbox { min-height: 30px; line-height: 1.35; font-size: 12px; }
.settings-switches input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; margin: 0 2px 0 0; accent-color: var(--amber); }
.settings-subtitle { display: none; }
@media (max-width: 900px) {
  .options, .transport.collapsed .options { max-height: 58vh; max-height: 58dvh; }
  .options { padding: 3px 10px 6px; }
}
@media (max-width: 560px) {
  .settings-body { gap: 6px 10px; padding-bottom: 8px; }
  .settings-fields > .ctl { flex: 0 0 calc((100% - 10px) / 2); gap: 5px; }
  .settings-fields > .setting-wide { flex-basis: 100%; }
  .setting-label { max-width: 5em; font-size: 11px; line-height: 1.25; }
  .options .setting-control > select, .options .setting-control > input[type="number"] { min-height: 34px; padding: 5px; font-size: 12px; }
  .settings-switches .checkbox { min-height: 32px; }
  .settings-group > summary { min-height: 36px; }
}

/* The picker occupies the same scrolling area as the song list. */
.marker-library-toggle {
  min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--void); color: var(--muted); font-size: 12px; cursor: pointer;
}
.marker-library-toggle:hover, .marker-library-toggle[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); }

.hot-songs-toggle {
  min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--void); color: var(--muted); font-size: 12px; cursor: pointer;
}
.hot-songs-toggle:hover, .hot-songs-toggle[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); }
.hot-songs-toggle:disabled { opacity:.45; cursor:progress; }
.hot-songs-toggle[hidden] { display: none; }
.song-item .hot-rank {
  display: inline-block; min-width: 2.2em; margin-right: 5px; color: var(--amber);
  font: 700 11px var(--mono); font-variant-numeric: tabular-nums;
}

.song-list[hidden], .marker-list[hidden] { display: none; }
.marker-list {
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 2px;
  list-style: none; margin: 0; padding: 0 8px 16px; overflow-y: auto; overflow-x: hidden;
  flex: 1; min-height: 0; overscroll-behavior: contain; touch-action: pan-y;
}
.marker-list > li { min-width: 0; }
.marker-list .empty-list { grid-column: 1 / -1; }
.marker-card {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: auto auto auto;
  align-items: center; gap: 2px 10px; width: 100%; min-height: 76px; text-align: left;
  padding: 8px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--ink); cursor: pointer;
}
.marker-card:hover { border-color: var(--muted); }
.marker-card.active { border-color: var(--amber); background: #ffb41310; }
.marker-picture { display: grid; grid-row: 1 / span 3; place-items: center; width: 56px; height: 56px; border-radius: 6px; background: #1a2030; }
.marker-picture img { width: 56px; height: 56px; object-fit: contain; }
.marker-picture img[hidden] { display: none; }
.marker-picture.ph::after { content: "截图暂不可用"; font-size: 10px; color: var(--muted); }
.marker-name, .marker-caption { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%; line-height: 1.35; overflow-wrap: anywhere; }
.marker-name { align-self: end; font-size: 13px; font-weight: 600; }
.marker-caption { align-self: start; font-size: 11px; color: var(--muted); }
.marker-release { grid-column: 2; min-width: 0; font-size: 11px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.marker-none { grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 6px; }
.marker-none i { width: 100%; height: 100%; border: 1px solid #49536b; border-radius: 3px; }

.cv img[hidden] { display: none; }

/* Keep all transport actions, including preview, on one mobile row. */
@media (max-width: 560px) {
  .transport-top { flex-wrap: nowrap; gap: 4px; }
  .transport-top > .icon-btn { width: 36px; min-width: 36px; height: 40px; flex: 0 0 36px; }
  .transport-top > .play-btn { width: 42px; min-width: 42px; height: 40px; flex: 0 0 42px; }
  .transport-top > .ab-btn { padding: 0; font-size: 11px; }
  .transport-top > .time-block { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; margin: 0; text-align: right; font-size: 10px; line-height: 1.2; white-space: nowrap; }
  .transport-top .time-sep, .transport-top > .spacer { display: none; }
  .transport-top > #btnPreview { padding: 0; font-size: 0; }
  #btnPreview::before { content: "试听"; font-size: 11px; }
  #btnPreview[aria-pressed="true"]::before { content: "停听"; }
  #btnPreview[aria-busy="true"]::before { content: "载入"; }
}
#btnPreview[hidden] { display: none; }

.settings-switches .checkbox[hidden] { display: none; }

/* Song actions sit within the existing heading; no extra mobile transport row. */
.np-main { position: relative; }
.stage .np-main { padding-right: 66px; }
.stage .np-kicker { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.np-actions { position:absolute; top:0; right:0; z-index:2; display:grid; gap:4px; }
.song-share-btn { width:58px; height:26px; padding:0; border:1px solid var(--line); border-radius:7px; background:var(--cabinet); color:var(--muted); font:10px var(--font); cursor:pointer; }
.song-share-btn:disabled { opacity:.4; cursor:default; }
.song-share-btn:hover:not(:disabled), .song-share-btn:focus-visible { color:var(--amber); border-color:var(--amber); }
.share-dialog { max-width:min(90vw,480px); padding:20px; border:1px solid var(--line); border-radius:14px; background:var(--cabinet); color:var(--ink); }
.share-dialog::backdrop { background:rgba(0,0,0,.65); }
.share-dialog h3 { margin:0 0 8px; }
.share-dialog p { font-size:13px; color:var(--muted); }
.share-dialog textarea { width:100%; min-width:0; margin-bottom:12px; background:var(--void); color:var(--ink); border:1px solid var(--line); border-radius:6px; padding:8px; }
.share-dialog button { float:right; padding:6px 16px; cursor:pointer; }
.share-dialog .share-copy { margin-right:8px; }

.share-dialog[open] { position:fixed; inset:0; margin:auto; z-index:100; }
.share-dialog:not([open]) { display:none; }

.story-dialog {
  width:min(92vw,720px);
  max-height:min(82vh,760px);
  max-height:min(82dvh,760px);
  padding:0;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--cabinet);
  color:var(--ink);
  box-shadow:0 24px 80px rgba(0,0,0,.55);
}
.story-dialog::backdrop { background:rgba(0,0,0,.72); backdrop-filter:blur(3px); }
.story-dialog[open] { position:fixed; inset:0; z-index:110; margin:auto; display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
.story-dialog:not([open]) { display:none; }
.story-dialog-head { min-width:0; display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:18px 20px 14px; border-bottom:1px solid var(--line); background:var(--cabinet-2); }
.story-dialog-title { min-width:0; }
.story-dialog-title h2 { margin:0; font-size:20px; line-height:1.25; overflow-wrap:anywhere; }
.story-dialog-title p { max-width:100%; margin:4px 0 0; overflow:hidden; color:var(--muted); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.story-close { flex:0 0 auto; min-height:32px; padding:0 13px; border:1px solid var(--line); border-radius:8px; background:var(--cabinet); color:var(--muted); font:12px var(--font); cursor:pointer; }
.story-close:hover, .story-close:focus-visible { color:var(--amber); border-color:var(--amber); }
.story-dialog-body { min-width:0; min-height:0; overflow:auto; overscroll-behavior:contain; padding:18px 20px 24px; }
.story-document, .story-section { min-width:0; max-width:100%; }
.story-document + .story-document { margin-top:24px; padding-top:22px; border-top:1px solid var(--line); }
.story-document h3 { margin:0 0 12px; font-size:17px; }
.story-version { display:inline-block; margin-bottom:10px; padding:3px 8px; border:1px solid var(--line); border-radius:999px; color:var(--amber); font-size:10px; }
.story-facts { display:grid; grid-template-columns:max-content minmax(0,1fr); gap:7px 14px; margin:0 0 18px; padding:12px 14px; border:1px solid var(--line); border-radius:10px; background:rgba(0,0,0,.14); }
.story-facts dt { color:var(--muted); font-size:12px; }
.story-facts dd { margin:0; font-size:12px; line-height:1.55; overflow-wrap:anywhere; }
.story-section + .story-section { margin-top:16px; }
.story-section h4 { margin:0 0 6px; color:var(--amber); font-size:13px; }
.story-copy { min-width:0; max-width:100%; margin:0; color:var(--ink); font-size:13px; line-height:1.72; overflow-wrap:anywhere; white-space:pre-wrap; }

@media (max-width:560px) {
  .np-actions { gap:3px; }
  .song-share-btn { width:56px; height:24px; border-radius:6px; font-size:9px; }
  .story-dialog { width:calc(100vw - 20px); max-height:calc(100vh - 20px); max-height:calc(100dvh - 20px); border-radius:12px; }
  .story-dialog-head { padding:14px 14px 11px; }
  .story-dialog-title h2 { font-size:17px; }
  .story-close { min-height:30px; padding:0 10px; }
  .story-dialog-body { padding:14px 14px max(20px,env(safe-area-inset-bottom)); }
  .story-facts { grid-template-columns:1fr; gap:3px; padding:10px 12px; }
  .story-facts dd + dt { margin-top:5px; }
  .story-copy { font-size:12px; line-height:1.66; }
}

/* Touch targets stay in a compact right-hand column and must not add height. */
@media (pointer: coarse) {
  .np-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
    gap: 5px;
    width: 58px;
  }
  .np-actions > .song-share-btn { width: 58px; height: 34px; padding: 0; border-radius: 8px; color: var(--ink); font: 600 11px var(--font); }
  .stage .np-main { padding-right: 66px; }
}

/* Secondary information stays in the sidebar, outside the chart layout. */
.visitor-count { margin: 0 7px 6px; padding: 0 0 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.visitor-count[hidden] { display: none; }

/* Keep transport text changes local to the clock, independent of marker frames. */
.time-block { display: inline-flex; align-items: baseline; contain: layout style; font-variant-numeric: tabular-nums; }
#timeNow, #timeTotal { display: inline-block; min-width: 8ch; text-align: right; }

/* Library filters stay visible below the search and list tools. */
.search-block { padding: 10px 12px 4px; flex: 0 0 auto; }
.library-search-row { display: grid; grid-template-columns: minmax(0, 1fr); }
.library-search-row > input { min-width: 0; width:100%; height:40px; font-size:13px; }
.library-filter-row { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr) minmax(0,1fr) auto; align-items:end; gap:6px; padding:2px 12px 10px; flex:0 0 auto; }
.library-filter-row > label { min-width:0; display:grid; gap:4px; font-size:11px; color:var(--muted); }
.library-filter-row select { width:100%; min-width:0; height:36px; padding:0 5px; font-size:12px; }
.library-filter-row .ghost-btn { height:36px; min-height:36px; padding:0 6px; font-size:11px; white-space:nowrap; }
.list-meta { gap:6px; min-height:38px; flex:0 0 auto; padding:3px 12px 6px; }
.list-meta > #listCount { flex:1; min-width:0; white-space:nowrap; font-size:10px; }
.list-meta > button { flex:0 0 auto; white-space:nowrap; font-size:11px; min-height:30px; padding:4px 7px; border-radius:6px; }

/* 浏览器主题：配色与装饰素材来自对应版本，默认主题保持现有外观。 */
:root[data-theme] .stage {
  background-color: var(--void);
  background-image: radial-gradient(ellipse at 80% 30%, rgba(var(--theme-rgb), .20), transparent 52%),
    linear-gradient(90deg, rgba(7, 9, 15, .94), rgba(7, 9, 15, .65)), var(--theme-art);
  background-position: center, center, right 6% center;
  background-repeat: no-repeat;
  background-size: auto, auto, var(--theme-art-size);
}
/* Keep each version's motif visible above the playfield on narrow screens. */
:root[data-theme] .now-playing { position: relative; isolation: isolate; }
:root[data-theme] .now-playing::after {
  content: ""; position: absolute; inset: 0 0 0 auto; width: min(42%, 260px);
  background: var(--theme-art) right center / contain no-repeat;
  opacity: .24; pointer-events: none; z-index: -1;
}
:root[data-theme] .brand-mark span:nth-child(1) { box-shadow: 0 0 12px rgba(var(--theme-rgb), .65); animation: theme-accent 4s ease-in-out infinite; }
@keyframes theme-accent { 50% { box-shadow: 0 0 18px rgba(var(--theme-rgb), .85); } }
@media (prefers-reduced-motion: reduce) { :root[data-theme] .brand-mark span:nth-child(1) { animation: none; } }
:root[data-theme="jubeat"] { --amber:#7d9dff; --amber-dim:#4057ae; --theme-rgb:91,125,255; --cabinet:#0c1021; --cabinet-2:#151b30; --line:#273354; --theme-art:url("theme-art-v1-jubeat.webp"); --theme-art-size:cover; }
:root[data-theme="ripples"] { --amber:#b6e863; --amber-dim:#668f26; --theme-rgb:141,205,63; --cabinet:#111a16; --cabinet-2:#17251b; --line:#324631; --theme-art:url("theme-art-v1-ripples.webp"); --theme-art-size:cover; }
:root[data-theme="knit"] { --amber:#c9ed42; --amber-dim:#7b9c14; --theme-rgb:190,235,46; --cabinet:#171b13; --cabinet-2:#21291a; --line:#3e4c28; --theme-art:url("theme-art-v1-knit.webp"); --theme-art-size:48% auto; }
:root[data-theme="copious"] { --amber:#ffca42; --amber-dim:#aa791c; --theme-rgb:247,144,54; --cabinet:#1a151c; --cabinet-2:#281d29; --line:#503446; --theme-art:url("theme-art-v1-copious.webp"); --theme-art-size:42% auto; }
:root[data-theme="saucer"] { --amber:#ffb365; --amber-dim:#ae6d32; --theme-rgb:255,171,101; --cabinet:#1a1718; --cabinet-2:#292120; --line:#473730; --theme-art:url("theme-art-v1-saucer.webp"); --theme-art-size:cover; }
:root[data-theme="fulfill"] { --amber:#f5bd71; --amber-dim:#a77a37; --theme-rgb:229,162,87; --cabinet:#1b181b; --cabinet-2:#2a232a; --line:#4c3b46; --theme-art:url("theme-art-v1-fulfill.webp"); --theme-art-size:55% auto; }
:root[data-theme="prop"] { --amber:#ff6bb6; --amber-dim:#a73d7c; --theme-rgb:255,82,164; --cabinet:#1c1421; --cabinet-2:#2a1b2c; --line:#513149; --theme-art:url("theme-art-v1-prop.webp"); --theme-art-size:24% auto; }
:root[data-theme="qubell"] { --amber:#83ceff; --amber-dim:#4186b9; --theme-rgb:102,186,240; --cabinet:#111a29; --cabinet-2:#19263b; --line:#304561; --theme-art:url("theme-art-v1-qubell.webp"); --theme-art-size:50% auto; }
:root[data-theme="clan"] { --amber:#8de9d8; --amber-dim:#459c91; --theme-rgb:83,204,185; --cabinet:#101c25; --cabinet-2:#192a36; --line:#314a56; --theme-art:url("theme-art-v1-clan.webp"); --theme-art-size:50% auto; }
:root[data-theme="jubeat2020"] { --amber:#85ead2; --amber-dim:#398c82; --theme-rgb:85,230,191; --cabinet:#151a24; --cabinet-2:#202933; --line:#3d5055; --theme-art:url("theme-art-v1-jubeat2020.webp"); --theme-art-size:cover; }
:root[data-theme="festo"] { --amber:#c7e67d; --amber-dim:#77993e; --theme-rgb:168,209,89; --cabinet:#182016; --cabinet-2:#242e20; --line:#40523a; --theme-art:url("theme-art-v1-festo.webp"); --theme-art-size:38% auto; }
:root[data-theme="ave"] { --amber:#74e6ef; --amber-dim:#348d99; --theme-rgb:67,210,225; --cabinet:#101e27; --cabinet-2:#192e37; --line:#304d55; --theme-art:url("theme-art-v1-ave.webp"); --theme-art-size:cover; }
:root[data-theme="beyond"] { --amber:#ffc578; --amber-dim:#ae7b37; --theme-rgb:238,163,65; --cabinet:#201815; --cabinet-2:#30231c; --line:#503b2d; --theme-art:url("theme-art-v1-beyond.webp"); --theme-art-size:cover; }
