body {
    margin: 0;
    overflow: hidden;
    background-color: #7d848e;
    font-family: 'Courier New', monospace;
    color: #ffffff;
}

/* --- START MENU OVERLAY --- */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #05070a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 100;
}

#start-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.03) 0px,
        rgba(255, 255, 255, 0.03) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 3;
}

#start-screen::after {
    content: "";
    position: absolute;
    inset: -10%;
    background:
        radial-gradient(ellipse 65% 46% at 15% 85%, rgba(190, 196, 202, 0.30), transparent 65%),
        radial-gradient(ellipse 60% 42% at 85% 25%, rgba(190, 196, 202, 0.24), transparent 65%),
        radial-gradient(ellipse 75% 50% at 50% 100%, rgba(190, 196, 202, 0.26), transparent 70%),
        radial-gradient(ellipse 55% 40% at 45% 45%, rgba(190, 196, 202, 0.14), transparent 60%);
    filter: blur(22px);
    animation: fog-drift 38s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

@keyframes fog-drift {
    0%   { transform: translate(-4%, 0%); }
    50%  { transform: translate(3%, -2%); }
    100% { transform: translate(-2%, 3%); }
}

@media (prefers-reduced-motion: reduce) {
    #start-screen::after { animation: none; }
}

/* Tape stretched across the whole screen, like a crime scene */
.tape-band {
    position: absolute;
    left: 50%;
    top: 40%;
    width: 170vw;
    transform: translate(-50%, -50%) rotate(-4deg);
    background: repeating-linear-gradient(45deg, #e8b73f 0 26px, #14171a 26px 52px);
    padding: 9px 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.65);
    pointer-events: none;
    z-index: 0;
}

.tape-band span {
    display: block;
    font-family: Impact, 'Arial Narrow Bold', 'Franklin Gothic Bold', sans-serif;
    font-size: clamp(13px, 2.3vw, 20px);
    letter-spacing: 3px;
    color: #14171a;
    white-space: nowrap;
    text-align: center;
}

@keyframes terminal-flicker {
    0%, 96%, 100% { opacity: 1; }
    97% { opacity: 0.85; }
    98% { opacity: 1; }
    99% { opacity: 0.92; }
}

.menu-card {
    position: relative;
    z-index: 2;
    background: #0a0f0a;
    border: 1px solid #3a4a3d;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 0 40px rgba(0,0,0,0.9), inset 0 0 60px rgba(255,179,71,0.03);
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    overflow: hidden;
    animation: terminal-flicker 7s infinite;
}

@media (prefers-reduced-motion: reduce) {
    .menu-card { animation: none; }
}

.corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #6b7a63;
}
.corner-tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.corner-tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.corner-bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.corner-br { bottom: -2px; right: -2px; border-left: none; border-top: none; }

h1 {
    font-family: Impact, 'Arial Narrow Bold', 'Franklin Gothic Bold', sans-serif;
    font-size: clamp(28px, 8vw, 40px);
    letter-spacing: 4px;
    margin: 4px 0 22px;
    color: #f1f4f6;
    text-shadow: 0 2px 0 #000, 0 0 22px rgba(255,255,255,0.08);
}

.controls-hint {
    display: flex;
    flex-wrap: wrap;
    font-size: 13px;
    color: #b9c4bb;
    background: #0e130e;
    border: 1px solid #232b23;
    padding: 14px 16px;
    margin-bottom: 20px;
    line-height: 1.7;
    text-align: left;
    column-gap: 24px;
    row-gap: 10px;
    box-sizing: border-box;
    width: 100%;
}

.controls-col {
    flex: 1 1 45%;
    white-space: nowrap;
}

.controls-label {
    display: block;
    font-size: 10px;
    letter-spacing: 2px;
    color: #6b7a63;
    margin-bottom: 4px;
}

.controls-note {
    flex: 1 1 100%;
    padding-top: 8px;
    border-top: 1px solid #232b23;
    font-size: 14px;
    color: #6b7a63;
    line-height: 1.6;
    white-space: normal;
}

.settings-block {
    margin-bottom: 20px;
}

.settings-row {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin-bottom: 12px;
    font-size: 12px;
    color: #b9c4bb;
}

.settings-row label {
    display: flex;
    justify-content: space-between;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.settings-row label span {
    color: #ffb347;
}

.settings-row input[type="range"] {
    width: 100%;
    accent-color: #ffb347;
}

@media (max-width: 480px), (max-height: 480px) {
    .menu-card {
        max-width: 94vw;
        padding: 20px 16px;
    }
    h1 {
        letter-spacing: 2px;
        margin-bottom: 16px;
    }
    .controls-hint {
        padding: 10px 12px;
        font-size: 12px;
    }
    .controls-col {
        flex: 1 1 100%;
        white-space: normal;
    }
    .tape-band {
        top: 32%;
    }
}

.btn {
    background: #0e130e;
    color: #ffb347;
    border: 1px solid #ffb347;
    padding: 12px 24px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 1px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    transition: background 0.15s, color 0.15s;
}
.btn::before { content: "> "; }

.btn:hover { background: #ffb347; color: #0a0f0a; }
a.btn { display: block; box-sizing: border-box; text-decoration: none; text-align: center; }
.btn-toggle { color: #b9c4bb; border-color: #4a5a4d; }
.btn-toggle.active { color: #7ee787; border-color: #7ee787; }
.btn-toggle.muted { color: #e57373; border-color: #e57373; }

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.4;
    z-index: 5;
}

#flashlight-hud {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(17, 22, 29, 0.8);
    border: 1px solid #4a5568;
    padding: 8px 16px;
    font-size: 12px;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 5;
    color: #ecc94b;
    display: none;
}

#journal-hud {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(17, 22, 29, 0.8);
    border: 1px solid #4a5568;
    padding: 8px 16px;
    font-size: 12px;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 5;
    color: #cbd5e0;
    display: none;
}

#audio-hud {
    position: absolute;
    bottom: 60px;
    left: 20px;
    background: rgba(17, 22, 29, 0.8);
    border: 1px solid #4a5568;
    padding: 8px 16px;
    font-size: 12px;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 5;
    color: #cbd5e0;
    display: none;
}

#interaction-prompt {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    padding: 8px 16px;
    border: 1px solid #aaa;
    font-size: 14px;
    display: none;
    z-index: 5;
}

/* --- END SCREEN OVERLAY --- */
#end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 90;
    transition: background 1.3s ease;
    pointer-events: none;
}

#end-screen.visible {
    display: flex;
    background: rgba(0, 0, 0, 0.97);
    pointer-events: all;
}

.end-card {
    max-width: 480px;
    max-height: 88vh;
    overflow-y: auto;
    text-align: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 1.1s ease 0.3s;
}

#end-screen.visible .end-card {
    opacity: 1;
}

.end-card h2 {
    font-size: 18px;
    letter-spacing: 4px;
    color: #e53e3e;
    margin-bottom: 18px;
}

.end-card p {
    font-size: 13px;
    color: #a0aec0;
    line-height: 1.7;
    margin-bottom: 14px;
    text-align: left;
}

.end-card .btn {
    margin-top: 10px;
}

/* --- PAUSE OVERLAY (distinct from the launch terminal) --- */
#pause-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 10, 0.82);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.pause-box {
    text-align: center;
    padding: 22px 40px;
    min-width: 240px;
    background: rgba(10, 15, 10, 0.92);
    border: 1px solid #3a4a3d;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

.pause-box h2 {
    font-size: 18px;
    letter-spacing: 5px;
    color: #e8ecef;
    margin: 0 0 18px;
}

/* --- JOURNAL OVERLAY STYLING --- */
#journal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 10, 0.88);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.journal-container {
    width: 85%;
    max-width: 800px;
    height: 82vh;
    background: #12161f;
    border: 2px solid #3a4454;
    padding: 30px;
    box-shadow: 0 0 50px rgba(0,0,0,0.95);
    display: flex;
    flex-direction: column;
}

.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2d3748;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.journal-header h2 {
    margin: 0;
    font-size: 20px;
    letter-spacing: 2px;
    color: #d1d5db;
}

.journal-progress {
    font-size: 12px;
    color: #718096;
}

.journal-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding-right: 15px;
}

/* --- ERA SCRAP STYLES --- */
.paper-scrap {
    padding: 22px 28px;
    box-shadow: 2px 4px 10px rgba(0,0,0,0.5);
    position: relative;
    line-height: 1.5;
}

/* 1950s: Yellowed, brittle, aged serif text */
.paper-50 {
    background-color: #d8c396;
    color: #3b2d18;
    font-family: "Georgia", "Times New Roman", serif;
    border: 1px solid #b39b6b;
    border-radius: 2px 8px 1px 5px;
    transform: rotate(-0.8deg);
    box-shadow: inset 0 0 20px rgba(115, 80, 25, 0.35), 3px 5px 12px rgba(0,0,0,0.6);
}

.paper-50::before {
    content: "RECOVERED DIARY SCRAP — 1950s";
    font-size: 10px;
    font-weight: bold;
    color: #6b532e;
    display: block;
    margin-bottom: 10px;
    border-bottom: 1px dashed #a38c5d;
    letter-spacing: 1px;
}

/* 1980s: Slightly consumed, typewriter font */
.paper-80 {
    background-color: #e5dfd3;
    color: #22252a;
    font-family: "Courier New", monospace;
    border-left: 5px solid #a39b88;
    transform: rotate(0.8deg);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.15), 3px 4px 8px rgba(0,0,0,0.5);
}

.paper-80::before {
    content: "RECOVERED JOURNAL PAGE — 1980s";
    font-size: 10px;
    font-weight: bold;
    color: #555;
    display: block;
    margin-bottom: 10px;
    border-bottom: 1px dashed #999;
    letter-spacing: 1px;
}

/* Modern (P): Crisp white sheet, clean sans-serif */
.paper-P {
    background-color: #ffffff;
    color: #1a202c;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 2px;
    transform: rotate(-0.3deg);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.paper-P::before {
    content: "NOTEBOOK ENTRY — PRESENT DAY";
    font-size: 10px;
    font-weight: bold;
    color: #2b6cb0;
    display: block;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    letter-spacing: 1px;
}

/* Final Foundation Report [REPORT] */
.paper-REPORT {
    background-color: #1a202c;
    color: #e2e8f0;
    font-family: "Courier New", monospace;
    border: 2px solid #e53e3e;
    box-shadow: 0 0 20px rgba(229, 62, 62, 0.3);
}

.paper-REPORT::before {
    content: "CLASSIFIED FOUNDATION DOCUMENT";
    font-size: 11px;
    font-weight: bold;
    color: #e53e3e;
    display: block;
    margin-bottom: 10px;
    border-bottom: 1px solid #e53e3e;
    letter-spacing: 2px;
}

.paper-REPORT blockquote {
    margin: 0;
    padding-left: 10px;
    border-left: 3px solid #e53e3e;
}

.empty-journal {
    text-align: center;
    color: #4a5568;
    margin-top: 100px;
    font-size: 14px;
}

/* --- SMALL SCREENS: journal / pause / end also get checked --- */
@media (max-width: 480px) {
    .journal-container {
        width: 94%;
        padding: 16px;
    }
    .pause-box {
        padding: 18px 24px;
        min-width: 200px;
    }
    .end-card {
        padding: 14px;
    }
}
