/* bias.beauty /lab/retouch (一键 P 图). Lab register (site-app.css body.lab) on top of home.css + face-analysis.css;
   shares the hero, guide, coach, tips and result board of lab-chuge.css. */

.rt-stage .fa-controls { justify-content: space-between; }

/* ---------- ① the photo ---------- */
.rt-drop { position: relative; display: grid; place-items: center; min-height: 360px; overflow: hidden; }
body.lab .rt-drop { --k: 22px; --t: 2px; border-style: dashed; border-color: var(--hair); }
body.lab .rt-drop:hover, body.lab .rt-drop.over { border-color: var(--pencil); }
body.lab .rt-drop.has-photo { border-style: solid; border-color: var(--line); }
.rt-empty { width: 100%; height: 100%; align-content: center; cursor: pointer; }
.rt-demo { width: min(220px, 60vw); height: auto; margin-bottom: 10px; }
.rt-art { overflow: visible; }
.rt-art .after-clip, .rt-art .handle { transition: transform .6s var(--ease); }
.rt-art .spark { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
    .rt-drop:hover .rt-art .handle, .lab-card.is-live:hover .rt-art .handle { animation: rt-sweep 2.4s var(--ease) infinite; }
    .rt-drop:hover .rt-art .after-clip, .lab-card.is-live:hover .rt-art .after-clip { animation: rt-sweep 2.4s var(--ease) infinite; }
    .rt-drop:hover .rt-art .spark, .lab-card.is-live:hover .rt-art .spark { animation: rt-twinkle 1.2s ease-in-out infinite alternate; }
}
@keyframes rt-sweep { 0%, 100% { transform: translateX(0); } 35% { transform: translateX(-34px); } 70% { transform: translateX(30px); } }
@keyframes rt-twinkle { from { transform: scale(.7) rotate(-10deg); } to { transform: scale(1.1) rotate(8deg); } }

.rt-photo { position: relative; align-self: stretch; justify-self: stretch; display: grid; place-items: center; padding: 14px; }
.rt-photo img { display: block; max-width: 100%; max-height: 460px; border-radius: 4px; object-fit: contain; animation: cg-dev .7s var(--ease) both; }
.rt-x { position: absolute; top: 10px; right: 10px; z-index: 3; appearance: none; width: 32px; height: 32px; border: 0; border-radius: 50%; display: grid; place-items: center;
    background: rgba(13, 11, 18, .62); color: #fff; font: 400 20px/1 var(--sans); cursor: pointer; }
.rt-x:hover { background: rgba(13, 11, 18, .8); }
/* orientation label on the photo: ✓ 正脸 / 有点侧 / 侧脸 */
.rt-badge { position: absolute; left: 22px; top: 22px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
    font: 600 13px/1.4 var(--sans); color: #fff; background: #17865b; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .45); animation: rt-pop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.rt-badge.partial { background: #c98112; }
.rt-badge.side { background: #c4423e; }
.rt-badge small { font: 500 11px/1 var(--mono); opacity: .85; }
@keyframes rt-pop { from { opacity: 0; transform: scale(.6); } }
/* the scan line while a photo is checked or retouched */
.rt-scan { position: absolute; inset: 14px; pointer-events: none; overflow: hidden; border-radius: 4px; display: none; }
.rt-scan::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--pencil); box-shadow: 0 0 14px var(--pencil); animation: rt-scan-move 1.8s linear infinite; }
.checking > .rt-scan, .working > .rt-scan { display: block; }
.working img { filter: saturate(.75) brightness(.92); transition: filter .5s; }
@keyframes rt-scan-move { from { top: 0; } to { top: 100%; } }
@media (prefers-reduced-motion: reduce) { .rt-scan::after { animation: none; top: 50%; } .rt-badge { animation: none; } }

/* ---------- the frontal reference ---------- */
.rt-ref { margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, #e39b1b 10%, var(--surface)); border: 1px solid color-mix(in srgb, #e39b1b 30%, transparent);
    animation: cg-coach-in .4s var(--ease) both; }
.rt-ref.side { background: color-mix(in srgb, #d9534f 8%, var(--surface)); border-color: color-mix(in srgb, #d9534f 30%, transparent); }
.rt-ref.done { background: color-mix(in srgb, #1f9d6b 8%, var(--surface)); border-color: color-mix(in srgb, #1f9d6b 28%, transparent); }
.rt-ref-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rt-ref-head b { font-size: 16px; }
.rt-ref-tag { padding: 1px 9px; border-radius: 999px; font: 600 12px/1.6 var(--sans); color: #a5670c; background: color-mix(in srgb, #e39b1b 18%, transparent); }
.rt-ref.side .rt-ref-tag { color: #c4423e; background: color-mix(in srgb, #d9534f 14%, transparent); }
.rt-ref.done .rt-ref-tag { color: #17865b; background: color-mix(in srgb, #1f9d6b 14%, transparent); }
.rt-ref-say { margin: 6px 0 12px; font-size: 14px; line-height: 1.6; color: var(--muted); }
.rt-ref-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rt-ref-add { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: 12px; border: 1.5px dashed var(--pencil); color: var(--pencil);
    background: var(--surface); font: 600 14px var(--sans); cursor: pointer; transition: background .2s; }
.rt-ref-add:hover { background: color-mix(in srgb, var(--pencil) 8%, var(--surface)); }
.rt-ref-add svg { width: 26px; height: 32px; }
.rt-ref-pic { position: relative; width: 96px; height: 120px; border-radius: 10px; overflow: hidden; background: var(--photo-bg); flex: none; }
.rt-ref-pic img { width: 100%; height: 100%; object-fit: cover; display: block; animation: cg-dev .7s var(--ease) both; }
.rt-ref-pic .rt-x { top: 4px; right: 4px; width: 24px; height: 24px; font-size: 16px; }
.rt-ref-pic .rt-scan { inset: 0; border-radius: 0; }
.rt-ref-ok { position: absolute; left: 4px; bottom: 4px; padding: 1px 8px; border-radius: 999px; font: 600 11px/1.6 var(--sans); color: #fff; background: #17865b; animation: rt-pop .4s cubic-bezier(.2, 1.6, .4, 1) both; }
.rt-ref-note { flex: 1 1 180px; margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.rt-ref-note.err { color: var(--bad, #d64545); }
.rt-ref-note:empty { display: none; }

/* ---------- ② compare ---------- */
.rt-result { scroll-margin-top: calc(var(--nav-h, 64px) + 8px); }
.rt-compare { position: relative; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: ew-resize; outline: none; --pos: 50%; padding: 0; line-height: 0; }
.rt-compare:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--pencil) 40%, transparent); }
.rt-compare img { display: block; width: 100%; height: auto; max-height: 78vh; object-fit: contain; background: var(--photo-bg); pointer-events: none; }
.rt-before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.rt-before img { width: 100%; height: 100%; }
.rt-compare.after-only .rt-before, .rt-compare.after-only .rt-handle, .rt-compare.after-only .rt-lab.l { display: none; }
.rt-compare.after-only { cursor: default; }
.rt-compare.peek .rt-before { clip-path: none; }
.rt-compare.peek .rt-handle, .rt-compare.peek .rt-lab.r { opacity: 0; }
.rt-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 0; pointer-events: none; transition: opacity .2s; }
.rt-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
.rt-handle i { position: absolute; top: 50%; left: -20px; width: 40px; height: 40px; margin-top: -20px; border-radius: 50%; background: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); }
.rt-handle i::before, .rt-handle i::after { content: ""; position: absolute; top: 50%; width: 8px; height: 8px; margin-top: -4px; border: solid var(--pencil); border-width: 0 0 2px 2px; }
.rt-handle i::before { left: 9px; transform: rotate(45deg); }
.rt-handle i::after { right: 9px; transform: rotate(-135deg); }
.rt-compare.hint .rt-handle, .rt-compare.hint .rt-before { transition: left .7s var(--ease), clip-path .7s var(--ease); }
.rt-lab { position: absolute; top: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(13, 11, 18, .58); color: #fff; font: 600 12px/1.5 var(--sans); pointer-events: none; transition: opacity .2s; }
.rt-lab.l { left: 12px; } .rt-lab.r { right: 12px; background: var(--pencil); }
.rt-view-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.rt-peek { appearance: none; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 14px var(--sans);
    cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none; }
.rt-peek:active, .rt-peek.on { border-color: var(--pencil); color: var(--pencil); }
.rt-notice b { color: var(--ink); }

/* ---------- ③ save ---------- */
.rt-save { display: grid; gap: 10px; }
.rt-save .btn { width: 100%; justify-content: center; }
.rt-wx { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- guide drawings (shared look from lab-chuge.css; these act out steps 2 and 3) ---------- */
.rt-guide .cg-guide-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rt-guide svg .tg { fill: #fff; font: 700 7.5px var(--sans); text-anchor: middle; }
.rt-guide svg .arrow { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rt-guide svg .aft { fill: color-mix(in srgb, var(--pencil) 12%, var(--surface)); }
.rt-guide svg .frame-l { fill: none; stroke: var(--hair); }
.rt-guide svg .bar { stroke: var(--pencil); stroke-width: 2; }
.rt-guide svg .knob { fill: var(--surface); stroke: var(--pencil); stroke-width: 2; }
@media (prefers-reduced-motion: no-preference) {
    .rt-guide[open] .a-turn { transform-origin: 50% 100%; animation: g-turn 4.2s infinite; }
    .rt-guide[open] .a-tag { transform-origin: center; animation: g-pop 4.2s infinite .4s both; }
    .rt-guide[open] .a-ref { animation: g-rise 4.2s infinite; }
    .rt-guide[open] .a-slide, .rt-guide[open] .a-wipe { animation: g-slide 4.2s var(--ease) infinite; }
}
@keyframes g-turn { 0%, 10% { transform: none; } 22%, 84% { transform: skewY(-6deg) scaleX(.82); } 96%, 100% { transform: none; } }
@keyframes g-slide { 0%, 8% { transform: translateX(0); } 34% { transform: translateX(-28px); } 62% { transform: translateX(26px); } 86%, 100% { transform: translateX(0); } }
@media (max-width: 640px) {
    .rt-guide .cg-guide-steps { grid-template-columns: 1fr; }
    .rt-drop { min-height: 300px; }
    .rt-photo img { max-height: 380px; }
}

/* ---------- /lab card ---------- */
.lab-card .rt-art { width: min(100%, 230px); }
