@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #050510;
    font-family: 'Inter', sans-serif;
    color: #ffffff;
    user-select: none;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* CROSSHAIR */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
}
#crosshair::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background-color: #ff3366;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #ff3366, 0 0 20px #ff3366;
}

/* HUD */
#hud {
    position: absolute;
    bottom: 30px;
    left: 30px;
    display: flex;
    gap: 20px;
}

.hud-box {
    background: rgba(10, 15, 30, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 150px;
}

.label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #8b9bb4;
}

.value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.5);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00f2fe 0%, #4facfe 100%);
    box-shadow: 0 0 10px #4facfe;
    transition: width 0.3s ease;
}

/* SCOREBOARD */
#scoreboard {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 300px;
    background: rgba(10, 15, 30, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#scoreboard.hidden {
    opacity: 0;
    transform: translateX(50px);
    pointer-events: none;
}

@media (max-width: 900px) {
    #scoreboard {
        top: 60px;
        right: 10px;
        width: 250px;
        padding: 10px;
        z-index: 100;
        pointer-events: none;
    }
    #scoreboard.hidden {
        transform: translateX(100%);
    }
}

#scoreboard h2 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #00f2fe;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

#score-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#score-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: background 0.2s;
}
#score-list li:hover {
    background: rgba(255, 255, 255, 0.08);
}

.score-stats {
    color: #00f2fe;
    font-family: monospace;
}

/* CONTROLS HINT */
.controls-hint {
    position: absolute;
    bottom: 20px;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.3);
}

/* POLISH ADDITIONS */
#crash-flash {
    position: absolute; width: 100%; height: 100%;
    box-shadow: inset 0 0 150px rgb(255,0,0);
    opacity: 0; pointer-events: none; transition: opacity 0.1s;
    z-index: 100;
}

#stats-ribbon {
    position: absolute; top: 0; left: 0; width: 100%;
    text-align: center; background: rgba(0,0,0,0.5);
    padding: 5px 0; font-size: 0.8rem; font-family: monospace; color: #00f2fe;
    letter-spacing: 1px;
}

#pause-menu {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(10, 15, 30, 0.7); backdrop-filter: blur(20px);
    padding: 50px 100px; border-radius: 20px; border: 1px solid rgba(0,242,254,0.3);
    text-align: center;
    transition: opacity 0.3s;
}
#pause-menu.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, -60%); }

#kill-feed-container {
    position: absolute; top: 80px; width: 100%; pointer-events: none;
    display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 100;
}
.kill-feed-entry {
    background: rgba(0,0,0,0.6); padding: 5px 15px; border-radius: 5px; border: 1px solid #ff3366;
    color: white; font-family: 'Inter'; font-weight: bold; font-size: 0.9rem;
    animation: fadeout 4s forwards; text-transform: uppercase;
}
@keyframes fadeout { 0%{opacity:1; transform:scale(1);} 75%{opacity:1; transform:scale(1);} 100%{opacity:0; transform:scale(0.8);} }

#main-menu {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, #1b2745, #050510);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding: 5vh 0; box-sizing: border-box;
    overflow-y: auto; overflow-x: hidden;
    z-index: 999;
    transition: opacity 1s ease;
}
.logo {
    font-size: 5rem; font-weight: 800; margin: 0;
    color: transparent; -webkit-text-stroke: 2px #00f2fe;
    text-shadow: 0 0 20px rgba(0,242,254,0.5);
    animation: pulse 2s infinite alternate;
}
@keyframes pulse { from { text-shadow: 0 0 10px rgba(0,242,254,0.5); } to { text-shadow: 0 0 40px #00f2fe; } }

#btn-start {
    margin-top: 40px; padding: 15px 40px; font-size: 1.2rem; font-weight: 800; font-family: 'Inter';
    background: #00f2fe; color: #000; border: none; border-radius: 30px;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 20px rgba(0,242,254,0.5);
}
#btn-start:hover { transform: scale(1.1); box-shadow: 0 0 40px #00f2fe; }

#username-input {
    margin-top: 30px; padding: 15px; font-size: 1.2rem; font-family: 'Inter'; font-weight: 800;
    text-align: center; background: rgba(0,0,0,0.5); border: 2px solid #00f2fe;
    color: white; outline: none; border-radius: 10px; width: 300px;
}
.skin-selector {
    display: flex; gap: 20px; margin-top: 20px;
}
.skin-btn {
    padding: 10px 20px; background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.3); border-radius: 5px; cursor: pointer; font-family: 'Inter'; font-weight: 800; transition: 0.2s;
}
.skin-btn.active {
    background: #00f2fe; color: black; border-color: #00f2fe; box-shadow: 0 0 15px rgba(0,242,254,0.5); transform: scale(1.1);
}
#btn-pause-ui {
    position: absolute; top: 30px; right: 20px; background: rgba(0,0,0,0.5); border: 2px solid #00f2fe; color: #00f2fe; font-size: 1.2rem; width: 50px; height: 50px; cursor: pointer; border-radius: 50%; z-index: 50; transition: transform 0.2s; pointer-events: auto;
}
#btn-pause-ui:hover { transform: scale(1.1); background: rgba(0,242,254,0.2); }

/* MOBILE CONTROLS */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    width: 100%;
    z-index: 50;
    justify-content: space-between;
    padding: 0 40px;
    box-sizing: border-box;
    pointer-events: none;
}

/* ORIENTATION WARNING */
#orientation-warning {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #050510;
    z-index: 10000;
    color: #00f2fe;
    font-size: 1.5rem;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
}
#orientation-warning .rotate-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: rotate-phone 2s infinite ease-in-out;
}

@keyframes rotate-phone {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-90deg); }
    100% { transform: rotate(-90deg); }
}

@media (max-width: 900px) and (orientation: portrait) {
    #orientation-warning {
        display: flex;
    }
}

@media (max-width: 900px) {
    #mobile-controls { display: flex; }
    .controls-hint { display: none; }
    #hud { bottom: auto; top: 10px; left: 10px; transform: scale(0.7); transform-origin: top left;}
}

#joystick-zone {
    width: 130px; height: 130px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    pointer-events: auto;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

#joystick-knob {
    width: 50px; height: 50px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    position: absolute;
    top: 40px; left: 40px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

#action-buttons {
    display: flex; flex-direction: column; gap: 10px; pointer-events: auto;
}

#action-buttons button {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1); 
    border: 2px solid rgba(255,255,255,0.2); 
    color: white; font-weight: 800; font-family: 'Inter'; font-size: 0.8rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    backdrop-filter: blur(5px);
}
#action-buttons button:active {
    background: rgba(255,255,255,0.3);
    transform: scale(0.95);
}

/* FULLSCREEN BUTTON */
#btn-fullscreen {
    display: none; /* Block on mobile if not fullscreen */
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0,0,0,0.5);
    border: 2px solid #00f2fe;
    color: #00f2fe;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    cursor: pointer;
    border-radius: 5px;
    z-index: 50;
    pointer-events: auto;
}

@media (max-width: 900px) {
    #btn-fullscreen { display: block; }
}

/* DRAGGING HUD */
.draggable-hud {
    transition: box-shadow 0.2s, background 0.2s;
}
.draggable-hud.editing {
    border: 2px dashed #ffa500 !important;
    background: rgba(255,165,0,0.2) !important;
    cursor: move;
    box-shadow: 0 0 20px rgba(255,165,0,0.5);
    animation: pulse-edit 1.5s infinite alternate;
}
@keyframes pulse-edit {
    from { box-shadow: 0 0 10px rgba(255,165,0,0.5); }
    to { box-shadow: 0 0 30px rgba(255,165,0,0.8); }
}

/* START MENU FOOTER */
.main-footer {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 40px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.developer-support h4 {
    margin: 0 0 10px 0;
    color: #ffaa00;
    font-size: 1rem;
    letter-spacing: 1px;
}

.developer-support p {
    margin: 10px 0 0 0;
    font-size: 0.9rem;
    color: #00f2fe;
    font-family: monospace;
    font-weight: 800;
}

.qr-code {
    width: 150px;
    height: 150px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
    object-fit: contain;
    background: #000;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}
.qr-code:hover {
    transform: scale(1.1);
    border-color: #00f2fe;
    box-shadow: 0 0 25px rgba(0,242,254,0.5);
}

.copyright {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
}

@media (max-width: 600px) {
    .logo { font-size: 3rem; }
    #username-input { width: 85%; padding: 10px; font-size: 1rem; }
    #room-input { width: 85%; padding: 10px; font-size: 1rem; }
    .skin-selector { flex-wrap: wrap; justify-content: center; gap: 10px; }
    .skin-btn { padding: 8px 15px; font-size: 0.9rem; }
    .main-footer { width: 85%; padding: 15px 20px; margin-top: 30px; box-sizing: border-box; }
    .qr-code { width: 120px; height: 120px; }
}
