:root {
    color-scheme: dark;
    --bg: #10161d;
    --panel: rgba(14, 22, 31, 0.88);
    --panel-strong: rgba(13, 19, 27, 0.97);
    --line: rgba(255, 255, 255, 0.12);
    --text: #f4f7fb;
    --muted: #aab7c5;
    --accent: #67d6ff;
    --accent-2: #7bf1a8;
    --danger: #ff6b72;
    --warning: #ffd166;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    --mobile-bottom-inset: max(12px, env(safe-area-inset-bottom, 0px));
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

button {
    font: inherit;
    -webkit-user-drag: none;
}

input,
textarea,
select,
[contenteditable="true"],
[role="textbox"] {
    user-select: text;
    -webkit-user-select: text;
}

#game-shell {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 520px;
    overflow: hidden;
    background: #87b66f;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    -webkit-user-drag: none;
    outline: none;
}

.glass-panel,
.hud-card {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

#hud {
    position: absolute;
    top: 14px;
    left: 14px;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 28px));
    pointer-events: none;
}

.hud-card {
    border-radius: 14px;
    padding: 11px 13px;
}

.identity-card {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.player-profile {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

.player-profile-text {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.player-avatar-wrap {
    position: relative;
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    overflow: hidden;
    place-items: center;
    border: 1px solid rgba(103, 214, 255, 0.58);
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(103, 214, 255, 0.9), rgba(255, 207, 103, 0.9));
    box-shadow: 0 0 0 2px rgba(8, 14, 19, 0.42);
}

.player-avatar-wrap[hidden],
.player-avatar[hidden],
.player-avatar-fallback[hidden] {
    display: none;
}

.player-avatar {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.identity-card strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
}

.identity-card span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.identity-card .player-avatar-fallback {
    color: #07161c;
    font-size: 13px;
    font-weight: 950;
    line-height: 1;
}

#seedLabel {
    flex: 0 0 auto;
}

.stats-card {
    display: grid;
    gap: 8px;
}

.combat-card {
    display: grid;
    gap: 7px;
}

.role-progress-card {
    display: grid;
    gap: 6px;
    width: 100%;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    pointer-events: auto;
    background:
        linear-gradient(135deg, rgba(111, 214, 255, 0.16), rgba(255, 209, 102, 0.09)),
        var(--panel);
}

.role-progress-card:hover {
    filter: brightness(1.08);
}

.role-progress-card span {
    min-width: 0;
}

.role-progress-card>span:first-child {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.role-progress-card strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-progress-card #roleProgressMeta {
    color: var(--muted);
    font-size: 11px;
}

.role-progress-card i {
    display: block;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.role-progress-card b {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #ffd166);
    transition: width 180ms ease;
}

.combat-row,
.wanted-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.combat-row span {
    color: var(--text);
    font-weight: 800;
}

.combat-row strong {
    color: var(--warning);
    font-variant-numeric: tabular-nums;
}

.wanted-row>span {
    color: var(--muted);
}

.wanted-stars {
    color: rgba(255, 255, 255, 0.3);
    font-size: 17px;
    line-height: 1;
    white-space: nowrap;
}

.wanted-stars b {
    color: #ffd45f;
    font-weight: 800;
    text-shadow: 0 0 9px rgba(255, 190, 55, 0.5);
}

.wanted-stars span {
    color: rgba(255, 255, 255, 0.3);
}

.wanted-stars[data-level="1"],
.wanted-stars[data-level="2"],
.wanted-stars[data-level="3"],
.wanted-stars[data-level="4"],
.wanted-stars[data-level="5"] {
    color: #ffd45f;
    text-shadow: 0 0 9px rgba(255, 190, 55, 0.5);
}

.reload-track {
    height: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.reload-track i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
}

.sync-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 10px;
}

.sync-row strong {
    max-width: 210px;
    overflow: hidden;
    color: var(--accent-2);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-row {
    display: grid;
    grid-template-columns: 74px 1fr 66px;
    gap: 8px;
    align-items: center;
    font-size: 12px;
}

.stat-row strong {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.bar-fill {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    transition: width 160ms ease;
}

.bar-fill.health {
    background: linear-gradient(90deg, #ff646d, #ff9c72);
}

.bar-fill.energy {
    background: linear-gradient(90deg, #51d6ff, #79f0b1);
}

.money-row {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
}

.money-row strong {
    color: var(--text);
}

.primary-button,
.secondary-button,
.action-button,
.buy-button,
.use-button {
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.action-button:hover,
.buy-button:hover,
.use-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.primary-button:active,
.secondary-button:active,
.action-button:active,
.buy-button:active,
.use-button:active {
    transform: translateY(0);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none !important;
    filter: none !important;
}

.primary-button {
    pointer-events: auto;
    padding: 11px 14px;
    color: #07161c;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    font-weight: 800;
    box-shadow: var(--shadow);
}

#hud .secondary-button {
    pointer-events: auto;
}

.iren-menu-button,
.auth-button,
.profile-button {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.secondary-button {
    padding: 11px 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid var(--line);
    font-weight: 700;
}

.cyber-systems-button {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    text-align: left;
}

.cyber-button-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(103, 214, 255, 0.58);
    border-radius: 5px;
    color: #07161c;
    background: var(--accent);
    font-size: 10px;
    font-weight: 950;
}

.cyber-button-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cyber-button-short {
    display: none;
}

.cyber-systems-button strong {
    color: var(--accent-2);
    font-size: 12px;
}

#cyberSystemsModal {
    position: fixed;
    width: 100vw;
    height: 100dvh;
}

.cyber-systems-card.modal-wide {
    width: min(980px, 100%);
    max-height: calc(100dvh - 24px);
    border-radius: 8px;
}

.cyber-resource-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0 4px;
}

.cyber-resource {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.045);
}

.cyber-resource span,
.cyber-resource strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cyber-resource span {
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
}

.cyber-resource strong {
    margin-top: 4px;
    font-size: 13px;
}

.cyber-resource i {
    display: block;
    height: 4px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.09);
}

.cyber-resource i b {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.cyber-resource.is-warning i b {
    background: #ff6672;
}

.cyber-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cyber-panel {
    margin: 14px 0 18px;
}

.cyber-panel.hidden {
    display: none;
}

.cyber-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.cyber-panel-toolbar h3 {
    margin: 0;
    font-size: 15px;
}

.cyber-panel-toolbar select,
.cyber-select {
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    background: #121a23;
}

.cyber-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.cyber-body-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.cyber-slot-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyber-color, rgba(255, 255, 255, 0.18));
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
}

.cyber-slot-card.is-installed {
    background: linear-gradient(135deg, rgba(103, 214, 255, 0.08), rgba(255, 255, 255, 0.035));
}

.cyber-slot-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(103, 214, 255, 0.34);
    border-radius: 5px;
    color: #07161c;
    background: var(--cyber-color, var(--accent));
    font-size: 10px;
    font-weight: 950;
}

.cyber-slot-card strong,
.cyber-slot-card span,
.cyber-slot-card small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cyber-slot-card strong {
    font-size: 12px;
}

.cyber-slot-card span,
.cyber-slot-card small {
    color: var(--muted);
    font-size: 10px;
}

.cyber-slot-card small {
    margin-top: 3px;
    white-space: normal;
}

.cyber-slot-load {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 5px;
}

.cyber-slot-load span {
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    font-size: 9px;
    font-weight: 800;
}

.cyber-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyber-color, var(--accent));
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.045);
}

.cyber-card.is-deployed {
    box-shadow: inset 0 0 0 1px rgba(95, 242, 178, 0.28);
}

.cyber-card.is-destroyed {
    opacity: 0.68;
}

.cyber-card-head,
.cyber-card-meta,
.cyber-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cyber-card-head>div {
    min-width: 0;
}

.cyber-card-head strong,
.cyber-card-head span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cyber-card-head strong {
    font-size: 13px;
}

.cyber-card-head span,
.cyber-card-meta,
.cyber-card-description {
    color: var(--muted);
    font-size: 11px;
}

.cyber-card-description {
    min-height: 30px;
    margin: 8px 0;
    line-height: 1.4;
}

.cyber-badge {
    flex: 0 0 auto;
    padding: 4px 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.16);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.cyber-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin: 9px 0;
}

.cyber-stat-grid span {
    min-width: 0;
    padding: 5px;
    border-radius: 4px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.17);
    font-size: 9px;
    text-align: center;
}

.cyber-stat-grid b {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: var(--text);
    font-size: 11px;
    text-overflow: ellipsis;
}

.cyber-system-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin: 8px 0;
}

.cyber-system-grid span {
    padding: 4px 5px;
    border-left: 2px solid hsl(calc(var(--system-health, 100) * 1.2), 72%, 55%);
    color: var(--muted);
    background: rgba(0, 0, 0, 0.16);
    font-size: 9px;
}

.cyber-system-grid b {
    float: right;
    color: var(--text);
}

.cyber-order-row,
.cyber-module-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}

.cyber-card-actions {
    margin-top: 9px;
}

.cyber-action {
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    font-size: 10px;
    font-weight: 800;
}

.cyber-action.primary {
    color: #07161c;
    border-color: transparent;
    background: var(--accent-2);
}

.cyber-action.danger {
    color: #ff9aa2;
}

.cyber-empty {
    padding: 24px 12px;
    border: 1px dashed var(--line);
    border-radius: 6px;
    color: var(--muted);
    text-align: center;
}

.wide {
    width: 100%;
}

#eventPanel {
    display: none !important;
    position: absolute;
    left: 14px;
    bottom: 14px;
    width: min(390px, calc(100vw - 28px));
    padding: 12px 14px;
    border-radius: 14px;
}

#eventPanel h2,
#miniMapPanel h2 {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

#eventLog {
    display: grid;
    gap: 5px;
    margin: 9px 0 0;
    padding-left: 21px;
    max-height: 112px;
    overflow: hidden;
    color: #e9eff6;
    font-size: 12px;
    line-height: 1.35;
}

#eventLog li::marker {
    color: var(--accent);
}

#miniMapPanel {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 290px;
    padding: 12px 14px;
    border-radius: 14px;
    transition: opacity 0.18s ease;
}

#miniMapPanel.is-world-object-overlap {
    opacity: 0.18;
}

#miniMapPanel.is-world-object-overlap:hover,
#miniMapPanel.is-world-object-overlap:focus-within {
    opacity: 0.96;
}

.panel-title-row,
.modal-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

#cityClock {
    color: var(--muted);
    font-size: 11px;
}

#miniMap {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 9px;
    border-radius: 9px;
    background: #6f985f;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

#miniMapPanel.world-map-teleport-enabled {
    cursor: pointer;
    border-color: rgba(123, 241, 168, 0.42);
    box-shadow: 0 0 0 1px rgba(123, 241, 168, 0.12), var(--shadow);
}

#miniMapPanel.world-map-teleport-enabled #miniMap {
    border-color: rgba(123, 241, 168, 0.48);
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 10px;
}

#game-shell.mission-active #miniMapPanel {
    width: min(280px, calc(100vw - 20px));
}

#game-shell.mission-active .map-legend {
    display: none;
}

.mission-ui-toggle {
    display: block;
    width: 100%;
    min-height: 38px;
    margin-top: 7px;
    padding: 9px 12px;
    border: 1px solid rgba(103, 214, 255, 0.36);
    border-radius: 8px;
    color: var(--text);
    background: rgba(10, 18, 27, 0.9);
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    cursor: pointer;
    pointer-events: auto;
}

.mission-ui-toggle[hidden] {
    display: none;
}

#game-shell.mission-location-controls #combatControl,
#combatControl[hidden] {
    display: none !important;
}

#game-shell.interface-compact:not(.mission-ui-expanded) #eventPanel,
#game-shell.interface-compact:not(.mission-ui-expanded) #missionTracker,
#game-shell.interface-compact:not(.mission-ui-expanded) #worldEventBadge,
#game-shell.interface-compact:not(.mission-ui-expanded) #interactionPrompt,
#game-shell.interface-compact:not(.mission-ui-expanded) #toast,
#game-shell.interface-compact:not(.mission-ui-expanded) #helpPanel {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

#game-shell.interface-compact:not(.mission-ui-expanded) #hud {
    width: min(292px, calc(100vw - 28px));
}

#game-shell.interface-compact:not(.mission-ui-expanded) #hud> :not(.stats-card):not(.combat-card),
#game-shell.interface-compact:not(.mission-ui-expanded) #hud .stats-card>.money-row,
#game-shell.interface-compact:not(.mission-ui-expanded) #hud .combat-card> :not(.combat-row):not(.reload-track) {
    display: none;
}

#game-shell.interface-compact:not(.mission-ui-expanded) #hud .stats-card,
#game-shell.interface-compact:not(.mission-ui-expanded) #hud .combat-card {
    gap: 7px;
    padding: 10px 12px;
    border-color: rgba(103, 214, 255, 0.3);
    background: rgba(10, 18, 27, 0.86);
}

#game-shell.interface-compact:not(.mission-ui-expanded) #hud .stats-card .stat-row {
    grid-template-columns: 74px minmax(84px, 1fr) 66px;
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.map-legend i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.legend-player {
    background: #fff14a;
}

.legend-camera {
    border: 1px solid rgba(255, 255, 255, 0.78);
    background: transparent;
}

.legend-faction-mission {
    border: 2px solid #ffd166;
    background: #6fd6ff;
}

.legend-mission-hub {
    background: #67d6ff;
}

.legend-shop {
    background: #f39cff;
}

.legend-weapon-shop {
    background: #ffcf67;
}

.legend-iren-shop {
    background: #67d6e9;
}

.legend-owned-shop {
    background: #65d88a;
}

.legend-salvage {
    background: #ffcf67;
}

.legend-delivery {
    border-radius: 50% !important;
    background: #67d6e9;
}

.legend-reputation {
    background: #f4c95d;
}

.legend-services {
    background: #65d88a;
}

.legend-content {
    background: #67d6e9;
}

.legend-exhibition {
    background: #e5d2a9;
}

.legend-iren-specialist {
    border: 2px solid #67d6e9;
    border-radius: 50% !important;
    background: #14313b;
}

.legend-project {
    background: #f4c95d;
}

.legend-project-finance {
    background: #ff9b59;
}

.legend-park {
    background: #43b65c;
}

.legend-police {
    background: #52a8ff;
}

.legend-bandit {
    background: #ff5e64;
}

.legend-transport {
    background: #ffb347;
}

.legend-train {
    background: #d4a94d;
}

#interactionPrompt {
    position: absolute;
    left: 50%;
    bottom: 38px;
    z-index: 16;
    transform: translateX(-50%) translateY(16px);
    opacity: 0;
    pointer-events: none;
    padding: 11px 16px;
    border-radius: 999px;
    color: #06151b;
    background: rgba(245, 251, 255, 0.94);
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 800;
    transition: opacity 140ms ease, transform 140ms ease;
    white-space: nowrap;
    max-width: min(520px, calc(100vw - 24px));
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
}

#interactionPrompt.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#toast {
    position: absolute;
    left: 50%;
    top: 22px;
    z-index: 30;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    pointer-events: none;
    max-width: min(640px, calc(100vw - 30px));
    padding: 11px 15px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: var(--text);
    background: rgba(13, 20, 29, 0.94);
    box-shadow: var(--shadow);
    text-align: center;
    font-size: 13px;
    transition: opacity 150ms ease, transform 150ms ease;
}

#toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.combat-control {
    position: fixed;
    left: auto;
    right: 14px;
    top: 50%;
    z-index: 14;
    display: grid;
    gap: 8px;
    width: min(280px, calc(100vw - 28px));
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(10, 17, 24, 0.9);
    box-shadow: var(--shadow);
    transform: translateY(-50%);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.combat-mode-button {
    min-height: 46px;
    padding: 10px 14px;
    border: 0;
    border-radius: 6px;
    color: #1a090b;
    background: #ff6b72;
    font-weight: 900;
    cursor: pointer;
}

.difficulty-control {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
}

.difficulty-control button {
    min-width: 0;
    padding: 8px 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.difficulty-control button.active {
    color: #07161c;
    border-color: #7bf1a8;
    background: #7bf1a8;
}

.combat-control.combat-active {
    top: 50%;
    right: 14px;
    width: auto;
    min-width: 210px;
    padding: 0;
    border: 0;
    background: transparent;
    transform: translateY(-50%);
    backdrop-filter: none;
}

.combat-control.combat-active .difficulty-control {
    display: none;
}

.combat-control.combat-active .combat-mode-button {
    min-height: 38px;
    color: #f7fbff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(132, 28, 38, 0.92);
    box-shadow: var(--shadow);
    font-size: 12px;
}

.world-event-badge {
    position: absolute;
    left: 50%;
    top: 62px;
    z-index: 13;
    max-width: min(520px, calc(100vw - 28px));
    padding: 8px 12px;
    border: 1px solid rgba(255, 209, 102, 0.35);
    border-radius: 6px;
    color: #fff2c4;
    background: rgba(57, 28, 18, 0.9);
    box-shadow: var(--shadow);
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.world-event-badge[hidden] {
    display: none;
}

.mission-tracker {
    position: absolute;
    left: 388px;
    right: 318px;
    top: 14px;
    z-index: 13;
    display: grid;
    gap: 8px;
    width: auto;
    max-width: 430px;
    padding: 10px 12px;
    border-radius: 10px;
    transform: none;
    pointer-events: none;
}

.mission-tracker[hidden] {
    display: none;
}

.mission-tracker-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mission-tracker-title strong {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mission-tracker-title span {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
}

.mission-tracker-stats,
.mission-tracker-objectives {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mission-tracker-pill,
.mission-objective-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 5px 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.045);
    font-size: 10px;
    font-weight: 800;
}

.mission-tracker-pill strong,
.mission-objective-pill strong {
    color: var(--text);
}

.mission-objective-pill.completed {
    color: rgba(244, 247, 251, 0.62);
    text-decoration: line-through;
}

.mission-objective-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

#helpPanel {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: grid;
    gap: 8px;
    width: 252px;
    padding: 11px 13px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 11px;
}

#helpPanel strong {
    color: var(--text);
    font-size: 12px;
}

.help-panel-title {
    line-height: 1.15;
}

.help-panel-subtitle,
.help-panel-footer {
    color: rgba(220, 230, 240, 0.66);
    font-size: 10px;
    line-height: 1.25;
}

.help-panel-rows,
.help-panel-tips {
    display: grid;
    gap: 5px;
}

.help-panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.help-panel-row b {
    flex: 0 0 auto;
    color: rgba(220, 230, 240, 0.62);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.help-panel-row span {
    min-width: 0;
    color: var(--text);
    font-weight: 800;
    text-align: right;
    overflow-wrap: anywhere;
}

.help-panel-tip {
    position: relative;
    padding-left: 10px;
    line-height: 1.28;
}

.help-panel-tip::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.48em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

.help-panel-tip.warning {
    color: #ffd166;
}

.help-panel-tip.warning::before {
    background: #ffd166;
}

.help-panel-footer {
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.onboarding-panel {
    position: absolute;
    right: 14px;
    bottom: 148px;
    z-index: 14;
    display: grid;
    gap: 8px;
    width: min(340px, calc(100vw - 28px));
    padding: 11px 12px 12px;
    border-radius: 12px;
    color: var(--text);
    pointer-events: auto;
}

.onboarding-panel[hidden] {
    display: none;
}

.onboarding-panel-head,
.onboarding-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.onboarding-panel-head span {
    color: #ffd166;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#onboardingSkipButton {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    line-height: 1;
}

.onboarding-progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
}

.onboarding-progress-track i {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ffd166, #7bf1a8, #67d6ff);
    transition: width 180ms ease;
}

.onboarding-progress-meta strong {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.onboarding-progress-meta span {
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

#onboardingDescription {
    margin: 0;
    color: rgba(232, 240, 248, 0.82);
    font-size: 11px;
    line-height: 1.35;
}

.onboarding-control-hint {
    padding: 8px 9px;
    border: 1px solid rgba(255, 209, 102, 0.35);
    border-radius: 7px;
    color: #fff3c4;
    background: rgba(255, 209, 102, 0.1);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.3;
}

.onboarding-steps {
    display: grid;
    gap: 5px;
}

.onboarding-step {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    gap: 7px;
    align-items: center;
    min-height: 30px;
    padding: 5px 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.onboarding-step i {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: #09131a;
    background: rgba(255, 255, 255, 0.2);
    font-size: 11px;
    font-style: normal;
}

.onboarding-step strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.onboarding-step span {
    color: rgba(232, 240, 248, 0.72);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.onboarding-step.completed i {
    background: #7bf1a8;
}

.onboarding-step.active {
    border-color: rgba(255, 209, 102, 0.42);
    background: rgba(255, 209, 102, 0.08);
}

.onboarding-step.active i {
    background: #ffd166;
}

.onboarding-reward {
    padding-top: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffdca0;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.25;
}

.onboarding-modal-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 20px;
}

.onboarding-modal-step {
    min-height: 118px;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.onboarding-modal-step b {
    display: block;
    margin-bottom: 6px;
    color: #ffd166;
    font-size: 12px;
    text-transform: uppercase;
}

.onboarding-modal-step strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
}

.onboarding-modal-step span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.modal {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(4, 8, 12, 0.68);
    backdrop-filter: blur(6px);
}

.modal.hidden {
    display: none;
}

.modal-card {
    position: relative;
    box-sizing: border-box;
    width: min(520px, 100%);
    max-width: calc(100vw - 36px);
    max-height: min(760px, calc(100dvh - 36px));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 25px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel-strong);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.modal-card.modal-wide {
    width: min(820px, 100%);
}

.world-map-overlay {
    align-items: stretch;
    padding: 18px;
}

.world-map-panel {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(280px, 1fr) auto auto;
    gap: 12px;
    width: min(1120px, calc(100vw - 36px));
    max-height: calc(100dvh - 36px);
    min-height: min(760px, calc(100dvh - 36px));
    margin: auto;
    padding: 18px;
    border: 1px solid rgba(123, 241, 168, 0.24);
    border-radius: 12px;
    background: rgba(8, 15, 22, 0.94);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.world-map-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
}

.world-map-head h2 {
    margin: 2px 0 0;
}

#worldMapCanvas {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 280px;
    border: 1px solid rgba(123, 241, 168, 0.28);
    border-radius: 8px;
    background: #07121d;
    cursor: crosshair;
}

.world-map-legend {
    margin-top: 0;
    max-height: 116px;
    overflow: auto;
    padding: 10px 12px;
    border: 1px solid rgba(123, 241, 168, 0.18);
    border-radius: 8px;
    background: rgba(5, 12, 18, 0.72);
}

.world-map-legend span {
    color: #dfeaf2;
    font-size: 11px;
}

.world-map-description {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.mission-result-card {
    width: min(920px, 100%);
}

.pause-menu-card {
    width: min(460px, calc(100vw - 36px));
    min-width: 0;
    contain: inline-size;
}

.pause-menu-card *,
.pause-menu-card *::before,
.pause-menu-card *::after {
    box-sizing: border-box;
    min-width: 0;
}

.onboarding-card.modal-wide {
    width: min(820px, calc(100vw - 36px));
    max-width: calc(100vw - 16px);
}

.role-progress-modal-card.modal-wide {
    width: min(980px, calc(100vw - 36px));
}

.role-progress-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 16px;
}

.role-progress-stat {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.role-progress-stat span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.role-progress-stat strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-progress-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr);
    gap: 16px;
}

.role-progress-section {
    min-width: 0;
}

.role-progress-section h3 {
    margin: 10px 0 9px;
    font-size: 14px;
}

.role-faction-list,
.role-style-list,
.role-progress-log {
    display: grid;
    gap: 8px;
}

.role-faction-row,
.role-style-row,
.role-log-row {
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.role-faction-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.9fr) minmax(130px, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.role-faction-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.role-faction-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    box-shadow: 0 0 14px currentColor;
}

.role-faction-name,
.role-style-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-faction-meter,
.role-style-meter {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.role-faction-meter i,
.role-style-meter i {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff5b67, #ffd166, #78e6a0);
}

.role-style-meter i {
    background: linear-gradient(90deg, #6fd6ff, #ffd166);
}

.role-relation-pill {
    min-width: 94px;
    padding: 5px 8px;
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.role-relation-pill[data-tone="ally"],
.role-relation-pill[data-tone="good"] {
    color: #17331f;
    background: #78e6a0;
}

.role-relation-pill[data-tone="warning"] {
    color: #291d05;
    background: #ffd166;
}

.role-relation-pill[data-tone="danger"] {
    color: #fff;
    background: #ff5b67;
}

.role-style-row {
    display: grid;
    gap: 7px;
}

.role-style-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.role-style-head span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.role-style-row p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.role-log-row {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.role-log-row[data-tone="positive"],
.role-log-row[data-tone="level"] {
    color: #9df0b6;
}

.role-log-row[data-tone="negative"] {
    color: #ff9aa2;
}

.role-log-empty {
    margin: 0;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
}

.pause-settings {
    display: grid;
    gap: 10px;
    margin: 22px 0 18px;
}

#pauseProgressButton {
    margin-bottom: 10px;
}

#pausePartyButton {
    margin-bottom: 10px;
}

.setting-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
    font-weight: 800;
}

.setting-toggle input {
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    accent-color: var(--accent);
}

.setting-toggle span {
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    text-overflow: ellipsis;
}

.setting-toggle:has(input:disabled) {
    opacity: 0.48;
}

.setting-toggle.compact {
    min-height: 38px;
    padding: 8px 11px;
    font-size: 12px;
}

.gamepad-settings .setting-toggle.compact {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    justify-content: start;
}

.gamepad-settings {
    display: grid;
    gap: 9px;
    min-width: 0;
    max-width: 100%;
    margin: -4px 0 14px;
    padding: 11px;
    border: 1px solid rgba(103, 214, 255, 0.22);
    border-radius: 10px;
    background: rgba(8, 18, 26, 0.58);
}

.gamepad-settings__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    color: var(--text);
    font-size: 13px;
}

.gamepad-settings__head strong {
    flex: 0 0 auto;
}

.gamepad-settings__head span {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.setting-range {
    display: grid;
    grid-template-columns: minmax(88px, 0.8fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.setting-range input {
    min-width: 0;
    width: 100%;
    accent-color: var(--accent);
}

.gamepad-settings__hint {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.gamepad-control-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 4px 7px 4px 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.055);
    color: #dce9f2;
    font-weight: 800;
}

.gamepad-button-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 50%;
    color: #07161c;
    background: #f4f8fb;
    font-size: 10px;
    font-weight: 950;
    line-height: 1;
}

.gamepad-control-hint.xbox .gamepad-button-icon {
    color: #06210f;
    border-color: rgba(123, 241, 168, 0.92);
    background: #7bf1a8;
}

.gamepad-control-hint.playstation .gamepad-button-icon {
    color: #081326;
    border-color: rgba(103, 214, 255, 0.92);
    background: #9be7ff;
}

.gamepad-control-hint.stick .gamepad-button-icon {
    border-radius: 8px;
    color: #f7fbff;
    background: #20334d;
}

.gamepad-bindings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.gamepad-bindings label {
    display: grid;
    gap: 4px;
    min-width: 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
}

.gamepad-bindings select {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: var(--text);
    background: rgba(12, 21, 29, 0.88);
    font: inherit;
    text-overflow: ellipsis;
}

.multiplayer-party-panel {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
}

.multiplayer-party-panel[hidden] {
    display: none;
}

.multiplayer-party-head,
.multiplayer-party-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.multiplayer-party-head strong,
.multiplayer-party-row strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiplayer-party-row {
    min-height: 32px;
    padding: 7px 8px;
    border-radius: 6px;
    background: rgba(8, 14, 19, 0.28);
}

.multiplayer-party-row span,
.multiplayer-party-empty,
.multiplayer-party-note {
    color: var(--muted);
    font-size: 12px;
}

.multiplayer-party-actions {
    display: flex;
    gap: 8px;
}

.multiplayer-party-actions button {
    flex: 1 1 0;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.modal-kicker {
    margin-bottom: 5px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.modal h2 {
    margin: 0;
    font-size: clamp(24px, 4vw, 34px);
}

.modal-subtitle {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.dialog-line {
    margin: 20px 0;
    padding: 14px 16px;
    border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
    color: #edf5fb;
    background: rgba(255, 255, 255, 0.05);
    line-height: 1.55;
}

.action-list {
    display: grid;
    gap: 10px;
    margin: 0 0 16px;
}

.action-button {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    color: var(--text);
    background: rgba(103, 214, 255, 0.1);
    border: 1px solid rgba(103, 214, 255, 0.22);
    text-align: left;
}

.action-button small {
    color: var(--muted);
    font-weight: 700;
}

.wallet-badge {
    flex: 0 0 auto;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    font-size: 12px;
}

.mission-result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
    margin: 18px 0 14px;
}

.mission-result-stat {
    display: grid;
    gap: 4px;
    min-height: 58px;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.mission-result-stat span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.mission-result-stat strong {
    color: var(--text);
    font-size: 17px;
}

.mission-result-death {
    display: grid;
    gap: 5px;
    margin: 0 0 14px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--faction-color, #ff5b67) 58%, transparent);
    border-left: 4px solid var(--faction-color, #ff5b67);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 91, 103, 0.18), rgba(255, 255, 255, 0.05));
    box-shadow: 0 0 0 1px rgba(255, 91, 103, 0.1) inset;
}

.mission-result-death[hidden] {
    display: none;
}

.mission-result-death-label {
    display: block;
    color: #ffb5bd;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.mission-result-death-name,
.mission-result-death strong {
    display: block;
    color: #fff2f4;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.18;
}

.mission-result-death-detail,
.mission-result-death small {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.mission-result-combat {
    display: grid;
    gap: 10px;
    margin-top: 4px;
}

.mission-result-judgment {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(103, 214, 255, 0.26);
    border-radius: 10px;
    background: rgba(103, 214, 255, 0.075);
}

.mission-result-grade {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(103, 214, 255, 0.42);
    border-radius: 8px;
    color: var(--accent);
    background: rgba(5, 12, 18, 0.42);
    font-size: 24px;
    font-weight: 950;
}

.mission-result-judgment-body {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.mission-result-judgment-body b {
    color: var(--text);
    font-size: 14px;
}

.mission-result-judgment-body span,
.mission-result-judgment-body small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.mission-result-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.mission-result-badges span {
    display: inline-grid;
    gap: 1px;
    min-width: 92px;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.mission-result-badges b {
    color: var(--text);
    font-size: 12px;
}

.mission-result-badges small {
    color: var(--muted);
    font-size: 11px;
}

.mission-result-section-title {
    margin: 0;
    color: var(--text);
    font-size: 15px;
}

.mission-result-faction-list {
    display: grid;
    gap: 8px;
    max-height: min(38vh, 340px);
    overflow: auto;
    padding-right: 2px;
}

.mission-result-faction {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--faction-color, #67d6ff) 42%, var(--line));
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.055);
}

.mission-result-faction-text {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.mission-result-faction-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--faction-color, #67d6ff);
    box-shadow: 0 0 14px var(--faction-color, #67d6ff);
}

.mission-result-faction-name,
.mission-result-faction strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
}

.mission-result-faction-details,
.mission-result-faction small,
.mission-result-empty {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.mission-result-faction-count,
.mission-result-faction b {
    display: block;
    min-width: 34px;
    color: var(--faction-color, #67d6ff);
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    text-align: right;
}

.mission-result-empty {
    margin: 0;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.mission-result-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
}

.mission-result-actions .secondary-button {
    display: grid;
    place-items: center;
    min-height: 44px;
    text-align: center;
    text-decoration: none;
}

.wallet-badge strong {
    color: var(--text);
}

.event-banner {
    margin: 18px 0;
    padding: 13px 15px;
    border-radius: 12px;
    color: #1b1606;
    background: linear-gradient(135deg, #ffe199, #ffd166);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.45;
}

.liveops-menu-button {
    position: relative;
}

.liveops-claim-badge {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    margin-left: 8px;
    padding: 0 6px;
    border-radius: 999px;
    color: #071018;
    background: #ffd166;
    font-weight: 900;
}

.liveops-modal-card {
    width: min(760px, calc(100vw - 32px));
    box-sizing: border-box;
    max-height: min(86vh, 820px);
    overflow: auto;
}

.liveops-modal-card #liveOpsTabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.liveops-modal-card #liveOpsTabs button {
    min-width: 0;
}

.liveops-list {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.liveops-card {
    overflow: hidden;
    border: 1px solid rgba(255, 104, 126, .35);
    border-radius: 18px;
    background: rgba(8, 17, 27, .82);
}

.liveops-card__cover {
    min-height: 118px;
    display: grid;
    align-content: end;
    gap: 4px;
    padding: 20px;
    color: #fff;
    background:
        radial-gradient(circle at 72% 28%, rgba(255, 198, 92, .54), transparent 8%),
        linear-gradient(128deg, #361126, #a42d4d 55%, #2a0c20);
}

.liveops-card__cover strong {
    font-size: clamp(20px, 3vw, 30px);
}

.liveops-card__body,
.liveops-objectives {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.liveops-card__meta,
.liveops-objective__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #b8cad8;
}

.liveops-objective {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 13px;
    background: rgba(255, 255, 255, .045);
}

.liveops-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
}

.liveops-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff536d, #ffd166);
}

.liveops-empty {
    padding: 28px;
    color: #a9bdcc;
    text-align: center;
}

@media (max-width: 620px) {
    .liveops-modal-card {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px);
    }

    .liveops-card__meta,
    .liveops-objective__head {
        align-items: flex-start;
        flex-direction: column;
    }
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.mission-section-title {
    margin: 18px 0 9px;
    color: var(--text);
    font-size: 14px;
}

.mission-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mission-choice {
    display: grid;
    gap: 7px;
    min-height: 136px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
    text-align: left;
}

.mission-planet-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.mission-choice-compact {
    min-height: 92px;
    padding: 11px;
}

.mission-ship-card {
    display: grid;
    gap: 8px;
}

.mission-ship-card .mission-choice {
    width: 100%;
}

.mission-ship-sell-button {
    min-height: 38px;
    padding: 9px 11px;
    border-color: rgba(255, 107, 114, 0.36);
    color: #ffd5d8;
    font-size: 12px;
}

.mission-choice.selected {
    border-color: rgba(103, 214, 255, 0.92);
    background: rgba(103, 214, 255, 0.13);
    box-shadow: inset 0 0 0 1px rgba(103, 214, 255, 0.36);
}

.gamepad-focused,
.mission-choice.gamepad-focused,
.product-card:has(.gamepad-focused),
.mission-ship-card:has(.gamepad-focused) {
    outline: 3px solid rgba(255, 209, 102, 0.88);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(255, 209, 102, 0.14), 0 12px 30px rgba(0, 0, 0, 0.35);
}

.mission-choice.faction-contract-choice {
    border-left: 4px solid var(--faction-color, var(--accent));
}

.mission-choice.faction-contract-choice.selected {
    border-color: var(--faction-color, var(--accent));
    background: color-mix(in srgb, var(--faction-color, var(--accent)) 14%, transparent);
}

.mission-choice strong {
    font-size: 14px;
}

.mission-choice span,
.mission-choice small,
.mission-summary {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.mission-summary {
    display: grid;
    gap: 8px;
    margin: 16px 0;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.mission-choice-meta {
    color: #9fdfff;
    font-weight: 850;
}

.mission-summary-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
}

.mission-summary-row b {
    color: var(--text);
    font-size: 11px;
    text-transform: uppercase;
}

.mission-summary-row span {
    min-width: 0;
}

.mission-tabs {
    margin: 12px 0 14px;
}

.mission-online-panel {
    display: grid;
    gap: 12px;
    max-height: min(62vh, 620px);
    overflow: auto;
    padding-right: 4px;
}

.mission-online-toolbar,
.mission-online-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.mission-online-actions {
    justify-content: flex-end;
}

.mission-online-create {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(103, 214, 255, 0.18);
    background: rgba(8, 16, 24, 0.62);
    border-radius: 8px;
}

.online-create-field,
.online-stake-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr);
    align-items: center;
    gap: 10px;
    color: #d9e8f4;
    font-size: 0.9rem;
}

.online-create-field input,
.online-create-field select,
.online-stake-row input {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(103, 214, 255, 0.24);
    background: rgba(3, 9, 14, 0.86);
    color: #ffffff;
    border-radius: 6px;
    padding: 8px 9px;
}

.online-stake-selector,
.mission-online-list,
.online-game-card {
    display: grid;
    gap: 8px;
}

.online-game-card {
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 22, 31, 0.74);
    border-radius: 8px;
}

.online-game-card strong {
    color: #ffffff;
}

.online-game-card span,
.online-game-card small {
    color: #b9c8d7;
}

.product-card,
.inventory-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.045);
}

.product-card {
    display: grid;
    gap: 8px;
    padding: 14px;
}

.product-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.product-card-icon {
    display: block;
    flex: 0 0 auto;
    width: 38px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background-color: rgba(8, 15, 22, 0.42);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.product-card h3,
.inventory-item h3 {
    margin: 0;
    font-size: 15px;
}

.product-card p,
.inventory-item p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.product-footer,
.inventory-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-top: 3px;
}

.price {
    font-weight: 900;
}

.old-price {
    margin-right: 6px;
    color: var(--muted);
    font-size: 11px;
    text-decoration: line-through;
}

.buy-button,
.use-button {
    padding: 8px 11px;
    color: #07161c;
    background: var(--accent-2);
    font-size: 12px;
    font-weight: 900;
}

.inventory-list {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.inventory-list.hidden,
.arsenal-list.hidden,
.weapon-slots-list.hidden,
.equipment-list.hidden,
.ship-loadout-list.hidden {
    display: none;
}

.inventory-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.inventory-tabs button {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.045);
    font-size: 12px;
    font-weight: 900;
}

.inventory-tabs button.active {
    color: #06151b;
    border-color: transparent;
    background: var(--accent);
}

.inventory-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
}

.inventory-item-icon,
.weapon-card-icon,
.weapon-slot-icon,
.weapon-quick-icon {
    display: block;
    flex: 0 0 auto;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.inventory-item-icon {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background-color: rgba(8, 15, 22, 0.42);
}

.equipment-list,
.ship-loadout-list {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.equipment-summary,
.equipment-card,
.ship-loadout-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.equipment-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
}

.equipment-summary span,
.equipment-stat,
.ship-loadout-stat {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.equipment-summary small,
.equipment-stat small,
.ship-loadout-stat small,
.ship-slot-row label,
.ship-loadout-meta {
    color: var(--muted);
    font-size: 10px;
}

.equipment-summary strong,
.equipment-stat strong,
.ship-loadout-stat strong {
    font-size: 12px;
}

.equipment-card,
.ship-loadout-card {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.equipment-card-header,
.ship-loadout-header,
.ship-slot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.equipment-card-title,
.ship-loadout-title {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.equipment-card-title strong,
.ship-loadout-title strong {
    font-size: 13px;
}

.equipment-card-title small,
.ship-loadout-title small {
    color: var(--muted);
    font-size: 10px;
}

.equipment-color-swatch,
.ship-color-swatch {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: 50%;
}

.equipment-stats,
.ship-loadout-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.equipment-stat,
.ship-loadout-stat {
    padding: 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.18);
}

.ship-loadout-slots {
    display: grid;
    gap: 7px;
}

.ship-slot-row label {
    flex: 0 0 90px;
    font-weight: 800;
}

.ship-slot-select {
    min-width: 0;
    width: 100%;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    background: #151e28;
}

.inventory-item.ally-item {
    border-color: rgba(103, 214, 255, 0.38);
    background: rgba(103, 214, 255, 0.065);
}

.inventory-item.elite-ally-item {
    border-color: rgba(255, 215, 0, 0.72);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(123, 241, 168, 0.07));
    box-shadow: 0 0 0 1px rgba(255, 247, 168, 0.16), 0 0 24px rgba(255, 215, 0, 0.18);
}

.inventory-item.sale-loot-item {
    border-color: rgba(255, 207, 103, 0.42);
    background:
        linear-gradient(135deg, rgba(255, 207, 103, 0.09), rgba(103, 214, 255, 0.045)),
        rgba(255, 255, 255, 0.045);
}

.inventory-item.sale-loot-item .item-quantity {
    color: #ffd166;
}

.inventory-item-content {
    display: grid;
    gap: 5px;
}

.ally-progress-panel {
    display: grid;
    gap: 6px;
    margin-top: 5px;
    padding: 8px;
    border: 1px solid rgba(103, 214, 255, 0.18);
    border-radius: 8px;
    background: rgba(6, 15, 22, 0.36);
}

.ally-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    font-size: 11px;
}

.ally-progress-header span,
.ally-revive-rule {
    color: var(--muted);
}

.ally-progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
}

.ally-progress-track i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7bf1a8, #65dfff);
}

.ally-modifier-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 18px;
    color: #c9f3ff;
    font-size: 10px;
}

.ally-modifier-chip {
    padding: 3px 6px;
    border: 1px solid color-mix(in srgb, var(--modifier-color, var(--accent)) 70%, transparent);
    border-radius: 5px;
    color: var(--modifier-color, var(--accent));
    background: color-mix(in srgb, var(--modifier-color, var(--accent)) 12%, transparent);
    font-size: 9px;
    font-weight: 900;
}

.ally-choice-button {
    align-self: stretch;
}

.item-quantity {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
}

.arsenal-list,
.weapon-slots-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.weapon-card {
    display: grid;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
}

.weapon-slot-card {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 11px;
    align-items: center;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.weapon-slot-index {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: #07161c;
    background: var(--accent);
    font-size: 18px;
    font-weight: 950;
}

.weapon-slot-icon {
    width: 36px;
    height: 28px;
}

.weapon-slot-content {
    min-width: 0;
    display: grid;
    gap: 7px;
}

.weapon-slot-content h3 {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weapon-slot-content small {
    color: var(--muted);
    font-size: 11px;
}

.weapon-slot-select {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: rgba(8, 15, 22, 0.82);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}

.weapon-card.locked {
    opacity: 0.58;
}

.weapon-card-header,
.weapon-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.weapon-card-icon {
    width: 46px;
    height: 34px;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background-color: rgba(8, 15, 22, 0.4);
}

.weapon-card-title {
    min-width: 0;
}

.weapon-card h3 {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weapon-card small {
    color: var(--muted);
    font-size: 11px;
}

.rarity-pill {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 999px;
    color: #06151b;
    font-size: 10px;
    font-weight: 900;
}

.weapon-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.weapon-stat {
    display: grid;
    gap: 2px;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(8, 15, 22, 0.45);
}

.weapon-stat span {
    color: var(--muted);
    font-size: 10px;
}

.weapon-stat strong {
    color: var(--text);
    font-size: 12px;
}

.weapon-progress {
    display: grid;
    gap: 5px;
}

.weapon-progress-label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 10px;
}

.weapon-progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
}

.weapon-progress-track i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
}

.weapon-modifier-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 18px;
    color: #c9f3ff;
    font-size: 10px;
    line-height: 1.45;
}

.weapon-modifier-chip {
    min-width: 0;
    padding: 3px 6px;
    border: 1px solid color-mix(in srgb, var(--modifier-color, var(--accent)) 70%, transparent);
    border-radius: 5px;
    color: var(--modifier-color, var(--accent));
    background: color-mix(in srgb, var(--modifier-color, var(--accent)) 12%, transparent);
    font-size: 9px;
    font-weight: 900;
}

.weapon-card-footer {
    flex-wrap: wrap;
}

.dismantle-button,
.weapon-choice-button {
    border: 1px solid rgba(255, 209, 102, 0.36);
    color: #ffe7a6;
    background: rgba(255, 209, 102, 0.09);
}

.weapon-evolution-card {
    width: min(680px, calc(100vw - 24px));
}

.weapon-evolution-choices {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.weapon-evolution-choice {
    display: grid;
    gap: 8px;
    min-height: 142px;
    padding: 14px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--modifier-color, var(--accent));
    border-radius: 8px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.045);
    text-align: left;
}

.weapon-evolution-choice strong {
    font-size: 14px;
}

.weapon-evolution-choice span {
    color: var(--modifier-color, var(--accent));
    font-size: 11px;
    font-weight: 900;
}

.weapon-evolution-choice small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.upgrade-button {
    padding: 8px 11px;
    color: #07161c;
    background: var(--accent-2);
    font-size: 12px;
    font-weight: 900;
}

.upgrade-button:disabled {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.07);
    cursor: not-allowed;
}

.use-button:disabled {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.07);
    cursor: not-allowed;
}

.empty-state {
    padding: 28px 16px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--muted);
    text-align: center;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#mobileControls {
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 12;
    display: none;
    grid-template-columns: 124px 108px 124px;
    align-items: end;
    justify-content: space-between;
    width: min(100%, 760px);
    min-height: 166px;
    padding: 12px max(10px, env(safe-area-inset-right, 0px)) var(--mobile-bottom-inset) max(10px, env(safe-area-inset-left, 0px));
    transform: translateX(-50%);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.mobile-stick {
    position: relative;
    width: 124px;
    height: 124px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(11, 19, 27, 0.66);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32), inset 0 0 0 12px rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    touch-action: none;
    transition: transform 120ms ease, opacity 120ms ease, border-color 120ms ease;
    will-change: transform;
}

.mobile-stick::after {
    content: "";
    position: absolute;
    inset: 26px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.mobile-stick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #0b151c;
    background: rgba(226, 240, 248, 0.92);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.35);
    font-size: 23px;
    font-weight: 900;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

.mobile-stick-active {
    border-color: rgba(103, 214, 255, 0.58);
    background: rgba(11, 19, 27, 0.78);
}

.aim-stick {
    justify-self: end;
    border-color: rgba(255, 161, 91, 0.38);
}

.aim-stick .mobile-stick-knob {
    color: #371407;
    background: rgba(255, 171, 96, 0.95);
}

#game-shell:not(.combat-enabled) .aim-stick {
    opacity: 0.42;
    filter: grayscale(0.7);
}

.mobile-action-cluster {
    display: grid;
    grid-template-columns: repeat(2, 48px);
    gap: 9px 7px;
    align-self: center;
    justify-content: center;
    pointer-events: auto;
}

.mobile-action-cluster button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.23);
    border-radius: 50%;
    color: #f5f8fb;
    background: rgba(12, 21, 29, 0.82);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.32);
    font-size: 16px;
    font-weight: 900;
    touch-action: manipulation;
}

#mobileRollButton {
    border-color: rgba(103, 214, 255, 0.48);
    color: #07161c;
    background: rgba(103, 214, 255, 0.92);
    box-shadow: 0 8px 22px rgba(103, 214, 255, 0.22);
    font-size: 20px;
}

#mobilePauseButton {
    border-color: rgba(255, 209, 102, 0.48);
    color: #1f1808;
    background: rgba(255, 209, 102, 0.92);
}

#game-shell.mobile-assist #mobileControls {
    min-height: 222px;
}

.mobile-action-cluster button:active {
    color: #07161c;
    background: var(--accent);
    transform: scale(0.94);
}

.weapon-quick-panel {
    position: absolute;
    left: 50%;
    bottom: calc(var(--mobile-bottom-inset) + 116px);
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(5, 44px);
    gap: 6px;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 8px;
    border: 1px solid rgba(126, 221, 177, 0.32);
    border-radius: 12px;
    background: rgba(10, 18, 26, 0.9);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(10px);
    transform: translateX(-50%);
    pointer-events: auto;
}

.weapon-quick-panel.hidden {
    display: none;
}

.weapon-quick-button {
    display: grid;
    grid-template-rows: 12px 18px 10px 7px;
    align-items: center;
    justify-items: center;
    width: 44px;
    height: 48px;
    padding: 4px 3px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: #ecf7fb;
    background: rgba(22, 35, 47, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
    font: inherit;
    text-align: center;
    touch-action: manipulation;
}

.weapon-quick-button strong {
    font-size: 12px;
    line-height: 1;
}

.weapon-quick-icon {
    width: 26px;
    height: 18px;
}

.weapon-quick-button span {
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weapon-quick-button em {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.weapon-quick-button.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(38, 75, 65, 0.94);
}

.weapon-quick-button.locked {
    opacity: 0.45;
    filter: grayscale(0.75);
}

@media (max-width: 760px),
(hover: none) and (pointer: coarse) {
    :root {
        /* Android Chrome can report a zero safe-area inset above the system navigation bar. */
        --mobile-bottom-inset: max(32px, env(safe-area-inset-bottom, 0px));
    }

    #game-shell {
        min-height: 0;
    }

    #hud {
        top: max(8px, env(safe-area-inset-top, 0px));
        left: max(8px, env(safe-area-inset-left, 0px));
        width: min(520px, calc(100vw - max(16px, calc(env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px)))));
    }

    #mobileControls {
        display: grid;
        grid-template-columns: clamp(92px, 28vw, 124px) clamp(92px, 22vw, 108px) clamp(92px, 28vw, 124px);
        width: min(100%, 720px);
        min-height: clamp(138px, 28vh, 208px);
    }

    .mobile-stick {
        width: clamp(96px, 27vw, 124px);
        height: clamp(96px, 27vw, 124px);
    }

    .mobile-stick-knob {
        width: clamp(50px, 13vw, 60px);
        height: clamp(50px, 13vw, 60px);
        margin: calc(clamp(50px, 13vw, 60px) / -2) 0 0 calc(clamp(50px, 13vw, 60px) / -2);
    }

    .mobile-action-cluster {
        grid-template-columns: repeat(2, clamp(42px, 11vw, 48px));
        gap: clamp(6px, 1.8vw, 9px);
    }

    .mobile-action-cluster button {
        width: clamp(42px, 11vw, 48px);
        height: clamp(42px, 11vw, 48px);
        grid-template-rows: 1fr auto;
        padding: 4px 2px 3px;
        line-height: 1;
    }

    .mobile-action-cluster button::after {
        color: rgba(255, 255, 255, 0.78);
        font-size: 7px;
        font-weight: 800;
        letter-spacing: -0.02em;
        line-height: 1;
    }

    #mobileInventoryButton::after {
        content: "вещи";
    }

    #mobileInteractButton::after {
        content: "действие";
    }

    #mobileWeaponButton::after {
        content: "оружие";
    }

    #mobilePauseButton::after {
        content: "пауза";
        color: rgba(31, 24, 8, 0.75);
    }

    #mobileRollButton::after {
        content: "рывок";
        color: rgba(7, 22, 28, 0.76);
    }

    #mobileReloadButton::after {
        content: "заряд";
    }

    .weapon-quick-panel {
        grid-template-columns: repeat(5, minmax(38px, 1fr));
        width: min(292px, calc(100vw - 24px));
    }

    .weapon-quick-button {
        width: 100%;
        min-width: 0;
        min-height: 52px;
    }

    button,
    [role="button"] {
        -webkit-tap-highlight-color: transparent;
    }

    .modal-card input,
    .modal-card select,
    .modal-card textarea {
        min-height: 44px;
        font-size: 16px;
    }

    .modal-card .primary-button,
    .modal-card .secondary-button,
    .modal-card .action-button,
    .modal-card .buy-button,
    .modal-card .use-button,
    .modal-card .cyber-action,
    .multiplayer-party-actions button {
        min-height: 44px;
    }

    #helpPanel {
        display: none;
    }

    .combat-control.combat-active {
        top: 112px;
        right: 8px;
        min-width: 176px;
        transform: none;
    }

    .combat-control:not(.combat-active) {
        top: 112px;
        right: 8px;
        width: min(230px, calc(100vw - 16px));
        transform: none;
    }

    .world-event-badge {
        top: 154px;
    }

    .mission-tracker {
        left: 8px;
        top: 118px;
        width: min(360px, calc(100vw - 16px));
        gap: 5px;
        padding: 6px 8px;
        transform: none;
    }

    .mission-tracker-title {
        gap: 7px;
    }

    .mission-tracker-title strong {
        font-size: 11px;
    }

    .mission-tracker-title span {
        font-size: 10px;
    }

    .mission-tracker-stats {
        gap: 4px;
    }

    .mission-tracker-objectives {
        display: none;
    }

    .mission-tracker-pill {
        padding: 3px 5px;
        font-size: 8px;
    }
}

@media (max-width: 920px) {
    #miniMapPanel {
        width: 225px;
    }

    .mission-tracker {
        right: 247px;
        max-width: 360px;
    }

    #helpPanel {
        display: none;
    }

    .onboarding-panel {
        right: 8px;
        bottom: 14px;
        width: min(320px, calc(100vw - 16px));
    }

    #eventPanel {
        width: min(360px, calc(100vw - 28px));
    }
}

/* VK embeds the desktop game in a medium-width iframe. Keep the combat card
   out of the top-right minimap at those viewport sizes. */
@media (min-width: 681px) and (max-width: 1100px) {

    .combat-control,
    .combat-control.combat-active {
        top: auto;
        right: 14px;
        bottom: 14px;
        transform: none;
    }
}

@media (max-width: 680px) {
    #hud {
        width: calc(100vw - 28px);
    }

    .role-progress-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .role-faction-row {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .role-relation-pill {
        width: max-content;
    }

    .identity-card {
        padding-right: 10px;
    }

    .stats-card {
        padding: 9px 11px;
    }

    #miniMapPanel {
        top: auto;
        right: 10px;
        bottom: 184px;
        width: 150px;
        padding: 8px;
    }

    #miniMapPanel .panel-title-row,
    .map-legend {
        display: none;
    }

    #miniMap {
        margin-top: 0;
    }

    #eventPanel {
        left: 10px;
        bottom: 184px;
        width: calc(100vw - 180px);
        min-width: 150px;
        padding: 9px 10px;
    }

    #eventLog {
        max-height: 72px;
        font-size: 10px;
    }

    #interactionPrompt {
        bottom: calc(var(--mobile-bottom-inset) + clamp(214px, 34vh, 268px));
        max-width: min(360px, calc(100vw - 28px));
        padding: 8px 11px;
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .onboarding-panel {
        left: 10px;
        right: auto;
        bottom: calc(var(--mobile-bottom-inset) + 400px);
        width: min(330px, calc(100vw - 20px));
        padding: 9px 10px;
        max-height: min(190px, calc(100dvh - var(--mobile-bottom-inset) - 150px));
        overflow-y: auto;
    }

    .onboarding-steps {
        display: none;
    }

    .onboarding-panel-head,
    .onboarding-reward {
        display: none;
    }

    .onboarding-modal-steps {
        grid-template-columns: 1fr;
    }

    .onboarding-card .modal-title-row {
        display: grid;
    }

    .onboarding-card.modal-wide {
        position: fixed;
        left: 12px;
        right: auto;
        top: 40px;
        width: min(342px, calc(100vw - 24px)) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 80px);
        transform: none;
        overflow-x: hidden;
    }

    .onboarding-card * {
        min-width: 0;
        max-width: 100%;
    }

    .onboarding-card .wallet-badge,
    .onboarding-card .modal-subtitle,
    .onboarding-modal-step span {
        overflow-wrap: anywhere;
        white-space: normal;
    }

    .mission-tracker {
        left: 8px;
        top: 124px;
        width: calc(100vw - 16px);
    }

    .mission-tracker-title strong {
        font-size: 12px;
    }

    .mission-tracker-pill,
    .mission-objective-pill {
        padding: 3px 5px;
        font-size: 8px;
    }

    .modal {
        padding: 8px;
    }

    .modal-card {
        width: min(100%, calc(100vw - 16px));
        max-height: calc(100dvh - 16px);
        min-width: 0;
        padding: max(20px, env(safe-area-inset-top, 0px)) max(15px, env(safe-area-inset-right, 0px)) max(15px, env(safe-area-inset-bottom, 0px)) max(15px, env(safe-area-inset-left, 0px));
        border-radius: 16px;
        overscroll-behavior: contain;
        scroll-padding-block: 58px max(24px, env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
    }

    .modal-close {
        top: 8px;
        right: 8px;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.13);
    }

    .modal-title-row {
        padding-right: 38px;
    }

    .modal h2 {
        font-size: clamp(22px, 7vw, 30px);
        line-height: 1.08;
        overflow-wrap: anywhere;
    }

    .online-create-field,
    .online-stake-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .mission-online-toolbar,
    .mission-online-actions,
    .multiplayer-party-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .mission-online-toolbar>button,
    .mission-online-actions>button,
    .online-game-card>button {
        width: 100%;
    }

    .modal-card.modal-wide {
        width: min(100%, calc(100vw - 16px));
    }

    .pause-menu-card {
        padding-bottom: max(15px, env(safe-area-inset-bottom, 0px));
    }

    .pause-settings {
        gap: 8px;
        margin: 16px 0 12px;
    }

    .gamepad-settings {
        gap: 8px;
        padding: 10px;
    }

    .setting-range {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .gamepad-bindings {
        grid-template-columns: 1fr;
    }

    .modal-title-row {
        align-items: flex-start;
    }

    .modal-title-row>* {
        min-width: 0;
    }

    .role-progress-overview,
    .role-progress-columns {
        grid-template-columns: 1fr;
    }

    .product-grid,
    .mission-choice-grid,
    .arsenal-list,
    .weapon-slots-list,
    .weapon-evolution-choices {
        grid-template-columns: 1fr;
    }

    .weapon-evolution-choice {
        min-height: 112px;
    }

    .mission-result-actions {
        grid-template-columns: 1fr;
    }

}

@media (max-height: 650px) {
    #eventPanel {
        width: min(300px, calc(100vw - 150px));
        padding: 8px 10px;
    }

    #miniMapPanel {
        width: 210px;
    }

    #miniMapPanel .map-legend {
        display: none;
    }
}

/* Mission UI layout -------------------------------------------------------
   Mission overlays share one grid so their space is negotiated instead of
   being guessed with unrelated top/bottom offsets.  Outside missions this
   layer is only a containing block and preserves the regular city layout. */
.game-ui-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.game-ui-layer>#miniMapPanel,
.game-ui-layer>#onboardingPanel {
    pointer-events: auto;
}

#game-shell.mobile-assist {
    --mobile-controls-reserve: 222px;
}

#game-shell.mobile-assist #mobileControls {
    min-height: var(--mobile-controls-reserve);
}

#game-shell.mission-active .game-ui-layer {
    --mission-ui-gap: 10px;
    display: grid;
    gap: var(--mission-ui-gap);
}

#game-shell.mission-active .game-ui-layer>#hud,
#game-shell.mission-active .game-ui-layer>#eventPanel,
#game-shell.mission-active .game-ui-layer>#miniMapPanel,
#game-shell.mission-active .game-ui-layer>#worldEventBadge,
#game-shell.mission-active .game-ui-layer>#missionTracker,
#game-shell.mission-active .game-ui-layer>#onboardingPanel,
#game-shell.mission-active .game-ui-layer>#interactionPrompt,
#game-shell.mission-active .game-ui-layer>#toast {
    position: static;
    inset: auto;
    min-width: 0;
    max-width: none;
    transform: none;
}

#game-shell.mission-active .game-ui-layer>#hud {
    grid-area: hud;
    width: auto;
    max-height: none;
    transform: none;
}

#game-shell.mission-active .game-ui-layer>#missionTracker {
    grid-area: tracker;
    align-self: start;
    width: auto;
    pointer-events: auto;
}

#game-shell.mission-active .game-ui-layer>#miniMapPanel {
    grid-area: map;
    align-self: start;
    width: auto;
}

#game-shell.mission-active .game-ui-layer>#eventPanel {
    grid-area: events;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    width: auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
    pointer-events: auto;
}

#game-shell.mission-active #eventLog {
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

#game-shell.mission-active .game-ui-layer>#worldEventBadge {
    grid-area: world-event;
    align-self: start;
    justify-self: center;
    width: fit-content;
    max-width: 100%;
}

#game-shell.mission-active.mobile-assist .game-ui-layer>#onboardingPanel {
    max-height: 100px !important;
}

#game-shell.mission-active .game-ui-layer>#onboardingPanel {
    /* grid-area: onboarding; */
    align-self: end;
    justify-self: stretch;
    width: auto;
    max-height: min(230px, 32dvh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#game-shell.mission-active .game-ui-layer>#interactionPrompt {
    grid-area: prompt;
    align-self: end;
    justify-self: center;
    width: fit-content;
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

#game-shell.mission-active .game-ui-layer>#toast {
    grid-area: toast;
    align-self: start;
    justify-self: center;
    width: fit-content;
    max-width: 100%;
}

#game-shell.mission-active .game-ui-layer>#toast:not(.visible),
#game-shell.mission-active .game-ui-layer>#interactionPrompt:not(.visible) {
    display: none;
}

#game-shell.mission-active .game-ui-layer>#toast.visible,
#game-shell.mission-active .game-ui-layer>#interactionPrompt.visible {
    opacity: 1;
    transform: none;
}

#game-shell.mission-active .mission-tracker-objectives {
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
}

/* Desktop missions: HUD, tracker, notices, map and journal each occupy a
   dedicated cell.  Short desktop windows keep both side columns scrollable. */
#game-shell.mission-active:not(.mobile-assist) .game-ui-layer {
    grid-template-columns: minmax(260px, 360px) minmax(220px, 1fr) minmax(190px, 280px);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
    grid-template-areas:
        "hud toast map"
        "hud tracker map"
        "hud world-event map"
        "hud . map"
        "hud onboarding map"
        "events prompt .";
    padding: 14px;
}

#game-shell.mission-active:not(.mobile-assist) .game-ui-layer>#hud {
    align-self: stretch;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    pointer-events: auto;
    touch-action: pan-y;
}

#game-shell.mission-active:not(.mobile-assist) .game-ui-layer>#eventPanel {
    max-height: min(180px, 30dvh);
}

#game-shell.mission-active:not(.mobile-assist) .game-ui-layer>#miniMapPanel {
    align-self: start;
}

#game-shell.mission-active:not(.mobile-assist) #helpPanel {
    max-height: min(180px, 30dvh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

/* In compact desktop mode the mission grid must not stretch the two remaining
   HUD cards across the full map height. Hidden mission panels also leave the
   grid entirely so they cannot reserve empty rows. */
#game-shell.mission-active:not(.mobile-assist).interface-compact:not(.mission-ui-expanded) .game-ui-layer {
    grid-template-columns: minmax(260px, 292px) minmax(220px, 1fr) minmax(190px, 280px);
}

#game-shell.mission-active:not(.mobile-assist).interface-compact:not(.mission-ui-expanded) .game-ui-layer>#hud {
    align-self: start;
    align-content: start;
    height: auto;
    overflow: visible;
}

#game-shell.mission-active:not(.mobile-assist).interface-compact:not(.mission-ui-expanded) .game-ui-layer>#missionTracker,
#game-shell.mission-active:not(.mobile-assist).interface-compact:not(.mission-ui-expanded) .game-ui-layer>#worldEventBadge,
#game-shell.mission-active:not(.mobile-assist).interface-compact:not(.mission-ui-expanded) .game-ui-layer>#interactionPrompt,
#game-shell.mission-active:not(.mobile-assist).interface-compact:not(.mission-ui-expanded) .game-ui-layer>#toast {
    display: none;
}

/* Touch missions use the same reserve for the dock and for every panel above
   it.  This removes the former 222px-vs-122px mismatch. */
#game-shell.mission-active.mobile-assist .game-ui-layer {
    padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) calc(var(--mobile-controls-reserve) + var(--mission-ui-gap)) max(8px, env(safe-area-inset-left, 0px));
}

/* Input capability is the source of truth for touch controls.  This also
   covers hybrid tablets whose CSS pointer media query reports a mouse. */
#game-shell.mission-active.mobile-assist #mobileControls {
    display: grid;
    width: min(100%, 860px);
}

#game-shell.mission-active.mobile-assist .mobile-hud-toggle {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    z-index: 20;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--text);
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    font-size: 25px;
    line-height: 1;
    pointer-events: auto;
    touch-action: manipulation;
}

#game-shell.mission-active.mobile-assist #hud>.cyber-systems-button {
    position: fixed;
    top: max(72px, calc(env(safe-area-inset-top, 0px) + 58px));
    right: max(14px, env(safe-area-inset-right, 0px));
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    width: 68px;
    height: 48px;
    min-height: 48px;
    padding: 0 7px;
    border-radius: 14px;
    text-align: center;
    pointer-events: auto;
    touch-action: manipulation;
}

#game-shell.mission-active.mobile-assist #hud>.cyber-systems-button .cyber-button-icon,
#game-shell.mission-active.mobile-assist #hud>.cyber-systems-button .cyber-button-label,
#game-shell.mission-active.mobile-assist #hud>.cyber-systems-button strong {
    display: none;
}

#game-shell.mission-active.mobile-assist #hud>.cyber-systems-button .cyber-button-short {
    display: block;
    font-size: 11px;
    font-weight: 900;
}

#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) #hud>.identity-card,
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) #hud>.role-progress-card,
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) #hud>.primary-button,
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) #hud>.secondary-button,
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .stats-card .stat-row:nth-child(n + 2),
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .stats-card .money-row,
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .combat-card .wanted-row,
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .combat-card .reload-track,
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .combat-card .sync-row {
    display: none;
}

#game-shell.mission-active.mobile-assist.mobile-hud-expanded #hud>.identity-card {
    display: flex;
    order: -3;
    margin-right: 0;
}

#game-shell.mission-active.mobile-assist.mobile-hud-expanded #hud>.role-progress-card {
    display: grid;
    margin-right: 0;
}

#game-shell.mission-active.mobile-assist.mobile-hud-expanded #hud>.primary-button,
#game-shell.mission-active.mobile-assist.mobile-hud-expanded #hud>.iren-menu-button,
#game-shell.mission-active.mobile-assist.mobile-hud-expanded #hud>.auth-button,
#game-shell.mission-active.mobile-assist.mobile-hud-expanded #hud>.profile-button:not([hidden]) {
    display: block;
    margin-right: 0;
}

#game-shell.mission-active.mobile-assist.mobile-hud-expanded .stats-card .stat-row {
    display: grid;
}

#game-shell.mission-active.mobile-assist.mobile-hud-expanded .stats-card .money-row,
#game-shell.mission-active.mobile-assist.mobile-hud-expanded .combat-card .wanted-row,
#game-shell.mission-active.mobile-assist.mobile-hud-expanded .combat-card .sync-row {
    display: flex;
}

#game-shell.mission-active.mobile-assist.mobile-hud-expanded .combat-card .reload-track {
    display: block;
}

#game-shell.mission-active.mobile-assist.mobile-hud-expanded .game-ui-layer>#hud {
    pointer-events: auto;
    touch-action: pan-y;
}

#game-shell.mission-active.mobile-assist #helpPanel {
    display: none;
}

#game-shell.mission-active.mobile-assist .game-ui-layer>#hud {
    left: auto;
    top: auto;
    pointer-events: auto;
    touch-action: pan-y;
}

#game-shell.mission-active.mobile-assist .game-ui-layer>#miniMapPanel {
    right: auto;
    bottom: auto;
    padding: 8px;
}

#game-shell.mission-active.mobile-assist #miniMapPanel .panel-title-row {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 7px;
}

#game-shell.mission-active.mobile-assist #miniMapPanel h2 {
    font-size: 10px;
}

#game-shell.mission-active.mobile-assist #cityClock {
    font-size: 8px;
}

#game-shell.mission-active.mobile-assist #miniMap {
    margin-top: 5px;
}

#game-shell.mission-active.mobile-assist .mini-map-pause-button {
    min-height: 36px;
    margin-top: 5px;
    padding: 6px 4px;
    font-size: 10px;
}

#game-shell.mission-active.mobile-assist .mission-tracker-objectives {
    display: flex;
    flex-wrap: nowrap;
    padding-bottom: 2px;
}

#game-shell.mission-active.mobile-assist .mission-objective-pill {
    flex: 0 0 auto;
}

#game-shell.mission-active.mobile-assist .onboarding-steps {
    display: grid;
}

#game-shell.mission-active.mobile-assist .game-ui-layer>#toast {
    justify-self: start;
    max-width: calc(100% - 82px);
}

#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .stats-card,
#game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .combat-card {
    width: calc(100% - 78px);
    margin-right: 78px;
}

@media (orientation: portrait) {
    #game-shell.mission-active.mobile-assist .game-ui-layer {
        --mission-map-width: clamp(150px, 29vw, 225px);
        grid-template-columns: minmax(0, 1fr) var(--mission-map-width);
        grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto auto;
        grid-template-areas:
            "toast toast"
            "hud hud"
            "tracker tracker"
            "world-event world-event"
            ". ."
            "onboarding onboarding"
            "prompt prompt"
            "events map";
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#eventPanel,
    #game-shell.mission-active.mobile-assist .game-ui-layer>#miniMapPanel {
        align-self: end;
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded .game-ui-layer {
        grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
        grid-template-areas:
            "toast toast"
            "tracker tracker"
            "world-event world-event"
            "hud map"
            "hud events"
            "onboarding onboarding"
            "prompt prompt";
        padding-top: max(128px, calc(env(safe-area-inset-top, 0px) + 116px));
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded .game-ui-layer>#hud {
        align-self: stretch;
        width: auto;
        height: 100%;
        min-height: 0;
        max-height: none;
        margin: 0;
        padding: 0 4px 4px 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded .game-ui-layer>#miniMapPanel {
        align-self: start;
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded .game-ui-layer>#eventPanel {
        align-self: stretch;
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded #eventLog {
        max-height: none;
    }
}

@media (orientation: portrait) and (max-height: 720px) {
    #game-shell.mission-active.mobile-assist {
        --mobile-controls-reserve: max(190px, calc(136px + var(--mobile-bottom-inset)));
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer {
        --mission-ui-gap: 4px;
        --mission-map-width: clamp(108px, 30vw, 120px);
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded .game-ui-layer {
        padding-top: max(72px, calc(env(safe-area-inset-top, 0px) + 58px));
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded .mobile-hud-toggle {
        top: max(14px, env(safe-area-inset-top, 0px));
        right: max(14px, env(safe-area-inset-right, 0px));
        width: 44px;
        height: 44px;
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded #hud>.cyber-systems-button {
        top: max(14px, env(safe-area-inset-top, 0px));
        right: calc(max(14px, env(safe-area-inset-right, 0px)) + 52px);
        width: 44px;
        height: 44px;
        min-height: 44px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker {
        grid-template-columns: minmax(84px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr);
        align-items: center;
        gap: 4px;
        padding: 4px 6px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-title,
    #game-shell.mission-active.mobile-assist .mission-tracker-stats,
    #game-shell.mission-active.mobile-assist .mission-tracker-objectives {
        min-width: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-title {
        gap: 4px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-title strong,
    #game-shell.mission-active.mobile-assist .mission-tracker-title span {
        font-size: 8px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-pill,
    #game-shell.mission-active.mobile-assist .mission-objective-pill {
        padding: 2px 4px;
        font-size: 7px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#worldEventBadge,
    #game-shell.mission-active.mobile-assist .game-ui-layer>#toast,
    #game-shell.mission-active.mobile-assist .game-ui-layer>#interactionPrompt {
        padding: 4px 7px;
        font-size: 9px;
        line-height: 1.15;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#onboardingPanel {
        max-height: 32px;
        gap: 4px;
        padding: 4px 6px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#eventPanel {
        align-self: stretch;
        padding: 4px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#miniMapPanel {
        align-self: end;
        padding: 4px;
    }

    #game-shell.mission-active.mobile-assist #eventPanel h2 {
        font-size: 9px;
    }

    #game-shell.mission-active.mobile-assist #eventLog {
        flex: 1 1 auto;
        max-height: none;
        margin-top: 3px;
        padding-left: 15px;
        font-size: 8px;
        line-height: 1.2;
    }

    #game-shell.mission-active.mobile-assist #miniMapPanel h2 {
        font-size: 8px;
    }

    #game-shell.mission-active.mobile-assist #cityClock {
        font-size: 7px;
    }

    #game-shell.mission-active.mobile-assist #miniMap {
        margin-top: 3px;
    }

    #game-shell.mission-active.mobile-assist .mini-map-pause-button {
        min-height: 26px;
        margin-top: 3px;
        padding: 3px 2px;
        font-size: 8px;
    }
}

@media (orientation: landscape) {
    #game-shell.mission-active.mobile-assist {
        --mobile-controls-reserve: 132px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer {
        --mission-map-width: clamp(104px, 14vw, 190px);
        grid-template-columns: clamp(230px, 34vw, 290px) minmax(0, 1fr) var(--mission-map-width);
        grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto;
        grid-template-areas:
            "hud toast tools"
            "hud tracker tools"
            "hud world-event tools"
            "hud . tools"
            "hud onboarding tools"
            "hud prompt tools"
            "hud events map";
        padding-top: max(8px, env(safe-area-inset-top, 0px));
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#hud {
        align-self: start;
        width: auto;
        min-height: 0;
        max-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded .game-ui-layer>#hud {
        align-self: stretch;
        width: auto;
        height: 100%;
        max-height: none;
        margin: 0;
        padding: 0 4px 0 0;
    }

    #game-shell.mission-active.mobile-assist.mobile-hud-expanded #eventLog {
        max-height: none;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#eventPanel,
    #game-shell.mission-active.mobile-assist .game-ui-layer>#miniMapPanel {
        align-self: end;
        padding: 6px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#onboardingPanel {
        max-height: 92px;
        padding: 7px 9px;
    }

    #game-shell.mission-active.mobile-assist #miniMapPanel .panel-title-row {
        display: grid;
        gap: 1px;
    }

    #game-shell.mission-active.mobile-assist #miniMapPanel h2 {
        font-size: 8px;
    }

    #game-shell.mission-active.mobile-assist #cityClock {
        font-size: 7px;
    }

    #game-shell.mission-active.mobile-assist .mini-map-pause-button {
        min-height: 30px;
        margin-top: 4px;
        padding: 4px 2px;
        font-size: 8px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker {
        gap: 4px;
        padding: 6px 8px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-stats,
    #game-shell.mission-active.mobile-assist .mission-tracker-objectives {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-pill,
    #game-shell.mission-active.mobile-assist .mission-objective-pill {
        flex: 0 0 auto;
        padding: 3px 5px;
        font-size: 8px;
    }

    #game-shell.mission-active.mobile-assist .stat-row {
        grid-template-columns: 62px minmax(44px, 1fr) 56px;
        gap: 5px;
        font-size: 10px;
    }

    #game-shell.mission-active.mobile-assist #mobileControls {
        grid-template-columns: 92px minmax(282px, 1fr) 92px;
        min-height: var(--mobile-controls-reserve);
        padding-top: 4px;
    }

    #game-shell.mission-active.mobile-assist .mobile-stick {
        width: 92px;
        height: 92px;
    }

    #game-shell.mission-active.mobile-assist .mobile-stick-knob {
        width: 44px;
        height: 44px;
        margin: -22px 0 0 -22px;
    }

    #game-shell.mission-active.mobile-assist .mobile-action-cluster {
        grid-template-columns: repeat(6, 42px);
        gap: 6px;
        align-self: end;
    }

    #game-shell.mission-active.mobile-assist .mobile-action-cluster button {
        width: 42px;
        height: 42px;
    }

    #game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .stats-card,
    #game-shell.mission-active.mobile-assist:not(.mobile-hud-expanded) .combat-card {
        width: 100%;
        margin-right: 0;
    }
}

@media (max-width: 680px) and (max-height: 650px) {
    #mobileControls {
        grid-template-columns: 98px 96px 98px;
        min-height: 132px;
        padding-bottom: var(--mobile-bottom-inset);
    }

    .mobile-stick {
        width: clamp(82px, 24vw, 98px);
        height: clamp(82px, 24vw, 98px);
    }

    .mobile-stick-knob {
        width: clamp(42px, 12vw, 50px);
        height: clamp(42px, 12vw, 50px);
        margin: calc(clamp(42px, 12vw, 50px) / -2) 0 0 calc(clamp(42px, 12vw, 50px) / -2);
    }

    #miniMapPanel {
        bottom: 140px;
        width: 112px;
    }

    #eventPanel {
        bottom: 140px;
        width: min(280px, calc(100vw - 142px));
        min-width: 0;
    }

    #interactionPrompt {
        bottom: calc(var(--mobile-bottom-inset) + 138px);
        max-width: min(300px, calc(100vw - 24px));
    }

    .onboarding-panel {
        bottom: calc(var(--mobile-bottom-inset) + 104px);
        width: calc(100vw - 20px);
    }

    #onboardingDescription,
    .onboarding-reward {
        display: none;
    }
}

@media (min-width: 681px) and (max-width: 1100px) and (hover: none),
(min-width: 681px) and (max-width: 1100px) and (pointer: coarse) {
    #hud {
        width: min(520px, calc(100vw - 32px));
    }

    #mobileControls {
        display: grid;
        width: min(100%, 860px);
        min-height: 190px;
    }

    #miniMapPanel {
        bottom: auto;
    }

    #eventPanel {
        bottom: 198px;
    }

    #interactionPrompt {
        bottom: 216px;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    #hud {
        gap: 6px;
        transform: scale(0.92);
        transform-origin: top left;
    }

    #mobileControls {
        grid-template-columns: 86px 180px 86px;
        min-height: 112px;
    }

    .mobile-stick {
        width: 86px;
        height: 86px;
    }

    .mobile-stick-knob {
        width: 42px;
        height: 42px;
        margin: -21px 0 0 -21px;
    }

    .mobile-action-cluster {
        grid-template-columns: repeat(6, 44px);
        align-self: end;
    }

    .mobile-action-cluster button {
        width: 44px;
        height: 44px;
        font-size: 13px;
    }

    #miniMapPanel {
        top: auto;
        right: 8px;
        bottom: 122px;
        width: 104px;
        padding: 7px;
    }

    #eventPanel {
        left: 8px;
        bottom: 122px;
        width: min(260px, calc(100vw - 128px));
        min-width: 0;
        padding: 7px 9px;
    }

    #eventLog {
        max-height: 54px;
        margin-top: 5px;
        font-size: 9px;
    }

    #interactionPrompt {
        bottom: calc(var(--mobile-bottom-inset) + 122px);
        max-width: min(380px, calc(100vw - 220px));
    }

    .modal {
        padding: 6px;
        align-items: start;
    }

    .pause-menu-card {
        width: min(430px, calc(100vw - 12px));
        max-height: calc(100dvh - 12px);
        padding: 16px 14px 12px;
        border-radius: 14px;
    }

    .pause-menu-card h2 {
        margin: 3px 0 10px;
        font-size: 24px;
    }

    .pause-settings {
        margin: 10px 0 9px;
    }

    .gamepad-settings {
        gap: 6px;
        margin-bottom: 10px;
        padding: 8px;
    }

    .gamepad-settings__hint {
        display: none;
    }

    .gamepad-bindings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }

    /* Short phones still keep every mission panel on screen.  The tracker is
       flattened into one scrollable row and the controls reserve shrinks in
       lockstep with the actual dock instead of clipping the last grid rows. */
    #game-shell.mission-active.mobile-assist {
        --mobile-controls-reserve: calc(89px + var(--mobile-bottom-inset));
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer {
        --mission-ui-gap: 4px;
        --mission-map-width: 96px;
        grid-template-columns: clamp(190px, 30vw, 245px) minmax(0, 1fr) clamp(112px, 18vw, 160px) var(--mission-map-width);
        grid-template-rows: minmax(44px, auto) auto minmax(0, 1fr) auto auto;
        grid-template-areas:
            "hud toast world-event tools"
            "hud tracker events map"
            "hud . events map"
            "hud onboarding events map"
            "hud prompt events map";
        padding: 4px 4px calc(var(--mobile-controls-reserve) + var(--mission-ui-gap));
    }

    #game-shell.mission-active.mobile-assist .mission-tracker {
        grid-template-columns: minmax(84px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr);
        align-items: center;
        gap: 4px;
        padding: 4px 6px;
    }

    #game-shell.mission-active.mobile-assist .mobile-hud-toggle {
        top: max(4px, env(safe-area-inset-top, 0px));
        right: max(4px, env(safe-area-inset-right, 0px));
        width: 44px;
        height: 44px;
    }

    #game-shell.mission-active.mobile-assist #hud>.cyber-systems-button {
        top: max(4px, env(safe-area-inset-top, 0px));
        right: calc(max(4px, env(safe-area-inset-right, 0px)) + 48px);
        width: 44px;
        height: 44px;
        min-height: 44px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-title,
    #game-shell.mission-active.mobile-assist .mission-tracker-stats,
    #game-shell.mission-active.mobile-assist .mission-tracker-objectives {
        min-width: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-title {
        gap: 4px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-title strong,
    #game-shell.mission-active.mobile-assist .mission-tracker-title span {
        font-size: 8px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker-pill,
    #game-shell.mission-active.mobile-assist .mission-objective-pill {
        padding: 2px 4px;
        font-size: 7px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#worldEventBadge,
    #game-shell.mission-active.mobile-assist .game-ui-layer>#toast,
    #game-shell.mission-active.mobile-assist .game-ui-layer>#interactionPrompt {
        padding: 4px 7px;
        font-size: 9px;
        line-height: 1.15;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#onboardingPanel {
        max-height: 32px;
        gap: 4px;
        padding: 4px 6px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#eventPanel {
        align-self: stretch;
        padding: 4px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#miniMapPanel {
        align-self: end;
        padding: 4px;
    }

    #game-shell.mission-active.mobile-assist #eventPanel h2 {
        font-size: 9px;
    }

    #game-shell.mission-active.mobile-assist #eventLog {
        flex: 1 1 auto;
        max-height: none;
        margin-top: 3px;
        padding-left: 15px;
        font-size: 8px;
        line-height: 1.2;
    }

    #game-shell.mission-active.mobile-assist #miniMapPanel h2 {
        font-size: 7px;
    }

    #game-shell.mission-active.mobile-assist #cityClock {
        font-size: 6px;
    }

    #game-shell.mission-active.mobile-assist #miniMap {
        margin-top: 2px;
    }

    #game-shell.mission-active.mobile-assist .mini-map-pause-button {
        min-height: 22px;
        margin-top: 3px;
        padding: 2px;
        font-size: 7px;
    }

    #game-shell.mission-active.mobile-assist #mobileControls {
        grid-template-columns: 86px minmax(258px, 1fr) 86px;
        min-height: var(--mobile-controls-reserve);
        padding-top: 3px;
    }

    #game-shell.mission-active.mobile-assist .mobile-stick {
        width: 86px;
        height: 86px;
    }

    #game-shell.mission-active.mobile-assist .mobile-action-cluster {
        grid-template-columns: repeat(6, 38px);
        gap: 5px;
    }

    #game-shell.mission-active.mobile-assist .mobile-action-cluster button {
        width: 38px;
        height: 38px;
        font-size: 11px;
    }

}

@media (max-height: 360px) and (orientation: landscape) {
    #game-shell.mission-active.mobile-assist {
        --mobile-controls-reserve: calc(77px + var(--mobile-bottom-inset));
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer {
        --mission-ui-gap: 2px;
        --mission-map-width: 80px;
        grid-template-columns: clamp(176px, 28vw, 210px) minmax(0, 1fr) clamp(96px, 17vw, 132px) var(--mission-map-width);
        grid-template-rows: minmax(36px, auto) auto minmax(0, 1fr) auto auto;
        padding: 2px 3px calc(var(--mobile-controls-reserve) + var(--mission-ui-gap));
    }

    #game-shell.mission-active.mobile-assist .mobile-hud-toggle {
        top: max(2px, env(safe-area-inset-top, 0px));
        right: max(2px, env(safe-area-inset-right, 0px));
        width: 36px;
        height: 36px;
    }

    #game-shell.mission-active.mobile-assist #hud>.cyber-systems-button {
        top: max(2px, env(safe-area-inset-top, 0px));
        right: calc(max(2px, env(safe-area-inset-right, 0px)) + 40px);
        width: 36px;
        height: 36px;
        min-height: 36px;
    }

    #game-shell.mission-active.mobile-assist .mission-tracker {
        padding-block: 2px;
    }

    #game-shell.mission-active.mobile-assist .game-ui-layer>#onboardingPanel {
        max-height: 30px;
        padding-block: 2px;
    }

    #game-shell.mission-active.mobile-assist #mobileControls {
        grid-template-columns: 74px minmax(228px, 1fr) 74px;
        min-height: var(--mobile-controls-reserve);
    }

    #game-shell.mission-active.mobile-assist .mobile-stick {
        width: 74px;
        height: 74px;
    }

    #game-shell.mission-active.mobile-assist .mobile-stick-knob {
        width: 38px;
        height: 38px;
        margin: -19px 0 0 -19px;
    }

    #game-shell.mission-active.mobile-assist .mobile-action-cluster {
        grid-template-columns: repeat(6, 34px);
        gap: 4px;
    }

    #game-shell.mission-active.mobile-assist .mobile-action-cluster button {
        width: 34px;
        height: 34px;
        font-size: 10px;
    }
}

.mobile-hud-toggle {
    display: none;
}

@media (max-width: 760px),
(hover: none) and (pointer: coarse) {
    .mobile-hud-toggle {
        position: absolute;
        top: max(0px, env(safe-area-inset-top, 0px));
        right: max(0px, env(safe-area-inset-right, 0px));
        z-index: 12;
        display: grid;
        place-items: center;
        width: 48px;
        height: 48px;
        padding: 0;
        border: 1px solid var(--line);
        border-radius: 14px;
        color: var(--text);
        background: var(--panel-strong);
        box-shadow: var(--shadow);
        font-size: 25px;
        line-height: 1;
        pointer-events: auto;
        touch-action: manipulation;
    }

    #game-shell.mobile-hud-expanded #hud {
        width: min(520px, calc(100vw - max(16px, calc(env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px)))));
        max-height: calc(100dvh - 188px);
        padding-top: 116px;
        padding-right: 4px;
        padding-bottom: 8px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        pointer-events: auto;
        scrollbar-width: thin;
    }

    #game-shell.mobile-assist.mobile-hud-expanded #hud {
        max-height: calc(100dvh - 244px);
    }

    #game-shell.mobile-hud-expanded .mobile-hud-toggle {
        position: fixed;
        top: 14px;
        right: 14px;
    }

    #hud>.identity-card,
    #hud>.role-progress-card,
    #hud>.primary-button,
    #hud>.secondary-button,
    .stats-card .stat-row:nth-child(n + 2),
    .stats-card .money-row,
    .combat-card .wanted-row,
    .combat-card .reload-track,
    .combat-card .sync-row {
        display: none;
    }

    /* Keep the map and event journal available while the HUD is open.  They
       occupy a separate right-hand rail instead of sitting underneath it. */
    #game-shell.mobile-hud-expanded #hud {
        width: calc(100vw - 180px);
    }

    #game-shell.mobile-hud-expanded #miniMapPanel,
    #game-shell.mobile-hud-expanded #eventPanel {
        left: auto;
        right: 10px;
        width: 150px;
        min-width: 0;
    }

    #game-shell.mobile-hud-expanded #miniMapPanel {
        top: max(132px, calc(env(safe-area-inset-top, 0px) + 132px));
        bottom: auto;
    }

    #game-shell.mobile-hud-expanded #eventPanel {
        top: max(300px, calc(env(safe-area-inset-top, 0px) + 300px));
        bottom: auto;
        padding: 8px;
    }

    #game-shell.mobile-hud-expanded #eventLog {
        max-height: min(150px, calc(100dvh - 500px));
        padding-left: 17px;
        font-size: 9px;
    }

    #hud>.cyber-systems-button {
        position: fixed;
        top: 72px;
        right: 14px;
        z-index: 12;
        display: grid;
        grid-template-columns: 1fr;
        width: 68px;
        height: 48px;
        min-height: 48px;
        padding: 0 7px;
        border-radius: 14px;
        text-align: center;
        pointer-events: auto;
        touch-action: manipulation;
    }

    #hud>.cyber-systems-button .cyber-button-icon,
    #hud>.cyber-systems-button .cyber-button-label,
    #hud>.cyber-systems-button strong {
        display: none;
    }

    #hud>.cyber-systems-button .cyber-button-short {
        display: block;
        font-size: 11px;
        font-weight: 900;
    }

    .stats-card {
        width: calc(100% - 58px);
        min-height: 48px;
        margin-right: 58px;
    }

    .combat-card {
        width: calc(100% - 78px);
        min-height: 48px;
        margin-right: 78px;
    }

    .stats-card {
        padding: 9px 11px;
    }

    #game-shell.mobile-hud-expanded #hud>.identity-card,
    #game-shell.mobile-hud-expanded #hud>.role-progress-card {
        display: flex;
        margin-right: 0;
    }

    #game-shell.mobile-hud-expanded #hud>.role-progress-card {
        display: grid;
    }

    #game-shell.mobile-hud-expanded #hud>.identity-card {
        order: -3;
    }

    #game-shell.mobile-hud-expanded #hud>.auth-button,
    #game-shell.mobile-hud-expanded #hud>.profile-button:not([hidden]) {
        order: -2;
        margin-right: 0;
    }

    #game-shell.mobile-hud-expanded #hud>.primary-button,
    #game-shell.mobile-hud-expanded #hud>.iren-menu-button,
    #game-shell.mobile-hud-expanded #hud>.auth-button,
    #game-shell.mobile-hud-expanded #hud>.profile-button:not([hidden]) {
        display: block;
    }

    #game-shell.mobile-hud-expanded .stats-card,
    #game-shell.mobile-hud-expanded .combat-card {
        width: 100%;
        margin-right: 0;
    }

    #game-shell.mobile-hud-expanded .stats-card .stat-row {
        display: grid;
    }

    #game-shell.mobile-hud-expanded .stats-card .money-row,
    #game-shell.mobile-hud-expanded .combat-card .wanted-row {
        display: flex;
    }

    #game-shell.mobile-hud-expanded .combat-card .reload-track {
        display: block;
    }

    #game-shell.mobile-hud-expanded .combat-card .sync-row {
        display: flex;
    }

    #game-shell.mobile-hud-expanded #hud>.combat-control,
    #game-shell.mobile-hud-expanded #hud>.combat-control.combat-active {
        position: static;
        display: grid;
        width: 100%;
        min-width: 0;
        padding: 10px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        background: rgba(10, 17, 24, 0.9);
        transform: none;
        backdrop-filter: blur(10px);
    }

    #game-shell.mobile-hud-expanded #hud>.combat-control.combat-active .difficulty-control {
        display: none;
    }

    #game-shell.mobile-hud-expanded #hud>.combat-control.combat-active .combat-mode-button {
        min-height: 42px;
    }

    .equipment-summary,
    .equipment-stats,
    .ship-loadout-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ship-slot-row {
        align-items: stretch;
        flex-direction: column;
        gap: 4px;
    }

    .ship-slot-row label {
        flex: 0 0 auto;
    }

    .cyber-systems-card.modal-wide {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        padding: 18px 12px 12px;
    }

    .cyber-resource-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cyber-grid {
        grid-template-columns: 1fr;
    }

    .cyber-body-grid {
        grid-template-columns: 1fr;
    }

    .cyber-panel-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .cyber-card-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .cyber-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 681px) and (max-width: 1100px) and (hover: none),
(min-width: 681px) and (max-width: 1100px) and (pointer: coarse) {
    #game-shell.mobile-hud-expanded #hud {
        width: calc(100vw - 265px);
        max-width: 520px;
    }

    #game-shell.mobile-hud-expanded #miniMapPanel,
    #game-shell.mobile-hud-expanded #eventPanel {
        right: 14px;
        width: 225px;
    }

    #game-shell.mobile-hud-expanded #eventPanel {
        top: 430px;
    }

    #game-shell.mobile-hud-expanded #eventLog {
        max-height: min(180px, calc(100dvh - 650px));
    }
}

.online-game-card-invited {
    border-color: #ffd166 !important;
    box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.28), 0 0 24px rgba(255, 209, 102, 0.2);
}

.mini-map-pause-button {
    width: 100%;
    min-height: 38px;
    margin-top: 10px;
    border: 1px solid rgba(103, 214, 255, 0.42);
    border-radius: 8px;
    color: #ecfaff;
    background: linear-gradient(135deg, rgba(38, 105, 126, 0.94), rgba(31, 72, 91, 0.94));
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.24);
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    pointer-events: auto;
}

.mini-map-pause-button:hover,
.mini-map-pause-button:focus-visible {
    border-color: var(--accent);
    filter: brightness(1.12);
}

.pause-menu-card .pause-combat-settings,
.pause-menu-card .pause-combat-settings.combat-active {
    position: static;
    display: grid;
    gap: 9px;
    width: 100%;
    min-width: 0;
    margin: 0 0 18px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
    box-shadow: none;
    transform: none;
    backdrop-filter: none;
}

.pause-menu-card .pause-combat-settings[hidden] {
    display: none;
}

.pause-menu-card .pause-section-title {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pause-menu-card .pause-combat-settings .combat-mode-button,
.pause-menu-card .pause-combat-settings.combat-active .combat-mode-button {
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 7px;
    color: #1a090b;
    background: #ff6b72;
    box-shadow: none;
    font-size: 13px;
}

.pause-menu-card .pause-combat-settings.combat-active .combat-mode-button {
    color: #f7fbff;
    background: rgba(132, 28, 38, 0.92);
}

.pause-menu-card .pause-combat-settings .difficulty-control,
.pause-menu-card .pause-combat-settings.combat-active .difficulty-control {
    display: grid;
}

@media (max-width: 680px) {
    .mini-map-pause-button {
        min-height: 42px;
        margin-top: 7px;
    }

    .pause-menu-card .pause-combat-settings,
    .pause-menu-card .pause-combat-settings.combat-active {
        margin-bottom: 12px;
        padding: 10px;
    }
}
