/* ============================================================
   记忆档案 · 毛玻璃 UI Demo
   ============================================================ */

/* ------------------------------------------------------------------
   1. 设计令牌（Design Tokens）
   ------------------------------------------------------------------ */
:root {
  --ink: #172332;
  --muted: rgba(31, 48, 69, 0.62);
  --line: rgba(255, 255, 255, 0.62);
  --glass: rgba(239, 244, 250, 0.46);
  --accent: #748fb8;
  --drawer-width: min(660px, 70vw);
  --handle-width: 54px;
  --record-size: clamp(300px, 34vw, 390px);
  --menu-button-scale: 1.1;
}

/* ------------------------------------------------------------------
   2. 基础与重置
   ------------------------------------------------------------------ */
* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #cfd7e2;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Noto Sans CJK SC", sans-serif;
  transition: background 300ms ease;
}

body.dark-mode {
  background: #0b1018;
}

button {
  font: inherit;
  color: inherit;
}

button:focus-visible {
  outline: 2px solid rgba(95, 126, 177, 0.85);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------
   3. 背景视频与氛围层
   ------------------------------------------------------------------ */
.scene-video {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  filter: brightness(1.04) contrast(1.02) saturate(0.94);
  transition: opacity 1400ms linear, filter 500ms ease;
}

.scene-video.is-active {
  opacity: 1;
}

.scene-wash,
.scene-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scene-wash {
  background: linear-gradient(90deg, rgba(246, 249, 253, 0.16), transparent 58%, rgba(219, 228, 239, 0.18)),
              linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 66%, rgba(77, 96, 125, 0.1));
}

.scene-vignette {
  box-shadow: inset 0 0 160px rgba(21, 29, 41, 0.12);
}

body.dark-mode .scene-video {
  opacity: 0;
  filter: brightness(0.76) contrast(1.06) saturate(0.84);
}

body.dark-mode .scene-video.is-active {
  opacity: 1;
}

body.dark-mode .scene-wash {
  background: linear-gradient(90deg, rgba(15, 23, 35, 0.28), transparent 58%, rgba(17, 28, 45, 0.36)),
              linear-gradient(180deg, rgba(10, 16, 28, 0.1), transparent 66%, rgba(8, 13, 23, 0.24));
}

/* ------------------------------------------------------------------
   4. 顶部信息栏
   ------------------------------------------------------------------ */
.topline {
  position: fixed;
  z-index: 10;
  top: 24px;
  left: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}

.topline i {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(46, 59, 78, 0.22), transparent 72%);
}

.topline time {
  min-width: 58px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------
   5. 标题层与档案标记
   ------------------------------------------------------------------ */
.title-layer {
  position: fixed;
  inset: 0;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.archive-mark {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 8;
  width: min(200px, 32vw);
  display: grid;
  gap: 8px;
  filter: drop-shadow(0 10px 24px rgba(31, 41, 55, 0.16));
}

/* 毛玻璃日历卡片（2026-08-08 大改风格） */
.calendar-note {
  position: relative;
  padding: 14px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(238, 243, 250, 0.6), rgba(225, 233, 243, 0.32) 58%, rgba(210, 220, 233, 0.22)),
              rgba(233, 239, 247, 0.2);
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(55, 70, 93, 0.14), inset 1px 1px rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px) saturate(0.9);
  -webkit-backdrop-filter: blur(16px) saturate(0.9);
}

.calendar-note::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 60% at 18% 0%, rgba(255, 255, 255, 0.4), transparent 46%);
}

body.dark-mode .calendar-note {
  background: linear-gradient(160deg, rgba(20, 29, 42, 0.78), rgba(25, 36, 51, 0.55) 58%, rgba(21, 30, 43, 0.45)),
              rgba(20, 29, 42, 0.32);
  color: #e8eef6;
  border-color: rgba(154, 170, 194, 0.23);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3), inset 1px 1px rgba(255, 255, 255, 0.06);
}

body.dark-mode .calendar-note::before {
  background: radial-gradient(120% 60% at 18% 0%, rgba(148, 170, 200, 0.12), transparent 46%);
}

/* 毛玻璃版不再展示螺旋装订与胶带（2026-08-08 大改风格） */
.spiral-binding,
.tape {
  display: none;
}

.note-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(62, 78, 102, 0.13);
}

body.dark-mode .note-header {
  border-bottom-color: rgba(232, 238, 246, 0.12);
}

.note-month-year {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--ink);
}

body.dark-mode .note-month-year {
  color: #e8eef6;
}

.month-nav {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.month-nav:hover {
  background: rgba(252, 253, 255, 0.7);
  border-color: var(--line);
  color: var(--ink);
}

body.dark-mode .month-nav {
  color: rgba(232, 238, 246, 0.5);
}

body.dark-mode .month-nav:hover {
  background: rgba(43, 57, 76, 0.8);
  border-color: rgba(154, 170, 194, 0.23);
  color: #e8eef6;
}

.calendar-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 8px 0 10px;
  text-align: center;
}

.calendar-grid .cal-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 10px;
  color: var(--muted);
  transition: background 150ms ease;
}

.calendar-grid .cal-cell:hover {
  background: rgba(255, 255, 255, 0.35);
}

body.dark-mode .calendar-grid .cal-cell {
  color: rgba(232, 238, 246, 0.65);
}

body.dark-mode .calendar-grid .cal-cell:hover {
  background: rgba(255, 255, 255, 0.06);
}

.calendar-grid .cal-cell.is-today {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(116, 143, 184, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.calendar-grid .cal-cell.is-other-month {
  color: rgba(46, 58, 74, 0.3);
}

/* 彩蛋：4 月 22 日隐藏日（琴座流星雨），点击解锁 dream */
.calendar-grid .cal-cell.is-lyrid {
  position: relative;
  cursor: pointer;
  color: #6d87c4;
  font-weight: 600;
}

body.dark-mode .calendar-grid .cal-cell.is-lyrid {
  color: #9db8e8;
}

.calendar-grid .cal-cell.is-lyrid::after {
  content: '✦';
  position: absolute;
  right: 1px;
  bottom: 1px;
  font-size: 8px;
  line-height: 1;
  color: rgba(109, 135, 196, 0.9);
  animation: lyridTwinkle 2.6s ease-in-out infinite;
}

body.dark-mode .calendar-grid .cal-cell.is-lyrid::after {
  color: rgba(157, 184, 232, 0.9);
}

@keyframes lyridTwinkle {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; text-shadow: 0 0 6px rgba(140, 170, 230, 0.8); }
}

body.dark-mode .calendar-grid .cal-cell.is-other-month {
  color: rgba(232, 238, 246, 0.25);
}

.calendar-grid .cal-weekday {
  font-size: 9px;
  font-weight: 600;
  color: rgba(46, 58, 74, 0.4);
}

body.dark-mode .calendar-grid .cal-weekday {
  color: rgba(232, 238, 246, 0.35);
}

.note-footer {
  position: relative;
  z-index: 1;
  padding-top: 8px;
  text-align: center;
  border-top: 1px solid rgba(62, 78, 102, 0.13);
}

body.dark-mode .note-footer {
  border-top-color: rgba(232, 238, 246, 0.12);
}

.note-footer h1 {
  margin: 0 0 3px;
  font: 500 15px Georgia, "Noto Serif CJK SC", serif;
  letter-spacing: 1px;
  color: var(--ink);
}

body.dark-mode .note-footer h1 {
  color: #e8eef6;
}

.note-footer p {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.4px;
  color: var(--muted);
}

body.dark-mode .note-footer p {
  color: rgba(232, 238, 246, 0.45);
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
  box-shadow: 0 6px 16px rgba(54, 69, 91, 0.1), inset 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px) saturate(0.9);
  -webkit-backdrop-filter: blur(12px) saturate(0.9);
}

body.dark-mode .now-playing {
  background: rgba(28, 39, 54, 0.62);
  border-color: rgba(154, 170, 194, 0.23);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18), inset 1px 0 rgba(255, 255, 255, 0.045);
}

.now-playing strong {
  min-width: 0;
  overflow: hidden;
  font: 500 11px Georgia, serif;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dark-mode .now-playing strong {
  color: rgba(236, 242, 250, 0.88);
}

body.dark-mode .now-playing strong {
  color: rgba(232, 238, 246, 0.8);
}

/* 音频频谱 - 使用 transform 避免重排 */
.sound-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 38px;
  height: 18px;
}

.sound-bars i {
  width: 2px;
  height: 100%;
  background: rgba(60, 78, 106, 0.5);
  transform: scaleY(0.35);
  transform-origin: bottom;
  animation: bars 1.2s ease-in-out infinite alternate;
}

.sound-bars i:nth-child(2) { animation-delay: -0.8s; }
.sound-bars i:nth-child(3) { animation-delay: -0.35s; }
.sound-bars i:nth-child(4) { animation-delay: -0.65s; }
.sound-bars i:nth-child(5) { animation-delay: -0.15s; }
.sound-bars i:nth-child(6) { animation-delay: -0.48s; }

body:not(.is-playing) .sound-bars i {
  transform: scaleY(0.18);
  animation-play-state: paused;
}

@keyframes bars {
  from { transform: scaleY(0.22); }
  to   { transform: scaleY(0.92); }
}

/* ------------------------------------------------------------------
   6. 音频抽屉
   ------------------------------------------------------------------ */
.audio-drawer {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 30;
  width: var(--drawer-width);
  height: min(690px, 88vh);
  transform: translate(calc(100% - var(--handle-width)), -50%);
  transition: transform 780ms cubic-bezier(0.16, 0.82, 0.22, 1), opacity 200ms ease, visibility 200ms ease;
  pointer-events: none;
}

.audio-drawer.is-open {
  transform: translate(0, -50%);
}

.drawer-handle {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 6;
  width: var(--handle-width);
  height: 176px;
  padding: 12px 0;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  transform: translateY(-50%);
  background: var(--glass);
  box-shadow: -8px 10px 24px rgba(58, 74, 98, 0.12), inset 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(16px) saturate(0.9);
  cursor: pointer;
  pointer-events: auto;
  transition: background 300ms ease, box-shadow 300ms ease;
}

.handle-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: 1px solid rgba(55, 70, 92, 0.28);
  border-radius: 50%;
  font: 500 12px Georgia, serif;
}

.handle-lines {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 30px;
  transform: translate(-50%, -50%);
}

.handle-lines i {
  position: absolute;
  left: 3px;
  width: 10px;
  height: 1px;
  background: currentColor;
  transition: transform 360ms ease;
}

.handle-lines i:first-child { top: 11px; transform: rotate(45deg); }
.handle-lines i:last-child  { top: 18px; transform: rotate(-45deg); }

.audio-drawer.is-open .handle-lines i:first-child { transform: rotate(-45deg); }
.audio-drawer.is-open .handle-lines i:last-child  { transform: rotate(45deg); }

.handle-caption {
  position: absolute;
  left: 50%;
  bottom: 14px;
  font-size: 8px;
  writing-mode: vertical-rl;
  transform: translateX(-50%);
}

.drawer-panel {
  position: absolute;
  left: var(--handle-width);
  top: 0;
  right: 12px;
  bottom: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(90deg, rgba(238, 243, 250, 0.52), rgba(225, 233, 243, 0.28) 58%, rgba(210, 220, 233, 0.18)),
              rgba(233, 239, 247, 0.18);
  box-shadow: -18px 20px 46px rgba(55, 70, 93, 0.12), inset 1px 0 rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(15px) saturate(0.88);
  pointer-events: auto;
}

body.dark-mode .drawer-panel {
  background: linear-gradient(90deg, rgba(20, 29, 42, 0.78), rgba(25, 36, 51, 0.54) 58%, rgba(21, 30, 43, 0.45)),
              rgba(20, 29, 42, 0.3);
}

.panel-line {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 30px;
  height: 1px;
  background: linear-gradient(90deg, rgba(55, 69, 90, 0.22), transparent 72%);
}

.music-info {
  position: absolute;
  left: 34px;
  top: 52px;
  width: 208px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(62, 78, 102, 0.13);
}

.music-info p,
.music-info h2,
.music-info span {
  display: block;
  margin: 0;
}

.music-info p {
  color: var(--muted);
  font-size: 8px;
}

.music-info h2 {
  margin-top: 6px;
  font: 500 18px/1.15 Georgia, serif;
}

.music-info span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

/* 播放控制按钮排在抽屉底部，避免被唱片遮挡（2026-08-08 重排） */
.transport {
  position: absolute;
  left: 34px;
  bottom: 26px;
  display: flex;
  gap: 8px;
}

.transport button,
.pager,
.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(242, 246, 251, 0.5);
  box-shadow: 0 6px 16px rgba(59, 74, 97, 0.1);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.transport button:hover,
.pager:hover,
.icon-button:hover {
  background: rgba(252, 253, 255, 0.84);
  transform: translateY(-1px);
}

.track-list {
  position: absolute;
  left: 34px;
  top: 214px;
  width: 214px;
  display: grid;
  gap: 8px;
}

.track-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 48px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(239, 244, 250, 0.42);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(54, 69, 91, 0.08);
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.track-chip img {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  object-fit: cover;
}

.track-chip span {
  min-width: 0;
  overflow: hidden;
  font: 11px Georgia, serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-chip:hover {
  background: rgba(250, 252, 255, 0.74);
  transform: translateX(2px);
}

.track-chip.is-active {
  background: rgba(249, 251, 254, 0.82);
  box-shadow: 0 7px 20px rgba(63, 82, 112, 0.14), inset 3px 0 var(--accent);
}

.command-grid {
  position: absolute;
  left: 34px;
  bottom: 30px;
  width: 214px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.command-grid button {
  height: calc(40px * var(--menu-button-scale));
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(237, 242, 249, 0.46);
  box-shadow: 0 6px 16px rgba(54, 69, 91, 0.09);
  font-size: calc(10px * var(--menu-button-scale));
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.command-grid button span {
  width: 18px;
  text-align: center;
  font-size: calc(14px * var(--menu-button-scale));
}

.command-grid button:hover {
  background: rgba(252, 253, 255, 0.8);
  transform: translateY(-1px);
}

.turntable-bed {
  position: absolute;
  top: 50%;
  right: -25px;
  width: calc(var(--record-size) + 74px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.46), transparent 34%),
              rgba(220, 228, 239, 0.25);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.07), inset 20px 0 42px rgba(65, 80, 104, 0.08);
}

.record-control {
  position: absolute;
  top: 50%;
  right: 12px;
  width: var(--record-size);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  transform: translateY(-50%);
  background: transparent;
  cursor: pointer;
}

/* 唱片 hover 提示 */
.record-control::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: -24px;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(15, 23, 35, 0.78);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.record-control:hover::after,
.record-control:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.record-rotor {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(66, 79, 98, 0.22) 0 1px, transparent 1px 6px),
              radial-gradient(circle, rgba(176, 188, 204, 0.62), rgba(50, 61, 77, 0.68) 72%, rgba(18, 24, 33, 0.76));
  box-shadow: inset 0 0 0 7px rgba(247, 249, 252, 0.16), inset 0 0 38px rgba(15, 20, 29, 0.44), 0 18px 42px rgba(54, 68, 89, 0.18);
  animation: record-spin 18s linear infinite;
  animation-play-state: paused;
  will-change: transform;
}

.record-control:active .record-rotor {
  transform: scale(0.985);
}

body.is-playing .record-rotor {
  animation-play-state: running;
}

.record-grooves {
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(235, 240, 247, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 10px rgba(9, 13, 19, 0.04), 0 0 0 24px rgba(235, 240, 247, 0.025);
}

.record-cover {
  position: absolute;
  inset: 25%;
  overflow: hidden;
  border: 3px solid rgba(241, 245, 250, 0.84);
  border-radius: 50%;
  background: #d9e0e9;
  box-shadow: 0 0 0 3px rgba(23, 31, 43, 0.46), 0 7px 22px rgba(17, 24, 35, 0.28);
}

.record-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: opacity 150ms ease, transform 420ms ease;
}

.record-glass {
  position: absolute;
  inset: 3%;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: linear-gradient(132deg, rgba(255, 255, 255, 0.14), transparent 27% 70%, rgba(255, 255, 255, 0.04));
  pointer-events: none;
}

.clock-face {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.clock-hand {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: 2px;
  height: 25%;
  border-radius: 2px;
  transform-origin: 50% 100%;
  background: linear-gradient(180deg, rgba(54, 64, 79, 0.18), rgba(35, 44, 57, 0.86));
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.35);
}

.clock-hand.hour {
  height: 22%;
  transform: translate(-50%, -100%) rotate(var(--rotation));
}

.clock-hand.minute {
  height: 31%;
  width: 1.5px;
  transform: translate(-50%, -100%) rotate(var(--rotation));
}

.clock-hand.second {
  height: 34%;
  width: 1px;
  background: rgba(100, 119, 150, 0.78);
  transform: translate(-50%, -100%) rotate(var(--rotation));
}

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

/* ------------------------------------------------------------------
   7. 玻璃弹窗视图
   ------------------------------------------------------------------ */
.glass-view {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 4vw, 58px);
  border: 0;
  border-radius: 0;
  background: rgba(228, 235, 244, 0.48);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(24px) saturate(0.88);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
}

body.dark-mode .glass-view {
  background: rgba(22, 31, 45, 0.5);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16);
}

body[data-view="archive"] #archiveView,
body[data-view="gallery"] #galleryView,
body[data-view="settings"] #settingsView {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

body[data-view="archive"] .title-layer,
body[data-view="gallery"] .title-layer,
body[data-view="settings"] .title-layer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-right: 52px;
}

.view-head > div,
.settings-content {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1.6px;
}

.view-head h2 {
  margin: 0;
  font: 400 clamp(30px, 4vw, 52px) SimSun, "Songti SC", "Noto Serif CJK SC", serif;
}

.view-head span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.glass-view > .view-head > .close-view {
  position: absolute;
  top: clamp(24px, 4vw, 58px);
  right: clamp(24px, 4vw, 58px);
}

.close-view {
  font-size: 24px;
}

.view-tabs {
  display: flex;
  gap: 8px;
  margin-top: 32px;
  border-bottom: 1px solid rgba(52, 71, 95, 0.17);
}

.view-tabs button,
.settings-nav button {
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 20px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.view-tabs button.is-active,
.settings-nav button.is-active {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.archive-toolbar,
.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 15px;
  color: var(--muted);
  font-size: 12px;
}

.archive-toolbar > div,
.gallery-toolbar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pager {
  width: 30px;
  height: 30px;
}

.save-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  overflow: auto;
  padding: 2px 3px 14px;
}

.save-slot {
  min-height: 148px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  background: rgba(248, 250, 253, 0.42);
  box-shadow: 0 10px 24px rgba(54, 69, 91, 0.08);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.save-slot:hover,
.save-slot.is-selected {
  background: rgba(255, 255, 255, 0.68);
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(54, 69, 91, 0.14);
}

.save-slot.is-selected {
  outline: 2px solid rgba(116, 143, 184, 0.42);
}

.save-slot h3 {
  margin: 0 0 16px;
  font: 500 15px Georgia, serif;
}

.save-slot p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 11px;
}

.slot-status {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 10px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  overflow: auto;
  padding: 2px 3px 14px;
}

.gallery-card {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  background: rgba(248, 250, 253, 0.4);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(54, 69, 91, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 30px rgba(54, 69, 91, 0.16);
}

.gallery-card img {
  width: 100%;
  height: 150px;
  display: block;
  object-fit: cover;
}

.gallery-card p {
  margin: 9px 12px 11px;
  font: 12px Georgia, serif;
}

.settings-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 36px;
  margin-top: 42px;
  min-height: 0;
}

.settings-nav {
  display: grid;
  align-content: start;
  gap: 3px;
}

.settings-nav button {
  text-align: left;
  border-left: 2px solid transparent;
  border-bottom: 0;
}

.settings-nav button.is-active {
  border-left-color: var(--accent);
  border-bottom: 0;
}

.settings-content {
  max-width: 660px;
  width: 100%;
  margin: 0 auto;
}

.setting-group {
  padding: 0 0 26px;
  margin: 0 0 26px;
  border-bottom: 1px solid rgba(52, 71, 95, 0.15);
}

.setting-group h3 {
  margin: 0 0 8px;
  font: 500 17px Georgia, serif;
}

.setting-group p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  margin: 14px 0;
  font-size: 13px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 7px;
  background: rgba(220, 228, 238, 0.35);
}

.segmented button {
  border: 0;
  border-radius: 4px;
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.is-active {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(54, 69, 91, 0.09);
}

.setting-row input[type="range"] {
  width: min(300px, 50%);
  accent-color: var(--accent);
}

.setting-row select {
  min-width: 190px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.46);
  color: var(--ink);
}

.range-with-value {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(340px, 60%);
}

.range-with-value input {
  flex: 1;
  min-width: 120px;
}

.range-with-value output {
  min-width: 44px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.switch {
  position: relative;
  width: 42px;
  height: 23px;
  border: 0;
  border-radius: 20px;
  background: rgba(67, 84, 106, 0.32);
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
  transition: transform 180ms ease;
}

.switch.is-on {
  background: var(--accent);
}

.switch.is-on::after {
  transform: translateX(19px);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 50px;
  background: rgba(12, 20, 31, 0.62);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.image-lightbox.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.image-lightbox img {
  max-width: min(900px, 90vw);
  max-height: 76vh;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

.image-lightbox .icon-button {
  position: absolute;
  top: 28px;
  right: 32px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 24px;
}

.image-lightbox p {
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 80;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 4px;
  opacity: 0;
  transform: translate(-50%, 10px);
  background: rgba(235, 241, 248, 0.66);
  color: rgba(25, 34, 47, 0.76);
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(54, 69, 91, 0.14);
  backdrop-filter: blur(14px);
  transition: opacity 180ms ease, transform 220ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

#musicBus {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
}

/* ------------------------------------------------------------------
   8. 加载层
   ------------------------------------------------------------------ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #cfd7e2;
  transition: opacity 400ms ease, visibility 400ms ease;
}

body.dark-mode .loader {
  background: #0b1018;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(116, 143, 184, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loader-spin 1s linear infinite;
}

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

/* ------------------------------------------------------------------
   9. 暗色模式组件覆盖
   ------------------------------------------------------------------ */
body.dark-mode .turntable-bed {
  border-color: rgba(154, 170, 194, 0.3);
  background: radial-gradient(circle at 34% 25%, rgba(103, 119, 143, 0.16), transparent 34%),
              radial-gradient(circle, rgba(24, 32, 44, 0.82), rgba(7, 11, 17, 0.96));
  box-shadow: inset 0 0 0 9px rgba(171, 187, 211, 0.035), inset 18px 0 46px rgba(0, 0, 0, 0.4), 0 18px 42px rgba(0, 0, 0, 0.24);
}

body.dark-mode .record-rotor {
  border-color: rgba(178, 193, 214, 0.32);
  background: repeating-radial-gradient(circle, rgba(198, 211, 229, 0.07) 0 1px, transparent 1px 6px),
              radial-gradient(circle at 43% 38%, #303a48 0 22%, #171e29 58%, #080c12 88%);
  box-shadow: inset 0 0 0 7px rgba(214, 225, 239, 0.055), inset 0 0 46px rgba(0, 0, 0, 0.72), 0 20px 46px rgba(0, 0, 0, 0.32);
}

body.dark-mode .record-grooves {
  border-color: rgba(221, 231, 244, 0.1);
  box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.08), 0 0 0 24px rgba(213, 225, 241, 0.018);
}

body.dark-mode .record-cover {
  border-color: rgba(191, 204, 222, 0.52);
  box-shadow: 0 0 0 4px rgba(5, 8, 13, 0.86), 0 8px 24px rgba(0, 0, 0, 0.52);
}

body.dark-mode .record-glass {
  border-color: rgba(212, 226, 244, 0.1);
  background: linear-gradient(132deg, rgba(182, 204, 231, 0.07), transparent 30% 70%, rgba(255, 255, 255, 0.025));
}

body.dark-mode .transport button,
body.dark-mode .track-chip,
body.dark-mode .command-grid button {
  border-color: rgba(185, 202, 225, 0.23);
  background: rgba(28, 39, 54, 0.62);
  color: rgba(236, 242, 250, 0.88);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18), inset 0 1px rgba(255, 255, 255, 0.045);
}

body.dark-mode .transport button:hover,
body.dark-mode .track-chip:hover,
body.dark-mode .command-grid button:hover {
  background: rgba(43, 57, 76, 0.82);
}

body.dark-mode .track-chip.is-active {
  background: rgba(61, 77, 99, 0.8);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.24), inset 3px 0 #8aa7d4;
}

/* 暗色模式下曲目信息与顶栏改用浅色文字（2026-08-08 重排） */
body.dark-mode .music-info h2 {
  color: #e8eef6;
}

body.dark-mode .music-info p,
body.dark-mode .music-info span {
  color: rgba(232, 238, 246, 0.5);
}

body.dark-mode .topline {
  color: rgba(232, 238, 246, 0.55);
}

/* ------------------------------------------------------------------
   10. 抽屉把手呼吸动效
   ------------------------------------------------------------------ */
.audio-drawer:not(.is-open) .drawer-handle {
  animation: drawer-breathe-strong 2.4s ease-in-out infinite;
}

.audio-drawer:not(.is-open) .drawer-handle::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(154, 205, 255, 0.72);
  border-radius: 7px;
  box-shadow: 0 0 10px rgba(126, 190, 255, 0.42);
  opacity: 0.42;
  transform: scale(0.98);
  animation: drawer-ring-strong 2.4s ease-in-out infinite;
  pointer-events: none;
}

.audio-drawer:not(.is-open) .handle-mark {
  animation: handle-mark-breathe 2.4s ease-in-out infinite;
}

@keyframes drawer-breathe-strong {
  0%, 100% {
    background: rgba(220, 231, 244, 0.62);
    box-shadow: -8px 10px 24px rgba(58, 74, 98, 0.18), 0 0 5px rgba(127, 188, 250, 0.2), inset 1px 0 rgba(255, 255, 255, 0.55);
  }
  50% {
    background: rgba(231, 244, 255, 0.92);
    box-shadow: -18px 8px 48px rgba(86, 161, 238, 0.62), 0 0 34px rgba(136, 198, 255, 0.66), inset 1px 0 rgba(255, 255, 255, 0.9);
  }
}

@keyframes drawer-ring-strong {
  0%, 100% { opacity: 0.42; transform: scale(0.98); }
  50%     { opacity: 1; transform: scale(1.035); }
}

@keyframes handle-mark-breathe {
  0%, 100% { border-color: rgba(75, 105, 145, 0.38); box-shadow: 0 0 0 rgba(123, 190, 255, 0); }
  50%     { border-color: rgba(104, 174, 244, 0.9); box-shadow: 0 0 15px rgba(111, 184, 255, 0.72); color: #315b88; }
}

body.dark-mode .audio-drawer:not(.is-open) .drawer-handle {
  animation-name: drawer-breathe-dark;
}

@keyframes drawer-breathe-dark {
  0%, 100% {
    background: rgba(28, 39, 54, 0.72);
    box-shadow: -8px 10px 24px rgba(0, 0, 0, 0.24), 0 0 7px rgba(101, 164, 231, 0.28), inset 1px 0 rgba(255, 255, 255, 0.16);
  }
  50% {
    background: rgba(45, 64, 86, 0.94);
    box-shadow: -18px 8px 52px rgba(70, 145, 224, 0.68), 0 0 38px rgba(99, 173, 244, 0.7), inset 1px 0 rgba(255, 255, 255, 0.32);
  }
}

/* ------------------------------------------------------------------
   11. 媒体查询与响应式
   ------------------------------------------------------------------ */
@media (max-width: 900px) {
  :root {
    --drawer-width: min(590px, 92vw);
    --record-size: clamp(270px, 54vw, 340px);
  }

  .music-info,
  .track-list,
  .command-grid {
    left: 22px;
    width: 190px;
  }

  /* 按钮行保持自然宽度，只平移，避免压扁重叠（2026-08-08 重排） */
  .transport {
    left: 22px;
  }

  .player-comments {
    left: 22px;
    width: 190px;
  }

  .track-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    max-width: 190px;
  }

  .track-chip {
    flex: 0 0 auto;
    width: auto;
    min-width: 120px;
  }

  .archive-mark {
    width: min(190px, 85vw);
    left: 18px;
    bottom: 18px;
  }

  .glass-view {
    padding: 24px 20px;
  }

  .save-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-layout {
    grid-template-columns: 110px 1fr;
    gap: 20px;
  }

  .setting-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .setting-row input[type="range"] {
    width: 100%;
  }

  .range-with-value {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .topline {
    left: 14px;
    right: 14px;
  }

  .archive-mark {
    width: min(170px, 92vw);
    left: 12px;
    bottom: 12px;
  }

  .calendar-grid .cal-cell {
    font-size: 9px;
  }

  .note-footer h1 {
    font-size: 16px;
  }

  .save-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .view-head h2 {
    font-size: 32px;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    display: flex;
    overflow: auto;
  }

  .settings-nav button {
    white-space: nowrap;
  }

  .drawer-panel {
    backdrop-filter: blur(10px);
  }

  .glass-view > .view-head > .close-view {
    top: 20px;
    right: 18px;
  }
}

/* ------------------------------------------------------------------
   12. 减少动效偏好
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .scene-video,
  .title-layer,
  .glass-view,
  .drawer-handle,
  .record-rotor,
  .sound-bars i,
  .toast,
  .loader {
    transition: none !important;
    animation: none !important;
  }

  .audio-drawer:not(.is-open) .drawer-handle,
  .audio-drawer:not(.is-open) .drawer-handle::after,
  .audio-drawer:not(.is-open) .handle-mark {
    animation: none !important;
  }
}

/* 在触控设备上禁用高成本的 backdrop-filter 以提升流畅度 */
@media (hover: none) and (pointer: coarse) {
  .drawer-panel,
  .glass-view,
  .calendar-note,
  .now-playing {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ── GLASSTIME PLAYER 评论区（2026-08-08）── */
/* 绝对定位进左栏：曲目列表之下、播放按钮之上，列表内部滚动（2026-08-08 重排） */
.player-comments{position:absolute;left:34px;top:446px;bottom:80px;width:214px;margin-top:0;padding-top:12px;border-top:1px solid rgba(255,255,255,.09);display:flex;flex-direction:column;min-height:0;overflow:hidden}
.comments-title{font-size:11px;letter-spacing:.14em;color:var(--glass-strong,#dfe7ec);margin:0 0 10px;font-family:inherit}
.comments-title span{color:var(--glass-dim,#8fa0ad);letter-spacing:.04em}
.comment-input{display:flex;gap:8px;margin-bottom:12px}
.comment-input input{flex:1;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.12);border-radius:9px;padding:9px 12px;color:#e8eef2;font:12px ui-monospace,monospace;outline:none;transition:border-color .2s}
.comment-input input:focus{border-color:rgba(180,210,235,.5)}
.comment-input button{border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.09);color:#e8eef2;border-radius:9px;padding:0 15px;font:11px ui-monospace,monospace;cursor:pointer;transition:background .2s;white-space:nowrap;flex:0 0 auto}
.comment-input button:hover{background:rgba(255,255,255,.16)}
.comment-list{flex:1 1 auto;min-height:0;max-height:none;overflow-y:auto}
.comment-list::-webkit-scrollbar{width:4px}
.comment-list::-webkit-scrollbar-thumb{background:rgba(255,255,255,.15);border-radius:2px}

/* 浅色模式下评论区改用深色文字，保证可读（2026-08-08 重排） */
body:not(.dark-mode) .comments-title{color:var(--ink)}
body:not(.dark-mode) .comments-title span{color:var(--muted)}
body:not(.dark-mode) .comment-input input{background:rgba(255,255,255,.42);border-color:rgba(62,78,102,.28);color:var(--ink)}
body:not(.dark-mode) .comment-input input::placeholder{color:var(--muted)}
body:not(.dark-mode) .comment-input button{background:rgba(255,255,255,.5);border-color:rgba(62,78,102,.28);color:var(--ink)}
body:not(.dark-mode) .comment-list::-webkit-scrollbar-thumb{background:rgba(62,78,102,.28)}

/* ── 播放模式按钮（2026-08-08）── */
#playMode{font-size:15px}
#playMode.is-loop{color:#ffd479;box-shadow:0 0 0 1px rgba(255,212,121,.35)}
#playMode.is-shuffle{color:#b7e3a8;box-shadow:0 0 0 1px rgba(183,227,168,.35)}

/* ── GLASSTIME PLAYER 附加（2026-08-08）── */
/* .topline 整体 pointer-events:none（避免文字层挡住底层交互），
   返回主页链接需单独恢复可点击 */
.back-home{color:var(--glass-dim,#8fa0ad);text-decoration:none;font-size:11px;letter-spacing:.06em;margin-left:auto;transition:color .2s;pointer-events:auto}
.back-home:hover{color:#dfe7ec}
#darkToggle{font-size:14px}
#playMode{font-size:10px;letter-spacing:.02em}
#playMode.is-loop{color:#ffd479;box-shadow:0 0 0 1px rgba(255,212,121,.35)}
#playMode.is-shuffle{color:#b7e3a8;box-shadow:0 0 0 1px rgba(183,227,168,.35)}

/* ------------------------------------------------------------------
   13. 手机竖屏专门优化（2026-08-08）
   唱片居中上移，按钮行居中跟随，曲目横滑，评论区收底
   ------------------------------------------------------------------ */
@media (orientation: portrait) and (max-width: 700px) {
  :root {
    --record-size: min(62vw, 34vh, 300px);
  }

  /* 竖屏裁切时把头部正好露出来；仅亮色，暗色不变（2026-08-08） */
  body:not(.dark-mode) .scene-video {
    object-position: 11% 50%;
  }

  .music-info {
    left: 22px;
    right: 22px;
    top: 34px;
    width: auto;
  }

  .turntable-bed {
    top: calc(120px + var(--record-size) / 2);
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(var(--record-size) + 56px);
  }

  .record-control {
    top: calc(120px + var(--record-size) / 2);
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .transport {
    left: 50%;
    transform: translateX(-50%);
    top: calc(120px + var(--record-size) + 32px);
    bottom: auto;
  }

  .track-list {
    left: 16px;
    right: 16px;
    top: calc(120px + var(--record-size) + 78px);
    width: auto;
    max-width: none;
  }

  .player-comments {
    left: 16px;
    right: 16px;
    top: calc(120px + var(--record-size) + 154px);
    bottom: 14px;
    width: auto;
  }

  .archive-mark {
    left: 12px;
    bottom: 12px;
  }
}
