/* ==================== RESET & FONTS ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #5DADE2;
    --dark-blue: #3498DB;
    --light-bg: #F0F8FF;
    --text-color: #555;
    --orange-btn: #FF7F50;
    --border-color: #85C1E9;
}

body {
    font-family: 'Fredoka', 'Segoe UI', sans-serif;
    background-color: #fff;
    color: var(--text-color);
    height: 100vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* ==================== BACKGROUND ==================== */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/snoopy-pattern.png');
    background-size: 300px;
    background-repeat: repeat;
    opacity: 0.8;
    z-index: -1;
    animation: bgScroll 60s linear infinite;
}

@keyframes bgScroll {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 300px 300px;
    }
}

/* ==================== MAIN CONTAINER ==================== */
.main-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

.screen {
    display: none;
    width: 100%;
    max-width: 400px;
    height: auto;
    min-height: 500px;
    max-height: 90vh;
    /* Prevent overflow on mobile */
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(93, 173, 226, 0.2);
    position: absolute;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
    z-index: 10;
}

/* ==================== CONTENT STYLES ==================== */
.card-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.image-container {
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.main-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.dance {
    animation: dance 1s infinite alternate;
}

@keyframes dance {
    0% {
        transform: rotate(-5deg);
    }

    100% {
        transform: rotate(5deg);
    }
}

h1,
h2 {
    color: var(--primary-blue);
    font-family: 'Patrick Hand', cursive;
}

.title-text {
    font-size: 2rem;
    letter-spacing: 1px;
}

.question-text {
    font-size: 1.5rem;
    color: var(--primary-blue);
}

.kaomoji {
    font-size: 1.2rem;
    color: var(--text-color);
    margin: 5px 0;
}

.instruction-text {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.retry-text {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

/* ==================== BUTTONS ==================== */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.btn {
    padding: 10px 30px;
    border: none;
    border-radius: 50px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn-blue {
    background-color: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 10px rgba(93, 173, 226, 0.4);
}

.btn-orange {
    background-color: var(--orange-btn);
    color: white;
    box-shadow: 0 4px 10px rgba(255, 127, 80, 0.4);
    position: relative;
}

/* ==================== MESSAGE SCREEN ==================== */
.message-mode {
    height: 100%;
    justify-content: flex-start;
}

.message-header {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.kaomoji-header {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 15px;
}

.message-scroll-area {
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 5px;
}

.message-scroll-area p {
    margin-bottom: 15px;
}

.message-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.message-scroll-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.message-scroll-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* ==================== GALLERY SCREEN ==================== */
.gallery-mode {
    height: 100%;
    max-height: 100%;
    /* Constrain to parent */
    justify-content: flex-start;
    overflow-y: auto;
    padding-bottom: 10px;
    /* Extra space at bottom */
}

.gallery-header {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 5px;
}

.photo-gallery {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.photo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.photo-frame {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid var(--border-color);
    border-radius: 15px;
    padding: 8px;
    background: white;
    box-shadow: 0 4px 10px rgba(93, 173, 226, 0.2);
    overflow: visible;
    position: relative;
}

.photo-frame::before {
    content: '♡';
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 1.2rem;
    color: #FF6B9D;
    opacity: 0.7;
    z-index: 2;
}

.gallery-photo,
.gallery-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.gallery-video {
    cursor: pointer;
    min-height: 90px;
}

/* Better video controls visibility on mobile */
.gallery-video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.5);
}

.photo-caption {
    font-size: 0.85rem;
    color: var(--text-color);
    font-style: italic;
    text-align: center;
}

/* ==================== BOTTOM BAR ==================== */
.bottom-bar {
    height: 60px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #333;
}

.brand-logo {
    height: 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f5f5f5;
    padding: 5px 15px;
    border-radius: 30px;
}

.avatar {
    width: 24px;
    height: 24px;
    background: #9B59B6;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #777;
}

/* ==================== MUSIC BUTTON ==================== */
.music-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-blue);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(93, 173, 226, 0.5);
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s;
}

.music-btn:hover {
    transform: scale(1.1);
}

.music-playing {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(93, 173, 226, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(93, 173, 226, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(93, 173, 226, 0);
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .screen {
        max-width: 90%;
        min-height: 400px;  /* Reduced for mobile */
        max-height: 85vh;   /* Fit in viewport */
    }

    .title-text {
        font-size: 1.8rem;
    }

    .bottom-bar {
        padding: 0 10px;
    }

    .user-profile span {
        display: none;
    }

    .photo-gallery {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }

    /* Better video controls on mobile */
    .gallery-video {
        min-height: 120px;
    }

    /* Larger touch targets for buttons */
    .btn {
        padding: 12px 35px;
        font-size: 1.1rem;
    }
}
