/* =========================================================
   TOKENS
   ========================================================= */
:root {
    --ink: #0f1115;
    --steel-900: #1c1f26;
    --steel-800: #262b35;
    --steel-700: #333a47;
    --steel-line: #414a5a;
    --olive: #6b7a3a;
    --olive-dim: #4d5a29;
    --amber: #d4a017;
    --amber-bright: #f4c542;
    --danger: #a5352f;
    --hp: #699e1a;
    --text: #eceff4;
    --text-dim: #aab0bd;

    --font-display: 'Oswald', 'Segoe UI', Verdana, Arial, sans-serif;
    --font-body: 'Rajdhani', 'Segoe UI', Verdana, Arial, sans-serif;
}

/* =========================================================
   BASE / PAGE (Discord activity — desktop only)
   ========================================================= */
html,
body {
    max-width: 100%;
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% 0%, #3a4152 0%, #232733 45%, #16181e 100%);
    font-family: var(--font-body);
    color: var(--text);
}

/* Centers the whole game on the page — this is the fix for
   "center stuff properly", since .stage previously had no rules
   at all and .container centering depended on default block flow. */
.stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 40px 0;
    box-sizing: border-box;
}

/* =========================================================
   GAME FRAME
   ========================================================= */
.container {
    background-image: url('imgs/cosa.png');
    background-size: cover;
    background-position: bottom;
    position: relative;
    overflow: hidden;
    margin: 0;
    display: block;
    width: 1000px;
    height: 450px;
    border-radius: 10px;
    border: solid 3px var(--ink);
    box-shadow:
        0 20px 45px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(212, 160, 23, 0.08);
}

/* subtle vignette so the HUD reads as an overlaid display,
   not text floating on the battlefield art */
.container::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 15;
    box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.55);
}

/* =========================================================
   GAMEPLAY OBJECTS
   ========================================================= */

/* ---- PLAYER TANK — layered gradient body, tracked wheels, gunmetal barrel ---- */
.player {
    position: relative;
    width: 70px;
    height: 35px;
    top: 375px;
    left: 40px;
    border-radius: 6px 6px 4px 4px;
    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.5),
        inset 0 2px 3px rgba(255, 255, 255, 0.15),
        inset 0 -4px 6px rgba(0, 0, 0, 0.35);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(0, 0, 0, 0.1) 60%, rgba(0, 0, 0, 0.25) 100%);
}

.lb-title {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 6px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    background-color: var(--amber);
    border-radius: 2px;
    border: 1px silver;
    vertical-align: middle;
}
.bullet {
    position: relative;
    top: 0px;
    left: 4px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    background: linear-gradient(180deg, rgb(245, 235, 210) 0%, rgb(230, 217, 182) 60%, rgb(200, 185, 150) 100%);
    box-shadow: 0 0 3px rgba(230, 217, 182, 0.6);
}

.cannon {
    border-radius: 3px;
    top: -45px;
    left: 25px;
    position: relative;
    width: 18px;
    height: 65px;
    background-image: linear-gradient(90deg,
            rgba(0, 0, 0, 0.35) 0%,
            rgba(255, 255, 255, 0.18) 30%,
            rgba(255, 255, 255, 0.05) 50%,
            rgba(0, 0, 0, 0.3) 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

/* muzzle tip */
.cannon::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -1px;
    width: 20px;
    height: 6px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.4);
}

.fallingObjectbullet {
    position: absolute;
    top: 0px;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle at 35% 30%, rgb(160, 70, 70) 0%, rgb(99, 38, 38) 70%);
    box-shadow: 0 0 3px rgba(99, 38, 38, 0.7);
    rotate: 0;
    left: 0;
    border-radius: 50%;
}

.fallingObjectbomb {
    position: absolute;
    top: 0px;
    width: 18px;
    height: 18px;
    background: radial-gradient(circle at 35% 30%, rgb(150, 60, 60) 0%, rgb(99, 38, 38) 70%);
    box-shadow: 0 0 4px rgba(99, 38, 38, 0.6);
    rotate: 0;
    left: 0;
    border-radius: 4px;
}

.wheel {
    width: 20px;
    height: 20px;
    margin-left: 10px;
    float: left;
    top: -70px;
    position: relative;
    border-radius: 50%;
    background-image: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35) 0%, rgba(0, 0, 0, 0.1) 45%, rgba(0, 0, 0, 0.5) 100%);
    box-shadow:
        inset 0 0 0 3px rgba(0, 0, 0, 0.35),
        0 2px 3px rgba(0, 0, 0, 0.4);
}

/* hubcap */
.wheel::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.color {
    background-color: rgb(255, 255, 255);
}

.planesContainer {
    margin: auto;
    position: absolute;
    width: 1000px;
    height: 130px;
}

/* ---- PLANES — shaded fuselage with a nose taper + cockpit dot ---- */


.planesContainer p.plane::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(0, 0, 0, 0.15) 55%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
}

.planesContainer p.plane::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(244, 197, 66, 0.55);
    box-shadow: 0 0 4px rgba(244, 197, 66, 0.4);
    pointer-events: none;
}

.planesContainer .Attacker {
    position: absolute;
    width: 80px;
    height: 30px;
    background-color: rgb(99, 38, 38);
    background-image: linear-gradient(90deg, rgb(76, 28, 28) 0%, rgb(99, 38, 38) 50%, rgb(122, 48, 48) 100%);
    border-radius: 6px 14px 6px 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.planesContainer .Bomber {
    position: absolute;
    width: 100px;
    height: 35px;
    background-color: rgb(87, 47, 1);
    background-image: linear-gradient(90deg, rgb(66, 35, 0) 0%, rgb(87, 47, 1) 50%, rgb(112, 62, 6) 100%);
    border-radius: 6px 16px 6px 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.planesContainer .Medic {
    position: absolute;
    width: 100px;
    height: 35px;
    background-color: rgb(60, 65, 16);
    background-image: linear-gradient(90deg, rgb(44, 48, 11) 0%, rgb(60, 65, 16) 50%, rgb(80, 87, 24) 100%);
    border-radius: 6px 16px 6px 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.planesContainer .Supplies {
    position: absolute;
    width: 90px;
    height: 28px;
    background-color: rgb(108, 114, 21);
    background-image: linear-gradient(90deg, rgb(84, 89, 15) 0%, rgb(108, 114, 21) 50%, rgb(135, 142, 30) 100%);
    border-radius: 6px 14px 6px 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.fallingObjectSupplies {
    position: relative;
    width: 25px;
    top: 0px;
    height: 15px;
    background: linear-gradient(180deg, rgb(140, 147, 40) 0%, rgb(108, 114, 21) 100%);
    box-shadow: 0 0 3px rgba(108, 114, 21, 0.6);
    border-radius: 3px;
}

.fallingObjectMedic {
    position: relative;
    width: 15px;
    top: 0px;
    height: 15px;
    background: linear-gradient(180deg, rgb(80, 145, 40) 0%, rgb(57, 109, 27) 100%);
    box-shadow: 0 0 3px rgba(57, 109, 27, 0.6);
    border-radius: 3px;
}

.coin {
    position: absolute;
    width: 16px;
    height: 20px;
    background: radial-gradient(circle at 35% 30%, #fff2b0 0%, gold 60%, #b8860b 100%);
    border-radius: 8px;
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.7);
}

.explosion {
    position: absolute;
    top: 350px;
    width: 110px;
    height: 90px;
}

/* =========================================================
   HUD — rebuilt as a flex bar (fixes overlap/overflow that
   happened with the old hard-coded pixel positions)
   ========================================================= */
.hud {
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(to bottom, rgba(10, 12, 16, 0.82) 0%, rgba(10, 12, 16, 0) 100%);
    pointer-events: none;
}

.hud-cell {
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.hud-left {
    width: 240px;
    gap: 6px;
}

.hud-center {
    flex: 1;
    align-items: center;
    text-align: center;
    padding-top: 6px;
}

.hud-right {
    width: 240px;
    align-items: flex-end;
    text-align: right;
    padding-top: 6px;
}

/* shield readout — sits above the healthbar, only shown when active */
.shield {
    position: relative;
    visibility: hidden;
    width: fit-content;
    padding: 3px 10px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--ink);
    background-color: var(--amber-bright);
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.healthbar {
    position: relative;
    width: 220px;
    height: 16px;
    border: solid 1px var(--steel-line);
    border-radius: 3px;
    background-color: rgba(15, 17, 21, 0.75);
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.hp {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, var(--hp), #8bc23f);
    transition: width 0.2s ease;
}

.alerts {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.timer-points {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--amber-bright);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* =========================================================
   OVERLAY SCREENS (menu / leaderboard)
   ========================================================= */
.screen {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 17, 21, 0.72);
    backdrop-filter: blur(2px);
}

.screen.hidden {
    display: none;
}

.hidden {
    display: none;
}

/* panel — the signature element: a steel HUD card framed with
   amber targeting-reticle corner brackets */
.panel {
    position: relative;
    width: 380px;
    padding: 34px 36px 30px;
    background: linear-gradient(180deg, var(--steel-800) 0%, var(--steel-900) 100%);
    border: 1px solid var(--steel-line);
    border-radius: 6px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    text-align: center;
}

.panel::before,
.panel::after,
.panel .eyebrow::before,
.panel .eyebrow::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid var(--amber);
    opacity: 0.85;
}

.panel::before {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
}

.panel::after {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
}

.panel .eyebrow::before {
    position: absolute;
    bottom: -37px;
    left: -39px;
    top: auto;
    right: auto;
    border-right: 2px solid var(--amber);
    border-top: none;
}

.panel .eyebrow::after {
    display: none;
}

.eyebrow {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--amber);
}

.title {
    margin: 0 0 22px;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text);
}

.player-tag {
    display: inline-block;
    margin-bottom: 24px;
    padding: 6px 16px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--amber-bright);
    background: rgba(212, 160, 23, 0.08);
    border: 1px solid var(--steel-line);
    border-radius: 3px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
    background-color: var(--steel-700);
    border: 1px solid var(--steel-line);
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn:hover {
    background-color: #3d4756;
    border-color: var(--amber);
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: 2px solid var(--amber-bright);
    outline-offset: 2px;
}

.btn-primary {
    color: var(--ink);
    background: linear-gradient(180deg, var(--amber-bright) 0%, var(--amber) 100%);
    border-color: var(--amber);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #ffd766 0%, var(--amber-bright) 100%);
    border-color: var(--amber-bright);
}

/* =========================================================
   ROUND STATS (post-round summary on menu screen)
   ========================================================= */
.round-stats {
    list-style: none;
    margin: 0 0 22px;
    padding: 14px 0;
    border-top: 1px solid var(--steel-line);
    border-bottom: 1px solid var(--steel-line);
    text-align: left;
}

.round-stats li {
    display: flex;
    justify-content: space-between;
    padding: 4px 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dim);
}

.round-stats li span:last-child {
    color: var(--amber-bright);
    font-family: var(--font-display);
}

/* =========================================================
   LEADERBOARD
   ========================================================= */
.leaderboard-screen .panel {
    width: 420px;
    text-align: left;
}

.leaderboard-screen .title,
.leaderboard-screen .eyebrow {
    text-align: center;
    font-size: 20px !important;
}
.leaderboard {
    counter-reset: rank;
    list-style: none;
    margin: 0 0 26px;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
}

.leaderboard li {
    counter-increment: rank;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 6px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard li:last-child {
    border-bottom: none;
}
.leaderboard li:first-child {
    background-color: rgba(255, 217, 0, 0.35);
}
.leaderboard li:nth-child(2) {
    background-color: rgba(192, 192, 192, 0.35);
}
.leaderboard li:nth-child(3) {
    background-color: rgba(153, 80, 37, 0.35);
}
.leaderboard li::before {
    content: counter(rank, decimal-leading-zero);
    flex-shrink: 0;
    width: 28px;
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--amber);
    text-align: right;
}

/* =========================================================
   CONTROLS SCREEN
   ========================================================= */
#controls-screen .panel {
    width: 420px;
    text-align: left;
}

#controls-screen .title,
#controls-screen .eyebrow {
    text-align: center;
}

#controls-screen .panel p {
    margin: 4px 0;
}
