/* 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: #3ddc97;
  --adv: #ffb020;
  --ext: #ff4d6a;
  --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;
}

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-gh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--cabinet-2);
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}

.brand-gh:hover,
.brand-gh:focus-visible {
  color: var(--ink);
  border-color: var(--muted);
}

.brand-gh svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.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,
.ctl select,
.ctl input[type="number"] {
  width: 100%;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 8px;
}

.filter-row select { min-width: 0; }

.search-block input:focus-visible,
.search-block 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 {
  /* 上千行时浏览器只为接近可视区的行做完整布局/绘制；
     老浏览器忽略这三条，退化回现在的完整列表。 */
  content-visibility: auto;
  contain-intrinsic-size: auto 68px;
  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;
}

.song-item .sm .ch {
  margin-left: auto;
  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(61,220,151,.45); }
.diff-btn.lv-adv:not(.active) { border-color: rgba(255,176,32,.45); }
.diff-btn.lv-ext:not(.active) { border-color: rgba(255,77,106,.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-info h2 {
  margin: 4px 0 2px;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.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;
}

/* —— marker 控制条 —— */
.marker-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

/* —— 选项区（可折叠）——
   桌面端也做成控制条上方的浮层：选项在正常流里时，展开/收起会让控制条
   高度差约 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;
}

/* —— 物量显示 / 进度条 —— */
.density-wrap {
  position: relative;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a0d14;
  height: 36px;
  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; }

.anchor-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 0;
}

.anchor-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.anchor-strip {
  display: flex;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--void);
  scrollbar-width: thin;
}

.anchor-strip button {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 5px;
  background-repeat: no-repeat;
  background-color: #0a0d14;
  cursor: pointer;
  opacity: 0.55;
}

.anchor-strip button:hover { opacity: 0.85; }

.anchor-strip button.anchor {
  opacity: 1;
  border-color: var(--amber);
  box-shadow: 0 0 0 1px rgba(255, 176, 32, 0.5), 0 0 10px rgba(255, 176, 32, 0.35);
}


.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;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4),
    0 0 24px rgba(242, 247, 255, 0.75),
    0 0 48px rgba(120, 180, 255, 0.35);
}

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

.pad.hold {
  background: linear-gradient(180deg, #4f74c8, #2c4a9c);
  border-color: #7ea2f0;
  box-shadow:
    0 0 16px rgba(91, 140, 255, 0.45),
    inset 0 0 18px rgba(255, 255, 255, 0.12);
}

/* —— hold：扇形填充 + 倒计时 —— */
.hold-fx {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
  overflow: hidden;
}

.pad.hold .hold-fx {
  opacity: 1;
}

/* 12 点起顺时针的扇形，从空填到满 */
.hold-pie {
  position: absolute;
  inset: 0;
  background: conic-gradient(
    rgba(235, 245, 255, 0.92) 0deg,
    rgba(235, 245, 255, 0.92) calc(var(--hp, 0) * 360deg),
    rgba(20, 32, 64, 0.35) calc(var(--hp, 0) * 360deg),
    rgba(20, 32, 64, 0.35) 360deg
  );
}

/* 中间留一个深色圆盘，让倒计时数字看得清 */
.pad.hold .hold-pie::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54%;
  height: 54%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(16, 24, 52, 0.72);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 0 10px rgba(0, 0, 0, 0.35);
}

.hold-count {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: clamp(12px, 1.5vw, 17px);
  font-weight: 700;
  line-height: 1;
  color: #f2f7ff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.7),
    0 0 8px rgba(120, 170, 255, 0.45);
  font-variant-numeric: tabular-nums;
}

.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; }
}

.panel-caption {
  width: min(48vh + 28px, 488px, 58vw + 28px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* —— 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); }

.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;
}

.seek-row {
  margin-top: 10px;
}

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;
  }

  .now-playing {
    /* 手机上这块要矮：封面缩小、行距压紧、统计压成一行 */
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 5px 10px;
    padding: 8px 12px 6px;
    align-items: center;
  }
  .cover-wrap {
    width: 56px;
    height: 56px;
    grid-row: span 2;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  }
  .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; }
  .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 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; }
  .density-wrap, #densityCanvas { height: 46px; }
  .opt-row { gap: 10px; }
  .ctl select, .ctl input[type="number"] { padding: 8px 10px; }
  .filter-row { grid-template-columns: 1fr; }
  /* 手机上选项做成底部浮层：不挤压面板，展开时可以内部滚动 */
  .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; }   /* 小屏再省一圈，把高度留给面板 */
  .now-playing { grid-template-columns: 52px minmax(0, 1fr); }
  .cover-wrap { width: 52px; height: 52px; }
  .np-main h2 { font-size: 15px; }
  .panel-inner { width: min(96vw, 380px); }
  .anchor-wrap { flex-basis: 100%; }
  #densityCanvas { height: 84px; }
}

/* —— 特别矮的屏（老机型、或浏览器工具栏吃掉很多高度）：再压一档，保证面板不被裁 —— */
@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)); }
  .density-wrap, #densityCanvas { height: 32px; }
  .panel-caption { font-size: 10px; }
}
