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

body {
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
}

.fas,
.far,
.fab {
    margin-right: 6px;
}

.overlay h1 .fas {
    color: #ffd700;
}

.flashlight-icon {
    vertical-align: middle;
    margin-right: 8px;
    animation: flashlightFadeIn 2s ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

@keyframes flashlightFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-10px);
        filter: drop-shadow(0 0 0px rgba(255, 215, 0, 0));
    }

    100% {
        opacity: 1;
        transform: translateX(0);
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    }
}

.instructions li .fas {
    width: 20px;
    text-align: center;
    color: #ffd700;
}

.instructions .stealth {
    color: #ff4488;
    font-weight: bold;
}

.instructions .danger {
    color: #ff4444;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

.hud-label .fas {
    margin-right: 4px;
}

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

#game-container canvas {
    display: block;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#start-screen {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8)), url('../assets/poster.png');
    background-size: cover;
    background-position: center;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

.overlay h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 200, 100, 0.8);
}

.overlay .subtitle {
    font-size: 1.2rem;
    color: #aaa;
    margin-bottom: 30px;
}

.instructions {
    text-align: left;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.instructions.minimal {
    background: rgba(255, 255, 255, 0.06);
    padding: 16px 18px;
}

.instructions.minimal ul {
    padding-left: 0;
}

.instructions.minimal li {
    margin: 6px 0;
    color: #ddd;
}

.instructions .micro-note {
    margin-top: 10px;
    color: #999;
    font-size: 0.85rem;
}

.instructions h3 {
    color: #ffd700;
    margin: 15px 0 10px 0;
    font-size: 1rem;
}

.instructions h3:first-child {
    margin-top: 0;
}

.instructions ul {
    list-style: none;
    padding-left: 10px;
}

.instructions li {
    margin: 8px 0;
    color: #ccc;
}

.instructions .stealth {
    color: #333;
    background: #111;
    padding: 2px 6px;
    border-radius: 3px;
    text-shadow: none;
}

.sound-notice {
    margin-bottom: 20px;
    color: #888;
    font-size: 0.9rem;
}

.sound-notice i {
    color: #ffd700;
}

button {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #000;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 200, 0, 0.5);
}

.hint {
    margin-top: 20px;
    color: #666;
    font-size: 0.9rem;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
}

.stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
}

#gameover-reason {
    font-size: 1.2rem;
    color: #ff6b6b;
    margin-top: 10px;
}

.button-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.button-row button {
    padding: 12px 25px;
    font-size: 1rem;
}

#score-submission {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.submit-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

#player-name {
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 180px;
    outline: none;
    transition: border-color 0.2s;
}

#player-name:focus {
    border-color: #ffd700;
}

#player-name::placeholder {
    color: #666;
}

#submit-score-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

#submit-score-btn:disabled {
    background: #444;
    cursor: not-allowed;
    transform: none;
}

#submit-status {
    margin-top: 10px;
    font-size: 0.9rem;
    min-height: 20px;
}

#submit-status.success {
    color: #4CAF50;
}

#submit-status.error {
    color: #ff6b6b;
}

.leaderboard-content {
    max-width: 450px;
}

#leaderboard-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    min-height: 200px;
}

#leaderboard-list .loading {
    text-align: center;
    color: #888;
    padding: 40px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    width: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
}

.leaderboard-rank.gold {
    color: #ffd700;
}

.leaderboard-rank.silver {
    color: #c0c0c0;
}

.leaderboard-rank.bronze {
    color: #cd7f32;
}

.leaderboard-info {
    flex: 1;
    text-align: left;
    padding-left: 10px;
}

.leaderboard-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
}

.leaderboard-details {
    font-size: 0.8rem;
    color: #888;
    margin-top: 3px;
}

.leaderboard-score {
    font-size: 1.3rem;
    font-weight: bold;
    color: #4CAF50;
}

.leaderboard-empty {
    text-align: center;
    color: #666;
    padding: 40px;
    font-style: italic;
}

#close-leaderboard-btn,
#leaderboard-btn,
#view-leaderboard-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* HUD */
#hud {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 30px;
    z-index: 50;
    pointer-events: none;
}

#hud.hidden {
    display: none;
}

.hud-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}

#battery-container {
    flex: 1;
    max-width: 300px;
}

#battery-bar {
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #444;
    border-radius: 10px;
    overflow: hidden;
}

#battery-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00ff00, #88ff00);
    transition: width 0.3s, background 0.3s;
    border-radius: 8px;
}

#battery-fill.medium {
    background: linear-gradient(90deg, #ffff00, #ff8800);
}

#battery-fill.low {
    background: linear-gradient(90deg, #ff4400, #ff0000);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

#battery-percent {
    font-size: 0.9rem;
    color: #fff;
    margin-left: 10px;
}

#score-container,
#time-container {
    text-align: center;
}

#score,
#time {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
}

#rescue-prompt {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 100, 0.9);
    color: #000;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.2rem;
    animation: bounce 0.5s infinite;
    pointer-events: none;
}

#rescue-prompt.hidden {
    display: none;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Near-miss vignette effect */
#vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
    opacity: 0;
    transition: opacity 0.1s;
    box-shadow: inset 0 0 150px 50px rgba(255, 0, 0, 0.8);
}

#vignette.active {
    opacity: 1;
    animation: vignette-flash 0.3s ease-out;
}

@keyframes vignette-flash {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Battery boost effect */
#battery-boost {
    position: fixed;
    top: 60px;
    left: 20px;
    background: rgba(0, 255, 100, 0.9);
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    z-index: 51;
    transition: opacity 0.2s, transform 0.2s;
}

#battery-boost.show {
    opacity: 1;
    transform: translateY(0);
    animation: boost-fade 1.5s ease-out forwards;
}

@keyframes boost-fade {
    0% {
        opacity: 1;
        transform: translateY(0);
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Falling overlay */
#falling-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 90;
    transition: opacity 0.1s;
}

/* Predator attack overlay */
#predator-attack {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(80, 0, 0, 0);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 95;
    pointer-events: none;
    transition: background 0.3s;
}

#predator-attack.active {
    background: rgba(80, 0, 0, 0.9);
}

#predator-attack .predator-icon {
    font-size: 8rem;
    color: #ff3333;
    animation: predator-shake 0.1s infinite;
    text-shadow: 0 0 30px #ff0000;
}

#predator-attack .predator-name {
    font-size: 3rem;
    font-weight: bold;
    color: #fff;
    margin-top: 20px;
    text-shadow: 0 0 20px #ff0000;
    animation: predator-pulse 0.2s infinite;
}

@keyframes predator-shake {

    0%,
    100% {
        transform: translateX(-5px) rotate(-2deg);
    }

    50% {
        transform: translateX(5px) rotate(2deg);
    }
}

@keyframes predator-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ─── Mobile Controls ─── */
#mobile-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 45;
}

#mobile-controls.hidden {
    display: none;
}

#joystick-container {
    position: absolute;
    bottom: 30px;
    left: 30px;
    pointer-events: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
}

#joystick {
    width: 140px;
    height: 140px;
    background: rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
}

#joystick-knob {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2));
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: transform 0.05s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#mobile-buttons {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: auto;
    z-index: 2;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* Flashlight toggle button */
#flashlight-toggle-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 200, 50, 0.5), rgba(255, 140, 0, 0.5));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.4);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    touch-action: manipulation;
    box-shadow: 0 4px 20px rgba(255, 200, 0, 0.3),
        inset 0 0 15px rgba(255, 255, 255, 0.1);
    transition: transform 0.1s, box-shadow 0.1s;
}

#flashlight-toggle-btn i {
    font-size: 1.6rem;
    margin: 0 0 4px 0;
    color: #ffd700;
}

#flashlight-toggle-btn .btn-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#flashlight-toggle-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 10px rgba(255, 200, 0, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
}

#flashlight-toggle-btn.off {
    background: linear-gradient(135deg, rgba(80, 80, 80, 0.5), rgba(50, 50, 50, 0.5));
    border-color: rgba(150, 150, 150, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.05);
}

#flashlight-toggle-btn.off i {
    color: #888;
}

#rescue-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 200, 100, 0.6), rgba(0, 150, 80, 0.6));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 255, 100, 0.4);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    touch-action: manipulation;
    box-shadow: 0 4px 20px rgba(0, 200, 100, 0.3),
        inset 0 0 15px rgba(255, 255, 255, 0.1);
    transition: transform 0.1s, box-shadow 0.1s;
}

#rescue-button i {
    font-size: 1.6rem;
    margin-bottom: 4px;
    margin-right: 0;
}

#rescue-button:active {
    transform: scale(0.92);
    background: linear-gradient(135deg, rgba(0, 255, 120, 0.7), rgba(0, 200, 100, 0.7));
    box-shadow: 0 2px 10px rgba(0, 255, 100, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
}

#look-area {
    position: absolute;
    top: 0;
    right: 0;
    width: 65%;
    bottom: 140px;
    height: auto;
    pointer-events: auto;
    touch-action: none;
    z-index: 1;
}

#look-area::before {
    content: "";
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), transparent);
    pointer-events: none;
}

/* Mobile Onboarding */
#mobile-onboarding {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    animation: fade-in 0.3s ease-out;
}

#mobile-onboarding.fade-out {
    animation: fade-out 0.3s ease-out forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.onboarding-content {
    text-align: center;
    padding: 30px;
    max-width: 320px;
}

.onboarding-content h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #ffd700;
}

.onboarding-tips {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.tip {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
}

.tip-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 140, 0, 0.2));
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    color: #ffd700;
    flex-shrink: 0;
}

.tip-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tip-text strong {
    color: #fff;
    font-size: 0.95rem;
}

.tip-text span {
    color: #999;
    font-size: 0.8rem;
}

#onboarding-dismiss {
    padding: 14px 40px;
    font-size: 1rem;
}

/* Crosshair */
#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 45;
}

/* Fullscreen Buttons */
#fullscreen-start-btn {
    background: linear-gradient(135deg, #555, #333);
    color: #fff;
}

#fullscreen-btn {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    cursor: pointer;
    z-index: 210;
    pointer-events: auto;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

#fullscreen-btn i {
    margin: 0;
}

#fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: scale(1.1);
}

#fullscreen-btn:active {
    transform: scale(0.92);
}

/* ─── Landscape orientation hint ─── */
#rotate-hint {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 999;
    gap: 16px;
}

#rotate-hint i {
    font-size: 3rem;
    color: #ffd700;
    animation: rotate-icon 2s ease-in-out infinite;
}

#rotate-hint p {
    font-size: 1.1rem;
    color: #ccc;
}

@keyframes rotate-icon {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(90deg);
    }
}

@media (max-width: 768px) and (orientation: portrait) {
    #rotate-hint {
        display: flex;
    }
}

/* ─── Mobile-specific adjustments ─── */
@media (max-width: 768px) {
    .overlay-content {
        padding: 20px;
        max-width: 90%;
    }

    .overlay h1 {
        font-size: 1.8rem;
    }

    .overlay .subtitle {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .instructions {
        padding: 12px;
        font-size: 0.85rem;
        margin-bottom: 20px;
    }

    .instructions.minimal {
        padding: 12px 14px;
    }

    .instructions.minimal li {
        margin: 4px 0;
        font-size: 0.85rem;
    }

    .instructions ul {
        padding-left: 5px;
    }

    .instructions .micro-note {
        font-size: 0.75rem;
        margin-top: 8px;
    }

    button {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .button-row {
        gap: 10px;
    }

    .button-row button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .stats {
        gap: 15px;
        margin: 20px 0;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    #gameover-reason {
        font-size: 1rem;
    }

    #score-submission {
        margin: 15px 0;
        padding: 12px;
    }

    #player-name {
        width: 140px;
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    #submit-score-btn {
        padding: 10px 15px;
        font-size: 0.8rem;
    }

    #hud {
        top: env(safe-area-inset-top, 8px);
        left: 10px;
        right: 10px;
        gap: 8px;
    }

    #battery-container {
        flex: 1;
        max-width: none;
    }

    #score-container,
    #time-container {
        flex: 0 0 auto;
    }

    .hud-label {
        font-size: 0.6rem;
        margin-bottom: 2px;
    }

    #score,
    #time {
        font-size: 1.2rem;
    }

    #battery-bar {
        height: 14px;
    }

    #battery-percent {
        font-size: 0.75rem;
    }

    #rescue-prompt {
        bottom: 150px;
        font-size: 1rem;
        padding: 10px 20px;
    }

    #look-area {
        width: 55%;
        top: 20px;
        bottom: 160px;
    }

    #look-area::before {
        inset: 10px;
    }

    #level-indicator {
        top: env(safe-area-inset-top, 8px);
        right: 10px;
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    #battery-boost {
        top: 55px;
        left: 10px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    #level-start-message {
        width: 90vw;
        height: 55vw;
        max-width: 400px;
        max-height: 260px;
    }

    .level-start-content {
        padding: 20px;
    }

    .level-start-content h2 {
        font-size: 1.4rem;
    }

    .level-start-content p {
        font-size: 0.8rem;
    }

    .level-badge {
        font-size: 0.65rem;
        padding: 3px 10px;
    }

    #machinery-accident .machinery-icon {
        font-size: 5rem;
    }

    #machinery-accident .machinery-text {
        font-size: 1.8rem;
    }

    .loading-spinner {
        font-size: 3rem;
    }

    .loading-content h2 {
        font-size: 1.5rem;
    }

    #rescue-feedback {
        font-size: 1.2rem;
        padding: 15px 30px;
    }

    .skip-button {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
        font-size: 0.8rem;
    }

    .click-prompt i {
        font-size: 3rem;
    }

    .click-prompt h2 {
        font-size: 1.8rem;
    }

    .click-prompt p {
        font-size: 0.95rem;
    }

    #predator-attack .predator-icon {
        font-size: 5rem;
    }

    #predator-attack .predator-name {
        font-size: 2rem;
    }
}

/* ─── Landscape mobile (the actual gameplay orientation) ─── */
@media (max-height: 500px) {
    #hud {
        top: 6px;
        left: 8px;
        right: 8px;
        gap: 6px;
    }

    .hud-label {
        font-size: 0.55rem;
        margin-bottom: 1px;
    }

    #battery-bar {
        height: 10px;
    }

    #battery-percent {
        font-size: 0.65rem;
    }

    #score,
    #time {
        font-size: 1rem;
    }

    #level-indicator {
        top: 6px;
        right: 8px;
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    #battery-boost {
        top: 40px;
        font-size: 0.7rem;
    }

    #joystick-container {
        bottom: 12px;
        left: 16px;
    }

    #joystick {
        width: 100px;
        height: 100px;
    }

    #joystick-knob {
        width: 40px;
        height: 40px;
    }

    #mobile-buttons {
        bottom: 12px;
        right: 16px;
        gap: 10px;
    }

    #flashlight-toggle-btn {
        width: 60px;
        height: 60px;
    }

    #flashlight-toggle-btn i {
        font-size: 1.2rem;
    }

    #flashlight-toggle-btn .btn-label {
        font-size: 0.55rem;
    }

    #rescue-button {
        width: 65px;
        height: 65px;
        font-size: 0.6rem;
    }

    #rescue-button i {
        font-size: 1rem;
    }

    #look-area {
        width: 60%;
        top: 0;
        bottom: 0;
    }

    #look-area::before {
        display: none;
    }

    #rescue-prompt {
        bottom: 90px;
        font-size: 0.9rem;
        padding: 8px 16px;
    }

    #level-start-message {
        width: 50vw;
        height: 60vh;
        max-width: 340px;
        max-height: 240px;
    }

    .level-start-content {
        padding: 15px;
    }

    .level-start-content h2 {
        font-size: 1.2rem;
        letter-spacing: 2px;
    }

    .overlay-content {
        padding: 15px;
        max-width: 85%;
    }

    .overlay h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .overlay .subtitle {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }

    .instructions {
        padding: 10px;
        font-size: 0.8rem;
        margin-bottom: 12px;
    }

    .stats {
        gap: 10px;
        margin: 12px 0;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    #score-submission {
        margin: 10px 0;
        padding: 8px;
    }

    .onboarding-content {
        padding: 15px;
        max-width: 300px;
    }

    .tip {
        padding: 10px;
        gap: 10px;
    }

    .tip-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    #fullscreen-btn {
        bottom: 10px;
        right: 10px;
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    #look-area {
        width: 50%;
        top: 10px;
        bottom: 170px;
    }

    #look-area::before {
        inset: 8px;
    }

    #joystick {
        width: 120px;
        height: 120px;
    }

    #joystick-knob {
        width: 48px;
        height: 48px;
    }

    #flashlight-toggle-btn {
        width: 68px;
        height: 68px;
    }

    #rescue-button {
        width: 85px;
        height: 85px;
        font-size: 0.7rem;
    }

    #rescue-button i {
        font-size: 1.3rem;
    }

    #joystick-container {
        bottom: 20px;
        left: 20px;
    }

    #mobile-buttons {
        bottom: 20px;
        right: 20px;
    }

    .onboarding-content {
        padding: 20px;
        max-width: 280px;
    }

    .tip {
        padding: 12px;
        gap: 12px;
    }

    .tip-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
}

/* Rescue Feedback */
#rescue-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: linear-gradient(135deg, rgba(0, 200, 100, 0.95), rgba(0, 150, 80, 0.95));
    color: #fff;
    padding: 20px 40px;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 40px rgba(0, 255, 100, 0.6),
        0 0 80px rgba(0, 255, 100, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#rescue-feedback i {
    margin-right: 10px;
    color: #fff;
}

#rescue-feedback.show {
    animation: rescue-pop 1.2s ease-out forwards;
}

@keyframes rescue-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }

    25% {
        transform: translate(-50%, -50%) scale(1);
    }

    75% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.9);
    }
}

/* Loading Screen */
#loading-screen {
    background: rgba(0, 0, 0, 0.95);
    z-index: 150;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-spinner {
    font-size: 4rem;
    color: #ffd700;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loading-content h2 {
    font-size: 2rem;
    color: #fff;
    margin: 0;
}

.loading-subtitle {
    color: #888;
    font-size: 1rem;
}

.loading-progress-bar {
    width: min(340px, 80vw);
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#loading-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ffd700, #ff8c00);
    transition: width 0.2s ease;
}

#loading-progress-label {
    margin-top: -8px;
    font-size: 0.9rem;
    color: #bbb;
}

/* Level Indicator */
#level-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700;
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

#level-indicator i {
    margin-right: 8px;
}

/* Level Start Message */
#level-start-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 600px;
    height: 400px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    text-align: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
}

#level-start-message::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -1;
    filter: brightness(0.7);
}

#level-start-message.level-1::before {
    background-image: url('../assets/level1.png');
}

#level-start-message.level-2::before {
    background-image: url('../assets/level2.png');
}

#level-start-message.level-3::before {
    background-image: url('../assets/level3.png');
}

#level-start-message.wave::before {
    background-image: url('../assets/poster.png');
}

#level-start-message.show {
    animation: level-poster-appear 4s ease-in-out forwards;
}

@keyframes level-poster-appear {
    0% {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.95);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    85% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -55%) scale(1.05);
    }
}

.level-start-content {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    padding: 40px;
    width: 100%;
}

.level-badge {
    display: inline-block;
    background: transparent;
    color: #ffd700;
    border: 1px solid #ffd700;
    padding: 4px 12px;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.level-start-content h2 {
    font-size: 2rem;
    color: #fff;
    margin: 0 0 5px 0;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.level-start-content p {
    font-size: 0.9rem;
    color: #ccc;
    margin: 0;
    font-weight: 400;
    font-style: italic;
    opacity: 0.8;
}

/* Machinery Accident Overlay */
#machinery-accident {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(80, 40, 0, 0);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 95;
    pointer-events: none;
    transition: background 0.3s;
}

#machinery-accident.active {
    background: rgba(80, 40, 0, 0.9);
}

#machinery-accident .machinery-icon {
    font-size: 8rem;
    color: #ff8800;
    animation: machinery-shake 0.1s infinite;
    text-shadow: 0 0 30px #ff6600;
}

#machinery-accident .machinery-text {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    margin-top: 20px;
    text-shadow: 0 0 20px #ff8800;
    animation: machinery-pulse 0.2s infinite;
}

@keyframes machinery-shake {

    0%,
    100% {
        transform: translateX(-5px) rotate(-2deg);
    }

    50% {
        transform: translateX(5px) rotate(2deg);
    }
}

@keyframes machinery-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Video Screen */
#video-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 120;
    display: flex;
    justify-content: center;
    align-items: center;
}

#video-screen.hidden {
    display: none;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-intro-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.skip-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 10px 20px;
    font-size: 0.9rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.skip-button:hover {
    background: rgba(255, 215, 0, 0.8);
    border-color: #ffd700;
    color: #000;
    transform: scale(1.05);
}

.skip-button i {
    margin-right: 5px;
}

/* Click to Start Screen */
#click-to-start-screen {
    background: rgba(0, 0, 0, 0.9);
    z-index: 130;
    cursor: pointer;
}

#click-to-start-screen.hidden {
    display: none;
}

.click-to-start-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.click-prompt {
    text-align: center;
    animation: pulse-click 2s ease-in-out infinite;
}

.click-prompt i {
    font-size: 4rem;
    color: #ffd700;
    margin-bottom: 20px;
    display: block;
}

.click-prompt h2 {
    font-size: 2.5rem;
    color: #fff;
    margin: 0 0 15px 0;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.click-prompt p {
    font-size: 1.1rem;
    color: #888;
    margin: 0;
}

@keyframes pulse-click {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}