/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background: linear-gradient(135deg, #ffeef8 0%, #f8e8ff 50%, #fff0f5 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Floating hearts background */
.hearts-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.heart {
    position: absolute;
    font-size: 20px;
    opacity: 0.3;
    animation: float 15s infinite ease-in-out;
    will-change: transform; /* Performance optimization */
}

/* Reduce hearts on mobile for better performance */
@media (max-width: 768px) {
    .hearts-container .heart:nth-child(n+4) {
        display: none;
    }
    
    .heart {
        font-size: 16px;
        opacity: 0.2;
    }
}

.heart:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 12s;
}

.heart:nth-child(2) {
    left: 30%;
    animation-delay: 2s;
    animation-duration: 14s;
}

.heart:nth-child(3) {
    left: 50%;
    animation-delay: 4s;
    animation-duration: 13s;
}

.heart:nth-child(4) {
    left: 70%;
    animation-delay: 1s;
    animation-duration: 15s;
}

.heart:nth-child(5) {
    left: 90%;
    animation-delay: 3s;
    animation-duration: 16s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Main container */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 700px;
}

/* Card */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(255, 182, 193, 0.3),
                0 0 0 1px rgba(255, 192, 203, 0.1);
    -webkit-backdrop-filter: blur(10px); /* Safari support */
    backdrop-filter: blur(10px);
    animation: cardFadeIn 0.6s ease-out;
    width: 100%;
    margin: 0 auto;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Title section */
.title-section {
    text-align: center;
    margin-bottom: 30px;
}

.title-section h1 {
    font-size: 1.8rem;
    font-weight: 500;
    color: #d63384;
    margin-bottom: 0;
}

.heart-icon {
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Intro state */
.intro-state {
    text-align: center;
    padding: 20px 0;
}

.intro-text {
    font-size: 1.3rem;
    color: #8b5a7a;
    margin-bottom: 30px;
    font-weight: 400;
}

.start-button {
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 158, 199, 0.4);
    transition: all 0.3s ease;
    font-family: 'Be Vietnam Pro', sans-serif;
    min-height: 48px; /* Touch-friendly minimum height */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.start-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 158, 199, 0.5);
}

.start-button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 15px rgba(255, 158, 199, 0.4);
}

/* Message state */
.message-state {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.message-content {
    min-height: 200px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 240, 245, 0.5);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-text {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #5a4a5a;
    text-align: left;
    animation: slideUp 0.4s ease-out;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    width: 100%;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Navigation buttons */
.navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
}

.nav-button {
    flex: 1;
    background: rgba(255, 182, 193, 0.2);
    color: #d63384;
    border: 2px solid rgba(255, 182, 193, 0.4);
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Be Vietnam Pro', sans-serif;
    min-height: 44px; /* Touch-friendly minimum height */
    -webkit-tap-highlight-color: transparent; /* Remove mobile tap highlight */
    touch-action: manipulation; /* Improve touch responsiveness */
}

.nav-button:hover:not(:disabled) {
    background: rgba(255, 182, 193, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 182, 193, 0.3);
}

.nav-button:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    background: rgba(255, 182, 193, 0.5);
}

.nav-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Prevent text selection on buttons */
.nav-button,
.start-button,
.choice-button {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Progress hearts */
.progress-hearts {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.heart-dot {
    font-size: 1.2rem;
    transition: all 0.3s ease;
    cursor: pointer;
    filter: grayscale(100%) opacity(0.4);
}

.heart-dot.active {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.3);
    animation: heartBeat 0.6s ease;
}

@keyframes heartBeat {
    0%, 100% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1.5);
    }
}

/* Final choice section */
.final-choice {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px dashed rgba(255, 182, 193, 0.3);
    text-align: center;
    animation: fadeIn 0.5s ease-in;
}

.final-question {
    font-size: 1.3rem;
    color: #d63384;
    font-weight: 500;
    margin-bottom: 25px;
    line-height: 1.6;
}

.choice-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.choice-button {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 500;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Be Vietnam Pro', sans-serif;
    min-width: 180px;
    min-height: 48px; /* Touch-friendly minimum height */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.yes-button {
    background: linear-gradient(135deg, #ff9ec7 0%, #ffb3d9 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(255, 158, 199, 0.4);
}

.yes-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 158, 199, 0.5);
}

.yes-button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 15px rgba(255, 158, 199, 0.4);
}

.no-button {
    background: rgba(255, 182, 193, 0.2);
    color: #d63384;
    border: 2px solid rgba(255, 182, 193, 0.4);
}

.no-button:hover {
    background: rgba(255, 182, 193, 0.4);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(255, 182, 193, 0.3);
}

.no-button:active {
    transform: translateY(0) scale(0.98);
    background: rgba(255, 182, 193, 0.5);
}

/* Reaction message */
.reaction-message {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.2) 0%, rgba(255, 192, 203, 0.2) 100%);
    border-radius: 20px;
    text-align: center;
    font-size: 1.2rem;
    color: #d63384;
    font-weight: 500;
    animation: fadeIn 0.5s ease-in, slideUp 0.5s ease-out;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 15px;
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        align-items: flex-start;
    }

    .container {
        max-width: 100%;
    }

    .card {
        padding: 25px 20px;
        border-radius: 25px;
        margin: 0;
    }

    .title-section {
        margin-bottom: 25px;
    }

    .title-section h1 {
        font-size: 1.4rem;
        line-height: 1.4;
    }

    .intro-state {
        padding: 15px 0;
    }

    .intro-text {
        font-size: 1.05rem;
        margin-bottom: 25px;
        line-height: 1.6;
    }

    .start-button {
        padding: 16px 32px;
        font-size: 1rem;
        width: 100%;
        max-width: 300px;
    }

    .message-content {
        min-height: 160px;
        padding: 18px;
        margin-bottom: 25px;
    }

    .message-text {
        font-size: 0.95rem;
        line-height: 1.75;
    }

    .navigation {
        gap: 12px;
        margin-bottom: 20px;
    }

    .nav-button {
        padding: 14px 18px;
        font-size: 0.95rem;
        min-height: 48px;
    }

    .progress-hearts {
        gap: 10px;
        margin-bottom: 20px;
    }

    .heart-dot {
        font-size: 1.1rem;
        min-width: 32px;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .final-choice {
        margin-top: 25px;
        padding-top: 25px;
    }

    .final-question {
        font-size: 1.05rem;
        margin-bottom: 20px;
        line-height: 1.6;
        padding: 0 10px;
    }

    .choice-buttons {
        gap: 12px;
        flex-direction: column;
        width: 100%;
    }

    .choice-button {
        padding: 16px 24px;
        font-size: 1rem;
        min-width: 100%;
        width: 100%;
        max-width: 100%;
    }

    .reaction-message {
        font-size: 1.05rem;
        padding: 18px;
        margin-top: 20px;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
        padding-top: max(15px, env(safe-area-inset-top));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }

    .card {
        padding: 20px 15px;
        border-radius: 20px;
    }

    .title-section {
        margin-bottom: 20px;
    }

    .title-section h1 {
        font-size: 1.2rem;
        line-height: 1.3;
    }

    .intro-text {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .start-button {
        padding: 14px 28px;
        font-size: 0.95rem;
    }

    .message-content {
        min-height: 140px;
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 15px;
    }

    .message-text {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    .navigation {
        gap: 10px;
        margin-bottom: 18px;
    }

    .nav-button {
        padding: 12px 16px;
        font-size: 0.9rem;
        border-radius: 20px;
    }

    .progress-hearts {
        gap: 8px;
        margin-bottom: 18px;
    }

    .heart-dot {
        font-size: 1rem;
        min-width: 28px;
        min-height: 28px;
    }

    .final-choice {
        margin-top: 20px;
        padding-top: 20px;
    }

    .final-question {
        font-size: 1rem;
        margin-bottom: 18px;
        padding: 0 5px;
    }

    .choice-button {
        padding: 14px 20px;
        font-size: 0.95rem;
        border-radius: 25px;
    }

    .reaction-message {
        font-size: 1rem;
        padding: 15px;
        border-radius: 15px;
    }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 360px) {
    .title-section h1 {
        font-size: 1.1rem;
    }

    .message-text {
        font-size: 0.85rem;
    }

    .nav-button {
        font-size: 0.85rem;
        padding: 12px 14px;
    }

    .choice-button {
        font-size: 0.9rem;
        padding: 14px 18px;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        align-items: center;
        padding: 15px;
    }

    .card {
        max-width: 600px;
    }

    .message-content {
        min-height: 120px;
    }
}

