body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #050505;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 125vw;
    height: 125vh;
    transform: scale(0.8);
    transform-origin: 0 0;
}

#gameCanvas {
    display: block;
    background-color: #1a1a1a;
    box-shadow: 0 0 100px rgba(0, 0, 0, 1);
    z-index: 10;
}

/* --- SPARKS --- */
#sparks-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.spark {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    box-shadow: 0 0 4px #2ed573, 0 0 8px #fff;
    border-radius: 50%;
    opacity: 0;
    animation: floatSpark 4s infinite linear;
}

@keyframes floatSpark {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }

    20% {
        opacity: 1;
        transform: scale(1);
    }

    80% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
}

/* --- UI LAYER --- */
#ui-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    display: flex;
    justify-content: space-between;
}

.side-pillar {
    width: calc((100% - 800px) / 2);
    height: 100%;
    background: linear-gradient(to bottom, rgba(10, 10, 10, 0.98), rgba(2, 2, 2, 0.98));
    display: flex;
    flex-direction: column;
    padding: 40px 20px;
    box-sizing: border-box;
    border-left: 2px solid #222;
    border-right: 2px solid #222;
    backdrop-filter: blur(12px);
}

.hud-left {
    align-items: flex-start;
}

.hud-right {
    align-items: flex-end;
    text-align: right;
}

.stat {
    font-size: 42px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 3px 3px 0 #000;
    font-family: 'Segoe UI Black', Impact, sans-serif;
    margin-bottom: 25px;
}

.stat-label {
    font-size: 15px;
    color: #888;
    letter-spacing: 2px;
    margin-bottom: -5px;
    text-transform: uppercase;
}

/* --- COMMS SUBTITLES --- */
.comms-panel {
    position: absolute;
    width: 380px;
    height: 160px;
    bottom: 50px;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 15, 25, 0.9);
    border: 3px solid #2ed573;
    border-radius: 4px;
    box-shadow: inset 0 0 15px rgba(46, 213, 115, 0.3), 0 0 20px rgba(0, 0, 0, 0.8);
    z-index: 100;
    font-family: 'Courier New', Courier, monospace;
}

#comms-left {
    left: 40px;
    border-left: 8px solid #2ed573;
}

#comms-right {
    right: 40px;
    border-right: 8px solid #2ed573;
    flex-direction: row-reverse;
}

.comms-avatar {
    width: 130px;
    height: 130px;
    border: 2px solid #2ed573;
    background: #000;
    overflow: hidden;
    flex-shrink: 0;
    image-rendering: pixelated;
}

.comms-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comms-content {
    flex-grow: 1;
    overflow: hidden;
}

.comms-sender {
    font-size: 18px;
    font-weight: 900;
    color: #2ed573;
    margin-bottom: 4px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(46, 213, 115, 0.3);
    padding-bottom: 2px;
}

.comms-msg {
    font-size: 18px;
    font-weight: bold;
    line-height: 1.2;
    color: #fff;
}

.comms-panel.anim-open {
    animation: panelOpen 0.2s ease-out forwards;
}

.comms-panel.anim-close {
    animation: panelClose 0.15s ease-in forwards;
}

@keyframes panelOpen {
    from {
        transform: scaleY(0);
        opacity: 0;
    }

    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

@keyframes panelClose {
    from {
        transform: scaleY(1);
        opacity: 1;
    }

    to {
        transform: scaleY(0);
        opacity: 0;
    }
}

/* --- SCREENS --- */
#game-over-screen,
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-sizing: border-box;
}

#start-screen {
    background: rgba(0, 0, 0, 0.75);
    padding: 20px;
}

#game-over-screen {
    display: none;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
}

/* --- SPLASH SCREEN --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
}

.splash-content {
    text-align: center;
}

.splash-logo {
    max-width: 80%;
    max-height: 50vh;
    margin-bottom: 60px;
    filter: drop-shadow(0 0 30px rgba(46, 213, 115, 0.6));
}

.splash-text {
    font-size: 32px;
    color: #2ed573;
    text-transform: uppercase;
    letter-spacing: 8px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(46, 213, 115, 0.8);
    animation: blink-text 1.5s infinite;
}

@keyframes blink-text {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.logo-img {
    display: block;
    margin: 0 auto 5px auto;
    width: auto;
    max-width: 95%;
    max-height: 78vh;
    filter: drop-shadow(0 0 50px rgba(46, 213, 115, 0.8));
    image-rendering: auto;
    object-fit: contain;
}

/* --- SPATIAL TECH BUTTON --- */
button {
    padding: 15px 60px;
    font-size: 28px;
    background: rgba(46, 213, 115, 0.15);
    color: #2ed573;
    border: 2px solid #2ed573;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(46, 213, 115, 0.3);
    text-shadow: 0 0 10px rgba(46, 213, 115, 0.7);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
    margin-bottom: 20px;
    animation: pulse-glow 2s infinite ease-in-out;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

button:hover {
    background: rgba(46, 213, 115, 0.3);
    box-shadow: 0 0 40px rgba(46, 213, 115, 0.6);
    transform: scale(1.05);
    color: #fff;
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: scale(0.95);
    opacity: 0.8;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 10px rgba(46, 213, 115, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(46, 213, 115, 0.5);
    }

    100% {
        box-shadow: 0 0 10px rgba(46, 213, 115, 0.3);
    }
}

/* --- DEBUG MENU --- */
#debug-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: rgba(10, 10, 20, 0.95);
    border: 2px solid #ff6b35;
    border-radius: 8px;
    z-index: 9999;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 40px rgba(255, 107, 53, 0.5);
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 107, 53, 0.2);
    border-bottom: 1px solid #ff6b35;
    font-weight: bold;
    color: #ff6b35;
}

.debug-header button {
    padding: 2px 8px;
    font-size: 16px;
    margin: 0;
}

.debug-content {
    padding: 15px;
}

.debug-content hr {
    border: none;
    border-top: 1px solid #333;
    margin: 10px 0;
}

.debug-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 10px;
}

.debug-row label {
    flex: 1;
    font-size: 14px;
    color: #ccc;
}

.debug-row span {
    width: 30px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

.toggle-btn {
    padding: 5px 15px !important;
    font-size: 14px !important;
    letter-spacing: 1px !important;
}

.toggle-btn.active {
    background: rgba(255, 50, 50, 0.4) !important;
    border-color: #ff3333 !important;
    color: #ff3333 !important;
    box-shadow: 0 0 20px rgba(255, 50, 50, 0.5) !important;
}

.arrow-btn {
    padding: 3px 10px !important;
    font-size: 14px !important;
    margin: 0 !important;
    min-width: 30px;
}

#add-points,
#level-down,
#level-up {
    padding: 5px 12px !important;
    font-size: 12px !important;
    margin: 0 !important;
}