/* === NIN DEFENDER — Industrial / Nine Inch Nails aesthetic === */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Share+Tech+Mono&display=swap');

:root {
    --nin-black:   #0a0a0a;
    --nin-dark:    #141414;
    --nin-grey:    #2a2a2a;
    --nin-mid:     #555;
    --nin-light:   #999;
    --nin-red:     #cc0000;
    --nin-hot:     #ff2200;
    --nin-blood:   #8b0000;
    --nin-rust:    #993300;
    --nin-white:   #d4d4d4;
    --nin-bone:    #b0a090;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--nin-black);
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    -webkit-user-select: none;
    user-select: none;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

/* --- Touch Controls (mobile only) --- */
#touchControls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    pointer-events: none;
    z-index: 10;
}

#joystickArea {
    position: absolute;
    left: 10px;
    bottom: 10px;
    width: 160px;
    height: 160px;
    pointer-events: auto;
    touch-action: none;
}

#joystickBase {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(204, 0, 0, 0.08);
    border: 2px solid rgba(204, 0, 0, 0.3);
    box-shadow: 0 0 15px rgba(204, 0, 0, 0.1), inset 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystickKnob {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: rgba(204, 0, 0, 0.25);
    border: 2px solid rgba(204, 0, 0, 0.6);
    box-shadow: 0 0 10px rgba(204, 0, 0, 0.3);
    position: absolute;
    transition: none;
}

#fireButton {
    position: absolute;
    right: 15px;
    bottom: 15px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(139, 0, 0, 0.2);
    border: 3px solid rgba(204, 0, 0, 0.5);
    box-shadow: 0 0 20px rgba(204, 0, 0, 0.15), inset 0 0 15px rgba(0, 0, 0, 0.4);
    color: var(--nin-red);
    font-size: 16px;
    font-weight: bold;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    touch-action: none;
    letter-spacing: 3px;
    text-transform: uppercase;
}

#fireButton:active {
    background: rgba(204, 0, 0, 0.4);
    border-color: var(--nin-hot);
    box-shadow: 0 0 30px rgba(255, 34, 0, 0.4);
}

#muteBtn {
    position: fixed;
    top: 10px;
    right: 60px;
    z-index: 20;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(204, 0, 0, 0.3);
    border-radius: 2px;
    color: var(--nin-light);
    font-size: 20px;
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s;
}

#muteBtn:hover {
    opacity: 1;
    border-color: var(--nin-red);
}

/* Portrait warning overlay */
#portraitWarning {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--nin-black);
    color: var(--nin-red);
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 20px;
}
#portraitWarning .rotate-icon {
    font-size: 60px;
    animation: rotateHint 2s ease-in-out infinite;
    filter: grayscale(0.5);
}
#portraitWarning p {
    font-size: 18px;
    color: var(--nin-mid);
    max-width: 280px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
@keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* Touch action buttons (shield + bomb) */
#touchActions {
    display: none;
    position: fixed;
    bottom: 140px;
    right: 15px;
    z-index: 10;
    gap: 10px;
    pointer-events: none;
    flex-direction: column;
}
.touch-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    touch-action: none;
    letter-spacing: 1px;
    -webkit-tap-highlight-color: transparent;
}
#shieldBtn {
    background: rgba(100, 100, 100, 0.15);
    border: 2px solid rgba(150, 150, 150, 0.4);
    color: var(--nin-light);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
}
#shieldBtn:active {
    background: rgba(150, 150, 150, 0.3);
    border-color: var(--nin-white);
}
#bombBtn {
    background: rgba(204, 0, 0, 0.15);
    border: 2px solid rgba(204, 0, 0, 0.4);
    color: var(--nin-red);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
}
#bombBtn:active {
    background: rgba(204, 0, 0, 0.4);
    border-color: var(--nin-hot);
}

/* ===== MOBILE: JS adds .touch-device to body ===== */
body.touch-device #touchControls {
    display: block;
}
body.touch-device #touchActions {
    display: flex;
}
body.touch-device #gameCanvas {
    cursor: none;
}
body.touch-device #muteBtn {
    top: auto;
    bottom: 180px;
    right: 20px;
}

/* Portrait warning — shown by JS when touch + portrait */
body.touch-portrait #portraitWarning {
    display: flex;
}
body.touch-portrait #gameCanvas,
body.touch-portrait #touchControls,
body.touch-portrait #touchActions,
body.touch-portrait #muteBtn {
    display: none !important;
}
