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

body {
    overflow: hidden;
    background: #1a1a1a;
    font-family: 'Share Tech Mono', monospace;
    cursor: crosshair;
    -webkit-user-select: none;
    user-select: none;
}

#scene-container {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#scene-container canvas {
    display: block;
}

/* START SCREEN */
#start-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

#start-overlay {
    width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, rgba(30,25,15,0.85) 0%, rgba(10,8,5,0.95) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

#start-content {
    text-align: center;
    padding: 2rem;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.03) 2px,
        rgba(0,0,0,0.03) 4px
    );
    max-width: 900px;
    width: 100%;
}

#title {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(2.5rem, 8vw, 5rem);
    color: #c8b06a;
    text-shadow: 0 0 40px rgba(200,176,106,0.3), 3px 3px 0 #2a2210;
    letter-spacing: 0.15em;
    margin-bottom: 0.2em;
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { text-shadow: 0 0 40px rgba(200,176,106,0.3), 3px 3px 0 #2a2210; }
    50% { text-shadow: 0 0 60px rgba(200,176,106,0.5), 3px 3px 0 #2a2210; }
}

#subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: #8a7d5a;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

/* FACTION SELECT */
#faction-select {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.faction-card {
    background: rgba(40, 35, 20, 0.7);
    border: 2px solid #3d3824;
    padding: 1.5rem 2rem;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 200px;
}

.faction-card:hover {
    border-color: #7a6d3f;
    transform: scale(1.05);
}

.faction-card.selected {
    border-color: #c8b06a;
    background: rgba(60, 50, 25, 0.9);
    box-shadow: 0 0 25px rgba(200,176,106,0.3);
}

.faction-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.allied-icon {
    color: #4a8a3a;
    text-shadow: 0 0 15px rgba(74,138,58,0.5);
}

.axis-icon {
    color: #8a4a3a;
    text-shadow: 0 0 15px rgba(138,74,58,0.5);
}

.faction-name {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: #c8b06a;
    letter-spacing: 0.1em;
    margin-bottom: 0.3em;
}

.faction-desc {
    font-size: 0.7rem;
    color: #6b6348;
    letter-spacing: 0.1em;
    margin-bottom: 0.4em;
}

.faction-units {
    font-size: 0.65rem;
    color: #5a5340;
    letter-spacing: 0.08em;
}

.faction-vs {
    font-family: 'Black Ops One', cursive;
    font-size: 1.5rem;
    color: #5a4a2a;
    letter-spacing: 0.1em;
}

/* ROLE SELECT */
#role-select {
    margin-bottom: 1.5rem;
}

.role-label {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    color: #8a7d5a;
    letter-spacing: 0.2em;
    margin-bottom: 0.8rem;
}

#role-options {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.role-card {
    background: rgba(40, 35, 20, 0.6);
    border: 2px solid #2d2820;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 160px;
}

.role-card:hover {
    border-color: #6a5d3f;
    transform: scale(1.05);
}

.role-card.selected {
    border-color: #c8b06a;
    background: rgba(60, 50, 25, 0.85);
    box-shadow: 0 0 20px rgba(200,176,106,0.25);
}

.role-icon {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
    color: #c8b06a;
}

.role-name {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    color: #c8b06a;
    letter-spacing: 0.08em;
    margin-bottom: 0.2em;
}

.role-desc {
    font-size: 0.6rem;
    color: #6b6348;
    letter-spacing: 0.08em;
}

#controls-guide {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

#controls-guide span {
    font-size: clamp(0.65rem, 1.5vw, 0.85rem);
    color: #6b6348;
    padding: 0.4em 1em;
    border: 1px solid #3d3824;
    letter-spacing: 0.1em;
}

#start-btn {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    padding: 1em 3em;
    background: linear-gradient(180deg, #5a4f2e 0%, #3d3518 100%);
    color: #c8b06a;
    border: 2px solid #7a6d3f;
    cursor: pointer;
    letter-spacing: 0.15em;
    transition: all 0.2s;
    text-shadow: 1px 1px 0 #1a1508;
}

#start-btn:hover {
    background: linear-gradient(180deg, #6b5e38 0%, #4d4320 100%);
    border-color: #9a8d5f;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(200,176,106,0.2);
}

/* HUD */
#hud {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
}

#mission-text {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.6rem, 1.3vw, 0.8rem);
    color: #c8b06a;
    letter-spacing: 0.15em;
    text-align: center;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    opacity: 1;
    transition: opacity 3s ease;
    padding: 0.3em 1em;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(200,176,106,0.2);
    white-space: nowrap;
}

#hud-top-left {
    position: absolute;
    top: 50px;
    left: 16px;
}

#health-label {
    font-size: 0.7rem;
    color: #8a8a6a;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
}

#health-bar-container {
    width: clamp(120px, 20vw, 200px);
    height: 14px;
    background: rgba(0,0,0,0.6);
    border: 1px solid #4a4a3a;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #4a7a2a, #6aaa3a);
    transition: width 0.3s, background 0.3s;
}

#hud-top-right {
    position: absolute;
    top: 55px;
    right: 16px;
    font-family: 'Black Ops One', cursive;
    font-size: clamp(0.7rem, 1.5vw, 0.95rem);
    color: #c8b06a;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    letter-spacing: 0.1em;
}

/* TEAM STATUS BAR */
#team-status {
    position: absolute;
    top: 38px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(0,0,0,0.5);
    padding: 0.3rem 1rem;
    border: 1px solid rgba(200,176,106,0.15);
}

#team-friendly, #team-enemy {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.team-label {
    font-family: 'Black Ops One', cursive;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
}

#friendly-label {
    color: #6aaa3a;
}

#enemy-label {
    color: #cc4433;
}

.team-count {
    font-family: 'Black Ops One', cursive;
    font-size: 1.1rem;
    color: #c8b06a;
    text-shadow: 0 0 6px rgba(200,176,106,0.3);
}

#team-vs-hud {
    font-family: 'Black Ops One', cursive;
    font-size: 0.7rem;
    color: #5a4a2a;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(200,176,106,0.6);
    font-family: monospace;
    font-weight: 100;
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
    pointer-events: none;
}

#hud-bottom-center {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

#ammo-label {
    font-size: 0.7rem;
    color: #8a8a6a;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
}

#reload-bar-container {
    width: clamp(100px, 15vw, 160px);
    height: 8px;
    background: rgba(0,0,0,0.6);
    border: 1px solid #4a4a3a;
    margin: 0 auto;
}

#reload-bar {
    width: 100%;
    height: 100%;
    background: #c8b06a;
    transition: width 0.1s;
}

#minimap-container {
    position: absolute;
    bottom: 20px;
    right: 16px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(200,176,106,0.4);
    background: rgba(0,0,0,0.5);
}

#minimap {
    display: block;
}

/* END SCREENS */
.end-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(5,5,3,0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.end-title {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(2rem, 7vw, 4.5rem);
    letter-spacing: 0.1em;
    margin-bottom: 0.5em;
}

.victory-title {
    color: #c8b06a;
    text-shadow: 0 0 40px rgba(200,176,106,0.4);
}

.defeat-title {
    color: #aa3333;
    text-shadow: 0 0 40px rgba(170,50,50,0.4);
}

#star-rating {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.3em;
}

.end-sub {
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    color: #8a7d5a;
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
    text-align: center;
    padding: 0 1rem;
}

.end-btn {
    font-family: 'Black Ops One', cursive;
    font-size: 1.1rem;
    padding: 0.8em 2.5em;
    background: linear-gradient(180deg, #5a4f2e 0%, #3d3518 100%);
    color: #c8b06a;
    border: 2px solid #7a6d3f;
    cursor: pointer;
    letter-spacing: 0.12em;
    pointer-events: all;
    transition: all 0.2s;
}

.end-btn:hover {
    background: linear-gradient(180deg, #6b5e38 0%, #4d4320 100%);
    transform: scale(1.05);
}

/* MOBILE CONTROLS */
/* CONFIRM MODAL */
#confirm-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
}

#confirm-overlay {
    width: 100%; height: 100%;
    background: rgba(5,5,3,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: confirmFadeIn 0.3s ease;
}

@keyframes confirmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#confirm-content {
    text-align: center;
    padding: 2.5rem 3rem;
    background: rgba(40, 35, 20, 0.9);
    border: 2px solid #7a6d3f;
    box-shadow: 0 0 60px rgba(200,176,106,0.15);
    max-width: 500px;
    width: 90%;
    animation: confirmSlideIn 0.3s ease;
}

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

#confirm-title {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: #c8b06a;
    letter-spacing: 0.15em;
    margin-bottom: 1.2em;
    text-shadow: 0 0 20px rgba(200,176,106,0.3);
}

#confirm-details {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    color: #8a7d5a;
    letter-spacing: 0.08em;
    line-height: 1.8;
    margin-bottom: 1.5em;
}

#confirm-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3em 0;
    border-bottom: 1px solid rgba(200,176,106,0.1);
}

#confirm-details .detail-label {
    color: #6b6348;
}

#confirm-details .detail-value {
    color: #c8b06a;
    font-weight: bold;
}

#confirm-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.confirm-btn {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(0.8rem, 2vw, 1rem);
    padding: 0.7em 2em;
    cursor: pointer;
    letter-spacing: 0.1em;
    transition: all 0.2s;
    min-width: 140px;
}

.confirm-yes {
    background: linear-gradient(180deg, #5a4f2e 0%, #3d3518 100%);
    color: #c8b06a;
    border: 2px solid #7a6d3f;
}

.confirm-yes:hover {
    background: linear-gradient(180deg, #6b5e38 0%, #4d4320 100%);
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(200,176,106,0.3);
}

.confirm-no {
    background: rgba(40, 35, 20, 0.6);
    color: #6b6348;
    border: 2px solid #3d3824;
}

.confirm-no:hover {
    border-color: #6a5d3f;
    color: #8a7d5a;
    transform: scale(1.05);
}

/* MOBILE CONTROLS */
#mobile-controls {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%; height: 200px;
    z-index: 15;
    pointer-events: none;
}

#joystick-zone {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 120px;
    height: 120px;
    pointer-events: all;
    touch-action: none;
}

#joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(200,176,106,0.15);
    border: 2px solid rgba(200,176,106,0.3);
    position: relative;
}

#joystick-stick {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(200,176,106,0.4);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#aim-joystick-zone {
    position: absolute;
    bottom: 140px;
    right: 40px;
    width: 100px;
    height: 100px;
    pointer-events: all;
    touch-action: none;
}

#aim-joystick-base {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(200,130,106,0.15);
    border: 2px solid rgba(200,130,106,0.3);
    position: relative;
}

#aim-joystick-stick {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(200,130,106,0.4);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#fire-btn {
    position: absolute;
    bottom: 30px;
    right: 40px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(170,50,50,0.5);
    border: 3px solid rgba(170,50,50,0.7);
    color: #c8b06a;
    font-family: 'Black Ops One', cursive;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    pointer-events: all;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

#fire-btn:active {
    background: rgba(200,60,60,0.7);
    transform: scale(0.95);
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    #minimap-container {
        width: 100px;
        height: 100px;
        bottom: 10px;
        right: 10px;
    }

    #hud-top-left {
        top: 40px;
        left: 10px;
    }

    #hud-top-right {
        top: 45px;
        right: 10px;
    }

    #team-status {
        top: 32px;
        font-size: 0.8em;
    }

    #hud-bottom-center {
        bottom: 20px;
    }

    #controls-guide {
        gap: 0.8rem;
    }

    #controls-guide span {
        font-size: 0.6rem;
        padding: 0.3em 0.6em;
    }

    .faction-card {
        padding: 1rem 1.2rem;
        min-width: 150px;
    }

    .role-card {
        padding: 0.6rem 1rem;
        min-width: 130px;
    }
}

#footer-bar {
    position: fixed;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

#footer-bar a {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    color: rgba(107, 99, 72, 0.5);
    text-decoration: none;
    letter-spacing: 0.1em;
}

#footer-bar a:hover {
    color: rgba(200, 176, 106, 0.7);
}