@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* === 1‑BIT PIXEL PALETTE === */
:root {
    --paper: #ececec;      /* light gray / white from image */
    --ink: #272727;         /* almost black from outlines/hair */
    --paper-transparent: rgba(236, 236, 236, 0.9); /* semi-transparent paper for readability */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    color: var(--ink);
    font-family: 'Courier New', Courier, 'Space Grotesk', monospace;
    font-weight: 500;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    letter-spacing: -0.02em;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    position: relative;
}

/* === BACKGROUND VIDEO - FULLSCREEN === */
.bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;  /* This makes it cover the entire screen */
    object-position: center;
    z-index: 0;
    pointer-events: none;  /* So clicks pass through to buttons */
    image-rendering: crisp-edges;  /* Keep pixel art sharp */
    image-rendering: pixelated;
    background-color: var(--paper); /* Fallback while video loads */
}

/* === HOME CONTENT (above video) === */
.content-wrap {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
    padding: 1rem;
    pointer-events: none; /* allow clicks to pass through to bg, but children re-enable */
}

.content-wrap * {
    pointer-events: auto;
}

.bottom-group {
    margin-top: auto;
    margin-bottom: 2rem;
    width: fit-content;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    background: var(--paper-transparent); /* Semi-transparent so video shows through */
    padding: 1.5rem;
    border: 4px solid var(--ink);
    box-shadow: 8px 8px 0 var(--ink);
    backdrop-filter: none; /* Keep pixel aesthetic */
}

.bottom-group h2 {
    font-size: clamp(1.8rem, 7vw, 3.2rem);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ink);
    background: transparent; /* Let the parent background show through */
    padding: 0.2rem 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.apply_button {
    background: var(--ink);
    border: 4px solid var(--ink);
    color: var(--paper);
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-size: clamp(1.5rem, 6vw, 2.2rem);
    padding: 0.75rem 2rem;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 6px 6px 0 var(--paper-transparent), 6px 6px 0 4px var(--ink);
    transition: all 0.1s ease;
    letter-spacing: 1px;
    width: fit-content;
}

.apply_button:active {
    transform: translate(4px, 4px);
    box-shadow: 2px 2px 0 var(--paper-transparent), 2px 2px 0 4px var(--ink);
}

.apply_button:hover {
    background: var(--paper);
    color: var(--ink);
    box-shadow: 8px 8px 0 var(--ink);
}

/* === POPUP (overlay) - Keep solid background for readability === */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(39,39,39,0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.popup.hidden {
    display: none;
}

.container {
    background: var(--paper); /* Solid paper for popup content */
    border: 6px solid var(--ink);
    box-shadow: 12px 12px 0 var(--ink);
    max-width: 580px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    position: relative;
}

/* Rest of your CSS remains exactly the same from here... */
/* (keep all your existing CSS from the previous version after this point) */

@media (max-width: 480px) {
    .container {
        padding: 1.5rem 1rem;
        max-height: 90vh;
    }
}

.container::-webkit-scrollbar {
    width: 8px;
    background: var(--paper);
}
.container::-webkit-scrollbar-thumb {
    background: var(--ink);
    border: 2px solid var(--paper);
}

.close_popup {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--paper);
    border: 4px solid var(--ink);
    color: var(--ink);
    width: 44px;
    height: 44px;
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--ink);
    transition: 0.1s;
    line-height: 1;
}

.close_popup:active {
    transform: translate(4px, 4px);
    box-shadow: none;
}

/* Step screens */
.step-screen, .success-screen {
    border: none;
    background: transparent;
}

.step-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--ink);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    gap: 0.5rem;
}

.step-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    text-transform: uppercase;
    word-break: break-word;
}

@media (max-width: 480px) {
    .step-header h2 {
        font-size: 1.4rem;
    }
}

.step-number {
    font-size: 1rem;
    border: 3px solid var(--ink);
    padding: 0.25rem 0.75rem;
    background: var(--paper);
    box-shadow: 4px 4px 0 var(--ink);
    white-space: nowrap;
}

/* Form elements */
.form-group {
    margin: 1.5rem 0;
}

label {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    border-left: 6px solid var(--ink);
    padding-left: 0.75rem;
}

.form-input, .task-input {
    width: 100%;
    padding: 1rem;
    background: var(--paper);
    border: 4px solid var(--ink);
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink);
    box-shadow: 6px 6px 0 var(--ink);
    outline: none;
    -webkit-appearance: none;
    border-radius: 0;
}

.form-input:focus, .task-input:focus {
    background: #ffffff;
    box-shadow: 8px 8px 0 var(--ink);
}

.error-message {
    color: var(--ink);
    font-weight: 700;
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    border: 2px solid var(--ink);
    background: var(--paper);
    display: none;
    text-transform: uppercase;
    font-size: 0.8rem;
}

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

.task {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--ink);
}

.task:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.task-icon {
    width: 40px;
    height: 40px;
    background: var(--paper);
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--ink);
    box-shadow: 4px 4px 0 var(--ink);
    flex-shrink: 0;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-text {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

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

.task-input {
    flex: 1 1 180px;
    padding: 0.8rem;
    font-size: 0.9rem;
}

.task-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--ink);
    color: var(--paper);
    border: 4px solid var(--ink);
    padding: 0.7rem 1.2rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 4px 4px 0 var(--paper), 4px 4px 0 4px var(--ink);
    font-size: 0.9rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.task-btn i {
    filter: invert(1);
}

.task-btn:hover {
    background: var(--paper);
    color: var(--ink);
}

.task-btn:hover i {
    filter: invert(0);
}

@media (max-width: 500px) {
    .task {
        flex-direction: column;
        gap: 0.5rem;
    }
    .task-icon {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }
    .task-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    .task-btn {
        justify-content: center;
        white-space: normal;
    }
}

/* Step actions */
.step-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.btn {
    border: 4px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    font-weight: 700;
    font-size: 1.2rem;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    box-shadow: 6px 6px 0 var(--ink);
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    flex: 1 1 auto;
    text-align: center;
    -webkit-appearance: none;
    border-radius: 0;
}

.primary-btn {
    background: var(--ink);
    color: var(--paper);
    box-shadow: 6px 6px 0 var(--paper), 6px 6px 0 4px var(--ink);
}

.primary-btn:active, .secondary-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 2px 2px 0 var(--ink);
}

.secondary-btn {
    background: var(--paper);
    color: var(--ink);
}

/* Success screen */
.success-icon {
    width: 80px;
    height: 80px;
    border: 5px solid var(--ink);
    box-shadow: 8px 8px 0 var(--ink);
    margin: 1rem auto;
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
    filter: grayscale(100%) contrast(200%);
}

.invite-link {
    background: var(--paper);
    border: 4px solid var(--ink);
    padding: 1rem;
    font-family: monospace;
    word-break: break-all;
    box-shadow: 6px 6px 0 var(--ink);
    margin: 1.5rem 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.invite-link:hover {
    background: var(--ink);
    color: var(--paper);
}

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

/* Social links inside popup */
.social_links {
    margin-top: 1.5rem;
    text-align: center;
}

.social_links a {
    color: var(--ink);
    font-size: 1.8rem;
    border: 4px solid var(--ink);
    padding: 0.5rem 1.2rem;
    display: inline-block;
    box-shadow: 6px 6px 0 var(--ink);
    background: var(--paper);
    transition: 0.1s;
}

.social_links a:active {
    transform: translate(4px, 4px);
    box-shadow: 2px 2px 0 var(--ink);
}

/* Loading overlay */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--paper);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading.hidden {
    display: none;
}

.loading-content {
    border: 8px solid var(--ink);
    padding: 2rem;
    background: var(--paper);
    box-shadow: 18px 18px 0 var(--ink);
    text-align: center;
    max-width: 80vw;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 6px solid var(--ink);
    border-top: 6px solid var(--paper);
    animation: spin 1s infinite steps(8);
    margin: 0 auto 1rem;
}

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

/* Utility */
.hidden {
    display: none !important;
}

/* mobile base fixes */
@media (max-width: 480px) {
    .bottom-group {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    .btn {
        font-size: 1rem;
        padding: 0.7rem 1rem;
    }
    .step-actions {
        gap: 0.7rem;
    }
    .close_popup {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
}

/* ensure no overflow */
body, html {
    overflow-x: hidden;
    width: 100%;
}