/* App Container */
#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   View: Main Menu
   ========================================================================== */
.view-main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.main-menu-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.main-menu-backdrop svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.5;
}

.menu-map-provinces path {
    fill-rule: evenodd;
    stroke: #d5c7a7;
    stroke-width: 0.9;
}

.main-menu-vignette {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 42%, transparent 0%, rgba(15, 23, 42, 0.55) 55%, rgba(15, 23, 42, 0.92) 100%);
}

.main-menu-content {
    position: relative;
    text-align: center;
    z-index: 10;
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-8);
}

.main-menu-title {
    font-size: 3rem;
    margin-bottom: var(--spacing-2);
    color: var(--color-text-main);
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.main-menu-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-accent);
    margin-bottom: var(--spacing-8);
    font-family: var(--font-display);
    font-style: italic;
}

.main-menu-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
}

.main-menu-actions .btn {
    padding: var(--spacing-4);
    font-size: 1.1rem;
}

/* ==========================================================================
   View: Faction Select
   ========================================================================== */
.view-faction-select {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: var(--spacing-8);
}

.faction-select-header {
    text-align: center;
    margin-bottom: var(--spacing-6);
}

.faction-layout {
    display: flex;
    flex: 1;
    gap: var(--spacing-6);
    overflow: hidden;
}

.faction-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    overflow-y: auto;
    padding-right: var(--spacing-2);
}

.faction-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-4);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.faction-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.2);
    transform: translateX(4px);
}

.faction-item.active {
    background: linear-gradient(90deg, rgba(59,130,246,0.2) 0%, transparent 100%);
    border-left: 4px solid var(--color-primary);
}

.faction-item-label {
    min-width: 0;
}

.faction-item-name {
    font-weight: 600;
    color: var(--color-text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.faction-item-sub {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.faction-color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: var(--spacing-4);
    box-shadow: 0 0 10px currentColor;
}

.faction-details {
    flex: 2;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-6);
    position: relative;
}

.faction-details-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

.faction-details-content {
    flex: 1;
    overflow-y: auto;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-4);
    margin-top: var(--spacing-4);
}

.stat-box {
    background: rgba(0,0,0,0.2);
    padding: var(--spacing-3);
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-family: var(--font-display);
    color: var(--color-text-accent);
}

.faction-action-bar {
    margin-top: var(--spacing-6);
    display: flex;
    justify-content: flex-end;
}

/* ==========================================================================
   View: Game Page Layout
   ========================================================================== */
.view-game-page {
    display: grid;
    grid-template-columns: 214px minmax(0, 1fr) 278px;
    grid-template-rows: 56px minmax(0, 1fr) 138px;
    grid-template-areas: 
        "top top top"
        "left center right"
        "bottom bottom bottom";
    height: 100%;
    overflow: hidden;
}

/* Areas */
.game-top-bar { grid-area: top; border-bottom: 1px solid var(--color-border); background: var(--color-bg-panel-solid); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--spacing-4); z-index: 20; }
.game-left-panel { grid-area: left; border-right: 1px solid var(--color-border); background: var(--color-bg-panel); overflow-y: auto; z-index: 10; padding: var(--spacing-4); }
.game-right-panel { grid-area: right; border-left: 1px solid var(--color-border); background: var(--color-bg-panel); overflow-y: auto; z-index: 10; padding: var(--spacing-4); }
.game-bottom-panel { grid-area: bottom; border-top: 1px solid var(--color-border); background: var(--color-bg-panel); z-index: 10; display: flex; flex-direction: column; }
.game-map-container { grid-area: center; position: relative; background: #0b1121; overflow: hidden; }

.mobile-panel-dock {
    display: none;
}

.mobile-lobby-dock {
    display: none;
}

.mobile-node-chip {
    display: none;
}

/* Top Bar Specifics */
.top-bar-stats {
    display: flex;
    gap: var(--spacing-6);
}

.top-stat-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    flex: 0 0 auto;
    white-space: nowrap;
}

.top-stat-label { color: var(--color-text-muted); font-size: 0.875rem; }
.top-stat-value { font-weight: 600; font-family: var(--font-display); color: var(--color-text-accent); }
.resource-delta {
    margin-left: 0.25rem;
    font-family: var(--font-sans);
    font-size: 0.78em;
    font-weight: 700;
}

.resource-delta.positive { color: var(--color-success); }
.resource-delta.negative { color: var(--color-danger); }
.resource-delta.neutral { color: var(--color-text-muted); }
.top-stat-value.negative-money,
.negative-money {
    color: var(--color-danger);
}

/* SVG Map */
#svg-map {
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#svg-map:active {
    cursor: grabbing;
}

/* Bottom Log Panel */
.log-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    background: rgba(0,0,0,0.2);
}

.log-tab {
    padding: var(--spacing-2) var(--spacing-4);
    cursor: pointer;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
}

.log-tab.active {
    color: var(--color-text-main);
    border-bottom-color: var(--color-primary);
    background: rgba(255,255,255,0.05);
}

.log-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-4);
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.log-entry { margin-bottom: var(--spacing-1); }
.log-entry-system { color: var(--color-primary); }
.log-entry-combat { color: var(--color-danger); }

/* ==========================================================================
   Shared App Controls
   ========================================================================== */
.btn:disabled,
button:disabled {
    opacity: 1;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.eyebrow {
    color: var(--color-text-accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-4);
}

.section-title-row h3,
.panel-section h3,
.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0;
}

.success-text { color: var(--color-success); }
.danger-text { color: var(--color-danger); }

.faction-swatch {
    display: inline-flex;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: 0 0 14px currentColor;
    flex: 0 0 auto;
}

.faction-swatch.small {
    width: 10px;
    height: 10px;
}

.connection-dot {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    color: var(--color-success);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.connection-dot::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 10px var(--color-success);
}

.connection-dot.waiting,
.connection-dot.offline {
    color: var(--color-warning);
}

.connection-dot.waiting::before,
.connection-dot.offline::before {
    background: var(--color-warning);
    box-shadow: 0 0 10px var(--color-warning);
}

/* Lobby slot rows (Red Alert style) */
.menu-name-row {
    display: flex;
    justify-content: center;
    gap: var(--spacing-3);
    margin: var(--spacing-4) 0 var(--spacing-2);
}

.menu-name-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    width: 100%;
    min-width: 0;
    max-width: 320px;
}

.menu-name-row .menu-turn-field {
    flex: 0 0 min(140px, 42%);
}

.menu-name-row input,
.menu-name-row select {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.85);
    color: var(--color-text-main);
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
}

.menu-status {
    margin-top: var(--spacing-4);
    text-align: center;
    font-size: 0.85rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.lobby-status {
    margin-top: 4px;
    font-size: 0.78rem;
}

.lobby-slots-panel {
    grid-column: 1 / -1;
    min-height: 0;
}

.slot-list {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    margin-top: var(--spacing-3);
    max-height: min(56vh, calc(100vh - 250px));
    overflow-y: auto;
    padding-right: 6px;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.slot-list::-webkit-scrollbar {
    width: 8px;
}

.slot-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 8px;
}

.slot-list::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}

.slot-row {
    display: grid;
    grid-template-columns: 8px 1fr auto auto;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--faction-color, var(--color-border));
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.55);
    transition: background 0.18s ease, border-color 0.18s ease;
}

.slot-row:hover {
    background: rgba(15, 23, 42, 0.78);
}

.slot-color {
    width: 8px;
    height: 28px;
    border-radius: 4px;
    background: var(--faction-color);
}

.slot-faction-name {
    font-weight: 600;
    color: var(--color-text-main);
}

.slot-state-badge {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(15, 23, 42, 0.5);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.slot-state-open {
    color: var(--color-text-muted);
    border-style: dashed;
}

.slot-state-ai {
    color: var(--color-warning);
    border-color: var(--color-warning);
}

.slot-state-human {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.slot-state-human-self {
    color: var(--color-success);
    border-color: var(--color-success);
    box-shadow: 0 0 0 1px var(--color-success);
}

.slot-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    flex-wrap: wrap;
    justify-content: flex-end;
}

.slot-actions .btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
}

.slot-actions .compact-select {
    width: auto;
    min-width: 100px;
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
}

.slot-help {
    margin-top: var(--spacing-3);
    font-size: 0.78rem;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
}

@media (max-width: 720px) {
    .slot-row {
        grid-template-columns: 8px 1fr;
        grid-template-areas: "color faction" ". badge" ". actions";
        row-gap: var(--spacing-2);
    }
    .slot-color { grid-area: color; height: 100%; }
    .slot-faction { grid-area: faction; }
    .slot-state-badge { grid-area: badge; justify-self: start; }
    .slot-actions { grid-area: actions; justify-content: flex-start; }
}

.chat-input,
.setting-field select,
.compact-select {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.84);
    color: var(--color-text-main);
    padding: var(--spacing-2) var(--spacing-3);
    outline: none;
}

.chat-input:focus,
.setting-field select:focus,
.compact-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

/* ==========================================================================
   View: Lobby
   ========================================================================== */
.view-lobby {
    height: 100%;
    padding: var(--spacing-8);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-6);
    overflow-x: hidden;
    overflow-y: auto;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-6);
}

.lobby-header h2 {
    margin: var(--spacing-1) 0 0;
    font-size: 2rem;
}

.lobby-header-actions {
    display: flex;
    gap: var(--spacing-3);
}

.lobby-grid {
    flex: 0 0 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(360px, 2fr) minmax(280px, 1fr) minmax(280px, 1fr);
    grid-template-areas:
        "slots slots slots"
        "settings chat chat";
    gap: var(--spacing-6);
}

.lobby-slots-panel { grid-area: slots; }
.lobby-settings-panel { grid-area: settings; }
.lobby-chat-panel { grid-area: chat; }

.lobby-panel,
.panel-section {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.56);
}

.lobby-panel {
    padding: var(--spacing-5, 1.25rem);
    min-height: 0;
    overflow: hidden;
}

.lobby-players-panel,
.lobby-chat-panel {
    display: flex;
    flex-direction: column;
}

.lobby-player-list,
.lobby-chat-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: var(--spacing-4);
}

.lobby-player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3) 0;
    border-bottom: 1px solid var(--color-border);
}

.lobby-player-name {
    font-weight: 700;
}

.status-pill {
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.status-pill.ready {
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.1);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-4);
}

.host-ai-fill {
    margin-top: var(--spacing-4);
    padding: var(--spacing-3);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.42);
    display: grid;
    gap: var(--spacing-3);
}

.host-ai-fill strong {
    display: block;
    color: var(--color-text-main);
    font-size: 0.9rem;
}

.host-ai-fill-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    flex-wrap: wrap;
}

.host-ai-fill-actions .compact-select {
    width: auto;
    min-width: 120px;
}

.setting-field,
.switch-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.switch-field {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-main);
}

.switch {
    width: 44px;
    height: 24px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    padding: 2px;
    cursor: pointer;
}

.switch span {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-text-muted);
    transition: transform 0.18s ease, background 0.18s ease;
}

.switch.on {
    border-color: rgba(16, 185, 129, 0.55);
    background: rgba(16, 185, 129, 0.2);
}

.switch.on span {
    transform: translateX(19px);
    background: var(--color-success);
}

.lobby-chat-line {
    padding: var(--spacing-2) 0;
    color: var(--color-text-muted);
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.lobby-chat-line span {
    color: var(--color-text-accent);
    margin-right: var(--spacing-2);
}

/* ==========================================================================
   Game Page Detail
   ========================================================================== */
.game-top-bar {
    position: relative;
    gap: var(--spacing-4);
}

.top-brand-block {
    display: flex;
    flex-direction: column;
    min-width: 156px;
}

.top-brand-block strong {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-text-main);
}

.top-brand-block span {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    flex-shrink: 0;
    white-space: nowrap;
}

.top-exit-button {
    padding-inline: var(--spacing-3);
}

.current-player-strip {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--current-color), transparent);
    opacity: 0.8;
}

.phase-value {
    color: #93c5fd;
}

.top-actions .btn.is-submitted {
    border-color: rgba(96, 165, 250, 0.55);
    background: rgba(30, 64, 175, 0.24);
    color: #bfdbfe;
}

.top-actions .turn-ready-button {
    min-width: 132px;
    min-height: 46px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding-block: 7px;
    line-height: 1.05;
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.turn-ready-label {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.turn-ready-count {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.top-actions .turn-ready-button.is-submitted .turn-ready-count {
    color: #93c5fd;
}

.view-game-page.is-plan-locked .game-right-panel,
.view-game-page.is-resolution-locked .game-right-panel {
    --panel-lock-color: #93c5fd;
}

.view-game-page.is-plan-locked .game-right-panel::before,
.view-game-page.is-resolution-locked .game-right-panel::before {
    display: block;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.24);
    background: rgba(30, 64, 175, 0.1);
    color: var(--panel-lock-color);
    font-size: 0.72rem;
    line-height: 1.35;
    text-align: center;
}

.view-game-page.is-plan-locked .game-right-panel::before {
    content: "计划已锁定 · 点击“取消准备”后可继续操作";
}

.view-game-page.is-resolution-locked .game-right-panel::before {
    content: "统一结算回放中 · 下一回合操作暂时锁定";
}

.game-top-bar.is-waiting .current-player-strip {
    animation: planning-strip-pulse 1.8s ease-in-out infinite;
}

@keyframes planning-strip-pulse {
    50% { opacity: 0.28; }
}

.timer.danger {
    color: var(--color-danger);
}

.panel-section {
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

.faction-summary-heading,
.selected-node-heading {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-4);
}

.faction-summary-heading h3,
.selected-node-heading h3 {
    margin: 0;
    letter-spacing: 0;
}

.summary-grid,
.node-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-3);
}

.summary-grid div,
.node-detail-grid div {
    padding: var(--spacing-3);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.18);
    min-width: 0;
}

.summary-grid span,
.node-detail-grid span {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.summary-grid strong,
.node-detail-grid strong {
    display: block;
    margin-top: var(--spacing-1);
    overflow-wrap: anywhere;
}

.passive-line,
.action-help-block,
.empty-state {
    margin-top: var(--spacing-4);
    padding: var(--spacing-3);
    border-left: 3px solid var(--color-text-accent);
    background: rgba(251, 191, 36, 0.08);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.action-help-block.hostile {
    border-left-color: var(--color-danger);
    background: rgba(239, 68, 68, 0.08);
}

.debt-status-card {
    margin-top: var(--spacing-4);
    padding: var(--spacing-3);
    border-left: 3px solid var(--color-danger);
    border-radius: var(--radius-sm);
    background: rgba(127, 29, 29, 0.2);
    color: var(--color-text-muted);
}

.debt-status-card strong {
    display: block;
    color: var(--color-danger);
    margin-top: var(--spacing-1);
}

.debt-status-card p {
    margin: var(--spacing-2) 0;
}

.debt-status-card small {
    color: var(--color-text-main);
}

.panel-actions {
    display: flex;
    gap: var(--spacing-3);
    margin-top: var(--spacing-4);
}

.compact-select {
    width: auto;
    min-width: 88px;
    padding: 0.35rem 0.5rem;
}

.ranking-list,
.diplomacy-badges {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.ranking-row {
    display: grid;
    grid-template-columns: 22px 12px 1fr auto auto;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.ranking-row > span:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-index {
    color: var(--color-text-accent);
    font-weight: 700;
}

.capital-state {
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
}

.capital-state.held {
    color: var(--color-success);
}

.capital-state.moved {
    color: var(--color-warning);
}

.capital-state.lost {
    color: var(--color-danger);
}

.diplomacy-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-2);
    border-left: 3px solid var(--faction-color);
    background: rgba(255, 255, 255, 0.04);
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.diplomacy-badge-name {
    color: var(--color-text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.diplomacy-badge-relation {
    flex: 0 0 auto;
    font-weight: 700;
}

.diplomacy-badge.war { color: var(--color-danger); }
.diplomacy-badge.truce { color: var(--color-warning); }
.diplomacy-badge.neutral { color: var(--color-text-muted); }

.action-count {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.selected-node-card {
    border: 1px solid color-mix(in srgb, var(--faction-color) 60%, transparent);
    border-radius: var(--radius-md);
    padding: var(--spacing-4);
    background: linear-gradient(135deg, color-mix(in srgb, var(--faction-color) 18%, transparent), rgba(15, 23, 42, 0.66));
}

.sea-mode-card {
    margin-top: var(--spacing-3);
    border: 1px solid color-mix(in srgb, var(--faction-color) 46%, var(--color-border));
    border-left: 4px solid var(--faction-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-4);
    background: rgba(255, 255, 255, 0.035);
}

.sea-mode-card .section-title-row {
    margin-bottom: var(--spacing-3);
}

.sea-mode-card .panel-actions {
    margin-top: var(--spacing-3);
}

.selected-node-heading > span {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--faction-color);
    color: var(--color-text-main);
    font-weight: 800;
    background: rgba(15, 23, 42, 0.72);
}

.action-button-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-2);
    margin-top: var(--spacing-4);
}

.action-btn {
    flex-direction: column;
    gap: 0.15rem;
    min-height: 58px;
    padding: var(--spacing-2);
}

.action-btn small {
    color: #dbeafe;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.action-btn:disabled small { color: #cbd5e1; }

.focus-action-summary {
    margin-top: var(--spacing-4);
    padding: var(--spacing-3);
    border: 1px solid rgba(251, 191, 36, 0.28);
    border-radius: var(--radius-sm);
    background: rgba(251, 191, 36, 0.06);
}

.focus-action-summary > div:first-child {
    display: grid;
    gap: 0.2rem;
}

.focus-action-summary span,
.focus-action-summary small {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.focus-action-summary strong {
    color: var(--color-text-main);
    line-height: 1.25;
}

.focus-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2);
    margin-top: var(--spacing-3);
}

.target-list,
.neighbor-list {
    margin-top: var(--spacing-4);
}

.target-list span,
.neighbor-list > span {
    display: block;
    margin-bottom: var(--spacing-2);
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.target-list button,
.neighbor-list button,
.diplomacy-table button {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text-main);
    padding: 0.35rem 0.5rem;
    margin: 0 0.35rem 0.35rem 0;
    cursor: pointer;
}

.attack-target-list button {
    border-color: rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

.move-target-list button {
    border-color: rgba(59, 130, 246, 0.45);
    color: #bfdbfe;
}

.move-order-panel {
    margin-top: var(--spacing-4);
    padding: var(--spacing-3);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.07);
}

.move-order-heading,
.move-amount-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.move-order-heading {
    justify-content: space-between;
    margin-bottom: var(--spacing-3);
}

.move-order-heading span {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.move-order-heading strong {
    color: var(--color-text-main);
}

.move-amount-controls input[type="range"] {
    flex: 1;
    min-width: 0;
}

.move-amount-input {
    width: 58px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.76);
    color: var(--color-text-main);
    padding: 0.35rem;
}

.mini-control-btn {
    min-width: 32px;
    min-height: 32px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-main);
    cursor: pointer;
}

.move-target-list button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-2);
}

.move-target-list button strong,
.move-target-list button small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.move-target-list button small {
    color: var(--color-text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

/* ==========================================================================
   Ideology
   ========================================================================== */
.ideology-card {
    margin: var(--spacing-3) 0 var(--spacing-2) 0;
    padding: var(--spacing-3);
    border: 1px solid var(--ideology-color, var(--color-border));
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.ideology-heading {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.ideology-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.ideology-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
}

.ideology-heading strong {
    font-size: 1rem;
    color: var(--color-text-main);
}

.ideology-desc {
    font-size: 0.78rem;
    line-height: 1.4;
}

.ideology-bonus-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ideology-bonus-list li {
    position: relative;
    padding-left: 12px;
    font-size: 0.78rem;
    color: var(--color-text-main);
}

.ideology-bonus-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--ideology-color, var(--color-text-muted));
}

.ranking-row {
    display: grid;
    grid-template-columns: 22px 14px 1fr auto auto auto;
    gap: var(--spacing-2);
    align-items: center;
}

.ranking-ideology {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 999px;
    color: var(--ideology-color, var(--color-text-muted));
    border: 1px solid var(--ideology-color, var(--color-border));
    background: rgba(15, 23, 42, 0.4);
    white-space: nowrap;
}

/* ==========================================================================
   Recruit slider (in confirm modal)
   ========================================================================== */
.recruit-slider-block,
.move-slider-block {
    margin: var(--spacing-2) 0 var(--spacing-3);
    padding: var(--spacing-3);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: var(--radius-sm);
    background: rgba(34, 197, 94, 0.06);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.move-slider-block {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.07);
}

.recruit-slider-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recruit-slider-heading span {
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.recruit-slider-heading strong {
    color: var(--color-text-main);
}

.recruit-slider-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.recruit-range,
.move-range,
.battle-range,
.move-amount-controls input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 1;
    min-width: 0;
    height: 30px;
    background: transparent;
    cursor: grab;
    touch-action: none;
}

.recruit-range:active,
.move-range:active,
.battle-range:active,
.move-amount-controls input[type="range"]:active {
    cursor: grabbing;
}

.recruit-range::-webkit-slider-runnable-track,
.move-range::-webkit-slider-runnable-track,
.battle-range::-webkit-slider-runnable-track,
.move-amount-controls input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.recruit-range::-webkit-slider-thumb,
.move-range::-webkit-slider-thumb,
.battle-range::-webkit-slider-thumb,
.move-amount-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 26px;
    height: 26px;
    margin-top: -10px;
    border-radius: 50%;
    border: 2px solid rgba(248, 250, 252, 0.95);
    background: var(--color-primary);
    box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.16), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.recruit-range::-moz-range-track,
.move-range::-moz-range-track,
.battle-range::-moz-range-track,
.move-amount-controls input[type="range"]::-moz-range-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.recruit-range::-moz-range-thumb,
.move-range::-moz-range-thumb,
.battle-range::-moz-range-thumb,
.move-amount-controls input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(248, 250, 252, 0.95);
    background: var(--color-primary);
    box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.16), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.recruit-amount-input,
.battle-amount-input,
.move-amount-input {
    width: 64px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.76);
    color: var(--color-text-main);
    padding: 0.35rem;
}

.recruit-slider-hint {
    font-size: 0.72rem;
}

.recruit-income-preview {
    color: var(--color-text-accent);
}

/* ==========================================================================
   Map
   ========================================================================== */
.map-command-strip {
    position: absolute;
    top: var(--spacing-4);
    left: var(--spacing-4);
    z-index: 4;
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: var(--backdrop-blur);
}

.planned-orders-layer {
    pointer-events: none;
    filter: drop-shadow(0 6px 12px rgba(2, 6, 23, 0.62));
}

.planned-order {
    pointer-events: none;
}

.planned-order path {
    pointer-events: none;
    fill: none;
    stroke: #60a5fa;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 10 7;
    filter: drop-shadow(0 0 5px rgba(96, 165, 250, 0.75));
    animation: planned-order-march 0.85s linear infinite;
}

.planned-order.attack path {
    stroke: #f87171;
    filter: drop-shadow(0 0 5px rgba(248, 113, 113, 0.8));
}

.planned-order.attack.coordinated path {
    stroke: #fb7185;
    stroke-width: 5;
    filter: drop-shadow(0 0 8px rgba(251, 113, 133, 0.96));
}

.planned-order.attack.coordinated .planned-order-label circle {
    stroke: #fecdd3;
    animation: coordinated-order-pulse 1.4s ease-in-out infinite;
}

.planned-order:hover path {
    stroke-width: 6;
}

.planned-order-label circle {
    fill: rgba(15, 23, 42, 0.96);
    stroke: #93c5fd;
    stroke-width: 2;
}

.planned-order.attack .planned-order-label circle {
    stroke: #fca5a5;
}
.planned-order-label {
    pointer-events: all;
    cursor: pointer;
}

.planned-orders-layer.is-locked .planned-order-label {
    pointer-events: none;
    cursor: default;
}

.planned-orders-layer.is-locked .planned-order path {
    animation-play-state: paused;
    opacity: 0.82;

}

.planned-order-label text {
    fill: #f8fafc;
    font-size: 9px;
    font-weight: 800;
    pointer-events: none;
}

@keyframes planned-order-march {
    to { stroke-dashoffset: -17; }
}

@keyframes coordinated-order-pulse {
    50% {
        fill: rgba(127, 29, 29, 0.94);
        stroke-width: 3;
    }
}

/* 权威结算结果在地图内回放：路线、移动兵牌和目标反馈都位于节点之上。 */
.resolution-movement-layer {
    pointer-events: none;
    overflow: visible;
}

.resolution-movement {
    --movement-color: #94a3b8;
}

.resolution-movement-route {
    fill: none;
    stroke: var(--movement-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 7 6;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--movement-color) 78%, transparent));
    animation: resolution-route-flow 0.46s linear infinite;
}

.resolution-movement-route.attack {
    stroke-width: 4;
}

.resolution-unit-token circle {
    fill: rgba(2, 6, 23, 0.96);
    stroke: var(--movement-color);
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
    filter:
        drop-shadow(0 2px 2px rgba(2, 6, 23, 0.9))
        drop-shadow(0 0 6px color-mix(in srgb, var(--movement-color) 72%, transparent));
}

.resolution-unit-token.attack circle {
    stroke-width: 4;
}

.resolution-unit-token text {
    fill: #f8fafc;
    font-size: 9px;
    font-weight: 900;
    paint-order: stroke;
    stroke: rgba(2, 6, 23, 0.85);
    stroke-width: 2px;
}

.resolution-engagement-pulse {
    --winner-color: #f8fafc;
}

.resolution-impact-ring {
    fill: none;
    stroke: var(--winner-color);
    stroke-width: 4;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 8px var(--winner-color));
}

.resolution-impact-core {
    fill: rgba(2, 6, 23, 0.92);
    stroke: var(--winner-color);
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.resolution-impact-mark {
    fill: none;
    stroke: #f8fafc;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.resolution-result-label {
    fill: #f8fafc;
    font-size: 9px;
    font-weight: 900;
    paint-order: stroke;
    stroke: rgba(2, 6, 23, 0.96);
    stroke-width: 4px;
    stroke-linejoin: round;
}

@keyframes resolution-route-flow {
    to { stroke-dashoffset: -13; }
}

@media (prefers-reduced-motion: reduce) {
    .resolution-movement-route {
        animation: none;
    }
}

.map-icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text-main);
    font-size: 1.1rem;
    cursor: pointer;
}

/* 国家修正弹窗 */
.modifiers-modal {
    max-width: 540px;
    width: 92%;
}

.modifiers-modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 6px 2px 2px;
    max-height: 70vh;
    overflow-y: auto;
}

.modifier-group h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: var(--color-text-accent, #e2e8f0);
}

.modifier-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.modifier-list li {
    padding: 5px 10px;
    background: rgba(148, 163, 184, 0.08);
    border-left: 3px solid var(--ideology-color, rgba(148, 163, 184, 0.4));
    border-radius: 4px;
    font-size: 0.88rem;
}

.modifier-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modifier-badge {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--ideology-color, #334155);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 0 8px color-mix(in srgb, var(--ideology-color, #334155) 50%, transparent);
}

.map-tooltip {
    position: absolute;
    right: var(--spacing-4);
    top: var(--spacing-4);
    z-index: 5;
    width: min(280px, calc(100% - 2rem));
    padding: var(--spacing-4);
    border: 1px solid color-mix(in srgb, var(--faction-color) 64%, transparent);
    border-left-width: 4px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.88);
    color: var(--color-text-muted);
    box-shadow: var(--shadow-lg);
    backdrop-filter: var(--backdrop-blur);
    font-size: 0.8125rem;
}

.tooltip-title {
    color: var(--color-text-main);
    font-weight: 800;
    margin-bottom: var(--spacing-2);
}

.map-grid-view {
    position: absolute;
    inset: 72px var(--spacing-4) var(--spacing-4);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    overflow: auto;
    padding: var(--spacing-2);
}

.grid-cell {
    min-height: 76px;
    border: 1px solid color-mix(in srgb, var(--faction-color) 56%, var(--color-border));
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.76);
    color: var(--color-text-main);
    padding: var(--spacing-2);
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.grid-cell:hover,
.grid-cell.selected {
    transform: translateY(-2px);
    background: color-mix(in srgb, var(--faction-color) 16%, rgba(15, 23, 42, 0.82));
    border-color: var(--faction-color);
}

.grid-cell strong,
.grid-cell span,
.grid-cell b {
    display: block;
}

.grid-cell span {
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

.grid-cell b {
    margin-top: var(--spacing-1);
    color: var(--color-text-accent);
    font-size: 0.8rem;
}

/* ==========================================================================
   Logs and Modals
   ========================================================================== */
.log-tab {
    appearance: none;
    border: 0;
    background: transparent;
    font: inherit;
}

.log-content {
    min-height: 0;
}

.log-entry-battle { color: #fecaca; }
.log-entry-diplomacy { color: #fde68a; }
.log-entry-chat { color: #bfdbfe; }

.game-chat-row {
    border-top: 1px solid var(--color-border);
    padding: var(--spacing-2) var(--spacing-4);
}

#modal-container {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: var(--spacing-6);
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.modal-panel {
    width: min(780px, 100%);
    max-height: min(86vh, 760px);
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.96);
    box-shadow: var(--shadow-lg);
}

.compact-modal {
    width: min(440px, 100%);
}

.modal-header,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4);
    padding: var(--spacing-4);
    border-bottom: 1px solid var(--color-border);
}

.modal-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--color-border);
    border-bottom: 0;
}

.modal-body {
    padding: var(--spacing-4);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1.25rem;
}

/* —— 联机房间对话框 —— */
.room-dialog { width: min(460px, 100%); }
.room-dialog-body { display: flex; flex-direction: column; gap: var(--spacing-3); }
.room-dialog-field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}
.room-trans-options { display: flex; flex-direction: column; gap: var(--spacing-2); }
.room-trans-option {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    width: 100%;
    text-align: left;
    padding: var(--spacing-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.5);
    color: var(--color-text-main);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.room-trans-option:hover:not(:disabled) { border-color: var(--color-primary); }
.room-trans-option:disabled { opacity: 1; color: var(--color-text-muted); cursor: default; }
.room-trans-option.active {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.12);
}
.room-trans-radio {
    flex-shrink: 0;
    width: 18px; height: 18px;
    margin-top: 2px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    position: relative;
}
.room-trans-option.active .room-trans-radio { border-color: var(--color-primary); }
.room-trans-option.active .room-trans-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--color-primary);
}
.room-trans-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.room-trans-top { display: flex; align-items: center; gap: var(--spacing-2); flex-wrap: wrap; }
.room-trans-name { font-weight: 600; }
.room-trans-desc { font-size: 0.8rem; color: var(--color-text-muted); line-height: 1.45; }
.room-trans-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    white-space: nowrap;
}
.room-trans-badge.warn { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }
.room-trans-badge.ok { background: rgba(52, 211, 153, 0.18); color: #6ee7b7; }
.room-dialog-field { display: flex; flex-direction: column; gap: var(--spacing-2); }
.room-dialog-field > input {
    width: 100%;
    padding: var(--spacing-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(2, 6, 23, 0.55);
    color: var(--color-text-main);
    font-size: 0.95rem;
}
.room-dialog-field > input:focus { outline: none; border-color: var(--color-primary); }
.room-code-input {
    text-transform: uppercase;
    letter-spacing: 0.35em;
    font-weight: 700;
    font-size: 1.4rem !important;
    text-align: center;
    font-family: var(--font-mono, ui-monospace, monospace);
}
.room-code-input::placeholder { letter-spacing: 0.35em; opacity: 0.4; }
.room-dialog-hint { font-size: 0.78rem; color: var(--color-text-muted); line-height: 1.45; }
.room-dialog-error {
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fca5a5;
    font-size: 0.85rem;
}

.confirm-line {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-4);
    padding: var(--spacing-3) 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.confirm-line span {
    color: var(--color-text-muted);
}

.battle-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-4);
    padding: var(--spacing-4);
}

.battle-side {
    border-left: 4px solid var(--faction-color);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    padding: var(--spacing-4);
}

.battle-side span,
.battle-side div {
    display: block;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-2);
}

.battle-side strong {
    display: block;
    color: var(--color-text-main);
    font-family: var(--font-display);
    font-size: 2.3rem;
    margin-bottom: var(--spacing-3);
}

.battle-slider-block {
    margin: 0 var(--spacing-4) var(--spacing-4);
    padding: var(--spacing-4);
    border: 1px solid rgba(239, 68, 68, 0.22);
    border-radius: var(--radius-md);
    background: rgba(127, 29, 29, 0.12);
}

.battle-slider-row {
    margin-top: var(--spacing-3);
    margin-bottom: var(--spacing-2);
}

.battle-range::-webkit-slider-thumb {
    background: var(--color-danger);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.16), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.battle-range::-moz-range-thumb {
    background: var(--color-danger);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.16), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.battle-result {
    margin: 0 var(--spacing-4) var(--spacing-4);
    padding: var(--spacing-4);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
}

.battle-result.success {
    color: var(--color-success);
}

.battle-result.danger {
    color: var(--color-danger);
}

.focus-modal {
    width: min(1180px, calc(100vw - 32px));
    max-height: min(90vh, 820px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.focus-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4);
    padding: var(--spacing-3) var(--spacing-4);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.focus-toolbar-stats,
.focus-zoom-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    flex-wrap: wrap;
}

.focus-zoom-controls span {
    min-width: 44px;
    text-align: center;
    color: var(--color-text-main);
    font-weight: 700;
}

.focus-mobile-filter {
    display: none;
}

.focus-modal-body {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    height: min(68vh, 720px);
    min-height: 0;
}

.focus-tree-scroll {
    height: 100%;
    min-height: 0;
    overflow: auto;
    cursor: grab;
    user-select: none;
    touch-action: none;
    background:
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        rgba(2, 6, 23, 0.35);
    background-size: 32px 32px;
}

.focus-tree-scroll.is-panning {
    cursor: grabbing;
}

.focus-tree-stage {
    position: relative;
}

.focus-tree-canvas {
    position: relative;
    transform-origin: 0 0;
}

.focus-connector-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.focus-link {
    fill: none;
    stroke: var(--focus-link-color, #94a3b8);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-opacity: 0.5;
}

.focus-link-any {
    stroke-dasharray: 6 5;
}

.focus-link-met {
    stroke-opacity: 0.85;
}

.focus-link-active {
    stroke-width: 3.5;
    stroke-opacity: 1;
}

/* 分支泳道：把每条线在视觉上圈成一簇 */
.focus-lane-band {
    opacity: 0.08;
}

.focus-lane-label {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    opacity: 0.55;
    pointer-events: none;
}

.focus-mutual-link {
    fill: none;
    stroke: rgba(239, 68, 68, 0.72);
    stroke-width: 2;
    stroke-dasharray: 8 6;
}

.focus-card {
    appearance: none;
    position: absolute;
    z-index: 1;
    width: 190px;
    height: 150px;
    display: grid;
    grid-template-rows: auto minmax(3.35em, auto) auto auto auto;
    gap: 0.28rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.62rem;
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.focus-card:hover,
.focus-card.selected {
    transform: translateY(-2px);
    border-color: rgba(251, 191, 36, 0.86);
    background: rgba(22, 30, 49, 0.96);
}

.focus-card.available {
    border-color: rgba(251, 191, 36, 0.72);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.18), 0 12px 24px rgba(0, 0, 0, 0.25);
}

.focus-card.done {
    border-color: rgba(16, 185, 129, 0.65);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.18), rgba(15, 23, 42, 0.94));
}

.focus-card.locked,
.focus-card.blocked {
    opacity: 0.62;
}

.focus-card.blocked {
    border-color: rgba(239, 68, 68, 0.55);
}

.focus-card.pp-blocked {
    border-color: rgba(148, 163, 184, 0.5);
}

.focus-branch {
    color: var(--branch-color, var(--color-text-accent));
    font-size: 0.62rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 卡片左侧分支色条（不与 status 的 border/box-shadow 冲突） */
.focus-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: var(--branch-color, transparent);
    opacity: 0.9;
    pointer-events: none;
}

.focus-title {
    color: var(--color-text-main);
    font-weight: 800;
    font-size: 0.8rem;
    line-height: 1.18;
    min-height: 3.35em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.focus-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-2);
    color: var(--color-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.focus-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 0.35rem;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 3px;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.04);
}

.focus-progress-mini,
.focus-progress-large {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
}

.focus-progress-mini span,
.focus-progress-large span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f59e0b, #facc15);
}

.focus-cost {
    color: var(--color-text-accent);
    font-size: 0.68rem;
    font-weight: 700;
    margin-top: auto;
}

.focus-detail-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-gutter: stable;
    padding: var(--spacing-4);
    border-left: 1px solid var(--color-border);
    background: rgba(15, 23, 42, 0.76);
}

.focus-detail-heading span,
.focus-detail-block > span,
.focus-detail-progress span,
.focus-detail-actions span {
    color: var(--color-text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
}

.focus-detail-heading h3 {
    margin: 0.25rem 0 0;
    color: var(--color-text-main);
    font-size: 1.12rem;
    line-height: 1.25;
}

.focus-detail-heading p {
    margin: var(--spacing-2) 0 0;
    color: var(--color-text-muted);
    line-height: 1.55;
}

.focus-detail-progress,
.focus-detail-block {
    display: grid;
    gap: var(--spacing-2);
    padding: var(--spacing-3);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.035);
}

.focus-detail-progress > div:first-child,
.focus-detail-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
}

.focus-detail-progress strong,
.focus-detail-block strong,
.focus-detail-actions strong {
    color: var(--color-text-main);
    line-height: 1.35;
}

.focus-detail-block.danger-block {
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(239, 68, 68, 0.08);
}

.focus-prereq-label {
    color: #c6cad3;
    font-size: .73rem;
}

.focus-prereq-nodes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.focus-prereq-option {
    padding-left: 6px;
    border-left: 1px dashed #a7b4c078;
}

.focus-condition {
    max-width: 100%;
    padding: 4px 7px;
    border: 1px solid #71829a77;
    border-radius: 4px;
    background: #243243;
    color: #edf0f4;
    font: inherit;
    font-size: .78rem;
    text-align: left;
}

button.focus-condition:hover,
button.focus-condition:focus-visible {
    cursor: pointer;
    border-color: #d7bb82;
}

.focus-condition.met {
    border-color: #74ab8c85;
    color: #c2e8ce;
}

.focus-effect-list {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding-left: 1rem;
    color: var(--color-text-main);
}

.focus-detail-actions {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding-top: var(--spacing-4);
    border-top: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.96) 28%);
    z-index: 2;
}

.diplomacy-modal {
    width: min(860px, 100%);
}

.diplomacy-table {
    width: 100%;
    border-collapse: collapse;
}

.diplomacy-table th,
.diplomacy-table td {
    padding: var(--spacing-3) var(--spacing-4);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: middle;
}

.diplomacy-table th {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.diplomacy-table td:first-child {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.endgame-modal {
    border-color: color-mix(in srgb, var(--faction-color) 70%, var(--color-border));
}

.winner-mark {
    display: inline-grid;
    place-items: center;
    min-width: 72px;
    height: 56px;
    margin-bottom: var(--spacing-4);
    border: 1px solid var(--faction-color);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--faction-color) 18%, rgba(15, 23, 42, 0.9));
    color: var(--color-text-main);
    font-weight: 900;
    font-size: 1.35rem;
}

.winner-mark-star {
    color: var(--faction-color);
    font-size: 1.9rem;
    line-height: 1;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--faction-color) 70%, transparent));
}

.winner-mark-sub {
    margin-top: calc(var(--spacing-1) * -1);
    margin-bottom: var(--spacing-3);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1120px) {
    .view-game-page {
        grid-template-columns: minmax(0, 1fr) minmax(240px, 29vw);
        grid-template-rows: 64px minmax(0, 1fr) 154px;
        grid-template-areas:
            "top top"
            "center right"
            "left bottom";
    }

    .game-left-panel {
        border-right: 0;
        border-top: 1px solid var(--color-border);
    }

    .top-bar-stats {
        gap: var(--spacing-3);
        overflow-x: auto;
    }

    .lobby-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "slots slots"
            "settings chat";
    }

    .lobby-players-panel { grid-area: players; }
    .lobby-settings-panel { grid-area: settings; }
    .lobby-chat-panel { grid-area: chat; }
}

@media (max-width: 760px) {
    body {
        overflow: auto;
    }

    #app {
        min-height: 100vh;
        height: auto;
    }

    .view-lobby,
    .view-faction-select {
        height: auto;
        min-height: 100vh;
        padding: var(--spacing-4);
    }

    .lobby-header,
    .lobby-header-actions,
    .faction-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .lobby-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .slot-list {
        max-height: none;
        overflow: visible;
    }

    .view-game-page {
        height: 100vh;
        grid-template-columns: 1fr;
        grid-template-rows: 128px minmax(340px, 1fr) 270px 220px;
        grid-template-areas:
            "top"
            "center"
            "right"
            "bottom";
    }

    .game-left-panel {
        display: none;
    }

    .game-top-bar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto minmax(34px, auto);
        align-items: center;
        padding: var(--spacing-3);
        overflow: hidden;
    }

    .top-brand-block {
        min-width: 120px;
        grid-column: 1;
        grid-row: 1;
    }

    .top-actions {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: start;
    }

    .top-actions .connection-dot {
        display: none;
    }

    .top-actions .btn {
        padding: var(--spacing-2) var(--spacing-3);
        min-width: 92px;
    }

    .top-actions .turn-ready-button {
        min-width: 112px;
    }

    .top-bar-stats {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        gap: var(--spacing-4);
        padding: var(--spacing-2) 0 var(--spacing-1);
    }

    .top-stat-label,
    .top-stat-value {
        font-size: 0.82rem;
    }

    .game-right-panel {
        border-left: 0;
        border-top: 1px solid var(--color-border);
    }

    .map-command-strip {
        right: var(--spacing-3);
        left: var(--spacing-3);
        flex-wrap: wrap;
    }

    .map-tooltip {
        display: none;
    }

    .battle-preview-grid,
    .action-button-grid {
        grid-template-columns: 1fr;
    }

    .focus-tree-scroll {
        height: min(50vh, 420px);
        min-height: 300px;
    }

    .focus-modal-body {
        flex: 1 1 auto;
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }

    .focus-detail-panel {
        max-height: min(58vh, 520px);
        border-left: 0;
        border-top: 1px solid var(--color-border);
    }

    .focus-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .focus-action-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    body.is-game-view,
    body.is-lobby-view {
        overflow: hidden;
        overscroll-behavior: none;
    }

    body.is-game-view #app,
    body.is-lobby-view #app {
        height: 100svh;
        min-height: 100svh;
    }

    .view-game-page {
        position: relative;
        height: 100svh;
        min-height: 100svh;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 112px minmax(0, 1fr);
        grid-template-areas:
            "top"
            "center";
        overflow: hidden;
    }

    .game-map-container {
        min-height: 0;
    }

    .game-top-bar {
        min-height: 0;
    }

    .top-brand-block strong {
        font-size: 0.94rem;
    }

    .top-brand-block span {
        font-size: 0.74rem;
    }

    .top-actions .btn {
        min-width: auto;
        min-height: 44px;
    }

    .top-actions .turn-ready-button {
        min-width: 104px;
        padding-inline: var(--spacing-2);
    }

    .top-exit-button {
        padding-inline: var(--spacing-2);
    }

    .top-bar-stats {
        scrollbar-width: none;
        gap: var(--spacing-3);
    }

    .top-bar-stats::-webkit-scrollbar {
        display: none;
    }

    .mobile-optional-stat {
        display: none;
    }

    .map-command-strip {
        top: var(--spacing-3);
        right: var(--spacing-3);
        left: auto;
        width: auto;
        max-width: calc(100vw - 1.5rem);
        flex-wrap: nowrap;
        padding: var(--spacing-1);
        background: rgba(15, 23, 42, 0.82);
    }

    .planned-order path {
        stroke-width: 5;
    }

    .map-command-strip .btn {
        min-height: 40px;
        padding: 0 var(--spacing-3);
    }

    .map-icon-btn {
        width: 40px;
        height: 40px;
    }

    .game-left-panel,
    .game-right-panel,
    .game-bottom-panel {
        position: fixed;
        left: var(--spacing-2);
        right: var(--spacing-2);
        bottom: calc(60px + env(safe-area-inset-bottom));
        max-height: min(62svh, 520px);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        background: rgba(15, 23, 42, 0.94);
        box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.38);
        backdrop-filter: var(--backdrop-blur);
        transform: translateY(calc(100% + 82px));
        opacity: 0;
        pointer-events: none;
        z-index: 32;
        transition: transform 0.22s ease, opacity 0.18s ease;
    }

    .game-left-panel,
    .game-right-panel {
        display: block;
        overflow-y: auto;
        padding: var(--spacing-3);
    }

    .game-bottom-panel {
        display: flex;
        min-height: 220px;
        overflow: hidden;
    }

    .view-game-page.mobile-panel-actions .game-right-panel,
    .view-game-page.mobile-panel-intel .game-left-panel,
    .view-game-page.mobile-panel-logs .game-bottom-panel {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-panel-dock {
        position: fixed;
        left: var(--spacing-2);
        right: var(--spacing-2);
        bottom: env(safe-area-inset-bottom);
        z-index: 36;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: var(--spacing-2);
        padding: var(--spacing-2);
        border: 1px solid rgba(148, 163, 184, 0.2);
        border-radius: var(--radius-md);
        background: rgba(15, 23, 42, 0.94);
        box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.32);
        backdrop-filter: var(--backdrop-blur);
    }

    .mobile-panel-dock button {
        min-height: 42px;
        border: 1px solid transparent;
        border-radius: var(--radius-sm);
        background: rgba(255, 255, 255, 0.04);
        color: var(--color-text-muted);
        font-weight: 800;
        letter-spacing: 0;
    }

    .mobile-panel-dock button.active {
        border-color: rgba(251, 191, 36, 0.48);
        background: rgba(251, 191, 36, 0.16);
        color: var(--color-text-accent);
    }

    .mobile-panel-actions .game-right-panel {
        max-height: min(72svh, 620px);
    }

    .mobile-panel-actions .game-right-panel .panel-section {
        border: 0;
        background: transparent;
        padding: 0;
    }

    .mobile-panel-actions .section-title-row {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: var(--spacing-2) 0;
        background: rgba(15, 23, 42, 0.94);
    }

    .mobile-panel-actions .action-button-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-2);
    }

    .mobile-panel-actions .action-btn {
        min-height: 54px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        padding: var(--spacing-3);
    }

    .mobile-node-chip {
        position: fixed;
        left: var(--spacing-2);
        right: var(--spacing-2);
        bottom: calc(64px + env(safe-area-inset-bottom));
        z-index: 34;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--spacing-3);
        padding: var(--spacing-2) var(--spacing-3);
        border: 1px solid color-mix(in srgb, var(--faction-color) 48%, rgba(148, 163, 184, 0.24));
        border-left: 4px solid var(--faction-color);
        border-radius: var(--radius-md);
        background: rgba(15, 23, 42, 0.94);
        box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.28);
        backdrop-filter: var(--backdrop-blur);
    }

    .view-game-page:not(.mobile-panel-none) .mobile-node-chip {
        display: none;
    }

    .mobile-node-chip-main {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: var(--spacing-2);
    }

    .mobile-node-chip-main > span {
        flex: 0 0 auto;
        min-width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        border-radius: var(--radius-sm);
        background: color-mix(in srgb, var(--faction-color) 24%, rgba(255, 255, 255, 0.05));
        color: var(--color-text-main);
        font-weight: 900;
    }

    .mobile-node-chip-main div {
        min-width: 0;
    }

    .mobile-node-chip-main strong,
    .mobile-node-chip-main small {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-node-chip-main small {
        color: var(--color-text-muted);
        font-size: 0.72rem;
    }

    .mobile-node-chip-actions {
        flex: 0 0 auto;
        display: flex;
        gap: var(--spacing-2);
    }

    .mobile-node-chip-actions .btn {
        min-height: 38px;
        padding-inline: var(--spacing-3);
    }

    .view-lobby {
        position: relative;
        height: 100svh;
        min-height: 100svh;
        padding: var(--spacing-3);
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
        overflow: hidden;
        gap: var(--spacing-3);
    }

    .lobby-header {
        flex: 0 0 auto;
        gap: var(--spacing-3);
    }

    .lobby-header h2 {
        font-size: 1.35rem;
    }

    .lobby-header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-2);
    }

    .lobby-header-actions .btn {
        min-height: 38px;
        padding-inline: var(--spacing-2);
    }

    .lobby-header-actions .btn-primary {
        grid-column: 1 / -1;
    }

    .lobby-grid {
        position: relative;
        flex: 1 1 auto;
        min-height: 0;
        display: block;
    }

    .lobby-panel {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        padding: var(--spacing-3);
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        transform: translateY(16px);
        transition: opacity 0.18s ease, transform 0.22s ease;
    }

    .view-lobby.mobile-lobby-panel-slots .lobby-slots-panel,
    .view-lobby.mobile-lobby-panel-settings .lobby-settings-panel,
    .view-lobby.mobile-lobby-panel-chat .lobby-chat-panel {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .slot-list,
    .lobby-chat-log {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .lobby-chat-panel .chat-input {
        flex: 0 0 auto;
        min-height: 44px;
        position: sticky;
        bottom: 0;
    }

    .slot-actions {
        gap: var(--spacing-2);
    }

    .slot-actions .compact-select,
    .host-ai-fill-actions .compact-select {
        min-height: 42px;
        flex: 1 1 150px;
    }

    .settings-grid {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .host-ai-fill {
        flex-shrink: 0;
    }

    .mobile-lobby-dock {
        position: fixed;
        left: var(--spacing-2);
        right: var(--spacing-2);
        bottom: env(safe-area-inset-bottom);
        z-index: 36;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--spacing-2);
        padding: var(--spacing-2);
        border: 1px solid rgba(148, 163, 184, 0.2);
        border-radius: var(--radius-md);
        background: rgba(15, 23, 42, 0.94);
        box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.32);
        backdrop-filter: var(--backdrop-blur);
    }

    .mobile-lobby-dock button {
        min-height: 42px;
        border: 1px solid transparent;
        border-radius: var(--radius-sm);
        background: rgba(255, 255, 255, 0.04);
        color: var(--color-text-muted);
        font-weight: 800;
        letter-spacing: 0;
    }

    .mobile-lobby-dock button.active {
        border-color: rgba(251, 191, 36, 0.48);
        background: rgba(251, 191, 36, 0.16);
        color: var(--color-text-accent);
    }

    .panel-section {
        padding: var(--spacing-3);
        margin-bottom: var(--spacing-3);
    }

    .summary-grid,
    .node-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-2);
    }

    .selected-node-heading,
    .faction-summary-heading {
        margin-bottom: var(--spacing-3);
    }

    .selected-node-card {
        padding: var(--spacing-3);
    }

    .target-list button,
    .neighbor-list button,
    .action-btn {
        min-height: 42px;
    }

    .log-tabs {
        flex-shrink: 0;
    }

    .log-list {
        min-height: 0;
        overflow-y: auto;
    }

    .modal-backdrop {
        padding: var(--spacing-3);
        align-items: flex-end;
    }

    .modal-panel {
        width: 100%;
        max-height: calc(100svh - 2rem);
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .modal-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: rgba(15, 23, 42, 0.96);
    }

    .battle-modal {
        max-height: calc(100svh - 1rem);
        overflow-y: auto;
    }

    .battle-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-2);
        padding: var(--spacing-3);
    }

    .battle-side {
        padding: var(--spacing-3);
    }

    .battle-side strong {
        font-size: 1.65rem;
    }

    .battle-slider-block,
    .battle-result {
        margin-inline: var(--spacing-3);
        padding: var(--spacing-3);
    }

    .battle-slider-row {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) 64px 42px 56px;
    }

    .focus-modal {
        width: 100%;
        height: 100svh;
        max-height: 100svh;
        border-radius: 0;
    }

    .focus-toolbar {
        gap: var(--spacing-2);
        padding: var(--spacing-2) var(--spacing-3);
    }

    .focus-toolbar-stats {
        gap: var(--spacing-2);
        max-width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }

    .focus-toolbar-stats::-webkit-scrollbar {
        display: none;
    }

    .focus-zoom-controls {
        width: 100%;
        justify-content: space-between;
    }

    .focus-mobile-filter {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: var(--spacing-2);
    }

    .focus-mobile-filter button {
        min-height: 40px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-sm);
        background: rgba(255, 255, 255, 0.04);
        color: var(--color-text-muted);
        font-weight: 800;
    }

    .focus-mobile-filter button.active {
        border-color: rgba(251, 191, 36, 0.52);
        background: rgba(251, 191, 36, 0.16);
        color: var(--color-text-accent);
    }

    .focus-modal-body {
        position: relative;
        display: block;
        height: auto;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .focus-tree-scroll {
        height: 100%;
        min-height: 0;
        padding-bottom: 210px;
    }

    .focus-card.mobile-focus-hidden {
        display: none;
    }

    .focus-detail-panel {
        position: absolute;
        left: var(--spacing-2);
        right: var(--spacing-2);
        bottom: var(--spacing-2);
        z-index: 5;
        max-height: min(38svh, 320px);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        background: rgba(15, 23, 42, 0.96);
        box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.36);
        padding: var(--spacing-3);
    }

    .focus-detail-heading h3 {
        font-size: 1rem;
    }

    .focus-detail-panel .modal-actions,
    .focus-detail-panel footer {
        position: sticky;
        bottom: 0;
        background: rgba(15, 23, 42, 0.96);
        padding-top: var(--spacing-2);
    }
}

.node-plan-orders {
    margin: 0 var(--spacing-4) var(--spacing-4);
    padding: var(--spacing-3) 0;
    border-top: 1px solid rgba(96, 165, 250, 0.26);
    border-bottom: 1px solid rgba(96, 165, 250, 0.18);
}

.node-plan-orders-heading,
.node-plan-order {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--spacing-2);
}

.node-plan-orders-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: var(--spacing-2);
    color: #bfdbfe;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.node-plan-order {
    min-height: 32px;
    padding: var(--spacing-1) 0;
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.node-plan-order + .node-plan-order {
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.node-plan-order strong {
    color: #93c5fd;
}

.node-plan-order.attack strong {
    color: #fca5a5;
}

.node-plan-order > span {
    min-width: 0;
}

.coordination-note {
    display: block;
    margin-top: 0.18rem;
    color: #fda4af;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    animation: coordination-note-arrive 0.45s ease-out both;
}

.battle-coordination {
    color: var(--color-text-muted);
    font-weight: 700;
}

.battle-coordination.active {
    color: #fda4af;
}

@keyframes coordination-note-arrive {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
}

.node-plan-order button {
    border: 0;
    background: transparent;
    color: var(--color-text-accent);
    cursor: pointer;
    font: inherit;
}

.node-plan-order button:hover {
    color: #fff;
}

.node-plan-order button:disabled {
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 1;
}

/* 手机端触摸目标与可读性 */
@media (max-width: 760px) {
    /* #2 主操作按钮 ≥44px（底部面板与国策树底部按钮空间充足） */
    .panel-actions .btn,
    .focus-action-buttons .btn {
        min-height: 44px;
    }

    /* #4 排序下拉/紧凑控件不要太矮 */
    .compact-select {
        min-height: 40px;
    }

    /* #5 收入增量等小字提升到约 12px，手机上更易读 */
    .resource-delta {
        font-size: 0.75rem;
    }

}

/* Campaign atlas */
.game-map-container {
    background-color: #15242e;
    background-image: radial-gradient(ellipse at 48% 42%, rgba(86, 113, 112, .28), transparent 74%);
}

#svg-map {
    display: block;
}

.map-province {
    fill: color-mix(in srgb, var(--province-color) 68%, #6e7764);
    fill-rule: evenodd;
    stroke: #14242b9c;
    stroke-width: .65;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    outline: none;
}

.atlas-overview .map-province:not(.selected, :hover, :focus-visible) {
    stroke-opacity: .67;
}

.map-province.attack-target {
    fill: color-mix(in srgb, var(--province-color) 54%, #ea9678);
}

.map-province.move-target {
    fill: color-mix(in srgb, var(--province-color) 40%, #78cce0);
}

.map-province.selected,
.map-province:hover,
.map-province:focus-visible {
    fill: color-mix(in srgb, var(--province-color) 48%, #f6da9a);
    stroke: #fff0c3;
    stroke-width: 2.2;
    paint-order: fill stroke;
}

.atlas-industry .map-province {
    fill: var(--province-color);
}

.atlas-industry .map-province:is(.selected, .attack-target, .move-target, :hover, :focus-visible) {
    stroke: #f7e6a7;
    stroke-width: 2;
}

.frontier-layer,
.atlas-context,
.territory-labels,
.map-nodes-layer {
    pointer-events: none;
}

.frontier-layer path {
    fill: none;
    stroke: #f3e5bd;
    stroke-opacity: .68;
    stroke-width: 1.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.atlas-context text {
    fill: #a4b9b7;
    opacity: .7;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 15px;
    text-anchor: middle;
    letter-spacing: .27em;
}

.territory-label,
.city-capital,
.city-name,
.city-count {
    text-anchor: middle;
    paint-order: stroke;
    stroke-linejoin: round;
}

.territory-label {
    fill: #fff0cd;
    stroke: #1b2528;
    stroke-width: 3.6;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .08em;
}

.atlas-detail .territory-labels,
.atlas-close .territory-labels {
    display: none;
}

.atlas-mid .territory-labels {
    opacity: .74;
}

.city-capital {
    fill: #ffe8a6;
    stroke: #20252a;
    stroke-width: 2.6;
    font-size: 15px;
    font-weight: 900;
}

.city-dot {
    fill: #eddfb8;
    stroke: #19272d;
    stroke-width: 1.2;
}

.city-detail {
    display: none;
}

.atlas-detail .city-detail,
.atlas-close .map-city:not(.crowded) .city-detail,
.atlas-close .map-city.selected .city-detail,
.atlas-mid .map-city.emphasis .city-detail,
.atlas-overview .map-city.selected .city-detail {
    display: inline;
}

.city-counter {
    fill: #17252c;
    stroke: #f0dbad;
    stroke-width: .65;
}

.map-city.selected .city-counter {
    stroke-width: 1.2;
}

.city-name,
.city-count {
    fill: #fff2cc;
    font-family: var(--font-sans);
    font-size: 8px;
    font-weight: 800;
}

.city-name {
    stroke: #17252c;
    stroke-width: 2;
    letter-spacing: .04em;
}

.atlas-toolbar {
    inset: 12px auto auto 12px;
    max-width: calc(100% - 24px);
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px;
    background: #17272f;
    border-color: #7f897b;
    box-shadow: 0 6px 20px #0b161c70;
}

.atlas-tabs,
.atlas-tools,
.atlas-plan-summary {
    display: flex;
    align-items: center;
    gap: 3px;
}

.atlas-tools,
.atlas-plan-summary {
    padding-left: 5px;
    border-left: 1px solid #78857960;
}

.atlas-toolbar button {
    min-height: 32px;
    min-width: 30px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #2b3a42;
    color: #e8e2d2;
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
    white-space: nowrap;
}

.atlas-toolbar button[aria-pressed="true"],
.atlas-toolbar button:hover:not(:disabled) {
    border-color: #d3bd8b;
    background: #6d6048;
    color: #fff4db;
}

.atlas-toolbar button:disabled {
    opacity: 1;
    color: #94a3b8;
    cursor: default;
}

.atlas-plan-summary {
    color: #d7d9ce;
    font-size: .76rem;
    white-space: nowrap;
}

.atlas-plan-summary strong {
    color: #ffe8ad;
}

.atlas-caption {
    position: absolute;
    inset: auto 12px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 13px;
    padding: 7px 10px;
    border-top: 1px solid #929a8266;
    color: #d9ded6;
    background: #15242eea;
    font-size: .76rem;
    pointer-events: none;
}

.atlas-coordinate {
    color: #ecd4a2;
    font-weight: 800;
}

.atlas-map-credit {
    margin-left: auto;
    color: #c2ced4;
    font-size: .68rem;
    white-space: nowrap;
    pointer-events: auto;
}

.view-main-menu > .atlas-map-credit {
    position: absolute;
    right: 12px;
    bottom: 10px;
    z-index: 2;
}

.atlas-caption i {
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
}

.atlas-front-key {
    width: 15px;
    border-top: 2px solid #e6d4a9;
}

.atlas-capital-key {
    color: #ffe8a6;
    font-style: normal;
}

.atlas-desktop-hint,
.atlas-order-hint {
    margin-left: auto;
}

.atlas-order-hint {
    color: #a3e6f2;
}

.game-left-panel .summary-grid > div,
.province-stats > div {
    padding: 7px 8px;
}

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

.game-right-panel .action-button-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.game-left-panel .panel-actions {
    flex-wrap: wrap;
}

.game-left-panel .panel-actions .btn {
    padding-inline: 9px;
    white-space: nowrap;
}

.province-meta {
    margin-top: 7px;
    font-size: .75rem;
    color: var(--color-text-muted);
}

.atlas-industry-key i {
    width: 45px;
    height: 7px;
    background: linear-gradient(90deg, #334a52, #e3b254);
}

.atlas-tooltip {
    inset: auto 12px 53px auto;
    width: auto;
    padding: 8px 12px;
    pointer-events: none;
}

.atlas-tooltip strong {
    color: #fff2d2;
}

.atlas-tooltip span {
    display: block;
}

.atlas-province-list {
    inset: 65px 12px 12px;
}

.atlas-province-group h3 {
    margin: 5px 0;
    color: #f6e1af;
    font-size: .9rem;
}

.atlas-province-group h3 small,
.atlas-province-group button small {
    margin-left: 4px;
    color: #aab9ba;
    font-size: .72rem;
}

.atlas-province-group > div {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
    gap: 6px;
}

.atlas-province-group .grid-cell {
    min-height: 56px;
}

@media (max-width: 760px) {
    .atlas-toolbar {
        max-width: calc(100% - 16px);
        inset: 8px auto auto 8px;
    }

    .atlas-toolbar button {
        min-height: 40px;
    }

    .atlas-caption {
        inset: auto 8px 66px;
    }

    .mobile-panel-none:has(.mobile-node-chip) .atlas-caption {
        bottom: 130px;
    }

    .atlas-desktop-hint {
        display: none;
    }

    .atlas-province-list {
        bottom: 130px;
    }

    .atlas-plan-summary {
        gap: 2px;
    }
}

/* Campaign selection, phase and story dossier */
.main-menu-content {
    max-width: 490px;
}

.menu-scenarios {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    text-align: left;
}

.menu-scenario {
    min-height: 62px;
    padding: 9px 12px;
    border: 1px solid #8394aa54;
    border-radius: var(--radius-sm);
    background: #101a28e8;
    color: #ebeff4;
    cursor: pointer;
    text-align: left;
}

.menu-scenario:hover,
.menu-scenario[aria-pressed="true"] {
    border-color: #e2bc7f;
    background: #2e2a27;
}

.menu-scenario small,
.menu-scenario strong {
    display: block;
}

.menu-scenario small {
    margin-bottom: 3px;
    font-size: .72rem;
    color: #aebcc9;
}

.menu-scenario strong {
    font-size: .95rem;
}

.menu-scenario-description {
    min-height: 2.5em;
    margin: 8px 0 15px;
    color: var(--color-text-muted);
    font-size: .82rem;
    text-align: left;
}

.lobby-campaign-brief {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #c1ab7b4f;
    border-left: 2px solid #d9b97a;
    border-radius: var(--radius-sm);
    background: #17222c;
}

.lobby-campaign-brief > strong {
    color: #f0d7a2;
    font-size: .93rem;
}

.lobby-campaign-brief small {
    color: var(--color-text-muted);
    font-size: .76rem;
}

.lobby-story-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    border-top: 1px solid #aebdcd29;
    cursor: pointer;
}

.lobby-story-toggle input {
    width: 18px;
    height: 18px;
    accent-color: #d9b97a;
}

.lobby-story-toggle small {
    display: block;
}

.scenario-west-russia .game-map-container {
    background-color: #172631;
    background-image: radial-gradient(ellipse at 50% 48%, #43616b50, transparent 72%);
}

.atlas-surroundings {
    fill: #2f4248;
    fill-rule: evenodd;
    stroke: #8ca3a83f;
    stroke-width: 1;
    pointer-events: none;
}

.atlas-rivers {
    fill: none;
    stroke: #b9d9dc;
    stroke-width: .75;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .56;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.atlas-lakes {
    fill: #1c3540;
    fill-rule: evenodd;
    stroke: #99bcc780;
    stroke-width: .55;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.scenario-west-russia .territory-label {
    font-size: 15px;
    letter-spacing: .04em;
}

.scenario-west-russia .atlas-context text {
    fill: #bbc8c4;
    font-size: 14px;
}

.campaign-briefing {
    position: absolute;
    z-index: 4;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 7px 9px;
    border: 1px solid #82969c80;
    border-left: 3px solid #aecacb;
    border-radius: 4px;
    background: #17252fec;
    box-shadow: 0 6px 18px #0d17227a;
}

.campaign-briefing strong,
.campaign-briefing small {
    display: block;
}

.campaign-briefing strong {
    color: #d5e6e3;
    font-size: .82rem;
}

.campaign-briefing small {
    color: #adbbc0;
    font-size: .68rem;
}

.campaign-wartime {
    border-left-color: #e2a17b;
}

.campaign-wartime strong {
    color: #ffd0a8;
}

.campaign-story-button {
    min-height: 31px;
    padding: 0 7px;
    border: 1px solid #9b895d;
    border-radius: 4px;
    background: #39372f;
    color: #f5e3b6;
    font-size: .77rem;
    cursor: pointer;
    white-space: nowrap;
}

.campaign-story-button:hover {
    background: #514637;
}

.campaign-story-button b {
    display: inline-grid;
    min-width: 16px;
    min-height: 16px;
    place-items: center;
    margin-left: 2px;
    border-radius: 2px;
    background: #ddba80;
    color: #26241e;
}

.campaign-story-modal {
    width: min(840px, 94vw);
    max-width: none;
    min-height: min(350px, 78svh);
    overflow: hidden;
}

.campaign-story-layout {
    display: grid;
    grid-template-columns: minmax(175px, 30%) minmax(0, 1fr);
    flex: 1;
    max-height: min(66svh, 570px);
    min-height: 0;
}

.campaign-story-index {
    overflow: auto;
    padding: 10px;
    border-right: 1px solid var(--color-border);
    background: #101b27;
}

.campaign-story-index button {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: #dce4e5;
    text-align: left;
    cursor: pointer;
}

.campaign-story-index button[aria-pressed="true"],
.campaign-story-index button:hover {
    border-color: #c6ab746f;
    background: #6b594138;
}

.campaign-story-index button span {
    display: block;
    color: #b5a887;
    font-size: .72rem;
}

.campaign-story-index button strong {
    font-size: .9rem;
}

.campaign-story-page {
    min-width: 0;
    overflow: auto;
    padding: clamp(18px, 4vw, 40px);
    background: linear-gradient(135deg, #1d2a35, #17232f);
}

.campaign-story-page small {
    color: #c9b183;
    letter-spacing: .06em;
}

.campaign-story-page h4 {
    margin: 8px 0 18px;
    color: #f6e8cb;
    font-size: clamp(1.25rem, 2.5vw, 1.7rem);
}

.campaign-story-page p {
    color: #e5e5df;
    font-size: 1rem;
    line-height: 1.9;
}

.campaign-branch-controls,
.campaign-branch-jump {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #dfc692;
    font-size: .78rem;
}

.campaign-branch-controls {
    flex-wrap: wrap;
    flex-shrink: 0;
}

.campaign-branch-jump select {
    max-width: 195px;
    padding: 6px 8px;
    border: 1px solid #8998a36d;
    border-radius: 4px;
    background: #172530;
    color: #e1e9ec;
}

.campaign-branch-view {
    padding: 5px 8px;
    font-size: .76rem;
    white-space: nowrap;
}

.campaign-branch-view[aria-pressed="true"] {
    border-color: #bfa670;
    background: #665332;
    color: #fff3d3;
}

.focus-graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 15px;
    padding: 5px var(--spacing-4);
    border-bottom: 1px solid var(--color-border);
    color: #c9d3df;
    font-size: .72rem;
}

.focus-graph-legend i {
    display: inline-block;
    width: 14px;
    vertical-align: middle;
    border-top: 2px solid #aabbd0;
}

.focus-graph-legend .focus-legend-any {
    border-top-style: dashed;
}

.focus-graph-legend .focus-legend-mutex {
    border-top: 2px dashed #ea8686;
}

.focus-legend-hint {
    color: #9aa8b8;
}

.focus-west-russia .focus-link {
    stroke-width: 1.8;
    stroke-opacity: .64;
}

.focus-west-russia .focus-link-cross {
    stroke-opacity: .58;
}

.focus-west-russia .focus-link-met {
    stroke-opacity: .86;
}

.focus-west-russia .focus-link-active {
    stroke: #f2d597;
    stroke-width: 2.8;
    stroke-opacity: 1;
}




.focus-choice-label {
    position: absolute;
    top: 10px;
    right: 6px;
    padding: 2px 4px;
    border: 1px solid #b6766b;
    border-radius: 3px;
    background: #312126;
    color: #f2b4a7;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.focus-mutual-bracket {
    fill: none;
    stroke: #dc8b81;
    stroke-width: 1.8;
    stroke-dasharray: 4 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.focus-mutual-label-background {
    fill: #251c23;
    stroke: #9b655f;
    stroke-width: .8;
}

.focus-mutual-label {
    fill: #f3b4a8;
    font: 700 11px var(--font-display);
    text-anchor: middle;
    dominant-baseline: central;
}

.focus-mutual-group.active .focus-mutual-bracket {
    stroke: #ffc0ae;
    stroke-width: 2.4;
}











.focus-modal-overview .focus-modal-body {
    grid-template-columns: minmax(0, 1fr);
}

.focus-modal-overview .focus-tree-scroll {
    display: grid;
    place-items: center;
    overflow: hidden;
    padding-bottom: 0;
    cursor: default;
    touch-action: auto;
}

.focus-chapter-jump {
    position: absolute;
    z-index: 1;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--chapter-color);
    cursor: pointer;
}

.focus-chapter-jump:is(.current, :hover, :focus-visible) {
    outline: calc(1px * var(--focus-zoom-inverse, 1)) solid var(--chapter-color);
    z-index: 2;
}

.focus-chapter-jump span {
    display: none;
    position: absolute;
    left: 50%;
    bottom: 100%;
    padding: .18em .4em;
    border-radius: .2em;
    transform: translateX(-50%);
    background: #0b1523;
    font-size: calc(11px * var(--focus-zoom-inverse, 1));
    font-weight: 700;
    white-space: nowrap;
}

.focus-chapter-jump:is(:hover, :focus-visible) span {
    display: block;
}

.focus-modal-overview .focus-west-russia .focus-link {
    stroke-width: calc(.75px * var(--focus-zoom-inverse, 1));
}

.focus-modal-overview .focus-link-any {
    stroke-dasharray: calc(2px * var(--focus-zoom-inverse, 1));
}

.focus-modal-overview .focus-mutual-bracket {
    stroke-width: calc(.8px * var(--focus-zoom-inverse, 1));
    stroke-dasharray: none;
}

.focus-modal-overview .focus-mutual-label,
.focus-modal-overview .focus-mutual-label-background {
    display: none;
}

.focus-overview-nodes {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.focus-overview-nodes rect {
    opacity: .54;
}

.focus-overview-nodes .done {
    opacity: .95;
}

.focus-overview-nodes .focus-overview-mutual-target {
    fill: #b35f59;
    stroke: #f7aa99;
    stroke-width: calc(1.4px * var(--focus-zoom-inverse, 1));
    opacity: 1;
}

@media (min-width: 1100px) {
    .focus-campaign-modal {
        width: min(1540px, calc(100vw - 48px));
        max-height: min(94vh, 920px);
    }

    .focus-campaign-modal .focus-modal-body {
        height: min(74vh, 760px);
    }
}

.focus-war-requirement {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 7px;
    border-left: 2px solid #da9a68;
    background: #b3673336;
    color: #f4ca9e;
}

@media (max-width: 1120px) {
    .campaign-briefing { top: 63px; }
}

@media (max-width: 760px) {
    .focus-legend-hint {
        display: none;
    }

    .view-main-menu {
        justify-content: safe center;
        overflow: auto;
    }

    .main-menu-content {
        padding: 20px;
    }

    .campaign-briefing {
        top: 104px;
        right: 8px;
        gap: 7px;
        padding: 5px 7px;
    }

    .campaign-story-button {
        min-height: 40px;
    }

    .campaign-story-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        max-height: 68svh;
    }

    .campaign-story-index {
        display: flex;
        gap: 6px;
        padding: 6px 8px;
        border-right: 0;
        border-bottom: 1px solid var(--color-border);
    }

    .campaign-story-index button {
        flex: 0 0 158px;
    }

    .campaign-branch-jump select {
        min-height: 36px;
    }
}

.scenario-west-russia .game-map-container:has(.atlas-province-list) .campaign-briefing {
    inset: auto 12px 12px auto;
}

@media (max-width: 760px) {
    .scenario-west-russia .game-map-container:has(.atlas-province-list) .campaign-briefing {
        bottom: 126px;
    }
}

/* ========================================================================
   Menu structure with the established dark-blue interface palette.
   ======================================================================== */
.view-main-menu { min-height: 0; }
.main-menu-backdrop svg { opacity: .36; filter: saturate(.75); }
.menu-map-provinces path { stroke: #94a3b8; stroke-width: .65; }
.main-menu-vignette {
    background: linear-gradient(90deg, #0f172af5 0%, #0f172a9c 48%, #0f172ade 100%),
        linear-gradient(0deg, #0f172a, transparent 45%);
}
.main-menu-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
    align-items: center;
    gap: clamp(38px, 7vw, 112px);
    width: min(1160px, 100%);
    max-width: 1160px;
    padding: 40px 48px;
    text-align: left;
}
.menu-identity { align-self: center; }
.menu-kicker {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
    color: #cbd5e1;
    font-size: .73rem;
    letter-spacing: .16em;
}
.menu-kicker > span { color: #93c5fd; font-family: monospace; letter-spacing: .08em; }
.main-menu-title {
    margin: 0 0 9px;
    font-size: clamp(3rem, 5.2vw, 4.5rem);
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.2;
    white-space: nowrap;
    color: #f8fafc;
    text-shadow: 0 3px 24px #0005;
}
.main-menu-subtitle {
    margin: 0;
    color: #b8c5d6;
    font-family: var(--font-sans);
    font-size: .77rem;
    font-weight: 500;
    font-style: normal;
    letter-spacing: .31em;
}
.menu-identity-copy { margin-top: 38px; color: #cbd5e1; font-size: .9rem; line-height: 2.1; letter-spacing: .08em; }
.menu-identity-rule { width: 42px; height: 3px; margin: 30px 0 20px; background: #60a5fa; }
.menu-dossier-caption { color: #b8c5d6; font: .64rem monospace; letter-spacing: .12em; }
.menu-dossier-caption span { display: block; margin-top: 8px; font-family: var(--font-sans); font-size: .71rem; letter-spacing: .06em; }
.menu-operations {
    padding: 25px 26px 18px;
    background: #172338f2;
    border: 1px solid #64748b70;
    border-top: 3px solid #60a5fa;
    box-shadow: 0 16px 50px #0004;
}
.menu-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
    font-size: .73rem;
    font-weight: 600;
    letter-spacing: .06em;
    color: #e2e8f0;
}
.menu-section-heading > span:last-child { color: #b8c5d6; font: .62rem monospace; letter-spacing: .11em; }
.menu-scenarios { grid-template-columns: 1fr; gap: 0; }
.menu-scenario {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 65px;
    padding: 11px 13px;
    border: 1px solid #64748b70;
    border-radius: 0;
    background: #152238;
    color: #cbd5e1;
    transition: background-color 140ms ease, border-color 140ms ease;
}
.menu-scenario + .menu-scenario { margin-top: -1px; }
.menu-scenario:hover { z-index: 1; background: #20334f; border-color: #93c5fd; }
.menu-scenario[aria-pressed="true"] { z-index: 2; border-color: #60a5fa; background: #233f64; color: #eff6ff; box-shadow: inset 3px 0 #93c5fd; }
.menu-scenario-number { color: #b8c5d6; font: .72rem monospace; }
.menu-scenario[aria-pressed="true"] .menu-scenario-number { color: #93c5fd; }
.menu-scenario-copy { flex: 1; min-width: 0; }
.menu-scenario small { margin: 0 0 3px; color: #b8c5d6; font-size: .66rem; letter-spacing: .06em; }
.menu-scenario strong { font-size: .91rem; font-weight: 600; }
.menu-scenario-check { color: #93c5fd; font-size: .7rem; }
.menu-scenario-description { min-height: 3em; margin: 12px 0 18px; color: #cbd5e1; font-size: .76rem; line-height: 1.7; }
.menu-name-row { margin: 0 0 20px; gap: 12px; justify-content: stretch; }
.menu-name-row label { max-width: none; gap: 6px; font-size: .71rem; }
.menu-name-row .menu-turn-field { flex: 0 0 122px; }
.menu-name-row input, .menu-name-row select {
    min-height: 40px;
    padding: 8px 10px;
    border-color: #64748b80;
    border-radius: 1px;
    background: #0f172a;
    color: #f1f5f9;
    font-size: .83rem;
    color-scheme: dark;
}
.menu-command-heading { padding-top: 17px; border-top: 1px solid #64748b70; }
.main-menu-actions { gap: 7px; }
.main-menu-actions .menu-command {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 16px;
    gap: 11px;
    min-height: 45px;
    padding: 11px 13px;
    text-align: left;
    font-size: .83rem;
    border-radius: 1px;
}
.main-menu-actions .menu-command-primary { min-height: 53px; margin-bottom: 3px; }
.menu-command-number { font-family: Georgia, serif; font-size: .73rem; opacity: .6; }
.menu-command-arrow { justify-self: end; opacity: .65; font-weight: 400; transition: opacity 140ms ease; }
.menu-command:hover .menu-command-arrow { opacity: 1; }
.main-menu-actions .btn-tutorial { margin-top: 2px; border-color: transparent; background: transparent; color: #cbd5e1; }
.main-menu-actions .btn-tutorial:hover { border-color: #64748b70; background: #20334f; color: #f8fafc; }
.menu-edition { display: flex; justify-content: space-between; gap: 10px; margin-top: 17px; padding-top: 12px; border-top: 1px solid #64748b70; color: #b8c5d6; font-size: .65rem; }
.menu-edition > span:last-child { font: .58rem monospace; letter-spacing: .04em; }
.menu-status { margin: 12px 0 0; text-align: left; font-size: .77rem; font-weight: 400; }

/* Numeric resources retain the original dark-blue interface contrast. */
.top-stat-value { font-variant-numeric: tabular-nums; }
.top-actions .turn-ready-button .turn-ready-count { color: #dbeafe; }
.top-actions .turn-ready-button.is-submitted .turn-ready-count { color: #bfdbfe; }

/* Actual buttons keep the faction list reachable with keyboard and touch. */
.faction-item-name, .faction-item-sub { display: block; }
.faction-item { width: 100%; min-height: 62px; flex-shrink: 0; text-align: left; font: inherit; }
.faction-select-header h2 { margin-bottom: 8px; }
.faction-select-header > .text-muted { font-size: .82rem; }
.stat-value { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
    .main-menu-content { grid-template-columns: minmax(0, 1fr) minmax(0, 410px); gap: 30px; padding: 28px; }
    .main-menu-title { font-size: 3rem; }
    .main-menu-subtitle { font-size: .65rem; letter-spacing: .21em; }
    .menu-operations { padding: 20px; }
}
@media (max-width: 800px) {
    .view-main-menu { overflow-y: auto; justify-content: flex-start; }
    .main-menu-content { grid-template-columns: minmax(0, 1fr); width: min(470px, 100%); gap: 25px; padding: 28px 20px 44px; }
    .menu-identity { padding-left: 3px; }
    .menu-kicker { margin-bottom: 13px; font-size: .65rem; }
    .main-menu-title { font-size: 2.6rem; letter-spacing: .14em; }
    .main-menu-subtitle { font-size: .62rem; letter-spacing: .27em; }
    .menu-identity-copy, .menu-identity-rule, .menu-dossier-caption { display: none; }
    .menu-operations { padding: 19px 17px 15px; }
    .menu-scenario { min-height: 61px; }
    .menu-scenario-description { min-height: 0; margin-bottom: 16px; }
    .menu-name-row { gap: 9px; }
    .menu-name-row .menu-turn-field { flex-basis: 113px; }
    .menu-edition { font-size: .6rem; }
    .menu-edition > span:last-child { font-size: .52rem; }
    .view-main-menu > .atlas-map-credit { position: fixed; font-size: 8px; opacity: .65; }
    .view-faction-select { padding: 18px 12px; overflow-y: auto; }
    .faction-layout { flex-direction: column; overflow: visible; gap: 0; }
    .faction-list { max-height: 220px; min-height: 160px; padding: 10px; }
    .faction-details { min-height: 400px; padding: 18px; }
    .faction-action-bar { justify-content: space-between; }
}
@media (max-height: 710px) and (min-width: 801px) {
    .view-main-menu { overflow-y: auto; justify-content: flex-start; }
    .main-menu-content { margin-block: auto; padding-block: 20px; }
    .menu-operations { padding-block: 17px 13px; }
    .menu-scenario { min-height: 55px; }
    .menu-scenario-description { margin-block: 9px 12px; min-height: 0; }
    .menu-name-row { margin-bottom: 14px; }
    .menu-command-heading { padding-top: 12px; }
}

/* The established route is a standing government order in the action ledger. */
.game-right-panel {
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
}
.route-action-card {
    min-width: 0;
    margin-top: 16px;
    padding: 14px 12px 12px;
    border: 1px solid var(--color-border);
    border-top: 2px solid #60a5fa;
    border-radius: 2px;
    background: #0f172a;
    overflow-wrap: anywhere;
}
.route-eyebrow {
    display: block;
    margin-bottom: 8px;
    color: #93c5fd;
    font-size: .65rem;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: .08em;
}
.route-action-card h4 {
    margin: 0 0 8px;
    color: var(--color-text-main);
    font-size: 1.06rem;
    line-height: 1.5;
    letter-spacing: .03em;
}
.route-action-card > p,
.route-outcome-preview > p {
    margin: 0;
    color: #cbd5e1;
    font-size: .77rem;
    line-height: 1.8;
}
.route-tradeoff {
    margin-top: 12px;
    padding: 8px 9px;
    border-left: 2px solid #f87171;
    background: #7f1d1d33;
    color: #fecaca;
    font-size: .73rem;
    line-height: 1.7;
}
.route-tradeoff > strong { margin-right: 4px; color: #fecaca; font-size: .69rem; }
.route-goal {
    margin-top: 11px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
    color: #cbd5e1;
    font-size: .72rem;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
}
.route-power { display: grid; gap: 7px; min-width: 0; padding-top: 12px; }
.route-power > strong { color: #dbeafe; font-size: .8rem; font-weight: 600; }
.route-power > p { margin: 0; color: #cbd5e1; font-size: .73rem; line-height: 1.75; }
.route-power > small { display: block; color: #b9c7da; font-size: .67rem; line-height: 1.65; }
.route-power > .btn { width: 100%; min-height: 40px; margin-top: 2px; white-space: normal; }
.route-power > .route-action-reason { color: #fde68a; font-size: .7rem; }
.route-outcome-preview {
    min-width: 0;
    margin-top: 16px;
    padding: 12px;
    border: 1px solid #60a5fa80;
    border-left: 2px solid #60a5fa;
    border-radius: 1px;
    background: #172d49;
    overflow-wrap: anywhere;
}
.route-outcome-preview > span { display: block; margin-bottom: 8px; color: #bfdbfe; font-size: .78rem; font-weight: 600; line-height: 1.65; }
.route-outcome-preview > h4 { margin: 0 0 8px; color: #bfdbfe; font-size: 1rem; line-height: 1.55; }
.route-outcome-preview dl { margin: 12px 0 0; }
.route-outcome-preview dt { margin-top: 10px; color: #bfdbfe; font-size: .68rem; font-weight: 600; letter-spacing: .04em; }
.route-outcome-preview dd { margin: 3px 0 0; color: #cbd5e1; font-size: .75rem; line-height: 1.8; }
.route-outcome-preview > small { display: block; margin-top: 13px; padding-top: 9px; border-top: 1px solid var(--color-border); color: #b9c7da; font-size: .67rem; line-height: 1.65; }
@media (max-width: 760px) {
    .mobile-panel-actions .section-title-row { background: var(--color-bg-panel-solid); }
    .route-action-card { margin-top: 14px; }
    .route-power > .btn { min-height: 44px; }
}

/* Focus controls use the shared dark-blue palette; route header colors remain distinct. */
.focus-card { background: var(--color-bg-panel-solid); box-shadow: 0 2px 6px #0004; }
.focus-card:is(:hover, .selected) { background: #263f62; border-color: #60a5fa; }
.focus-card.done { background: #173b2f; border-color: #34d399; }
.focus-detail-actions { background: var(--color-bg-panel-solid); padding-bottom: 8px; }
.route-outcome-preview .focus-effect-list { margin-top: 14px; font-size: .75rem; line-height: 1.7; }


/* Both campaigns use the same readable, color-block focus cards. */
.focus-tree-canvas .focus-unified-card {
    display: grid;
    grid-template-rows: 34px minmax(30px, 1fr) 20px 4px 19px;
    gap: 5px;
    padding: 0 10px 8px;
    border: 1px solid color-mix(in srgb, var(--branch-color) 58%, #475569);
    border-radius: 3px;
    background: color-mix(in srgb, var(--branch-color) 14%, #1e293b);
    box-shadow: 0 2px 5px #0005;
    opacity: 1;
    transform: none;
    overflow: hidden;
    color: #f8fafc;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}
.focus-unified-card::before { content: none; }
.focus-unified-card .focus-branch {
    display: flex;
    align-items: center;
    width: calc(100% + 20px);
    min-width: 0;
    margin: 0 -10px;
    padding: 5px 9px;
    background: var(--branch-color);
    border-bottom: 1px solid #ffffff20;
    color: var(--branch-text-color, #f8fafc);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
    letter-spacing: .02em;
}
.focus-unified-card .focus-branch > span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.focus-unified-card .focus-title {
    align-self: center;
    min-height: 0;
    color: #f8fafc;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    -webkit-line-clamp: 2;
}
.focus-unified-card .focus-card-row {
    width: 100%;
    min-height: 0;
    font-size: 11px;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
}
.focus-unified-card .focus-status-pill {
    min-height: 18px;
    padding: 1px 5px;
    border-color: #64748b;
    background: #0f172a80;
    color: #cbd5e1;
    font-size: 10px;
    line-height: 1.2;
}
.focus-unified-card .focus-progress-mini {
    width: 100%;
    height: 4px;
    border-radius: 1px;
    background: #0f172a99;
}
.focus-unified-card .focus-progress-mini > span { background: var(--branch-color); border-radius: 1px; }
.focus-unified-card .focus-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 5px;
}
.focus-unified-card .focus-cost { margin: 0; color: #dbeafe; font-size: 11px; line-height: 1.2; }
.focus-unified-card .focus-choice-label {
    position: static;
    display: inline-flex;
    align-items: center;
    min-height: 17px;
    padding: 1px 4px;
    border-radius: 2px;
    border-color: #f87171;
    background: #7f1d1d;
    color: #fee2e2;
    font-size: 9px;
    line-height: 1.2;
}
.focus-unified-card.available .focus-status-pill { border-color: #4ade80; color: #bbf7d0; }
.focus-unified-card.done .focus-status-pill { border-color: #4ade80; background: #14532d; color: #dcfce7; }
.focus-unified-card.blocked .focus-status-pill { border-color: #f87171; color: #fecaca; }
.focus-unified-card.pp-blocked .focus-status-pill { color: #fde68a; }
.focus-unified-card:is(.selected, :hover, :focus-visible) {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px #60a5fa80, 0 2px 7px #0006;
    transform: none;
}
.focus-unified-card:focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; }
.focus-unified-card.focus-mutual-target {
    border-color: #f87171;
    box-shadow: 0 0 0 2px #f87171b3;
}
.focus-unified-card.focus-mutual-target .focus-choice-label { border-color: #fecaca; background: #991b1b; color: #fff1f2; }
.focus-west-russia .focus-lane-band { opacity: .075; }
.focus-west-russia .focus-lane-label { font-size: 14px; opacity: .8; }
.focus-west-russia .focus-section-heading .focus-lane-label { font-size: 13px; font-weight: 700; opacity: .95; }
.focus-section-rule { fill: none; stroke-width: 3; stroke-linecap: square; opacity: .85; }
@media (prefers-reduced-motion: reduce) {
    .focus-unified-card { transition: none; }
}


/* Flat branch boards: dependencies outside the board are short, explicit references. */
.focus-unified-card .focus-card-badges {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    gap: 3px;
    white-space: nowrap;
}
.focus-unified-card .focus-external-label {
    display: inline-flex;
    align-items: center;
    min-height: 17px;
    padding: 1px 3px;
    border: 1px solid #60a5fa;
    border-radius: 2px;
    background: #1e3a5f;
    color: #dbeafe;
    font-size: 9px;
    line-height: 1.2;
}
.focus-unified-card .focus-card-bottom { gap: 3px; }
.focus-unified-card .focus-card-bottom .focus-cost { white-space: nowrap; font-size: 11px; }
.focus-external-prerequisites {
    border-color: #60a5fa80;
    background: #172d49;
}
.focus-external-prerequisites > small {
    display: block;
    color: #cbd5e1;
    font-size: .68rem;
    line-height: 1.5;
}
.focus-external-reference-list { display: grid; gap: 7px; margin-top: 8px; }
.focus-external-reference { display: flex; align-items: center; gap: 7px; min-width: 0; }
.focus-external-reference > small { flex: 0 0 3.5em; color: #cbd5e1; font-size: .64rem; }
.focus-external-reference .focus-condition { min-width: 0; text-align: left; }


/* ==========================================================================
   v0.80 War-Room Visual Polish, Intuitive Tactical Controls & Mobile UX
   ========================================================================== */

#app {
    height: 100vh;
    height: 100dvh;
}

/* Refined Command Surfaces & Elevation */
.game-top-bar {
    background: linear-gradient(180deg, #182740 0%, #111d32 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 4px 18px rgba(2, 6, 23, 0.42);
}

.top-stat-interactive {
    cursor: pointer;
    padding: 3px 8px;
    margin: -3px -4px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.top-stat-interactive:hover {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.34);
}

.game-left-panel,
.game-right-panel {
    background: linear-gradient(180deg, rgba(20, 32, 52, 0.92) 0%, rgba(14, 23, 38, 0.95) 100%);
}

.panel-section {
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 16px rgba(2, 6, 23, 0.24);
}

.selected-node-card {
    background: linear-gradient(145deg, color-mix(in srgb, var(--faction-color) 16%, #18263d) 0%, #111c2f 100%);
    border: 1px solid color-mix(in srgb, var(--faction-color) 48%, rgba(148, 163, 184, 0.24));
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.32);
}

.ideology-card {
    background: linear-gradient(145deg, color-mix(in srgb, var(--ideology-color, #3b82f6) 14%, #16243a) 0%, #0f1a2c 100%);
    border-color: color-mix(in srgb, var(--ideology-color, #3b82f6) 44%, rgba(148, 163, 184, 0.24));
}

.btn:active:not(:disabled) {
    transform: scale(0.985);
}

/* Strategic Map Visual Clarity & Tactile Target Highlights */
.game-map-container {
    background-color: #111e29;
    background-image:
        radial-gradient(ellipse at 50% 42%, rgba(74, 110, 120, 0.30), transparent 72%),
        linear-gradient(180deg, rgba(8, 15, 28, 0.35) 0%, rgba(8, 15, 28, 0.65) 100%);
}

.map-command-strip.atlas-toolbar {
    background: rgba(15, 25, 42, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 8px 22px rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(12px);
}

.map-province {
    transition: fill 120ms ease, stroke-width 120ms ease;
}

.map-province.move-target {
    fill: color-mix(in srgb, var(--province-color) 36%, #67d4f4);
    stroke: #bae6fd;
    stroke-width: 1.75;
}

.map-province.attack-target {
    fill: color-mix(in srgb, var(--province-color) 46%, #f87171);
    stroke: #fecaca;
    stroke-width: 1.85;
}

/* Floating March-Mode Tactical Banner */
.march-mode-banner {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 16;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(560px, calc(100% - 24px));
    padding: 8px 12px;
    border: 1px solid rgba(96, 165, 250, 0.55);
    border-left: 4px solid #fbbf24;
    border-radius: var(--radius-md);
    background: rgba(15, 25, 44, 0.94);
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(12px);
}

.march-mode-banner-copy {
    min-width: 0;
}

.march-mode-banner-copy strong {
    display: block;
    color: #fef3c7;
    font-size: 0.82rem;
    line-height: 1.3;
}

.march-mode-banner-copy small {
    display: block;
    color: #bfdbfe;
    font-size: 0.72rem;
    line-height: 1.35;
}

/* 1-Tap Preset Ratio Chips in Sliders & Modals */
.tactical-preset-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.preset-chip {
    min-height: 32px;
    padding: 4px 8px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: var(--radius-sm);
    background: rgba(30, 46, 72, 0.65);
    color: #dbeafe;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.preset-chip:hover {
    background: rgba(59, 130, 246, 0.28);
    border-color: #60a5fa;
    color: #ffffff;
}

/* Attack-From Neighbor Quick List on Enemy Provinces */
.attack-from-list {
    margin-bottom: var(--spacing-3);
}

.attack-from-list button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 11px;
    border-color: rgba(248, 113, 113, 0.45);
    background: linear-gradient(90deg, rgba(153, 27, 27, 0.36) 0%, rgba(30, 41, 59, 0.6) 100%);
}

.attack-from-list button:hover {
    border-color: #fca5a5;
    background: linear-gradient(90deg, rgba(185, 28, 28, 0.52) 0%, rgba(51, 65, 85, 0.75) 100%);
}

.attack-from-list button small {
    color: #fecaca;
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
}

/* Desktop Focus Detail Sheet Bar Hidden */
.mobile-focus-sheet-bar {
    display: none;
}

.focus-detail-body-content {
    display: contents;
}

/* Mobile Experience Polish (Phones & Compact Touch Screens) */
@media (max-width: 760px) {
    .march-mode-banner {
        top: 52px;
        width: calc(100% - 16px);
        padding: 7px 10px;
    }

    .march-mode-banner .btn {
        min-height: 36px;
        padding-inline: 10px;
        flex-shrink: 0;
    }

    .preset-chip {
        min-height: 38px;
        font-size: 0.78rem;
    }

    /* 5-Tab Mobile Dock (地图 / 行动 / 国策 / 情报 / 战报) */
    .mobile-panel-dock {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
        padding: 6px 8px;
        background: rgba(13, 22, 38, 0.96);
        border-color: rgba(148, 163, 184, 0.28);
    }

    .mobile-panel-dock button {
        min-height: 44px;
        font-size: 0.82rem;
    }

    /* Upgraded Two-Row Mobile Tactical Province Bar */
    .mobile-node-chip {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        bottom: calc(66px + env(safe-area-inset-bottom));
        padding: 9px 11px;
        background: rgba(14, 24, 42, 0.96);
        box-shadow: 0 -12px 32px rgba(2, 6, 23, 0.52);
    }

    .mobile-node-chip.is-ordering {
        border-color: rgba(251, 191, 36, 0.65);
        box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35), 0 -12px 32px rgba(2, 6, 23, 0.55);
    }

    .mobile-node-quick-strip {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .mobile-node-quick-strip .btn {
        flex: 1 1 0;
        min-width: 68px;
        min-height: 40px;
        padding: 0 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .mobile-panel-none:has(.mobile-node-chip) .atlas-caption {
        display: none;
    }

    /* Collapsible Mobile Focus Detail Bottom Sheet */
    .mobile-focus-sheet-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    }

    .mobile-focus-sheet-summary {
        min-width: 0;
        flex: 1;
        cursor: pointer;
    }

    .mobile-focus-sheet-summary strong {
        display: block;
        color: var(--color-text-main);
        font-size: 0.92rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-focus-sheet-summary small {
        display: block;
        color: var(--color-text-muted);
        font-size: 0.72rem;
    }

    .mobile-focus-sheet-toggle {
        min-height: 36px;
        padding: 0 10px;
        font-size: 0.75rem;
        flex-shrink: 0;
    }

    .focus-detail-panel {
        max-height: min(46svh, 380px);
        overflow-y: auto;
        transition: max-height 180ms ease, padding 180ms ease;
    }

    .focus-detail-panel.is-sheet-collapsed {
        max-height: none;
        overflow: hidden;
        padding-block: 8px 10px;
    }

    .focus-detail-panel.is-sheet-collapsed .focus-detail-body-content {
        display: none;
    }

    .focus-detail-panel.is-sheet-collapsed .mobile-focus-sheet-bar {
        margin-bottom: 6px;
        padding-bottom: 6px;
    }

    .focus-tree-scroll {
        padding-bottom: 148px;
    }
}
