/* 银蓝色调 · 清透 iOS 风：毛玻璃面板、SF 字体、细线、柔和高光 */
:root {
  --silver: #eef3f9;
  --silver-2: #c9d6e4;
  --blue: #8cc8ff;
  --blue-deep: #4f9cf0;
  /* 雾是亮的，面板改成深一点的蓝灰玻璃，白字才看得清 */
  --glass: rgba(22, 40, 64, 0.46);
  --glass-strong: rgba(236, 243, 250, 0.22);
  --hairline: rgba(255, 255, 255, 0.32);
  --shadow: 0 10px 40px rgba(20, 40, 70, 0.25);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #a9bccf;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--silver);
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

body.idle { cursor: none; }

#gl { touch-action: none; }

#gl, #overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}
#overlay { pointer-events: none; }

/* YouTube 模式：播放器铺满最底层（按原比例铺满，不拉伸），毛玻璃在中间，画布在上面画雾 */
#yt, #frost { position: fixed; inset: 0; display: none; overflow: hidden; pointer-events: none; }
body.yt #yt, body.yt #frost { display: block; }
body.yt { background: #000; }
#yt iframe {
  position: absolute; left: 50%; top: 50%; border: 0;
  width: max(100vw, 177.78vh); height: max(100vh, 56.25vw);
  transform: translate(-50%, -50%);
}
#frost {
  -webkit-backdrop-filter: blur(18px) saturate(1.05) brightness(1.06);
  backdrop-filter: blur(18px) saturate(1.05) brightness(1.06);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}

/* 视频元素只当贴图来源，不直接显示（不用 display:none，避免部分浏览器停止解码） */
#clip, #cam, #fogvid {
  position: fixed;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

/* 毛玻璃 */
.glass {
  background: var(--glass);
  border: 0.5px solid var(--hairline);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* 左上品牌 */
#brand {
  position: fixed;
  top: 28px;
  left: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.4px;
  pointer-events: none;
}
#brand .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 10px var(--blue);
  animation: breathe 3.2s ease-in-out infinite;
}
#brand .name { font-weight: 600; }
#brand .sep { width: 0.5px; height: 12px; background: var(--hairline); }
#brand #status { opacity: 0.8; }
body.screensaver #brand { opacity: 0.7; }

@keyframes breathe { 50% { opacity: 0.35; } }

/* 左下动作标题卡：没有底框，靠柔和阴影保证可读，屏保里更干净 */
#label {
  position: fixed;
  left: 40px;
  bottom: 44px;
  max-width: min(560px, calc(100vw - 80px));
  text-shadow: 0 1px 3px rgba(15, 30, 50, 0.55), 0 2px 22px rgba(15, 30, 50, 0.5);
  pointer-events: none;
  transition: opacity 0.8s;
}
/* 标题卡背后一层很淡的暗影，亮雾上也能看清字 */
#label::before {
  content: "";
  position: absolute;
  left: -120px; right: -160px; top: -90px; bottom: -80px;
  z-index: -1;
  background: radial-gradient(ellipse at 35% 60%, rgba(16, 32, 54, 0.42), rgba(16, 32, 54, 0) 68%);
}
#label .eyebrow {
  font-size: 12px;
  letter-spacing: 3px;
  color: #cfe7ff;
  font-weight: 600;
}
#label .zh {
  margin-top: 8px;
  font-size: 46px;
  font-weight: 300;
  letter-spacing: 6px;
  color: #ffffff;
}
#label .en {
  margin-top: 2px;
  font-family: ui-serif, "New York", Georgia, serif;
  font-style: italic;
  font-size: 24px;
  opacity: 0.92;
}
#label .tip {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.6;
}
#label .credit {
  margin-top: 10px;
  font-size: 11px;
  opacity: 0.75;
}
#label .credit a { color: inherit; text-decoration: none; pointer-events: auto; }
#label .credit a:hover { text-decoration: underline; }
/* 视频署名：只是备注，一个很淡的「视频来源」，移上去或点一下才展开 */
#label .credit.src { font-size: 10px; opacity: 0.45; pointer-events: auto; transition: opacity 0.2s; }
#label .credit.src:hover, #label .credit.src.open { opacity: 0.85; }
#label .credit .src-tag { all: unset; cursor: pointer; letter-spacing: 1px; border-bottom: 1px dotted rgba(255, 255, 255, 0.5); }
#label .credit .src-full { display: none; margin-left: 8px; }
#label .credit.src:hover .src-full, #label .credit.src.open .src-full { display: inline; }
/* 标题卡下面：把当前动作下载成 Mac 屏保 */
#label .saver-dl {
  margin-top: 14px; pointer-events: auto; cursor: pointer;
  font: 500 13px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; letter-spacing: 1px;
  color: #fff; padding: 9px 16px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(180deg, rgba(220, 234, 248, 0.32), rgba(160, 190, 220, 0.18));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  text-shadow: none; box-shadow: 0 4px 16px rgba(20, 40, 70, 0.18);
  transition: background 0.2s, opacity 0.6s;
}
#label .saver-dl:hover { background: linear-gradient(180deg, rgba(230, 242, 252, 0.45), rgba(170, 200, 230, 0.28)); }
body.idle #label .saver-dl { opacity: 0.35; }

/* 右下控制面板 */
#ui {
  position: fixed;
  right: 32px;
  bottom: 40px;
  width: 340px;
  padding: 16px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: opacity 0.6s, transform 0.6s;
}
body.panel-away #ui, body.panel-off #ui { opacity: 0; transform: translateY(8px); pointer-events: none; }
/* 右下角淡淡的小按钮：随时收起 / 打开控制面板（也可以按 H） */
#panelToggle {
  position: fixed; right: 32px; bottom: 8px; z-index: 21;
  width: 28px; height: 28px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #f2f7fc; background: rgba(60, 86, 120, 0.28); border: 0.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 2px 10px rgba(20, 40, 70, 0.18);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0.55; cursor: pointer; transition: opacity 0.4s, background 0.2s;
}
#panelToggle:hover, #panelToggle:focus-visible { opacity: 0.95; background: rgba(60, 86, 120, 0.42); }
#panelToggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
body.preview #panelToggle, body.screensaver #panelToggle, body.wallpaper #panelToggle { display: none; }
body.screensaver #ui { display: none; }

#ui .cap {
  font-size: 13px;
  letter-spacing: 1px;
  color: rgba(244, 248, 252, 0.8);
}
#ui .cap.plain { margin: 10px 0 8px 4px; font-size: 12px; }

/* 每组选项直接摆出来，一下就能点到，不用先展开（更好用） */
.drop { border-top: 0.5px solid rgba(255, 255, 255, 0.14); padding: 10px 0 4px; }
.drop-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 8px;
  text-align: left;
  pointer-events: none;
}
.drop-head .val, #ui .drop-head .chev { display: none; }
.drop-body > * { margin-bottom: 6px; }

#ui button {
  font: inherit;
  color: var(--silver);
  background: transparent;
  border: none;
  cursor: pointer;
}
#ui svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* iOS 分段控件 */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}
.seg button {
  flex: 1;
  padding: 8px 4px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: background 0.25s, color 0.25s;
}
.seg.speed button { padding: 8px 2px; font-variant-numeric: tabular-nums; }
.seg button:hover { background: rgba(255, 255, 255, 0.1); }
.seg button.on {
  background: var(--glass-strong);
  color: #fff;
  box-shadow: 0 2px 10px rgba(20, 40, 70, 0.18), inset 0 0 0 0.5px var(--hairline);
}
.seg button.on svg { stroke: var(--blue); }

#ui .row { display: flex; gap: 8px; }
.pill {
  height: 44px;
  border-radius: 14px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
}
.pill.accent {
  flex: 1;
  background: linear-gradient(180deg, rgba(140, 200, 255, 0.55), rgba(79, 156, 240, 0.55)) !important;
  border: 0.5px solid rgba(255, 255, 255, 0.45) !important;
  font-weight: 600;
}
.pill.accent.on { background: rgba(236, 243, 250, 0.22) !important; }
.pill.icon { width: 44px; background: rgba(255, 255, 255, 0.1) !important; }

/* 播放行 */
.transport { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.transport .time {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}
.transport .slash { opacity: 0.45; margin: 0 6px; }
#btnPlay .i-play { display: none; }
#btnPlay.paused .i-play { display: block; }
#btnPlay.paused .i-pause { display: none; }
#btnLoop.on { color: var(--blue); box-shadow: inset 0 0 0 0.5px var(--blue); }

/* 旋转片库 */
.seg.moves { margin-bottom: 8px; }
.lib { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lib button {
  padding: 8px 4px;
  border-radius: 12px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.08) !important;
  transition: background 0.25s;
}
.lib button:hover { background: rgba(255, 255, 255, 0.12) !important; }
.lib button.on {
  background: var(--glass-strong) !important;
  box-shadow: inset 0 0 0 0.5px var(--blue);
  color: #fff;
}
.lib button.missing { opacity: 0.5; }
.lib button.soon { opacity: 0.4; cursor: not-allowed; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.lib button.soon:hover { background: rgba(255, 255, 255, 0.08) !important; }
.lib button.soon small { font-size: 10px; opacity: 0.85; letter-spacing: 0.02em; }
/* 中 / EN 切换 */
.langsw { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.langsw button { padding: 3px 9px; border-radius: 999px; font-size: 12px; opacity: 0.75; }
.langsw button.on { background: var(--glass-strong); opacity: 1; color: #fff; }
#ui .cap .hint { opacity: 0.8; letter-spacing: 0; }
.lib button.own { box-shadow: inset 0 -2px 0 rgba(140, 200, 255, 0.7); }
.lib button[hidden] { display: none; }
.pill.soft { flex: 1; background: rgba(255, 255, 255, 0.1) !important; }
.pill.soft:hover { background: rgba(255, 255, 255, 0.16) !important; }
#mineTarget button { padding: 8px 4px; }
.urlrow { display: flex; gap: 8px; }
.urlrow input {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px;
  border-radius: 14px; border: 0.5px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08); color: var(--silver);
  font: inherit; font-size: 13px; outline: none;
}
.urlrow input::placeholder { color: rgba(244, 248, 252, 0.55); }
.urlrow input:focus { border-color: rgba(140, 200, 255, 0.8); }
.urlrow .pill { flex: 0 0 auto; padding: 0 14px; }

/* 底部进度线 */
#progress {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
#progress .bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--silver), var(--blue));
  box-shadow: 0 0 8px var(--blue);
  transition: width 0.3s linear;
}

#toast {
  position: fixed;
  left: 50%;
  top: 28px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 18px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
#toast.show { opacity: 1; }

@media (max-width: 760px) {
  #label .zh { font-size: 34px; }
  #ui { left: 16px; right: 16px; width: auto; bottom: 40px; }
  #panelToggle { right: 16px; }
  body:not(.idle) #label { opacity: 0; }
}

/* 预览屏保：和真屏保一样不显示面板，只留右上角一个淡淡的退出按钮 */
body.preview #ui { display: none; }
#exitPreview { position: fixed; top: 18px; right: 18px; z-index: 20; display: none; transition: opacity 0.6s; }
body.preview #exitPreview { display: inline-flex; }
body.preview.idle #exitPreview { opacity: 0; pointer-events: none; }
#iceToggle { display: none; position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 20;
  letter-spacing: 0.08em; opacity: 0.55; transition: opacity 0.6s; }
body.saver #iceToggle { display: inline-flex; }
body.saver #iceToggle:hover { opacity: 0.95; }
body.saver.interactive #iceToggle { left: auto; right: 18px; top: 66px; bottom: auto; transform: none; opacity: 0.85; }
body.saver.idle #iceToggle { opacity: 0.25; }

/* 桌面壁纸模式：避开顶部菜单栏和底部 Dock，不要进度线，鼠标划过就擦雾 */
body.wallpaper #brand { top: 52px; left: 28px; opacity: 0.55; }
body.wallpaper #label { bottom: 128px; left: 48px; opacity: 0.85; }
body.wallpaper #progress, body.wallpaper #exitPreview, body.wallpaper #toast { display: none; }
body.wallpaper { cursor: default; }
body.ext #btnPreview { display: none; }
#btnCopy { display: none; }   /* 屏保 / 壁纸链接：第一阶段不用 */

/* 排查小读数（?debug=1 或 Shift+D） */
#debug {
  position: fixed; top: 76px; left: 32px; z-index: 50;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(20, 34, 52, 0.78); color: #e8f2ff;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre; pointer-events: none;
}
#debug[hidden] { display: none; }
#ui .row.langrow { align-items: center; justify-content: space-between; }
