body {
    background-color: #008080; /* Windows 95 Teal */
    font-family: "Comic Sans MS", "Chalkboard SE", sans-serif;
    overflow: hidden;
    margin: 0;
    padding: 0;
    user-select: none;
    cursor: default;
    transition: filter 0.1s;
}

#desktop {
    width: 100vw;
    height: 100vh;
    position: relative;
    background-image: url('data:image/svg+xml;utf8,<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><text x="10" y="30" font-size="20">🤡</text></svg>');
}

/* The WIN Button */
#win-btn {
    position: absolute;
    z-index: 10; /* Lower than popups */
    padding: 20px 40px;
    background: linear-gradient(to bottom, #ffd700, #ff8c00);
    border: 5px outset #fff;
    font-size: 24px;
    font-weight: bold;
    color: red;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 20px yellow;
    animation: pulse 0.5s infinite;
}

#win-btn:active {
    border-style: inset;
}

/* Popups */
.popup {
    position: absolute;
    background: #c0c0c0;
    border: 2px outset #fff;
    box-shadow: 10px 10px 0px #000;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    max-width: 400px;
    z-index: 100;
    animation: appear 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.popup-header {
    background: linear-gradient(90deg, #000080, #1084d0);
    color: white;
    padding: 2px 5px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.popup-header.active {
    background: linear-gradient(90deg, #ff0000, #ff8080);
}

.close-btn {
    background: #c0c0c0;
    border: 1px outset #fff;
    width: 16px;
    height: 16px;
    line-height: 14px;
    text-align: center;
    color: black;
    font-family: sans-serif;
    cursor: pointer;
    margin-left: 10px;
}

.close-btn:active {
    border-style: inset;
}

.popup-body {
    padding: 10px;
    text-align: center;
    color: black;
    font-size: 16px;
}

.popup-body img {
    max-width: 100%;
    height: auto;
    border: 2px solid black;
    margin-bottom: 5px;
}

.popup button.action-btn {
    margin-top: 10px;
    padding: 5px 15px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    background: #00ff00;
    border: 2px outset #fff;
}

/* Animations & Effects */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1); }
}

@keyframes appear {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.rainbow-text {
    background-image: linear-gradient(to left, violet, indigo, blue, green, yellow, orange, red);
    -webkit-background-clip: text;
    color: transparent;
    animation: rainbow 2s linear infinite;
}

@keyframes rainbow { 
    100% { background-position: 1000px 0; } 
}

/* Punishment Classes */
.screen-rotate {
    animation: spin 5s linear infinite;
}

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

.screen-invert {
    filter: invert(100%);
}

.cursor-huge {
    cursor: wait;
}

.shake {
    animation: shake 0.5s;
    animation-iteration-count: infinite;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.particle {
    position: absolute;
    pointer-events: none;
    z-index: 2000;
    font-weight: bold;
    user-select: none;
    will-change: transform;
    /* Use translate3d for hardware acceleration */
    transform: translate3d(0,0,0);
    animation: particle-physics 0.5s cubic-bezier(0.1, 0.5, 0.3, 1) forwards;
}

.particle-geom {
    width: 20px; /* Bigger */
    height: 20px;
    background: yellow;
    border: 2px solid black;
}

.particle-text {
    font-family: "Courier New", monospace;
    color: #0f0;
    background: #000;
    padding: 5px;
    font-size: 18px; /* Bigger */
    border: 2px solid lime;
}

@keyframes particle-physics {
    0% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate3d(var(--tx), var(--ty), 0) scale(1.5) rotate(360deg); opacity: 0; }
}

/* Removed Shockwaves */

.glitch-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 0, 255, 0.2); /* Reduced opacity */
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: overlay; /* Softer blend mode */
}

@keyframes glitch-anim {
    0% { opacity: 0.2; transform: translate(2px, 2px); }
    20% { opacity: 0.4; transform: translate(-2px, 5px); }
    40% { opacity: 0.1; transform: translate(-5px, -2px); }
    60% { opacity: 0.5; transform: translate(5px, 2px); }
    80% { opacity: 0.2; transform: translate(2px, -5px); }
    100% { opacity: 0; transform: translate(0, 0); }
}

.shake {
    animation: shake 0.5s;
    animation-iteration-count: infinite;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -1px) rotate(-0.5deg); }
    20% { transform: translate(-2px, 0px) rotate(0.5deg); }
    30% { transform: translate(2px, 1px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(0.5deg); }
    50% { transform: translate(-1px, 1px) rotate(-0.5deg); }
    60% { transform: translate(-2px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-0.5deg); }
    80% { transform: translate(-1px, -1px) rotate(0.5deg); }
    90% { transform: translate(1px, 1px) rotate(0deg); }
    100% { transform: translate(1px, -1px) rotate(-0.5deg); }
}

/* Destruction Animation */
.popup-destruct {
    animation: destruct 0.3s forwards ease-out;
    pointer-events: none;
}

@keyframes destruct {
    0% { transform: scale(1) rotate(0deg); opacity: 1; filter: hue-rotate(0deg); }
    50% { transform: scale(1.2) rotate(15deg); opacity: 0.8; filter: hue-rotate(90deg) invert(1); }
    100% { transform: scale(0) rotate(45deg); opacity: 0; }
}

/* HUD SYSTEM */
.hud-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #c0c0c0;
    border-bottom: 3px outset #fff;
    padding: 10px 20px;
    box-sizing: border-box;
    z-index: 10000;
    font-family: 'Courier New', monospace;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    color: #000;
    font-weight: bold;
}

.bar-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-text {
    font-size: 12px;
    padding: 2px 8px;
    background: #000;
    color: #0f0;
}

.progress-track {
    width: 100%;
    background: #444;
    border: 2px inset #fff;
    position: relative;
    height: 25px;
    box-sizing: border-box;
    overflow: hidden;
}

.main-track {
    height: 35px;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #004400, #00ff00);
    box-shadow: 0 0 10px #0f0;
}

.heat-track {
    background: #222;
    margin-top: 5px;
    height: 20px;
}

.target-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(0, 255, 0, 0.5);
    border-left: 2px solid #0f0;
    border-right: 2px solid #0f0;
    width: 20%;
    left: 40%;
    box-sizing: border-box;
}

.heat-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    background: #fff;
    border: 1px solid #000;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 8px #fff;
    z-index: 5;
}

.status-danger { color: #f00 !important; animation: blink 0.3s infinite; }
.status-warn { color: #ff0 !important; }

@keyframes blink {
    50% { opacity: 0.3; }
}

/* TRAP POPUPS */
.popup-trap {
    border: 4px solid #ff0000 !important;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.8) !important;
    z-index: 500 !important; /* Above others */
}

.popup-trap .popup-header {
    background: linear-gradient(90deg, #600, #f00) !important;
}

.popup-trap .popup-body {
    background: #ffe0e0;
}

.combo-text {
    position: fixed;
    color: yellow;
    font-size: 40px;
    font-weight: bold;
    pointer-events: none;
    z-index: 10001;
    text-shadow: 2px 2px #000;
    animation: floatUp 0.5s ease-out forwards;
}

@keyframes floatUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-100px); opacity: 0; }
}

.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% { opacity: 0; }
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #39ff14; /* Neon Green */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    font-family: monospace;
    text-align: center;
    padding: 20px;
    border: 15px solid #ff00ff; /* Acid Pink border */
    box-sizing: border-box;
    box-shadow: inset 0 0 100px #ff00ff, 0 0 50px #ff00ff;
}

.rules-container {
    background: rgba(0, 0, 0, 0.9) !important;
    padding: 25px;
    border: 4px solid #39ff14 !important;
    text-align: left;
    font-size: 20px;
    line-height: 1.6;
    max-width: 650px;
    box-shadow: 0 0 30px #39ff14, inset 0 0 15px #39ff14;
    color: #fff;
}

.rules-container p {
    margin: 10px 0;
    text-shadow: 0 0 5px #39ff14;
}

#start-btn {
    padding: 25px 70px !important;
    font-size: 32px !important;
    margin-top: 40px;
    cursor: pointer;
    background: #ff00ff !important;
    color: #fff !important;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border: 5px outset #39ff14 !important;
    text-shadow: 3px 3px #000;
    box-shadow: 0 0 40px #ff00ff;
    animation: pulse 1s infinite;
}

#start-btn:hover {
    background: #39ff14 !important;
    color: #000 !important;
    box-shadow: 0 0 60px #39ff14;
}
