:root {
    --bg-color: #111;
    --text-color: #fff;
    --primary-color: #ff0055;
    --secondary-color: #00ffcc;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'VT323', monospace;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    user-select: none;
}

/* Hiệu ứng sọc ngang của màn hình CRT cũ */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none; /* Không cản trở việc click nút */
    z-index: 10;
}

.screen {
    text-align: center;
    z-index: 5;
    width: 90%;
    max-width: 800px;
}



.game-selection {
    display: flex;
    flex-direction: column;
    gap: 40px;
    align-items: center;
}

@media (min-width: 768px) {
    .game-selection {
        flex-direction: row;
        justify-content: center;
    }
}

/* Nút bấm phong cách Pixel 8-bit */
.pixel-btn {
    background-color: #222;
    border: 4px solid #fff;
    color: #fff;
    font-family: inherit;
    padding: 30px 20px;
    width: 100%;
    max-width: 320px;
    cursor: pointer;
    position: relative;
    transition: all 0.1s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Đổ bóng khối 3D cứng đặc trưng của retro */
.pixel-btn.game1-btn {
    box-shadow: inset -4px -4px 0px 0px rgba(0,0,0,0.5), 
                8px 8px 0px 0px var(--secondary-color);
}
.pixel-btn.game2-btn {
    box-shadow: inset -4px -4px 0px 0px rgba(0,0,0,0.5), 
                8px 8px 0px 0px var(--primary-color);
}

/* Hiệu ứng khi hover */
.pixel-btn.game1-btn:hover {
    background-color: var(--secondary-color);
    color: #000;
}
.pixel-btn.game2-btn:hover {
    background-color: var(--primary-color);
    color: #000;
}

/* Hiệu ứng khi bấm xuống (lún xuống) */
.pixel-btn.game1-btn:active {
    box-shadow: inset -4px -4px 0px 0px rgba(0,0,0,0.5), 
                0px 0px 0px 0px var(--secondary-color);
}
.pixel-btn.game2-btn:active {
    box-shadow: inset -4px -4px 0px 0px rgba(0,0,0,0.5), 
                0px 0px 0px 0px var(--primary-color);
}

.pixel-btn:active {
    transform: translate(8px, 8px);
}

.btn-icon {
    font-size: 3.5rem;
}

.btn-text {
    font-size: 1.8rem;
    line-height: 1.8;
}

.btn-desc {
    font-size: 1.2rem;
    opacity: 0.8;
}

footer {
    margin-top: 80px;
}

/* Chữ nhấp nháy "Insert Coin" */
.blink {
    animation: blink 1s step-end infinite;
    color: #fff;
    font-size: 0.9rem;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* =========================================
   LOADING SCREEN STYLES
   ========================================= */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('./pc.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

/* Lớp phủ siêu mỏng giúp chữ không bị chìm vào ảnh, không làm đen ảnh */
#loading-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 101;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.loading-content {
    position: relative;
    z-index: 102;
    text-align: center;
}

.loading-header {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 30px;
}

.loading-content h1 {
    font-size: 6rem;
    color: #ffd700;
    text-shadow: 4px 4px 0px #ff0055;
    letter-spacing: 5px;
    margin-bottom: 0;
}

.pixel-runner {
    width: 80px;
    height: 80px;
    object-fit: contain;
    image-rendering: pixelated; /* Giữ độ sắc nét của đồ họa pixel */
    margin-bottom: 10px;
    mix-blend-mode: screen; /* Xóa phông nền đen của ảnh */
    animation: runBounce 0.25s infinite alternate; /* Hiệu ứng nhún nhảy như đang chạy */
}

@keyframes runBounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

.progress-bar {
    width: 90vw;
    max-width: 500px;
    height: 35px;
    border: 4px solid #fff;
    background-color: #222;
    margin: 0 auto 20px auto;
    position: relative;
    padding: 3px;
    box-shadow: 6px 6px 0px #000;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--secondary-color);
    transition: width 0.1s linear;
}

#loading-text {
    font-size: 1.8rem;
    color: #fff;
    text-shadow: 2px 2px 0px #000;
}

/* =========================================
   PIXEL UI UTILITIES (Ported from Game 2)
   ========================================= */
.shadow-pixel {
    box-shadow: 4px 4px 0px #000;
}

.shadow-pixel-heavy {
    box-shadow: 8px 8px 0px #000;
}

.text-shadow-pixel {
    text-shadow: 3px 3px 0px #000;
}

.pixel-border-blue {
    border: 6px solid #1e88e5;
    outline: 4px solid #000;
    outline-offset: -10px;
    box-shadow: inset 0 0 0 4px #000, 8px 8px 0px #000;
}

.pixel-banner-blue {
    background-color: #29b6f6;
    border: 4px solid #000;
    position: relative;
    font-weight: bold;
}
.pixel-banner-blue::before, .pixel-banner-blue::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px; 
    height: 80%;
    background-color: #0288d1;
    border: 4px solid #000;
    z-index: -1;
}
.pixel-banner-blue::before { left: -15px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 30% 50%); }
.pixel-banner-blue::after { right: -15px; clip-path: polygon(0 0, 100% 0, 70% 50%, 100% 100%, 0 100%); }

.pixel-label-blue {
    background-color: #1e88e5;
    border: 4px solid #000;
    box-shadow: 4px 4px 0px #000;
    font-weight: bold;
}

.pixel-input {
    border: 4px solid #000;
    box-shadow: inset 4px 4px 0px rgba(0,0,0,0.1);
    font-family: 'VT323', monospace;
    font-weight: bold;
}

.pixel-btn-yellow {
    background-color: #ffca28;
    border: 4px solid #000;
    box-shadow: inset -4px -4px 0px rgba(0,0,0,0.2), 4px 4px 0px #000;
    transition: transform 0.1s, box-shadow 0.1s;
    font-weight: bold;
}
.pixel-btn-yellow:active {
    transform: translate(4px, 4px);
    box-shadow: inset -4px -4px 0px rgba(0,0,0,0.2), 0px 0px 0px #000;
}
