:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: rgba(20, 24, 30, .82);
  --surface-strong: #171b21;
  --border: rgba(255,255,255,.12);
  --text: #fff6ef;
  --muted: #b7b0ad;
  --accent: #5b8cff;
  --accent-soft: rgba(91,140,255,.16);
  --success: #4ae6a2;
  --radius-lg: 28px;
  --radius-md: 20px;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
button, input { font: inherit; }
button { color: inherit; }
button, label, input[type="range"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

html { height: 100%; overflow: hidden; }
body { min-height: 100vh; background: #05070a; overflow: hidden; touch-action: manipulation; overscroll-behavior: none; }

.app-shell {
  --hero-image: radial-gradient(90% 50% at 50% 0%, rgba(91,140,255,.28), transparent 68%), linear-gradient(180deg, #0e2c52 0%, #0a1e36 52%, #071420 100%);
  width: 100vw;
  min-height: 100vh;
  box-sizing: border-box;
  margin: 0 auto;
  /* C1：底部留一个顶部按钮的高度 + 上下空隙，页面本身不滚动 */
  padding: max(28px, env(safe-area-inset-top)) clamp(24px, 4vw, 64px) calc(120px + env(safe-area-inset-bottom));
  background: var(--hero-image);
  background-attachment: fixed;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
}

.app-shell.has-custom-wallpaper {
  background-image: var(--custom-wallpaper);
  background-size: var(--wallpaper-size, cover);
  background-position: var(--wallpaper-pos, center);
  background-repeat: no-repeat;
}

.dynamic-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.dynamic-bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.dynamic-bg[hidden] { display: none; }
.app-shell.dynamic-active { background: transparent !important; }
.dynamic-btn { border: 1px solid var(--border); background: rgba(10,13,18,.7); min-height: 44px; padding: 0 16px; border-radius: 14px; color: var(--text); cursor: pointer; font-size: 14px; }

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 54px; }
.brand { font-size: clamp(18px, 2.1vw, 28px); letter-spacing: .02em; }
.system-status { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: clamp(13px, 1.4vw, 18px); }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #6a6f75; box-shadow: 0 0 0 5px rgba(106,111,117,.12); flex: none; }
.status-dot.connected { background: var(--success); box-shadow: 0 0 18px rgba(74,230,162,.7); }

.hero { position: relative; min-height: clamp(300px, 38vh, 500px); text-align: center; }
.clock-wrap { margin-top: clamp(40px, 7vh, 90px); text-align: center; }
.clock { contain: layout paint style; will-change: contents; display: inline-block; font-family: "Bebas Neue", "Arial Narrow", "Helvetica Neue", sans-serif; font-size: clamp(62px, 11vw, 132px); font-weight: 400; letter-spacing: .015em; line-height: 1; font-variant-numeric: tabular-nums; transform: scaleY(0.92); }
.date { display: block; margin-top: 14px; font-size: clamp(15px, 2.4vw, 26px); color: #c9d6e8; }
.icon-button { border: 1px solid var(--border); background: rgba(10,13,18,.7); min-width: 56px; min-height: 56px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: background .16s ease, border-color .16s ease; }
.icon-button:active { background: rgba(255,255,255,.13); }
.icon-button svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-button { position: absolute; top: 78px; right: 0; flex-direction: column; width: 92px; height: 92px; font-size: 14px; }

.surface { border: 1px solid var(--border); background: var(--surface); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); box-shadow: 0 28px 70px rgba(0,0,0,.22); }
.player { display: grid; grid-template-columns: 96px 1fr; gap: 12px 18px; padding: 16px 18px; border-radius: 24px; width: 100%; margin: auto auto 18px; background: rgba(24,28,36,.12); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.1); cursor: default; }
.player-controls { grid-column: 1 / -1; margin-top: 2px; }
.cover { position: relative; width: 96px; height: 96px; border-radius: 16px; padding: 0; display: flex; flex-direction: column; justify-content: flex-end; background: radial-gradient(circle at 50% 24%, #a9c6ff 0 4%, transparent 4.5%), radial-gradient(circle at 50% 30%, rgba(91,140,255,.7), transparent 34%), linear-gradient(160deg,#101827 8%,#1d3a63 54%,#0e1522); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); overflow: hidden; cursor: pointer; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.cover img[hidden] { display: none; }
.cover.has-image span, .cover.has-image small { position: relative; z-index: 1; }
.cover.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 42%, rgba(0,0,0,.55)); pointer-events: none; }
.cover span { font-family: serif; font-size: 18px; letter-spacing: .12em; }
.cover small { margin-top: auto; align-self: flex-start; padding: 4px 8px; border-radius: 8px; background: rgba(0,0,0,.48); color: #e5d8d2; font-size: 11px; }
.track { min-width: 0; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.track h1 { margin: 0; font-size: clamp(20px, 2.6vw, 30px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist { margin: 8px 0 0; color: var(--muted); font-size: clamp(14px, 1.8vw, 18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album { margin: 4px 0 0; color: var(--muted); opacity: .75; font-size: clamp(12px, 1.4vw, 15px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album[hidden] { display: none; }
.timeline { contain: layout paint style; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 26px; cursor: pointer; opacity: 0; position: relative; z-index: 2; }
/* 进度条用纯 CSS 动画推进：换歌/seek 时设一次 transform + transition，
   之后由合成器补间，主线程完全不参与，也就不触发车机重绘。 */
.timeline { position: relative; }
.progress-rail { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.14); overflow: hidden; pointer-events: none; }
.progress-fill { height: 100%; width: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(0); will-change: transform; }
.timeline div { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.transport { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 2px; }
.transport-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; }
.transport-button:active { background: rgba(255,255,255,.1); }
.transport-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.play-button { width: 44px; height: 44px; border: 1px solid var(--accent); background: var(--accent-soft); }
.pause-icon { display: none; }
.is-playing .play-icon { display: none; }
.is-playing .pause-icon { display: block; }
.lyrics-line { contain: layout paint style; text-align: center; margin: auto 0 12px; padding: 0 16px; color: #ffffff; font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Microsoft YaHei", sans-serif; font-weight: 700; font-size: clamp(28px, 3.8vw, 46px); line-height: 1.4; word-break: break-word; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.lyrics-line[hidden] { display: none; }
.lyrics-particles { display: block; width: 100%; height: 132px; margin: auto 0 12px; }
.lyrics-particles[hidden] { display: none; }

/* 趣味速度模式 */
.speed-view { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; text-align: center; padding: 6vh 0 10vh; }
.speed-view[hidden] { display: none; }
.speed-view [hidden] { display: none !important; }
.app-shell.speed-mode .clock-wrap,
.app-shell.speed-mode .lyrics-line,
.app-shell.speed-mode .lyrics-particles,
.app-shell.speed-mode .player { display: none; }
.app-shell.speed-mode .settings-button { display: none; }
.app-shell.speed-mode { background: radial-gradient(80% 52% at 50% 22%, var(--speed-bg-a, rgba(69,201,101,.32)), transparent 72%), linear-gradient(180deg, var(--speed-bg-b, rgba(69,201,101,.14)), #151321 78%) !important; }
.app-shell.speed-mode .hero { min-height: 0; }
.speed-view { font-family: "Fredoka", "Nunito", "Avenir Next Rounded", "PingFang SC", sans-serif; }
.speed-view::before, .speed-view::after { content: none; display: none; }
.speed-sticker { position: relative; z-index: 2; padding: 8px 18px 9px; border: 3px solid rgba(255,255,255,.82); border-radius: 999px 999px 999px 18px; background: var(--speed-color, #45c965); color: #182018; box-shadow: 0 8px 0 rgba(20,20,30,.18); font-size: 15px; font-weight: 800; letter-spacing: .08em; transform: rotate(-3deg); }
.speed-reading { position: relative; z-index: 2; display: flex; align-items: baseline; gap: 12px; margin-top: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--speed-color, #45c965); text-shadow: 0 5px 0 rgba(18,24,24,.18), 0 0 32px color-mix(in srgb, var(--speed-color, #45c965) 48%, transparent); box-shadow: none; transform: none; }
.speed-reading span { font-family: "Fredoka", "Nunito", "Avenir Next Rounded", sans-serif; font-size: clamp(126px, 24vw, 300px); line-height: .8; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.speed-reading small { font-size: clamp(20px, 3vw, 34px); font-weight: 800; opacity: .9; }
.speed-controls { position: relative; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 26px; }
.speed-light-toggle { position: relative; z-index: 3; display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; border: 3px solid rgba(255,255,255,.86); border-radius: 999px 999px 999px 16px; background: rgba(20,24,34,.54); color: rgba(255,255,255,.92); box-shadow: 0 7px 0 rgba(20,20,30,.18), 0 8px 24px rgba(0,0,0,.16); font: 800 15px/1 "Fredoka", "Nunito", "Avenir Next Rounded", "PingFang SC", sans-serif; cursor: pointer; transition: background .2s ease, color .2s ease, transform .2s ease; }
.speed-light-toggle:active { transform: translateY(2px) rotate(-1deg); }
.speed-light-toggle.is-on { background: var(--speed-color, #45c965); color: #142016; }
.speed-light-toggle.is-off { background: rgba(20,24,34,.54); color: rgba(255,255,255,.72); }
.speed-light-toggle-dot { width: 11px; height: 11px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(255,255,255,.22), 0 0 14px currentColor; }
.speed-test-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 92px; padding: 10px 15px; border: 3px solid rgba(255,255,255,.74); border-radius: 999px 999px 16px 999px; background: rgba(20,24,34,.54); color: rgba(255,255,255,.9); box-shadow: 0 7px 0 rgba(20,20,30,.18), 0 8px 24px rgba(0,0,0,.16); font: 800 15px/1 "Fredoka", "Nunito", "Avenir Next Rounded", "PingFang SC", sans-serif; cursor: pointer; transition: background .2s ease, color .2s ease, transform .2s ease; }
.speed-test-toggle:active { transform: translateY(2px) rotate(1deg); }
.speed-test-toggle.is-on { background: #fff3bb; color: #633b0d; border-color: #fff9dc; }
.speed-theme-name { position: relative; z-index: 2; margin-top: 24px; color: rgba(255,255,255,.92); font-size: clamp(18px, 2.3vw, 28px); font-weight: 800; letter-spacing: .03em; text-shadow: 0 3px 0 rgba(18,24,24,.24); }
.speed-location-status { position: relative; z-index: 2; margin-top: 16px; color: rgba(255,255,255,.66); font-size: 13px; font-weight: 700; }
.speed-motif-stage { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: min(94vw, 1220px); height: clamp(180px, 30vh, 360px); margin-top: clamp(14px, 2.5vh, 28px); pointer-events: none; overflow: hidden; }
.speed-motif { position: relative; flex: 0 0 min(90vw, 820px); min-width: 0; width: min(90vw, 820px); height: 100%; filter: drop-shadow(0 12px 18px rgba(0,0,0,.24)); }
.speed-motif.turtle, .speed-motif.subway, .speed-motif.plane, .speed-motif.rocket, .speed-motif.bullet { background: none; }
.speed-motif-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transform-origin: center; transition: opacity .08s linear; }
.speed-motif-frame.is-active { opacity: .98; }
.speed-motif-frame:nth-child(1) { transform: translate3d(-2%, 2%, 0) rotate(-2deg) scale(.98); }
.speed-motif-frame:nth-child(2) { transform: translate3d(1%, -2%, 0) rotate(1deg) scale(1.02); }
.speed-motif-frame:nth-child(3) { transform: translate3d(2%, 1%, 0) rotate(2deg) scale(1); }
.speed-motif-frame:nth-child(4) { transform: translate3d(-1%, -1%, 0) rotate(-1deg) scale(1.03); }
.speed-motif-frame:nth-child(5) { transform: translate3d(2%, 0, 0) rotate(2deg) scale(.99); }

/* 已移除环形频谱桌面：保留旧节点样式以兼容旧缓存，不再进入模式循环 */
.app-shell.radial-mode .clock-wrap,
.app-shell.radial-mode .lyrics-line,
.app-shell.radial-mode .player { display: none; }
.app-shell.radial-mode .hero { min-height: 0; }

.radial-view { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.radial-view[hidden] { display: none; }
.radial-stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; width: 100%; }
.radial-cover { width: min(46vw, 32vh); height: min(46vw, 32vh); border-radius: 50%; overflow: hidden; position: relative; animation: radialSpin 26s linear infinite; box-shadow: 0 0 50px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.1); }
.radial-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.radial-cover img[hidden] { display: none; }
.radial-cover span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: serif; font-size: clamp(22px, 3vw, 34px); letter-spacing: .1em; background: radial-gradient(circle at 50% 30%, #1d3a63, #0e1522); color: #c9d6e8; }
.radial-cover.has-image span { display: none; }
.radial-view.paused .radial-cover { animation-play-state: paused; }
@keyframes radialSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.radial-bottom { width: 100%; padding: 0 24px max(14px, env(safe-area-inset-bottom)); text-align: center; }
.radial-meta h2 { margin: 0; font-size: clamp(20px, 2.8vw, 30px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radial-meta p { margin: 6px 0 0; color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radial-lyrics { margin: 12px 0 8px; color: #ffffff; font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Microsoft YaHei", sans-serif; font-weight: 700; font-size: clamp(22px, 2.8vw, 30px); line-height: 1.4; min-height: 1.5em; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.radial-lyrics[hidden] { display: none; }

.cover-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--ov-a, #0e2c52), var(--ov-b, #0a1e36), var(--ov-a, #0e2c52)); background-size: 260% 260%; animation: overlayFlow 16s ease infinite; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); opacity: 0; transition: opacity .45s ease; }
.cover-overlay[hidden] { display: none; }
.cover-overlay.show { opacity: 1; }
@keyframes overlayFlow { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.cover-overlay-card { position: relative; width: min(520px, 90vw); padding: 32px 28px 26px; border-radius: 28px; background: rgba(24,28,36,.22); backdrop-filter: blur(26px) saturate(1.3); -webkit-backdrop-filter: blur(26px) saturate(1.3); border: 1px solid rgba(255,255,255,.14); text-align: center; transform: perspective(1200px) rotateY(-90deg); transition: transform .45s cubic-bezier(.2,.7,.3,1); }
.cover-overlay.show .cover-overlay-card { transform: perspective(1200px) rotateY(0deg); }
.cover-overlay-card img { width: min(300px, 68vw); aspect-ratio: 1; object-fit: cover; border-radius: 20px; margin: 0 auto 20px; display: block; }
.cover-overlay-card img[hidden] { display: none; }
.cover-overlay-fallback { width: min(300px, 68vw); aspect-ratio: 1; border-radius: 20px; margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; font-family: serif; font-size: 28px; background: linear-gradient(160deg,#1d3a63,#0e1522); color: #c9d6e8; }
.cover-overlay-fallback[hidden] { display: none; }
.cover-overlay-card h2 { margin: 0; font-size: clamp(24px, 4vw, 34px); }
.cover-overlay-card p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.cover-overlay-card .overlay-lyrics { margin-top: 18px; color: var(--text); font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Microsoft YaHei", sans-serif; font-weight: 700; font-size: clamp(22px, 3vw, 30px); line-height: 1.4; min-height: 1.5em; }
.overlay-transport { display: flex; align-items: center; justify-content: center; gap: 26px; margin-top: 22px; }

.settings { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(0,0,0,.5); color: var(--text); }
.settings::backdrop { background: rgba(0,0,0,.58); backdrop-filter: blur(7px); }
.settings[open] { display: flex; justify-content: flex-end; }
.settings-panel { width: min(780px, 92vw); height: 100%; background: #0f1318; border-left: 1px solid var(--border); overflow: auto; }
.settings-header { position: sticky; top: 0; z-index: 2; padding: 28px clamp(24px, 5vw, 48px); display: flex; justify-content: space-between; align-items: center; background: rgba(15,19,24,.94); backdrop-filter: blur(22px); border-bottom: 1px solid var(--border); }
.close-button { width: 60px; height: 60px; }
.settings-content { padding: 12px clamp(24px, 5vw, 48px) 80px; }
.setting-section { padding: 30px 0; border-bottom: 1px solid var(--border); }
.setting-section h3 { margin: 0 0 16px; font-size: 22px; }
.setting-card { border: 1px solid var(--border); background: var(--surface-strong); border-radius: var(--radius-md); padding: 20px; }
.setting-card [hidden] { display: none !important; }
.setting-card small, .relay-form label small { color: var(--muted); display: block; margin-top: 5px; line-height: 1.5; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.settings h2 { margin: 0; font-size: clamp(28px, 3.5vw, 44px); }

.relay-form > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 15px; }
.relay-form input { min-width: 0; min-height: 50px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: #090c10; color: var(--text); }
.relay-form button, .secondary-button { min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid rgba(255,155,120,.6); background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.secondary-button { color: var(--text); }

.form-status { margin: 12px 0 0; color: var(--muted); }

.light-card { display: grid; grid-template-columns: 132px 1fr; gap: 22px; align-items: start; }
.light-preview { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.light-preview canvas { width: 132px; height: 132px; border-radius: 16px; border: 1px solid var(--border); }
.light-preview small { color: var(--muted); font-size: 12px; }
.light-controls { min-width: 0; }
.light-hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.color-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.color-row span { color: var(--muted); font-size: 13px; }
.color-row input[type="color"] { width: 46px; height: 46px; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: transparent; cursor: pointer; }
.color-row code { color: var(--accent); font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.beat-toggle { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 40px; color: var(--muted); font-size: 14px; cursor: pointer; }
.beat-toggle input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.swatch { width: 40px; height: 40px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; transition: transform .12s ease; }
.swatch:hover { transform: scale(1.1); }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.seg-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 5px; border: 1px solid var(--border); border-radius: 14px; background: rgba(5,7,10,.5); }
.seg { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.seg.selected { background: var(--accent-soft); color: var(--text); }
.two-color-row { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.two-color-row label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.two-color-row input[type="color"] { width: 40px; height: 40px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: transparent; cursor: pointer; }
.two-color-row[hidden] { display: none; }

.wallpaper-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.wallpaper-card p { margin: 10px 0 0; color: var(--accent); font-size: 13px; }

.diagnostics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-bottom: 14px; }
.diagnostics p { grid-column: 1/-1; color: var(--muted); }
.diagnostic-item { padding: 13px; background: var(--surface-strong); border: 1px solid var(--border); border-radius: 14px; }
.diagnostic-item span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }

.wallpaper-dialog { width: min(560px, 92vw); border: 1px solid var(--border); border-radius: 24px; background: #0f1318; color: var(--text); padding: 0; }
.wallpaper-dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(6px); }
.wallpaper-dialog-inner { padding: 24px; }
.wallpaper-dialog-inner h3 { margin: 0 0 16px; font-size: 22px; }
.wallpaper-preview { position: relative; width: 100%; height: 44vh; min-height: 220px; border-radius: 16px; border: 1px solid var(--border); background-color: #090c10; touch-action: none; cursor: grab; overflow: hidden; }
.wallpaper-preview:active { cursor: grabbing; }
.wallpaper-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.wallpaper-safe { position: absolute; border: 2px solid #ffffff; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); pointer-events: none; }
.wallpaper-controls { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.wallpaper-controls label { color: var(--muted); font-size: 14px; }
.wallpaper-controls input[type="range"] { flex: 1; }
.wallpaper-controls span { color: var(--accent); font-size: 14px; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.wallpaper-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.wallpaper-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.wallpaper-confirm { min-height: 48px; padding: 0 22px; border-radius: 14px; border: 1px solid rgba(255,155,120,.6); background: var(--accent-soft); color: var(--text); cursor: pointer; font-size: 15px; }

/* CarPlay 窗口 */
.carplay-window {
  position: fixed;
  z-index: 200;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
  transition: inset .28s ease, border-radius .28s ease;
}
.carplay-window iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.carplay-ca-hint {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(18,20,32,.94);
  color: #fff;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,.14);
}
.carplay-ca-hint[hidden] { display: none; }
.carplay-ca-link { color: #7cc4ff; text-decoration: underline; white-space: nowrap; }
.carplay-ca-dismiss {
  position: static;
  margin-left: auto;
  top: auto; right: auto;
  width: 26px; height: 26px;
  font-size: 16px;
  flex: 0 0 auto;
}
.carplay-card { inset: 4% 6%; cursor: default; }
.carplay-window.carplay-float { inset: 8% 10%; }
.carplay-window.carplay-fullscreen { inset: 0; border-radius: 0; }
.carplay-window button {
  position: absolute;
  top: 10px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.carplay-window .carplay-close { right: 10px; }
/* 卡片态显示 ⛶ 进全屏；全屏态换成 ⤡ 退出全屏。两个按钮同位置，互斥显示。 */
.carplay-window .carplay-enter-fullscreen { right: 62px; display: flex; }
.carplay-window .carplay-exit-fullscreen { right: 62px; display: none; }
.carplay-window.carplay-fullscreen .carplay-enter-fullscreen { display: none; }
.carplay-window.carplay-fullscreen .carplay-exit-fullscreen { display: flex; }

/* 视频窗口（AirPlay 视频流） */
.clip-window {
  position: fixed;
  z-index: 190;
  background: #000;
  overflow: hidden;
  touch-action: none;
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
  transition: inset .28s ease, border-radius .28s ease;
}
/* iframe 在最上层承载实际画面，canvas/video 仅作回退 */
.clip-window iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  z-index: 2;
}
.clip-window canvas,
.clip-window video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  pointer-events: none;
}
/* 悬浮卡片：顶部（时钟位置），16:9，撑满横向，只留美观留空 */
.clip-float { left: clamp(12px, 3vw, 40px); right: clamp(12px, 3vw, 40px); top: clamp(20px, 6vh, 64px); aspect-ratio: 16 / 9; border-radius: 18px; cursor: pointer; }
/* 视频桌面：隐藏时钟和播放控制卡片 */
.app-shell.clip-mode .clock-wrap { display: none; }
.app-shell.clip-mode .settings-button { display: none; }
/* 视频桌面：占位框整体下移（position:fixed 下 margin 无效，改 top），歌词不显示 */
.clip-window.clip-desktop.clip-float { top: clamp(70px, 12vh, 150px) !important; }
.app-shell.clip-mode .lyrics-line,
.app-shell.clip-mode .lyrics-particles { display: none !important; }
.app-shell.clip-mode .player { display: none; }
/* 视频桌面：禁止页面滚动/下拉刷新手势，避免误触发重载把流断掉 */
.app-shell.clip-mode { touch-action: none; overscroll-behavior: none; }
/* 全屏：占满，视频位置可切（顶部/中部） */
.clip-fullscreen { inset: 0; border-radius: 0; cursor: default; }
.clip-fullscreen.clip-pos-top canvas { object-position: center top; }
.clip-fullscreen.clip-pos-mid canvas { object-position: center center; }
.clip-window button {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.clip-window .clip-close { top: 10px; right: 10px; }
.clip-window .clip-exit { top: 10px; right: 58px; display: none; }
.clip-window .clip-position { top: 10px; right: 106px; display: none; }
.clip-window .clip-stop-stream {
  top: auto;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 1px;
}
.clip-fullscreen .clip-exit { display: flex; }
.clip-fullscreen .clip-position { display: flex; }
.clip-fullscreen .clip-close { display: none; }

@media (max-width: 720px) {
  .app-shell { width: 100%; min-height: 100vh; padding-inline: 18px; }
  .hero { min-height: 310px; }
  .settings-button { top: 66px; width: 76px; height: 76px; }
  .light-card { grid-template-columns: 1fr; }
  .wallpaper-card { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
