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

:root {
  --bg-desktop: #EFECE8;
  --bg-card: #FFFFFF;
  --ink-primary: #222222;
  --ink-secondary: #717171;
  --border-light: rgba(0, 0, 0, 0.08);
  --accent: #FF385C;
  --accent-dark: #E31C5F;
  --accent-soft: rgba(255, 56, 92, 0.11);
  --glass-light: rgba(255, 255, 255, 0.80);
  --glass-dark: rgba(20, 20, 24, 0.52);
  --shadow-float: 0 6px 22px rgba(0, 0, 0, 0.12);
  --shadow-sheet: 0 -10px 36px rgba(0, 0, 0, 0.16);
}

html, body {
  height: 100%;
  background: var(--bg-desktop);
  color: var(--ink-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
  touch-action: manipulation;
}

.is-hidden { display: none !important; }
.sr-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.file-label { position: relative; overflow: hidden; cursor: pointer; }

/* 全屏沉浸式容器：手机端 100vw×100dvh 满屏，桌面端居中优雅画框 */
.app-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #111113;
}

@media (min-width: 600px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
  }
  .app-shell {
    max-width: 460px;
    height: min(94dvh, 880px);
    border-radius: 30px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
  }
}

/* ============ 顶部悬浮毛玻璃导航 ============ */
.top-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 25;
  pointer-events: none;
}

.brand-group {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--glass-light);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.brand-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.brand-title { font-size: 13px; font-weight: 700; color: var(--ink-primary); white-space: nowrap; letter-spacing: -0.01em; }

.mode-pill {
  pointer-events: auto;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--glass-light);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
}
.mode-btn {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.mode-btn.is-active {
  background: #FFFFFF;
  color: var(--ink-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}

.header-actions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  justify-content: flex-end;
}
.icon-pill {
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: var(--glass-light);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  transition: all 0.18s ease;
}
.icon-pill.is-active {
  border-color: var(--accent);
  background: rgba(255, 56, 92, 0.92);
  color: #FFFFFF;
}
.eye-icon { display: block; flex-shrink: 0; }

/* AR 摄像头模式下顶部控件自动切换暗色通透玻璃 */
.app-shell.mode-camera .brand-group,
.app-shell.mode-camera .mode-pill,
.app-shell.mode-camera .icon-pill {
  background: var(--glass-dark);
  border-color: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}
.app-shell.mode-camera .brand-title { color: #FFFFFF; }
.app-shell.mode-camera .mode-btn { color: rgba(255, 255, 255, 0.72); }
.app-shell.mode-camera .mode-btn.is-active {
  background: rgba(255, 255, 255, 0.94);
  color: #1A1A1A;
}

/* ============ 全屏主舞台 ============ */
.stage-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.stage-card {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(165deg, #FFFBF9 0%, #F6EFEA 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 欢迎页 */
.welcome-box {
  text-align: center;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
}
.welcome-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.welcome-badge.is-ready {
  color: #0E7C5B;
  background: rgba(14, 124, 91, 0.11);
}
.welcome-box h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  margin-bottom: 10px;
}
.welcome-box p {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.welcome-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.sample-section {
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  padding-top: 16px;
}
.sample-title {
  font-size: 11px;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}
.sample-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}
.sample-pill {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, background 0.15s ease;
}
.sample-pill:active { transform: scale(0.95); background: #FFFFFF; }

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, #FF385C 0%, #E31C5F 100%);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(255, 56, 92, 0.28);
  transition: transform 0.15s ease;
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  border: 1.5px solid var(--ink-primary);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.btn-secondary:active { transform: scale(0.97); }
.btn-lg { padding: 13px 20px; border-radius: 16px; font-size: 15px; }
.btn-outline {
  border: 1px solid #DDDDDD;
  background: #FFFFFF;
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 14px;
  border-radius: 14px;
  cursor: pointer;
}

/* ============ 全屏摄像头 & 照片画布 ============ */
.camera-layer, .editor-layer {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0F0F11;
}
.editor-layer { background: #181716; }
.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-video.is-mirrored { transform: scaleX(-1); }
.camera-overlay, .editor-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* AR 顶部状态提示（避让悬浮顶栏） */
.camera-hud-top {
  position: absolute;
  top: calc(60px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 12;
}
.hud-tip {
  background: rgba(18, 18, 22, 0.56);
  color: rgba(255, 255, 255, 0.94);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* 照片模式次级工具栏（位于顶栏下方） */
.editor-hud-top {
  position: absolute;
  top: calc(60px + env(safe-area-inset-top, 0px));
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 12;
}
.hud-left-group, .hud-right-group { display: flex; gap: 6px; pointer-events: auto; }
.chip-btn {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

/* 单指微调浮层（仅选中指甲时浮现于底部 Dock 上方） */
.finger-tuner {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 8px 12px;
  box-shadow: var(--shadow-float);
  z-index: 16;
}
.tuner-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tuner-finger-badge {
  font-size: 11px;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--ink-primary);
  padding: 4px 8px;
  border-radius: 8px;
  flex-shrink: 0;
}
.tuner-sliders { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.tuner-item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-secondary); font-weight: 600; }
.tuner-item span { flex-shrink: 0; }
.mini-range { width: 100%; min-width: 0; accent-color: var(--accent); cursor: pointer; }
.tuner-apply-btn {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  cursor: pointer;
}

/* 对比分屏线 */
.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 36px;
  margin-left: -18px;
  z-index: 10;
  cursor: ew-resize;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compare-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #FFFFFF; box-shadow: 0 0 8px rgba(0, 0, 0, 0.45); }
.compare-handle {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--ink-primary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
}

/* ============ 底部极简悬浮栏（抽屉收起态） ============ */
.floating-dock {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 22;
  transition: opacity 0.22s ease, transform 0.26s ease;
}
.floating-dock.is-dock-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.style-trigger-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: rgba(20, 20, 24, 0.62);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
  max-width: 148px;
}
.style-trigger-pill.is-light {
  background: rgba(255, 255, 255, 0.90);
  border-color: rgba(255, 255, 255, 0.8);
  color: var(--ink-primary);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.14);
  max-width: 196px;
}
.trigger-thumb-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 56, 92, 0.65);
}
.trigger-thumb { width: 82%; height: 82%; object-fit: contain; display: block; }
.trigger-meta { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.trigger-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trigger-sub {
  font-size: 10px;
  opacity: 0.78;
  margin-top: 1px;
  white-space: nowrap;
}

.shutter-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 3.5px solid rgba(255, 255, 255, 0.96);
  background: rgba(255, 255, 255, 0.22);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
  transition: transform 0.14s ease;
}
.shutter-btn:active { transform: scale(0.92); }
.shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF385C 0%, #E31C5F 100%);
  display: block;
}

.cam-right-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cam-icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 20, 24, 0.60);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}

/* 照片模式底部 Dock */
.photo-dock {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 4px;
}
.photo-dock-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dock-btn-outline {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.90);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
}
.dock-btn-primary {
  border: 0;
  background: linear-gradient(135deg, #FF385C 0%, #E31C5F 100%);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 56, 92, 0.34);
}

/* ============ 抽屉遮罩 & 可收起底部抽屉 ============ */
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  z-index: 28;
  transition: opacity 0.25s ease;
}

.bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-sheet);
  z-index: 32;
  transform: translateY(0);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.32s;
}
.bottom-sheet.is-collapsed {
  transform: translateY(108%);
  pointer-events: none;
  visibility: hidden;
}

.drawer-handle-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 0 10px;
  cursor: pointer;
}
.drawer-pill-bar {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  margin-bottom: 8px;
}
.drawer-header-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-primary);
}
.drawer-collapse-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.shape-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
.row-label { font-size: 12px; font-weight: 700; flex-shrink: 0; color: var(--ink-secondary); }
.shape-pills { display: flex; gap: 6px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.shape-pills::-webkit-scrollbar { display: none; }
.shape-pill {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #F7F7F7;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.16s ease;
}
.shape-pill.is-active {
  border-color: var(--ink-primary);
  background: var(--ink-primary);
  color: #FFFFFF;
}

.styles-scroll { overflow-x: auto; margin-bottom: 12px; padding: 2px 0 4px; width: 100%; min-width: 0; scrollbar-width: none; }
.styles-scroll::-webkit-scrollbar { display: none; }
.styles-track { display: flex; gap: 9px; }
.style-card {
  width: 80px;
  flex-shrink: 0;
  background: #FFFFFF;
  border: 1.5px solid rgba(0, 0, 0, 0.07);
  border-radius: 16px;
  padding: 7px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s ease;
}
.style-card.is-active {
  border-color: var(--accent);
  background: #FFF9FA;
  box-shadow: 0 4px 12px rgba(255, 56, 92, 0.18);
  transform: translateY(-1px);
}
.style-thumb-box {
  width: 44px;
  height: 54px;
  margin: 0 auto 6px;
  border-radius: 11px;
  background: #F6F6F6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.style-thumb { max-width: 100%; max-height: 100%; display: block; }
.style-name { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-primary); }
.style-price { font-size: 10px; color: var(--ink-secondary); margin-top: 1px; }

.action-bar { display: flex; gap: 8px; }
.action-bar .btn-outline { flex: 1; }
.action-bar .btn-order { flex: 1.45; }

/* ============ 下单弹窗 & Toast ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
.modal-card { width: 100%; max-width: 420px; background: #FFFFFF; border-radius: 24px; padding: 18px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close { border: 0; background: #F2F2F2; width: 28px; height: 28px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.order-preview-row { display: flex; align-items: center; background: #F7F7F7; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.order-thumb { width: 40px; height: 54px; object-fit: contain; margin-right: 12px; }
.order-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.order-meta { display: flex; align-items: center; gap: 8px; }
.order-price { font-size: 14px; font-weight: 700; color: var(--accent); }
.order-shape-tag { font-size: 11px; color: var(--ink-secondary); background: #FFFFFF; border: 1px solid var(--border-light); padding: 2px 8px; border-radius: 999px; }
.order-desc { font-size: 12px; color: var(--ink-secondary); line-height: 1.5; margin-bottom: 14px; }
.modal-link-btn { width: 100%; }

.toast {
  position: fixed;
  top: calc(102px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(24, 24, 28, 0.86);
  backdrop-filter: blur(12px);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 15px;
  border-radius: 999px;
  z-index: 60;
  white-space: nowrap;
  pointer-events: none;
}
