/* Face search scanner. Colors come from the CopIX maroon theme. */
.face-search {
    max-width: 760px;
    margin: 0 auto;
    padding: 0.5rem 1rem 3rem;
    color: var(--copix-content-text, #f5f0e6);
}

.face-search-head {
    margin-bottom: 0.85rem;
}

.face-kicker {
    margin: 0 0 0.15rem;
    color: var(--copix-text-muted, #d99b9b);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-size: 0.72rem;
}

.face-search h1 {
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: 0.04em;
    color: var(--copix-text-primary, #fff);
}

.face-note,
.face-message {
    color: var(--copix-text-light, #ffdddd);
}

.face-note {
    margin: 0.35rem 0 0;
    max-width: 40rem;
}

.face-console {
    position: relative;
    padding: 0.7rem;
    border-radius: 22px;
    border: 1px solid rgba(205, 92, 92, 0.45);
    background:
        linear-gradient(180deg, rgba(255, 221, 214, 0.06), rgba(255, 221, 214, 0.02)),
        rgba(26, 8, 8, 0.72);
    box-shadow:
        0 0 0 1px rgba(127, 29, 29, 0.45),
        0 18px 40px rgba(0, 0, 0, 0.35),
        inset 0 0 40px rgba(127, 29, 29, 0.18);
}

.scanner-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 68vh;
    overflow: hidden;
    border-radius: 16px;
    background: var(--copix-bg-darkest, #1a0808);
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.55);
}

.scanner-viewport video,
.scanner-viewport .face-preview,
.scanner-viewport .scanner-idle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.scanner-viewport video,
.scanner-viewport .face-preview {
    object-fit: contain;
    background: #120403;
    z-index: 1;
}

.scanner-idle {
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--copix-text-muted, #d99b9b);
    letter-spacing: 0.28em;
    font-size: 0.78rem;
}

.scanner-idle-face {
    width: 38%;
    height: 52%;
    border-radius: 50%;
    border: 1px solid rgba(255, 214, 204, 0.28);
    box-shadow: 0 0 30px rgba(153, 27, 27, 0.35), inset 0 0 24px rgba(127, 29, 29, 0.35);
}

.scanner-grid,
.scanner-canvas,
.scanner-sweep,
.scanner-reticle,
.scanner-brackets,
.scanner-ring,
.scanner-banner,
.scanner-chip,
.scanner-statusbar,
.scanner-vignette {
    position: absolute;
    pointer-events: none;
}

.scanner-grid {
    inset: 0;
    z-index: 2;
    background-image:
        linear-gradient(rgba(255, 210, 196, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 210, 196, 0.07) 1px, transparent 1px);
    background-size: 32px 32px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 42%, transparent 78%);
    mask-image: radial-gradient(ellipse at center, #000 42%, transparent 78%);
}

.scanner-canvas {
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
}

.scanner-reticle {
    z-index: 4;
    left: 50%;
    top: 46%;
    width: 46%;
    height: 62%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255, 214, 204, 0.32);
    border-radius: 50%;
    box-shadow: 0 0 24px rgba(153, 27, 27, 0.35), inset 0 0 20px rgba(153, 27, 27, 0.18);
}

.scanner-reticle::before,
.scanner-reticle::after {
    content: "";
    position: absolute;
    background: rgba(255, 220, 210, 0.4);
}

.scanner-reticle::before {
    left: 50%;
    top: -8%;
    bottom: -8%;
    width: 1px;
}

.scanner-reticle::after {
    top: 50%;
    left: -8%;
    right: -8%;
    height: 1px;
}

.scanner-sweep {
    z-index: 4;
    left: 8%;
    right: 8%;
    height: 2px;
    top: 14%;
    background: linear-gradient(90deg, transparent, rgba(255, 214, 204, 0.15), #fff6f2, rgba(255, 180, 160, 0.15), transparent);
    box-shadow: 0 0 18px 4px rgba(185, 28, 28, 0.8);
    animation: face-sweep 2.8s ease-in-out infinite alternate;
}

.scanner-brackets {
    inset: 0;
    z-index: 5;
}

.scanner-brackets i {
    position: absolute;
    width: 14%;
    height: 14%;
    border: 2px solid rgba(255, 228, 220, 0.92);
    filter: drop-shadow(0 0 6px rgba(185, 28, 28, 0.85));
}

.scanner-brackets .br-tl { top: 5%; left: 4%; border-right: 0; border-bottom: 0; }
.scanner-brackets .br-tr { top: 5%; right: 4%; border-left: 0; border-bottom: 0; }
.scanner-brackets .br-bl { bottom: 12%; left: 4%; border-right: 0; border-top: 0; }
.scanner-brackets .br-br { bottom: 12%; right: 4%; border-left: 0; border-top: 0; }

.scanner-ring {
    z-index: 5;
    top: 30%;
    right: 7%;
    width: 72px;
    height: 72px;
}

.scanner-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-track,
.ring-value {
    fill: none;
    stroke-width: 3;
}

.ring-track { stroke: rgba(255, 221, 214, 0.22); }

.ring-value {
    stroke: #ffe4dc;
    stroke-linecap: round;
    stroke-dasharray: 64 112;
    stroke-dashoffset: 0;
    animation: face-ring 2.6s linear infinite;
    filter: drop-shadow(0 0 4px rgba(255, 214, 204, 0.8));
}

.scanner-ring span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--copix-text-light, #ffdddd);
}

.scanner-banner,
.scanner-chip,
.scanner-statusbar {
    z-index: 6;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--copix-text-light, #ffdddd);
    letter-spacing: 0.12em;
    text-shadow: 0 0 10px rgba(127, 29, 29, 0.9);
}

.scanner-banner,
.scanner-chip {
    text-transform: uppercase;
}

.scanner-banner {
    top: 8%;
    left: 22%;
    right: 22%;
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
}

.scanner-chip {
    top: 8%;
    padding: 0.2rem 0.45rem;
    border: 1px solid rgba(255, 214, 204, 0.28);
    border-radius: 999px;
    background: rgba(26, 8, 8, 0.45);
    font-size: 0.68rem;
    animation: face-flicker 1.7s steps(2, end) infinite;
}

.scanner-chip-left { left: 7%; }
.scanner-chip-right { right: 7%; }

.scanner-statusbar {
    left: 8%;
    right: 8%;
    bottom: 4.5%;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0.65rem;
    border-radius: 999px;
    background: rgba(18, 4, 3, 0.62);
    border: 1px solid rgba(255, 214, 204, 0.22);
    font-size: 0.72rem;
}

.scanner-status {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scanner-statusbar.is-honest .scanner-status {
    color: #fff6f2;
    white-space: normal;
    letter-spacing: 0.04em;
}

.scanner-vignette {
    inset: 0;
    z-index: 4;
    background: radial-gradient(ellipse at center, transparent 52%, rgba(18, 4, 3, 0.55) 100%);
}

.is-analyze .scanner-grid {
    background-image:
        linear-gradient(rgba(255, 220, 210, 0.16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 220, 210, 0.16) 1px, transparent 1px);
}

.is-analyze .scanner-sweep {
    animation-duration: 1.05s;
    height: 3px;
    box-shadow: 0 0 24px 8px rgba(255, 140, 110, 0.9);
}

.is-analyze .ring-value { animation-duration: 0.9s; }
.is-analyze .scanner-chip { animation-duration: 0.7s; }
.is-analyze .scanner-reticle {
    border-color: rgba(255, 236, 228, 0.7);
    box-shadow: 0 0 28px rgba(255, 160, 140, 0.45), inset 0 0 24px rgba(185, 28, 28, 0.28);
}

.is-idle .scanner-sweep,
.is-hold .scanner-sweep {
    animation-duration: 4.6s;
    opacity: 0.45;
}

.is-hold .scanner-grid,
.is-idle .scanner-grid { opacity: 0.65; }

.face-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.face-btn {
    position: relative;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.55rem 1.15rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 221, 214, 0.38);
    background:
        linear-gradient(180deg, rgba(255, 236, 228, 0.14), rgba(255, 236, 228, 0.03)),
        rgba(80, 12, 10, 0.55);
    color: var(--copix-text-primary, #fff);
    box-shadow:
        0 0 0 1px rgba(127, 29, 29, 0.45),
        0 8px 24px rgba(0, 0, 0, 0.28),
        0 0 18px rgba(185, 28, 28, 0.4);
    backdrop-filter: blur(10px);
    font: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.face-btn svg {
    width: 1.05rem;
    height: 1.05rem;
    flex: none;
}

.face-btn-primary {
    background:
        linear-gradient(180deg, rgba(255, 196, 180, 0.28), rgba(127, 29, 29, 0.15)),
        var(--copix-primary, #7f1d1d);
    border-color: rgba(255, 228, 220, 0.62);
}

.face-btn-quiet {
    background: rgba(26, 8, 8, 0.35);
    box-shadow: 0 0 0 1px rgba(127, 29, 29, 0.35), 0 0 12px rgba(127, 29, 29, 0.25);
}

.face-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(255, 236, 228, 0.75);
    box-shadow:
        0 0 0 1px rgba(185, 28, 28, 0.55),
        0 10px 28px rgba(0, 0, 0, 0.32),
        0 0 26px rgba(255, 170, 150, 0.45);
}

.face-btn:active:not(:disabled) { transform: translateY(0) scale(0.99); }

.face-btn:focus-visible {
    outline: 2px solid var(--copix-text-light, #ffdddd);
    outline-offset: 3px;
}

.face-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    box-shadow: none;
}

.face-btn:disabled.is-loading {
    opacity: 1;
    cursor: progress;
    box-shadow: 0 0 22px rgba(255, 170, 150, 0.45);
}

.face-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.face-spin {
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 221, 214, 0.35);
    border-top-color: #fff;
    animation: face-spin 0.7s linear infinite;
}

.face-hint {
    margin: 0.55rem 0 0;
    color: var(--copix-text-muted, #d99b9b);
    font-size: 0.85rem;
}

.face-alert {
    margin-top: 0.9rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 214, 204, 0.28);
    background: rgba(26, 8, 8, 0.78);
    color: var(--copix-text-light, #ffdddd);
}

.face-alert p { margin: 0.2rem 0 0; }

.face-alert-kicker {
    margin: 0;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--copix-text-primary, #fff);
}

.face-alert-busy {
    border-color: rgba(249, 115, 22, 0.65);
    box-shadow: 0 0 18px rgba(185, 28, 28, 0.28);
}

.face-alert-noface {
    border-color: rgba(255, 214, 204, 0.5);
}

.face-alert-other {
    border-color: var(--copix-danger-border, rgba(239, 68, 68, 0.3));
    background: var(--copix-danger-bg, rgba(239, 68, 68, 0.15));
}

.face-alert .face-btn { margin-top: 0.75rem; }

.face-legend,
.face-results {
    list-style: none;
    padding: 0;
    margin: 0.8rem 0 0;
}

.face-legend li,
.face-result {
    display: flex;
    gap: 0.7rem;
    align-items: center;
}

.face-legend li { margin: 0.25rem 0; color: var(--copix-text-light, #ffdddd); }

.swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
    flex: none;
}

.swatch.high { background: #2e7d32; }
.swatch.review { background: #f9a825; }
.swatch.weak { background: #9e9e9e; }

.face-result {
    padding: 0.7rem;
    margin-bottom: 0.5rem;
    border-radius: 14px;
    background: rgba(58, 12, 8, 0.85);
    border: 1px solid rgba(255, 214, 204, 0.16);
    border-left-width: 6px;
}

.face-result.high { border-left-color: #2e7d32; }
.face-result.review { border-left-color: #f9a825; }
.face-result.weak { border-left-color: #9e9e9e; }

.face-result img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
}

.face-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--copix-text-primary, #fff);
}

.face-result a { color: var(--copix-text-light, #ffdddd); }

@keyframes face-sweep {
    from { top: 12%; }
    to { top: 80%; }
}

@keyframes face-ring {
    to { stroke-dashoffset: -176; }
}

@keyframes face-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@keyframes face-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .face-search { padding-left: 0.7rem; padding-right: 0.7rem; }
    .face-search h1 { font-size: 1.45rem; }
    .scanner-viewport {
        aspect-ratio: 3 / 4;
        max-height: 62vh;
    }
    .scanner-ring { width: 58px; height: 58px; top: 28%; }
    .scanner-chip { top: 6%; }
    .scanner-banner { top: 13%; left: 18%; right: 18%; }
    .scanner-chip,
    .scanner-banner,
    .scanner-statusbar { letter-spacing: 0.06em; }
    .face-actions { gap: 0.45rem; }
    .face-btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .scanner-sweep,
    .ring-value,
    .scanner-chip,
    .face-spin,
    .face-btn {
        animation: none !important;
        transition: none;
    }

    .scanner-sweep { top: 46%; opacity: 0.4; }
    .face-btn:hover:not(:disabled) { transform: none; }
}
