/* ============================================================================
   MANEE BRIDES · AI TRY-ON PAGE (CELADON CRYSTAL OPTICAL SCULPTURE)
   ----------------------------------------------------------------------------
   Design System: 《曼妮设计系统_定版_v1.0》方向一【冰翡水晶 · 光学雕塑】
   Coexistence  : 100% 兼容默认主题（石榴红＋奶油白）与三星座定版色值
   References   :
     - Shader lightfield : https://movin.design/shaders
     - Hero & rhythm     : https://supahero.io & https://godly.website
     - Double-bezel glass: https://omnira.one & https://csstools.io/glassmorphism
     - 3D icons          : https://3dicons.co
     - CTA funnel        : https://cta.gallery
   Performance Redlines :
     - 60fps Mobile-first (390px), transform/opacity only animations
     - Zero backdrop-filter on scrolling cards (only top header & bottom tabbar)
     - Zero pure-dark hex/rgb literals, zero price characters inside tryon
   ============================================================================ */

:root {
  --tryon-jade-900: #091E18;
  --tryon-jade-800: #0E3329;
  --tryon-jade-700: #13362C;
  --tryon-jade-600: #1D5C4B;
  --tryon-jade-500: #2B7A65;
  --tryon-jade-400: #6CC4AB;
  --tryon-celadon-bg: #ECF3F0;
  --tryon-celadon-50: #F7FAF9;
  --tryon-celadon-100: #EEF4F1;
  --tryon-celadon-200: #D7E4DF;
  --tryon-pearl-warm: #FAF8F5;
  --tryon-mat-paper: #FCFBF9;
  --tryon-mat-backing: #EAE6DF;

  --tryon-st-run-bg: #E7F3F8;
  --tryon-st-run-fg: #0D4F6B;
  --tryon-st-run-dot: #1B7FA8;

  --tryon-st-ok-bg: #E6F4EE;
  --tryon-st-ok-fg: #0F543F;
  --tryon-st-ok-dot: #227C60;

  --tryon-st-idl-bg: #EDF1F0;
  --tryon-st-idl-fg: #3B4D48;
  --tryon-st-idl-dot: #6C807A;

  --tryon-ease-silk: cubic-bezier(0.22, 1, 0.36, 1);
  --tryon-r-outer: 24px;
  --tryon-r-gap: 6px;
  --tryon-r-inner: 18px;
  --tryon-r-sub: 12px;
}

/* ---------- Top Header Persistence & WCAG 2.2.2 Motion Toggle ---------- */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

.app-main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.app-shell,
.tryon-main,
.tryon-intro-compact {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Keep sticky topbar & bottom tabbar pinned nicely on mobile without overlapping full-page scroll anchors */
.app-shell {
  padding-bottom: calc(var(--tabbar-h, 62px) + 18px);
}

.app-header {
  view-transition-name: tryon-header;
}

.app-tabbar {
  view-transition-name: tryon-tabbar;
}

.header-actions {
  gap: 6px;
}

.motion-toggle-btn {
  min-height: 36px;
  min-width: 44px;
  padding: 5px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line-soft);
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 140ms var(--tryon-ease-silk), border-color 220ms var(--tryon-ease-silk), background-color 220ms var(--tryon-ease-silk);
}

.motion-toggle-btn:hover {
  border-color: var(--rosegold);
  color: var(--ink-900);
}

.motion-toggle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tryon-jade-500);
  flex-shrink: 0;
}

html.is-motion-paused .motion-toggle-dot {
  background: var(--tryon-st-idl-dot);
}

/* ---------- Directional View Transitions (Same-Document State Machine) ---------- */
@view-transition {
  navigation: none;
}

::view-transition-group(root) {
  animation-duration: 340ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-group(tryon-header),
::view-transition-group(tryon-tabbar) {
  animation-duration: 0s;
}

::view-transition-old(tryon-portrait-stage),
::view-transition-new(tryon-portrait-stage) {
  height: 100%;
  object-fit: cover;
}

@keyframes tryon-slide-out-left {
  to {
    opacity: 0;
    transform: translate3d(-16%, 0, 0);
  }
}

@keyframes tryon-slide-in-right {
  from {
    opacity: 0;
    transform: translate3d(16%, 0, 0);
  }
}

@keyframes tryon-slide-out-right {
  to {
    opacity: 0;
    transform: translate3d(16%, 0, 0);
  }
}

@keyframes tryon-slide-in-left {
  from {
    opacity: 0;
    transform: translate3d(-16%, 0, 0);
  }
}

html:active-view-transition-type(forward)::view-transition-old(root) {
  animation: tryon-slide-out-left 260ms var(--tryon-ease-silk) both;
}

html:active-view-transition-type(forward)::view-transition-new(root) {
  animation: tryon-slide-in-right 340ms var(--tryon-ease-silk) both;
}

html:active-view-transition-type(backward)::view-transition-old(root) {
  animation: tryon-slide-out-right 260ms var(--tryon-ease-silk) both;
}

html:active-view-transition-type(backward)::view-transition-new(root) {
  animation: tryon-slide-in-left 340ms var(--tryon-ease-silk) both;
}

/* ---------- Page Intro & Three-Step Optical Flow Rail ---------- */
.tryon-main {
  gap: 14px;
  padding-top: 12px;
}

.tryon-intro-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tryon-h1 {
  font-family: var(--font-display);
  font-size: clamp(1.38rem, 1.18rem + 0.9vw, 1.85rem);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  text-wrap: balance;
}

.tryon-lead {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-500);
}

.tryon-flow-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.flow-step-pill {
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink-500);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 140ms var(--tryon-ease-silk), border-color 220ms var(--tryon-ease-silk), background-color 220ms var(--tryon-ease-silk);
}

.flow-step-pill[disabled] {
  opacity: 0.62;
  cursor: not-allowed;
}

.flow-step-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--tryon-jade-600);
}

.flow-step-pill.is-active {
  background: var(--selected-surface, linear-gradient(164deg, #FFFFFF 0%, #FBF0DF 100%));
  border-color: var(--rosegold);
  color: var(--ink-900);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), 0 8px 18px -12px rgba(9, 30, 24, 0.22);
}

.flow-step-pill.is-done {
  background: var(--tryon-st-ok-bg);
  border-color: rgba(34, 124, 96, 0.34);
  color: var(--tryon-st-ok-fg);
}

/* ---------- Resume Last Session Banner ---------- */
.resume-tryon-banner {
  padding: 10px 14px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.94) 0%, rgba(236, 243, 240, 0.88) 100%);
  border: 1px solid rgba(43, 122, 101, 0.26);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.resume-tryon-banner[hidden] {
  display: none !important;
}

.resume-tryon-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.resume-tryon-copy strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900);
}

.resume-tryon-copy span {
  font-size: 12px;
  color: var(--ink-500);
}

/* ---------- Double-Bezel Celadon Crystal Shell ---------- */
.tryon-bezel-tray {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-radius: var(--tryon-r-outer);
  padding: var(--tryon-r-gap);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.72) 0%, rgba(215, 228, 223, 0.62) 100%);
  border: 1px solid var(--line-soft);
  box-shadow:
    inset 0 1.5px 3px rgba(9, 30, 24, 0.08),
    inset 0 -1px 0 rgba(255, 255, 255, 0.92),
    0 1px 2px rgba(9, 30, 24, 0.04);
}

.tryon-crystal-slab {
  width: 100%;
  max-width: 100%;
  border-radius: var(--tryon-r-inner);
  padding: 14px 12px;
  min-width: 0;
  overflow: hidden;
  background: var(--surface-card, rgba(255, 253, 249, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.98),
    inset 0 -2px 0 rgba(14, 51, 41, 0.05),
    0 6px 16px -4px rgba(9, 30, 24, 0.07),
    0 20px 38px -16px rgba(14, 51, 41, 0.12);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tryon-stage {
  min-width: 0;
  width: 100%;
}

.tryon-stage[hidden] {
  display: none !important;
}

.stage-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.stage-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stage-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tryon-jade-600);
}

.stage-heading {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-900);
  text-wrap: balance;
}

.stage-heading:focus {
  outline: none;
}

.stage-mineral-pill {
  padding: 5px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.stage-mineral-pill.is-idle {
  background: var(--tryon-st-idl-bg);
  color: var(--tryon-st-idl-fg);
  border: 1px solid rgba(59, 77, 72, 0.22);
}

.stage-mineral-pill.is-running {
  background: var(--tryon-st-run-bg);
  color: var(--tryon-st-run-fg);
  border: 1px solid rgba(13, 79, 107, 0.24);
}

.stage-mineral-pill.is-done {
  background: var(--tryon-st-ok-bg);
  color: var(--tryon-st-ok-fg);
  border: 1px solid rgba(15, 84, 63, 0.28);
}

.mineral-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ---------- 3-Layer Warm Porcelain Skincare Portrait Frame (#FAF8F5) ---------- */
.skincare-portrait-frame {
  border-radius: 20px;
  padding: 5px;
  background: linear-gradient(155deg, #FFFFFF 0%, #D9E7E1 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 10px 26px -14px rgba(9, 30, 24, 0.20);
}

.skincare-pearl-liner {
  border-radius: 15px;
  padding: 3px;
  background: var(--tryon-pearl-warm);
  border: 1px solid rgba(196, 139, 128, 0.42);
}

.skincare-canvas {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--tryon-mat-backing);
}

/* ---------- Stage 1: Setup (Upload Portrait + Select Look) ---------- */
.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.upload-cabin {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.look-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.upload-preview-box {
  width: min(236px, 100%);
  margin-inline: auto;
}

.upload-preview-canvas {
  aspect-ratio: 4 / 5;
}

.upload-preview-canvas img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 10%;
  transform: scale(1.015);
  display: block;
}

/* Optical framing reticles (four corners) */
.optical-reticle {
  position: absolute;
  inset: 10px;
  pointer-events: none;
  z-index: 2;
}

.optical-reticle span {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: rgba(250, 248, 245, 0.86);
  border-style: solid;
}

.optical-reticle .tl { top: 0; left: 0; border-width: 2px 0 0 2px; border-top-left-radius: 6px; }
.optical-reticle .tr { top: 0; right: 0; border-width: 2px 2px 0 0; border-top-right-radius: 6px; }
.optical-reticle .bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; border-bottom-left-radius: 6px; }
.optical-reticle .br { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-bottom-right-radius: 6px; }

.upload-source-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(9, 30, 24, 0.78);
  border: 1px solid rgba(245, 239, 234, 0.34);
  color: #F5EFEA;
  font-size: 12px;
  font-weight: 600;
}

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

.upload-action-btn {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 1.5px solid var(--line-soft);
  color: var(--ink-900);
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 140ms var(--tryon-ease-silk), border-color 220ms var(--tryon-ease-silk);
}

.upload-action-btn:hover {
  border-color: var(--rosegold);
}

.upload-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.demo-selfie-btn {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: var(--tryon-celadon-50);
  border: 1px solid rgba(43, 122, 101, 0.28);
  color: var(--tryon-jade-600);
  font-size: 12px;
  font-weight: 600;
}

.privacy-shield-bar {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--tryon-pearl-warm);
  border: 1px solid var(--rosegold-border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-700);
}

/* ---------- 2x2 Look Selection Cards ---------- */
.look-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.look-panel-head > div {
  min-width: 0;
}

.look-panel-head h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-900);
}

.look-panel-head p {
  font-size: 12.5px;
  line-height: 1.48;
  color: var(--ink-500);
}

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

.look-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 78px;
  padding: 9px 8px;
  border-radius: 16px;
  border: 1.5px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.94);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 140ms var(--tryon-ease-silk), border-color 220ms var(--tryon-ease-silk), background-color 220ms var(--tryon-ease-silk), box-shadow 220ms var(--tryon-ease-silk);
}

.look-card:hover {
  border-color: var(--rosegold-border);
}

.look-card[aria-pressed="true"] {
  background: var(--selected-surface, linear-gradient(164deg, #FFFFFF 0%, #FBF0DF 100%));
  border-color: var(--rosegold);
  box-shadow: 0 10px 22px -14px rgba(9, 30, 24, 0.24);
}

.look-thumb-wrap {
  width: 42px;
  height: 52px;
  border-radius: 10px;
  padding: 2px;
  background: var(--tryon-pearl-warm);
  border: 1px solid rgba(196, 139, 128, 0.40);
  flex-shrink: 0;
  overflow: hidden;
}

.look-thumb-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: cover;
  object-position: 50% 12%;
  display: block;
}

.look-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.look-cat-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.look-swatch-pair {
  display: inline-flex;
  align-items: center;
}

.look-swatch-pair i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.92);
  display: inline-block;
}

.look-swatch-pair i + i {
  margin-left: -4px;
}

.look-cat {
  font-size: 12px;
  color: var(--ink-500);
}

.look-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.look-sub {
  font-size: 12px;
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MU Image Multi-Reference Bridge Strip */
.multiref-pair-strip {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--tryon-celadon-50);
  border: 1px solid rgba(43, 122, 101, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.multiref-slots {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.multiref-mini-thumb {
  width: 30px;
  height: 36px;
  border-radius: 7px;
  object-fit: cover;
  object-position: 50% 12%;
  border: 1.5px solid var(--tryon-pearl-warm);
  box-shadow: 0 2px 6px rgba(9, 30, 24, 0.14);
  flex-shrink: 0;
}

.multiref-plus {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--tryon-jade-600);
}

.multiref-copy strong {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tryon-jade-900);
}

.multiref-slots {
  flex-shrink: 0;
}

.multiref-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.multiref-copy span {
  font-size: 12px;
  color: var(--tryon-jade-600);
  white-space: normal;
  line-height: 1.4;
}

/* ---------- Primary CTA & Button-in-Button Shimmer ---------- */
.tryon-cta-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.tryon-cta-promise {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-700);
  text-align: center;
}

.btn-tryon-imperial {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px 8px 18px;
  border-radius: 9999px;
  background: var(--cta-bg, linear-gradient(160deg, #13362C 0%, #091E18 100%));
  color: var(--cta-fg, #F5EFEA);
  border: 1px solid var(--cta-border, rgba(229, 194, 185, 0.48));
  box-shadow: var(--cta-shadow, inset 0 1.5px 0 rgba(255, 255, 255, 0.24), 0 12px 24px -10px rgba(9, 30, 24, 0.36));
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: transform 140ms var(--tryon-ease-silk), box-shadow 260ms var(--tryon-ease-silk);
}

.btn-tryon-imperial::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 28%, rgba(255, 248, 236, 0.34) 50%, transparent 72%);
  transform: translate3d(-130%, 0, 0);
}

.btn-tryon-imperial-text {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding-left: 8px;
  white-space: normal;
  line-height: 1.3;
}

.btn-tail-ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(245, 239, 234, 0.16);
  border: 1px solid rgba(229, 194, 185, 0.46);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 240ms var(--tryon-ease-silk);
}

.btn-tail-ring svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .btn-tryon-imperial:hover {
    transform: translate3d(0, -1px, 0);
  }
  .btn-tryon-imperial:hover::after {
    transform: translate3d(130%, 0, 0);
    transition: transform 780ms var(--tryon-ease-silk);
  }
  .btn-tryon-imperial:hover .btn-tail-ring {
    transform: translate3d(2px, -1px, 0);
  }
}

.btn-tryon-imperial:active,
.upload-action-btn:active,
.look-card:active,
.flow-step-pill:active,
.btn-secondary:active {
  transform: scale3d(0.98, 0.98, 1);
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.is-motion-paused):not(.v2-lite) .btn-tryon-imperial::after {
    animation: tryon-cta-sheen 6.5s var(--tryon-ease-silk) 1.4s infinite;
  }
}

@keyframes tryon-cta-sheen {
  0%, 82% { transform: translate3d(-130%, 0, 0); }
  100%    { transform: translate3d(130%, 0, 0); }
}

.tryon-cta-foot {
  font-size: 12px;
  color: var(--ink-500);
  text-align: center;
}

/* ---------- Stage 2: Processing (Zero Blank Screen + Celadon Light-Pipe) ---------- */
.processing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.processing-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.result-grid > *,
.result-action-stack {
  min-width: 0;
}

.processing-mirror-box {
  position: relative;
  width: min(244px, 100%);
  margin-inline: auto;
}

.processing-mirror-canvas {
  aspect-ratio: 4 / 5;
}

.processing-mirror-canvas img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 10%;
  display: block;
}

.processing-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(168deg, rgba(247, 250, 249, 0.56) 0%, rgba(236, 243, 240, 0.70) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.processing-scan-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 54px;
  background: linear-gradient(180deg, transparent 0%, rgba(108, 196, 171, 0.34) 50%, transparent 100%);
  pointer-events: none;
  transform: translate3d(0, -60px, 0);
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.is-motion-paused):not(.v2-lite) .processing-scan-band {
    animation: tryon-scan-sweep 2.4s var(--tryon-ease-silk) infinite;
  }
}

@keyframes tryon-scan-sweep {
  0%   { transform: translate3d(0, -60px, 0); opacity: 0.25; }
  50%  { opacity: 0.92; }
  100% { transform: translate3d(0, 320px, 0); opacity: 0.25; }
}

.processing-halo-ring {
  position: relative;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
}

.processing-halo-outer {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px solid rgba(196, 139, 128, 0.62);
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.is-motion-paused):not(.v2-lite) .processing-halo-outer {
    animation: tryon-halo-breathe 3.6s ease-in-out infinite;
  }
}

@keyframes tryon-halo-breathe {
  0%, 100% { transform: scale3d(0.98, 0.98, 1); opacity: 0.5; }
  50%      { transform: scale3d(1.04, 1.04, 1); opacity: 0.95; }
}

.processing-ring-svg {
  width: 96px;
  height: 96px;
  transform: rotate(-90deg);
}

.processing-ring-track {
  fill: none;
  stroke: rgba(9, 30, 24, 0.14);
  stroke-width: 5.5;
}

.processing-ring-fill {
  fill: none;
  stroke: var(--tryon-jade-500);
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-dasharray: 263.89;
  stroke-dashoffset: 263.89;
  transition: stroke-dashoffset 260ms var(--tryon-ease-silk);
}

.processing-pct {
  position: absolute;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 700;
  color: var(--tryon-jade-900);
}

/* Curved Mineral Celadon Optical Light-Pipe */
.light-pipe-card {
  padding: 12px;
  border-radius: 14px;
  background: var(--tryon-celadon-50);
  border: 1px solid rgba(43, 122, 101, 0.22);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.light-pipe-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tryon-jade-900);
}

.light-pipe-groove {
  position: relative;
  height: 12px;
  border-radius: 9999px;
  background: #DCE8E3;
  box-shadow: inset 0 2px 4px rgba(9, 30, 24, 0.16), 0 1px 0 rgba(255, 255, 255, 0.95);
  overflow: hidden;
}

.light-pipe-fill {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(180deg, #6CC4AB 0%, #2B7A65 55%, #16493B 100%);
  transform-origin: left center;
  transform: scaleX(var(--prog, 0.16));
  transition: transform 280ms var(--tryon-ease-silk);
  overflow: hidden;
}

.light-pipe-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.62) 50%, transparent 100%);
  transform: translate3d(-120%, 0, 0);
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.is-motion-paused):not(.v2-lite) .light-pipe-fill::after {
    animation: tryon-pipe-glint 2.2s var(--tryon-ease-silk) infinite;
  }
}

@keyframes tryon-pipe-glint {
  0%   { transform: translate3d(-120%, 0, 0); }
  100% { transform: translate3d(220%, 0, 0); }
}

.pipeline-stage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pipeline-stage-item {
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line-hair);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-500);
}

.pipeline-stage-item.is-active {
  background: var(--tryon-st-run-bg);
  border-color: rgba(13, 79, 107, 0.28);
  color: var(--tryon-st-run-fg);
  font-weight: 700;
}

.pipeline-stage-item.is-done {
  background: var(--tryon-st-ok-bg);
  border-color: rgba(15, 84, 63, 0.26);
  color: var(--tryon-st-ok-fg);
  font-weight: 600;
}

.pipeline-stage-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pipeline-stage-state {
  font-family: var(--font-mono);
  font-size: 12px;
  flex-shrink: 0;
}

/* ---------- Stage 3: Result Comparison, Save, Share & App Routing ---------- */
.result-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.compare-tablist {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 9999px;
  background: var(--tryon-celadon-100);
  border: 1px solid var(--line-soft);
  gap: 3px;
}

.compare-tab-btn {
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-500);
  transition: background-color 200ms var(--tryon-ease-silk), color 200ms var(--tryon-ease-silk), transform 120ms var(--tryon-ease-silk);
}

.compare-tab-btn[aria-selected="true"] {
  background: #FFFFFF;
  color: var(--ink-900);
  box-shadow: 0 4px 10px -4px rgba(9, 30, 24, 0.18);
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* Slider Comparison Mirror (Knob locked at top: 80% collar zone -> 0% face occlusion) */
.result-mirror-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  touch-action: pan-y;
  user-select: none;
  cursor: ew-resize;
  --split: 58%;
  --after-filter: none;
  --after-tint: transparent;
}

.result-mirror-viewport .portrait-layer {
  position: absolute;
  inset: 0;
}

.result-mirror-viewport .portrait-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 8%;
  display: block;
}

.result-mirror-viewport .portrait-after {
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
}

.result-mirror-viewport .portrait-after img {
  filter: var(--after-filter);
}

.result-mirror-viewport .portrait-after::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--after-tint);
  pointer-events: none;
}

.result-mirror-viewport.is-peek-before .portrait-after {
  opacity: 0;
}

.result-mirror-viewport.is-gliding .portrait-after {
  transition: clip-path 240ms var(--tryon-ease-silk), opacity 180ms ease;
}

.result-mirror-viewport.is-gliding .mirror-line,
.result-mirror-viewport.is-gliding .mirror-handle-hit {
  transition: left 240ms var(--tryon-ease-silk);
}

.mirror-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 1.5px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.36) 0%, #FAF8F5 35%, #FAF8F5 88%, rgba(255, 255, 255, 0.36) 100%);
  pointer-events: none;
  z-index: 4;
}

.mirror-handle-hit {
  position: absolute;
  top: 80%;
  left: var(--split);
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  z-index: 5;
  cursor: ew-resize;
}

.mirror-knob {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(250, 248, 245, 0.96);
  border: 1.5px solid var(--rosegold);
  box-shadow: 0 6px 16px -4px rgba(9, 30, 24, 0.28);
  display: grid;
  place-items: center;
  color: var(--ink-900);
}

.mirror-knob svg {
  width: 17px;
  height: 17px;
}

.mirror-tag {
  position: absolute;
  top: 10px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(9, 30, 24, 0.78);
  border: 1px solid rgba(250, 248, 245, 0.34);
  color: #F5EFEA;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.mirror-tag.left { left: 10px; }
.mirror-tag.right { right: 10px; }

/* Side-by-Side Album Comparison */
.sidebyside-panel[hidden] {
  display: none !important;
}

.sidebyside-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sidebyside-card {
  border-radius: 16px;
  padding: 6px 6px 10px;
  background: var(--tryon-pearl-warm);
  border: 1px solid var(--rosegold-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebyside-img-win {
  border-radius: 11px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--tryon-mat-backing);
}

.sidebyside-img-win img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 8%;
  display: block;
}

.sidebyside-img-win.is-after img {
  filter: var(--after-filter, none);
}

.sidebyside-plaque {
  padding-top: 6px;
  border-top: 1px solid var(--line-hair);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebyside-plaque strong {
  font-size: 12.5px;
  color: var(--ink-900);
}

.sidebyside-plaque span {
  font-size: 12px;
  color: var(--ink-500);
}

/* Slider Controls & Quick Remakeup Strip */
.mirror-controls-bar {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line-hair);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mirror-controls-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mirror-controls-top label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-900);
}

.mirror-tool-btns {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mirror-mini-btn {
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: var(--tryon-celadon-50);
  border: 1px solid var(--line-soft);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-700);
}

.remakeup-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.remakeup-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.remakeup-strip-head strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
}

.remakeup-chip-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.remakeup-chip {
  min-height: 44px;
  padding: 7px 10px;
  border-radius: 14px;
  border: 1.5px solid var(--line-soft);
  background: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-700);
}

.remakeup-chip[aria-pressed="true"] {
  background: var(--selected-surface, linear-gradient(164deg, #FFFFFF 0%, #FBF0DF 100%));
  border-color: var(--rosegold);
  color: var(--ink-900);
}

.remakeup-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Save & Share Action Row */
.result-action-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.save-share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-crystal-action {
  min-height: 48px;
  padding: 9px 12px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 1.5px solid var(--rosegold-border);
  color: var(--ink-900);
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 6px 16px -10px rgba(9, 30, 24, 0.22);
  transition: transform 140ms var(--tryon-ease-silk), border-color 220ms var(--tryon-ease-silk);
}

.btn-crystal-action:hover {
  border-color: var(--rosegold);
}

.btn-crystal-action svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Subscription & Diagnosis Continuation Card (0 Price Chars) */
.tryon-bridge-card {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(164deg, rgba(255, 255, 255, 0.96) 0%, rgba(236, 243, 240, 0.90) 100%);
  border: 1px solid rgba(43, 122, 101, 0.24);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tryon-bridge-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-900);
}

.tryon-bridge-card p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-500);
}

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

.bridge-sub-link {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 1px solid var(--line-soft);
  color: var(--ink-900);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- Top-Layer Modal Dialogs (Auth Save & Passe-Partout Share Drawer) ---------- */
dialog.app-dialog.tryon-modal {
  max-height: min(92dvh, 760px);
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 280ms;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  transition-behavior: allow-discrete;
}

.tryon-modal .dialog-inner {
  padding: 16px 15px;
  gap: 10px;
}

@media (prefers-reduced-motion: no-preference) {
  dialog.app-dialog.tryon-modal {
    transform: translate3d(0, 14px, 0) scale3d(0.97, 0.97, 1);
  }
}

:is(dialog.app-dialog.tryon-modal[open]):where(:not([data-closing])) {
  opacity: 1;
}

@starting-style {
  :is(dialog.app-dialog.tryon-modal[open]):where(:not([data-closing])) {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  :is(dialog.app-dialog.tryon-modal[open]):where(:not([data-closing])) {
    transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
  }
  @starting-style {
    :is(dialog.app-dialog.tryon-modal[open]):where(:not([data-closing])) {
      transform: translate3d(0, 14px, 0) scale3d(0.97, 0.97, 1);
    }
  }
}

dialog.app-dialog.tryon-modal::backdrop {
  background-color: rgba(9, 30, 24, 0);
  transition-property: background-color, display, overlay;
  transition-duration: 280ms;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

:is(dialog.app-dialog.tryon-modal[open]):where(:not([data-closing]))::backdrop {
  background-color: rgba(9, 30, 24, 0.44);
}

@starting-style {
  :is(dialog.app-dialog.tryon-modal[open]):where(:not([data-closing]))::backdrop {
    background-color: rgba(9, 30, 24, 0);
  }
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-close-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--tryon-celadon-50);
  border: 1px solid var(--line-soft);
  color: var(--ink-700);
  font-size: 18px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.dialog-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dialog-field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-700);
}

.dialog-field input {
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line-soft);
  background: #FFFFFF;
  color: var(--ink-900);
  font-size: 16px;
}

/* Passe-Partout 3:4 Share Card (Ch.3 Official Spec: #FCFBF9 mat + 0% portrait occlusion + #EAE6DF backing) */
.xhs-passe-partout {
  width: min(268px, 100%);
  margin-inline: auto;
  aspect-ratio: 3 / 4;
  padding: 12px 12px 14px;
  background: var(--tryon-mat-paper);
  border: 1px solid rgba(20, 20, 23, 0.14);
  border-radius: 2px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.xhs-mat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #4D5754;
  text-transform: uppercase;
  white-space: nowrap;
}

.xhs-mat-window {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 4.4;
  overflow: hidden;
  background: var(--tryon-mat-backing);
}

.xhs-mat-window > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 8%;
  display: block;
}

.xhs-mat-plaque {
  padding-top: 8px;
  border-top: 1px solid rgba(20, 20, 23, 0.10);
  display: grid;
  gap: 3px;
}

.xhs-mat-title {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 22px;
  font-weight: 700;
  color: var(--tryon-jade-900);
  text-wrap: balance;
}

.xhs-mat-meta {
  font-size: 12px;
  line-height: 17px;
  color: #4D5754;
}

.share-actions-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-actions-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ---------- Tap Ripple Micro-Interaction (Transform/Opacity Only) ---------- */
.tryon-ripple {
  position: absolute;
  z-index: -1;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(245, 239, 234, 0.34) 0%, transparent 65%);
  transform: scale3d(0.2, 0.2, 1);
  opacity: 1;
  animation: tryon-ripple-burst 520ms var(--tryon-ease-silk) forwards;
}

.upload-action-btn .tryon-ripple,
.btn-crystal-action .tryon-ripple,
.look-card .tryon-ripple {
  background: radial-gradient(circle, rgba(43, 122, 101, 0.16) 0%, transparent 65%);
}

@keyframes tryon-ripple-burst {
  to {
    transform: scale3d(3, 3, 1);
    opacity: 0;
  }
}

/* ---------- Desktop >= 900px ---------- */
@media (min-width: 900px) {
  .app-main {
    max-width: 920px;
    padding-inline: 24px;
  }

  .setup-grid {
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
    gap: 22px;
    align-items: start;
  }

  .upload-preview-box {
    width: min(292px, 100%);
  }

  .processing-grid {
    grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
    gap: 24px;
  }

  .processing-mirror-box {
    width: min(300px, 100%);
  }

  .result-grid {
    grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
    gap: 22px;
    align-items: start;
  }

  .remakeup-chip-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Accessibility: Paused Motion, Reduced Motion & Forced Colors ---------- */
html.is-motion-paused *,
html.is-motion-paused *::before,
html.is-motion-paused *::after {
  animation-play-state: paused !important;
}

html.v2-lite .btn-tryon-imperial::after,
html.v2-lite .processing-scan-band,
html.v2-lite .processing-halo-outer,
html.v2-lite .light-pipe-fill::after {
  animation: none !important;
}

html.v2-lite .tryon-ripple {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .tryon-modal {
    transition-duration: 100ms;
  }
  .btn-tryon-imperial::after,
  .processing-scan-band,
  .processing-halo-outer,
  .light-pipe-fill::after,
  .tryon-ripple {
    animation: none !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

@media (forced-colors: active) {
  .tryon-bezel-tray,
  .tryon-crystal-slab,
  .look-card,
  .btn-tryon-imperial,
  .btn-crystal-action {
    border: 1px solid CanvasText;
  }
}
