:root {
  --bg: #090b10;
  --surface: rgba(16, 20, 29, 0.86);
  --surface-solid: #121620;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --text: #f3f6fc;
  --text-muted: #98a3b8;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f59e0b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

/* ==================== 摄像头舞台 ==================== */
.stage {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 35%, #182133 0%, #07090e 75%);
  overflow: hidden;
}

.preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: block;
}

.preview-video.mirrored {
  transform: scaleX(-1);
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 58px) 24px 110px;
  text-align: center;
  background: radial-gradient(circle at 50% 24%, rgba(59, 130, 246, 0.16), rgba(9, 11, 16, 0.94) 68%);
  transition: padding-bottom 0.25s ease;
}

.app-shell.sheet-open .camera-placeholder {
  padding-bottom: 53dvh;
}

.placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  margin-bottom: 12px;
}

.placeholder-icon svg {
  width: 28px;
  height: 28px;
}

.camera-placeholder h1 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.camera-placeholder p {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 290px;
  line-height: 1.45;
}

.https-warning {
  margin-top: 14px !important;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fcd34d !important;
  font-size: 12px !important;
}

/* 人脸对准引导框 */
.face-guide-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 15dvh;
}

.face-guide-oval {
  width: min(58vw, 250px);
  height: min(74vw, 320px);
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), inset 0 0 24px rgba(255, 255, 255, 0.08);
}

.face-guide-tip {
  margin-top: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
}

/* ==================== 纯色闪光层 ==================== */
.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.flash-overlay.interactive-backdrop {
  pointer-events: auto;
}

.flash-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.flash-svg.smooth-cut #flashColorRect {
  transition: fill 0.22s linear;
}

.flash-oval-border {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.flash-running-hud {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 12px;
  right: 12px;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.flash-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(9, 11, 16, 0.68);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: auto;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  display: inline-block;
  flex-shrink: 0;
}

.flash-step-counter {
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}

.flash-exit-btn {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(9, 11, 16, 0.72);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.flash-exit-btn:active {
  transform: scale(0.95);
}

.flash-gesture-hint {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 22px);
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(9, 11, 16, 0.62);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

/* 回环测试小窗 */
.loopback-box {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  right: 12px;
  width: 120px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(59, 130, 246, 0.75);
  background: #000;
  z-index: 26;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48);
}

.loopback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 7px;
  font-size: 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #93c5fd;
}

.loopback-box video {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

/* ==================== 顶部状态栏 ==================== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: calc(var(--safe-top) + 10px) 12px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(180deg, rgba(9, 11, 16, 0.82) 0%, rgba(9, 11, 16, 0) 100%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.top-bar.ui-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

.status-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(15, 20, 30, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}

.status-badge.live {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fecaca;
}

.status-badge.live .status-dot {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseDot 1.2s infinite;
}

.status-badge.connecting {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}

.status-badge.connecting .status-dot {
  background: #f59e0b;
}

.status-badge.ready .status-dot {
  background: #22c55e;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.meta-pill {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15, 20, 30, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 20, 30, 0.74);
  backdrop-filter: blur(10px);
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn.active {
  background: rgba(59, 130, 246, 0.34);
  border-color: rgba(96, 165, 250, 0.75);
}

.icon-btn:active {
  transform: scale(0.93);
}

/* ==================== Toast ==================== */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(90vw, 380px);
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 20, 30, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.2s ease;
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.65);
  color: #fecaca;
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.65);
  color: #bbf7d0;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== 底部抽屉控制面板 ==================== */
.control-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  max-height: 52dvh;
  background: var(--surface);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px 22px 0 0;
  padding-bottom: var(--safe-bottom);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, max-height 0.26s ease;
}

.control-sheet.collapsed {
  max-height: calc(96px + var(--safe-bottom));
}

.control-sheet.collapsed .sheet-tabs,
.control-sheet.collapsed .sheet-body {
  display: none;
}

.control-sheet.collapsed #btnExpandSettings svg {
  transform: rotate(0deg);
}

.control-sheet.expanded #btnExpandSettings svg {
  transform: rotate(180deg);
}

.control-sheet.ui-hidden {
  transform: translateY(105%);
  opacity: 0;
  pointer-events: none;
}

.quick-bar {
  padding: 6px 14px 10px;
  flex-shrink: 0;
}

.sheet-handle-btn {
  width: 100%;
  padding: 4px 0 8px;
  border: none;
  background: transparent;
  display: flex;
  justify-content: center;
  cursor: pointer;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
}

.quick-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.quick-chip.active {
  background: rgba(59, 130, 246, 0.24);
  border-color: rgba(96, 165, 250, 0.72);
}

.quick-chip-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.09);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.quick-chip.active .quick-chip-icon {
  background: #3b82f6;
  color: #fff;
}

.quick-chip-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.quick-chip-col strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.mini-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.btn-broadcast {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.btn-broadcast.live {
  background: linear-gradient(135deg, #334155, #1e293b);
  border: 1px solid rgba(239, 68, 68, 0.75);
  box-shadow: none;
}

.btn-broadcast:active {
  transform: scale(0.96);
}

.broadcast-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.btn-broadcast.live .broadcast-dot {
  border-radius: 2px;
  background: #ef4444;
}

.quick-icon-pill {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.quick-icon-pill svg {
  width: 19px;
  height: 19px;
  transition: transform 0.2s ease;
}

/* 标签页 */
.sheet-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 14px 10px;
  flex-shrink: 0;
}

.sheet-tab {
  padding: 8px 6px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sheet-tab.active {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(96, 165, 250, 0.55);
  color: #fff;
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 16px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.sheet-body::-webkit-scrollbar {
  width: 4px;
}

.sheet-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-panel.active {
  display: flex;
}

/* ==================== 卡片与表单控件 ==================== */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 13px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.mb-10 { margin-bottom: 10px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 11px 0;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #f8fafc;
}

.row-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.hint-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(148, 163, 184, 0.34);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Segmented Control */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: 9px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--accent);
  color: #fff;
}

/* 按钮 */
.btn {
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-lg {
  padding: 13px 24px;
  font-size: 15px;
  border-radius: 14px;
}

.btn-sm {
  padding: 7px 11px;
  font-size: 12px;
  border-radius: 10px;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 11px;
  border-radius: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.btn-accent {
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(96, 165, 250, 0.6);
  color: #dbeafe;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

.btn-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* 预设颜色组合 */
.preset-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.preset-btn.active {
  border-color: rgba(96, 165, 250, 0.75);
  background: rgba(59, 130, 246, 0.16);
}

.preset-btn-name {
  font-size: 12px;
  font-weight: 600;
}

.preset-swatches {
  display: flex;
  gap: 5px;
  align-items: center;
}

.preset-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

/* 可选颜色调色盘 */
.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.color-swatch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 4px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 11px;
  cursor: pointer;
  position: relative;
}

.color-swatch-btn.in-seq {
  border-color: rgba(96, 165, 250, 0.7);
  background: rgba(59, 130, 246, 0.14);
}

.swatch-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.swatch-count {
  position: absolute;
  top: 4px;
  right: 5px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.custom-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-color-row input[type="color"] {
  width: 38px;
  height: 36px;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  flex-shrink: 0;
}

/* 序列芯片编辑器 */
.sequence-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 36px;
}

.seq-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
}

.seq-chip.current-active {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, 0.28);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.seq-chip.disabled-item {
  opacity: 0.45;
}

.seq-chip-color {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.seq-chip-label {
  font-weight: 600;
  cursor: pointer;
}

.seq-chip-btn {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.seq-chip-btn.remove {
  color: #fca5a5;
}

/* 滑块 */
.range-group {
  margin-bottom: 12px;
}

.range-group:last-child {
  margin-bottom: 0;
}

.range-header {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 6px;
  color: #cbd5e1;
}

.range-header strong {
  color: #93c5fd;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 6px;
}

.quick-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.pill-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  cursor: pointer;
}

.pill-btn.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(96, 165, 250, 0.7);
  color: #fff;
}

/* 推流协议选择 */
.protocol-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.proto-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.proto-btn strong {
  font-size: 12.5px;
}

.proto-btn span {
  font-size: 11px;
  color: var(--text-muted);
}

.proto-btn.active {
  border-color: rgba(96, 165, 250, 0.8);
  background: rgba(59, 130, 246, 0.2);
}

.proto-span-2 {
  grid-column: span 2;
}

/* 表单输入 */
.form-group {
  margin-bottom: 10px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.input-field {
  width: 100%;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35);
  color: #f8fafc;
  font-size: 13px;
  outline: none;
  user-select: text;
}

.input-field:focus {
  border-color: var(--accent);
}

.input-sm {
  padding: 8px 10px;
  font-size: 12px;
  flex: 1;
}

select.input-field option {
  background: #0f172a;
  color: #f8fafc;
}

.form-help {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

.form-help code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  color: #93c5fd;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* 指标与日志 */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric-item {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-item span {
  font-size: 10.5px;
  color: var(--text-muted);
}

.metric-item strong {
  font-size: 12.5px;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-log {
  max-height: 170px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 8px 10px;
  color: #cbd5e1;
  user-select: text;
}

.log-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 3px;
  word-break: break-all;
}

.log-time {
  color: #64748b;
  flex-shrink: 0;
}

.log-tag-flash {
  color: #93c5fd;
}

.log-tag-err {
  color: #fca5a5;
}

.log-tag-ok {
  color: #86efac;
}

/* 桌面端或宽屏适配：居中模拟手机壳体体验 */
@media (min-width: 720px) {
  .control-sheet {
    max-width: 520px;
    left: 50%;
    right: auto;
    width: 100%;
    transform: translateX(-50%);
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    border-right: 1px solid rgba(255, 255, 255, 0.14);
  }

  .control-sheet.ui-hidden {
    transform: translate(-50%, 105%);
  }
}

/* ==================== 4 标签布局与动作引导录制 ==================== */
.sheet-tabs-4 {
  grid-template-columns: repeat(4, 1fr);
}

.sheet-tabs-4 .sheet-tab {
  font-size: 12px;
  padding: 8px 2px;
}

.btn-full {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
}

a.btn {
  text-decoration: none;
}

/* 录制动作引导叠加层 */
.record-overlay {
  position: fixed;
  inset: 0;
  z-index: 46;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 14px calc(var(--safe-bottom) + 20px);
}

.rec-top-card {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(9, 12, 20, 0.82);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.rec-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rec-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.24);
  border: 1px solid rgba(239, 68, 68, 0.65);
  color: #fecaca;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulseDot 1s infinite;
}

.rec-step-badge {
  font-size: 12px;
  font-weight: 600;
  color: #93c5fd;
}

.rec-prompt-text {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  color: #fff;
  letter-spacing: 0.5px;
  margin: 4px 0 10px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.rec-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.rec-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  border-radius: 999px;
  transition: width 0.08s linear;
}

.rec-steps-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.rec-step-pill {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid transparent;
}

.rec-step-pill.done {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.5);
}

.rec-step-pill.active {
  background: rgba(59, 130, 246, 0.32);
  color: #fff;
  border-color: rgba(96, 165, 250, 0.85);
}

.rec-bottom-actions {
  width: min(440px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  gap: 8px;
  pointer-events: auto;
}

/* 上传进度浮层 */
.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(9, 11, 16, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.upload-card {
  width: min(360px, 100%);
  background: var(--surface-solid);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.upload-title {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

/* 已上传视频列表 */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-item {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.video-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.video-item-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #f8fafc;
  word-break: break-all;
}

.video-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.video-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* 在线回放弹窗 */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.video-modal-box {
  width: min(460px, 100%);
  max-height: 90dvh;
  background: var(--surface-solid);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.video-modal-box video {
  width: 100%;
  max-height: 62dvh;
  background: #000;
  display: block;
}

.video-modal-footer {
  padding: 10px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
