* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
}

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000000;
    opacity: 1;
    transition: opacity 0.8s ease;
}

.game-container.fade-in {
    animation: fade-in 1s ease forwards;
}

.game-container.fade-out {
    animation: fade-out 0.5s ease forwards;
}

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

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

/* Button glitch effect animation */
@keyframes button-glitch {
    0% { opacity: 0; transform: translateX(0) skewX(0deg); }
    25% { opacity: 0.8; transform: translateX(-2px) skewX(1deg); }
    50% { opacity: 0.6; transform: translateX(2px) skewX(-1deg); }
    75% { opacity: 0.4; transform: translateX(-1px) skewX(0.5deg); }
    100% { opacity: 0; transform: translateX(0) skewX(0deg); }
}

.button-glitch-effect {
    border-radius: 50%;
    mix-blend-mode: screen;
}

.logo-container {
    position: absolute;
    top: -50px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 10; 
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 350px;
    height: auto;
}

.candle-container {
    position: absolute;
    bottom: 30px;
    right: 50px;
    z-index: 1; 
}

.candle {
    width: 220px;
    height: auto;
    filter: brightness(1);
}

.play-button-container {
    position: absolute;
    bottom: 40px;
    left: 50px;
    cursor: pointer;
    z-index: 10; 
}

.play-button {
    width: 300px;
    height: auto;
    filter: brightness(1);
    transition: filter 0.3s ease;
}

.play-button:hover {
    filter: brightness(0.65);
}

/* Screen transition overlay */
.screen-transition {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background-color: #000;
    opacity: 1;
    pointer-events: none;
    z-index: 1000;
    transition: height 1s ease-out;
}

.screen-transition.active {
    height: 100%;
    pointer-events: all;
}

/* Black screen after transition */
.black-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 999;
    display: none;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.black-screen.show {
    display: block;
}

/* Game screen (after transition) */
.game-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 1001; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
}

.game-screen.show {
    opacity: 1;
    visibility: visible;
}

/* New Pause Overlay Styles */
.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 5000;
    display: none; /* Initially hidden */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.pause-overlay.active {
    display: flex;
    opacity: 1;
}

.pause-message {
    font-family: 'Courier New', monospace;
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
    text-align: center;
    position: fixed;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    filter: blur(1px);
    animation: glitch-text 0.1s linear infinite;
}

@keyframes glitch-text {
    0% { 
        transform: translateX(-50%) translateY(0);
        text-shadow: 2px 2px 0px #ff0000, -2px -2px 0px #00ff00;
    }
    20% { 
        transform: translateX(-50%) translateY(-1px) translateX(1px);
        text-shadow: -2px 2px 0px #ff0000, 2px -2px 0px #00ff00;
    }
    40% { 
        transform: translateX(-50%) translateY(1px) translateX(-1px);
        text-shadow: 2px -2px 0px #ff0000, -2px 2px 0px #00ff00;
    }
    60% { 
        transform: translateX(-50%) translateY(-1px) translateX(1px);
        text-shadow: -2px -2px 0px #ff0000, 2px 2px 0px #00ff00;
    }
    80% { 
        transform: translateX(-50%) translateY(1px) translateX(-1px);
        text-shadow: 2px 2px 0px #ff0000, -2px -2px 0px #00ff00;
    }
    100% { 
        transform: translateX(-50%) translateY(0);
        text-shadow: 2px 2px 0px #ff0000, -2px -2px 0px #00ff00;
    }
}

.pause-countdown {
    font-family: 'Courier New', monospace;
    font-size: 48px;
    font-weight: bold;
    color: #ff0000;
    text-align: center;
    position: fixed;
    top: 70%;
    left: 50%;
    transform: translateX(-50%);
    filter: blur(1px);
    animation: countdown-glitch 0.1s linear infinite;
    text-shadow: 3px 3px 0px #ffffff, -3px -3px 0px #000000;
}

@keyframes countdown-glitch {
    0% { 
        transform: translateX(-50%) scale(1);
        color: #ff0000;
    }
    25% { 
        transform: translateX(-50%) scale(1.05) translateY(-2px);
        color: #ff3333;
    }
    50% { 
        transform: translateX(-50%) scale(0.98) translateY(2px);
        color: #cc0000;
    }
    75% { 
        transform: translateX(-50%) scale(1.02) translateY(-1px);
        color: #ff6666;
    }
    100% { 
        transform: translateX(-50%) scale(1);
        color: #ff0000;
    }
}

.paused {
    animation-play-state: paused !important;
}

/* Score screen (after death) */
.score-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: none;
    justify-content: flex-start;
    align-items: flex-start;
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
}

.score-screen.show {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.score-screen.fade-out {
    opacity: 0;
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 2rem;
    width: 100%;
    height: 100%;
    max-width: none;
    background-color: #000; 
    border: none;
    border-top: none;
    box-shadow: none;
    position: relative;
    font-family: 'Consolas', 'Courier New', monospace;
    text-align: left;
    overflow: auto;
}

.score-container::before {
    content: none;
}

.score-container::after {
    content: none;
}

.score-title {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    color: #ffffff;
    margin-bottom: 1rem;
    text-shadow: none;
    letter-spacing: 0px;
    text-align: left;
    align-self: flex-start;
    position: relative;
}

.score-title::after {
    content: "_";
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.score-text, .high-score-text {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 2.2rem;
    color: #ffffff;
    margin-bottom: 0.8rem;
    text-align: left;
    align-self: flex-start;
    min-height: 1.5rem;
    letter-spacing: 0px;
    font-weight: normal;
    text-shadow: none;
    padding-left: 0;
    white-space: pre-wrap;
    line-height: 1.2;
    max-width: 90%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.score-instruction {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 2.2rem;
    color: #aaaaaa;
    margin-top: 1.5rem;
    opacity: 0;
    animation: pulse 2s infinite;
    letter-spacing: 0;
    text-transform: none;
    position: relative;
    padding-left: 0;
}

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

/* Ripple effect container */
.ripple-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1001;
}

/* Ripple element styling */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 70%);
    transform: scale(0);
    animation: ripple-animation 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.round-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); 
    position: relative; 
    z-index: 1002; 
    pointer-events: auto;
}

.round-button-container.show {
    transform: scale(1);
}

.round-button {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: url('/Button Pressed.svg') no-repeat center center;
    background-size: contain;
    background-color: #222; 
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.15s ease, background-image 0.3s ease;
    box-shadow: none;
    position: relative;
    will-change: transform;
}

.round-button:hover {
    box-shadow: none; 
}

.round-button.pressed {
    transform: scale(0.95);
}

/* New style for green gradient on press during sickness */
.round-button.sickness-pressed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 0, 0.4) 0%, rgba(0, 150, 0, 0.6) 100%);
    mix-blend-mode: screen;
    opacity: 0.6;
    transition: opacity 0.1s ease;
}

.round-button.cancel-active {
    transform: scale(0.98);
    animation: cancel-pulse 0.5s ease-in-out 3;
}

.round-button.danger-active {
    animation: danger-glow 2s ease-in-out infinite;
    background-image: url('/RedPress (1).svg') !important;
    background-color: #990000; 
}

.round-button.danger-active:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 0, 0, 0.15); 
    border-radius: 50%;
    pointer-events: none;
}

@keyframes danger-glow {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.3); } 
    100% { filter: brightness(1); }
}

@keyframes cancel-pulse {
    0% { transform: scale(0.98); }
    50% { transform: scale(1.05); }
    100% { transform: scale(0.98); }
}

/* Win button expansion animation */
.round-button.win-expand {
    animation: win-button-expand 0.8s ease-out forwards;
}

@keyframes win-button-expand {
    0% { 
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% { 
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Win Effect with background green effect */
.win-overlay.background-effect {
    background: radial-gradient(circle at center, rgba(0, 255, 0, 0.15) 0%, rgba(0, 255, 0, 0.05) 50%, rgba(0, 0, 0, 0.85) 100%);
}

.win-overlay.background-effect .win-effect-container {
    animation: win-celebration-background 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes win-celebration-background {
    0%, 100% { 
        transform: translateX(0);
        filter: hue-rotate(0deg) brightness(1);
    }
    5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { 
        transform: translateX(-10px) translateY(-8px);
        filter: hue-rotate(120deg) brightness(1.2);
    }
    10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { 
        transform: translateX(10px) translateY(8px);
        filter: hue-rotate(240deg) brightness(1.1);
    }
}

.counter {
    font-family: 'Poppins', sans-serif;
    font-size: 72px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: none;
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
    user-select: none;
    letter-spacing: 0;
}

/* Entity styling */
.entity-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1010; 
}

.entity {
    position: absolute;
    width: 280px;  
    height: 280px; 
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: all; 
    z-index: 10000; 
    filter: brightness(0.9);
    cursor: none; 
    transform-style: flat;
    opacity: 1; 
    background-color: rgba(255, 0, 0, 0.01); 
}

/* Remove Eyes entity animation */
[data-type="eyes"] {
    display: none;
}

@keyframes entity-move {
    0% {
        transform: translateY(-50%) translateX(-300px) rotate(0deg);
        opacity: 0;
    }
    5% {
        opacity: 1;
        transform: translateY(-50%) translateX(-250px) rotate(0deg);
    }
    95% {
        opacity: 1;
        transform: translateY(-50%) translateX(calc(100vw + 250px)) rotate(0deg);
    }
    100% {
        transform: translateY(-50%) translateX(calc(100vw + 300px)) rotate(0deg);
        opacity: 0;
    }
}

/* Sickness entity specific styles */
.sickness-clone {
    animation-timing-function: linear !important;
    box-shadow: none !important; /* Remove ugly border */
    transition: filter 0.1s ease, box-shadow 0.1s ease;
}

/* Enhanced entity move animation for sickness (slower) */
@keyframes sickness-move {
    0% {
        transform: translateY(-50%) translateX(-300px) rotate(0deg);
        opacity: 0;
    }
    5% {
        opacity: 1;
        transform: translateY(-50%) translateX(-250px) rotate(0deg);
    }
    95% {
        opacity: 1;
        transform: translateY(-50%) translateX(calc(100vw + 250px)) rotate(0deg);
    }
    100% {
        transform: translateY(-50%) translateX(calc(100vw + 300px)) rotate(0deg);
        opacity: 0;
    }
}

/* New animation for right-to-left movement with mirror image */
@keyframes sickness-move-rtl {
    0% {
        transform: translateY(-50%) translateX(calc(100vw + 300px)) scaleX(-1);
        opacity: 0;
    }
    5% {
        opacity: 1;
        transform: translateY(-50%) translateX(calc(100vw + 250px)) scaleX(-1);
    }
    95% {
        opacity: 1;
        transform: translateY(-50%) translateX(-250px) scaleX(-1);
    }
    100% {
        transform: translateY(-50%) translateX(-300px) scaleX(-1);
        opacity: 0;
    }
}


/* Cancel message */
.cancel-message {
    position: fixed;
    top: 20%;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 2.2rem;
    color: #ff0000;
    z-index: 2000;
    pointer-events: none;
    animation: message-slide-in 0.5s ease forwards;
}

.cancel-message.fade-out {
    animation: message-fade-out 0.5s ease forwards;
}

@keyframes message-slide-in {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* Goal display */
.goal-display {
    display: none;
}

/* Game over container */
.game-over-container {
    display: none;
    visibility: hidden;
    opacity: 0;
}

.game-over-message, .restart-button {
    display: none;
}

/* Debug panel */
.debug-panel {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 300px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid #555;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    z-index: 2000;
    display: none;
}

.debug-panel h3 {
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #444;
}

.debug-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#debug-log {
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
    font-size: 12px;
}

#debug-log div {
    margin-bottom: 3px;
    border-bottom: 1px dotted #333;
}

/* Jumpscare Effect */
.jumpscare-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.jumpscare-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.jumpscare-overlay.fade-out {
    animation: jumpscare-fade-out 0.5s ease forwards;
}

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

.jumpscare-effect-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.jumpscare-effect {
    position: absolute;
    width: 120%; 
    height: 120%;
    object-fit: cover;
    top: -10%;
    left: -10%;
}

.jumpscare-skull {
    position: relative;
    width: 250px; 
    height: 250px; 
    transform: scale(0.1);
    z-index: 2001;
}

.jumpscare-overlay.active .jumpscare-effect-container {
    animation: intense-shake 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

.jumpscare-overlay.active .jumpscare-skull {
    animation: skull-big-zoom 0.8s ease forwards;
}

@keyframes intense-shake {
    0%, 100% { transform: translateX(0); }
    5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { transform: translateX(-15px) translateY(-10px); }
    10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { transform: translateX(15px) translateY(10px); }
}

@keyframes skull-big-zoom {
    0% { transform: scale(0.1); }
    70% { transform: scale(2.3); } 
    100% { transform: scale(1.8); } 
}

/* Win Effect */
.win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.win-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.win-overlay.fade-out {
    animation: win-fade-out 0.5s ease forwards;
}

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

.win-effect-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.win-effect {
    position: absolute;
    width: 120%; 
    height: 120%;
    object-fit: cover;
    top: -10%;
    left: -10%;
}

.win-icon {
    position: relative;
    width: 250px; 
    height: 250px; 
    transform: scale(0.1);
    z-index: 2001;
}

.win-overlay.active .win-effect-container {
    animation: win-celebration 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

.win-overlay.active .win-icon {
    animation: win-icon-zoom 0.8s ease forwards;
}

@keyframes win-celebration {
    0%, 100% { transform: translateX(0); }
    5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { transform: translateX(-10px) translateY(-8px); }
    10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { transform: translateX(10px) translateY(8px); }
}

@keyframes win-icon-zoom {
    0% { transform: scale(0.1); }
    70% { transform: scale(2.3); } 
    100% { transform: scale(1.8); } 
}

/* New win effect overlay styles */
.win-effect-overlay {
    position: absolute;
    width: 120%; 
    height: 120%;
    object-fit: cover;
    top: -10%;
    left: -10%;
    opacity: 0;
    z-index: 2002;
}

.win-overlay.active .win-effect-overlay {
    animation: win-effect-flare 1.5s ease-out forwards;
}

@keyframes win-effect-flare {
    0% {
        transform: scale(0.5);
        opacity: 0;
        filter: brightness(1.5);
    }
    30% {
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
        filter: brightness(1);
    }
}

/* Glitch Effect Styles - Doors Style */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.glitch-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Doors-style glitch layers */
.doors-glitch-layer1 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        transparent 0%,
        rgba(255, 0, 0, 0.1) 25%,
        transparent 50%,
        rgba(0, 255, 0, 0.1) 75%,
        transparent 100%
    );
    animation: doors-glitch-shift1 0.1s linear infinite;
    mix-blend-mode: screen;
}

.doors-glitch-layer2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.03) 2px,
        rgba(255, 255, 255, 0.03) 4px
    );
    animation: doors-glitch-shift2 0.15s linear infinite;
}

.doors-glitch-layer3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0, 255, 255, 0.05) 1px,
        rgba(0, 255, 255, 0.05) 3px
    );
    animation: doors-glitch-shift3 0.08s linear infinite;
}

.doors-glitch-static {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
    background-size: 50px 50px, 30px 30px, 70px 70px;
    animation: doors-static-noise 0.1s linear infinite;
    opacity: 0.4;
}

@keyframes doors-glitch-shift1 {
    0% { transform: translateX(0) translateY(0); }
    20% { transform: translateX(-2px) translateY(1px); }
    40% { transform: translateX(2px) translateY(-1px); }
    60% { transform: translateX(-1px) translateY(2px); }
    80% { transform: translateX(1px) translateY(-2px); }
    100% { transform: translateX(0) translateY(0); }
}

@keyframes doors-glitch-shift2 {
    0% { transform: translateX(0) skewX(0deg); }
    25% { transform: translateX(1px) skewX(0.5deg); }
    50% { transform: translateX(-1px) skewX(-0.5deg); }
    75% { transform: translateX(1px) skewX(0.3deg); }
    100% { transform: translateX(0) skewX(0deg); }
}

@keyframes doors-glitch-shift3 {
    0% { transform: translateY(0) scaleY(1); }
    33% { transform: translateY(-1px) scaleY(1.001); }
    66% { transform: translateY(1px) scaleY(0.999); }
    100% { transform: translateY(0) scaleY(1); }
}

@keyframes doors-static-noise {
    0% { opacity: 0.4; filter: brightness(1); }
    25% { opacity: 0.3; filter: brightness(1.1); }
    50% { opacity: 0.5; filter: brightness(0.9); }
    75% { opacity: 0.2; filter: brightness(1.05); }
    100% { opacity: 0.4; filter: brightness(1); }
}

/* Glitch Progress Bar */
.glitch-progress-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 200px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.glitch-progress-bar {
    width: 20px;
    height: 150px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #FFD700;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.glitch-progress-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #FFD700;
    transition: height 0.1s linear, background-color 0.3s ease;
    border-radius: 8px;
}

.glitch-time-text {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    color: #FFD700;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    background-color: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #FFD700;
}

/* Clean Glitch Progress Bar - Bottom Center */
.clean-glitch-progress-container {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 8px;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.clean-glitch-progress-bar {
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.clean-glitch-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
    transition: width 0.1s linear;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Intro screen styles */
.intro-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3001;
    opacity: 1;
    visibility: visible;
}

.intro-screen.fade-out {
    animation: fade-out 1s ease forwards;
}

.intro-logo {
    width: 600px;
    height: auto;
    opacity: 0;
    transition: opacity 1s ease;
}

.intro-logo.fade-in {
    opacity: 1;
}

.intro-logo.fade-out {
    opacity: 0;
}

.intro-copyright {
    position: absolute;
    bottom: 50px;
    font-family: 'Avid Web Bold', 'Poppins', sans-serif;
    font-size: 22px;
    color: #D4AF37;
    opacity: 0;
    transition: opacity 1s ease;
    text-align: center;
    font-weight: 600;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.intro-copyright.fade-in {
    opacity: 1;
}

.intro-copyright.fade-out {
    opacity: 0;
}

/* Mobile support for intro */
@media (max-width: 768px) {
    .intro-logo {
        width: 400px;
    }
    
    .intro-copyright {
        font-size: 16px;
        bottom: 30px;
        padding: 0 20px;
    }
    
    /* Mobile glitch progress bar */
    .clean-glitch-progress-container {
        width: 280px;
        bottom: 20px;
        height: 6px;
    }
}

@media (max-width: 480px) {
    .intro-logo {
        width: 300px;
    }
    
    .intro-copyright {
        font-size: 14px;
        padding: 0 15px;
    }
    
    .clean-glitch-progress-container {
        width: 240px;
        height: 5px;
    }
}

/* Mobile support styles */
@media (max-width: 768px) {
    .logo {
        width: 250px;
    }
    
    .logo-container {
        top: -30px;
        left: 10px;
    }
    
    .candle {
        width: 150px;
    }
    
    .candle-container {
        bottom: 20px;
        right: 20px;
    }
    
    .play-button {
        width: 200px;
    }
    
    .play-button-container {
        bottom: 30px;
        left: 20px;
    }
    
    .round-button {
        width: 180px;
        height: 180px;
    }
    
    .counter {
        font-size: 48px;
    }
    
    .score-text, .high-score-text {
        font-size: 1.8rem;
        max-width: 95%;
    }
    
    .score-container {
        padding: 1rem;
    }
    
    /* Mobile debug panel adjustments */
    .mc-debug-panel {
        font-size: 10px;
        max-width: 280px;
    }
    
    #mc-score-input {
        width: 50px;
        font-size: 10px;
    }
    
    /* Mobile glitch progress bar */
    .clean-glitch-progress-container {
        width: 280px;
        bottom: 20px;
    }
    
    .clean-glitch-progress-bar {
        height: 20px;
        border: 3px solid #FFD700;
    }
    
    /* Mobile entity sizing - reduced */
    .entity {
        width: 150px;
        height: 150px;
    }
    
    /* Mobile jumpscare and win effects - better sizing */
    .jumpscare-skull, .win-icon {
        width: 120px;
        height: 120px;
    }
    
    /* Mobile intro adjustments */
    .intro-logo {
        width: 250px;
    }
    
    .intro-copyright {
        font-size: 14px;
        bottom: 20px;
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .logo {
        width: 200px;
    }
    
    .candle {
        width: 120px;
    }
    
    .play-button {
        width: 160px;
    }
    
    .round-button {
        width: 150px;
        height: 150px;
    }
    
    .counter {
        font-size: 36px;
    }
    
    .score-text, .high-score-text {
        font-size: 1.4rem;
    }
    
    .clean-glitch-progress-container {
        width: 240px;
    }
    
    .entity {
        width: 120px;
        height: 120px;
    }
    
    /* Mobile intro adjustments for very small screens */
    .intro-logo {
        width: 200px;
    }
    
    .intro-copyright {
        font-size: 12px;
        padding: 0 10px;
    }
    
    /* Mobile jumpscare effects for very small screens */
    .jumpscare-skull, .win-icon {
        width: 100px;
        height: 100px;
    }
}

/* Touch-friendly hover states for mobile */
@media (hover: none) and (pointer: coarse) {
    .play-button:hover {
        filter: brightness(1);
    }
    
    .round-button:hover {
        box-shadow: none;
    }
    
    .play-button:active {
        filter: brightness(0.65);
        transform: scale(0.95);
    }
    
    .round-button:active {
        transform: scale(0.95);
    }
}

/* Prevent zoom on mobile inputs */
input[type="number"] {
    font-size: 16px;
}

/* Mobile-specific loading overlay */
@media (max-width: 768px) {
    .loading-spinner {
        width: 40px;
        height: 40px;
    }
    
    .loading-text {
        font-size: 14px;
    }
}

/* Minecraft-style debug panel */
.mc-debug-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    max-height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.2;
    padding: 5px;
    z-index: 10000;
    pointer-events: none;
    overflow-y: auto;
    white-space: nowrap;
    text-shadow: 1px 1px 0px #000000;
}

.mc-debug-fps {
    margin-bottom: 5px;
    font-weight: bold;
}

.mc-fps-value {
    color: #00ff00;
}

.mc-debug-section {
    margin-bottom: 10px;
}

.mc-debug-title {
    font-weight: bold;
    border-bottom: 1px solid #555555;
    margin-bottom: 2px;
    color: #3FA0FF;
}

.mc-debug-item {
    margin-left: 8px;
    line-height: 1.2;
}

.mc-clickable {
    pointer-events: auto;
    cursor: pointer;
    color: #AAFFAA;
}

.mc-clickable:hover {
    text-decoration: underline;
    color: #FFFFFF;
}

.mc-debug-log {
    max-height: 120px;
    overflow-y: auto;
    font-size: 11px;
    margin-left: 4px;
}

.mc-debug-log div {
    line-height: 1.1;
}

#mc-score-input {
    background: #444;
    color: #FFFFFF;
    border: 1px solid #666;
    width: 60px;
    pointer-events: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.mc-debug-item input {
    pointer-events: auto;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    color: white;
    font-family: 'Poppins', sans-serif;
}

.loading-overlay.fade-out {
    animation: fade-out 0.5s ease forwards;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top: 6px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 18px;
    letter-spacing: 2px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Debug panel score input styling */
#debug-controls input[type="number"] {
    background: #222;
    color: #0f0;
    border: 1px solid #444;
    padding: 3px;
}

#debug-controls button {
    background: #333;
    color: #0f0;
    border: 1px solid #444;
    cursor: pointer;
}

#debug-controls button:hover {
    background: #444;
}

img {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.play-button, .round-button {
    pointer-events: auto;
}

/* Low quality filter */
.low-quality {
    filter: contrast(0.75) saturate(0.6) blur(1px);
}

@font-face {
    font-family: 'Avid Web Bold';
    src: url('/Avid_web_bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}