/* SW48 command console, inspired by the installed Remake command-bar assets.
   Scope chrome to DOM panels: weapon strip and world health/shield colors stay independent. */
body.sw48-ui {
 --sw-gold:#acdfff; --sw-line:#50677b; --sw-text:#d8e5ef; --sw-muted:#8fa5b8;
 --sw-panel:linear-gradient(150deg,rgba(25,38,55,.97),rgba(10,19,32,.96));
 background-color:#050914;color:var(--sw-text);
 font-family:"Segoe UI","Microsoft YaHei",sans-serif;accent-color:#7ecaff;
}
/* Raised gunmetal rim, inner bevel and recessed blue screen. No blur or animated filters. */
body.sw48-ui :is(#dialog_frame,#escape_menu) {
 background:var(--sw-panel) !important;color:var(--sw-text) !important;
 border:2px solid #3e4c5c !important;border-top-color:#677789 !important;
 border-bottom-color:#26303c !important;border-radius:3px !important;
 box-shadow:inset 0 0 0 1px #101822,inset 0 3px 0 #9db4cc12,0 5px 16px #0006 !important;
}
body.sw48-ui :is(#dialog_titlebar,#dialog_footer,#action_panel) {
 background:linear-gradient(#354353,#1b2838) !important;color:#c3e8ff !important;
}
body.sw48-ui #dialog_titlebar {border-bottom:2px solid #0d1723;box-shadow:inset 0 1px #a4bfd035;}
body.sw48-ui :is(#dialog_footer,#action_panel) {border-top:1px solid #46586b;}
body.sw48-ui #dialog_frame :is(h1,h2,h3,h4,th,legend) {color:#b6ddfa;}
body.sw48-ui #dialog_content {scrollbar-color:#536e88 #0e1928;}
body.sw48-ui #dialog_content :is(table,td) {border-color:#36485c;}
body.sw48-ui #dialog_content th {border-bottom:1px solid #536b84;}
body.sw48-ui #dialog_frame hr {border:0;border-top:1px solid #36485c;}
body.sw48-ui :is(#team,#chat,#leaderboard,#upgrade,#respawn) h2 {
 color:#b6ddfa;text-shadow:none;border-bottom:1px solid #486078;padding-bottom:.3rem;
}
body.sw48-ui #instructions_meter {color:#d8e5ef;text-shadow:0 1px 3px #000;}
body.sw48-ui :is(#dialog_frame,#links,#account,#escape_menu) a {color:#acdfff !important;text-decoration-color:#76a7cc70;}
body.sw48-ui :is(#dialog_frame,#links,#account) a:hover {color:#e0f4ff !important;}
/* Separate normal, hover, pressed and disabled states, as in the Remake command bar. */
body.sw48-ui :is(#dialog_frame,#spawn_overlay,#team,#chat,#escape_menu,#nexus_icons,#upgrade,#respawn) :is(button,select),
body.sw48-ui #escape_menu a,body.sw48-ui .sw48-rebuild .rebuild-confirm {
 background:linear-gradient(#344d65,#1a2c40) !important;
 color:#bfe7ff !important;border:1px solid #5e7892 !important;border-bottom-color:#273c51 !important;
 border-radius:2px !important;box-shadow:inset 0 1px #bddfff20,0 1px 1px #0005 !important;
 transition:background-color .12s,border-color .12s,color .12s;
}
body.sw48-ui :is(#dialog_frame,#spawn_overlay,#team,#chat,#escape_menu,#nexus_icons,#upgrade,#respawn) button:hover:not(:disabled),
body.sw48-ui #escape_menu a:hover,body.sw48-ui .sw48-rebuild .rebuild-confirm:hover:not(:disabled) {
 background:linear-gradient(#436583,#263f58) !important;border-color:#93bfe0 !important;color:#f1faff !important;filter:none;
}
body.sw48-ui :is(#dialog_frame,#spawn_overlay,#team,#chat,#escape_menu,#nexus_icons,#upgrade,#respawn) button:active:not(:disabled),
body.sw48-ui .sw48-rebuild .rebuild-confirm:active:not(:disabled) {
 background:#15283b !important;box-shadow:inset 0 2px 4px #0007 !important;
}
body.sw48-ui :is(#dialog_frame,#spawn_overlay,#team,#chat,#escape_menu,#nexus_icons,#upgrade,#respawn) button:disabled {
 opacity:.4;cursor:default;box-shadow:none !important;
}
body.sw48-ui :is(#dialog_frame,#spawn_overlay,#team,#chat,#escape_menu,#nexus_icons) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),textarea) {
 background:#0a1524 !important;color:#e0edfa !important;border:1px solid #465d75 !important;
 border-radius:2px !important;box-shadow:inset 0 2px 4px #0006;box-sizing:border-box;caret-color:#acdfff;
}
body.sw48-ui :is(#dialog_frame,#spawn_overlay,#team,#chat,#escape_menu,#nexus_icons) ::placeholder {color:#8fa5b8;opacity:1;}
body.sw48-ui :is(button,a,input,select,textarea):focus-visible {outline:2px solid #a4dbff !important;outline-offset:3px;}
body.sw48-ui :is(#nexus_icons,#social_icons) :is(a,svg) {color:#acdfff !important;}
body.sw48-ui #load_warning {color:#d8e5ef !important;}
body.sw48-ui #load_warning button {background:#21364d !important;color:#c4e8ff !important;border-color:#6b91af !important;}
/* Fleet: lightweight holographic projection rather than metal housing. */
body.sw48-ui #team {
 background:repeating-linear-gradient(0deg,transparent 0 3px,#63cfff06 3px 4px),linear-gradient(135deg,#062b3bd9,#04121ebd) !important;
 border:1px solid #4fbbd566 !important;border-left:2px solid #69d6ef !important;border-radius:2px;
 box-shadow:inset 0 0 16px #4ad7ff08 !important;color:#c3f1fa;
}
body.sw48-ui #team h2 {color:#89dced;border-bottom-color:#4fbbd533;}
body.sw48-ui #team :is(button,input) {background:#07334780 !important;border-color:#4fbbd555 !important;box-shadow:none !important;color:#a2e6f5 !important;}
body.sw48-ui #team button:hover:not(:disabled) {background:#0b516480 !important;border-color:#8de0f1 !important;}
/* Upgrade/redeployment: clean hangar catalogue; the ship cards carry the detail. */
body.sw48-ui :is(#upgrade,#respawn) {
 background:#0b111be8 !important;border:1px solid #596476 !important;border-top:2px solid #a7b7c8 !important;
 border-radius:2px;box-shadow:0 5px 16px #0005 !important;color:#e1e5eb;
}
body.sw48-ui :is(#upgrade,#respawn) h2 {color:#e1e5eb;border-bottom:1px solid #ffffff18;}
body.sw48-ui :is(#upgrade,#respawn) button {background:#171f2c !important;border-color:#445166 !important;box-shadow:none !important;}
/* A short, horizontal upgrade strip leaves the upper centre clear for the assignment. */
body.sw48-ui #upgrade {
 top:10px !important;margin-top:0 !important;padding:4px 6px !important;min-width:168px;max-width:calc(100vw - 250px);
 box-sizing:border-box;border-top-width:1px !important;background:#0b111bcc !important;
}
body.sw48-ui #upgrade h2 {font-size:16px;line-height:20px;text-align:center;padding-bottom:3px;}
body.sw48-ui #upgrade h2 svg {width:13px;height:12px;}
body.sw48-ui #upgrade .sw48-ship-options {
 grid-template-columns:none !important;grid-auto-flow:column;grid-auto-columns:140px;
 gap:5px;margin-top:4px;max-width:min(575px,calc(100vw - 266px));max-height:none;
 overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:#536e88 transparent;
}
body.sw48-ui #upgrade .sw48-ship-card {
 display:grid !important;grid-template-columns:45px minmax(0,1fr);grid-template-rows:26px 12px;
 column-gap:5px;align-items:center !important;width:140px !important;height:48px !important;
 padding:4px !important;text-align:left;transition:border-color .15s,background-color .15s;
}
body.sw48-ui #upgrade .sw48-ship-card>img {
 grid-row:1 / 3;width:45px !important;height:36px !important;object-fit:contain;
}
body.sw48-ui #upgrade .sw48-ship-card>div:nth-of-type(1) {
 font-size:11px !important;line-height:13px !important;max-height:26px !important;
}
body.sw48-ui #upgrade .sw48-ship-card>div:nth-of-type(2) {
 font-size:9px !important;line-height:12px !important;overflow:hidden;text-overflow:ellipsis;
}
body.sw48-ui #instructions_meter {top:10px !important;margin-top:0 !important;max-width:calc(100vw - 250px);}
/* Faction assignment is informational and never blocks steering or firing. */
#sw48-station-alert {
    contain:inline-size;margin-top:6px;text-shadow:0 1px 3px #000;
    text-align:start;overflow-wrap:anywhere;pointer-events:none;color:#ffaaa5;
    font:500 clamp(11px,.94vw,13px)/1.35 system-ui,sans-serif;
}
#sw48-faction-entry {
 position:fixed;left:50%;top:110px;z-index:3;
 width:min(490px,calc(100vw - 32px));box-sizing:border-box;padding:10px 20px 14px;
 display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;
 color:#d4e3f3;pointer-events:none;user-select:none;transform:translateX(-50%);
 background:radial-gradient(ellipse at center,#0c1723c9,transparent 72%);
 text-shadow:0 2px 5px #000;animation:sw48-faction-arrival 7s both;
}
#sw48-faction-entry[data-obscured="true"] {visibility:hidden;}
#sw48-faction-entry .entry-assignment {font:500 17px/1.5 'Segoe UI','Microsoft YaHei',sans-serif;letter-spacing:.04em;}
#sw48-faction-entry .entry-emblem {width:64px;height:64px;object-fit:contain;}
#sw48-faction-entry .entry-mission {margin:0;max-width:100%;font:13px/1.7 'Segoe UI','Microsoft YaHei',sans-serif;color:#aebed0;}
#sw48-faction-entry[data-faction="rebellion"] .entry-assignment {color:#f1c8c4;}
#sw48-faction-entry[data-faction="rebellion"] .entry-mission {color:#d1b7b4;}
@keyframes sw48-faction-arrival {
 0% {opacity:0;transform:translate(-50%,8px);}
 6%,88% {opacity:1;transform:translate(-50%,0);}
 100% {opacity:0;transform:translate(-50%,-4px);}
}
@media(prefers-reduced-motion:reduce) {
 @keyframes sw48-faction-arrival {0%,94% {opacity:1;} 100% {opacity:0;}}
}
#sw48-match-chat {
 --chat-edge:max(.5rem,env(safe-area-inset-left));
 --chat-bottom:max(.5rem,env(safe-area-inset-bottom));
 --chat-nav:26px;
 --chat-row:32px;
 --chat-inset:5px;
 position:fixed;z-index:40;left:var(--chat-edge);
 bottom:var(--chat-bottom);
 width:min(25vw,21rem,calc(var(--chat-side-room,25vw) - var(--chat-edge) - .35rem));
 pointer-events:none;color:white;font:16px/1.07 Arial,sans-serif;text-align:left;
 text-shadow:0 1px 2px #050a12;
}
#sw48-match-chat.inactive {visibility:hidden;}
#sw48-chat-content {
 display:flex;flex-direction:column;box-sizing:border-box;
 height:calc(min(11em,22dvh) + var(--chat-row) + 3em + 2 * var(--chat-inset));
 padding:var(--chat-inset);background:transparent;}
#sw48-match-chat.collapsed #sw48-chat-content {visibility:hidden;}
#sw48-chat-messages {
 display:flex;flex-direction:column;flex:1 1 0;min-height:0;list-style:none;margin:0;padding:0 .15rem;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;
 overflow-wrap:anywhere;scrollbar-width:none;
}
#sw48-chat-messages::-webkit-scrollbar {display:none;}
#sw48-chat-messages::before {content:"";margin-top:auto;}
#sw48-chat-messages li {
 flex:none;
 overflow:hidden;
 margin-bottom:.25rem;
 transition:opacity .1s linear;
}
#sw48-chat-content {pointer-events:auto;}
#sw48-chat-messages li.chat-faded {visibility:hidden;}
@media (hover:none) {#sw48-chat-messages li.chat-faded {display:none;}}
#sw48-chat-messages .chat-author {
 display:inline;padding:0;margin:0;font:inherit;font-weight:700;text-align:start;vertical-align:baseline;
}
#sw48-chat-messages .chat-author:is(:hover,:focus-visible) {text-decoration:underline;}
#sw48-chat-messages .chat-author:is(.empire,.rebellion)::before {
 content:"";display:inline-block;width:.70em;height:.70em;margin-inline-end:.2em;
 background:var(--chat-mark) center / contain no-repeat;
}
#sw48-chat-messages .empire {--chat-mark:url("factions/chat-empire.png");}
#sw48-chat-messages .rebellion {--chat-mark:url("factions/chat-rebellion.png");}
#sw48-chat-messages .sw48-chat-mention {background:#305578;color:#e1f1ff;font-weight:700;border-radius:3px;padding:0 .16em;box-decoration-break:clone;}
#sw48-chat-messages b {font-weight:700;}
#sw48-chat-messages .empire {color:#a2c5ff;}
#sw48-chat-messages .rebellion {color:#ffa49b;}
#sw48-match-chat.reading #sw48-chat-messages {
 overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;
 pointer-events:auto;user-select:text;
}
#sw48-match-chat.reading li {transition:none;}
#sw48-match-chat small {display:block;color:#ffcf9f;}
.sw48-chat-compose {
 display:flex;align-items:stretch;margin-top:.25rem;padding-right:var(--chat-nav);
 border-radius:.25rem;background:rgb(2 7 13 / .419);pointer-events:auto;
}
#sw48-match-chat :is(input,button) {
 border:0;border-radius:3px;color:inherit;background:transparent;
 font:inherit;text-shadow:inherit;box-sizing:border-box;
}
#sw48-match-chat button {cursor:pointer;touch-action:manipulation;}
#sw48-match-chat .sw48-chat-channels {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));flex:none;gap:3px;margin-bottom:2px;pointer-events:auto;}
#sw48-match-chat .sw48-chat-channels button {
 flex:0 1 auto;min-width:0;min-height:27px;padding:2px 8px;
 font:700 .75rem/1.1 Arial,sans-serif;overflow-wrap:anywhere;opacity:.65;
}
#sw48-match-chat .sw48-chat-channels button {position:relative;}
#sw48-match-chat .sw48-chat-channels button[data-unread="true"] {opacity:1;}
#sw48-match-chat .sw48-chat-channels button[data-unread="true"]::after {
 content:"";position:absolute;top:2px;right:1px;width:6px;height:6px;
 background:#ff5c58;border-radius:50%;box-shadow:0 0 0 1px #280b10;pointer-events:none;
}
#sw48-match-chat .sw48-chat-channels button[aria-pressed="true"] {background:transparent;opacity:1;}
#sw48-match-chat .sw48-chat-channels button:focus-visible {outline:1px solid #a4dbff;outline-offset:-1px;}
#sw48-chat-toggle {
 position:absolute;bottom:var(--chat-inset);right:var(--chat-inset);
 width:var(--chat-nav);height:var(--chat-row);padding:0;pointer-events:auto;
}
#sw48-match-chat.collapsed #sw48-chat-toggle {
 right:auto;left:0;bottom:0;background:rgb(7 14 25 / .34);
}
#sw48-chat-input {
 flex:1;min-width:0;min-height:var(--chat-row);padding:.35rem .5rem;outline:0;font-weight:700;
 transition:background-color .12s ease;
}
#sw48-chat-input::placeholder {color:inherit;opacity:.62;}
#sw48-match-chat input:focus,#sw48-chat-toggle:hover {background:rgb(18 32 49 / .24);}
#sw48-chat-input:focus {box-shadow:inset 0 -1px #a5c6d359;}
body.sw48-ui #sw48-chat-input:focus-visible {outline:1px solid #a4dbff66 !important;outline-offset:-1px;}
#sw48-match-chat.collapsed .sw48-chat-compose {pointer-events:none;}
@media (pointer:coarse), (max-width:700px) {
 #sw48-match-chat {
  --chat-nav:0px;--chat-row:36px;
  font-size:14px;
 }
 #sw48-chat-toggle {display:none;}
 #sw48-match-chat.collapsed:not(.inactive) #sw48-chat-content {visibility:visible;}
 #sw48-match-chat.collapsed .sw48-chat-compose {pointer-events:auto;}
 #sw48-match-chat #sw48-chat-input {font-size:16px;}
 #sw48-match-chat .sw48-chat-channels button {flex:1;min-height:34px;padding:2px 3px;font-size:12px;}
}
@media (max-height:440px) {


}
@media (max-width:360px) and (min-height:441px) {

}

body.sw48-ui #leaderboard {background:#080f1bc9 !important;border:0 !important;border-top:1px solid #7b8ca066 !important;box-shadow:none !important;border-radius:0;color:#c0cbd9;}
body.sw48-ui #leaderboard h2 {color:#b5c4d5;border-bottom-color:#ffffff12;}
/* Opening screen: cinematic yellow accent, without the in-game console bevel. */
body.sw48-ui #spawn_overlay button {
 background:#0b101bd9 !important;color:#ffe81f !important;border:1px solid #c5b536 !important;
 border-radius:3px !important;box-shadow:none !important;letter-spacing:.04em;
}
body.sw48-ui #spawn_overlay button:hover:not(:disabled) {background:#272614 !important;border-color:#ffe81f !important;color:#fff3a0 !important;}
body.sw48-ui #spawn_overlay button:active:not(:disabled) {background:#17180e !important;}
body.sw48-ui #spawn_overlay input {background:#05091490 !important;border-color:#8c8b7155 !important;box-shadow:none;}
/* Wreck controls: compact maintenance console, distinct from the fleet hologram. */
body.sw48-ui .sw48-rebuild {
 background:linear-gradient(125deg,#202731fa,#111820fc 65%) !important;
 border:1px solid #535e6c !important;border-top:2px solid #a6b4c1 !important;
 border-radius:2px !important;box-shadow:inset 0 0 0 1px #050a10,0 6px 16px #0006 !important;
 padding:12px !important;color:#dde5ec;font-size:13px !important;
}
body.sw48-ui .sw48-rebuild > div:first-child {padding-bottom:9px;border-bottom:1px solid #ffffff14;gap:6px !important;}
body.sw48-ui .sw48-rebuild strong {font-size:14px !important;letter-spacing:0 !important;line-height:1.5;color:#e0e8ef;}
body.sw48-ui .sw48-rebuild strong::before {content:"";display:inline-block;width:3px;height:12px;background:#dfbb74;margin-right:8px;vertical-align:-1px;}
body.sw48-ui .sw48-rebuild > div:nth-child(2) {margin:10px 0 !important;padding:8px !important;background:#080f17;border:1px solid #35404d !important;border-radius:2px;color:#b5c3d0 !important;font-size:12px !important;align-items:center;}
body.sw48-ui .sw48-rebuild > div:nth-child(2) span:first-child {color:#e1c58e;font-variant-numeric:tabular-nums;}
body.sw48-ui .sw48-rebuild > div:nth-child(2) span:first-child::before {content:"";display:inline-block;width:12px;height:12px;margin-right:6px;vertical-align:-1px;background:url("/data/credit-icon.png") center/contain no-repeat;}
body.sw48-ui .sw48-rebuild > div:last-child {gap:8px !important;}
body.sw48-ui .sw48-rebuild .rebuild-confirm {min-height:36px;padding:7px 10px !important;background:linear-gradient(#354c60,#233547) !important;color:#e0effb !important;border:1px solid #6f8a9e !important;border-bottom-color:#3c5265 !important;box-shadow:inset 0 1px #c6e6ff20 !important;font-weight:600;}
body.sw48-ui .sw48-rebuild .rebuild-confirm:hover:not(:disabled) {background:linear-gradient(#45647c,#2b465d) !important;border-color:#b3d5ec !important;}
body.sw48-ui .sw48-rebuild .rebuild-confirm:active:not(:disabled) {background:#1b2b3b !important;box-shadow:inset 0 2px 3px #0006 !important;}
body.sw48-ui .sw48-rebuild .rebuild-confirm:disabled {opacity:.4;cursor:default;box-shadow:none !important;}
body.sw48-ui .sw48-rebuild .rebuild-demolish {padding:7px 10px !important;min-height:36px;color:#be9898;border:1px solid #634b50 !important;background:#2a2026 !important;border-radius:2px;}
body.sw48-ui .sw48-rebuild .rebuild-demolish:hover {background:#44292f !important;color:#ffd1d1;border-color:#b07a80 !important;}
body.sw48-ui .sw48-rebuild .rebuild-close {width:25px;height:25px;padding:0 !important;color:#96a8b8;font-size:19px !important;}
@media (max-width:600px) {body.sw48-ui #dialog_frame {border-radius:0 !important;}}
@media (prefers-reduced-motion:reduce) {body.sw48-ui :is(button,a,input,select,textarea) {transition:none !important;}}

/* Remake-style personal credit readout; separate from the leaderboard's scores. */
body.sw48-ui #sw48-credits {
 position:fixed;z-index:5;top:.5rem;right:.5rem;display:flex;align-items:center;justify-content:flex-end;gap:8px;
 min-width:108px;max-width:calc(100vw - 1rem);box-sizing:border-box;padding:3px 10px;height:30px;
 background:linear-gradient(#151b27f5,#080c15f5);border:1px solid #6b5255;border-top-color:#b09994;
 box-shadow:inset 0 1px #ebc9b312,inset 0 -1px #0009;color:#b7d6f0;
 font-family:"Bahnschrift","Consolas",monospace;font-size:20px;font-weight:500;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:.045em;
 pointer-events:none;white-space:nowrap;
}
body.sw48-ui #sw48-credits img {width:17px;height:17px;object-fit:contain;filter:brightness(0) saturate(100%) invert(85%) sepia(15%) saturate(650%) hue-rotate(174deg);}
/* Both live and historical leaderboard rows share this score cell. */
body.sw48-ui #leaderboard td.score {white-space:nowrap;text-align:right;font-variant-numeric:tabular-nums;}
body.sw48-ui #leaderboard td.score:not(:empty)::before {
 content:"";display:inline-block;width:.8em;height:.8em;margin-right:.3em;vertical-align:-.05em;
 background: url("/data/credit-icon.png") center / contain no-repeat;
 filter:brightness(0) saturate(100%) invert(85%) sepia(15%) saturate(650%) hue-rotate(174deg);
}

body.sw48-ui .sw48-credit-gain {
 display:inline-block;color:#8ff0c1;font-size:.75em;letter-spacing:.02em;
 animation:sw48-credit-gain 1.8s ease-out both;
}
@keyframes sw48-credit-gain {
 0% {opacity:0;transform:translateY(3px);}
 12%,65% {opacity:1;transform:translateY(0);}
 100% {opacity:0;transform:translateY(-4px);}
}
@media (prefers-reduced-motion:reduce) {
 body.sw48-ui .sw48-credit-gain {animation-name:sw48-credit-gain-still;}
 @keyframes sw48-credit-gain-still {0%,70% {opacity:1;}100% {opacity:0;}}
}

body.sw48-ui .sw48-credit-gain.sw48-credit-loss {color:#f0a0a0;}


/* Compact current-match board. Color belongs to the faction, never the viewer. */
body.sw48-ui #leaderboard.sw48-faction-board {background:rgba(7,13,23,.78)!important;border:0!important;border-radius:5px;padding:4px 5px;width:13rem;max-width:calc(100vw - 1rem);box-sizing:border-box;pointer-events:none;}
.sw48-faction-board table {width:100%;border-collapse:collapse;font-family:Arial,sans-serif;font-size:1rem;line-height:1.2;table-layout:fixed;}
.sw48-faction-board td {padding:1px 1px;}
.sw48-faction-board td.ranking {width:1.5em;text-align:right;}
.sw48-faction-board td.name {text-align:left;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sw48-faction-board td.score {width:4em;font-weight:400;}
.sw48-faction-board .faction-emblem {width:.9em;height:.9em;vertical-align:-.1em;margin-right:.2em;mix-blend-mode:screen;}
.sw48-faction-board tr.self td.name {font-weight:700;}
@media(max-width:600px){body.sw48-ui #leaderboard.sw48-faction-board{width:13rem;padding:4px 5px;}}

.sw48-faction-board tr[data-faction="empire"] .faction-emblem {filter:invert(1) sepia(1) saturate(6) hue-rotate(175deg) brightness(.7);}

/* Lightweight world overview; never consumes steering or firing input. */
body.sw48-ui {
 --hud-top:max(.5rem,env(safe-area-inset-top,0px));--hud-left:max(.5rem,env(safe-area-inset-left,0px));
 --hud-map-size:clamp(110px,14vw,176px);--hud-faction-width:clamp(174px,23vw,292px);
 /* The radar uses content-box, with a 1px border on each side. */
 --hud-faction-left:calc(var(--hud-left) + var(--hud-map-size) + 2px + 6px);
 --hud-faction-end:calc(var(--hud-faction-left) + var(--hud-faction-width));
}
#sw48-minimap {position:fixed;top:var(--hud-top);left:var(--hud-left);width:var(--hud-map-size);aspect-ratio:1;pointer-events:none;user-select:none;z-index:2;background:rgba(4,13,23,.78);border:1px solid rgba(126,178,207,.38);border-radius:3px;}
#sw48-minimap svg {display:block;width:100%;height:100%;}
#sw48-minimap .map-background {fill:rgba(13,32,47,.65);}
#sw48-minimap .map-cardinals {fill:#a6c5d6;font:7px Arial;text-anchor:middle;}

/* Tactical map keeps map gestures separate from flight controls. */
#sw48-minimap {pointer-events:auto;cursor:pointer;padding:0;box-sizing:content-box;min-width:0;line-height:normal;color:inherit;}
#sw48-minimap:hover,#sw48-minimap:focus-visible {border-color:#a6d7ef;outline:1px solid #a6d7ef;}
#sw48-minimap svg {pointer-events:none;}
#sw48-tactical-backdrop {position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;background:rgba(0,5,12,.82);pointer-events:auto;}
#sw48-tactical-backdrop.deployment-backdrop {background:#060c14;animation:deployment-reveal .36s ease-out both;}
#sw48-tactical-map.deployment-map {width:100%;height:100dvh;max-height:100dvh;display:flex;flex-direction:column;align-items:center;border:0;border-radius:0;overflow:auto;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);}
#sw48-tactical-map.deployment-map header {align-self:stretch;min-height:24px;flex-shrink:0;gap:4px 16px;}
.deployment-map header strong {flex:none;}
.deployment-hint {min-width:0;color:#c3d0d9;font:normal 13px/1.35 Arial,sans-serif;letter-spacing:normal;overflow-wrap:anywhere;}
@media (orientation:portrait) and (max-width:600px) {
 #sw48-tactical-map.deployment-map header {flex-direction:column;align-items:flex-start;}
 .deployment-hint {font-size:12px;}
}
.tactical-chart {display:contents;}
.deployment-chart {position:relative;container-type:size;flex:1;min-height:100px;width:calc(100% - 24px);animation:deployment-reveal .38s .06s ease-out both;}
#sw48-tactical-map.deployment-map .tactical-surface {position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100cqw,100cqh);height:min(100cqw,100cqh);}
.deployment-toolbar {display:flex;align-items:center;gap:12px;max-width:1280px;width:calc(100% - 32px);padding:7px 0;font-size:13px;flex-shrink:0;}
.deployment-roster {display:flex;gap:8px;width:calc(100% - 32px);max-width:1280px;flex-shrink:0;overflow-x:auto;overscroll-behavior-x:contain;touch-action:pan-x;scrollbar-width:thin;scrollbar-color:#58758a #101c28;padding:3px 2px 9px;box-sizing:border-box;animation:deployment-cards-in .32s .08s ease-out both;}
.deployment-unit {position:relative;flex:0 0 132px;display:flex;flex-direction:column;align-items:center;box-sizing:border-box;gap:2px;min-width:0;margin:0;padding:6px;color:#c4d4df;background:linear-gradient(150deg,#253240,#101923);border:1px solid #3a4b5c;border-radius:3px;font:12px/15px Arial,sans-serif;text-align:center;cursor:pointer;transition:border-color .16s,background-color .16s,transform .16s;}
.deployment-unit:not(:disabled):hover {border-color:#93bed8;transform:translateY(-2px);}
.deployment-unit.selected {border-color:#bee6fb;background:#20394c;box-shadow:inset 0 -2px #a6d9f2;}
.deployment-unit:focus-visible {outline:2px solid #e1f3ff;outline-offset:1px;}
.deployment-unit:disabled {opacity:.4;cursor:default;}
.deployment-unit-level {align-self:flex-start;color:#9bb4c8;font-size:10px;line-height:12px;}
.deployment-unit-image {width:112px;height:48px;object-fit:contain;pointer-events:none;}
.deployment-unit-name {display:flex;align-items:center;justify-content:center;min-height:30px;width:100%;overflow-wrap:anywhere;}
.deployment-unit-kind {font-size:10px;line-height:12px;color:#a5bac9;}
.deployment-unit-threshold {display:flex;align-items:center;gap:4px;font-size:10px;line-height:12px;color:#b8d8eb;font-variant-numeric:tabular-nums;margin-top:auto;}
.deployment-unit-threshold img {width:11px;height:11px;object-fit:contain;}
.deployment-credits {display:flex;align-items:center;gap:6px;margin-left:auto;font-variant-numeric:tabular-nums;}
.deployment-credits img {width:20px;height:20px;object-fit:contain;}
.deployment-actions {display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap;padding:8px 16px;flex-shrink:0;font-size:14px;}
.deployment-actions button {min-height:40px;padding:7px 28px;border:1px solid #9bc4dc;background:#29485e;color:#e2f3ff;border-radius:3px;cursor:pointer;font:inherit;}
.deployment-actions button:disabled {opacity:.4;cursor:default;}
.deployment-actions p {width:100%;margin:0;text-align:center;color:#f5b4a6;}
@keyframes deployment-reveal {from{opacity:0;}to{opacity:1;}}
@keyframes deployment-cards-in {from{opacity:0;transform:translateY(-8px);}to{opacity:1;transform:translateY(0);}}
@media(max-width:600px){.deployment-toolbar{gap:6px;font-size:12px;}.deployment-roster{gap:6px;}.deployment-unit{flex-basis:116px;padding:5px;}.deployment-unit-image{width:100px;height:42px;}.deployment-actions{font-size:12px;gap:8px;}.deployment-actions button{padding:7px 18px;}}
@media(max-height:500px){
 #sw48-tactical-map.deployment-map footer{display:none;}
 .deployment-toolbar{padding:3px 0;font-size:11px;}
 .deployment-roster{gap:6px;padding-bottom:5px;}
 .deployment-unit{flex-basis:154px;display:grid;grid-template-columns:52px minmax(0,1fr);grid-template-rows:12px minmax(28px,auto) 12px;column-gap:5px;padding:4px;}
 .deployment-unit-image{grid-column:1;grid-row:1 / 4;width:52px;height:48px;}
 .deployment-unit-level{grid-column:2;text-align:left;}
 .deployment-unit-name{grid-column:2;min-height:28px;font-size:11px;line-height:13px;}
 .deployment-unit-kind{display:none;}
 .deployment-unit-threshold{grid-column:2;justify-content:center;}
 .deployment-actions{padding:4px 10px;font-size:12px;}
 .deployment-actions button{min-height:32px;padding:3px 20px;}
}
@media(prefers-reduced-motion:reduce){#sw48-tactical-backdrop.deployment-backdrop,.deployment-chart,.deployment-roster{animation:none;}.deployment-unit{transition:none;}}
@media (orientation:landscape) and (max-height:360px) {
 .deployment-chart {min-height:60px;}
 .deployment-hint {font-size:12px;}
}
#sw48-tactical-map {width:min(760px,94vw,calc(96dvh - 140px));max-height:96dvh;overflow:auto;box-sizing:border-box;outline:none;color:#c9e2f1;background:#08131f;border:1px solid #5c7c92;border-radius:4px;box-shadow:0 12px 45px #0009;font-family:Arial,sans-serif;}
#sw48-tactical-map header {display:flex;align-items:center;justify-content:space-between;padding:8px 14px;border-bottom:1px solid #30495b;font-size:16px;letter-spacing:1px;}
#sw48-tactical-map header button {background:transparent!important;border:0!important;box-shadow:none!important;color:#c9e2f1!important;font:26px/1 Arial;padding:0 6px;min-width:32px;cursor:pointer;}
.tactical-surface {position:relative;aspect-ratio:1;width:100%;touch-action:none;cursor:crosshair;}
.tactical-surface svg {display:block;width:100%;height:100%;}
#sw48-tactical-map .map-background {fill:#0b1d2c;}
#sw48-tactical-map .tactical-sensors {fill:#499bdb;fill-opacity:.045;stroke:#57a9e1;stroke-width:.2;stroke-opacity:.5;pointer-events:none;}
#sw48-tactical-map .tactical-heading {fill:none;stroke:white;stroke-width:.2;stroke-opacity:.7;pointer-events:none;}
#sw48-tactical-map .tactical-contact:hover .tactical-station {fill-opacity:.3;stroke-width:.5;}
#sw48-tactical-map .tactical-contact:hover .tactical-hit-area {stroke:#c5e7ff;stroke-width:.2;fill:#a6d5ff;fill-opacity:.09;}
#tactical-target-info {position:absolute;top:8px;left:12px;max-width:calc(100% - 24px);box-sizing:border-box;padding:6px 9px;background:rgba(4,13,23,.94);border-left:2px solid #7ab6d9;color:#d7ebf6;font:12px/18px Arial;pointer-events:none;z-index:1;}
#sw48-tactical-map footer span {white-space:nowrap;}
#sw48-tactical-map .map-boundary {fill:none;stroke:#83adc4;stroke-width:.4;}
#sw48-tactical-map .map-cardinals {fill:#a8c9db;font:3.2px Arial;text-anchor:middle;}
#tactical-coordinates {display:block;min-height:20px;text-align:center;padding:5px 4px;border-top:1px solid #30495b;font:13px/20px Consolas,monospace;font-variant-numeric:tabular-nums;}
#sw48-tactical-map footer {display:flex;flex-wrap:wrap;justify-content:center;gap:6px 14px;padding:7px 10px 10px;font-size:12px;line-height:16px;}
#sw48-tactical-map .map-self {color:white;}
@media(max-width:600px){#sw48-tactical-map{width:min(94vw,calc(96dvh - 160px));}#sw48-tactical-map footer{font-size:11px;gap:4px 10px;}#tactical-coordinates{font-size:11px;}}
@media(max-height:500px) and (orientation:landscape) {
 #sw48-tactical-map {width:min(94vw,calc(96dvh - 124px));}
 #sw48-tactical-map header {padding:4px 10px;font-size:14px;}
 #sw48-tactical-map header button {font-size:22px;}
 #tactical-coordinates {font-size:10px;line-height:14px;min-height:14px;padding:3px 2px;}
 #sw48-tactical-map footer {font-size:10px;line-height:13px;gap:3px 8px;padding:4px 6px 6px;}
}

/* Preserve MK48's corner panels, centred upgrade and bottom-centred weapons.
   The engine's vmin-based rem keeps the same control scale across rotation. */
#sw48-top-hud {display:contents;}
@media(min-width:701px) {
 body.sw48-ui:has(#sw48-faction-hud) :is(#upgrade,#instructions_meter) {
  left:max(50%,calc(var(--hud-faction-end) + 92px)) !important;
  max-width:max(168px,calc(100vw - 2 * var(--hud-faction-end) - 16px));
 }
 body.sw48-ui:has(#sw48-faction-hud) #upgrade .sw48-ship-options {max-width:min(575px,100%);}
 body.sw48-ui #status .sw48-armaments {width:max-content;}
 .sw48-armaments>button {flex-shrink:0;white-space:nowrap;}
 .sw48-weapon-icon {display:inline-block;vertical-align:middle;}
}
@media(max-width:700px), (max-width:1100px) and (max-height:600px) and (pointer:coarse) {
 body.sw48-ui {
  --hud-right:max(.5rem,env(safe-area-inset-right,0px));
  --hud-map-size:min(9rem,24vw);--hud-corner-width:min(11rem,24vw);
  --hud-faction-width:min(176px,max(100px,calc(28vw - var(--hud-left) - 6px)));
 }
 body.sw48-ui #sw48-faction-hud {
  left:var(--hud-left);top:calc(var(--hud-top) + var(--hud-map-size) + 2px + 6px);
 }
 body.sw48-ui #sw48-top-hud {
  position:fixed;top:var(--hud-top);left:50%;transform:translateX(-50%);z-index:3;
  width:44vw;display:flex;flex-direction:column;align-items:center;pointer-events:none;
 }
 body.sw48-ui #upgrade,body.sw48-ui #instructions_meter {
  position:relative !important;top:auto !important;left:auto !important;transform:none !important;
  margin:0 !important;min-width:0;max-width:44vw;width:max-content;
 }
 body.sw48-ui #upgrade {padding:.3rem .5rem !important;pointer-events:auto;}
 body.sw48-ui #upgrade h2 {font-size:1.25rem;line-height:1.4;text-align:center;padding-bottom:.3rem;}
 body.sw48-ui #upgrade h2 svg {width:1rem;height:1rem;}
 body.sw48-ui #upgrade .sw48-ship-options {
  grid-template-columns:minmax(0,1fr) !important;grid-auto-flow:row;grid-auto-columns:auto;
  gap:.4rem;margin-top:.4rem;width:min(14rem,calc(44vw - 1.2rem));max-width:100%;
  max-height:min(26dvh,12rem);overflow-x:hidden;overflow-y:auto;
  overscroll-behavior:contain;touch-action:pan-y;
 }
 body.sw48-ui #upgrade .sw48-ship-card {
  grid-template-columns:3.6rem minmax(0,1fr);grid-template-rows:2.6rem 1.2rem;
  column-gap:.4rem;width:100% !important;height:4.6rem !important;padding:.4rem !important;
 }
 body.sw48-ui #upgrade .sw48-ship-card>img {width:3.6rem !important;height:3.2rem !important;}
 body.sw48-ui #upgrade .sw48-ship-card>div:nth-of-type(1) {font-size:1rem !important;line-height:1.3rem !important;max-height:2.6rem !important;}
 body.sw48-ui #upgrade .sw48-ship-card>div:nth-of-type(2) {font-size:.85rem !important;line-height:1.2rem !important;}
 body.sw48-ui #instructions_meter {font-size:1rem;}
 /* Leave both corner columns clear even when several upgrade cards are shown. */
 body.sw48-ui:has(#sw48-faction-hud) #sw48-top-hud {
  width:min(44vw,calc(100vw - 2 * max(var(--hud-left) + var(--hud-faction-width),var(--hud-right) + var(--hud-corner-width)) - 12px));
 }
 body.sw48-ui:has(#sw48-faction-hud) :is(#upgrade,#instructions_meter) {left:auto !important;max-width:100%;}
 body.sw48-ui #sw48-credits {
  top:var(--hud-top);right:var(--hud-right);min-width:0;max-width:var(--hud-corner-width);
  padding:.3rem .5rem;height:2.6rem;gap:.5rem;font-size:1.6rem;
 }
 body.sw48-ui #sw48-credits img {width:1.3rem;height:1.3rem;}
 body.sw48-ui .sw48-credit-gain {position:absolute;right:.3rem;top:2.7rem;font-size:1rem;text-shadow:0 1px 2px #000;}
 body.sw48-ui a.sw48-faction-details-toggle {
  top:calc(var(--hud-top) + 4rem);right:var(--hud-right);width:var(--hud-corner-width);min-width:0;
  gap:.4rem;padding:.55rem .4rem;font-size:1rem;line-height:1.3;background:#0b142099;
 }
 body.sw48-ui #status {
  left:50% !important;right:auto !important;transform:translateX(-50%) !important;
  bottom:env(safe-area-inset-bottom,0px) !important;width:max-content !important;max-width:45% !important;
  font-size:1rem;text-align:center;
 }
 body.sw48-ui #status .sw48-status-line {
  font-size:1rem;line-height:1.25;white-space:normal;overflow-wrap:anywhere;
  text-align:center;margin:0 0 .5rem !important;
 }
 body.sw48-ui #status .sw48-armaments {
  margin:auto;max-width:100%;
 }
 body.sw48-ui #status .sw48-armaments>button {flex-shrink:0;white-space:nowrap;}
 body.sw48-ui #status .sw48-weapon-slot {
  display:flex;align-items:center;justify-content:space-between;gap:.5rem;
  min-width:5rem;padding:.5rem !important;font:inherit;
 }
 /* Star Wars sprites bypass the generic sprite atlas, so size their icon-only variants here. */
 body.sw48-ui #status .sw48-weapon-icon {display:inline-flex;align-items:center;justify-content:center;font-size:0;}
 body.sw48-ui #status .sw48-weapon-icon span {font-size:0 !important;}
 body.sw48-ui #status .sw48-weapon-icon img {max-width:2.8rem;max-height:2.5rem;object-fit:contain;}
 body.sw48-ui #status .sw48-weapon-count {float:none;font:inherit;}
 body.sw48-ui #status .sw48-system-button {font:inherit;padding:.5rem !important;min-width:5rem;}
 body.sw48-ui #sw48-settings-toggle {
  right:var(--hud-right) !important;bottom:max(.25rem,env(safe-area-inset-bottom,0px)) !important;margin:0 !important;
 }
 body.sw48-ui .sw48-gear svg {width:2.4rem;height:2.4rem;}
 #sw48-faction-entry {
  position:relative;top:auto;left:auto;transform:none !important;
  width:48vw;margin-top:1rem;padding:.5rem;gap:.6rem;flex-shrink:0;
 }
 #sw48-faction-entry .entry-assignment {font-size:1.15rem;line-height:1.3;letter-spacing:0;}
 #sw48-faction-entry .entry-emblem {width:3.6rem;height:3.6rem;}
 #sw48-faction-entry .entry-mission {font-size:1rem;line-height:1.4;}
}
/* Keep the announcement below the catalogue without covering the bottom controls on short screens. */
@media(orientation:landscape) and (max-height:600px) and (max-width:700px),
      (orientation:landscape) and (max-height:600px) and (max-width:1100px) and (pointer:coarse) {
 #sw48-faction-entry {
  width:min(44rem,calc(100vw - 25rem));display:grid;grid-template-columns:2.6rem minmax(0,1fr);
  column-gap:.8rem;row-gap:.3rem;text-align:left;
 }
 #sw48-faction-entry .entry-emblem {width:2.6rem;height:2.6rem;grid-column:1;grid-row:1 / 3;}
 #sw48-faction-entry .entry-assignment {grid-column:2;grid-row:1;}
 #sw48-faction-entry .entry-mission {grid-column:2;grid-row:2;}
}

/* Compact combat strip: rem scales with viewport size, so use bounded pixels
   here instead of letting the hyperdrive label stretch every weapon slot. */
body.sw48-ui #status .sw48-status-line {font-size:12px;line-height:16px;margin:0 0 3px !important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
body.sw48-ui #status .sw48-armaments {align-items:center;justify-content:center;flex-wrap:wrap;gap:2px;max-width:100%;touch-action:manipulation;}
body.sw48-ui #status .sw48-weapon-slot {
 display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;
 height:44px;min-height:44px;min-width:72px;padding:5px 6px !important;gap:5px;
 font:13px/16px Arial,sans-serif;white-space:nowrap;flex-shrink:0;
}
body.sw48-ui #status .sw48-weapon-icon {display:inline-flex;align-items:center;justify-content:center;width:34px;height:30px;flex:0 0 34px;font-size:0;}
body.sw48-ui #status .sw48-weapon-icon>*,body.sw48-ui #status .sw48-weapon-icon span {zoom:1 !important;font-size:0 !important;max-width:34px;max-height:30px;}
body.sw48-ui #status .sw48-weapon-icon img {width:32px !important;height:28px !important;max-width:32px;max-height:28px;object-fit:contain;}
body.sw48-ui #status .sw48-weapon-count {float:none;font:13px/16px Arial,sans-serif;flex-shrink:0;}
body.sw48-ui #status .sw48-system-controls {align-items:center;gap:2px;}
body.sw48-ui #status .sw48-system-controls>.sw48-system-button {
 box-sizing:border-box;height:44px;min-height:44px;min-width:78px;max-width:108px;
 padding:4px 6px !important;font:12px/15px Arial,sans-serif;white-space:normal;text-align:center;
}
body.sw48-ui #status #sw48-hyperspace-toggle {flex-direction:row;width:108px;gap:4px;font:11px/13px Arial,sans-serif;}
body.sw48-ui #status #sw48-hyperspace-toggle img {width:20px;height:20px;flex:0 0 20px;}
@media(max-width:700px), (max-width:1100px) and (max-height:600px) and (pointer:coarse) {
 body.sw48-ui #status .sw48-status-line {font-size:10px;line-height:13px;}
 body.sw48-ui #status .sw48-weapon-slot {min-width:96px;height:32px;min-height:32px;padding:2px 5px !important;gap:4px;}
 body.sw48-ui #status .sw48-weapon-icon {width:28px;height:26px;flex-basis:28px;}
 body.sw48-ui #status .sw48-weapon-icon img {width:28px !important;height:24px !important;}
 body.sw48-ui #status .sw48-system-controls {width:min(160px,45vw);}
 body.sw48-ui #status .sw48-system-controls>.sw48-system-button {min-width:0;height:44px;min-height:44px;flex:1;max-width:50%;font-size:11px;line-height:13px;}
 body.sw48-ui #status #sw48-hyperspace-toggle {flex-direction:column;gap:1px;font-size:10px;line-height:11px;}
 body.sw48-ui #status #sw48-hyperspace-toggle img {display:none;}
 body.sw48-ui #status .sw48-single-system>.sw48-system-button {min-width:108px;max-width:100%;}
}

/* Carrier trial controls share the bottom HUD without using the mobile gun stack. */
#carrier-trial-entry {position:fixed;z-index:25;inset:50% auto auto 50%;transform:translate(-50%,-50%);width:min(420px,88vw);max-height:92dvh;overflow:auto;padding:18px;background:#101923;color:#d3e5ef;border:1px solid #73899d;text-align:center;box-sizing:border-box}
#carrier-trial-entry h2 {font:600 19px/1.25 Arial,sans-serif;margin:0 0 12px}
#carrier-trial-entry img {display:block;width:100%;max-height:28dvh;object-fit:contain;margin-bottom:14px}
.carrier-trial-ships {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:0 0 12px}
@media (min-width:600px) {
  .carrier-trial-ships {grid-template-columns:repeat(4,minmax(0,1fr))}
}
body.sw48-ui #status:has(#carrier-weapon-bar) {width:max-content !important;max-width:min(72vw,720px) !important}
body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-armaments {flex-direction:row;width:max-content}
#carrier-weapon-bar {
  --carrier-key-width:46px;
  width:max-content;max-width:100%;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:1px 4px;
  margin:0 auto 3px;font:11px/1.1 Arial,sans-serif;text-align:center;color:#d1e6f3;
}
#carrier-weapon-bar button,#carrier-trial-entry button {min-height:28px;background:#142534;color:#d9edf8;border:1px solid #526e83;border-radius:2px;padding:2px;cursor:pointer;font:inherit;touch-action:manipulation}
#carrier-trial-entry button {min-height:44px;padding:5px 12px}
#carrier-weapon-bar button:disabled {cursor:default;opacity:.6}
#carrier-weapon-bar button[aria-pressed=true],.carrier-trial-ships button[aria-pressed=true] {border-color:#a8ddf7;background:#2b4b61;color:#fff;opacity:1}
.carrier-wing-orders,.carrier-wing-slots {
  display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,var(--carrier-key-width));gap:1px;
  width:max-content;max-width:100%;min-width:0;
}
.carrier-wing-orders:has(> #carrier-wing-launch) {grid-auto-columns:minmax(var(--carrier-key-width),max-content)}
.carrier-wing-orders button {min-width:0;overflow-wrap:anywhere}
.carrier-wing-slot {position:relative;display:grid;place-content:center;justify-items:center;min-width:0;white-space:nowrap}
.carrier-wing-mark {display:flex;align-items:center;justify-content:center;gap:2px;color:#c3d7e6}
.carrier-wing-mark img {width:15px;height:11px;object-fit:contain}
.carrier-wing-slot strong {font-size:10px;line-height:11px;font-variant-numeric:tabular-nums}
.carrier-wing-warning {position:absolute;top:2px;right:3px;color:#ffc37f;font-weight:bold}
#carrier-spawn-opponent {flex-basis:100%;min-width:0;overflow-wrap:anywhere}
#carrier-weapon-bar .carrier-wing-slot[data-mode=attack] {box-shadow:inset 0 -2px #e89c72}
#carrier-weapon-bar .carrier-wing-slot[data-mode=standby] {box-shadow:inset 0 -2px #7cb8d8}
#carrier-weapon-bar .carrier-wing-slot[data-mode=return] {box-shadow:inset 0 -2px #98d3ad}
@media (pointer:coarse), (max-width:700px) {
  #carrier-weapon-bar {--carrier-key-width:44px}
  #carrier-weapon-bar button {min-height:44px}
}
@media (pointer:coarse), (max-width:700px) {
  body.sw48-ui #status:has(#carrier-weapon-bar) {width:min(350px,calc(100vw - 104px)) !important;max-width:none !important}
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-armaments {
    display:grid;grid-template-columns:repeat(6,minmax(0,1fr));width:100%;max-height:none;
    overflow:visible;touch-action:manipulation;
  }
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-weapon-slot {
    flex-direction:column;justify-content:center;min-width:0;height:44px;min-height:44px;
    gap:1px;padding:2px !important;touch-action:manipulation;
  }
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-weapon-icon {
    width:22px;height:20px;flex:0 0 20px;
  }
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-weapon-icon img {
    width:22px !important;height:20px !important;
  }
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-weapon-count {font:10px/12px Arial,sans-serif}
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-system-controls {width:100%;min-width:0}
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-system-controls:has(#sw48-hyperspace-toggle) {grid-column:span 2}
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-system-controls>.sw48-system-button {
    width:100%;min-width:0;max-width:none;min-height:44px;padding:2px !important;
    font:10px/12px Arial,sans-serif;touch-action:manipulation;
  }
}
@media (max-width:377px) {
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-armaments {grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* Portrait HUD: chat and weapons share the bottom edge in separate columns. */
@media (orientation:portrait) and (max-width:700px) {
  #sw48-match-chat {
    --chat-inset:4px;
    width:calc(28vw - var(--chat-edge) - 3px);
    bottom:var(--chat-bottom);
    font-size:clamp(11px,3.15vw,14px);line-height:1.18;
  }
  #sw48-chat-input {padding-inline:.3rem;}


  body.sw48-ui #status,
  body.sw48-ui #status:has(#carrier-weapon-bar) {
    width:min(42vw,17rem) !important;
    max-width:42vw !important;
  }
  body.sw48-ui #status .sw48-armaments,
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-armaments {
    display:grid;grid-template-columns:minmax(0,1fr);
    width:100%;max-height:none;overflow:visible;touch-action:manipulation;
  }
  body.sw48-ui #status .sw48-armaments:has(> .sw48-weapon-slot:nth-child(3)),
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-armaments {
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  body.sw48-ui #status .sw48-weapon-slot {
    min-width:0;min-height:40px;padding:2px 3px !important;
    justify-content:center;font-size:11px;
  }
  body.sw48-ui #status .sw48-armaments:has(> .sw48-weapon-slot:nth-child(3))>.sw48-weapon-slot {
    flex-direction:column;gap:0;
  }
  body.sw48-ui #status .sw48-weapon-count {font-size:11px;}
  body.sw48-ui #status .sw48-system-controls,
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-system-controls:has(#sw48-hyperspace-toggle) {
    grid-column:1/-1;width:100%;
  }
  body.sw48-ui #status .sw48-system-controls>.sw48-system-button,
  body.sw48-ui #status:has(#carrier-weapon-bar) .sw48-system-controls>.sw48-system-button {
    flex:1;min-width:0;max-width:none;height:auto;
    padding:2px !important;font:10px/12px Arial,sans-serif;
  }
}

@media (orientation:landscape) and (max-height:600px) {
  #sw48-match-chat {
    width:min(26vw,17rem,calc(var(--chat-side-room,26vw) - var(--chat-edge) - .35rem));
  }
}
/* Aircraft deployment anchors remain compact and scrollable on phones. */
.deployment-carriers{display:flex;align-items:center;gap:6px;width:calc(100% - 32px);max-width:1280px;flex-shrink:0;overflow-x:auto;padding:4px 0 7px;font:12px Arial,sans-serif;touch-action:pan-x;}
.deployment-carriers>span{white-space:nowrap;color:#9cb8ca;}
.deployment-carriers button{display:flex;align-items:center;gap:6px;white-space:nowrap;min-height:36px;padding:4px 9px;background:#152838;color:#cce5f4;border:1px solid #486174;border-radius:3px;cursor:pointer;font:inherit;}
.deployment-carriers button.selected{background:#29485e;border-color:#bee6fb;}
.deployment-carriers img{width:42px;height:24px;object-fit:contain;}
@media(max-height:500px){.deployment-carriers{padding:2px 0;}.deployment-carriers button{min-height:30px;}.deployment-carriers img{height:20px;width:30px;}}

/* Translated system labels can occupy more lines than English/Chinese. */
body.sw48-ui #status .sw48-system-controls>.sw48-system-button {
 height:auto!important;min-height:44px;overflow-wrap:anywhere;hyphens:auto;
}
body.sw48-ui #status .sw48-system-button span {min-width:0;white-space:normal;overflow-wrap:anywhere;}
@media(max-width:700px), (max-width:1100px) and (max-height:600px) and (pointer:coarse) {
 body.sw48-ui #status .sw48-status-line {white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;}
 body.sw48-ui a.sw48-faction-details-toggle {overflow-wrap:anywhere;}
 body.sw48-ui a.sw48-faction-details-toggle>span {min-width:0;}
 body.sw48-ui #sw48-faction-status .faction-identity,
 body.sw48-ui #sw48-faction-status .faction-name {min-width:0;overflow-wrap:anywhere;}
 body.sw48-ui #upgrade .sw48-ship-card {
  height:auto!important;min-height:4.6rem;grid-template-rows:auto auto;
 }
 body.sw48-ui #upgrade .sw48-ship-card>div:nth-of-type(1),
 body.sw48-ui #upgrade .sw48-ship-card>div:nth-of-type(2) {
  max-height:none!important;white-space:normal!important;overflow:visible;overflow-wrap:anywhere;
 }
}

#sw48-faction-entry.last-stand-message {animation:none;color:#ffd278}
.last-stronghold[role="button"] {cursor:pointer}
.last-stronghold text {font:2.8px 'Segoe UI','Microsoft YaHei',sans-serif;paint-order:stroke;stroke:#101319;stroke-width:.55;pointer-events:none}
.last-stronghold[role="button"]:focus {outline:none !important;box-shadow:none !important}
.last-stronghold:focus-visible path {stroke:white;stroke-width:.85}
#sw48-tactical-map:has(.support-actions) #tactical-coordinates {display:none}
#sw48-tactical-map .support-actions {padding:4px 10px}
#sw48-tactical-map .support-actions button {min-height:36px}
#sw48-tactical-map .reinforcing-count {display:block;font-size:.9em}
#sw48-faction-hud .recon-assist {margin-top:3px;font-size:.85em;color:#fff;text-shadow:0 1px 3px #000;pointer-events:none}
