:root {
    /* Color Palette - Pastel Warm/Neutral */
    --bg-color: #FEF9F6;
    /* Exact match for image background */
    --text-primary: #4a4a4a;
    --text-secondary: #7a7a7a;
    --primary-color: #E05297;
    --primary-hover: #C73E80;
    --secondary-color: #FFFFFF;
    --secondary-hover: #f0f0f0;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-card: 0 15px 35px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* BSOD Specific Styles */
body.bsod-active {
    background: #0078d7 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 8vh 8vw !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 100vh !important;
    height: auto !important;
}

body.bsod-active #app {
    width: 100% !important;
    max-width: 700px !important;
    min-height: auto !important;
    height: auto !important;
    padding: 0 !important;
    display: block !important;
}

body.bsod-active .card-container {
    min-height: auto !important;
    height: auto !important;
    display: block !important;
    text-align: left !important;
}

body.bsod-active h1 {
    font-size: clamp(6rem, 20vw, 10rem) !important;
    font-weight: 300 !important;
    margin: 0 0 20px 0 !important;
    color: white !important;
    text-shadow: none !important;
    line-height: 1 !important;
    text-align: left !important;
    padding: 0 !important;
}

body.bsod-active .response-text {
    display: block !important;
    color: white !important;
    font-size: 1.3rem !important;
    font-weight: 400 !important;
    text-align: left !important;
    text-shadow: none !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 0 40px 0 !important;
    line-height: 1.6 !important;
}

body.bsod-active .button-group {
    justify-content: flex-start !important;
    gap: 15px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-wrap: wrap !important;
}

/* Custom BSOD Buttons */
body.bsod-active .btn {
    border: 2px solid white !important;
    box-shadow: none !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    padding: 12px 30px !important;
    min-width: auto !important;
    max-width: none !important;
    flex: none !important;
    animation: none !important;
}

/* Primary BSOD Button (White) */
body.bsod-active .btn-primary {
    background-color: white !important;
    background: white !important;
    color: #0078d7 !important;
}

/* Secondary BSOD Button (Blue/Transparent) */
body.bsod-active .btn-secondary {
    background-color: transparent !important;
    color: white !important;
}

body.bsod-active .btn:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}

body.bsod-active .image-wrapper {
    display: none !important;
}

/* ============================================
   FINAL BIRTHDAY SCREEN - Harry Potter Theme
   ============================================ */
body.final-active {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
    padding: 0 !important;
    overflow: hidden !important;
}

body.final-active #app {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
}

body.final-active .card-container {
    min-height: 100vh !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    align-content: center !important;
    text-align: center !important;
    padding: 40px 24px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    gap: 24px !important;
}

body.final-active h1 {
    width: 100% !important;
    font-size: clamp(2.2rem, 6vw, 3.5rem) !important;
    font-weight: 700 !important;
    margin: 0 !important;
    color: #ffd700 !important;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.3) !important;
    line-height: 1.2 !important;
    text-align: center !important;
    padding: 0 !important;
    animation: magicGlow 2s ease-in-out infinite alternate !important;
}

@keyframes magicGlow {
    from {
        text-shadow: 0 0 30px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.3);
    }
    to {
        text-shadow: 0 0 40px rgba(255, 215, 0, 0.7), 0 0 80px rgba(255, 215, 0, 0.5), 0 0 100px rgba(255, 215, 0, 0.3);
    }
}

body.final-active .response-text {
    display: block !important;
    color: #e0e0e0 !important;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem) !important;
    font-weight: 400 !important;
    text-align: left !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    max-width: 500px !important;
    padding: 24px 28px !important;
    margin: 0 !important;
    line-height: 1.75 !important;
    font-style: italic !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 16px !important;
    border-left: 3px solid rgba(255, 215, 0, 0.4) !important;
    flex: 1 !important;
    min-width: 300px !important;
}

body.final-active .image-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex: 1 !important;
    min-width: 300px !important;
    max-width: 500px !important;
    margin: 0 !important;
    min-height: auto !important;
    order: 2 !important;
}

body.final-active img {
    max-width: 100% !important;
    max-height: 70vh !important;
    width: auto !important;
    height: auto !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 215, 0, 0.2) !important;
    animation: floatImage 3s ease-in-out infinite !important;
}

@keyframes floatImage {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

body.final-active .button-group {
    display: none !important;
}

/* Mobile responsive for Final Screen */
@media (max-width: 900px) {
    body.final-active .card-container {
        flex-direction: column !important;
        padding: 24px 16px !important;
        gap: 20px !important;
        overflow-y: auto !important;
    }

    body.final-active .response-text {
        max-width: 100% !important;
        min-width: auto !important;
        text-align: left !important;
        padding: 20px !important;
        font-size: clamp(0.9rem, 3.5vw, 1rem) !important;
    }

    body.final-active .image-wrapper {
        max-width: 100% !important;
        min-width: auto !important;
    }

    body.final-active img {
        max-height: 40vh !important;
        border-radius: 16px !important;
    }
}

@media (max-width: 600px) {
    body.final-active {
        padding: 0 !important;
        overflow-y: auto !important;
    }

    body.final-active .card-container {
        min-height: auto !important;
        padding: 20px 12px 30px 12px !important;
        gap: 16px !important;
    }

    body.final-active h1 {
        font-size: clamp(1.8rem, 8vw, 2.4rem) !important;
    }

    body.final-active .response-text {
        font-size: 0.9rem !important;
        padding: 16px !important;
        line-height: 1.7 !important;
    }

    body.final-active img {
        max-height: 35vh !important;
    }
}

/* Very small screens for Final */
@media (max-width: 360px) {
    body.final-active h1 {
        font-size: 1.6rem !important;
    }

    body.final-active .response-text {
        font-size: 0.85rem !important;
        padding: 14px !important;
    }

    body.final-active img {
        max-height: 30vh !important;
    }
}

/* Mobile responsive for BSOD */
@media (max-width: 600px) {
    body.bsod-active {
        padding: 6vh 6vw !important;
    }

    body.bsod-active .card-container {
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }

    body.bsod-active h1 {
        font-size: clamp(4rem, 18vw, 6rem) !important;
        margin-bottom: 15px !important;
    }

    body.bsod-active .response-text {
        font-size: 1rem !important;
        margin-bottom: 30px !important;
    }

    body.bsod-active .btn {
        padding: 10px 24px !important;
        font-size: 0.95rem !important;
    }
}



body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    /* Flat color to match images */
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--text-primary);
}

#app {
    width: 100%;
    max-width: 800px;
    padding: 0 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

.card-container {
    background: transparent;
    box-shadow: none;
    padding: 0;
    text-align: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.6s forwards;
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Heading Area - Fixed at top portion */
h1 {
    font-weight: 700;
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    line-height: 1.4;
    color: var(--text-primary);
    z-index: 2;

    /* Position control */
    margin-top: 10vh;
    margin-bottom: 16px;
    padding: 0 8px;

    /* Subtle Glow */
    text-shadow: 0 0 20px rgba(224, 82, 151, 0.25), 0 0 10px rgba(255, 255, 255, 0.8);
}

.response-text {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 600;
    color: #E05297;
    z-index: 2;
    padding: 0 8px;
    /* Glow */
    text-shadow: 0 0 15px rgba(224, 82, 151, 0.2);
}

/* Reordering Elements - order handled in main .button-group */

.image-wrapper {
    order: 2;
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 0;
    margin-bottom: 0;
    min-height: 200px;
    flex: 1;
    overflow: visible;
}

img {
    max-width: 100%;
    height: auto;
    width: auto;
    display: block;
    margin-bottom: 0;
    object-fit: contain;
}

.hidden {
    display: none !important;
}

img.hidden {
    display: none;
}

#video-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#video-wrapper.hidden {
    display: none;
}

/* Video Placeholder Style */
.video-placeholder {
    width: 100%;
    max-width: 400px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-md);
    font-size: clamp(1rem, 4vw, 1.2rem);
    gap: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.video-placeholder p {
    margin: 0;
    text-align: center;
}

.video-placeholder .btn {
    min-width: 140px;
}

.button-group {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
    order: 1;
    margin: 16px 0;
    z-index: 10;
    position: relative;
    flex-wrap: wrap;
    padding: 0 8px;
}

/* Button Styling - Rose & White */
.btn {
    border: 2px solid transparent;
    padding: 14px 28px;
    border-radius: 50px;
    font-family: inherit;
    font-weight: 700;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    max-width: 180px;
    min-width: 120px;
    min-height: 48px; /* Touch-friendly size */
    outline: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, #E05297 0%, #d14388 100%);
    color: white;
    border-color: #E05297;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #C73E80 0%, #b83575 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(224, 82, 151, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 10px rgba(224, 82, 151, 0.3);
}

.btn-secondary {
    background-color: #FFFFFF;
    color: #E05297;
    border-color: rgba(224, 82, 151, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover {
    background-color: #fff5f9;
    transform: translateY(-3px);
    color: #C73E80;
    border-color: rgba(224, 82, 151, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
    transform: translateY(-1px) scale(0.98);
    background-color: #fff0f5;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0);
    }
    40%, 60% {
        transform: translate3d(4px, 0, 0);
    }
}

.fade-out {
    opacity: 0;
    transform: scale(0.97);
}

.fade-in {
    opacity: 1;
    transform: scale(1);
}

/* Image entrance animation */
#main-image {
    animation: bounceIn 0.5s ease-out;
}

/* Button focus states for accessibility */
.btn:focus-visible {
    outline: 3px solid rgba(224, 82, 151, 0.5);
    outline-offset: 3px;
}

/* Prevent text selection on buttons for better mobile UX */
.btn {
    -webkit-user-select: none;
    user-select: none;
}

/* Smooth scrolling if needed */
html {
    scroll-behavior: smooth;
}

/* Hide scrollbar but keep functionality */
body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Add a subtle pulse to primary button for attention */
@keyframes subtlePulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(224, 82, 151, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(224, 82, 151, 0.5);
    }
}

.btn-primary {
    animation: subtlePulse 2s ease-in-out infinite;
}

.btn-primary:hover, .btn-primary:active {
    animation: none;
}

/* Disable pulse on BSOD buttons */
body.bsod-active .btn-primary {
    animation: none;
}

/* Tablet Adjustments */
@media (max-width: 768px) {
    h1 {
        margin-top: 8vh;
    }
}

/* Mobile Adjustments - Centered Card Layout */
@media (max-width: 480px) {
    body {
        padding: 16px;
    }

    #app {
        padding: 0;
        min-height: auto;
        justify-content: center;
    }

    .card-container {
        min-height: auto;
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-radius: 24px;
        padding: 24px 16px;
        box-shadow: 0 8px 32px rgba(224, 82, 151, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.8);
        justify-content: flex-start;
        gap: 12px;
    }

    h1 {
        margin-top: 0;
        margin-bottom: 8px;
        padding: 0;
        font-size: clamp(1.2rem, 5vw, 1.6rem);
    }

    .button-group {
        gap: 10px;
        margin: 12px 0;
        order: 1;
    }

    .btn {
        padding: 12px 20px;
        min-width: 100px;
        max-width: 160px;
    }

    .image-wrapper {
        order: 2;
        min-height: auto;
        max-height: 45vh;
        flex: none;
        margin-top: 8px;
    }

    img {
        max-height: 40vh;
        border-radius: 16px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    body {
        padding: 12px;
    }

    .card-container {
        padding: 20px 12px;
        border-radius: 20px;
    }

    h1 {
        font-size: clamp(1.1rem, 5vw, 1.4rem);
    }

    .btn {
        padding: 10px 16px;
        min-width: 90px;
        max-width: 140px;
        min-height: 44px;
    }

    .button-group {
        gap: 8px;
    }

    img {
        max-height: 35vh;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 12px;
    }

    #app {
        min-height: auto;
        justify-content: center;
    }

    .card-container {
        min-height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        padding: 16px;
        gap: 16px;
    }

    h1 {
        margin-top: 0;
        margin-bottom: 8px;
        width: 100%;
    }

    .button-group {
        margin: 8px 0;
        order: 1;
    }

    .image-wrapper {
        min-height: 80px;
        max-height: 50vh;
        order: 2;
        flex: none;
    }

    img {
        max-height: 45vh;
    }
}