/* ========================================
   Screen Overlay System (5-Layer UI)
   ======================================== */

.screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    z-index: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    pointer-events: none;
}

.screen-overlay.active {
    z-index: 100;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Special Case: Game Screen needs to show App Container */
#game-screen .app-container {
    width: 100%;
    height: 100%;
}

/* Full Screen Image Display */
.fullscreen-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

/* Full Screen Video Display */
.fullscreen-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Game Over Stats Container */
.gameover-stats-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    background: rgba(0, 0, 0, 0.9);
    padding: 60px 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 600px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
    animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gameover-result {
    font-size: 2.5rem;
    font-weight: bold;
    font-family: 'VT323', monospace;
    color: #fdfdca;
    text-shadow: 0 0 10px rgba(253, 253, 202, 0.5);
    margin-bottom: 20px;
}

.gameover-turn-count {
    font-size: 1.5rem;
    color: #fdfdca;
    font-family: 'VT323', monospace;
    margin-bottom: 30px;
}

.gameover-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.gameover-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: 'VT323', monospace;
    border: 2px solid #fdfdca;
    background: rgba(253, 253, 202, 0.1);
    color: #fdfdca;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(253, 253, 202, 0.5);
    box-shadow: 0 0 15px rgba(253, 253, 202, 0.2);
}

.gameover-btn:hover {
    background: rgba(253, 253, 202, 0.2);
    box-shadow: 0 0 25px rgba(253, 253, 202, 0.4);
    transform: translateY(-2px);
}

.gameover-btn:active {
    transform: translateY(0);
}

/* --- Tutorial Popup (Paper Style) --- */
.tutorial-container {
    background-image: url('../images/1.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 2200px;
    height: 1800px;
    /* Double size again */
    max-width: 95%;
    border: none;
    box-shadow: none;
    background-color: transparent;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 60px 80px;
    /* Safe area for text inside paper */
    box-sizing: border-box;
    transform: translateX(-40px);
    /* Adjust position left */
}

.tutorial-content-overlay {
    background: transparent;
    /* No overlay */
    padding: 0;
    color: #000000 !important;
    /* Force Black */
    font-family: 'Courier New', Courier, serif;
    /* Typewriter/Paper feel */
    text-shadow: none;
    border: none;
    backdrop-filter: none;
    text-align: center;
    width: 100%;
}

.tutorial-content-overlay h2 {
    margin: 0 0 20px 0;
    color: #8b0000;
    /* Blood Red Title */
    font-size: 2rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #5d4037;
    font-weight: bold;
    transform: rotate(-2deg);
    /* Slight handcrafted feel */
}

.tutorial-content-overlay ul {
    list-style: none;
    padding: 0;
    margin: 0;
    line-height: 1.8;
    text-align: left;
    display: inline-block;
    /* Center the block of left-aligned text */
}

.tutorial-content-overlay li {
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: bold;
}

/* Hide strong tags or make them just bolder */
.tutorial-content-overlay strong {
    color: #000;
    margin-right: 5px;
    text-decoration: underline;
}

.tutorial-content-overlay .key {
    display: inline-block;
    background: transparent;
    border: 2px solid #2a1a10;
    border-radius: 4px;
    padding: 0 6px;
    margin: 0 2px;
    font-family: inherit;
    font-size: 0.9em;
    color: #2a1a10;
    box-shadow: none;
    font-weight: 900;
}

.tutorial-btn {
    margin-top: 30px;
    width: auto;
    border-radius: 0;
    padding: 10px 40px;
    background: transparent;
    color: #8b0000;
    border: 3px solid #8b0000;
    font-family: 'Courier New', Courier, serif;
    font-weight: 900;
    font-size: 1.5rem;
    transform: rotate(2deg);
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.2s, color 0.2s, background 0.2s;
}

.tutorial-btn:hover {
    background: #8b0000;
    color: #fdfdca;
    transform: rotate(0deg) scale(1.1);
}

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