:root {
    --anim-snappy: cubic-bezier(0.4, 0, 0.2, 1);
    --anim-bouncy: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --anim-smooth: cubic-bezier(0.165, 0.84, 0.44, 1);
    --time-fast: 0.2s;
    --time-med: 0.4s;
}

.animate-pop {
    animation: pop var(--time-med) var(--anim-bouncy) forwards;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.animate-shake-mini {
    animation: shake-mini 0.2s var(--anim-snappy);
}

@keyframes shake-mini {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Simple Wires Animations */
.simple-wires .wire {
    transition: transform var(--time-fast) var(--anim-bouncy), box-shadow var(--time-fast) var(--anim-smooth);
    will-change: transform;
}

.simple-wires .wire:hover {
    transform: scale(1.03);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.simple-wires .wire-cut {
    opacity: 1 !important;
    pointer-events: none;
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.simple-wires .wire-cut::before,
.simple-wires .wire-cut::after {
    content: '';
    position: absolute;
    top: 0;
    height: 100%;
    width: 40%;
    background-color: inherit;
    border: 1px solid rgba(0,0,0,0.5);
    border-radius: 6px;
    transition: transform var(--time-med) var(--anim-bouncy);
}

.simple-wires .wire-cut::before {
    left: -14px;
    transform: translateX(-20px) rotate(-5deg);
    background-color: var(--wire-color);
}

.simple-wires .wire-cut::after {
    right: -14px;
    transform: translateX(20px) rotate(5deg);
    background-color: var(--wire-color);
}

/* Set wire colors as variables for the cut pieces */
.wire-red { --wire-color: #f00; }
.wire-blue { --wire-color: #00f; }
.wire-yellow { --wire-color: #ff0; }
.wire-white { --wire-color: #fff; }
.wire-black { --wire-color: #111; }

/* Global Module Entrance */
.module.start-animations {
    animation: modulePop var(--time-med) var(--anim-bouncy) both;
}

@keyframes modulePop {
    from { transform: scale(0.95); opacity: 0.8; }
    to { transform: scale(1); opacity: 1; }
}

.start-animations .wire-reveal {
    animation: wireReveal var(--time-med) var(--anim-bouncy) both;
}

@keyframes wireReveal {
    from { opacity: 0; transform: scale(0.5) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.module-status.disarmed {
    animation: ledBloom 0.5s var(--anim-bouncy) forwards;
}

@keyframes ledBloom {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; background-color: #00ff00; box-shadow: 0 0 10px #00ff00; }
}

.wire-strike {
    animation: wireStrike 0.2s var(--anim-snappy);
    background-color: #f00 !important;
}

@keyframes wireStrike {
    0% { transform: scale(1); }
    50% { transform: scale(1.1) translateX(5px); }
    100% { transform: scale(1); }
}

/* Screen Effects Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 4000; /* High, but under modals */
    box-shadow: inset 0 0 0 transparent;
    background-color: transparent;
    transition: box-shadow 0.3s, background-color 0.3s;
}

/* Strike Flash */
body.strike-flash::after {
    background-color: rgba(255, 0, 0, 0.4) !important;
    transition: none !important;
}

/* Strike Persistence */
body.strike-1::after {
    box-shadow: inset 0 0 50px rgba(255, 0, 0, 0.2);
}
body.strike-2::after {
    box-shadow: inset 0 0 120px rgba(255, 0, 0, 0.4);
}

/* Timer Animations */
body.time-60::after {
    animation: pulse-60 2s infinite;
}
body.time-30::after {
    animation: pulse-30 1s infinite;
}
body.time-15 {
    animation: shake 0.5s infinite;
}
body.time-15::after {
    animation: pulse-15 0.5s infinite;
    box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.6);
}

@keyframes pulse-60 {
    0%, 100% { background-color: rgba(255, 0, 0, 0.0); }
    50% { background-color: rgba(255, 0, 0, 0.05); }
}
@keyframes pulse-30 {
    0%, 100% { background-color: rgba(255, 0, 0, 0.05); box-shadow: inset 0 0 80px rgba(255, 0, 0, 0.3); }
    50% { background-color: rgba(255, 0, 0, 0.1); box-shadow: inset 0 0 120px rgba(255, 0, 0, 0.5); }
}
@keyframes pulse-15 {
    0%, 100% { background-color: rgba(255, 0, 0, 0.1); box-shadow: inset 0 0 120px rgba(255, 0, 0, 0.5); }
    50% { background-color: rgba(255, 0, 0, 0.2); box-shadow: inset 0 0 200px rgba(255, 0, 0, 0.8); }
}
@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 2px); }
    50% { transform: translate(2px, -2px); }
    75% { transform: translate(-2px, -2px); }
}

/* Base Styles */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    overflow-x: hidden;
}

#landing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    background-image: url('../pic/bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 5rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 15px;
    font-weight: 900;
    color: #fff; /* Bright white */
    text-shadow: 
        1px 1px 0px #444,
        2px 2px 0px #333,
        3px 3px 0px #222,
        4px 4px 0px #111,
        0 0 10px rgba(50, 50, 50, 0.8), /* Dark grey glow */
        0 0 20px rgba(50, 50, 50, 0.5);
    position: relative;
    display: inline-block;
    pointer-events: none;
}

/* Neon Inlay Effect */
.title-text {
    position: relative;
    color: #fff;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
    pointer-events: auto;
}

.main-title:hover .title-text::after {
    content: 'DihFUSE';
    visibility: visible;
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    color: #fff;
}

.subtitle {
    font-family: 'Courier New', Courier, monospace; /* Stencil substitute */
    font-size: 1.2rem;
    color: #98FF98; /* Mint green tactical look */
    letter-spacing: 4px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.bottom-text {
    color: #777; /* Metallic gray */
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.landing-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 4rem;
}

.main-roles {
    display: flex;
    gap: 2rem;
    position: relative;
    z-index: 100; /* Ensure top row is above lower rows for tooltips */
}

.gamemode-controls, .sub-controls {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 50;
}

.utility-controls {
    display: flex;
    justify-content: center;
    gap: 1.5rem; /* Space between utility buttons */
    position: relative;
    z-index: 10;
}

/* Tactical Button Theme (Matte Black Steel) - ONLY Landing Page Flow */
#landing-page button, #mute-btn, #credits-btn, .level-btn, .accept-btn, #fullscreen-btn {
    position: relative;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    cursor: pointer;
    letter-spacing: 2px;
    font-weight: bold;
    color: #eee;
    
    background: 
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.01) 0px,
            rgba(255, 255, 255, 0.01) 1px,
            transparent 1px,
            transparent 2px
        ),
        linear-gradient(
            to bottom,
            #2c2c2c 0%,
            #1a1a1a 15%,
            #0a0a0a 100%
        );
    
    border: 1px solid #333;
    border-top: 1px solid #555;
    border-radius: 4px;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        0 4px 10px rgba(0, 0, 0, 0.8),
        0 1px 0 rgba(255, 255, 255, 0.05);

    transition: all 0.2s var(--anim-snappy);
    z-index: 25;
}

#landing-page button:hover, #mute-btn:hover, #credits-btn:hover, .level-btn:hover, .accept-btn:hover, #fullscreen-btn:hover {
    background: 
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.02) 0px,
            rgba(255, 255, 255, 0.02) 1px,
            transparent 1px,
            transparent 2px
        ),
        linear-gradient(
            to bottom,
            #333 0%,
            #1f1f1f 15%,
            #0f0f0f 100%
        );
    color: #fff;
    border-color: #444;
    transform: translateY(-1px);
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 6px 15px rgba(0, 0, 0, 0.9);
}

#landing-page button:active, #mute-btn:active, #credits-btn:active, .level-btn:active, .accept-btn:active, #fullscreen-btn:active {
    transform: translateY(2px);
    background: #050505;
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 1),
        0 1px 2px rgba(255, 255, 255, 0.05);
}

#mute-btn, #fullscreen-btn {
    width: 48px;
    height: 48px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem; /* Icon size */
    text-transform: none; /* Crucial for Material Icons ligatures */
    font-family: 'Material Icons' !important;
}

/* Role Selection Hover Tooltips */
.main-roles button {
    position: relative;
}

.main-roles button::after {
    content: attr(data-desc);
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #111;
    color: #0f0;
    padding: 12px;
    border: 2px solid #555;
    border-radius: 5px;
    width: 250px;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: normal;
    text-transform: none;
    letter-spacing: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000; /* Increased to stay above all other buttons/rows */
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    font-weight: normal;
}

.main-roles button:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(5px);
}

button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    cursor: pointer;
    background-color: #333;
    color: white;
    border: 2px solid #555;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #555;
    border-color: #fff;
}

/* Manual Viewer */
#manual-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1000;
}

#manual-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#close-manual {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 500;
    justify-content: center;
    align-items: center;
}

/* Tactical Modal Theme */
.modal-content {
    background: 
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.005) 0px,
            rgba(255, 255, 255, 0.005) 1px,
            transparent 1px,
            transparent 2px
        ),
        linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    padding: 2.5rem;
    border: 3px solid #333;
    border-top: 3px solid #555;
    box-shadow: 0 20px 50px rgba(0,0,0,0.9), inset 0 1px 2px rgba(255,255,255,0.05);
    max-width: 80%;
    width: 650px;
    text-align: left;
    color: #ddd;
    animation: modalEntry 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalEntry {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Briefing Specific Styles */
.briefing-content {
    border: 3px solid #444;
    border-top: 3px solid #666;
}

.briefing-columns {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.brief-col {
    flex: 1;
}

.brief-col h3 {
    color: #fff;
    font-size: 1.1rem;
    letter-spacing: 1px;
    border-bottom: 2px solid #333;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.accept-btn {
    width: 100%;
    padding: 15px !important;
}

.phase-section {
    margin-bottom: 1.5rem;
}

.phase-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

.level-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.level-btn {
    width: 50px;
    height: 50px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#close-modal {
    margin-top: 1rem;
    float: right;
}

/* Game Mode Selection Styles */
.gamemode-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gamemode-option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s var(--anim-snappy);
    position: relative;
    overflow: hidden;
}

.gamemode-option:hover {
    background: rgba(0, 255, 0, 0.05);
    border-color: #0f0;
}

.gamemode-option input[type="radio"] {
    display: none;
}

.custom-radio {
    width: 22px;
    height: 22px;
    border: 2px solid #555;
    border-radius: 50%;
    margin-right: 20px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s var(--anim-bouncy);
}

.gamemode-option input[type="radio"]:checked + .custom-radio {
    border-color: #0f0;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.custom-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 12px;
    height: 12px;
    background-color: #0f0;
    border-radius: 50%;
    transition: transform 0.2s var(--anim-bouncy);
    box-shadow: 0 0 8px #0f0;
}

.gamemode-option input[type="radio"]:checked + .custom-radio::after {
    transform: translate(-50%, -50%) scale(1);
}

.option-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.option-title {
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: #eee;
    transition: color 0.2s;
}

.option-desc {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
}

.gamemode-option input[type="radio"]:checked ~ .option-info .option-title {
    color: #0f0;
}

/* Selected option highlight animation */
.gamemode-option input[type="radio"]:checked ~ .option-info {
    animation: slideRight 0.3s var(--anim-snappy);
}

@keyframes slideRight {
    0% { transform: translateX(0); }
    50% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

/* AI Config Styles */
.tactical-input {
    width: 100%;
    padding: 15px;
    background-color: #111;
    border: 2px solid #444;
    color: #0f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.tactical-input:focus {
    outline: none;
    border-color: #0f0;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

/* In-Game Styles */
#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
}

#main-game-area {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 1100px; /* Accommodate both info panel and bomb */
}

#info-panel {
    width: 250px;
    min-height: 400px;
    background-color: #222;
    border: 5px solid #444;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 6000; /* Higher than start-overlay (5000) */
}

#info-panel h2 {
    color: #0f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

#info-content {
    color: #888;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Bomb Shell UI */
#bomb-container {
    position: relative;
    width: 100%;
    max-width: 750px;
    background-color: #333;
    border: 10px solid #222;
    padding: 15px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#bomb-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #000;
    padding: 5px 15px;
    border: 2px solid #444;
    margin-bottom: 15px;
    min-height: 70px;
}

#timer-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 2.5rem;
    color: #ff0000;
    text-shadow: 0 0 10px #ff0000;
}

#strike-display {
    display: flex;
    gap: 10px;
    align-items: center;
}

.strike-cross {
    font-size: 2.2rem;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    transition: all 0.3s var(--anim-bouncy);
}

.strike-cross.fainted {
    color: #400; /* Slightly brighter dark red */
    opacity: 0.5; /* Increased from 0.3 */
}

.strike-cross.lit {
    color: #ff0000;
    text-shadow: 0 0 15px #ff0000;
    opacity: 1;
    animation: strikePop 0.4s var(--anim-bouncy);
}

@keyframes strikePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

.strike-shake {
    animation: strikeShake 0.5s var(--anim-snappy);
}

@keyframes strikeShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.strike-flash {
    animation: flash 0.5s ease;
}

@keyframes flash {
    0% { background-color: rgba(255, 0, 0, 0); }
    50% { background-color: rgba(255, 0, 0, 0.3); }
    100% { background-color: rgba(255, 0, 0, 0); }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

/* ... existing styles ... */

/* Bomb Faces Container */
#bomb-faces {
    background-color: #444;
    border: 5px solid #222;
    position: relative;
    padding: 15px;
    min-height: 400px;
}

/* Individual Face Grid */
.bomb-face {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    height: 100%;
}

.module-slot {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #333;
    border: 2px inset #222;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    z-index: 5; /* Ensure modules are above the face background */
}

/* Module Common Styles */
.module {
    width: 100%;
    height: 100%;
    background-color: #555;
    border: 5px solid #333;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
}

/* Module Cover (Obfuscation Mechanic) */
.module-cover {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #111;
    z-index: 50; 
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem; /* Reduced slightly for longer names */
    text-align: center; /* Center multi-line text */
    padding: 15px; /* Add padding to prevent text hitting edges */
    line-height: 1.2;
    font-weight: bold;
    color: #0f0; /* Terminal green */
    cursor: pointer;
    border: 3px solid #333;
    transition: opacity 0.3s ease, border-color 0.2s ease;
    box-sizing: border-box;
    overflow: hidden;
}

.module-cover:hover {
    background-color: #222;
    border-color: #0f0;
    box-shadow: inset 0 0 15px rgba(0,255,0,0.2);
}

.module-cover.revealed {
    opacity: 0;
    pointer-events: none; 
}


.module-status {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    background-color: #330000;
    border: 1px solid #000;
}

.module-status.disarmed {
    background-color: #00ff00;
    box-shadow: 0 0 5px #00ff00;
}

#view-indicator {
    background-color: #000;
    color: #0f0;
    padding: 5px 15px;
    border: 1px solid #444;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

/* Navigation Buttons */
.nav-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.nav-btn {
    padding: 10px 15px;
    background-color: #333;
    border: 2px solid #555;
    color: white;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    background-color: #555;
    border-color: #fff;
}

.nav-btn.btn-up { grid-column: 2; grid-row: 1; }
.nav-btn.btn-left { grid-column: 1; grid-row: 2; }
.nav-btn.btn-front { grid-column: 2; grid-row: 2; background-color: #444; }
.nav-btn.btn-right { grid-column: 3; grid-row: 2; }
.nav-btn.btn-down { grid-column: 2; grid-row: 3; }

/* Edgework Styles */
.edgework-item {
    padding: 20px;
    border: 1px solid #555;
    background-color: #222;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    grid-column: 1 / span 3;
    grid-row: 1 / span 2;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

#edgework-sn {
    font-size: 2rem;
    font-weight: bold;
    color: #ddd;
    margin-bottom: 10px;
}

#edgework-batteries {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.battery {
    width: 25px;
    height: 55px;
    background-color: #111; /* Black body */
    border: 1px solid #000;
    position: relative;
    border-radius: 2px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    margin-top: 8px; /* Space for the nub */
}

/* Copper Top */
.battery::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 35%;
    background: linear-gradient(to right, #b87333, #ffb86c, #b87333); 
    border-bottom: 1px solid #000;
    border-radius: 1px 1px 0 0;
}

/* Silver Terminal Nub */
.battery::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 6px;
    background: linear-gradient(to right, #888, #fff, #888);
    border: 1px solid #444;
    border-radius: 2px 2px 0 0;
}

#edgework-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.indicator {
    padding: 5px 12px;
    border: 2px solid #444;
    font-size: 1.1rem;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    background-color: #000;
    color: #555; /* Dimmer for unlit */
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 2px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.indicator-led {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #111;
    border: 1px solid #333;
}

.indicator.lit {
    color: #fff;
    border-color: #777;
}

.indicator.lit .indicator-led {
    background-color: #fff;
    border-color: #fff;
    box-shadow: 0 0 10px #fff;
}

/* Simple Wires Styles */
.simple-wires .wire-container {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 85%;
    width: 90%;
}

.wire {
    height: 12px;
    width: 100%;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.5);
    position: relative;
    border-radius: 6px;
}

.wire::before, .wire::after {
    content: '';
    position: absolute;
    top: -4px;
    width: 14px;
    height: 20px;
    background-color: #222;
    border: 1px solid #000;
}
.wire::before { left: -14px; }
.wire::after { right: -14px; }

.wire-red { background-color: #f00; }
.wire-blue { background-color: #00f; }
.wire-yellow { background-color: #ff0; }
.wire-white { background-color: #fff; }
.wire-black { background-color: #111; }

.wire-cut {
    opacity: 0;
    pointer-events: none;
}

/* The Button Styles */
.the-button .button-element {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 10px solid rgba(0,0,0,0.2);
    box-shadow: 0 6px 0 rgba(0,0,0,0.4), 0 10px 20px rgba(0,0,0,0.3);
    transition: transform var(--time-fast) var(--anim-bouncy), box-shadow var(--time-fast) var(--anim-bouncy);
    user-select: none;
}

.start-animations .the-button .button-element {
    animation: keypadReveal 0.5s var(--anim-bouncy) both;
}

.the-button .button-element:active, .the-button .button-element.pressed {
    transform: scale(0.92) translateY(4px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.4), 0 5px 10px rgba(0,0,0,0.3);
}

.button-element.blue { background-color: #00f; }
.button-element.white { background-color: #fff; color: #000; }
.button-element.yellow { background-color: #ff0; color: #000; }
.button-element.red { background-color: #f00; }

.button-label {
    font-weight: bold;
    font-size: 1rem;
    pointer-events: none;
    transition: opacity var(--time-fast);
}

.the-button .button-element.holding .button-label {
    animation: labelPulse 1s infinite alternate var(--anim-smooth);
}

@keyframes labelPulse {
    from { opacity: 0.6; filter: brightness(0.8); }
    to { opacity: 1; filter: brightness(1.2); }
}

.indicator-strip {
    display: none;
    width: 15px;
    height: 60px;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid #222;
    z-index: 10;
}

.indicator-strip.show {
    display: block;
    animation: stripReveal 0.4s var(--anim-bouncy) both;
}

@keyframes stripReveal {
    from { transform: translateY(-50%) translateX(20px); opacity: 0; }
    to { transform: translateY(-50%) translateX(0); opacity: 1; }
}

.indicator-strip.glow {
    animation: stripGlow 1s infinite alternate var(--anim-smooth), stripReveal 0.4s var(--anim-bouncy) both;
}

@keyframes stripGlow {
    from { box-shadow: 0 0 5px currentColor; }
    to { box-shadow: 0 0 15px currentColor; }
}

/* Keypads Styles */
.keypads .keypad-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
}

.keypad-btn {
    width: 60px;
    height: 60px;
    background-color: #ddd;
    border: 3px solid #999;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 #666;
    transition: transform var(--time-fast) var(--anim-bouncy), box-shadow var(--time-fast) var(--anim-bouncy), background-color var(--time-fast);
    position: relative;
    user-select: none;
}

.keypad-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #666;
}

.keypad-btn.pressed {
    background-color: #0f0;
    box-shadow: 0 2px 0 #080, 0 0 15px rgba(0, 255, 0, 0.5);
    transform: translateY(2px);
    animation: pop var(--time-med) var(--anim-bouncy);
}

.keypad-btn.error {
    background-color: #f00 !important;
    box-shadow: 0 2px 0 #800 !important;
    animation: shake-mini 0.2s var(--anim-snappy);
}

.keypad-btn.success-pulse {
    animation: successPulse 0.5s var(--anim-smooth) alternate 2;
}

@keyframes successPulse {
    from { filter: brightness(1); box-shadow: 0 0 15px rgba(0, 255, 0, 0.5); }
    to { filter: brightness(1.5); box-shadow: 0 0 25px rgba(0, 255, 0, 0.8); }
}

.start-animations .keypad-reveal {
    animation: keypadReveal 0.4s var(--anim-bouncy) both;
}

@keyframes keypadReveal {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.symbol-icon {
    font-size: 1.8rem;
    color: #000;
    transition: color var(--time-fast);
}

.keypad-btn.pressed .symbol-icon {
    color: #fff;
    text-shadow: 0 0 5px #fff;
}

/* Simon Says Styles */
.simon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    width: 80%;
    height: 80%;
    transition: transform var(--time-fast) var(--anim-snappy);
}

.simon-grid.error {
    animation: shake 0.4s var(--anim-snappy);
}

.simon-btn {
    border: 4px solid #222;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s var(--anim-smooth), transform 0.1s var(--anim-snappy), box-shadow 0.2s var(--anim-smooth), filter 0.2s;
    will-change: transform, opacity, box-shadow;
    position: relative;
}

.simon-btn:active {
    transform: scale(0.94);
    filter: brightness(0.7);
}

.simon-btn.red { background-color: #f00; border-top-left-radius: 100%; }
.simon-btn.blue { background-color: #00f; border-top-right-radius: 100%; }
.simon-btn.green { background-color: #0f0; border-bottom-left-radius: 100%; }
.simon-btn.yellow { background-color: #ff0; border-bottom-right-radius: 100%; }

.simon-btn.active {
    opacity: 1;
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 0 30px white, inset 0 0 20px white;
    filter: brightness(1.2);
}

.simon-btn.victory-pulse {
    animation: victoryPulse 0.4s var(--anim-bouncy) both;
}

@keyframes victoryPulse {
    0% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 20px white; }
    100% { opacity: 1; transform: scale(1); box-shadow: none; }
}

.start-animations .simon-reveal {
    animation: simonReveal 0.5s var(--anim-bouncy) both;
}

@keyframes simonReveal {
    from { opacity: 0; transform: scale(0) rotate(-45deg); }
    to { opacity: 0.4; transform: scale(1) rotate(0deg); }
}

/* Who's on First Styles */
.whos-on-first {
    padding: 10px;
}

.wof-display {
    background-color: #000;
    color: #0f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    padding: 8px;
    width: 85%;
    text-align: center;
    border: 2px solid #444;
    margin-bottom: 8px;
    min-height: 1.2rem;
    position: relative;
    overflow: hidden;
    animation: terminalFlicker 2s infinite;
}

@keyframes terminalFlicker {
    0%, 100% { opacity: 1; }
    33% { opacity: 0.95; }
    66% { opacity: 0.98; }
    70% { opacity: 0.94; }
}

.wof-display::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.wof-display.glitch {
    animation: glitch 0.2s var(--anim-snappy) infinite;
    color: #f00;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

.wof-display.success-flash {
    animation: successFlash 0.5s var(--anim-smooth);
}

@keyframes successFlash {
    0% { background-color: #000; }
    50% { background-color: #040; box-shadow: inset 0 0 20px #0f0; }
    100% { background-color: #000; }
}

.wof-button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
    gap: 5px;
    width: 95%;
}

.wof-btn {
    padding: 6px 2px;
    font-size: 0.6rem;
    background-color: #ccc;
    color: #000;
    border: 2px solid #888;
    box-shadow: 0 2px 0 #666;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.1s var(--anim-snappy), box-shadow 0.1s var(--anim-snappy), background-color 0.2s;
    user-select: none;
}

.wof-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #666;
    background-color: #aaa;
}

.start-animations .wof-reveal {
    animation: wofReveal 0.4s var(--anim-bouncy) both;
}

@keyframes wofReveal {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* Memory Styles */
.memory {
    padding: 10px;
    justify-content: space-between;
}

.memory-display {
    background-color: #000;
    color: #f00;
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    padding: 1px 25px;
    border: 2px solid #444;
    margin-bottom: 5px;
    box-shadow: inset 0 0 10px rgba(255,0,0,0.2);
    animation: displayPowerUp 0.3s var(--anim-snappy) both;
}

@keyframes displayPowerUp {
    0% { opacity: 0; filter: brightness(2); }
    20% { opacity: 1; filter: brightness(1); }
    40% { opacity: 0.5; }
    60% { opacity: 1; }
    100% { opacity: 1; }
}

.memory-button-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 3px;
    margin-bottom: 0px;
}

.memory-btn {
    height: 35px;
    width: 35px;
    font-size: 1rem;
    font-weight: bold;
    background-color: #444444;
    border: 2px solid #999;
    box-shadow: 0 4px 0 #222;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s var(--anim-snappy), box-shadow 0.1s var(--anim-snappy), background-color 0.2s;
    user-select: none;
}

.memory-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #222;
    background-color: #333;
}

.memory-reveal {
    animation: keypadReveal 0.4s var(--anim-bouncy) both;
}

.memory-stages {
    display: flex;
    gap: 8px;
    padding: 5px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #300;
    border: 1px solid #000;
    transition: background-color 0.3s var(--anim-smooth), box-shadow 0.3s var(--anim-smooth);
}

.stage-dot.active {
    background-color: #f00;
    box-shadow: 0 0 8px #f00;
    animation: pop 0.4s var(--anim-bouncy);
}

.stage-dot.reset {
    animation: shake-mini 0.2s var(--anim-snappy);
    background-color: #f00;
}

/* Morse Code Styles */
.morse-code {
    padding: 10px;
    justify-content: space-around;
    position: relative;
}

.morse-replay {
    position: absolute;
    top: 5px;
    right: 25px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background-color: #333;
    color: white;
    border: 1px solid #777;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
    transition: background-color 0.2s, transform 0.2s var(--anim-bouncy);
}

.morse-replay:hover {
    background-color: #666;
    transform: rotate(45deg);
}

.morse-light {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: #330;
    border: 3px solid #111;
    margin-bottom: 5px;
    transition: background-color 0.1s, transform 0.2s var(--anim-smooth), box-shadow 0.1s;
    will-change: transform, box-shadow, background-color;
}

.morse-light.lit {
    background-color: #ff0;
    box-shadow: 0 0 20px #ff0, 0 0 40px rgba(255, 255, 0, 0.4);
}

.morse-light.sync-pulse {
    background-color: #0f0;
    box-shadow: 0 0 30px #0f0, 0 0 60px rgba(0, 255, 0, 0.4);
    transform: scale(1.15);
}

.morse-light.dot {
    border-radius: 50%;
    width: 35px;
    height: 35px;
}

.morse-light.dash {
    border-radius: 4px;
    width: 60px;
    height: 35px;
}

.morse-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    gap: 5px;
}

.morse-freq-display {
    background-color: #000;
    color: #f00;
    font-family: 'Courier New', Courier, monospace;
    padding: 16px 4px;
    border: 1px solid #444;
    min-width: 90px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.morse-freq-val {
    display: inline-block;
    transition: transform 0.2s var(--anim-snappy), opacity 0.2s;
}

.morse-freq-val.slide-up {
    animation: slideUp 0.2s var(--anim-snappy);
}
.morse-freq-val.slide-down {
    animation: slideDown 0.2s var(--anim-snappy);
}

@keyframes slideUp {
    0% { transform: translateY(0); opacity: 1; }
    49% { transform: translateY(-20px); opacity: 0; }
    50% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
    0% { transform: translateY(0); opacity: 1; }
    49% { transform: translateY(20px); opacity: 0; }
    50% { transform: translateY(-20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.morse-nav {
    background-color: #444;
    color: white;
    border: 1px solid #666;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: transform 0.1s var(--anim-snappy);
}

.morse-nav:active {
    transform: scale(0.9);
}

.morse-tx {
    width: 60%;
    padding: 8px;
    background-color: #800;
    color: white;
    border: 2px solid #400;
    box-shadow: 0 4px 0 #400;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 5px;
    transition: transform 0.1s var(--anim-snappy), box-shadow 0.1s var(--anim-snappy);
}

.morse-tx:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #400;
}

.morse-reveal {
    animation: keypadReveal 0.4s var(--anim-bouncy) both;
}

/* Complicated Wires Styles */
.comp-wire-container {
    display: flex;
    justify-content: space-around;
    width: 90%;
    height: 80%;
}

.comp-wire-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.comp-slot-reveal {
    animation: keypadReveal 0.4s var(--anim-bouncy) both;
}

.comp-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #300;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.comp-led.lit {
    background-color: #f00;
    box-shadow: 0 0 8px #f00, 0 0 15px rgba(255, 0, 0, 0.4);
    animation: ledPulse 2s infinite alternate var(--anim-smooth);
}

@keyframes ledPulse {
    from { filter: brightness(0.8); box-shadow: 0 0 5px #f00; }
    to { filter: brightness(1.3); box-shadow: 0 0 12px #f00; }
}

.comp-wire {
    width: 12px;
    height: 60px;
    background-color: #fff;
    cursor: pointer;
    border-radius: 6px;
    position: relative;
    transition: transform var(--time-fast) var(--anim-bouncy), box-shadow var(--time-fast) var(--anim-smooth);
    will-change: transform;
}

.comp-wire:hover {
    transform: scaleX(1.15);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.comp-wire.red { background-color: #f00; }
.comp-wire.blue { background-color: #00f; }
.comp-wire.red.blue { background: linear-gradient(to right, #f00 50%, #00f 50%); }

.comp-wire.cut {
    opacity: 1 !important;
    pointer-events: none;
    background-color: transparent !important;
    box-shadow: none !important;
}

.comp-wire.cut::before,
.comp-wire.cut::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 40%;
    background: inherit;
    border-radius: 4px;
    transition: transform var(--time-med) var(--anim-bouncy);
}

.comp-wire.cut::before {
    top: -5px;
    transform: translateY(-15px) rotate(-10deg);
}

.comp-wire.cut::after {
    bottom: -5px;
    transform: translateY(15px) rotate(10deg);
}

.comp-star {
    font-size: 1.5rem;
    color: #000;
    opacity: 0.1; /* Almost invisible when absent */
    transition: opacity 0.5s var(--anim-smooth), color 0.5s;
}

.comp-star.present { 
    opacity: 1; /* Fully visible when present */
    color: #fff; /* White star for better contrast against dark background */
    text-shadow: 0 0 5px #fff;
    animation: starShimmer 3s infinite alternate var(--anim-smooth);
}

@keyframes starShimmer {
    0%, 100% { filter: brightness(1); transform: scale(1); }
    50% { filter: brightness(1.5); transform: scale(1.1); text-shadow: 0 0 12px #fff; }
}

/* Wire Sequences Styles */
.wire-sequences { padding: 5px; justify-content: space-between; overflow: hidden; }

.ws-panel-label {
    font-size: 0.75rem;
    color: #eee;
    background: #222;
    padding: 2px 8px;
    border: 1px solid #444;
    margin-bottom: 5px;
    transition: box-shadow 0.3s;
}

.ws-panel-label.pulse {
    animation: labelPulseOnce 0.4s var(--anim-smooth);
}

@keyframes labelPulseOnce {
    0% { box-shadow: 0 0 0 #fff; transform: scale(1); }
    50% { box-shadow: 0 0 10px #fff; transform: scale(1.1); }
    100% { box-shadow: 0 0 0 #fff; transform: scale(1); }
}

.ws-wire-container {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 60%;
    width: 90%;
    position: relative;
    transition: transform 0.4s var(--anim-snappy), opacity 0.4s;
}

.ws-wire-container.slide-out-left {
    transform: translateX(-120%);
    opacity: 0;
}

.ws-wire-container.slide-out-right {
    transform: translateX(120%);
    opacity: 0;
}

.ws-wire-container.slide-in-right {
    animation: slideInRight 0.4s var(--anim-snappy) both;
}

.ws-wire-container.slide-in-left {
    animation: slideInLeft 0.4s var(--anim-snappy) both;
}

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(-120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.ws-wire-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 20px;
}

.ws-wire {
    height: 12px;
    width: 80%;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.5);
    position: relative;
    border-radius: 6px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    transition: transform var(--time-fast) var(--anim-bouncy), box-shadow var(--time-fast) var(--anim-smooth);
    will-change: transform;
}

.ws-wire:hover {
    transform: scale(1.03);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 0 10px rgba(255, 255, 255, 0.3);
}

.ws-wire.red { --wire-color: #f00; background-color: #f00; }
.ws-wire.blue { --wire-color: #00f; background-color: #00f; }
.ws-wire.black { --wire-color: #111; background-color: #111; }

.ws-wire.cut {
    opacity: 1 !important;
    pointer-events: none;
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.ws-wire.cut::before,
.ws-wire.cut::after {
    content: '';
    position: absolute;
    top: 0;
    height: 100%;
    width: 40%;
    background-color: var(--wire-color);
    border: 1px solid rgba(0,0,0,0.5);
    border-radius: 6px;
    transition: transform var(--time-med) var(--anim-bouncy);
}

.ws-wire.cut::before {
    left: -10px;
    transform: translateX(-15px) rotate(-3deg);
}

.ws-wire.cut::after {
    right: -10px;
    transform: translateX(15px) rotate(3deg);
}

.start-animations .ws-reveal {
    animation: wireReveal var(--time-med) var(--anim-bouncy) both;
}

.ws-to-label { 
    font-weight: bold; 
    color: #000; 
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.ws-controls {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.ws-nav-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    background-color: #444;
    color: white;
    border: 2px solid #666;
    box-shadow: 0 3px 0 #222;
    cursor: pointer;
    position: relative;
    z-index: 10;
    transition: transform 0.1s var(--anim-snappy), box-shadow 0.1s var(--anim-snappy), opacity 0.2s;
    user-select: none;
}

.ws-nav-btn:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #222;
}

.ws-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

/* Mazes Styles */
.maze-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 2px;
    width: 120px;
    height: 120px;
    background-color: #222;
    padding: 2px;
    margin-bottom: 10px;
    position: relative;
}

.maze-cell {
    background-color: #444;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.maze-cell-reveal {
    animation: keypadReveal 0.4s var(--anim-bouncy) both;
}

.maze-player {
    width: 10px;
    height: 10px;
    background-color: #fff;
    border-radius: 2px;
    position: absolute;
    z-index: 10;
    box-shadow: 0 0 5px #fff;
    transition: transform 0.2s var(--anim-bouncy);
    pointer-events: none;
}

.maze-goal {
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #f00;
    animation: goalPulse 1.5s infinite alternate var(--anim-smooth);
}

@keyframes goalPulse {
    from { transform: scale(0.9); filter: drop-shadow(0 0 2px #f00); }
    to { transform: scale(1.2); filter: drop-shadow(0 0 8px #f00); }
}

.maze-indicator {
    width: 6px;
    height: 6px;
    border: 2px solid #0f0;
    border-radius: 50%;
    position: absolute;
    animation: indicatorFlicker 0.1s infinite alternate;
}

@keyframes indicatorFlicker {
    from { opacity: 0.7; filter: brightness(0.8); }
    to { opacity: 1; filter: brightness(1.2); }
}

.maze-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.maze-mid-row {
    display: flex;
    gap: 20px;
}

.maze-btn {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #444;
    border: 2px solid #666;
    box-shadow: 0 2px 0 #222;
    cursor: pointer;
    transition: transform 0.1s var(--anim-snappy), box-shadow 0.1s var(--anim-snappy);
    user-select: none;
}

.maze-btn:active {
    transform: scale(0.85) translateY(2px);
    box-shadow: 0 1px 0 #222;
}

/* Passwords Styles */
.pass-columns {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
    justify-content: center;
}

.pass-column-reveal {
    animation: keypadReveal 0.4s var(--anim-bouncy) both;
}

.pass-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pass-char-container {
    background-color: #000;
    border: 1px solid #444;
    width: 28px;
    height: 32px;
    overflow: hidden;
    position: relative;
}

.pass-char {
    color: #0f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s var(--anim-snappy), opacity 0.2s;
    will-change: transform, opacity;
}

.pass-char.slide-in-up {
    animation: passSlideInUp 0.15s var(--anim-bouncy) both;
}

.pass-char.slide-in-down {
    animation: passSlideInDown 0.15s var(--anim-bouncy) both;
}

@keyframes passSlideInUp {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes passSlideInDown {
    from { transform: translateY(-15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pass-char.shiver {
    animation: shake-mini 0.2s var(--anim-snappy);
    color: #f00;
}

.pass-char.success-pulse {
    animation: successPulse 0.5s var(--anim-smooth);
    color: #0f0;
}

.pass-nav {
    width: 26px;
    height: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    background-color: #444;
    border: 1px solid #666;
    box-shadow: 0 2px 0 #222;
    cursor: pointer;
    transition: transform 0.1s var(--anim-snappy), box-shadow 0.1s var(--anim-snappy);
    user-select: none;
}

.pass-nav:active {
    transform: scale(0.85) translateY(1px);
    box-shadow: 0 1px 0 #222;
}

.pass-submit {
    padding: 8px 20px;
    font-size: 0.9rem;
    text-transform: uppercase;
    background-color: #333;
    border: 2px solid #555;
    box-shadow: 0 4px 0 #222;
    cursor: pointer;
    transition: transform 0.1s var(--anim-snappy), box-shadow 0.1s var(--anim-snappy);
    user-select: none;
}

.pass-submit:active {
    transform: scale(0.9) translateY(3px);
    box-shadow: 0 1px 0 #222;
}

/* Game Over Modal */
.game-over-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.95) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 99999 !important;
    pointer-events: all !important;
}

.game-over-modal .modal-content {
    background-color: #222 !important;
    padding: 3rem !important;
    border: 5px solid #444 !important;
    border-radius: 10px !important;
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.5) !important;
    max-width: 500px !important;
    width: 90% !important;
    color: white !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Comms Box Styles */
.comms-box {
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 350px;
    max-height: 180px; /* Fits approx 2-3 messages */
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.85);
    border: 2px solid #0f0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s var(--anim-snappy);
    font-family: 'Courier New', Courier, monospace;
    display: none; /* Controlled by JS */
}

.comms-box.active {
    display: block;
    animation: slideInLeft 0.4s var(--anim-snappy) both;
}

.comms-box.recording {
    border-color: #f00;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.4);
    animation: commsPulse 1.5s infinite alternate var(--anim-smooth);
}

@keyframes commsPulse {
    from { box-shadow: 0 0 10px rgba(255, 0, 0, 0.2); }
    to { box-shadow: 0 0 30px rgba(255, 0, 0, 0.5); }
}

.comms-header {
    font-size: 0.7rem;
    color: #0f0;
    opacity: 0.7;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    padding-bottom: 4px;
    letter-spacing: 1px;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 5;
}

.comms-text {
    font-size: 1.1rem;
    color: #fff;
    line-height: 1.3;
}

.comms-msg {
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comms-msg.user { color: #0f0; }
.comms-msg.ai { color: #fff; }

.comms-box::-webkit-scrollbar {
    width: 6px;
}

.comms-box::-webkit-scrollbar-thumb {
    background: #0f0;
    border-radius: 3px;
}

.ptt-hint {
    font-size: 0.75rem;
    color: #888;
    text-align: center;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ptt-hint b { color: #eee; }

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

.comms-indicator.active {
    background-color: #FF0000;
    opacity: 1;
    box-shadow: 0 0 10px #FF0000, inset 0 0 4px #FFF;
    animation: commsFlicker 0.1s infinite alternate;
}

@keyframes commsFlicker {
    0% { opacity: 0.4; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1.05); }
}

/* Ambient Radio Effect Overlay */
.comms-vignette {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(circle, transparent 60%, rgba(255, 0, 0, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.5s;
}

.comms-vignette.active {
    opacity: 1;
}
