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

body {
    overflow: hidden;
    background: #0a0a0f;
    font-family: 'IBM Plex Mono', monospace;
    color: #e0e0e0;
    cursor: default;
    user-select: none;
}

#scene-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

#game-ui {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
}

#game-ui > * { pointer-events: auto; }

/* ========== START SCREEN ========== */
.start-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 80%, #0d1520 0%, #050508 70%);
    z-index: 100;
}

.title-container {
    text-align: center;
    margin-bottom: 40px;
}

.game-title {
    font-family: 'Creepster', cursive;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    color: #ff3344;
    text-shadow:
        0 0 20px rgba(255,51,68,0.6),
        0 0 60px rgba(255,51,68,0.3),
        0 0 100px rgba(255,51,68,0.15);
    letter-spacing: 4px;
    animation: titleFlicker 4s infinite;
    line-height: 1.1;
}

@keyframes titleFlicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.4; }
    94% { opacity: 1; }
    96% { opacity: 0.7; }
    97% { opacity: 1; }
}

.game-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    color: #667788;
    margin-top: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 280px;
}

.menu-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 32px;
    border: 2px solid;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: transparent;
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255,255,255,0.1);
}

.menu-btn.primary {
    border-color: #ff3344;
    color: #ff3344;
    background: rgba(255,51,68,0.08);
}
.menu-btn.primary:hover {
    background: rgba(255,51,68,0.2);
    box-shadow: 0 4px 30px rgba(255,51,68,0.3);
}

.menu-btn.secondary {
    border-color: #445566;
    color: #8899aa;
}
.menu-btn.secondary:hover {
    border-color: #667788;
    color: #aabbcc;
}

/* ========== HUD ========== */
.hud-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    font-size: 0.85rem;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-label {
    color: #556677;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-value {
    color: #44ff88;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(68,255,136,0.4);
    font-size: 0.9rem;
}

.hud-value.warning { color: #ffaa33; text-shadow: 0 0 10px rgba(255,170,51,0.4); }
.hud-value.danger { color: #ff3344; text-shadow: 0 0 10px rgba(255,51,68,0.4); animation: pulse 1s infinite; }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

.sanity-bar-container {
    width: 120px;
    height: 8px;
    background: #1a1a2e;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #2a2a3e;
}

.sanity-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s, background 0.5s;
}

.clock-display {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.1rem;
    color: #44ff88;
    text-shadow: 0 0 15px rgba(68,255,136,0.5);
}

/* ========== MEDICAL FILE ========== */
.medical-file {
    position: absolute;
    left: 16px;
    top: 70px;
    width: 300px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    background: #f5f0e0;
    border-radius: 4px;
    padding: 20px 18px 16px;
    box-shadow: 4px 4px 20px rgba(0,0,0,0.6);
    color: #2a2a2a;
    font-family: 'Patrick Hand', cursive;
    transform: rotate(-1deg);
    transition: opacity 0.3s;
}

.medical-file::before {
    content: '';
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 60px; height: 16px;
    background: #888;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.file-header {
    text-align: center;
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'IBM Plex Mono', monospace;
    margin-top: 12px;
    margin-bottom: 10px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 6px;
}

.file-portrait {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.file-portrait img {
    width: 128px;
    height: 128px;
    image-rendering: pixelated;
    border: 2px solid #999;
    border-radius: 2px;
    background: #ddd;
}

.file-field {
    margin: 8px 0;
    font-size: 1.15rem;
    line-height: 1.3;
}

.file-field .label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 2px;
}

.file-field .value {
    color: #1a1a1a;
}

.file-notes {
    margin-top: 12px;
    padding: 8px;
    background: #fffbe6;
    border-left: 3px solid #e8c840;
    font-style: italic;
    font-size: 1rem;
}

/* ========== CHECKLIST ========== */
.checklist-panel {
    position: absolute;
    right: 16px;
    top: 70px;
    width: 240px;
    background: #fff9c4;
    border-radius: 2px;
    padding: 16px 14px;
    box-shadow: 4px 4px 20px rgba(0,0,0,0.5);
    font-family: 'Patrick Hand', cursive;
    color: #2a2a2a;
    transform: rotate(1deg);
}

.checklist-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-align: center;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    font-size: 1.05rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(100,140,180,0.15);
    transition: background 0.15s;
}

.checklist-item:hover { background: rgba(0,0,0,0.04); }

.checklist-item.checked {
    text-decoration: line-through;
    color: #aaa;
}

.check-box {
    width: 18px; height: 18px;
    border: 2px solid #999;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.checklist-item.checked .check-box {
    background: #4caf50;
    border-color: #388e3c;
    color: white;
}

/* ========== DECISION BUTTONS ========== */
.decision-panel {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
}

.decision-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 16px 40px;
    border: 3px solid;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.15s;
    background: transparent;
}

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

.btn-admit {
    border-color: #44ff88;
    color: #44ff88;
    background: rgba(68,255,136,0.08);
}
.btn-admit:hover {
    background: rgba(68,255,136,0.2);
    box-shadow: 0 0 30px rgba(68,255,136,0.3);
}

.btn-reject {
    border-color: #ff3344;
    color: #ff3344;
    background: rgba(255,51,68,0.08);
}
.btn-reject:hover {
    background: rgba(255,51,68,0.2);
    box-shadow: 0 0 30px rgba(255,51,68,0.3);
}

/* ========== CONTROLS ========== */
.controls-bar {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.ctrl-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    padding: 8px 16px;
    border: 1px solid #334455;
    border-radius: 4px;
    background: rgba(20,30,40,0.8);
    color: #8899aa;
    cursor: pointer;
    transition: all 0.15s;
}

.ctrl-btn:hover {
    border-color: #556677;
    color: #bbccdd;
    background: rgba(30,45,60,0.9);
}

.ctrl-btn.active {
    border-color: #ffaa33;
    color: #ffaa33;
    background: rgba(255,170,51,0.1);
}

/* ========== RESULT SPLASH ========== */
.result-splash {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.result-splash.correct {
    background: rgba(0,40,20,0.85);
}

.result-splash.wrong {
    background: rgba(40,0,0,0.85);
    animation: fadeIn 0.3s, screenShake 0.5s;
}

@keyframes screenShake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-8px, 4px); }
    20% { transform: translate(6px, -6px); }
    30% { transform: translate(-4px, 8px); }
    40% { transform: translate(8px, -2px); }
    50% { transform: translate(-6px, 4px); }
}

.result-text {
    font-family: 'Creepster', cursive;
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 12px;
}

.result-text.correct { color: #44ff88; text-shadow: 0 0 30px rgba(68,255,136,0.5); }
.result-text.wrong { color: #ff3344; text-shadow: 0 0 30px rgba(255,51,68,0.5); }

.result-detail {
    font-size: 1rem;
    color: #aabbcc;
    max-width: 400px;
    text-align: center;
    line-height: 1.5;
}

/* ========== SHIFT SUMMARY ========== */
.shift-summary {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(5,5,10,0.95);
    z-index: 60;
}

.summary-card {
    background: #0d1520;
    border: 1px solid #1a2a3a;
    border-radius: 6px;
    padding: 30px 40px;
    min-width: 340px;
    max-width: 500px;
}

.summary-title {
    font-family: 'Creepster', cursive;
    font-size: 2rem;
    color: #ff3344;
    text-align: center;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #1a2a3a;
    font-size: 0.9rem;
}

.summary-row .label { color: #667788; }
.summary-row .value { color: #e0e0e0; font-weight: 700; }

.summary-stars {
    text-align: center;
    font-size: 2rem;
    margin: 16px 0;
    letter-spacing: 4px;
}

.missed-anomaly {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255,51,68,0.1);
    border: 1px solid rgba(255,51,68,0.3);
    border-radius: 4px;
    font-size: 0.8rem;
    color: #ff6677;
}

/* ========== GAME OVER ========== */
.game-over {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.95);
    z-index: 70;
}

.game-over-title {
    font-family: 'Creepster', cursive;
    font-size: clamp(2rem, 6vw, 4rem);
    color: #ff3344;
    text-shadow: 0 0 40px rgba(255,51,68,0.6);
    margin-bottom: 16px;
}

.game-over-subtitle {
    color: #667788;
    font-style: italic;
    margin-bottom: 30px;
}

/* ========== TUTORIAL OVERLAY ========== */
.tutorial-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5,5,10,0.92);
    z-index: 80;
}

.tutorial-card {
    background: #0d1520;
    border: 1px solid #1a2a3a;
    border-radius: 8px;
    padding: 30px 36px;
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.tutorial-title {
    font-family: 'Creepster', cursive;
    font-size: 1.8rem;
    color: #ff3344;
    text-align: center;
    margin-bottom: 20px;
}

.tutorial-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #1a2a3a;
    font-size: 0.9rem;
    line-height: 1.5;
}

.tutorial-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.tutorial-text { color: #aabbcc; }

/* ========== DIFFICULTY SELECTOR ========== */
.difficulty-selector {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    justify-content: center;
}

.diff-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    padding: 6px 14px;
    border: 1px solid #334455;
    border-radius: 3px;
    background: transparent;
    color: #667788;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.diff-btn:hover { border-color: #556677; color: #99aabb; }

.diff-btn.selected {
    border-color: #ff3344;
    color: #ff3344;
    background: rgba(255,51,68,0.1);
}

/* ========== SCARE EFFECTS ========== */
.scare-flash {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
}

.vignette-overlay {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
    transition: all 0.5s;
}

.static-overlay {
    position: fixed;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    opacity: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect width="4" height="4" fill="%23ffffff" opacity="0.03"/><rect x="1" y="1" width="1" height="1" fill="%23000000" opacity="0.1"/></svg>');
    mix-blend-mode: overlay;
    transition: opacity 0.3s;
}

/* ========== FOOTER ========== */
.footer-link {
    position: absolute;
    bottom: 8px;
    right: 16px;
    z-index: 10;
}

.footer-link a {
    color: #334455;
    text-decoration: none;
    font-size: 0.65rem;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.footer-link a:hover { color: #667788; }

/* ========== MOBILE WARNING ========== */
.mobile-notice {
    display: none;
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: #556677;
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .medical-file { 
        width: 220px; 
        padding: 14px 12px;
        font-size: 0.9rem;
        left: 8px;
        top: 55px;
    }
    .checklist-panel { 
        width: 180px; 
        right: 8px;
        top: 55px;
    }
    .decision-btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }
    .mobile-notice { display: block; }
    .controls-bar { bottom: 90px; }
}

@media (max-width: 480px) {
    .medical-file { display: none; }
    .checklist-panel { display: none; }
}

/* Scrollbar for medical file */
.medical-file::-webkit-scrollbar { width: 4px; }
.medical-file::-webkit-scrollbar-track { background: transparent; }
.medical-file::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }