/* #region Foundation and arena */
:root {
    color-scheme: dark;
    --gold: #e2c16e;
    --red: #811f2d;
    --ink: #090b12;
    --muted: #a9a9b2;
    --line: #625850;
    font-family: Arial,Helvetica,sans-serif;
    color: #ede7da;
    background: #070912;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
}

button,input,select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    opacity: .5;
    cursor: wait;
}

[hidden] {
    display: none!important;
}

#arena {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    outline: none;
}

#vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 130px #0004;
}
/* #endregion */

/* #region Sniper and guided Redeemer sights */
.weapon-scope {
    position: fixed;
    inset: 0;
    pointer-events: none;
    /* vmin preserves a real circle on ultrawide and portrait viewports; the exterior stays opaque. */
    background: radial-gradient(circle at center, transparent 0 calc(46vmin - 1px), #000 46vmin);
}

.weapon-scope-sight {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 92vmin;
    height: 92vmin;
    transform: translate(-50%, -50%);
    border: 2px solid #484b38;
    border-radius: 50%;
    background: center / 55% 55% no-repeat;
}

.weapon-scope[data-kind="sniper"] .weapon-scope-sight {
    background-image: none!important;
    border-color: #303030;
}

.weapon-scope[data-kind="sniper"] .weapon-scope-sight::before,
.weapon-scope[data-kind="sniper"] .weapon-scope-sight::after {
    content: "";
    position: absolute;
    background: #101010;
    box-shadow: 0 0 1px #fff7;
}

.weapon-scope[data-kind="sniper"] .weapon-scope-sight::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
}

.weapon-scope[data-kind="sniper"] .weapon-scope-sight::after {
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
}

body.weapon-scoped #crosshair,
body[data-match-state="paused"] .weapon-scope {
    display: none;
}
/* #endregion */

/* #region Authoritative HUD team palette */
body {
    --hud-text: #d3e1ff;
    --hud-diagnostics: #a9ccff;
    --hud-feed: #001b552e;
    --hud-band: rgb(0 40 160 / 8%);
    --hud-border: #315f9b;
}

body[data-hud-team="red"] {
    --hud-text: #ffd3d3;
    --hud-diagnostics: #ffa9a9;
    --hud-feed: #5500002e;
    --hud-band: rgb(160 0 0 / 8%);
    --hud-border: #9b3131;
}

/* #endregion */

/* #region Original HUD and scoreboard (independent of menu theme) */
.window {
    border: 1px solid #8e7e63;
    background: linear-gradient(135deg,#161922f5,#0a0d15f5);
    box-shadow: 0 0 0 3px #151417,0 15px 70px #0009;
    min-width: 330px;
    width: 365px;
}

.window-title {
    background: linear-gradient(#8f303a,#49151e);
    border-bottom: 1px solid #9a6c58;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1.7px;
    color: #edd9b6;
    text-shadow: 0 1px #000;
}

.window-title span:last-child {
    opacity: .7;
}

/* #region Match information and diagnostics */
#hud {
    --hud-margin: clamp(8px, 1.25vw, 20px);
    --hud-band-height: clamp(32px, 5vw, 96px);
    --hud-status-width: clamp(96px, 10vw, 192px);
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.match-top {
    position: absolute;
    top: var(--hud-margin);
    left: var(--hud-margin);
    right: var(--hud-margin);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--hud-margin);
    align-items: start;
    font-size: 10px;
    color: var(--hud-text);
    text-shadow: 0 1px 3px #000;
}

.match-details,.match-timing {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#hud-map {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--hud-text);
}

.match-timing {
    text-align: center;
}

#match-clock {
    font: bold clamp(18px, 2vw, 28px) monospace;
    color: #fff;
}

#match-rule {
    overflow-wrap: anywhere;
}

#debug {
    font: 11px/1.4 monospace;
    color: var(--hud-diagnostics);
    overflow-wrap: anywhere;
}

#debug:empty {
    display: none;
}
/* #endregion */

/* #region Original aiming reticle */
#crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(48px, 10vw, 128px);
    height: clamp(48px, 10vw, 128px);
    transform: translate(-50%, -50%);
    background: url('/assets/textures/hud/crosshair.png') center / contain no-repeat;
    pointer-events: none;
}
/* #endregion */

/* #region Native target identification */
#target-identify {
    position: absolute;
    left: 50%;
    /* Native Y = viewport height - 256 * (viewport width / 1280); keep wide screens below the reticle. */
    top: max(56%, calc(100% - 20vw));
    transform: translateX(-50%);
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /*font-size: clamp(16px, 2vw, 32px);*/
    font-size: clamp(14px, 1.5vw, 26px);
    color: #00a000;
    text-shadow: 0 1px 3px #000;
}

#target-name {
    color: #00ff00;
}

#target-identify[data-team="red"] {
    color: #c80000;
}

#target-identify[data-team="red"] #target-name {
    color: #ff0000;
}

#target-identify[data-team="blue"] {
    color: #005ebb;
}

#target-identify[data-team="blue"] #target-name {
    color: #0080ff;
}

body.scores-open #target-identify {
    display: none;
}
/* #endregion */

#hitmarker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    font-size: 40px;
    color: #ff7565;
    opacity: 0;
}

#hitmarker.active {
    animation: hit .2s;
}

/* #region Combat feed and original inventory panels */
#feed {
    position: absolute;
    top: calc(var(--hud-status-width) + var(--hud-margin));
    right: var(--hud-margin);
    width: min(380px, 45vw);
    max-height: max(0px, calc(100% - var(--hud-status-width) - var(--hud-band-height) - 64px));
    overflow: hidden;
    font-size: 12px;
    text-align: right;
    text-shadow: 0 2px 3px #000;
}

#feed p {
    background: var(--hud-feed);
    padding: 6px 8px;
    margin: 4px 0;
    color: var(--hud-text);
}

.hud-vitals {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--hud-status-width);
    display: grid;
    grid-template-rows: repeat(2, 1fr);
    aspect-ratio: 1;
}

.hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--hud-band-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 8fr) minmax(0, 1fr);
    background: var(--hud-band);
}

.hud-readout,#weapon-list {
    position: relative;
    min-width: 0;
    min-height: 0;
}

.hud-readout canvas,.original-weapon-bar {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

/* Text stays accessible; it is also the visible fallback while local art is unavailable. */
.hud-readout-text,.hud-weapon-text {
    position: relative;
    display: block;
    padding: 2px;
    max-height: 100%;
    overflow: auto;
    font: 10px/1.2 monospace;
    color: #fff;
    overflow-wrap: anywhere;
}

.hud-readout-text b {
    display: block;
    font-size: clamp(16px, 2.5vw, 36px);
}

.hud-art-ready .hud-readout-text,.hud-art-ready .hud-weapon-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

#hud-rank {
    position: absolute;
    bottom: calc(var(--hud-band-height) + 8px);
    left: var(--hud-margin);
    font: bold clamp(12px, 1.5vw, 22px)/1.2 monospace;
    color: #fff;
    text-shadow: 0 1px 3px #000;
}
/* #endregion */

#notice {
    position: absolute;
    top: 65%;
    left: 50%;
    transform: translateX(-50%);
    color: #f1d089;
    text-shadow: 0 2px 3px #000;
    font-size: 14px;
    letter-spacing: 1px;
}

/* #endregion */

/* #region Native TournamentScoreboard presentation */
#scoreboard {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3;
    padding: clamp(20px, 7.5vh, 72px) max(20px, calc((100vw - 1200px) / 2)) 20px;
    color: #fff;
    background: linear-gradient(#0005, #0002 45%, #0007);
    text-shadow: 1px 2px 2px #000, 0 0 6px #000;
    font-family: "Arial Narrow", Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

body.scores-open #scoreboard,
body.match-finished #scoreboard,
body.awaiting-respawn #scoreboard {
    display: flex;
    flex-direction: column;
}

/* ChallengeHUD.PostRender returns after ShowScores, leaving the arena behind the standings. */
body:is(.scores-open, .match-finished, .awaiting-respawn) :is(#hud, #match-start, #observer-help) {
    display: none;
}

.score-header {
    text-align: center;
    flex: 0 0 auto;
}

#scoreboard-title, #result {
    margin: 0 0 8px;
    font-size: clamp(24px, 3vw, 42px);
    line-height: 1.15;
}

#scoreboard:has(#result:not([hidden])) #scoreboard-title {
    display: none;
}

#scoreboard-rules {
    margin: 0;
    font-size: clamp(15px, 1.8vw, 24px);
}

#round, #mutator-status, #mode-summary {
    text-align: center;
    font-size: clamp(11px, 1.1vw, 15px);
    margin: 8px 0 0;
}

#round {
    color: #80ffff;
}

#mode-summary:empty, #mutator-status:empty, #result-time:empty {
    display: none;
}

#change-team-field {
    align-self: center;
    margin: 12px 0 0;
    font-size: 13px;
}

#change-team {
    color: #fff;
    border: 1px solid #80ffff80;
    background: #071323;
    padding: 4px 8px;
}

/* Only the standings scroll, keeping result and respawn instructions on screen. */
.score-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-anchor: none;
    scrollbar-width: thin;
    margin: clamp(18px, 3vh, 32px) 0;
}

#scores {
    width: min(100%, 980px);
    margin: 0 auto;
}

#scoreboard table {
    border-collapse: separate;
    border-spacing: 0 3px;
    width: 100%;
    table-layout: fixed;
}

/* A subtle gray backing separates player rows while leaving the arena visible. */
#scoreboard tbody tr {
    background: rgb(96 96 96 / 24%);
}

#scoreboard th, #scoreboard td {
    border: 0;
    padding: 6px 12px;
    line-height: 1.25;
}

#scoreboard th {
    color: #fff;
    font-size: clamp(14px, 1.6vw, 22px);
    letter-spacing: 0;
    text-align: right;
    padding-bottom: 14px;
}

#scoreboard th:first-child, #scoreboard td:first-child {
    width: 60%;
    text-align: left;
}

#scoreboard td {
    color: #80ffff;
    font-size: clamp(18px, 2vw, 28px);
    text-align: right;
    vertical-align: top;
}

#scoreboard td:first-child {
    color: #0080ff;
}

.score-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#scoreboard td small {
    display: block;
    font-size: 10px;
    color: #fff;
    margin-top: 2px;
}

#scoreboard tr.self td, #result {
    color: #ffff00;
}

#scoreboard[data-mode="LMS"] tr:not(.eliminated) td:nth-child(2) {
    color: #ffff00;
}

#scoreboard .score-empty {
    text-align: center;
    font-size: 14px;
    color: #fff;
}

#scores.score-teams {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(16px, 4vw, 64px);
    width: 100%;
}

.score-team {
    --score-team-color: #0080ff;
    --score-team-name: #609fff;
    min-width: 0;
}

.score-team[data-team="0"] {
    --score-team-color: #ff3030;
    --score-team-name: #ff7070;
}

.score-team h3 {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0 12px 12px;
    font-size: clamp(20px, 2.3vw, 32px);
    color: var(--score-team-color);
}

#scoreboard .score-team td {
    color: var(--score-team-color);
    font-size: clamp(16px, 1.6vw, 23px);
}

#scoreboard .score-team td:first-child {
    color: var(--score-team-name);
}

#scoreboard .score-team tr.self td {
    color: #ffff00;
}

/* Native green restart instructions sit above the map/time trailer. */
#death {
    text-align: center;
    margin: 0 0 12px;
    color: #00ff00;
    font-size: clamp(14px, 1.6vw, 20px);
}

#death p {
    margin: 4px 0;
}

#death p:first-child {
    font-size: 12px;
}

#respawn-error {
    color: #ff7070;
    font-size: 12px;
}

#respawn-error:empty {
    display: none;
}

body[data-match-state="waiting-respawn"]:not(.match-finished) #scoreboard {
    cursor: pointer;
}

.score-footer {
    flex: 0 0 auto;
    text-align: center;
    font-size: clamp(12px, 1.3vw, 18px);
}

.score-footer p {
    margin: 4px 0 0;
}

#result-time {
    color: #00ff00;
}

#scoreboard-scroll-hint {
    color: #80ffff;
    font-size: 11px;
}

@media (max-width: 640px) {
    #scoreboard {
        padding: 18px 12px 12px;
    }

    #scores.score-teams {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    #scoreboard th, #scoreboard td {
        padding-left: 6px;
        padding-right: 6px;
    }
}

@media (max-height: 500px) {
    #scoreboard {
        padding-top: 12px;
        padding-bottom: 8px;
    }

    .score-list {
        margin: 12px 0;
    }
}
/* #endregion */

/* #region Match feedback */
#loading-error {
    position: fixed;
    bottom: 55px;
    left: 20px;
    right: 20px;
    background: #601b26;
    padding: 15px;
    border: 1px solid #bf7869;
    font-size: 13px;
    z-index: 10;
}

#weapon-charge {
    position: fixed;
    top: 56%;
    left: 50%;
    transform: translateX(-50%);
    color: #ffdc77;
    font: bold 22px monospace;
}

#notice {
    max-width: 90vw;
    text-align: center;
}

#loading-error,#feed p {
    overflow-wrap: anywhere;
}
@keyframes hit {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@media (max-width: 900px) {
    .window {
        min-width: 315px;
        width: 330px;
    }
}
/* #endregion */

/* #region Steel and electric blue menu tokens */
.ut-menu {
    --menu-ink: #eaf2fc;
    --menu-muted: #a5b5c9;
    --menu-border: #304258;
    --menu-panel: #172231;
    --menu-accent: #64b5ff;
    --menu-focus: #b9ddff;
    color-scheme: dark;
    color: var(--menu-ink);
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    scrollbar-color: #49617d #101925;
}

.ut-menu .window, dialog.ut-menu, .ut-menu .language-menu {
    border: 1px solid var(--menu-border);
    border-radius: 3px;
    background: linear-gradient(145deg, #1b2a3c, var(--menu-panel) 55%, #131e2c);
    box-shadow: 0 24px 64px #0005, 0 1px 0 #ffffff06 inset;
}

.ut-menu .window-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--menu-border);
    background: #0d182366;
    color: var(--menu-ink);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1.8px;
    text-shadow: none;
}

.ut-menu .window-title > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ut-menu .window-title > span:first-child::before {
    content: "";
    width: 3px;
    height: 16px;
    background: var(--menu-accent);
    box-shadow: 0 0 12px #64b5ff40;
}

.ut-menu .window-title > span:last-child:not(:first-child) {
    color: var(--menu-muted);
    font: 11px "Segoe UI", Arial, sans-serif;
    letter-spacing: 1px;
    opacity: 1;
}

.ut-menu button {
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid #425a75;
    border-radius: 3px;
    background: #1c2c40;
    color: var(--menu-ink);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: .6px;
    transition: background-color 150ms, border-color 150ms, color 150ms, box-shadow 150ms;
}

.ut-menu button:hover:not(:disabled) {
    border-color: var(--menu-accent);
    background: #263d57;
    color: #fff;
}

.ut-menu button:active:not(:disabled),
.ut-menu button[aria-expanded="true"],
.ut-menu button[aria-pressed="true"] {
    border-color: var(--menu-accent);
    background: #152e49;
    color: var(--menu-focus);
}

.ut-menu button:disabled {
    border-color: #304258;
    background: #172231;
    color: #8495ac;
    opacity: 1;
    cursor: default;
}

.ut-menu .primary {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 0;
    background: linear-gradient(135deg, transparent 7px, var(--menu-accent) 0);
    color: #081522;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .9px;
}

.ut-menu .primary {
    width: 100%;
}

.ut-menu .primary:hover:not(:disabled) {
    border-color: transparent;
    background: linear-gradient(135deg, transparent 7px, #91cbff 0);
    color: #081522;
    box-shadow: 0 6px 24px #64b5ff1c;
}

.ut-menu .primary:active:not(:disabled) {
    background: linear-gradient(135deg, transparent 7px, #4a9ee9 0);
}

.ut-menu .primary:disabled {
    border-color: var(--menu-border);
    background: #15202f;
    color: #8495ac;
}

.ut-menu .quiet {
    width: 100%;
    margin-top: 10px;
    border-color: transparent;
    background: transparent;
    color: var(--menu-muted);
}

.ut-menu .field {
    display: block;
    margin-bottom: 18px;
    color: var(--menu-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .4px;
}

.ut-menu input:not([type="checkbox"]):not([type="range"]), .ut-menu select {
    display: block;
    width: 100%;
    min-height: 42px;
    margin: 8px 0 0;
    padding: 10px 12px;
    border: 1px solid var(--menu-border);
    border-radius: 3px;
    background: #0e1825;
    color: var(--menu-ink);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: normal;
    transition: border-color 150ms, background-color 150ms;
}

.ut-menu input:hover:not(:disabled), .ut-menu select:hover:not(:disabled) {
    border-color: #587496;
}

.ut-menu input:disabled, .ut-menu select:disabled, .ut-menu option:disabled {
    color: #8495ac;
    cursor: default;
}

.ut-menu option, .ut-menu optgroup {
    color: var(--menu-ink);
    background: #0e1825;
}

.ut-menu input[type="range"] {
    width: clamp(90px, 25vw, 140px);
    accent-color: var(--menu-accent);
}

.ut-menu input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--menu-accent);
}

.ut-menu :is(button, input, select, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--menu-focus);
    outline-offset: 3px;
}

.ut-menu details {
    padding: 16px 0;
    border-top: 1px solid var(--menu-border);
    border-bottom: 1px solid var(--menu-border);
}

.ut-menu summary {
    color: var(--menu-ink);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.ut-menu .map-caption {
    margin: 8px 0 18px;
    color: var(--menu-muted);
    font-size: 12px;
    line-height: 1.6;
}

.ut-menu :is(p, td, .map-caption) {
    overflow-wrap: anywhere;
}

dialog.ut-menu {
    max-height: 92vh;
    padding: 0;
}

dialog.ut-menu::backdrop {
    background: #060b14c9;
}
/* #endregion */

/* #region Graphite home, silver branding and Escape home */
#menu {
    position: fixed;
    inset: 0;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    background: radial-gradient(ellipse at 20% 36%, #1a35504d, transparent 58%),
                radial-gradient(ellipse at 90% 10%, #1f426c30, transparent 48%), #0b1018;
}

/* The original emblem supplies identity without loading the legacy window textures. */
#menu::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: url('/assets/textures/menu/ut-mark.png') no-repeat -80px 58% / min(65vw, 850px) auto;
    filter: grayscale(1) brightness(2);
    opacity: .035;
    pointer-events: none;
}

/* Escape keeps the opaque home background and hides independently updated game surfaces. */
body[data-match-state="paused"] :is(#arena, #hud, #vignette, #scoreboard, #match-start, #match-loading) {
    display: none!important;
}

.topbar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 18px;
    height: 76px;
    padding: 0 4vw;
    border-bottom: 1px solid #30425880;
    background: #0a121ed9;
}

.mark {
    width: 38px;
    height: 32px;
    object-fit: contain;
    filter: grayscale(1) brightness(1.65);
}

.topbar strong {
    color: #a5b5c9;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.ut-menu .icon-button {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-color: transparent;
    background: #142131;
    color: var(--menu-muted);
}

.icon-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.menu-content {
    display: flex;
    flex: 1;
    align-items: flex-start;
    justify-content: space-between;
    gap: 56px;
    min-height: 0;
    padding: clamp(32px, 7vh, 80px) 6vw;
    overflow: auto;
}

.intro {
    flex: 1 1 400px;
    min-width: 0;
    max-width: 520px;
    padding: 24px 0;
    color: var(--menu-ink);
}

.eyebrow, .edition {
    color: var(--menu-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 3px;
}

.eyebrow {
    margin-bottom: 24px;
}

.intro h1 {
    margin: 0;
    line-height: 1;
}

.ut-logo {
    display: block;
    width: 100%;
    height: auto;
    filter: grayscale(1) brightness(1.65) contrast(.9) drop-shadow(0 8px 16px #0006);
}

.edition {
    margin-top: 24px;
    color: var(--menu-accent);
}

.rule {
    width: 56px;
    height: 2px;
    margin: 40px 0 28px;
    background: var(--menu-accent);
    box-shadow: 0 0 16px #64b5ff30;
}

.tagline {
    max-width: 450px;
    margin: 0 0 20px;
    font-size: clamp(25px, 2.1vw, 32px);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -.6px;
}

.subline {
    color: var(--menu-muted);
    font-size: 14px;
    line-height: 1.9;
}

.map-facts {
    display: flex;
    gap: 32px;
    margin-top: 32px;
    color: var(--menu-muted);
    font-size: 10px;
    letter-spacing: 1px;
}

.map-facts b {
    display: block;
    margin-bottom: 6px;
    color: var(--menu-ink);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0;
}

#menu footer {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 48px;
    padding: 12px 4vw;
    border-top: 1px solid #30425880;
    background: #0a121e80;
    color: var(--menu-muted);
    font-size: 10px;
    letter-spacing: 1px;
}

#server-status {
    display: inline-flex;
    margin-left: auto;
    color: #b8cfe8;
    font-size: 10px;
    line-height: 1.5;
}

/* Connection failures stay conspicuous until a successful lobby refresh. */
#server-status.is-offline {
    padding: 5px 10px;
    border: 1px solid #ef6c75;
    border-radius: 3px;
    background: #491d28;
    color: #ffb6bc;
    font-size: 11px;
    font-weight: 700;
}
/* #endregion */

/* #region Match browser and creation */
.menu-content > .window {
    flex: 1 1 780px;
    min-width: 0;
    width: min(900px, 100%);
    max-width: 900px;
    border-top-color: #4d7399;
}

/* The Escape panel follows its visible text and buttons instead of the room table. */
#menu.in-match #lobby-window {
    flex: 0 1 auto;
    width: max-content;
    max-width: 100%;
}

#menu.in-match #lobby-window .panel-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.panel-content {
    padding: 28px;
}

/* Keep list navigation above matches and creation in its own section below them. */
.lobby-browse-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lobby-browse-header h2 {
    flex: 1 1 220px;
    min-width: 0;
    margin: 0;
    color: var(--menu-ink);
    font-size: 20px;
    line-height: 1.3;
}

.lobby-browse-header button {
    flex: 0 0 auto;
}

/* Announce an in-flight refresh without removing the button from keyboard focus. */
.lobby-browse-header button[aria-disabled="true"] {
    opacity: .6;
    cursor: progress;
}

.lobby-instructions {
    margin: 12px 0 16px;
    color: var(--menu-muted);
    font-size: 13px;
    line-height: 1.6;
}

#browse-panel #password-field {
    margin: 16px 0 0;
}

.lobby-create-section {
    margin-top: 20px;
}

/* Frame the joining/creation alternative with decorative lines that adapt to available width. */
.lobby-choice-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    color: var(--menu-muted);
    font-size: 13px;
    line-height: 1.5;
}

.lobby-choice-divider::before,
.lobby-choice-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--menu-border);
}

.lobby-create-section p {
    margin: 0 0 12px;
    color: var(--menu-muted);
    font-size: 13px;
    line-height: 1.5;
}

.ut-menu .lobby-create-section button {
    width: 100%;
    max-width: 100%;
    white-space: normal;
}

.lobby-table-scroll {
    max-height: 360px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--menu-border);
    border-radius: 3px;
    background: #0e1825;
}

/* Share available width between text columns while reserving space for actions. */
#matches-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

#matches-table th:nth-child(1) {
    width: calc(18% - 18px);
}

#matches-table th:nth-child(3) {
    width: calc(18% - 18px);
}

#matches-table th:nth-child(4) {
    width: calc(18% - 18px);
}

#matches-table th:nth-child(5) {
    width: calc(22% - 22px);
}

#matches-table th:nth-child(6) {
    width: 100px;
}

#matches-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 14px clamp(2px, .6vw, 8px);
    border-bottom: 1px solid var(--menu-border);
    background: #1b2b3e;
    color: #b3c4d9;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

#matches-table td {
    padding: 16px clamp(2px, .6vw, 8px);
    border-bottom: 1px solid #23354b;
    color: inherit;
    font: 13px/1.6 "Segoe UI", Arial, sans-serif;
    vertical-align: middle;
}

/* Clip text inside cells so action buttons and focus outlines remain visible. */
#matches-table .match-cell-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#matches-table :is(th, td):nth-child(4) {
    text-align: center;
}

#matches-table :is(th, td):nth-child(6) {
    padding-right: 4px;
    padding-left: 4px;
}

#matches-table tbody tr {
    transition: background-color 150ms;
}

#matches-table tbody tr:hover {
    background: #16283d;
}

/* Primary join actions stay inside the reserved table column. */
#matches-table button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 36px;
    padding: 7px 8px;
    font-size: 11px;
    letter-spacing: 0;
    white-space: nowrap;
}

#lobby-state, #connection {
    min-height: 20px;
    margin: 18px 0;
    color: var(--menu-muted);
    font-size: 12px;
    line-height: 1.7;
}

#connection {
    margin-bottom: 0;
}

/* An idle connection has no message or reserved paragraph spacing. */
#connection:empty {
    display: none;
}

/* Creation retains the browsing layout and keeps compact controls inside the lobby. */
#lobby-window:has(#create-form:not([hidden])) .panel-content {
    padding: 16px 24px;
}

/* Center the lobby in the space available beside the branding. */
#lobby-window.window {
    width: min(820px, 100%);
    max-width: 820px;
    margin-inline: auto;
}

.creation-tabs {
    margin-bottom: 16px;
}

.creation-grid {
    display: grid;
    align-items: start;
    gap: 10px 24px;
}

.creation-grid > *, .player-fields {
    min-width: 0;
}

.creation-map {
    grid-column: 1 / -1;
}

/* Stack the native screenshot below the selector with a fixed, compact footprint. */
.map-choice {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.map-preview {
    display: grid;
    place-items: center;
    width: 196px;
    height: 196px;
    overflow: hidden;
    border: 1px solid var(--menu-border);
    background: #080f18;
}

.map-preview img {
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.map-preview > span {
    padding: 4px;
    color: var(--menu-muted);
    font-size: 10px;
    line-height: 1.3;
    text-align: center;
    overflow-wrap: anywhere;
}

/* Small or short windows retain the vertical layout with a smaller screenshot. */
@media (max-width: 550px), (max-height: 650px) {
    .map-choice {
        gap: 8px;
    }
    .map-preview {
        width: 64px;
        height: 64px;
    }
}

.ut-menu :is(.creation-grid, .player-fields) .field {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--menu-ink);
    font-size: 14px;
    line-height: 1.3;
    letter-spacing: normal;
}

/* Give the Map vertical align top. */
#creation-panel-match .field.map-field,
#creation-panel-match .field.map-field .map-choice {
    align-items: flex-start;
}

/* Give the player and bot labels more room within their creation tab. */
#creation-panel-bots .field {
    grid-template-columns: 250px minmax(0, 1fr);
}

.ut-menu :is(.creation-grid, .player-fields) :is(input:not([type="checkbox"]), select) {
    min-width: 0;
    min-height: 36px;
    margin: 0;
    padding: 7px 10px;
}

/* Keep the filling total and its player unit together at every screen width. */
.population-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

#create-form .map-caption, .player-fields .map-caption {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.4;
}

.creation-map .map-caption {
    display: inline-block;
    margin-right: 12px;
}

.creation-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.ut-menu .creation-actions button {
    flex: 1;
    width: auto;
    margin: 0;
}

#lobby-window:has(#create-form:not([hidden])) #connection {
    margin-top: 8px;
}
/* #endregion */

/* #region Language chooser and settings */
.language-control {
    position: relative;
}

.language-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 5;
    min-width: 165px;
    padding: 8px;
}

.language-menu button {
    display: block;
    width: 100%;
    margin: 3px 0;
    border-color: transparent;
    background: transparent;
    text-align: left;
    font-size: 13px;
}

dialog.ut-menu .window-title {
    min-height: 56px;
    padding: 8px 20px;
}

.settings-dialog {
    width: min(760px, 95vw);
}

.settings-tabs, .creation-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--menu-border);
    background: #101b2980;
}

.ut-menu :is(.settings-tabs, .creation-tabs) button {
    flex: 1 0 auto;
    padding: 8px 10px;
    border-color: transparent;
    background: transparent;
    color: var(--menu-muted);
    font-size: 14px;
    letter-spacing: 0;
}

.ut-menu :is(.settings-tabs, .creation-tabs) button[aria-selected="true"] {
    border-color: #3e6a93;
    background: #152e49;
    color: var(--menu-accent);
    box-shadow: inset 0 -2px var(--menu-accent);
}

.settings-fields {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 18px 24px;
}

.settings-fields label {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    font-size: 16px;
    line-height: 1.4;
}

.settings-fields label:not(.check) > span {
    flex: 0 1 280px;
}

.ut-menu .settings-fields input[type="range"] {
    flex: 1;
    min-width: 80px;
    max-width: 260px;
    margin: 0;
}

.ut-menu .settings-fields select {
    width: 200px;
    min-height: 38px;
    margin: 0;
    padding: 7px 10px;
    font-size: 16px;
}

.settings-fields output {
    min-width: 4ch;
    color: var(--menu-accent);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* Reserve space for 100.0 % so moving a volume slider does not shift its layout. */
#settings-panel-audio output {
    min-width: 7ch;
}

.settings-fields:focus-visible {
    outline-offset: -5px;
}

.controls {
    display: grid;
    gap: 10px;
}

.controls > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    min-height: 32px;
    font-size: 15px;
}

.controls kbd {
    color: #c1dcf8;
    font: inherit;
}

.control-keys {
    font-weight: 600;
}
/* #endregion */

/* #region Editable gameplay bindings */
.settings-dialog[open] {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.settings-dialog > .settings-fields {
    min-height: 0;
    overflow-y: auto;
}
.binding-intro, .binding-reference p, .binding-prompt p {
    margin: 0;
    color: var(--menu-muted);
    font-size: 14px;
    line-height: 1.6;
}
.binding-list, .binding-reference {
    display: grid;
    gap: 12px;
}
.binding-list h3, .binding-reference h3 {
    margin: 12px 0 8px;
    color: var(--menu-accent);
    font-size: 16px;
}
.binding-row {
    display: grid;
    grid-template-columns: minmax(150px, .9fr) minmax(0, 1.3fr);
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--menu-border);
}
.binding-action {
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.binding-entries, .binding-prompt > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
/* Each shortcut is one rounded tag; the separate Add control retains its button style. */
.binding-chip, .binding-fixed {
    border: 1px solid #425a75;
    border-radius: 999px;
    background: #182c42;
}
.binding-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
    padding: 3px;
}
.ut-menu .binding-entries button, .ut-menu .binding-prompt button {
    margin: 0;
    padding: 6px 9px;
    font-size: 13px;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}
/* System monospace fonts distinguish key names from the surrounding interface. */
.binding-label, .binding-fixed {
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
}
/* Shortcut text is read-only; only its remove control is interactive. */
.binding-label {
    min-width: 0;
    padding: 4px 9px 4px 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.ut-menu .binding-chip button {
    min-width: 0;
    min-height: 28px;
    padding: 4px 9px;
    border: 0;
    border-radius: 999px;
    background: transparent;
}
.ut-menu .binding-chip button[data-kind="remove"] {
    flex: 0 0 28px;
    width: 28px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}
.ut-menu .binding-chip button:focus-visible {
    outline-offset: 0;
}
.binding-empty, .binding-fixed {
    color: var(--menu-muted);
    font-size: 13px;
}
.binding-empty {
    padding: 6px 0;
}
.binding-fixed {
    padding: 7px 12px;
}
.binding-prompt {
    position: sticky;
    top: -18px;
    z-index: 1;
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--menu-accent);
    background: #101b29;
}
.binding-capturing .binding-list {
    opacity: .65;
}
.ut-menu #bindings-reset {
    justify-self: start;
    margin: 10px 0 0;
    font-size: 14px;
    letter-spacing: 0;
}
@media (max-width: 600px) {
    .binding-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }
}
/* #endregion */

/* #region Player setup and equipment browser */
#player-setup {
    width: min(920px, 95vw);
}

.player-layout {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 24px;
    padding: 20px 24px;
    align-items: start;
}

#player-canvas {
    display: block;
    width: 100%;
    height: 340px;
    border: 1px solid var(--menu-border);
    border-radius: 3px;
    background: #0e1825;
}

.player-fields {
    display: grid;
    align-content: start;
    gap: 10px;
}

#player-status {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

#player-status:empty {
    display: none;
}

.player-actions {
    display: flex;
    justify-content: flex-end;
    padding: 12px 24px;
    border-top: 1px solid var(--menu-border);
    background: #0d182366;
}

#player-confirm {
    width: auto;
    min-width: 160px;
}

#player-status, #character-load-status, #arsenal-status {
    color: var(--menu-accent);
}

#arsenal {
    width: min(1180px, 96vw);
    height: min(850px, 92vh);
}

.arsenal-layout {
    display: grid;
    grid-template-columns: 235px minmax(0, 1fr);
    height: calc(100% - 69px);
    min-height: 0;
}

#arsenal-list {
    overflow-y: auto;
    padding: 12px;
    border-right: 1px solid var(--menu-border);
    background: #0e182580;
}

#arsenal-list button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 4px 0;
    padding: 10px 8px;
    border-color: transparent;
    background: transparent;
    text-align: left;
    letter-spacing: 0;
}

#arsenal-list button.selected {
    border-color: #3e6a93;
    background: #152e49;
    color: var(--menu-focus);
    box-shadow: inset 3px 0 var(--menu-accent);
}

#arsenal-list img {
    width: 64px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

.arsenal-detail {
    padding: 24px 28px;
    overflow-y: auto;
}

.arsenal-detail h2 {
    margin-top: 0;
    color: var(--menu-ink);
    font-size: 26px;
    font-weight: 600;
}

#arsenal-description {
    max-width: 65ch;
    color: var(--menu-muted);
    line-height: 1.8;
}

#arsenal-canvas {
    display: block;
    width: 100%;
    height: 300px;
    border: 1px solid var(--menu-border);
    border-radius: 3px;
    background: radial-gradient(ellipse at 50% 40%, #243d58, #0e1825 75%);
    touch-action: none;
}

.arsenal-detail details {
    margin: 18px 0;
}

.arsenal-detail summary {
    margin-bottom: 12px;
}

.arsenal-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#arsenal-stats td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--menu-border);
    color: inherit;
    font-size: 14px;
    font-weight: normal;
}
/* #endregion */

/* #region Responsive layout and reduced motion */
@media (max-width: 1200px) {
    .intro {
        display: none;
    }
    /* Keep Escape branding above the actions while the home content scrolls. */
    body[data-match-state="paused"] .intro {
        display: block;
        flex: 0 0 auto;
        width: min(520px, 100%);
    }
    body[data-match-state="paused"] .menu-content {
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 24px;
    }
    body[data-match-state="paused"] #lobby-window {
        flex-shrink: 0;
    }
    .menu-content {
        justify-content: center;
        padding: 32px 4vw;
    }
    #menu::before {
        background-position: center;
        background-size: 70vw auto;
    }
}

@media (max-height: 760px) {
    .topbar {
        height: 60px;
    }
    .menu-content {
        padding-top: 24px;
        padding-bottom: 24px;
    }
    .intro {
        padding-top: 10px;
    }
    .panel-content {
        padding: 20px;
    }
}

/* Short desktop windows keep room creation visible with readable controls. */
@media (max-height: 650px) and (min-width: 551px) {
    #lobby-window:has(#create-form:not([hidden])) .panel-content {
        padding-top: 12px;
        padding-bottom: 12px;
    }
    .creation-grid {
        gap: 6px 20px;
    }
    .ut-menu .creation-grid :is(input:not([type="checkbox"]), select) {
        min-height: 32px;
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .creation-actions {
        margin-top: 10px;
    }
}

@media (max-width: 700px) {
    .arsenal-layout {
        grid-template-columns: 130px minmax(0, 1fr);
    }
    #arsenal-list button, #arsenal-list img {
        display: block;
    }
    .arsenal-detail {
        padding: 16px;
    }
    #arsenal-canvas {
        height: 220px;
    }
}

@media (max-width: 650px) {
    .topbar {
        gap: 10px;
        padding-right: 4vw;
        padding-left: 4vw;
    }
    .topbar strong {
        min-width: 0;
        overflow: hidden;
        font-size: 10px;
        letter-spacing: .6px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .header-actions {
        flex-shrink: 0;
        gap: 5px;
    }
    .ut-menu .topbar .icon-button {
        width: 36px;
        min-height: 36px;
        height: 36px;
        padding: 6px;
    }
    .mark {
        display: none;
    }
    .ut-menu .window-title {
        padding: 12px 16px;
    }
    #server-status {
        font-size: 9px;
        letter-spacing: .5px;
    }
}

@media (max-width: 600px) {
    .player-layout {
        grid-template-columns: 1fr;
    }
    #player-canvas {
        height: 140px;
    }
    .player-layout {
        gap: 16px;
        padding: 16px;
    }
    .ut-menu .player-fields .field {
        grid-template-columns: 90px minmax(0, 1fr);
    }
}

@media (max-width: 550px) {
    .creation-grid {
        grid-template-columns: 1fr;
    }
    .ut-menu .creation-grid .field {
        grid-template-columns: 125px minmax(0, 1fr);
    }
    #lobby-window:has(#create-form:not([hidden])) .panel-content {
        padding: 16px;
    }
    .creation-actions {
        position: sticky;
        bottom: 0;
        padding: 10px 0;
        background: var(--menu-panel);
    }
    .ut-menu .creation-actions button {
        padding-right: 10px;
        padding-left: 10px;
        letter-spacing: 0;
    }
    .panel-content {
        padding: 18px;
    }
    .settings-tabs {
        padding: 12px;
    }
    .settings-fields {
        padding: 16px;
    }
    .settings-fields label:not(.check) > span {
        flex-basis: 45%;
    }
    .ut-menu .settings-fields select {
        width: 50%;
    }
    .settings-fields label {
        gap: 8px;
    }
    .controls > div {
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ut-menu *, .ut-menu *::before, .ut-menu *::after {
        transition: none;
    }
}
/* #endregion */

/* #region Match loading and first capture */
.match-loading {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    overflow: auto;
    padding: 24px;
    color: #edf5ff;
    background: #080e18;
}

.match-loading.scene-visible {
    background: #080e18bc;
}

.loading-content {
    width: min(100%, 540px);
}

.loading-eyebrow {
    color: #78baff;
    letter-spacing: .16em;
    font-size: .8rem;
}

.loading-content h1 {
    margin: 12px 0 28px;
    font-size: clamp(1.7rem, 5vw, 2.8rem);
    overflow-wrap: anywhere;
}

#loading-stage {
    min-height: 2.8em;
    line-height: 1.4;
}

.loading-meter {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

#loading-progress {
    flex: 1;
    min-width: 0;
    height: 10px;
    border: 0;
    background: #203149;
    accent-color: #67b0ff;
}

#loading-progress::-webkit-progress-bar {
    background: #203149;
}

#loading-progress::-webkit-progress-value {
    background: #67b0ff;
}

#loading-progress::-moz-progress-bar {
    background: #67b0ff;
}

#loading-percent {
    min-width: 4em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.waiting-server #loading-progress {
    animation: loading-activity 1.2s ease-in-out infinite alternate;
}

@keyframes loading-activity {
    to { opacity: .45; }
}

.match-start {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
    padding: 24px;
    border: 0;
    background: transparent;
    color: #fff;
    text-shadow: 0 2px 6px #000, 0 0 18px #000;
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: bold;
}

.match-start small {
    max-width: 540px;
    font-size: .95rem;
    line-height: 1.5;
}

.match-start:focus-visible {
    outline: 2px solid #78baff;
    outline-offset: -8px;
}

@media (prefers-reduced-motion: reduce) {
    .waiting-server #loading-progress { animation: none; }
}
/* #endregion */

/* #region Quick-match objectives */
#team-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

#team-scores > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#team-scores img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    image-rendering: pixelated;
}

#objective-status {
    max-width: min(85vw, 960px);
    font-size: .85rem;
    white-space: normal;
}

#team-rules {
    grid-column: 1 / -1;
}
/* #endregion */

/* #region Mutator creation and native relic HUD */
.mutator-choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
}
.mutator-choice input {
    flex: 0 0 auto;
    margin-top: 4px;
}
.mutator-choice strong,
.mutator-choice small {
    display: block;
}
.mutator-choice small {
    margin-top: 4px;
    color: var(--muted, #abb7c5);
}
.mutator-options,
.relic-choices {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 4px 16px;
    border: 1px solid rgba(128, 160, 192, .3);
    padding: 12px;
}
/* Keep the three match options together, wrapping naturally on narrow windows. */
.mutator-options {
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}
.mutator-options .mutator-choice {
    min-width: 0;
    gap: 8px;
    padding: 4px 0;
}
.relic-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.relic-hud img {
    object-fit: contain;
}
#mutator-status {
    color: #d7e6fa;
}
/* #endregion Mutator creation and native relic HUD */

/* #region Room and team text chat */
#chat {
    position: fixed;
    left: 18px;
    top: 125px;
    width: min(560px, calc(100vw - 36px));
    z-index: 12;
    color: #e6f2ff;
    font: 14px/1.4 monospace;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

#chat-history {
    max-height: min(30vh, 260px);
    overflow: hidden;
    overflow-wrap: anywhere;
}

#chat-history p {
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    margin: 3px 0;
    padding: 3px 6px;
    background: #06152c59;
    unicode-bidi: plaintext;
}

#chat:not(.composing) #chat-history p:nth-last-child(n + 6),
#chat:not(.composing):not(.recent) #chat-history {
    display: none;
}

#chat.composing #chat-history {
    overflow-y: auto;
    pointer-events: auto;
}

#chat .chat-team { color: #79e8b1; }
#chat .chat-notice { color: #ffd581; }

#chat-form {
    padding: 8px;
    border: 1px solid #647baf;
    background: #06152cee;
    pointer-events: auto;
}

#chat-input {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 4px 0;
    padding: 5px;
    color: #fff;
    background: #020916;
    border: 1px solid #647baf;
    font: inherit;
}

/* #endregion */

/* #region Team orders */

#bot-orders {
    position: fixed;
    z-index: 90;
    top: 18%;
    left: 5%;
    width: min(620px, 90vw);
    max-height: 72vh;
    overflow: auto;
    padding: 16px;
    box-sizing: border-box;
    color: #ffe9a1;
    border: 2px solid #8a9dcc;
    background: #081831f2;
    box-shadow: 0 4px 24px #000b;
}

#bot-orders h2 {
    margin: 0 0 8px;
    color: #ffdd75;
}

#bot-orders-help {
    margin: 0 0 12px;
    color: #c4d0eb;
    font-size: 13px;
}

.bot-order-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

#bot-order-targets, #bot-order-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

#bot-order-targets {
    max-height: 42vh;
    overflow-y: auto;
}

#bot-orders button {
    flex-shrink: 0;
    width: 100%;
    padding: 8px;
    text-align: left;
    overflow-wrap: anywhere;
    color: #d5e0ff;
    background: #142647;
    border: 1px solid #52648c;
    font: inherit;
}

#bot-orders button[aria-pressed="true"] {
    color: #fff1ae;
    background: #39496a;
    border-color: #ffdd75;
}

#bot-orders button:disabled {
    opacity: .45;
}

/* #endregion */
