* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #06142b 0%, #0b1a4a 45%, #101b37 100%);
    color: #fff;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.bg-orb {
    position: fixed;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.25;
    z-index: 0;
    pointer-events: none;
}

.orb-1 {
    background: #4f46e5;
    top: -80px;
    left: -80px;
}

.orb-2 {
    background: #06b6d4;
    right: -100px;
    bottom: -80px;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 36px 36px;
    z-index: 0;
    pointer-events: none;
}

.page-shell {
    position: relative;
    z-index: 2;
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 18px 60px;
}

.hero {
    margin-bottom: 22px;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.logo-box {
    width: 84px;
    height: 84px;
    border-radius: 24px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.logo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-fallback {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.hero-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
}

.hero h1 {
    margin: 0 0 10px;
    font-size: 42px;
    line-height: 1.1;
}

.hero p {
    margin: 0;
    max-width: 760px;
    line-height: 1.7;
    color: #d7e3ff;
}

.main-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 32px;
    padding: 24px;
    backdrop-filter: blur(16px);
    box-shadow: 0 20px 80px rgba(0,0,0,0.28);
}

.main-grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 24px;
}

.panel {
    background: rgba(255,255,255,0.92);
    color: #101828;
    border-radius: 26px;
    padding: 22px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}

.panel-head h2 {
    margin: 0 0 6px;
    font-size: 28px;
}

.panel-head p {
    margin: 0 0 18px;
    color: #667085;
    line-height: 1.6;
}

.mode-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.mode-btn {
    border: 0;
    padding: 12px 18px;
    border-radius: 14px;
    background: #edf2ff;
    color: #1d4ed8;
    font-weight: 700;
    cursor: pointer;
}

.mode-btn.active {
    background: #2563eb;
    color: #fff;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.camera-shell {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    min-height: 360px;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
}

#camera {
    width: 100%;
    height: auto;
    display: block;
    max-height: 460px;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.face-guide {
    width: 56%;
    height: 78%;
    border: 2px dashed rgba(255,255,255,0.6);
    border-radius: 28px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.12);
}

.camera-fallback {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.88);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.camera-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.btn {
    border: 0;
    border-radius: 16px;
    padding: 13px 20px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}

.btn-secondary {
    background: #e4e7ec;
    color: #101828;
}

.btn-ghost {
    background: #eef2ff;
    color: #1d4ed8;
}

.btn-large {
    padding: 16px 28px;
    font-size: 16px;
}

.status-text {
    margin-top: 12px;
    font-size: 14px;
    color: #667085;
}

.upload-box {
    min-height: 260px;
    border: 2px dashed #cbd5e1;
    border-radius: 22px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    cursor: pointer;
    padding: 20px;
}

.upload-box input {
    display: none;
}

.upload-box span {
    font-weight: 700;
    font-size: 17px;
}

.upload-box small {
    color: #667085;
}

.upload-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: #e0e7ff;
    color: #1d4ed8;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.preview-card {
    margin-top: 18px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #eaecf0;
    border-radius: 22px;
}

.preview-label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #475467;
}

.preview-card img {
    width: 100%;
    max-height: 330px;
    object-fit: contain;
    border-radius: 16px;
    background: #fff;
}

.outfit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.outfit-card {
    display: block;
    background: #fff;
    border: 2px solid #eaecf0;
    border-radius: 20px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.outfit-card input {
    display: none;
}

.outfit-image-wrap {
    border-radius: 14px;
    overflow: hidden;
    background: #f8fafc;
}

.outfit-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.outfit-card span {
    display: block;
    margin-top: 10px;
    font-weight: 700;
    color: #101828;
}

.outfit-card:has(input:checked) {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
    transform: translateY(-2px);
}

.tips-box {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fbff, #eef4ff);
    border: 1px solid #dbe7ff;
}

.tips-box strong {
    display: block;
    margin-bottom: 8px;
}

.tips-box ul {
    margin: 0;
    padding-left: 18px;
    color: #475467;
    line-height: 1.7;
}

.form-error {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #fee4e2;
    color: #b42318;
    font-weight: 600;
}

.form-footer {
    text-align: center;
    margin-top: 24px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(2,6,23,0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.loading-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    color: #101828;
    border-radius: 28px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
}

.loading-card h3 {
    margin: 0 0 10px;
    font-size: 26px;
}

.loading-card p {
    margin: 0;
    color: #667085;
    line-height: 1.6;
}

.loader-ring {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 5px solid #dbeafe;
    border-top-color: #2563eb;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.result-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.result-card {
    width: 100%;
    max-width: 920px;
    background: #f8fafc;
    color: #101828;
    border-radius: 30px;
    padding: 34px;
    text-align: center;
}

.badge {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
    margin-bottom: 16px;
}

.badge.processing {
    background: #e0ecff;
    color: #1d4ed8;
}

.badge.success {
    background: #dcfae6;
    color: #15803d;
}

.badge.error {
    background: #fee4e2;
    color: #b42318;
}

.result-card h1 {
    margin: 0 0 12px;
    font-size: 38px;
    color: #0f254d;
}

.result-card p {
    color: #667085;
    line-height: 1.7;
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 22px;
}

.result-preview img {
    max-height: 72vh;
    object-fit: contain;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(0,0,0,0.12);
}

.helper-text {
    margin-top: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 34px;
    }
}

@media (max-width: 560px) {
    .page-shell {
        padding: 18px 12px 42px;
    }

    .main-card,
    .result-card {
        padding: 18px;
    }

    .outfit-grid {
        grid-template-columns: 1fr;
    }

    .camera-actions,
    .actions,
    .mode-switch {
        flex-direction: column;
    }

    .btn,
    .btn-large,
    .mode-btn {
        width: 100%;
    }

    .hero h1 {
        font-size: 28px;
    }

    .logo-box {
        width: 72px;
        height: 72px;
    }
}