/* OMAAA Astro — Transparent Hand & Face Alignment Stencil + Green-Tick Fit Gate */
.sm-slot {
    --sm-accent: #f59e0b;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.sm-viewport {
    position: relative;
    width: 100%;
    max-width: 340px;
    aspect-ratio: 300 / 380;
    margin: 0 auto;
    border-radius: 22px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 45%, #1e293b 0%, #0f172a 100%);
    border: 3px solid #cbd5e1;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    user-select: none;
    touch-action: pan-y;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.sm-slot.compact {
    padding: 0 6px;
}

.sm-slot.compact .sm-viewport {
    max-width: 240px;
    border-radius: 16px;
}

.sm-slot.state-fit .sm-viewport {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22), 0 12px 30px rgba(16, 185, 129, 0.22);
}

.sm-slot.state-warn .sm-viewport {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

/* Media layer underneath transparent stencil cutout */
.sm-media-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.sm-media-layer:active { cursor: grabbing; }

.sm-video,
.sm-photo-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.sm-video.active,
.sm-photo-canvas.active {
    display: block;
}

/* Real-Time Multi-Scanner Animated Dot Mesh & Line Tracing Canvas */
.sm-scan-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    display: none;
}

.sm-scan-canvas.active {
    display: block;
}

.sm-slot.state-scanning .sm-viewport {
    border-color: #06b6d4;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.25), 0 12px 30px rgba(6, 182, 212, 0.25);
}

.sm-slot.state-scanning .sm-stencil-outline {
    stroke: #22d3ee;
    stroke-width: 4;
    stroke-dasharray: none;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.85));
}

.sm-slot.state-scanning .sm-empty-hint {
    background: rgba(8, 51, 68, 0.92);
    border-color: #22d3ee;
    color: #cffafe;
}

/* Detected Lines / Facial Features Legend & Replay Bar */
.sm-scan-legend {
    display: none;
    width: 100%;
    max-width: 340px;
    margin-top: 8px;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 8px 10px;
    text-align: left;
    font-size: 11px;
}

.sm-slot.compact .sm-scan-legend {
    max-width: 240px;
    padding: 6px 8px;
    font-size: 9.8px;
}

.sm-scan-legend.show { display: block; }

.sm-legend-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    padding-bottom: 5px;
    font-weight: 800;
    color: #67e8f9;
}

.sm-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.sm-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    padding: 2px 7px;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.3;
}

.sm-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sm-legend-controls {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.sm-mini-btn {
    flex: 1;
    background: rgba(34, 211, 238, 0.14);
    border: 1px solid rgba(34, 211, 238, 0.45);
    color: #cffafe;
    border-radius: 8px;
    padding: 3px 6px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.sm-mini-btn:hover { background: rgba(34, 211, 238, 0.26); }

/* Transparent Cutout SVG Overlay */
.sm-overlay-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.sm-stencil-outline {
    fill: none;
    stroke: #fbbf24;
    stroke-width: 3.4;
    stroke-dasharray: 8 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.25s ease, stroke-dasharray 0.25s ease, filter 0.25s ease;
}

.sm-slot.state-warn .sm-stencil-outline {
    stroke: #fb923c;
    stroke-width: 3.8;
}

.sm-slot.state-fit .sm-stencil-outline {
    stroke: #10b981;
    stroke-width: 4.5;
    stroke-dasharray: none;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.85));
}

.sm-guide-lines {
    fill: none;
    stroke: rgba(255, 255, 255, 0.42);
    stroke-width: 1.5;
    stroke-dasharray: 4 4;
    transition: stroke 0.25s ease, opacity 0.25s ease;
}

.sm-slot.state-fit .sm-guide-lines {
    stroke: rgba(167, 243, 208, 0.72);
}

.sm-finger-label {
    font-size: 9.5px;
    font-weight: 800;
    fill: rgba(255, 251, 235, 0.92);
    text-anchor: middle;
    paint-order: stroke;
    stroke: rgba(15, 23, 42, 0.8);
    stroke-width: 2.5px;
}

.sm-slot.has-media .sm-finger-label {
    opacity: 0.55;
}

.sm-slot.state-fit .sm-finger-label {
    opacity: 0;
}

/* Top Orientation Badge */
.sm-top-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 6;
    background: rgba(15, 23, 42, 0.78);
    color: #fef3c7;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(251, 191, 36, 0.45);
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.sm-slot.compact .sm-top-badge {
    font-size: 9px;
    padding: 2px 7px;
    top: 5px;
    left: 6px;
}

/* Big Animated Green Tick Badge (Only visible when FIT) */
.sm-green-tick {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 8;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.55);
    border: 2.5px solid #ecfdf5;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
    pointer-events: none;
}

.sm-slot.compact .sm-green-tick {
    width: 34px;
    height: 34px;
    top: 7px;
    right: 7px;
}

.sm-slot.state-fit .sm-green-tick {
    transform: scale(1);
    opacity: 1;
}

/* Empty Center Prompt */
.sm-empty-hint {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 6;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    border-radius: 12px;
    padding: 7px 10px;
    font-size: 11.5px;
    font-weight: 700;
    text-align: center;
    line-height: 1.35;
    border: 1px solid rgba(255, 255, 255, 0.16);
    pointer-events: none;
}

.sm-slot.compact .sm-empty-hint {
    font-size: 10px;
    padding: 5px 7px;
    bottom: 8px;
}

.sm-slot.state-fit .sm-empty-hint {
    background: rgba(6, 95, 70, 0.92);
    border-color: #34d399;
    color: #ecfdf5;
}

.sm-slot.state-warn .sm-empty-hint {
    background: rgba(154, 52, 18, 0.90);
    border-color: #fdba74;
    color: #fff7ed;
}

/* Fit Progress Bar */
.sm-meter-wrap {
    width: 100%;
    max-width: 340px;
    margin-top: 8px;
}

.sm-slot.compact .sm-meter-wrap { max-width: 240px; }
.sm-slot.compact .sm-meter-row { font-size: 10.5px; }

.sm-meter-track {
    width: 100%;
    height: 7px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.sm-meter-fill {
    height: 100%;
    width: 0%;
    background: #f59e0b;
    border-radius: 999px;
    transition: width 0.2s ease, background-color 0.25s ease;
}

.sm-slot.state-fit .sm-meter-fill { background: #10b981; }
.sm-slot.state-warn .sm-meter-fill { background: #f97316; }

.sm-meter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    margin-top: 4px;
}

.sm-slot.state-fit .sm-meter-row { color: #047857; }

/* Action Buttons (Live Camera + Gallery Upload) */
.sm-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 340px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.sm-slot.compact .sm-actions { max-width: 240px; gap: 5px; flex-direction: column; }

.sm-btn {
    flex: 1;
    min-width: 90px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
    border: 1.5px solid #d97706;
    background: #fffbeb;
    color: #92400e;
    transition: all 0.16s ease;
    text-align: center;
    white-space: nowrap;
}

.sm-slot.compact .sm-btn {
    padding: 6px 10px;
    font-size: 11px;
    width: 100%;
    min-width: 0;
}

.sm-btn:hover { background: #fef3c7; }

.sm-btn-cam {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #047857;
    color: #fff;
}

.sm-btn-cam:hover { filter: brightness(1.07); color: #fff; }

.sm-btn-capture {
    display: none;
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #059669;
    color: #fff;
    width: 100%;
}

.sm-btn-capture.show { display: inline-flex; }

/* Uploaded Image Fine Alignment Controls (Drag / Zoom / Rotate) */
.sm-adjust-bar {
    display: none;
    width: 100%;
    max-width: 340px;
    margin-top: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 11.5px;
}

.sm-slot.compact .sm-adjust-bar { max-width: 240px; padding: 6px 8px; font-size: 10.5px; }

.sm-adjust-bar.show { display: block; }

.sm-adjust-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.sm-adjust-row:last-child { margin-bottom: 0; }
.sm-adjust-row span { min-width: 44px; font-weight: 700; color: #334155; text-align: left; }
.sm-adjust-row input[type="range"] { flex: 1; accent-color: #059669; cursor: pointer; }

/* Submit / Proceed Locked Gate Style */
.sm-gate-locked {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    filter: grayscale(0.45);
    pointer-events: auto;
}

[data-sm-ready="1"]:not(.sm-gate-locked) {
    animation: smPulseBtn 1.8s infinite ease-in-out;
    box-shadow: 0 4px 18px rgba(202, 138, 4, 0.45) !important;
    cursor: pointer !important;
}

@keyframes smPulseBtn {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.sm-gate-status {
    margin-top: 8px;
    font-size: 12.5px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 10px;
    display: inline-block;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.sm-gate-status.ready {
    background: #ecfdf5;
    color: #065f46;
    border-color: #6ee7b7;
}

/* 2026-11-23 / Stage 25: Non-cropping mobile media frame & 360° photo editor controls */
.sm-photo-canvas, .sm-video { background: #0f172a; object-fit: contain; }
.sm-slot.has-media .sm-overlay-svg > rect { opacity: 0; }
.sm-slot.has-media .sm-stencil-outline { opacity: 0.27; stroke-width: 2.5; }
.sm-slot.has-media .sm-guide-lines { opacity: 0.25; }
.sm-slot.sm-guide-hidden .sm-overlay-svg { display: none; }
.sm-empty-hint {
    position: static;
    width: 100%;
    max-width: 340px;
    margin-top: 9px;
    z-index: auto;
    min-height: 34px;
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 12px;
}
.sm-slot.compact .sm-empty-hint { max-width: 240px; }
.sm-slot.state-fit .sm-empty-hint { background: #ecfdf5; color: #065f46; }
.sm-slot.state-warn .sm-empty-hint { background: #fff7ed; color: #9a3412; }
.sm-ear-review:not([hidden]) {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem;
    min-height: 44px;
    max-width: 340px;
    line-height: 1.45;
    text-align: start;
    cursor: pointer;
}
.sm-ear-review[hidden] { display: none; }
.sm-ear-review input { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.sm-adjust-help { color: #0f766e; font-size: 11px; font-weight: 700; margin-bottom: 8px; line-height: 1.5; }
.sm-adjust-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 9px; }
.sm-adjust-buttons .sm-mini-btn { min-height: 40px; font-size: 11px; padding: 8px; }
.sm-adjust-row input[type=range] { min-width: 0; min-height: 36px; }
@media (max-width: 575px) {
    .sm-slot.compact { padding: 0; }
    .sm-slot.compact .sm-viewport,
    .sm-slot.compact .sm-meter-wrap,
    .sm-slot.compact .sm-actions,
    .sm-slot.compact .sm-adjust-bar,
    .sm-slot.compact .sm-empty-hint,
    .sm-slot.compact .sm-scan-legend { max-width: 340px; }
    .sm-slot.compact .sm-actions { flex-direction: row; }
    .sm-slot.compact .sm-btn { flex: 1 1 125px; width: auto; }
    .sm-slot.compact .sm-top-badge { font-size: 11px; padding: 4px 8px; }
    .sm-slot.compact .sm-empty-hint { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .sm-viewport, .sm-stencil-outline, .sm-guide-lines { transition: none; }
}
.sm-adjust-row label { min-width: 44px; font-weight: 700; color: #334155; }
.sm-adjust-row output { min-width: 45px; text-align: right; color: #0f766e; font-weight: 800; font-variant-numeric: tabular-nums; }
.sm-adjust-shortcuts { margin-top: 2px; }
.sm-adjust-shortcuts .sm-mini-btn { min-width: 0; }
.sm-adjust-row-zoom .sm-mini-btn {
    flex: 0 0 38px; min-height: 44px; min-width: 38px;
    background: #ecfdf5; color: #065f46; border-color: #86efac;
    font-size: 22px; padding: 4px;
}
.sm-confirm-button {
    width: 100%; min-height: 48px; margin-top: 10px;
    border: 0; border-radius: 10px; cursor: pointer;
    color: #fff; background: #047857; font-weight: 800;
    font-size: 13px; padding: 10px 12px;
}
.sm-confirm-button:focus-visible, .sm-adjust-bar button:focus-visible,
.sm-adjust-bar input:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.sm-slot.compact .sm-adjust-row-zoom { gap: 4px; }
.sm-slot.compact .sm-adjust-row label { min-width: 38px; }
.sm-slot.compact .sm-adjust-row output { min-width: 35px; font-size: 10px; }
.sm-slot.compact .sm-adjust-row-zoom .sm-mini-btn { min-width: 32px; flex-basis: 32px; }
@media (max-width: 360px) {
    .sm-adjust-bar { padding: 8px 6px; }
    .sm-adjust-row { gap: 5px; }
    .sm-adjust-row-zoom .sm-mini-btn { flex-basis: 34px; min-width: 34px; }
}
.sm-adjust-bar .sm-mini-btn {
    background: #e6f7f4;
    border: 1px solid #6ee7b7;
    color: #065f46;
    min-height: 44px;
    font-size: 12px;
    line-height: 1.25;
    white-space: normal;
}
.sm-adjust-bar .sm-mini-btn:hover { background: #ccfbf1; color: #064e3b; }
.sm-adjust-bar .sm-btn-zoom-in, .sm-adjust-bar .sm-btn-zoom-out { font-size: 22px; }
