:root {
    /* --- Vibrant Gen-Z Love Palette --- */
    --primary: #ff0055;
    --secondary: #7000ff;
    --accent: #ffd166;

    --bg-dark: #0f0c29;
    --mesh-1: #302b63;
    --mesh-2: #24243e;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.12);

    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --text-dim: rgba(255, 255, 255, 0.4);

    --glow-pink: rgba(255, 0, 85, 0.4);
    --glow-purple: rgba(112, 0, 255, 0.4);
    --radius-lg: 32px;
    --radius-md: 20px;
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* Background Animation */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(at 0% 0%, hsla(339, 100%, 50%, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 100%, hsla(266, 100%, 50%, 0.15) 0, transparent 50%),
        radial-gradient(at 50% 50%, var(--mesh-1) 0%, transparent 80%);
    z-index: -1;
    opacity: 0.5;
}

.particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    bottom: -10vh;
    background: white;
    border-radius: 50%;
    filter: blur(1px);
    animation: floatUp infinite linear;
    opacity: 0.15;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }

    20% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-120vh) scale(1.5);
        opacity: 0;
    }
}

.gradient-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

/* --- Core Layout --- */
.scene {
    width: 100%;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 10;
    overflow-x: hidden;
}

.hero-section {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem clamp(1rem, 4vw, 2rem);
    gap: 4rem;
    max-width: 1400px;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .hero-section {
        flex-direction: column;
        padding-top: 6rem;
        gap: 3rem;
    }
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 5px;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(3.5rem, 8vw, 6rem);
    line-height: 0.95;
    font-weight: 800;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* --- Input Section --- */
.input-section {
    flex: 1;
    max-width: 460px;
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: clamp(2rem, 5vw, 3rem);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    box-sizing: border-box;
}

.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}

.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    color: #fff;
    font-size: 1.1rem;
    transition: 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px var(--glow-pink);
}

.cta-button {
    width: 100%;
    padding: 1.25rem;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.4s;
    position: relative;
    overflow: hidden;
}

.cta-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px var(--glow-pink);
}

.btn-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: 0.6s ease;
}

.cta-button:hover .btn-glow {
    transform: translateX(100%);
}

.hero-perks {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.perk {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* --- Content Wrapper & Info Sections --- */
.content-wrapper {
    width: 100%;
    max-width: 1200px;
    padding: clamp(4rem, 10vw, 10rem) clamp(1rem, 3vw, 2rem);
    display: flex;
    flex-direction: column;
    gap: clamp(4rem, 8vw, 12rem);
    margin: 0 auto;
    box-sizing: border-box;
}

.section-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    text-align: center;
    margin-bottom: 5rem;
    background: linear-gradient(to bottom, #fff 20%, rgba(255, 255, 255, 0.4) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
}

.text-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 5rem 3rem;
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.02);
}

.flames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.vibe-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: var(--radius-md);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.vibe-item::before {
    content: attr(data-letter);
    position: absolute;
    top: -20px;
    right: -10px;
    font-size: 10rem;
    font-weight: 900;
    color: #fff;
    opacity: 0.03;
    pointer-events: none;
}


.vibe-item:hover {
    transform: translateY(-12px) scale(1.02);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.vibe-header {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 1.2rem;
    letter-spacing: -0.5px;
}

.vibe-header span {
    color: var(--primary);
}

.vibe-item p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* --- Math Section Upgrade --- */
.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
}

.step-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 3.5rem 2.5rem;
    border-radius: var(--radius-md);
    position: relative;
    transition: 0.3s;
}

.step-card:hover {
    border-color: var(--secondary);
    background: rgba(255, 255, 255, 0.05);
}

.step-num {
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--primary);
    opacity: 0.1;
    position: absolute;
    top: 1rem;
    right: 2rem;
    line-height: 1;
}

.step-card h4 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #fff;
    letter-spacing: -0.5px;
}

.step-card p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 1rem;
}

/* --- Result Scene Enhanced --- */
#result-scene {
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem);
    position: relative;
    z-index: 10;
    box-sizing: border-box;
    overflow-x: hidden;
}

.stage-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

.names-display {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-bottom: 4rem;
    box-sizing: border-box;
    padding: 0 1rem;
}

.name-row {
    display: flex;
    flex-direction: row;
    /* FORCE HORIZONTAL (Image 2 Fix) */
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.char-box {
    width: clamp(40px, 8vw, 60px);
    height: clamp(55px, 10vw, 80px);
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.25rem, 4vw, 2.25rem);
    font-weight: 800;
    color: #333;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(30px) rotate(-10deg);
    transition: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.char-box.reveal {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

.char-box.match {
    background: var(--primary);
    color: #fff;
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 0 30px var(--glow-pink);
    z-index: 2;
}

.char-box.removed {
    transform: scale(0) translateY(50px) rotate(45deg);
    opacity: 0;
}

.status-message {
    font-size: clamp(0.9rem, 2.5vw, 1.25rem);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: clamp(2px, 1vw, 4px);
    margin: 1rem 0;
    text-align: center;
    word-wrap: break-word;
    padding: 0 1rem;
}

.glass-orb {
    width: clamp(250px, 60vw, 300px);
    height: clamp(250px, 60vw, 300px);
    max-width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 60px var(--glow-pink);
    clip-path: path('M150,280 L42,172 Q10,140 16,108 Q21,64 64,48 Q107,32 150,75 Q193,32 236,48 Q279,64 284,108 Q290,140 258,172 Z');
    animation: heartbeat 1.2s infinite;
    box-sizing: border-box;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

#match-count {
    font-size: clamp(3rem, 12vw, 6rem);
    font-weight: 900;
    color: #fff;
}

.flames-letters {
    display: flex;
    gap: 1.5rem;
    margin: 4rem 0;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.f-char {
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 900;
    color: rgba(255, 255, 255, 0.1);
    transition: 0.4s;
}

.f-char.active {
    color: var(--primary);
    transform: scale(1.6) translateY(-20px);
    opacity: 1;
    text-shadow: 0 0 40px var(--glow-pink);
}

.f-char.eliminated {
    text-decoration: line-through;
    opacity: 0.05;
    transform: scale(0.8);
}

.result-card-premium {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(45px) saturate(160%);
    -webkit-backdrop-filter: blur(45px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: clamp(2rem, 6vw, 6rem) clamp(1.5rem, 4vw, 4rem);
    border-radius: clamp(24px, 6vw, 48px);
    text-align: center;
    width: 100%;
    max-width: 850px;
    box-sizing: border-box;
    box-shadow:
        0 60px 120px -30px rgba(0, 0, 0, 0.6),
        inset 0 0 50px rgba(255, 255, 255, 0.03);
    animation: cardPop 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.result-card-premium::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 0, 85, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

@keyframes cardPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(40px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#result-title {
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 900;
    line-height: 0.9;
    background: linear-gradient(135deg, #ff0055 0%, #7000ff 50%, #ff0055 100%);
    background-size: 200% auto;
    animation: gradientFlow 5s linear infinite;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    letter-spacing: clamp(-2px, -0.5vw, -6px);
    filter: drop-shadow(0 15px 40px rgba(255, 0, 85, 0.3));
    text-transform: uppercase;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

@keyframes gradientFlow {
    to {
        background-position: 200% center;
    }
}

.compatibility-label {
    font-size: clamp(0.75rem, 2vw, 1rem);
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: clamp(2px, 1vw, 4px);
    margin-top: 2rem;
    word-wrap: break-word;
}

.compatibility-container {
    height: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 100px;
    margin: 1.5rem 0 0.5rem;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0055, #7000ff, #ff0055);
    background-size: 200% 100%;
    animation: gradientFlow 3s linear infinite;
    width: 0;
    transition: width 2.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 20px var(--primary);
    border-radius: 100px;
}

#meter-text {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    text-transform: uppercase;
    letter-spacing: 2px;
    word-wrap: break-word;
}

.result-desc {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: var(--text-muted);
    margin: 2rem 0 3.5rem;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

/* Names Display in Result */
.names-display-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    margin-bottom: 2rem;
    padding: clamp(1rem, 3vw, 1.5rem) clamp(1rem, 3vw, 2rem);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.result-name {
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--text-main);
    text-transform: capitalize;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ff0055 0%, #7000ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    display: inline-block;
}

.result-heart {
    font-size: clamp(1.5rem, 4vw, 2rem);
    animation: heartbeat 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 0, 85, 0.5));
}

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

.match-info {
    margin: 2rem 0;
    padding: 1rem clamp(1rem, 3vw, 2rem);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 3rem;
    align-items: center;
}

.share-btn {
    min-width: 280px;
    font-size: 1.1rem !important;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.share-btn:hover {
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.4);
}

.share-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.restart-btn {
    min-width: 280px;
    font-size: 1.1rem !important;
}

.main-footer {
    padding: 6rem 2rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.footer-bottom {
    margin-top: 4rem;
    color: var(--text-dim);
}

.hidden {
    display: none !important;
}

/* Shutter */
.reveal-shutter {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.shutter-top,
.shutter-bottom {
    flex: 1;
    background: #0a0a0c;
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.shutter-top {
    transform: translateY(-100%);
}

.shutter-bottom {
    transform: translateY(100%);
}

.shutter-active .shutter-top {
    transform: translateY(0);
}

.shutter-active .shutter-bottom {
    transform: translateY(0);
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .name-row {
        gap: 0.25rem;
        flex-wrap: wrap;
        max-width: 100%;
    }

    .char-box {
        width: 35px;
        height: 50px;
        flex-shrink: 0;
    }

    .names-display-result {
        flex-direction: row;
        gap: 0.75rem;
        padding: 1rem;
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
    }

    .result-name {
        font-size: 1.2rem;
        max-width: 45%;
        text-align: center;
    }

    .result-heart {
        font-size: 1.2rem;
        flex-shrink: 0;
    }

    .result-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .share-btn,
    .restart-btn {
        width: 100%;
        min-width: auto;
        max-width: 100%;
    }

    .result-card-premium {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
        width: calc(100% - 2rem);
        max-width: calc(100% - 2rem);
    }

    #result-title {
        font-size: 2.5rem;
        letter-spacing: -1px;
        line-height: 1;
    }

    .result-desc {
        font-size: 1rem;
        padding: 0;
    }

    .compatibility-label {
        font-size: 0.75rem;
        letter-spacing: 2px;
    }

    #meter-text {
        font-size: 0.9rem;
    }

    .match-info {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .hero-perks {
        flex-direction: column;
    }

    .hero-section {
        padding: 2rem 1rem;
        gap: 2rem;
    }

    .content-wrapper {
        padding: 4rem 1rem;
        gap: 4rem;
    }

    .text-card {
        padding: 2rem 1.5rem;
    }

    .flames-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .steps-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .glass-orb {
        width: 250px;
        height: 250px;
    }

    #match-count {
        font-size: 4rem;
    }

    .flames-letters {
        gap: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .f-char {
        font-size: 2.5rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 3rem;
    }
}

@media (max-width: 480px) {
    .result-card-premium {
        padding: 1.5rem 1rem;
        border-radius: 24px;
    }

    #result-title {
        font-size: 2rem;
    }

    .result-name {
        font-size: 1rem;
    }

    .names-display-result {
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .result-heart {
        font-size: 1rem;
    }
}