/* ==========================================================================
   Virtual Try-On — public, shareable funnel page
   Dark / purple aesthetic, mirrors scene-studio.css conventions.
   ========================================================================== */

.vto-page {
    background: var(--surface-raised);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    padding-bottom: 80px;
}

.vto-accent {
    background: linear-gradient(90deg, #828282, #7c7c7c);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------- Hero ---------- */
.vto-hero {
    text-align: center;
    padding: 52px 20px 22px;
    background: radial-gradient(900px 460px at 50% -20%, rgba(130, 130, 130, 0.32), transparent 70%);
}
.vto-hero-title { font-size: clamp(30px, 6vw, 48px); font-weight: 800; margin: 0 0 14px; line-height: 1.05; }
.vto-hero-sub { font-size: clamp(15px, 2.4vw, 18px); color: var(--ink-soft); max-width: 640px; margin: 0 auto; line-height: 1.55; }
.vto-hero-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 20px; }
.vto-step { font-size: 13px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 7px; }
.vto-step i { color: var(--ink-soft); font-size: 15px; }

/* ---------- Guest banner ---------- */
.vto-guest-banner {
    max-width: 640px;
    margin: 0 auto 8px;
    padding: 12px 18px;
    display: flex; align-items: center; gap: 10px;
    background: var(--glass-strong);
    border: 1px solid rgba(88, 88, 88, 0.28);
    border-radius: 14px;
    font-size: 14px; color: var(--ink-soft);
}
.vto-guest-banner a { color: var(--ink-muted); font-weight: 700; text-decoration: none; }
.vto-guest-icon { font-size: 18px; }

/* ---------- Shell ---------- */
.vto-shell { max-width: 920px; margin: 0 auto; padding: 16px 16px 0; }

/* ---------- Selfie card ---------- */
.vto-selfie-card {
    background: var(--glass);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    padding: 16px;
    margin: 14px 0 22px;
}
.vto-card-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-muted); margin-bottom: 10px; }
.vto-card-hint { font-size: 12px; color: var(--ink-muted); margin-top: 8px; text-align: center; }
.vto-dropzone {
    position: relative;
    border: 1.5px dashed rgba(88, 88, 88, 0.4);
    border-radius: 14px;
    min-height: 180px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: border-color .15s, background .15s;
    overflow: hidden;
}
.vto-dropzone.dragover { border-color: var(--line); background: var(--glass-strong); }
.vto-dropzone-empty { text-align: center; padding: 22px; }
.vto-dropzone-icon { font-size: 34px; color: var(--ink-soft); }
.vto-dropzone-text { margin: 8px 0 14px; color: var(--ink-soft); font-size: 14px; }
.vto-link { color: var(--ink-muted); font-weight: 700; }
.vto-selfie-btn {
    background: var(--scrim-soft); border: 1px solid rgba(88, 88, 88, 0.35);
    color: var(--ink); border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 7px;
}
.vto-selfie-btn:hover { background: var(--scrim-soft); }
.vto-dropzone-preview { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; }
.vto-dropzone-preview img { max-height: 220px; max-width: 100%; border-radius: 12px; object-fit: cover; }
.vto-selfie-change {
    background: var(--veil-strong); border: 1px solid rgba(0, 0, 0, 0.2); color: var(--ink);
    border-radius: 9px; padding: 6px 12px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.vto-selfie-status { font-size: 13px; }
.vto-selfie-status.ok { color: #1d8660; }
.vto-selfie-status.error { color: #d50b0b; }
.vto-selfie-status.uploading { color: var(--ink-soft); }

/* ---------- Tabs ---------- */
.vto-tabs {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.vto-tabs::-webkit-scrollbar { display: none; }
.vto-tab {
    flex: 0 0 auto;
    background: var(--glass); border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--ink-soft); border-radius: 999px; padding: 9px 18px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.vto-tab:hover { color: var(--ink); border-color: var(--line-strong); }
.vto-tab.active { background: linear-gradient(90deg, #828282, #7c7c7c); color: var(--ink); border-color: transparent; }

/* ---------- Outfit picker (Try-on tab) ---------- */
.vto-outfit-panel { margin-top: 16px; }
.vto-outfit-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 10px; }
.vto-outfit-sub { font-weight: 400; color: var(--ink-muted); }
.vto-outfit-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.vto-outfit-row::-webkit-scrollbar { display: none; }
.vto-outfit-item, .vto-outfit-upload {
    flex: 0 0 auto; width: 78px; height: 78px; border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1); background: var(--glass);
    cursor: pointer; overflow: hidden; padding: 0; position: relative;
}
.vto-outfit-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vto-outfit-item.selected { border-color: var(--line); }
.vto-outfit-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-muted); font-size: 11px; }
.vto-outfit-upload i { font-size: 20px; color: var(--ink-soft); }
.vto-outfit-upload.is-loading { opacity: .6; pointer-events: none; }

/* ---------- Template grids ---------- */
.vto-grids { margin-top: 18px; }
.vto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.vto-grid.hidden { display: none; }
.vto-grid-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-muted); padding: 40px 0; font-size: 14px; }
.vto-tile {
    position: relative; border: 2px solid rgba(0, 0, 0, 0.08); border-radius: 14px;
    overflow: hidden; cursor: pointer; padding: 0; background: var(--glass);
    aspect-ratio: 3 / 4; transition: border-color .15s, transform .15s;
}
.vto-tile:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.vto-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vto-tile-name {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 10px 8px;
    font-size: 12px; font-weight: 600; text-align: left; color: var(--ink);
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.78));
}
.vto-tile-check {
    position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
    background: var(--fill-mid); color: var(--ink); display: none; align-items: center; justify-content: center; font-size: 14px;
}
.vto-tile.selected { border-color: var(--line); }
.vto-tile.selected .vto-tile-check { display: flex; }

/* ---------- Generate ---------- */
.vto-generate-wrap { position: sticky; bottom: 0; margin-top: 26px; padding: 16px 0 8px; text-align: center; background: linear-gradient(transparent, #efefef 24%); }
.vto-generate-btn {
    width: 100%; max-width: 460px; border: none; border-radius: 14px; padding: 15px 22px;
    background: linear-gradient(90deg, #828282, #7c7c7c); color: var(--ink); font-size: 16px; font-weight: 700;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); transition: opacity .15s, transform .1s;
}
.vto-generate-btn:hover:not(:disabled) { transform: translateY(-1px); }
.vto-generate-btn:active:not(:disabled) { transform: translateY(0); }
.vto-generate-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.vto-generate-cost { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; background: var(--veil); padding: 3px 9px; border-radius: 999px; }
.vto-balance { margin-top: 10px; font-size: 13px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 7px; }
.vto-balance-add { background: none; border: none; color: var(--ink-soft); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.vto-generate-hint { margin-top: 10px; font-size: 13px; color: var(--ink-muted); }

/* ---------- Overlays ---------- */
.vto-overlay { position: fixed; inset: 0; z-index: 2000; background: var(--veil-strong); display: flex; align-items: center; justify-content: center; padding: 20px; }
.vto-overlay[hidden] { display: none; }
.vto-overlay-inner { text-align: center; }
.vto-spinner { width: 46px; height: 46px; border: 3px solid rgba(88, 88, 88, 0.25); border-top-color: var(--line); border-radius: 50%; margin: 0 auto 16px; animation: vto-spin 0.9s linear infinite; }
@keyframes vto-spin { to { transform: rotate(360deg); } }
.vto-overlay-text { color: var(--ink-soft); font-size: 15px; }

.vto-result { width: 100%; max-width: 460px; background: var(--surface-sunken); border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 18px; overflow: hidden; }
.vto-result-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.vto-result-title { font-size: 18px; font-weight: 700; margin: 0; }
.vto-result-close { background: none; border: none; color: var(--ink-muted); font-size: 18px; cursor: pointer; }
.vto-result-imgwrap { background: var(--surface-page); display: flex; align-items: center; justify-content: center; max-height: 64vh; }
.vto-result-image { max-width: 100%; max-height: 64vh; object-fit: contain; }
.vto-result-actions { display: flex; gap: 8px; padding: 14px; }
.vto-result-btn { flex: 1; border-radius: 11px; padding: 11px 10px; font-size: 13px; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid rgba(0, 0, 0, 0.14); background: var(--glass-strong); color: var(--ink); }
.vto-result-btn-download { background: linear-gradient(90deg, #828282, #7c7c7c); border-color: transparent; }
.vto-result-btn:hover { filter: brightness(1.08); }

/* ---------- Webcam ---------- */
.vto-webcam-backdrop { position: fixed; inset: 0; z-index: 2100; background: var(--veil-strong); display: flex; align-items: center; justify-content: center; padding: 20px; }
.vto-webcam-backdrop[hidden] { display: none; }
.vto-webcam { max-width: 440px; width: 100%; }
.vto-webcam video { width: 100%; border-radius: 14px; transform: scaleX(-1); }
.vto-webcam-actions { display: flex; gap: 10px; margin-top: 14px; }
.vto-webcam-btn { flex: 1; border: none; border-radius: 11px; padding: 12px; font-size: 14px; font-weight: 600; cursor: pointer; background: linear-gradient(90deg, #828282, #7c7c7c); color: var(--ink); }
.vto-webcam-btn.vto-webcam-cancel { background: var(--glass-strong); }

@media (max-width: 520px) {
    .vto-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
