/* style.css */
/* Core Color Palette */
:root {
    --primary: #E76F2E;
    --primary-dark: #D65A1F;
    --secondary: #1A1A1A;
    --background: #F5EFE6;
    --accent-purple: #B565A7;
    --accent-yellow: #F4B400;
    --muted: #4A4A4A;
    --border: #D9D9D9;
    --soft-tint: #FFE5D0;
    
    --border-thin: 1.5px solid var(--secondary);
    --border-radius: 12px;
    --border-radius-alt: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
/* Video Background */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.video-background video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Fallback image  */
.video-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Dark overlay to make text readable */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(245, 239, 230, 0.4);
}

.intro-section {
    text-align: center;
    width: 100%;
    max-width: 750px;
    margin: 0 auto;
    padding: 1rem;
    position: relative;
    transition: filter 0.2s ease;
    background: transparent;
}

.popup-overlay {
    z-index: 1000;
}

.loading-overlay {
    z-index: 2000;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', cursive, sans-serif;
    background-color: var(--background); /* fallback color */
    color: var(--secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
}

/* Intro Section */
.intro-section {
    text-align: center;
    width: 100%;
    max-width: 750px;
    margin: 0 auto;
    padding: 1rem;
    position: relative;
    transition: filter 0.2s ease;
}

body.popup-open .popup-overlay {
    background-color: rgba(26, 26, 26, 0.7); /* darker overlay */
    backdrop-filter: blur(4px);
}

.intro-heading {
    font-family: 'Gaegu', 'Patrick Hand', cursive;
    font-size: clamp(4rem, 15vw, 7rem);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 6px;
    text-shadow: 2px 2px 0 var(--accent-yellow);
    margin-bottom: 0.2rem;
    transform: rotate(-1deg);
    word-break: break-word;
}

.intro-subheading {
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    color: var(--muted);
    margin-bottom: 1.5rem;
    border-bottom: 1.5px dashed var(--border);
    display: inline-block;
    padding-bottom: 0.5rem;
    font-weight: 400;
    transform: rotate(0.5deg);
}

.image-container {
    margin: 2rem auto;
    overflow: hidden;
    border: var(--border-thin);
    width: 300px;
    height: 300px;
    background: var(--background);
    transition: transform 0.2s ease;
    clip-path: polygon(
        0% 2%, 2% 0%, 98% 1%, 100% 3%,
        99% 97%, 97% 100%, 3% 99%, 1% 96%
    );
}

.image-container:hover {
    transform: scale(1.02);
}

.image-container img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.register-button {
    background: var(--primary);
    border: var(--border-thin);
    color: var(--background);
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(1.5rem, 6vw, 2.2rem);
    padding: 0.8rem 2.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: bold;
    letter-spacing: 2px;
    margin-top: 0.5rem;
    transform: rotate(-1deg);
    clip-path: polygon(
        1% 0%, 99% 2%, 100% 98%, 97% 100%, 
        2% 99%, 0% 97%
    );
}

.register-button:hover {
    background: var(--primary-dark);
}

.register-button:active {
    transform: scale(0.98) rotate(-1deg);
}

/* Doodles */
.doodle {
    position: absolute;
    font-size: 2rem;
    color: var(--primary);
    opacity: 0.4;
    pointer-events: none;
    z-index: -1;
}

.doodle-1 { top: 8%; left: 3%; transform: rotate(15deg); }
.doodle-2 { bottom: 12%; right: 5%; transform: rotate(-20deg); color: var(--accent-purple); }
.doodle-3 { top: 25%; right: 8%; transform: rotate(45deg); color: var(--accent-yellow); }
.doodle-4 { top: 60%; left: 2%; transform: rotate(-10deg); font-size: 2.5rem; }
.doodle-5 { bottom: 25%; left: 8%; transform: rotate(30deg); color: var(--accent-purple); font-size: 1.8rem; }
.doodle-6 { top: 45%; right: 3%; transform: rotate(-35deg); font-size: 1.5rem; }

/* Popup Overlay */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 26, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    padding: 1rem;
}

body.popup-open .popup-overlay {
    visibility: visible;
    opacity: 1;
}

.registration-container {
    background: var(--background);
    border: var(--border-thin);
    max-width: 480px;
    width: 480px;
    height: 600px;
    padding: 2rem 1.5rem;
    position: relative;
    font-family: 'Patrick Hand', cursive;
    transform: rotate(-0.5deg);
    overflow-y: auto;
    clip-path: polygon(
        0% 1%, 2% 0%, 98% 0%, 100% 2%,
        100% 98%, 98% 100%, 2% 100%, 0% 98%
    );
}

.close-popup {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    color: var(--secondary);
    border: none;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-popup:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

/* Step Screens */
.step-screen, .success-screen {
    display: block;
}

.step-screen.hidden, .success-screen.hidden {
    display: none;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1.5px dotted var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.8rem;
}

.step-header h2 {
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    color: var(--primary);
    text-transform: lowercase;
    font-weight: 700;
}

.step-number {
    background: var(--accent-yellow);
    padding: 0.2rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--secondary);
    clip-path: polygon(
        3% 0%, 97% 2%, 100% 95%, 96% 100%, 
        4% 98%, 0% 94%
    );
}

/* Form Elements */
.form-group {
    margin-bottom: 1.8rem;
}

label {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    color: var(--muted);
}

.form-input, .task-input {
    width: 100%;
    padding: 0.8rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    background: white;
    border: var(--border-thin);
    outline: none;
    transition: border-color 0.15s;
    clip-path: polygon(
        0% 3%, 2% 0%, 98% 1%, 100% 4%,
        99% 97%, 96% 100%, 3% 98%, 1% 95%
    );
}

.form-input:focus, .task-input:focus {
    border-color: var(--primary);
}

.input-note {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 5px;
}

.error-message {
    color: #d63e3e;
    min-height: 1.5rem;
    font-size: 0.9rem;
    margin-top: 4px;
    padding-left: 0.5rem;
}

/* Tasks */
.tasks-intro {
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
}

.task-list {
    margin: 1.5rem 0;
}

.task {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.8rem;
    align-items: flex-start;
}

.task-icon {
    background: var(--accent-yellow);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: var(--border-thin);
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--secondary);
    flex-shrink: 0;
    clip-path: polygon(
        5% 0%, 95% 3%, 100% 92%, 94% 100%, 
        6% 97%, 0% 91%
    );
}

.task-content {
    flex: 1;
}

.task-content h4 {
    font-size: 1.2rem;
    margin-bottom: 0.6rem;
}

.task-input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.task-input {
    flex: 1;
    min-width: 180px;
}

.task-btn {
    background: var(--primary);
    color: var(--background);
    padding: 0.5rem 1rem;
    text-decoration: none;
    border: var(--border-thin);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    clip-path: polygon(
        2% 0%, 98% 2%, 100% 96%, 97% 100%, 
        3% 98%, 0% 95%
    );
}

.task-btn:hover {
    background: var(--accent-purple);
    color: var(--background);
}

/* Buttons */
.step-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: space-between;
}

.btn {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.3rem;
    padding: 0.6rem 1.4rem;
    border: var(--border-thin);
    background: var(--background);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: bold;
    flex: 1;
    text-align: center;
    clip-path: polygon(
        1% 2%, 99% 0%, 100% 97%, 98% 100%, 
        2% 99%, 0% 96%
    );
}

.primary-btn {
    background: var(--primary);
    color: var(--background);
}

.primary-btn:hover {
    background: var(--primary-dark);
}

.secondary-btn {
    background: var(--accent-purple);
    color: var(--background);
}

.secondary-btn:hover {
    background: #9a4f8e;
}

.btn:active {
    transform: scale(0.98);
}

/* Success Screen */
.success-screen {
    text-align: center;
}

.success-header {
    margin-bottom: 2rem;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border: var(--border-thin);
    overflow: hidden;
    background: var(--accent-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(
        0% 4%, 3% 0%, 97% 1%, 100% 5%,
        99% 96%, 95% 100%, 4% 98%, 1% 94%
    );
}

.success-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.success-header h2 {
    font-size: 1.8rem;
    color: var(--primary);
}

.referral-section {
    background: var(--soft-tint);
    border: 1.5px dashed var(--primary);
    padding: 1.5rem;
    margin: 2rem 0;
    clip-path: polygon(
        0% 1%, 1% 0%, 99% 1%, 100% 3%,
        99% 98%, 97% 100%, 2% 99%, 1% 97%
    );
}

.referral-goal {
    margin-bottom: 1.2rem;
}

.goal-badge {
    background: var(--accent-purple);
    color: var(--background);
    padding: 0.3rem 1.2rem;
    display: inline-block;
    font-size: 1rem;
    margin: 2rem;
    border: var(--border-thin);
    clip-path: polygon(
        2% 0%, 98% 2%, 100% 95%, 96% 100%, 
        3% 98%, 0% 94%
    );
}

.referral-section h3 {
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
}

.invite-link {
    background: white;
    padding: 0.8rem;
    border: var(--border-thin);
    word-break: break-all;
    font-family: monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
    clip-path: polygon(
        0% 3%, 2% 0%, 98% 1%, 100% 4%,
        99% 96%, 96% 100%, 3% 98%, 1% 95%
    );
}

.invite-link:hover {
    background: var(--primary);
    color: white;
}

.referral-note {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.success-actions {
    margin-top: 1.5rem;
}

/* Loading Overlay - simple one-color spinner */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(245, 239, 230, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
    background: white;
    border: var(--border-thin);
    padding: 2.5rem;
    clip-path: polygon(
        0% 2%, 2% 0%, 98% 1%, 100% 3%,
        99% 97%, 97% 100%, 2% 99%, 1% 96%
    );
}

.spinner {
    width: 50px;
    height: 50px;
    border: 2px solid transparent;
    border-top: 2.5px solid var(--primary);
    border-right: 2.5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-content p {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.3rem;
    color: var(--muted);
    margin-top: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Scrollbar */
.registration-container::-webkit-scrollbar {
    width: 6px;
}

.registration-container::-webkit-scrollbar-thumb {
    background: var(--primary);
}

/* Responsive */
@media (max-width: 600px) {
    body { padding: 1rem; }
    
    .registration-container {
        width: 100%;
        max-width: 480px;
        height: 550px;
        padding: 1.5rem 1rem;
    }
    
    .image-container {
        width: 250px;
        height: 250px;
    }
    
    .step-header h2 {
        font-size: 1.8rem;
    }
    
    .task-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .task-btn {
        justify-content: center;
    }
    
    .step-actions {
        flex-direction: column;
    }
    
    .btn {
        font-size: 1.2rem;
        padding: 0.8rem;
    }
    
    .doodle-4, .doodle-5 {
        display: none;
    }
}

@media (max-width: 400px) {
    .intro-heading {
        font-size: 3.5rem;
    }
    
    .image-container {
        width: 220px;
        height: 220px;
    }
    
    .step-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .doodle-6 {
        display: none;
    }
}
}
/* copy function */
.copy-btn {
    background: var(--primary);
    border: var(--border-thin);
    color: var(--background);
    font-family: 'Patrick Hand', cursive;
    font-size: 1rem;
    padding: 0 1rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.copy-btn:hover {
    background: var(--primary-dark);
}

.copy-btn:active {
    transform: scale(0.95);
}
/* Content Wrapper - gets blurred when popup opens */
.content-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transform: scale(0.5);
    transform-origin: center center;
    transition: filter 0.2s ease;
}

/* Blur ONLY the content wrapper when popup is open */
body.popup-open .content-wrapper {
    filter: blur(4px);
    pointer-events: none;
}

/* Popup overlay - independent from wrapper, NEVER blurred */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 26, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    padding: 1rem;
}

/* Make sure popup itself is never blurred */
body.popup-open .popup-overlay {
    visibility: visible;
    opacity: 1;
    filter: none !important;
}

/* Registration container - scale to match content wrapper on mobile */
.registration-container {
    background: var(--background);
    border: 3px solid var(--secondary);
    border-radius: 8px 28px 8px 24px;
    max-width: 480px;
    width: 480px;
    height: 600px;
    padding: 2rem 1.5rem;
    position: relative;
    font-family: 'Patrick Hand', 'Comic Sans MS', cursive;
    transform: rotate(-0.5deg);
    overflow-y: auto;
    box-shadow: 5px 6px 0 rgba(26, 26, 26, 0.15);
}

/* Scale popup container on mobile to match content */
@media (max-width: 768px) {
    .registration-container {
        transform: scale(0.5) rotate(-0.5deg);
    }
}
