html,
body,
#app {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    background: #07161b;
    color: #f3f7ee;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(20, 31, 36, 0.88);
    color: #f5f8ee;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 0;
}

button:hover,
button:focus-visible,
button.active {
    background: #9f3032;
    outline: 2px solid rgba(255, 235, 117, 0.55);
}

.game-shell {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #0b6e93;
}

.game-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}

.hud {
    position: absolute;
    z-index: 5;
    background: rgba(12, 20, 23, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

.top-hud {
    top: 0;
    left: 0;
    right: 0;
    min-height: 62px;
    display: grid;
    grid-template-columns: 230px repeat(5, minmax(95px, 1fr));
    align-items: center;
    gap: 12px;
    padding: 0 18px;
}

.top-hud div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    color: #d7e3dd;
}

.top-hud strong {
    color: #fff2bd;
}

.brand {
    font-size: 23px !important;
    font-weight: 950;
    color: #f8f6df !important;
}

.weapon-hud {
    left: 18px;
    bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    padding: 8px;
    max-width: calc(100vw - 36px);
    flex-wrap: wrap;
}

.weapon-hud span,
.aim-hud span {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 13px;
    font-weight: 800;
    color: #f6f2d6;
}

.aim-hud {
    right: 18px;
    bottom: 18px;
    display: flex;
    gap: 8px;
    padding: 8px;
}

.commander {
    position: absolute;
    z-index: 6;
    top: 78px;
    right: 18px;
    width: min(410px, calc(100vw - 36px));
    min-height: 76px;
    display: grid;
    grid-template-columns: 138px 1fr;
    gap: 20px;
    align-items: center;
    padding: 12px 18px 12px 12px;
    background: rgba(244, 247, 238, 0.92);
    border: 1px solid rgba(28, 35, 36, 0.16);
    color: #172126;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24);
}

.commander p {
    margin: 0;
    font-weight: 900;
    line-height: 1.25;
}

.portrait {
    position: relative;
    width: 114px;
    height: 114px;
    background: #fbfbf4;
    border: 12px solid #162534;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.portrait .hair,
.portrait .face,
.portrait .tie,
.portrait .suit,
.portrait .shirt,
.portrait .brow,
.portrait .eye,
.portrait .nose,
.portrait .mouth {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.portrait .suit {
    bottom: 8px;
    width: 72px;
    height: 51px;
    background: linear-gradient(90deg, #14233b 0 22%, transparent 22% 78%, #14233b 78% 100%);
    clip-path: none;
    z-index: 2;
}

.portrait .shirt {
    bottom: 8px;
    width: 27px;
    height: 31px;
    background: #f9f2dd;
    clip-path: none;
    z-index: 3;
}

.portrait .hair {
    top: 24px;
    width: 72px;
    height: 26px;
    background: #f6cf48;
    border-radius: 0;
    clip-path: polygon(0 0, 94% 0, 100% 72%, 52% 100%, 4% 86%);
    box-shadow: none;
    z-index: 5;
}

.portrait .hair::before {
    content: "";
    position: absolute;
    left: 30px;
    top: 9px;
    width: 43px;
    height: 16px;
    background: #e7b63b;
    border-radius: 0;
    transform: rotate(-13deg);
}

.portrait .hair::after {
    content: "";
    position: absolute;
    left: 38px;
    top: 17px;
    width: 22px;
    height: 8px;
    background: #f6cf48;
    border-radius: 0;
    transform: none;
}

.portrait .face {
    top: 48px;
    width: 56px;
    height: 42px;
    background: #eaa06f;
    border-radius: 0;
    z-index: 3;
}

.portrait .face::before,
.portrait .face::after {
    content: none;
}

.portrait .face::before {
    left: -3px;
}

.portrait .face::after {
    right: -3px;
}

.portrait .brow {
    top: 52px;
    width: 28px;
    height: 4px;
    background: #875431;
    border-radius: 0;
    z-index: 6;
}

.portrait .brow.left {
    margin-left: 0;
    transform: translateX(-50%);
}

.portrait .brow.right {
    display: none;
}

.portrait .eye {
    top: 60px;
    width: 5px;
    height: 5px;
    background: #1f2930;
    border-radius: 0;
    z-index: 6;
}

.portrait .eye.left {
    margin-left: -8px;
}

.portrait .eye.right {
    margin-left: 11px;
}

.portrait .nose {
    display: none;
}

.portrait .mouth {
    top: 68px;
    width: 29px;
    height: 18px;
    background: #5b2426;
    border-radius: 0;
    margin-left: 15px;
    z-index: 6;
    animation: none;
}

.portrait .tie {
    bottom: 8px;
    width: 12px;
    height: 22px;
    background: #b72d2f;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    z-index: 4;
}

.overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    background: rgba(4, 12, 15, 0.55);
}

.modal-panel {
    width: min(520px, calc(100vw - 32px));
    padding: 28px;
    background: #f5f7ef;
    color: #142127;
    border: 1px solid rgba(255, 255, 255, 0.48);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

.modal-panel h1 {
    margin: 0 0 10px;
    font-size: 34px;
    letter-spacing: 0;
}

.modal-panel p {
    margin: 0 0 22px;
    line-height: 1.45;
    font-weight: 700;
}

.modal-panel button {
    background: #276246;
}

.dialog-commander {
    display: grid;
    grid-template-columns: 114px 1fr;
    gap: 16px;
    align-items: center;
    margin: 12px 0 18px;
    padding: 12px;
    background: #fbfbf4;
    border: 1px solid rgba(20, 33, 39, 0.16);
}

.dialog-commander .portrait {
    transform: scale(0.72);
    transform-origin: left center;
}

.dialog-commander p {
    margin: 0 !important;
    font-size: 22px;
    font-weight: 950;
    line-height: 1.18;
    text-align: center;
}

.score-submit {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-bottom: 10px;
}

.score-submit input {
    min-width: 0;
    min-height: 36px;
    border: 1px solid rgba(20, 33, 39, 0.24);
    border-radius: 6px;
    padding: 0 10px;
    font: inherit;
    font-weight: 800;
    color: #142127;
}

.submit-message {
    margin: 0 0 12px !important;
    color: #7b2d2f;
    font-size: 14px;
}

.leaderboard {
    margin: 16px 0 18px;
}

.leaderboard h2 {
    margin: 0 0 8px;
    font-size: 20px;
    letter-spacing: 0;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(20, 33, 39, 0.14);
    font-weight: 800;
}

.leaderboard-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    padding: 0.7rem 1rem;
    background: #b32121;
    color: white;
}

@media (max-width: 900px) {
    .top-hud {
        grid-template-columns: repeat(3, 1fr);
        min-height: 92px;
        gap: 4px 10px;
    }

    .brand {
        grid-column: 1 / -1;
        font-size: 20px !important;
    }

    .commander {
        top: 104px;
        right: 10px;
        width: min(330px, calc(100vw - 20px));
    }

    .aim-hud {
        right: 10px;
        bottom: 158px;
    }

    .weapon-hud {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }
}
