/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(45deg, #F2EEE8, #E38792, #F2EEE8);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#gameboy-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Enhanced Screen Transitions */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transform: translateY(0);
}

.screen.fade-out {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading Screen Styles */
#loading-screen {
    background: linear-gradient(180deg, #4E0A0B, #F2EEE8);
    color: #00ff00;
}

#loading-screen .gameboy-screen {
    width: 600px;
    height: 400px;
    background: #4E0A0B;
    border: 4px solid #E38792;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#loading-screen .screen-content {
    text-align: center;
    width: 100%;
    padding: 40px;
}

#loading-screen .title {
    font-size: 48px;
    font-weight: bold;
    color: #00ff00;
    margin-bottom: 40px;
    letter-spacing: 4px;
    animation: titleGlow 2s ease-in-out infinite alternate; /* Tambahkan ini */
}

/* Tambahkan keyframe ini */
@keyframes titleGlow {
    from {
        text-shadow: 0 0 10px #00ff00;
    }
    to {
        text-shadow: 0 0 20px #00ff00, 0 0 30px #00ff00;
    }
}

#loading-screen .loading-text {
    font-size: 24px;
    color: #00ff00;
    margin-bottom: 30px;
    text-align: left;
    padding-left: 20px;
    animation: blink 1s infinite;
    transition: opacity 0.3s ease; /* Tambahkan ini */
}

.progress-bar {
    width: 80%;
    height: 30px;
    background: #F2EEE8;
    border: 2px solid #E38792;
    margin: 0 auto 30px;
    position: relative;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #E38792;
    width: 38%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Tambahkan efek shine */
.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-weight: bold;
    font-size: 16px;
}

#loading-screen .smile-text {
    font-size: 32px;
    color: #ffff00;
    font-weight: bold;
    margin-top: 20px;
}

/* Main Screen Entry Animation */
#main-screen.screen-entering {
    animation: mainScreenEnter 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes mainScreenEnter {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.02) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Loading completion animation */
.loading-complete {
    animation: loadingSuccess 0.8s ease-in-out forwards;
}

@keyframes loadingSuccess {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Main Gameboy Styles */
.gameboy-body {
    width: 400px;
    height: 600px;
    background: linear-gradient(145deg, #F2EEE8, #E38792);
    border-radius: 20px 20px 40px 40px;
    padding: 20px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(255,255,255,0.8),
        inset 0 -2px 4px rgba(0,0,0,0.2);
    position: relative;
}

.gameboy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 12px;
    color: #666;
}

.power-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
}

.power-dot {
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
}

.brand-text {
    font-weight: bold;
    font-size: 14px;
}

.gameboy-screen {
    width: 100%;
    height: 200px;
    background: #F2EEE8;
    border: 8px solid #4E0A0B;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

/* Gameboy elements staggered entry */
.gameboy-screen {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active .gameboy-screen {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.menu-buttons {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active .menu-buttons {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}

.controls {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active .controls {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.6s;
}

.bottom-controls {
    opacity: 0;
    transform: translateY(50px);
    transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active .bottom-controls {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.8s;
}

.gameboy-screen .screen-content {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.birthday-title {
    color: #4E0A0B; /* was #9bbc0f */
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 1px 6px rgba(78,10,11,0.14); /* adjusted shadow for new text color */
}

.start-text {
    color: #4E0A0B; /* was #ffff00 */
    font-size: 16px;
    margin-bottom: 20px;
}

.screen-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: #666;
}

.battery {
    display: flex;
    align-items: center;
    gap: 3px;
}

.battery-dot {
    width: 4px;
    height: 4px;
    background: #ff4444;
    border-radius: 50%;
}


/* Menu Buttons - Fixed Tetris Button */
.menu-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 30px;
}

.menu-btn {
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    text-transform: uppercase; /* Ensure consistent text formatting */
    letter-spacing: 0.5px; /* Better letter spacing */
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.menu-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.message-btn {
    background: linear-gradient(145deg, #E38792, #C86A74);
    color: white;
}

.message-btn:hover {
    background: linear-gradient(145deg, #C86A74, #D06A78);
}

.gallery-btn {
    background: linear-gradient(145deg, #E38792, #D77682);
    color: white;
}

.gallery-btn:hover {
    background: linear-gradient(145deg, #D77682, #D06A78);
}

.music-btn {
    background: linear-gradient(145deg, #E38792, #D06A78);
    color: white;
}

.music-btn:hover {
    background: linear-gradient(145deg, #D06A78, #C86A74);
}

.tetris-btn {
    background: linear-gradient(145deg, #E38792, #D77682);
    color: white;
}

.tetris-btn:hover {
    background: linear-gradient(145deg, #D77682, #C86A74);
}

/* Ensure all buttons have consistent focus states */
.menu-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}


/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dpad {
    width: 80px;
    height: 80px;
    position: relative;
}

.dpad-center {
    width: 100%;
    height: 100%;
    background: #333;
    position: relative;
    border-radius: 8px;
}

.dpad-center div {
    position: absolute;
    background: #555;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dpad-center div:hover {
    background: #666;
}

.dpad-up, .dpad-down {
    width: 30px;
    height: 25px;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-up {
    top: 0;
    border-radius: 8px 8px 0 0;
}

.dpad-down {
    bottom: 0;
    border-radius: 0 0 8px 8px;
}

.dpad-left, .dpad-right {
    width: 25px;
    height: 30px;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-left {
    left: 0;
    border-radius: 8px 0 0 8px;
}

.dpad-right {
    right: 0;
    border-radius: 0 8px 8px 0;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.action-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    font-family: inherit;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.b-btn, .a-btn {
    background: linear-gradient(145deg, #E38792, #C86A74);
    color: white; /* text color was already set */
}

.bottom-controls {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.control-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #666;
    color: white;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #777;
    transform: translateY(-1px);
}

.speaker-grille {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: 
        radial-gradient(circle at 25% 25%, #4E0A0B 2px, transparent 2px),
        radial-gradient(circle at 75% 25%, #4E0A0B 2px, transparent 2px),
        radial-gradient(circle at 25% 75%, #4E0A0B 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, #4E0A0B 2px, transparent 2px),
        radial-gradient(circle at 50% 50%, #4E0A0B 2px, transparent 2px);
    background-size: 8px 8px;
}

/* Page Container Styles */
.page-container {
    width: 400px;
    height: 600px;
    background: linear-gradient(145deg, #F2EEE8, #E38792);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 4px solid #4E0A0B;
}

.page-screen {
    width: 100%;
    height: 480px;
    background: #F2EEE8;
    border: 4px solid #4E0A0B;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.page-header {
    background: #4E0A0B;
    color: #4E0A0B; /* was #9bbc0f -> keep header text consistent with new accent */
    padding: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}

.page-controls {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
}

.page-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.continue-btn {
    order: 2; /* Right side */
}

.back-btn {
    order: 1; /* Left side */
}

.page-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Message Page Styles - Fixed Layout */
.message-content {
    height: calc(100% - 80px); /* Adjusted to match other pages */
    overflow-y: auto;
    padding: 15px;
    background: #F2EEE8;
    color: #4E0A0B; /* was #9bbc0f */
    font-size: 12px;
    line-height: 1.5;
    border-radius: 4px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.message-content::-webkit-scrollbar {
    width: 4px;
}

.message-content::-webkit-scrollbar-track {
    background: #1a1a2e;
}

.message-content::-webkit-scrollbar-thumb {
    background: #E38792;
    border-radius: 2px;
}

/* Skip button positioned consistently with other pages */
.skip-btn {
    display: block;
    margin: 0 auto 8px auto;
    padding: 6px 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.skip-btn:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.skip-btn:active {
    transform: scale(0.95);
}

/* Remove the problematic overrides */
#message-screen .page-screen {
    height: 480px; /* Same as other pages */
}

/* Ensure consistent structure */
#message-screen .page-container {
    width: 400px;
    height: 600px;
    /* Same as other pages */
}

/* Gallery Page Styles */
.gallery-content {
    padding: 15px;
    height: calc(100% - 60px);
    display: flex;
    flex-direction: column;
}

.photobox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F2EEE8;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    flex-shrink: 0;
    color: inherit; /* text color remains as defined elsewhere */
}

.photobox-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.photobox-dot.red {
    background: #ff4444;
}

.photobox-dot.green {
    background: #9DAD71;
}

.photobox-title {
    color: #4E0A0B; /* was #ffff00 */
    font-size: 12px;
    font-weight: bold;
}

.photobox-progress {
    background: #F2EEE8;
    border: 1px solid #E38792;
    color: inherit; /* text color unchanged */
    margin-bottom: 15px;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    text-align: center;
    min-height: 20px;
    flex-shrink: 0;
}

.photo-display {
    background: #F2EEE8;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 15px;
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    max-height: 300px;
}

/* Custom scrollbar for photo display */
.photo-display::-webkit-scrollbar {
    width: 6px;
}

.photo-display::-webkit-scrollbar-track {
    background: #333;
    border-radius: 3px;
}

.photo-display::-webkit-scrollbar-thumb {
    background: #9DAD71;
    border-radius: 3px;
}

.photo-display::-webkit-scrollbar-thumb:hover {
    background: #D06A78;
}

.photo-placeholder {
    text-align: center;
    color: #4E0A0B; /* was #9bbc0f */
    font-size: 12px;
    margin-top: 50px;
}

/* Photo Strip Styles - Vertical Scrollable */
.photo-strip {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    background: #F2EEE8;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    min-height: 100%;
    position: relative;
    overflow: hidden; /* Prevent content from spilling out */
}

.photo-strip-header {
    text-align: center;
    color: #333;
    font-size: 12px;
    font-weight: bold;
    padding: 15px 10px 10px 10px;
    border-bottom: 2px solid #E38792;
    background: #F2EEE8;
    flex-shrink: 0; /* Prevent header from shrinking */
    position: relative;
    z-index: 2;
}

.photo-frames-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    padding: 15px;
    overflow-y: auto; /* Make only the frames container scrollable */
    overflow-x: hidden;
    max-height: 220px; /* Limit height to enable scrolling */
}

/* Custom scrollbar for frames container */
.photo-frames-container::-webkit-scrollbar {
    width: 5px;
}

.photo-frames-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.photo-frames-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.photo-frames-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.photo-frame {
    width: 100%;
    height: 150px;
    background: #F2EEE8;
    border: 3px solid #E38792; /* consistent soft-pink frame */
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.photo-frame.filled {
    background: none; /* Remove gradient for image display */
    color: white;
    transform: scale(1.02);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.photo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    transition: opacity 0.3s ease;
}

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 10px 6px 6px 6px; /* Increased padding for larger frame */
    border-radius: 0 0 3px 3px;
}

.photo-content {
    color: #333;
    font-size: 11px;
    text-align: center;
    padding: 5px;
    font-weight: bold;
    line-height: 1.2;
}

.photo-frame.filled .photo-overlay .photo-content {
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-size: 10px;
    text-align: center;
    font-weight: bold;
    line-height: 1.2;
}

.photo-strip-footer {
    text-align: center;
    color: #666;
    font-size: 10px;
    font-weight: bold;
    background: #F2EEE8;
    padding: 8px;
    border-top: 2px solid #E38792; /* subtle pink divider */
    flex-shrink: 0; /* Prevent footer from shrinking */
    position: relative;
    z-index: 1;
}

.photobox-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: auto;
    padding-top: 10px;
    flex-shrink: 0;
}

.photo-btn {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.photo-btn:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.photo-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

/* Loading state for images */
.photo-image:not([complete]) {
    opacity: 0.5;
}

.photo-frame .photo-content {
    color: #333;
    font-size: 12px;
    text-align: center;
    padding: 5px;
    font-weight: bold;
    line-height: 1.2;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: #4E0A0B; /* was #9DAD71 */
    font-size: 10px;
    opacity: 0.7;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}


/* Music Page Styles - Updated for Spotify */
.music-content {
    padding: 15px;
    height: calc(100% - 60px);
    overflow-y: auto;
}

.spotify-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 10px;
}

.spotify-header {
    text-align: center;
    margin-bottom: 10px;
}

.spotify-logo {
    color: #4E0A0B; /* was #1db954 */
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.playlist-title {
    color: #4E0A0B; /* was #9bbc0f */
    font-size: 14px;
    font-weight: bold;
}

.spotify-embed-container {
    background: #F2EEE8;
    border: 2px solid #E38792;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 12px;
}

.spotify-embed-container iframe {
    border-radius: 8px;
    transition: opacity 0.3s ease;
}

.playlist-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.playlist-btn {
    padding: 6px 12px;
    background: #E38792;       /* new background */
    color: #F2EEE8;            /* new text color */
    border: 1px solid transparent; /* remove contrasting border */
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: bold;
    transition: all 0.18s ease;
}

.playlist-btn:hover {
    background: #4E0A0B;      /* hover background */
    color: #F2EEE8;           /* hover text color */
    transform: translateY(-2px);
}

.playlist-btn.active {
    background: #4E0A0B;      /* active state */
    color: #F2EEE8;
    border-color: #4E0A0B;
}

.music-info {
    text-align: center;
    margin-top: auto;
}

.current-playlist {
    color: #4E0A0B; /* was #ffff00 */
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
}

.playlist-description {
    color: #4E0A0B; /* was #9bbc0f */
    font-size: 10px;
    line-height: 1.4;
}


/* Tetris Page Styles - Much Larger Display */
#tetris-screen .page-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0;
}

.tetris-header {
    background: #4E0A0B;
    color: inherit; /* keep text colors as-is */
    border-bottom: 1px solid rgba(0,0,0,0.2);
}

.tetris-title {
    font-size: 15px; /* Very small title */
    font-weight: bold;
}

.tetris-stats {
    display: flex;
    gap: 6px;
    font-size: 8px; /* Very small stats */
}

.stat {
    color: #4E0A0B; /* was #9bbc0f */
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
}

.tetris-game {
    background: #F2EEE8;
    flex: 1; /* Take most available space */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px; /* Minimal padding */
    overflow: hidden;
    min-height: 0;
}

#tetris-canvas {
    border: 2px solid #E38792;
    background: #F2EEE8;
    border-radius: 6px;
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.tetris-controls {
    display: flex;
    justify-content: center;
    gap: 10px; /* comfortable spacing */
    padding: 8px 14px;
    background: #1a1a1a;
    flex-shrink: 0;
    border-top: 1px solid #333;
}

/* Make only the in-game control buttons circular/rounded (do not touch .tetris-btn used in main menu) */
#left-btn,
#rotate-btn,
#right-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;               /* bulat */
    background: linear-gradient(145deg, #E38792, #C86A74); /* soft-pink */
    border: 2px solid #4E0A0B;        /* pink border */
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

/* Hover / active states for nicer feedback */
#left-btn:hover,
#rotate-btn:hover,
#right-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.18);
}

#left-btn:active,
#rotate-btn:active,
#right-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

/* Make the rotate button circular again (match left/right) and keep the rotate icon */
#rotate-btn {
	/* match left/right buttons */
	width: 48px;
	height: 48px;
	min-width: 48px;
	padding: 0;
	border-radius: 50%;
	background: linear-gradient(145deg, #E38792, #C86A74);
	border: 2px solid #4E0A0B;
	color: #fff;
	font-weight: bold;
	font-size: 18px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 8px rgba(0,0,0,0.15);
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}

/* Make the "Kembali" (back) button on Tetris screen slightly larger / proportional */
#tetris-screen .back-btn {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 10px;
    min-width: 92px;
    background: linear-gradient(145deg, #F2EEE8, #E38792);
    border: 1px solid #4E0A0B;
    color: inherit;
    margin-top: 12px;      /* added vertical spacing above the button */
    margin-bottom: 12px;   /* added vertical spacing below the button */
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(78,10,11,0.75); /* overlay tinted soft-pink/dusky */
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #F2EEE8;
    border: 4px solid #E38792;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.game-over-text {
    color: #4E0A0B;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.final-message-title {
    color: #4E0A0B;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.final-message-text {
    color: #4E0A0B; /* was #9bbc0f */
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.final-message-text p {
    margin-bottom: 8px;
}

.love-text {
    color: #ff69b4;
    font-size: 18px;
    font-weight: bold;
    margin-top: 15px !important;
}

.modal-btn {
    padding: 12px 24px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    font-size: 16px;
}

.modal-btn:hover {
    background: #357abd;
}

/* The game-over confirm and final OK buttons should follow the theme */
#confirm-btn,
#ok-btn {
    padding: 10px 18px;
    background: linear-gradient(145deg, #E38792, #D77682);
    color: #F2EEE8;
    border: 2px solid #4E0A0B;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0,0,0,0.12);
    transition: transform 0.12s ease, background 0.12s ease;
}

#confirm-btn:hover,
#ok-btn:hover {
    background: #4E0A0B;
    color: #F2EEE8;
    transform: translateY(-2px);
}

/* Style for an optional description inside the game-over modal */
#game-over-modal .game-over-desc {
    color: #4E0A0B;
    font-size: 14px;
    margin-bottom: 14px;
}

/* Responsive Design */
@media (max-width: 480px) {
    /* Make the main card adapt to screen without becoming too tall */
    .gameboy-body,
    .page-container {
        width: 94vw;
        max-width: 420px;
        height: auto;          /* let content determine height */
        max-height: 86vh;      /* limit how tall the card can grow */
        overflow: hidden;      /* hide overflow on the outer card */
    }

    /* Allow internal scrolling if a page's content is taller than the card */
    .page-screen,
    .gameboy-screen {
        max-height: calc(86vh - 60px); /* keep internal areas constrained */
        overflow: auto;
    }

    /* Keep tetris canvas and controls unchanged (no resizing of game area) */
    #tetris-canvas {
        max-width: 92%;
        max-height: 52vh;
        width: auto;
        height: auto;
        border-width: 1.5px;
    }

    /* Smaller circular tetris controls for phones */
    #left-btn,
    #rotate-btn,
    #right-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    /* Ensure page buttons remain tappable and proportional */
    .page-btn {
        padding: 10px;
        font-size: 13px;
        border-radius: 10px;
    }

    /* Photo frames shrink a little on mobile */
    .photo-frame {
        height: 120px;
    }

    .photo-frames-container {
        max-height: 180px;
    }

    /* Improve spacing in tetris header and stats */
    .tetris-title { font-size: 14px; }
    .tetris-stats { font-size: 9px; gap: 8px; }

    /* Modal adapt */
    .modal-content {
        width: 95%;
        padding: 18px;
    }
}

/* Animations */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.loading-text {
    animation: blink 1s infinite;
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 10px currentColor; }
    50% { text-shadow: 0 0 20px currentColor, 0 0 30px currentColor; }
}

.birthday-title {
    animation: glow 2s ease-in-out infinite;
}

