/* =====================================================================
 * 四套界面：经典圣诞（红金暖色）/ 星图天象仪（细线 HUD）/ 东方水墨（宣纸 + 朱印）/ 冰晶棱镜（磨砂冰）
 * 结构样式在前，风格皮肤在后（body[data-style=…]）
 * ===================================================================== */
:root {
  --accent: #ffd98a;
  --bg: #02050f;
  --text: #eef3ff;
  --muted: rgba(220, 230, 255, 0.6);
  --glass: rgba(6, 12, 28, 0.55);
  --glass-strong: rgba(6, 10, 24, 0.9);
  --line: rgba(160, 190, 255, 0.2);
  --soft: rgba(255, 255, 255, 0.06);
  --radius: 4px;
  --radius-lg: 8px;
  --btn-text: #0a0f1e;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-title: 'Helvetica Neue', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'PingFang SC', 'Microsoft YaHei', monospace;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active {
  cursor: grabbing;
}
/* 用手打方向盘：往哪边转，那一侧的箭头亮起来 */
#steerHud {
  --k: 0;
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
#steerHud .side {
  position: absolute;
  top: 44%;
  display: flex;
  gap: 4px;
  opacity: 0;
}
#steerHud .side.l {
  left: 4vw;
  flex-direction: row-reverse;
}
#steerHud .side.r {
  right: 4vw;
}
#steerHud[data-dir='l'] .side.l,
#steerHud[data-dir='r'] .side.r {
  opacity: var(--k);
}
#steerHud .side i {
  width: 16px;
  height: 16px;
  border-top: 3px solid var(--accent);
  border-right: 3px solid var(--accent);
  transform: rotate(45deg);
  filter: drop-shadow(0 0 6px var(--accent));
  animation: steerPulse 0.8s ease-in-out infinite;
}
#steerHud .side.l i {
  transform: rotate(-135deg);
}
#steerHud .side i:nth-child(2) {
  animation-delay: 0.13s;
}
#steerHud .side i:nth-child(3) {
  animation-delay: 0.26s;
}
@keyframes steerPulse {
  0%,
  100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
}
body:not(.started) #steerHud {
  display: none;
}
/* 大动作时的闪光（蓄力爆炸、冲天烟花、拍手） */
#fxFlash {
  --fx: #fff6e0;
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background: radial-gradient(circle at 50% 46%, #fff 0%, var(--fx) 24%, transparent 92%);
}
#fxFlash.ink {
  mix-blend-mode: multiply;
  background: radial-gradient(circle at 50% 46%, rgba(20, 20, 20, 0.75), rgba(20, 20, 20, 0.2) 55%, transparent 85%);
}

button {
  font: inherit;
  color: inherit;
}
[hidden] {
  display: none !important;
}

/* ---------- 顶部 ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: calc(16px + var(--st)) calc(18px + var(--sr)) 0 calc(22px + var(--sl));
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.started .topbar {
  opacity: 1;
  transform: none;
}
.topbar > * {
  pointer-events: auto;
}
.brand {
  min-width: 0;
  max-width: 46vw;
}
.brand .title {
  font-family: var(--font-title);
  font-size: clamp(20px, 2.5vw, 32px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.brand .subtitle {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--muted);
  margin-top: 4px;
}
.brand .ded {
  font-size: 12px;
  margin-top: 6px;
  color: var(--accent);
  letter-spacing: 1px;
}
#seal {
  display: none;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s, background 0.25s, color 0.25s;
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}
.icon-btn.off::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 1.8px;
  background: currentColor;
  transform: rotate(-45deg);
  border-radius: 2px;
}
.icon-btn.off {
  color: var(--muted);
}
.icon-btn.small {
  width: 34px;
  height: 34px;
  font-size: 15px;
}

/* 隐藏界面 */
.chrome-hidden .brand,
.chrome-hidden .dock,
.chrome-hidden #hud,
.chrome-hidden .actions > :not(#btnHide) {
  opacity: 0;
  pointer-events: none;
}
.chrome-hidden #btnHide {
  opacity: 0.35;
}
.brand,
.dock,
#hud,
.actions > * {
  transition: opacity 0.4s;
}

/* ---------- 底部操作栏 ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--sb));
  transform: translate(-50%, 20px);
  display: flex;
  gap: 2px;
  padding: 5px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  z-index: 20;
  opacity: 0;
  max-width: calc(100vw - 16px);
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
  transition: opacity 0.8s var(--ease) 0.2s, transform 0.8s var(--ease) 0.2s;
}
.started .dock {
  opacity: 1;
  transform: translate(-50%, 0);
}
.dock::-webkit-scrollbar {
  display: none;
}
.dock button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  min-width: 58px;
  padding: 7px 6px 6px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: background 0.25s, transform 0.2s, color 0.25s;
}
.dock button i {
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  height: 21px;
  display: grid;
  place-items: center;
}
.dock button span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  white-space: nowrap;
}
.dock button:hover {
  background: var(--soft);
}
.dock button:active {
  transform: scale(0.94);
}
.dock button.active span {
  color: var(--accent);
}

/* ---------- 星图取景框 ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  display: none;
}
.hc {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
  opacity: 0.55;
}
.hc.tl {
  left: calc(8px + var(--sl));
  top: calc(8px + var(--st));
  border-left-width: 1px;
  border-top-width: 1px;
}
.hc.tr {
  right: calc(8px + var(--sr));
  top: calc(8px + var(--st));
  border-right-width: 1px;
  border-top-width: 1px;
}
.hc.bl {
  left: calc(8px + var(--sl));
  bottom: calc(8px + var(--sb));
  border-left-width: 1px;
  border-bottom-width: 1px;
}
.hc.br {
  right: calc(8px + var(--sr));
  bottom: calc(8px + var(--sb));
  border-right-width: 1px;
  border-bottom-width: 1px;
}
.hud-read {
  position: absolute;
  right: calc(22px + var(--sr));
  bottom: calc(22px + var(--sb));
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--accent);
  opacity: 0.7;
  white-space: pre;
}

/* ---------- 摄像头预览 ---------- */
.cam-panel {
  position: fixed;
  left: calc(18px + var(--sl));
  bottom: calc(18px + var(--sb));
  width: 216px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  z-index: 19;
  display: none;
  cursor: pointer;
  transition: width 0.4s var(--ease);
}
.cam-on .cam-panel {
  display: block;
}
.cam-large .cam-panel {
  width: 360px;
}
.no-preview .cam-panel {
  width: 150px;
  aspect-ratio: auto;
  height: 32px;
}
.no-preview .cam-panel video,
.no-preview .cam-panel canvas {
  visibility: hidden;
}
.cam-panel video,
.cam-panel canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.cam-panel video {
  opacity: 0.8;
  filter: saturate(0.85) contrast(1.05);
}
.cam-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.5px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), transparent);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cam-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #888;
  flex: 0 0 auto;
}
.cam-status[data-state='ok']::before {
  background: #3dff8a;
  box-shadow: 0 0 8px #3dff8a;
}
.cam-status[data-state='busy']::before {
  background: var(--accent);
  animation: blink 1s infinite;
}
.cam-status[data-state='error']::before {
  background: #ff4d4d;
}
.cam-progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.3s;
}
.cam-progress.show {
  opacity: 1;
}
.cam-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.2s;
}
@keyframes blink {
  50% {
    opacity: 0.3;
  }
}

/* ---------- 手势徽章 ---------- */
.gesture-badge {
  position: fixed;
  left: calc(18px + var(--sl));
  bottom: calc(18px + var(--sb) + 162px + 10px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 19;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s var(--ease);
  pointer-events: none;
  max-width: 270px;
}
.cam-large .gesture-badge {
  bottom: calc(18px + var(--sb) + 270px + 10px);
}
.no-preview .gesture-badge {
  bottom: calc(18px + var(--sb) + 32px + 10px);
}
.gesture-badge.show {
  opacity: 1;
  transform: none;
}
.g-emoji {
  font-size: 28px;
  line-height: 1;
}
.g-emoji .hand-art {
  width: 44px;
  height: 40px;
}
.g-text {
  display: flex;
  flex-direction: column;
}
.g-text b {
  font-size: 14px;
  color: var(--accent);
}
.g-text small {
  font-size: 11px;
  color: var(--muted);
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(88px + var(--st));
  transform: translate(-50%, -12px) scale(0.96);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 10px 14px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.45s var(--ease);
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.t-emoji {
  font-size: 20px;
  color: var(--accent);
}
.t-text {
  font-size: 14px;
  letter-spacing: 0.5px;
}

/* ---------- 面板 ---------- */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(390px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--glass-strong);
  border-left: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  z-index: 50;
  transform: translateX(105%);
  transition: transform 0.5s var(--ease);
  padding-top: var(--st);
  padding-right: var(--sr);
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
}
.panel.open {
  transform: none;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px 22px;
}
.panel-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
}
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 22px 18px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px calc(14px + var(--sb));
  border-top: 1px solid var(--line);
}

.group {
  margin: 8px 0 18px;
}
.group h3 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 14px 0 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--soft);
}
.row > label {
  font-size: 14px;
  flex: 0 0 auto;
}
.row-hint {
  flex: 1 0 100%;
  font-size: 11px;
  color: var(--muted);
}
.row select,
.row input[type='text'] {
  flex: 1;
  max-width: 220px;
  min-width: 0;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.row input[type='text']::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
.row select:focus,
.row input[type='text']:focus {
  border-color: var(--accent);
}
.row select option {
  background: #111827;
  color: #fff;
}
.range {
  flex: 1;
  max-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.range output {
  font-size: 12px;
  color: var(--accent);
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  outline: none;
  touch-action: pan-x;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
}
input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: var(--line);
  transition: background 0.25s;
  cursor: pointer;
}
.switch span::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s var(--ease);
}
.switch input:checked + span {
  background: var(--accent);
}
.switch input:checked + span::before {
  transform: translateX(20px);
}

.btn {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  border-color: transparent;
  color: var(--btn-text);
  font-weight: 700;
  background: var(--accent);
}
.btn.ghost {
  background: transparent;
}
.btn.small {
  padding: 5px 10px;
  font-size: 12px;
}
.btn.big {
  padding: 14px 26px;
  font-size: 16px;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* 风格选择（设置面板） */
.style-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 4px 0 6px;
}
.style-pick,
.istyle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px 9px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--soft);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.2s;
  text-align: center;
}
.style-pick i,
.istyle i {
  font-style: normal;
  font-size: 22px;
  line-height: 1.1;
}
.style-pick b,
.istyle b {
  font-size: 13px;
}
.style-pick small,
.istyle small {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.35;
}
.style-pick.active,
.istyle.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.style-pick:active,
.istyle:active {
  transform: scale(0.97);
}
.share-box {
  padding: 12px 0 4px;
}
.share-box .btn {
  width: 100%;
}

.photo-box {
  padding: 6px 0 4px;
}
.photo-actions {
  display: flex;
  gap: 8px;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb .cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 4px;
  font-size: 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thumb button {
  position: absolute;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 13px;
  line-height: 22px;
  padding: 0;
  cursor: pointer;
}
.thumb .del {
  right: 3px;
}
.thumb .edit {
  left: 3px;
}
.music-ctl {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
#musicName {
  font-size: 12px;
  color: var(--muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gesture-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 10px;
  display: grid;
  gap: 8px;
}
.gesture-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--soft);
  border: 1px solid var(--soft);
}
.gesture-list .ge {
  flex: none;
  width: 74px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.gesture-list .ge .hand-art {
  width: 70px;
  height: 60px;
}

/* ---------- 手势图解（js/handart.js 画的小手） ---------- */
.hand-art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  --ha-f: #fff0d6;
  --ha-o: #6b3d1c;
  --ha-c: #ffffff;
  --ha-x: var(--accent);
}
.hand-art .o,
.hand-art .f {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hand-art .o {
  stroke: var(--ha-o);
}
.hand-art .f {
  stroke: var(--ha-f);
}
.hand-art .o.pm {
  fill: var(--ha-o);
}
.hand-art .f.pm {
  fill: var(--ha-f);
}
.hand-art .ln {
  fill: none;
  stroke: var(--ha-o);
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0.35;
}
.hand-art .cuff {
  fill: var(--ha-c);
  stroke: var(--ha-o);
  stroke-width: 2;
}
.hand-art .x {
  fill: none;
  stroke: var(--ha-x);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hand-art .xf {
  fill: var(--ha-x);
}
.hand-art .cd {
  fill: var(--ha-f);
  stroke: var(--ha-o);
  stroke-width: 1.6;
}
.hand-art .ci {
  fill: var(--ha-x);
  opacity: 0.45;
}
.hand-art .cm {
  fill: var(--ha-o);
  opacity: 0.55;
}
body[data-style='star'] .hand-art {
  --ha-f: #071526;
  --ha-o: #7df9ff;
  --ha-c: #071526;
  --ha-x: #7df9ff;
}
body[data-style='ink'] .hand-art {
  --ha-f: #fbf6ea;
  --ha-o: #1d1a16;
  --ha-c: #fbf6ea;
  --ha-x: #b8322a;
}
body[data-style='ice'] .hand-art {
  --ha-f: #effaff;
  --ha-o: #2a6f99;
  --ha-c: #ffffff;
  --ha-x: #8fe3ff;
}
.gesture-list b {
  display: block;
  font-size: 14px;
  color: var(--accent);
}
.gesture-list small {
  font-size: 12px;
  color: var(--muted);
}
.gesture-list li.gsec {
  display: block;
  padding: 10px 4px 0;
  background: none;
  border: 0;
}
.gesture-list li.gsec small {
  display: block;
}
.sub {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 18px 0 6px;
}
.plain {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.9;
}
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-family: inherit;
  font-size: 12px;
  text-align: center;
  margin: 0 2px;
}

/* ---------- 开场 ---------- */
#intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: calc(20px + var(--st)) 18px calc(20px + var(--sb));
  background: radial-gradient(ellipse at center, rgba(2, 5, 15, 0.2) 0%, rgba(2, 5, 15, 0.8) 72%);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), background 0.6s;
  overflow-y: auto;
  touch-action: pan-y;
}
#intro.hide {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}
.intro-card {
  max-width: 640px;
  width: 100%;
  text-align: center;
  animation: rise 1.4s var(--ease) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}
.intro-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-transform: uppercase;
}
.intro-to {
  margin: 16px 0 0;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--muted);
}
.intro-to b {
  color: var(--accent);
  font-size: 20px;
  margin: 0 6px;
}
.intro-title {
  margin: 14px 0 6px;
  font-family: var(--font-title);
  font-size: clamp(40px, 8.5vw, 92px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.intro-sub {
  margin: 0 0 20px;
  font-size: clamp(13px, 2.1vw, 17px);
  letter-spacing: 2px;
  opacity: 0.85;
}
.intro-styles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 640px;
  margin: 0 auto 18px;
}
.istyle {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: var(--glass);
}
.intro-feats {
  list-style: none;
  padding: 0;
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-width: 520px;
}
.intro-feats li {
  padding: 8px 2px;
  font-size: 11px;
  color: var(--muted);
}
.intro-feats b {
  display: block;
  font-size: 20px;
  margin-bottom: 3px;
}
.intro-feats b .hand-art {
  width: 52px;
  height: 46px;
  margin: 0 auto;
}
.intro-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.intro-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}
.intro-warn {
  margin: 16px auto 0;
  max-width: 480px;
  font-size: 13px;
  line-height: 1.7;
  color: #ffd2a0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(255, 140, 40, 0.12);
  border: 1px solid rgba(255, 160, 60, 0.35);
}

#fatal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  padding: 18px 22px;
  border-radius: 12px;
  background: #2a0d0d;
  color: #fff;
  border: 1px solid #ff6b6b;
  max-width: 90vw;
  font-size: 14px;
}

/* =====================================================================
 * 星图天象仪：细线、等宽字、取景框
 * ===================================================================== */
body[data-style='star'] .brand .title {
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: clamp(16px, 2vw, 26px);
  color: var(--text);
  text-shadow: 0 0 18px rgba(160, 200, 255, 0.35);
}
body[data-style='star'] .brand .subtitle,
body[data-style='star'] .brand .ded {
  font-family: var(--font-mono);
  font-size: 11px;
}
body[data-style='star'] .brand .subtitle::before {
  content: '◇ ';
  color: var(--accent);
}
body[data-style='star'].started #hud {
  display: block;
}
body[data-style='star'] .icon-btn {
  background: rgba(4, 10, 26, 0.45);
}
body[data-style='star'] .dock {
  border-radius: 3px;
}
body[data-style='star'] .dock button span,
body[data-style='star'] .panel-head h2,
body[data-style='star'] .group h3,
body[data-style='star'] .t-text,
body[data-style='star'] .intro-badge {
  font-family: var(--font-mono);
}
body[data-style='star'] .dock button.active {
  background: linear-gradient(180deg, transparent 70%, color-mix(in srgb, var(--accent) 22%, transparent));
  box-shadow: inset 0 -1px 0 var(--accent);
}
body[data-style='star'] .toast {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
body[data-style='star'] .toast::before,
body[data-style='star'] .toast::after {
  content: '';
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 8px;
  border: 1px solid var(--accent);
}
body[data-style='star'] .toast::before {
  left: -1px;
  border-right: 0;
}
body[data-style='star'] .toast::after {
  right: -1px;
  border-left: 0;
}
body[data-style='star'] .intro-title {
  font-weight: 200;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: clamp(30px, 6.6vw, 72px);
  text-shadow: 0 0 30px rgba(140, 190, 255, 0.45);
}
body[data-style='star'] .intro-sub {
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.8vw, 15px);
}

/* =====================================================================
 * 东方水墨：宣纸面板、楷体、朱红印章
 * ===================================================================== */
body[data-style='ink'] {
  --text: #1d1a16;
  --muted: rgba(40, 32, 24, 0.62);
  --glass: rgba(246, 239, 222, 0.72);
  --glass-strong: rgba(243, 235, 216, 0.97);
  --line: rgba(60, 44, 28, 0.28);
  --soft: rgba(80, 60, 30, 0.06);
  --radius: 2px;
  --radius-lg: 3px;
  --btn-text: #fff6ea;
  --font-ui: Georgia, 'KaiTi', 'STKaiti', 'Kaiti SC', '楷体', 'PingFang SC', 'Microsoft YaHei', serif;
  --font-title: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, 'STXingkai', '华文行楷', 'KaiTi', 'STKaiti', 'Kaiti SC', '楷体', serif;
}
body[data-style='ink'] .brand .title {
  font-size: clamp(24px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: 2px;
}
body[data-style='ink'] .brand .subtitle {
  letter-spacing: 4px;
}
body[data-style='ink'] #seal {
  display: flex;
  writing-mode: vertical-rl;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-top: 10px;
  padding: 3px;
  background: var(--accent);
  color: #f7ecdc;
  font-family: 'KaiTi', 'STKaiti', 'Kaiti SC', serif;
  font-weight: 900;
  font-size: 18px;
  line-height: 1;
  border-radius: 3px 5px 2px 4px;
  box-shadow: inset 0 0 0 2px rgba(255, 240, 220, 0.25), 0 1px 0 rgba(0, 0, 0, 0.08);
  transform: rotate(-3deg);
}
body[data-style='ink'] #seal[data-n='1'] {
  font-size: 30px;
}
body[data-style='ink'] #seal i {
  font-style: normal;
  display: block;
  height: 50%;
  display: grid;
  place-items: center;
}
body[data-style='ink'] #seal[data-n='1'] i {
  height: 100%;
}
body[data-style='ink'] .icon-btn {
  background: rgba(247, 241, 226, 0.78);
  border: 1.5px solid rgba(30, 24, 18, 0.7);
  border-radius: 3px 6px 4px 5px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body[data-style='ink'] .icon-btn svg {
  stroke-width: 1.9;
}
body[data-style='ink'] .icon-btn.active {
  background: var(--accent);
  color: #fff6ea;
  border-color: var(--accent);
}
body[data-style='ink'] .dock {
  background: rgba(246, 239, 222, 0.85);
  border: 1.5px solid rgba(30, 24, 18, 0.55);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 6px 18px rgba(80, 60, 30, 0.15);
}
body[data-style='ink'] .dock button + button {
  border-left: 1px dashed rgba(60, 44, 28, 0.18);
}
body[data-style='ink'] .dock button span {
  font-size: 13px;
  color: var(--text);
}
body[data-style='ink'] .dock button.active {
  background: var(--accent);
}
body[data-style='ink'] .dock button.active span {
  color: #fff6ea;
}
body[data-style='ink'] .panel {
  background: linear-gradient(180deg, rgba(247, 240, 224, 0.98), rgba(239, 229, 205, 0.98));
  border-left: 2px solid rgba(40, 30, 20, 0.6);
}
body[data-style='ink'] .panel-head h2 {
  font-family: var(--font-title);
  font-size: 24px;
}
body[data-style='ink'] .row select option {
  background: #f3ebd8;
  color: #1d1a16;
}
body[data-style='ink'] .switch span::before {
  background: #fffaf0;
}
body[data-style='ink'] .toast {
  background: rgba(246, 239, 222, 0.97);
  border: 1.5px solid rgba(30, 24, 18, 0.6);
  box-shadow: 0 8px 20px rgba(80, 60, 30, 0.18);
}
body[data-style='ink'] .t-text {
  font-size: 16px;
}
body[data-style='ink'] .gesture-badge {
  background: rgba(246, 239, 222, 0.95);
}
body[data-style='ink'] #intro {
  background: radial-gradient(ellipse at center, rgba(239, 230, 210, 0.15) 0%, rgba(239, 230, 210, 0.75) 72%);
}
body[data-style='ink'] .intro-title {
  font-weight: 700;
  font-size: clamp(46px, 9vw, 100px);
  letter-spacing: 4px;
}
body[data-style='ink'] .intro-badge {
  border: 1.5px solid var(--accent);
  color: var(--accent);
}
body[data-style='ink'] .istyle {
  background: rgba(246, 239, 222, 0.8);
}
body[data-style='ink'] .btn.primary {
  border-radius: 3px 6px 4px 5px;
}
body[data-style='ink'] .cam-panel {
  border: 2px solid rgba(30, 24, 18, 0.7);
}

/* =====================================================================
 * 经典圣诞：黑底香槟金、衬线斜体标题、细金线
 * ===================================================================== */
body[data-style='classic'] {
  --text: #fff8ea;
  --muted: rgba(255, 238, 210, 0.62);
  --glass: rgba(16, 12, 6, 0.55);
  --glass-strong: rgba(18, 14, 8, 0.94);
  --line: rgba(255, 214, 140, 0.22);
  --soft: rgba(255, 228, 190, 0.07);
  --radius: 10px;
  --radius-lg: 16px;
  --btn-text: #fff6e0;
  --font-title: Georgia, 'Times New Roman', 'Songti SC', 'SimSun', serif;
}
body[data-style='classic'] .brand .title {
  font-style: italic;
  font-weight: 700;
  font-size: clamp(20px, 2.5vw, 32px);
  color: #fff3d6;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
body[data-style='classic'] .icon-btn {
  border-radius: 50%;
}
body[data-style='classic'] .icon-btn.active {
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 55%, transparent);
}
body[data-style='classic'] .dock {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 70%, transparent), transparent) top / 100% 1px no-repeat, var(--glass);
}
body[data-style='classic'] .dock button.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 34%, transparent), color-mix(in srgb, var(--accent) 12%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 25%, transparent);
}
body[data-style='classic'] .dock button.active span {
  color: #fff3d6;
}
body[data-style='classic'] .toast {
  border-radius: 999px;
  border-color: rgba(255, 210, 120, 0.5);
}
body[data-style='classic'] #intro {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.8) 72%);
}
body[data-style='classic'] .intro-title {
  font-style: italic;
  font-weight: 400;
  color: #fff3d6;
  text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent);
}
body[data-style='classic'] .btn.primary {
  border: 1px solid color-mix(in srgb, var(--accent) 80%, transparent);
  color: #1a1206;
  background: linear-gradient(180deg, #ffe6a8, color-mix(in srgb, var(--accent) 90%, #8a5a12));
  box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 30%, transparent);
}
body[data-style='classic'] .btn.big {
  border-radius: 999px;
}

/* =====================================================================
 * 冰晶棱镜：磨砂冰面、圆角、冷光
 * ===================================================================== */
body[data-style='ice'] {
  --text: #f2fbff;
  --muted: rgba(225, 244, 255, 0.7);
  --glass: rgba(200, 235, 255, 0.12);
  --glass-strong: rgba(14, 40, 58, 0.7);
  --line: rgba(255, 255, 255, 0.3);
  --soft: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --radius-lg: 20px;
  --btn-text: #052235;
  --font-title: 'Avenir Next', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
body[data-style='ice']::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(210, 240, 255, 0.1) 85%, rgba(230, 248, 255, 0.2) 100%);
}
body[data-style='ice'] .brand .title {
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(100deg, #ffffff 0%, #d6f6ff 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 55%, transparent));
}
body[data-style='ice'] .icon-btn {
  border-radius: 50%;
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 18px rgba(0, 20, 40, 0.25);
}
body[data-style='ice'] .icon-btn.active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent);
}
body[data-style='ice'] .dock {
  border-radius: 26px;
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 30px rgba(0, 20, 40, 0.3);
}
body[data-style='ice'] .dock button {
  border-radius: 20px;
}
body[data-style='ice'] .dock button.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 16px color-mix(in srgb, var(--accent) 40%, transparent);
}
body[data-style='ice'] .toast {
  border-radius: 999px;
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 26px color-mix(in srgb, var(--accent) 30%, transparent);
}
body[data-style='ice'] .panel {
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
}
body[data-style='ice'] #intro {
  background: radial-gradient(ellipse at center, rgba(1, 12, 20, 0.15) 0%, rgba(1, 12, 20, 0.72) 72%);
}
body[data-style='ice'] .intro-title {
  font-weight: 800;
  background: linear-gradient(100deg, #ffffff 0%, #d6f6ff 35%, var(--accent) 70%, #ffffff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px color-mix(in srgb, var(--accent) 50%, transparent));
  animation: shine 6s linear infinite;
}
@keyframes shine {
  to {
    background-position: -200% 0;
  }
}
body[data-style='ice'] .btn.primary {
  border-radius: 999px;
  background: linear-gradient(100deg, #ffffff, var(--accent));
  box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 45%, transparent);
}
body[data-style='ice'] .btn.big {
  border-radius: 999px;
}

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  .topbar {
    padding: calc(10px + var(--st)) calc(10px + var(--sr)) 0 calc(14px + var(--sl));
  }
  .brand {
    max-width: 44vw;
  }
  .brand .title {
    font-size: 18px;
  }
  body[data-style='star'] .brand .title {
    font-size: 14px;
    letter-spacing: 0.14em;
  }
  body[data-style='ink'] .brand .title {
    font-size: 22px;
  }
  .brand .subtitle {
    font-size: 10px;
    letter-spacing: 1px;
  }
  body[data-style='ink'] #seal {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }
  .actions {
    gap: 6px;
    max-width: 210px;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  .icon-btn svg {
    width: 18px;
    height: 18px;
  }
  .dock {
    bottom: calc(10px + var(--sb));
    padding: 3px;
  }
  .dock button {
    min-width: 42px;
    padding: 6px 2px 5px;
  }
  .dock button i {
    font-size: 18px;
  }
  .dock button span,
  body[data-style='ink'] .dock button span {
    font-size: 10px;
    letter-spacing: 0;
  }
  .hud-read {
    display: none;
  }
  .cam-panel {
    width: 112px;
    left: calc(10px + var(--sl));
    bottom: calc(82px + var(--sb));
  }
  .cam-large .cam-panel {
    width: 200px;
  }
  .cam-status {
    font-size: 9px;
    padding: 4px 6px;
  }
  .gesture-badge {
    left: calc(10px + var(--sl));
    bottom: calc(82px + var(--sb) + 84px + 8px);
    padding: 6px 10px 6px 8px;
    max-width: 220px;
  }
  .cam-large .gesture-badge {
    bottom: calc(82px + var(--sb) + 150px + 8px);
  }
  .no-preview .gesture-badge {
    bottom: calc(82px + var(--sb) + 32px + 8px);
  }
  .g-emoji {
    font-size: 22px;
  }
  .toast {
    top: calc(70px + var(--st));
  }
  .panel {
    top: auto;
    left: 0;
    width: 100%;
    height: min(80vh, 660px);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    transform: translateY(105%);
    padding-top: 0;
  }
  body[data-style='ink'] .panel {
    border-left: 0;
    border-top: 2px solid rgba(40, 30, 20, 0.6);
    border-radius: 3px 3px 0 0;
  }
  .panel.open {
    transform: none;
  }
  .intro-styles {
    gap: 6px;
    grid-template-columns: repeat(2, 1fr);
  }
  .istyle {
    padding: 9px 4px 8px;
    background: var(--glass-strong);
  }
  .istyle small {
    font-size: 10px;
    line-height: 1.3;
  }
  #intro,
  body[data-style='ice'] #intro {
    background: radial-gradient(ellipse at center, rgba(2, 6, 16, 0.42) 0%, rgba(2, 6, 16, 0.82) 70%);
  }
  .intro-feats {
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    margin-bottom: 16px;
  }
  .intro-feats li {
    padding: 5px 2px;
  }
  .btn.big {
    width: 100%;
    padding: 13px 20px;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .intro-feats {
    display: none;
  }
  .intro-title {
    font-size: 40px !important;
  }
  .cam-panel {
    width: 140px;
  }
  .gesture-badge {
    bottom: calc(18px + var(--sb) + 105px + 10px);
  }
}

/* ================= 服务器版：发布给朋友 ================= */
.seg {
  display: flex;
  gap: 4px;
  margin: 12px 0;
  padding: 3px;
  border-radius: var(--radius-lg);
  background: var(--soft);
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px;
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.seg button.active {
  background: var(--accent);
  color: var(--btn-text);
  font-weight: 700;
}
.cform {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0;
}
.cform label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.cform label small {
  font-size: 11px;
  opacity: 0.8;
}
.cform label.ccheck {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.cform input:not([type='checkbox']),
.cform select,
.cform textarea,
.clink input,
.v-pass input {
  width: 100%;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.cform textarea {
  resize: vertical;
}
.cform input:focus,
.cform select,
.cform textarea:focus {
  border-color: var(--accent);
}
.cform select option {
  background: #111827;
  color: #fff;
}
.cerr {
  margin: 0;
  color: #ff8a8a;
  font-size: 13px;
}
.cbtns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cuser {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0 2px;
  font-size: 14px;
}
.hint.small {
  font-size: 11px;
}
.cprog {
  position: relative;
  height: 22px;
  border-radius: var(--radius);
  background: var(--soft);
  overflow: hidden;
  font-size: 12px;
}
.cprog i {
  position: absolute;
  inset: 0 auto 0 0;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: width 0.3s;
}
.cprog span {
  position: relative;
  padding: 0 10px;
  line-height: 22px;
}
.cresult {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.clink {
  display: flex;
  gap: 8px;
}
.cqr {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--muted);
}
.cqr canvas {
  width: 116px;
  height: 116px;
  border-radius: var(--radius);
  image-rendering: pixelated;
  flex: 0 0 auto;
}
.cqr p {
  margin: 0 0 8px;
}
.wcard {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--soft);
}
.wcard.cur .winfo b {
  color: var(--accent);
}
.wcover {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--soft);
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-style: normal;
}
.wcover i {
  font-style: normal;
}
.wcover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.winfo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
}
.winfo b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.winfo b em {
  font-style: normal;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.winfo small {
  font-size: 11px;
  color: var(--muted);
}
.chip {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--soft);
  color: var(--muted);
}
.chip.published {
  background: color-mix(in srgb, #5fd38d 22%, transparent);
  color: #8fe6b0;
}
.chip.revoked,
.chip.banned {
  background: color-mix(in srgb, #ff6b6b 20%, transparent);
  color: #ff9d9d;
}
.wbtns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 2px;
}
.wbtns button {
  border: 0;
  background: none;
  padding: 2px 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}
.wbtns button.danger {
  color: #ff9d9d;
}

/* 弹窗（二维码、海报、回复、举报） */
#cmodal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#cmodal.show {
  display: grid;
}
.cm-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--glass-strong);
  color: var(--text);
  user-select: text;
  -webkit-user-select: text;
}
.cm-card h3 {
  margin: 0 0 12px;
  padding-right: 30px;
  color: var(--accent);
}
.cm-x {
  position: absolute;
  top: 12px;
  right: 12px;
}
.cm-qr {
  display: block;
  width: 240px;
  max-width: 100%;
  margin: 0 auto 8px;
  image-rendering: pixelated;
  border-radius: var(--radius);
}
.cm-poster {
  display: block;
  width: 100%;
  border-radius: var(--radius);
}
.cm-card .hint {
  word-break: break-all;
}
.cm-replies .rp {
  padding: 10px 0;
  border-bottom: 1px solid var(--soft);
}
.cm-replies .rp small {
  margin-left: 8px;
  color: var(--muted);
}
.cm-replies .rp p {
  margin: 6px 0;
  white-space: pre-wrap;
}

/* ================= 接收者看礼物 ================= */
body.viewer #btnUpload,
body.viewer #btnSettings,
body.viewer #btnCloud,
body.viewer #dock [data-action='style'],
body.viewer #dock [data-action='palette'] {
  display: none;
}
.gift-card .gift-box {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
  animation: giftBob 2.4s ease-in-out infinite;
}
@keyframes giftBob {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-8px) rotate(4deg);
  }
}
.v-line {
  margin: 10px 0;
  font-size: 16px;
}
.v-line.small {
  font-size: 13px;
  color: var(--muted);
}
.v-pass {
  display: flex;
  gap: 8px;
  max-width: 320px;
  margin: 14px auto;
}
.v-count {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 4px;
  margin: 18px 0;
  font-variant-numeric: tabular-nums;
}
.v-count b {
  font-size: 40px;
  color: var(--accent);
}
.v-count small {
  margin-right: 8px;
  color: var(--muted);
}
#vBar {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--sb, 0px));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s, transform 0.5s var(--ease);
}
#vBar.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
#vBar a.btn {
  text-decoration: none;
  color: inherit;
}
.v-report {
  border: 0;
  background: none;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.chrome-hidden #vBar {
  opacity: 0;
  pointer-events: none;
}
@media (max-width: 520px) {
  #vBar {
    width: calc(100% - 24px);
    justify-content: center;
    flex-wrap: wrap;
  }
}
.cresult a.btn,
.cm-card a.btn {
  text-decoration: none;
  color: inherit;
  display: inline-block;
}
.cresult a.btn.primary,
.cm-card a.btn.primary {
  color: var(--btn-text);
}

/* 发布表单里的主题选择 */
.ctheme {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ctheme .clabel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--muted);
}
.ctheme .clabel small {
  font-size: 11px;
  opacity: 0.8;
}
.cstyles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.cstyles button,
.cpals button {
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  background: var(--soft);
  color: var(--muted);
  border-radius: var(--radius);
  font: inherit;
  cursor: pointer;
}
.cstyles button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  font-size: 12px;
}
.cstyles button i {
  font-style: normal;
  font-size: 18px;
  line-height: 1.2;
}
.cpals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cpals button {
  padding: 5px 10px;
  font-size: 12px;
}
.cstyles button.active,
.cpals button.active {
  border-color: var(--accent);
  color: var(--text, inherit);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  font-weight: 700;
}


/* =====================================================================
 * 树下的大标题：圣诞树形态才出现，其他形态淡出（左上角的小标题这时让位）
 * ===================================================================== */
#treeTitle {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(86px + var(--sb));
  z-index: 5;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
  padding: 0 16px;
}
.started[data-mode='tree'] #treeTitle {
  opacity: 1;
  transform: none;
  transition-delay: 0.5s;
}
#treeTitle .tt-main {
  font-family: var(--font-title);
  font-size: clamp(28px, min(4.6vw, 7.2vh), 60px);
  line-height: 1.1;
  color: var(--text);
  overflow-wrap: anywhere;
}
#treeTitle .tt-sub {
  margin-top: 6px;
  font-size: clamp(11px, 1.3vw, 14px);
  letter-spacing: 0.32em;
  color: var(--muted);
}
.brand .title,
.brand .ded {
  transition: opacity 0.8s var(--ease);
}
.started[data-mode='tree'] .brand .title,
.started[data-mode='tree'] .brand .ded {
  opacity: 0;
}
body[data-style='classic'] #treeTitle .tt-main {
  font-family: 'Bodoni MT', Didot, 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #fffaf0 0%, var(--star) 48%, color-mix(in srgb, var(--star) 60%, #6b4210) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--star) 30%, transparent));
}
body[data-style='classic'] #treeTitle .tt-sub {
  color: color-mix(in srgb, var(--star) 70%, transparent);
}
body[data-style='star'] #treeTitle .tt-main {
  font-weight: 300;
  font-size: clamp(22px, min(3.4vw, 6vh), 42px);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
body[data-style='ink'] #treeTitle .tt-main {
  font-style: italic;
  font-weight: 400;
  color: #161616;
}
body[data-style='ice'] #treeTitle .tt-main {
  font-weight: 200;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #ffffff 10%, color-mix(in srgb, var(--accent) 80%, #ffffff) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 35%, transparent));
}
.chrome-hidden #treeTitle {
  bottom: calc(28px + var(--sb));
}
@media (max-height: 560px) and (orientation: landscape) {
  #treeTitle {
    bottom: calc(70px + var(--sb));
  }
  #treeTitle .tt-sub {
    display: none;
  }
}

/* ======================================================================
   动效：统一的缓动、依次入场、弹性高亮、电影遮幅
   ====================================================================== */
:root {
  --spring: cubic-bezier(0.34, 1.42, 0.64, 1);
  --glide: cubic-bezier(0.65, 0, 0.35, 1);
}

/* 标题：字距从宽收拢、从模糊到清晰（片头字幕的感觉） */
@keyframes trackIn {
  from {
    letter-spacing: 0.32em;
    opacity: 0;
    filter: blur(12px);
  }
  45% {
    opacity: 0.75;
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(5px);
  }
}
/* 圣诞树时左上角标题是隐藏的（树下有自己的标题），所以每次它出现时都收拢一次 */
.started:not([data-mode='tree']) .brand .title {
  animation: trackIn 1.7s cubic-bezier(0.19, 1, 0.22, 1) 0.1s backwards;
}
.started .brand .subtitle {
  animation: fadeUp 1.2s var(--ease) 0.75s backwards;
}
/* 树下的大标题：每次聚成树都像片头字幕一样字距收拢浮现（不动 filter，保留各风格的发光） */
@keyframes trackInSoft {
  from {
    letter-spacing: 0.4em;
    opacity: 0;
  }
}
.started[data-mode='tree'] #treeTitle .tt-main {
  animation: trackInSoft 2.2s cubic-bezier(0.19, 1, 0.22, 1) 0.6s backwards;
}
.started[data-mode='tree'] #treeTitle .tt-sub {
  animation: fadeUp 1.4s var(--ease) 1.2s backwards;
}

/* 底栏按钮、右上角按钮：一个接一个浮上来 */
@keyframes dockIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.86);
    filter: blur(6px);
  }
}
@keyframes actIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.8);
  }
}
.started .dock button {
  animation: dockIn 0.85s var(--ease) backwards;
  animation-delay: calc(0.35s + var(--i, 0) * 55ms);
}
.started .actions > * {
  animation: actIn 0.75s var(--ease) backwards;
  animation-delay: calc(0.2s + var(--i, 0) * 50ms);
}

/* 当前模式的高亮块：换模式时带一点弹性滑过去 */
.dock button {
  position: relative;
  z-index: 1;
}
.dock-pill {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: 0;
  border-radius: var(--radius);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 24px -12px var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent), 0 8px 24px -12px var(--accent);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.6s var(--spring), width 0.6s var(--spring), opacity 0.3s;
}
.dock-pill::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 16px;
  height: 2px;
  margin-left: -8px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.dock-pill.no-anim {
  transition: none;
}
@keyframes iconPop {
  0% {
    transform: scale(0.7) rotate(-12deg);
  }
  60% {
    transform: scale(1.18) rotate(4deg);
  }
}
.dock button.active i {
  animation: iconPop 0.6s var(--spring);
}
.dock button:hover i {
  transform: translateY(-2px);
}
.dock button i {
  transition: transform 0.35s var(--spring);
}

/* 提示：弹性落下、从模糊到清晰，表情跳一下，一道光扫过 */
.toast {
  overflow: hidden;
  filter: blur(6px);
  transform: translate(-50%, -16px) scale(0.9);
  transition: opacity 0.35s, transform 0.6s var(--spring), filter 0.45s var(--ease);
}
.toast.show {
  filter: blur(0);
}
@keyframes emojiPop {
  from {
    opacity: 0;
    transform: scale(0.3) rotate(-30deg);
  }
}
.toast.show .t-emoji {
  display: inline-block;
  animation: emojiPop 0.7s var(--spring) 0.06s backwards;
}
.toast::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.16) 50%, transparent 65%);
  transform: translateX(-110%);
}
.toast.show::after {
  animation: sweep 1.2s var(--ease) 0.12s;
}
@keyframes sweep {
  to {
    transform: translateX(110%);
  }
}

/* 手势提示牌：同样的弹性 + 模糊入场 */
.gesture-badge {
  filter: blur(4px);
  transform: translateY(10px) scale(0.94);
  transition: opacity 0.3s, transform 0.55s var(--spring), filter 0.4s var(--ease);
}
.gesture-badge.show {
  filter: blur(0);
}

/* 面板：滑出时里面的设置一组组依次滑入 */
.panel {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}
.panel.open .panel-body > * {
  animation: rowIn 0.65s var(--ease) backwards;
  animation-delay: calc(0.12s + var(--i, 0) * 45ms);
}

/* 按钮按下：先压一下再弹回 */
.icon-btn:active,
.dock button:active {
  transition-duration: 0.08s;
}
.icon-btn {
  transition: transform 0.4s var(--spring), border-color 0.25s, box-shadow 0.25s, background 0.25s, color 0.25s;
}
.icon-btn:hover {
  box-shadow: 0 6px 20px -10px var(--accent);
}

/* 电影遮幅：大爆炸的慢动作里，上下黑边滑进来 */
#letterbox {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}
#letterbox i {
  position: absolute;
  left: 0;
  right: 0;
  height: clamp(5vh, calc((100vh - 100vw / 2.39) / 2), 12vh);
  background: #000;
  transition: transform 0.9s var(--glide);
}
#letterbox i:first-child {
  top: 0;
  transform: translateY(-101%);
}
#letterbox i:last-child {
  bottom: 0;
  transform: translateY(101%);
}
.letterbox #letterbox i {
  transform: none;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (orientation: portrait) {
  #letterbox i {
    height: 7vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .started:not([data-mode='tree']) .brand .title,
  .started[data-mode='tree'] #treeTitle .tt-main,
  .started[data-mode='tree'] #treeTitle .tt-sub,
  .started .brand .subtitle,
  .started .dock button,
  .started .actions > *,
  .panel.open .panel-body > *,
  .toast.show .t-emoji,
  .toast.show::after,
  .dock button.active i {
    animation: none;
  }
}

/* ================= 管理后台（☁️ 面板里，只有管理员能看到） ================= */
.chip.admin {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--accent);
}
.aentry {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.abadge {
  display: inline-block;
  min-width: 18px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ff5f5f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.aseg button {
  padding: 7px 2px;
  font-size: 13px;
}
.amode button {
  font-size: 13px;
  padding: 7px 2px;
}
.astats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 16px;
}
.astat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  font: inherit;
  text-align: left;
}
button.astat {
  cursor: pointer;
  transition: background 0.2s;
}
button.astat:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--soft));
}
.astat b {
  color: var(--text);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.astat span {
  font-size: 12px;
}
.astat small {
  font-size: 10px;
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.astat.warn b {
  color: #ff8a8a;
}
.asearch {
  display: flex;
  gap: 6px;
  margin: 4px 0 6px;
}
.asearch input,
.asearch select {
  min-width: 0;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 9px;
  font: inherit;
  font-size: 14px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.asearch input {
  flex: 1;
}
.asearch input:focus {
  border-color: var(--accent);
}
.asearch select option {
  background: #111827;
  color: #fff;
}
.arow {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 0;
  border-bottom: 1px solid var(--soft);
  font-size: 14px;
}
.arow.dim {
  opacity: 0.55;
}
.atitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.atitle b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.atitle em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}
.arow small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.areason {
  margin: 2px 0;
  padding: 6px 9px;
  border-left: 2px solid #ff8a8a;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: color-mix(in srgb, #ff6b6b 9%, transparent);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}
.acode {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  letter-spacing: 0.04em;
}
.arow2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.acheck {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 4px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.awarn {
  padding: 8px 10px;
  border-radius: var(--radius);
  background: color-mix(in srgb, #ffb020 12%, transparent);
}
.linkbtn {
  border: 0;
  background: none;
  padding: 0;
  margin-left: 4px;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.apath {
  word-break: break-all;
}
