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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #111;
    touch-action: none;
}

#game-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #85A48B;
    overflow: hidden;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

#apng-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; overflow: hidden;
}

#corgi-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; overflow: hidden;
}

.apng-sprite {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
    will-change: transform;
}

#corgi-jump-overlay, #corgi-walk-overlay, #corgi-stand-overlay, #corgi-dive-overlay {
    position: absolute;
    top: 0; left: 0;
    display: none;
    pointer-events: none;
    will-change: transform;
}

.menu-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(141, 70, 69, 0.6);
    z-index: 10;
}

.menu-title {
    font-family: 'Monofett', monospace;
    font-size: 80px;
    color: #F7E3A9;
    text-shadow: 0 0 20px rgba(141, 70, 69, 0.8);
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.1;
}

.ui-box {
    font-family: 'Monofett', monospace;
    color: #8D4645;
    background: #F7E3A9;
    border: 4px solid #8D4645;
    border-radius: 10px;
    box-shadow: 5px 5px 0px #8D4645;
    text-align: center;
}

.menu-btn {
    font-size: 30px;
    padding: 12px 30px;
    margin: 10px;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.1s;
}

.menu-btn:hover { transform: scale(1.05); }

.dev-btn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.dev-btn-grid .menu-btn {
    margin: 0;
    font-size: 24px;
    padding: 10px 15px;
}

.score-display {
    position: absolute;
    bottom: 30px;
    right: 30px;
    font-size: 40px;
    padding: 10px 30px;
    z-index: 20;
    pointer-events: none;
    display: none;
}

.tutorial-score-display {
    position: absolute;
    bottom: 30px;
    right: 30px;
    font-size: 40px;
    padding: 10px 30px;
    z-index: 20;
    pointer-events: none;
    display: none;
}

.center-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 150px;
    padding: 20px 60px;
    z-index: 20;
    pointer-events: none;
    display: none;
}

#tutorial-msg-box {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 900px;
    font-size: 40px;
    padding: 30px;
    z-index: 50;
    display: none;
    pointer-events: none;
    line-height: 1.4;
}

#hud-health {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 20;
    display: none;
    gap: 10px;
}

@keyframes scanline-scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100vh; }
}

@keyframes pulse-op {
    0% { opacity: 0.8; } 50% { opacity: 1; } 100% { opacity: 0.8; }
}

.codec-scanlines {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    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% 6px, 3px 100%;
    pointer-events: none; z-index: 65;
    animation: scanline-scroll 10s linear infinite;
}

.codec-portrait {
    width: 350px; height: 350px; border: 6px solid #679481; object-fit: cover;
    animation: pulse-op 2s infinite;
    background: #000;
}

.codec-portrait.static {
    filter: grayscale(1) contrast(3) brightness(1.5);
    animation: pulse-op 0.1s infinite;
}

@keyframes spin-coin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

.bone-spin {
    animation: spin-coin 1.5s linear infinite;
    display: inline-block;
}

/* Scale all UI text elements with the game */
#game-wrapper .menu-title,
#game-wrapper .menu-btn,
#game-wrapper .ui-box,
#game-wrapper .score-display,
#game-wrapper .tutorial-score-display,
#game-wrapper .center-countdown,
#game-wrapper #tutorial-msg-box {
    transform-origin: top left;
}

/* ===== LEVEL 2 SURVIVAL HUD ===== */

/* Countdown timer shown bottom-right during Level 2 survival */
.survival-timer-display {
position: absolute;
bottom: 20px !important;
right: 20px !important;
top: auto;
left: auto;
transform: none;
font-size: 28px !important;
padding: 6px 16px !important;
line-height: 1 !important;
z-index: 20;
pointer-events: none;
display: none;
/* Nighttime color scheme — dark background with light text */
background: #0D1A2B;
border-color: #3A6B8C;
color: #A8D8F0;
box-shadow: 5px 5px 0px #1A3A5C, 0 0 18px rgba(80,160,220,0.4);
}

/* "SURVIVE" flash prompt — shown briefly at the start of Level 2 survival */
.survive-prompt-display {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 90px;
    padding: 20px 60px;
    z-index: 21;
    pointer-events: none;
    display: none;
    /* Bold danger styling */
    background: #568a7c;
    border-color: #DA6A5C;
    color: #F7E3A9;
    box-shadow: 6px 6px 0px #8D2020, 0 0 30px rgba(218,106,92,0.6);
    letter-spacing: 4px;
    white-space: nowrap;
}
/* CC survival timer UI color override START */
.survival-timer-display {
    background: #f7dfa2 !important;
    color: #8b3f42 !important;
    border-color: #8b3f42 !important;
    box-shadow: 6px 6px 0 rgba(95, 45, 48, 0.9), 0 0 18px rgba(247, 223, 162, 0.35) !important;
    text-shadow: 2px 2px 0 rgba(255, 245, 190, 0.75) !important;
}
/* CC survival timer UI color override END */

/* CC final compact Level 2 survival timer override */
.survival-timer-display,
.center-countdown.survival-timer-display,
#hud-countdown.survival-timer-display {
    position: absolute !important;
    right: 20px !important;
    bottom: 20px !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    font-size: 22px !important;
    line-height: 1 !important;
    padding: 4px 10px !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
}
