:root {
    --bg: #050508;
    --card: rgba(15, 15, 22, 0.75);
    --border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --text-dim: #94a3b8;
    
    --accent: #ff1b6b;
    --accent-glow: rgba(255, 27, 107, 0.4);
    --accent-alt: #45caff;
    
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --font-h: 'Outfit', sans-serif;
    --font-b: 'Plus Jakarta Sans', sans-serif;
}

[data-theme="light"] {
    --bg: #f8fafc;
    --card: rgba(255, 255, 255, 0.95);
    --border: rgba(0, 0, 0, 0.08);
    --text: #0f172a;
    --text-dim: #475569;
    --accent: #e11d48;
    --accent-glow: rgba(225, 29, 72, 0.2);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-b);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.5s var(--ease);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.glow-mesh {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(at 0% 0%, var(--accent-glow) 0, transparent 45%),
                radial-gradient(at 100% 100%, rgba(69, 202, 255, 0.15) 0, transparent 45%);
    z-index: -1;
    pointer-events: none;
}

/* ===== NAVIGATION ===== */
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 2rem;
    background: var(--card);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0; z-index: 1000;
    gap: 1rem;
}

.logo { 
    font-family: var(--font-h); 
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: -1px;
    white-space: nowrap;
}

.logo span { 
    color: var(--accent);
    background: linear-gradient(135deg, var(--accent), var(--accent-alt));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.theme-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 0.6rem;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
}

.theme-btn:active { 
    transform: scale(0.92);
}

[data-theme="dark"] .sun-icon, 
[data-theme="light"] .moon-icon { 
    display: none; 
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper { 
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    width: 100%;
}

/* ===== HERO SECTION ===== */
.hero-section { 
    text-align: center;
    margin-bottom: 2rem;
    padding: 0;
}

.hero-section h1 { 
    font-family: var(--font-h);
    font-size: 3.8rem;
    font-weight: 950;
    line-height: 1.15;
    margin-bottom: 0.8rem;
    letter-spacing: -0.02em;
}

.gradient-text { 
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-alt) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.subtitle { 
    color: var(--text-dim);
    font-size: 1.3rem;
    font-weight: 500;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    letter-spacing: 0.3px;
}

/* ===== APP CARD ===== */
.app-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 2.5rem;
    padding: 2.5rem;
    box-shadow: 0 40px 100px -15px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    margin: 0 auto;
}

/* ===== UPLOAD GRID - DESKTOP ===== */
.upload-grid { 
    display: grid;
    grid-template-columns: 1fr 140px 1fr;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.upload-box {
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, rgba(255, 27, 107, 0.08) 0%, rgba(69, 202, 255, 0.08) 100%);
    border: 2px dashed var(--border);
    border-radius: 2rem;
    cursor: pointer;
    transition: 0.3s var(--ease);
    position: relative;
    overflow: hidden;
    width: 100%;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
}

.upload-box:hover { 
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(255, 27, 107, 0.15) 0%, rgba(69, 202, 255, 0.1) 100%);
    transform: translateY(-6px);
    box-shadow: 0 15px 40px rgba(255, 27, 107, 0.25);
}

.upload-box:active {
    transform: scale(0.97);
}

.connector {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.box-content { 
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    gap: 1rem;
}

.upload-icon { 
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-icon svg {
    width: 48px;
    height: 48px;
    stroke-width: 1.5;
}

.empty-ui h3 { 
    font-family: var(--font-h);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.preview-wrap { 
    position: absolute;
    top: 0; left: 0;
    width: 100%; 
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-img { 
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: scaleIn 0.4s var(--ease);
}

@keyframes scaleIn { 
    from { 
        opacity: 0;
        transform: scale(1.08);
    } 
    to { 
        opacity: 1;
        transform: scale(1);
    } 
}

.scan-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent-glow);
    animation: scanLine 3.5s infinite ease-in-out;
    z-index: 10;
}

@keyframes scanLine { 
    0%, 100% { top: 0; } 
    50% { top: calc(100% - 4px); } 
}

/* ===== NEXUS GRAPHIC ===== */
.nexus-graphic { 
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nexus-graphic svg { 
    width: 100%;
    height: 100%;
    z-index: 5;
    animation: heartbeat 1.2s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: drop-shadow(0 0 30px var(--accent-glow));
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.35); }
    30% { transform: scale(1); }
    45% { transform: scale(1.18); }
    60% { transform: scale(1); }
}

.pulse-rings {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pulse-rings span {
    position: absolute;
    top: 50%; left: 50%;
    border: 2.5px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: ringPulse 2.5s infinite;
}

.pulse-rings span:nth-child(1) { 
    width: 70px;
    height: 70px;
}

.pulse-rings span:nth-child(2) { 
    width: 70px;
    height: 70px;
    animation-delay: 1.25s;
}

@keyframes ringPulse {
    0% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* ===== ACTION FOOTER ===== */
.action-footer {
    margin-top: 1.5rem;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-alt) 100%);
    color: white;
    border: none;
    padding: 1.2rem 2rem;
    border-radius: 1.5rem;
    font-size: 1.25rem;
    font-weight: 850;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    box-shadow: 0 15px 45px var(--accent-glow);
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s;
}

.btn-primary:hover:not(:disabled)::before {
    left: 100%;
}

.btn-primary:disabled { 
    background: var(--border);
    color: var(--text-dim);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-primary:active:not(:disabled) { 
    transform: scale(0.96);
}

.btn-primary:hover:not(:disabled) { 
    transform: translateY(-2px);
    box-shadow: 0 20px 50px var(--accent-glow);
}

/* ===== LOADING OVERLAY ===== */
#loading-overlay {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1.5px solid var(--border);
}

.loader-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s infinite linear;
    flex-shrink: 0;
}

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

#loader-msg {
    color: var(--text-dim);
    font-size: 1.05rem;
    font-weight: 600;
}

.progress-bar-wrap {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 1rem;
    border: 1px solid var(--border);
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-alt) 100%);
    box-shadow: 0 0 15px var(--accent);
    transition: width 0.15s linear;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
    animation: fadeIn 0.3s var(--ease);
    overflow-y: auto;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    width: 100%;
    max-width: 550px;
    border-radius: 2.5rem;
    padding: 2.5rem 2rem;
    position: relative;
    text-align: center;
    animation: modalIn 0.5s var(--ease);
    box-shadow: 0 50px 120px rgba(0, 0, 0, 0.8);
}

@keyframes modalIn {
    from {
        transform: scale(0.85) translateY(40px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: 1.2rem; right: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-dim);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    border-radius: 12px;
}

.close-btn:active {
    transform: scale(0.88);
}

.modal-header {
    margin-bottom: 1.5rem;
}

.badge {
    display: inline-block;
    background: var(--accent-glow);
    color: var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
}

.modal-title {
    font-family: var(--font-h);
    font-size: 2.2rem;
    margin-bottom: 1.2rem;
    font-weight: 950;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-alt) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.score-radial {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 1.8rem;
}

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

.radial-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.radial-fill {
    fill: none;
    stroke: url(#heartGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 2s var(--ease);
}

.score-content {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-h);
    font-weight: 950;
    display: flex;
    align-items: baseline;
    justify-content: center;
}

#score-num {
    font-size: 3.8rem;
    line-height: 1;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(255, 27, 107, 0.3);
}

.score-content small {
    font-size: 1.8rem;
    color: var(--accent);
    margin-left: 0.2rem;
}

.verdict-container {
    margin: 1.5rem 0;
}

.verdict-container h3 {
    font-family: var(--font-h);
    font-size: 1.6rem;
    margin-bottom: 0.8rem;
    font-weight: 900;
    color: var(--accent);
}

.verdict-container p {
    color: var(--text-dim);
    font-size: 1.05rem;
    line-height: 1.7;
    font-weight: 500;
}

.modal-footer {
    margin-top: 1.5rem;
}

.legal-footer {
    text-align: center;
    padding: 2rem 1rem;
    opacity: 0.3;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    margin-top: 1rem;
}

.hidden {
    display: none !important;
}

/* ===== DESKTOP - LARGE SCREENS (1200px+) ===== */
@media (min-width: 1200px) {
    .main-wrapper {
        max-width: 1400px;
        padding: 3.5rem 3rem;
    }

    .hero-section h1 {
        font-size: 4.5rem;
        margin-bottom: 1rem;
    }

    .subtitle {
        font-size: 1.3rem;
    }

    .app-card {
        padding: 3.5rem;
    }

    .upload-box {
        min-height: 350px;
    }

    .btn-primary {
        font-size: 1.35rem;
        padding: 1.4rem 2.5rem;
        min-height: 60px;
    }

    .modal-card {
        max-width: 600px;
        padding: 3.5rem 3rem;
    }

    .score-radial {
        width: 200px;
        height: 200px;
        margin: 0 auto 2.5rem;
    }

    #score-num {
        font-size: 5rem;
    }
}

/* ===== TABLET (768px - 1200px) ===== */
@media (min-width: 768px) and (max-width: 1199px) {
    .main-wrapper {
        max-width: 900px;
        padding: 2.5rem 1.5rem;
    }

    .hero-section h1 {
        font-size: 3rem;
        margin-bottom: 0.8rem;
    }

    .subtitle {
        font-size: 1.15rem;
    }

    .app-card {
        padding: 2.5rem;
    }

    .upload-grid {
        grid-template-columns: 1fr 100px 1fr;
        gap: 1.5rem;
    }

    .upload-box {
        min-height: 300px;
    }

    .nexus-graphic {
        width: 80px;
        height: 80px;
    }

    .btn-primary {
        font-size: 1.2rem;
        padding: 1.2rem 2rem;
        min-height: 56px;
    }

    .modal-card {
        max-width: 500px;
        padding: 2.5rem 2rem;
    }

    .modal-title {
        font-size: 2rem;
    }
}

/* ===== PHONE - NO SCROLL - VERTICAL LAYOUT (max-width: 767px) ===== */
@media (max-width: 767px) {
    .main-wrapper {
        padding: 1rem 0.8rem;
    }

    .hero-section {
        margin-bottom: 0.6rem;
    }

    .hero-section h1 {
        font-size: 1.8rem;
        line-height: 1.1;
        margin-bottom: 0.3rem;
    }

    .subtitle {
        font-size: 0.85rem;
        line-height: 1.5;
        max-width: 100%;
    }

    .app-card {
        padding: 0.8rem;
        border-radius: 1.5rem;
    }

    /* ===== PHONE UPLOAD GRID - VERTICAL STACK ===== */
    .upload-grid {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        margin-bottom: 0.8rem;
        align-items: stretch;
    }

    .upload-box {
        width: 100%;
        aspect-ratio: auto;
        border-radius: 1.3rem;
        padding: 0;
        min-height: auto;
    }

    /* YOUR PHOTO BOX */
    #zone-1 {
        order: 1;
        height: 240px;
    }

    /* HEART/CONNECTOR */
    .connector {
        order: 2;
        height: 30px;
        padding: 0.2rem 0;
        margin: 0.1rem 0;
    }

    .nexus-graphic {
        width: 40px;
        height: 40px;
    }

    .pulse-rings span:nth-child(1) { 
        width: 28px;
        height: 28px;
    }

    .pulse-rings span:nth-child(2) { 
        width: 28px;
        height: 28px;
    }

    /* GF/BF PHOTO BOX */
    #zone-2 {
        order: 3;
        height: 240px;
    }

    .box-content {
        padding: 0.8rem;
        gap: 0.3rem;
    }

    .upload-icon svg {
        width: 20px;
        height: 20px;
    }

    .empty-ui h3 {
        font-size: 0.75rem;
    }

    /* ===== BUTTONS ===== */
    .action-footer {
        margin-top: 0.6rem;
    }

    .btn-primary {
        padding: 0.85rem 1.2rem;
        font-size: 0.95rem;
        min-height: 46px;
        border-radius: 1rem;
    }

    /* ===== MODAL ===== */
    .modal-card {
        padding: 1.8rem 1.3rem;
        border-radius: 1.7rem;
        max-width: 95vw;
    }

    .modal-title {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .score-radial {
        width: 140px;
        height: 140px;
        margin: 0 auto 1.5rem;
    }

    #score-num {
        font-size: 3.2rem;
    }

    .score-content small {
        font-size: 1.5rem;
    }

    .verdict-container h3 {
        font-size: 1.4rem;
        margin-bottom: 0.6rem;
    }

    .verdict-container p {
        font-size: 1rem;
    }

    #loading-overlay {
        margin-top: 0.8rem;
        padding-top: 0.8rem;
    }

    .spinner {
        width: 28px;
        height: 28px;
    }

    #loader-msg {
        font-size: 0.95rem;
    }
}

/* ===== SMALL PHONES (max-width: 480px) ===== */
@media (max-width: 480px) {
    .glass-nav {
        padding: 0.8rem 0.8rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    .main-wrapper {
        padding: 0.8rem 0.6rem;
    }

    .hero-section h1 {
        font-size: 1.6rem;
        margin-bottom: 0.3rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .app-card {
        padding: 0.7rem;
    }

    #zone-1,
    #zone-2 {
        height: 220px;
    }

    .btn-primary {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .modal-card {
        padding: 1.5rem 1.2rem;
    }

    .modal-title {
        font-size: 1.6rem;
    }

    .score-radial {
        width: 120px;
        height: 120px;
        margin: 0 auto 1.2rem;
    }

    #score-num {
        font-size: 2.8rem;
    }
}

/* ===== VERY SMALL PHONES (<380px) ===== */
@media (max-width: 379px) {
    .hero-section h1 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    #zone-1,
    #zone-2 {
        height: 200px;
    }

    .btn-primary {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
        min-height: 42px;
    }

    .modal-title {
        font-size: 1.5rem;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== HIGH DPI / RETINA ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .glass-nav, .legal-footer {
        display: none;
    }
}
