/* ── WARLORDS – Historical Dark Theme ──────────────────────────────────── */

:root {
    --bg-darkest: #0a0908;
    --bg-dark: #12100e;
    --bg-panel: rgba(26, 23, 20, 0.78);
    --bg-panel-hover: rgba(38, 34, 30, 0.88);
    --bg-input: #0d0c0a;
    --border: #423629;
    --border-light: #6e5b47;
    --text: #e6dfd3;
    --text-dim: #9c8e7d;
    --text-bright: #fffdfa;
    --accent: #d4af37; /* Bronze / Warm Gold */
    --accent-glow: rgba(212, 175, 55, 0.25);
    --accent-red: #b22222; /* Battle Red */
    --accent-green: #2e8b57; /* Tactical Forest Green */
    --accent-gold: #ffd700;
    --team-blue: #3b6ea5; /* Standard blue faction */
    --team-blue-bg: #1c355e;
    --team-red: #c94a4a; /* Standard red faction */
    --team-red-bg: #631d1d;
    --panel-radius: 4px;
}

/* ── Version stamp (top-left, always on top) ──────────────────────── */
#version-overlay {
    position: fixed;
    top: 6px;
    left: 8px;
    z-index: 100000;
    pointer-events: none;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(10, 9, 8, 0.8);
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    letter-spacing: 0.05em;
    user-select: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-darkest);
    color: var(--text);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ── Screens ────────────────────────────────────────────── */
.screen {
    display: none;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: linear-gradient(rgba(16, 14, 12, 0.98), rgba(10, 9, 8, 1));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}
.screen.active { display: flex; }

/* Keep main gameplay/editor screens clear of menu background overrides */
#screen-battle, #screen-setup, #screen-map-editor {
    background: var(--bg-darkest);
    background-image: none;
}

/* ── Main Menu ──────────────────────────────────────────── */
#screen-menu {
    justify-content: flex-start;
    align-items: center;
    padding-left: 8%;
    background-image: radial-gradient(ellipse at 30% 50%, rgba(40, 33, 24, 1) 0%, rgba(10, 9, 8, 1) 70%);
}
.menu-container {
    text-align: left;
    width: 440px;
    max-width: 90vw;
    background: rgba(22, 19, 16, 0.72);
    padding: 40px;
    border-radius: 6px;
    border: 1px solid rgba(184, 134, 11, 0.25);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: menu-slide-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes menu-slide-in {
    from { transform: translateX(-40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.game-title {
    margin: 0 0 2rem;
    text-align: center;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: normal;
    line-height: 1;
}
.game-title-name {
    display: block;
    font-size: 3.4rem;
    letter-spacing: 0.12em;
    color: var(--accent);
    text-shadow: 0 0 18px var(--accent-glow);
}
.game-title-tagline {
    display: block;
    margin-top: 0.6rem;
    font-size: 0.8rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-top: -1.5rem;
    margin-bottom: 2.5rem;
    font-style: italic;
    letter-spacing: 0.5px;
    text-align: left;
}
.menu-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.menu-row {
    display: flex;
    gap: 10px;
}
.menu-row .btn { flex: 1; }

/* ── Color Picker ───────────────────────────────────────── */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.color-picker-row label {
    color: var(--text-dim);
    font-size: 0.9rem;
    white-space: nowrap;
}
input[type="color"] {
    width: 48px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background: var(--bg-input);
    cursor: pointer;
    padding: 2px;
}
input[type="color"]:hover {
    border-color: var(--border-light);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    padding: 11px 22px;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background: var(--bg-panel);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.btn:hover {
    background: var(--bg-panel-hover);
    border-color: var(--border-light);
    color: var(--text-bright);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.btn-primary {
    background: linear-gradient(180deg, #534533 0%, #3e3325 100%);
    border-color: var(--accent);
    color: #fffdfa;
}
.btn-primary:hover {
    background: linear-gradient(180deg, #6c5a43 0%, #534533 100%);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}
.btn-accent {
    background: linear-gradient(180deg, #8c2a2a 0%, #631d1d 100%);
    border-color: var(--accent-red);
    color: #fff;
}
.btn-accent:hover { 
    background: linear-gradient(180deg, #b22222 0%, #8c2a2a 100%);
    box-shadow: 0 0 10px rgba(178, 34, 34, 0.2);
}
.btn-secondary {
    background: #2b2520;
    border-color: var(--border);
}
.btn-secondary:hover {
    background: #3c342d;
    border-color: var(--border-light);
}
.btn-small { padding: 6px 14px; font-size: 0.85rem; }
.btn-tiny { padding: 4px 10px; font-size: 0.8rem; }
.btn-stance, .btn-order {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-width: 70px;
}
.btn-stance.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Inputs ─────────────────────────────────────────────── */
input[type="text"], select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

input[type="number"] {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Panels ─────────────────────────────────────────────── */
.panel-container {
    background: rgba(22, 19, 16, 0.78);
    border: 1px solid rgba(184, 134, 11, 0.25);
    border-radius: 6px;
    padding: 30px;
    margin: auto;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}
.panel-header h2 { 
    font-size: 1.5rem; 
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent);
}

/* ── Conquest / Campaign ────────────────────────────────── */
#screen-conquest-setup,
#screen-campaign {
    background: var(--bg-darkest);
}
.conquest-setup-container {
    max-width: 620px;
}
.conquest-setup-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}
.conquest-ruleset-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(13, 19, 33, 0.9);
    color: var(--text);
    padding: 14px;
    text-align: left;
    cursor: pointer;
}
.conquest-ruleset-card:hover,
.conquest-ruleset-card.active {
    border-color: var(--accent);
    background: rgba(21, 101, 192, 0.28);
}
.conquest-ruleset-card span {
    display: block;
    margin-bottom: 6px;
    color: var(--text-bright);
    font-weight: 700;
}
.conquest-ruleset-card small {
    color: var(--text-dim);
    line-height: 1.35;
}
.campaign-shell {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
}
.campaign-sidebar {
    position: absolute;
    top: 14px;
    bottom: 14px;
    z-index: 3;
    width: min(320px, calc(100vw - 28px));
    background: rgba(19, 27, 46, 0.86);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(8px);
}
.campaign-right {
    right: 14px;
    width: min(360px, calc(100vw - 28px));
    transition: transform 0.18s ease, opacity 0.18s ease;
}
.campaign-left {
    left: 14px;
    top: 64px;
    bottom: auto;
    width: min(280px, calc(100vw - 28px));
    max-height: calc(100vh - 92px);
}
.campaign-right.collapsed {
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(100% + 18px));
}
.campaign-map-wrap {
    position: absolute;
    inset: 0;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: #07111a;
    overflow: hidden;
}
.conquest-queue-modal {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 10, 18, 0.45);
    backdrop-filter: blur(3px);
}
.conquest-queue-dialog {
    width: min(320px, calc(100vw - 32px));
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(19, 27, 46, 0.94);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
    padding: 20px;
    text-align: center;
}
.conquest-queue-title {
    color: var(--text-bright);
    font-weight: 700;
    margin-bottom: 10px;
}
.conquest-queue-timer {
    color: var(--accent-gold);
    font-size: 2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin-bottom: 16px;
}
#campaign-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}
.campaign-map-controls {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 4;
    display: flex;
    gap: 8px;
}
.campaign-map-controls .btn,
.campaign-sidebar-header .btn {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}
.campaign-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.campaign-resources {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.campaign-resources div,
.campaign-army-summary,
.campaign-city-detail,
.campaign-queue-row,
.campaign-events div {
    border: 1px solid rgba(58, 79, 122, 0.6);
    border-radius: 6px;
    background: rgba(8, 12, 20, 0.45);
    padding: 10px;
}
.campaign-resources span,
.campaign-section-title,
.campaign-city-row small,
.campaign-queue-row small {
    color: var(--text-dim);
    font-size: 0.78rem;
}
.campaign-resources strong {
    display: block;
    margin-top: 4px;
    color: var(--text-bright);
}
.campaign-army-summary h3,
.campaign-city-detail h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}
.campaign-unlock-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.campaign-unlock-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    border: 1px solid rgba(58, 79, 122, 0.5);
    border-radius: 6px;
    background: rgba(8, 12, 20, 0.32);
    padding: 8px;
}
.campaign-unlock-row strong,
.campaign-unlock-row span:last-child {
    display: block;
}
.campaign-unlock-row strong {
    color: var(--text-bright);
    font-size: 0.82rem;
    margin-bottom: 3px;
}
.campaign-unlock-row span:last-child,
.campaign-unlock-empty {
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.35;
}
.campaign-unlock-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #07111a;
    border-radius: 50%;
    color: #101827;
    font-weight: 800;
    font-size: 0.72rem;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}
.campaign-unlock-icon-unit {
    background: #ffd166;
}
.campaign-unlock-icon-tech {
    background: #62d6ff;
}
.campaign-unlock-empty {
    margin-top: 10px;
}
.campaign-actions,
.campaign-ruleset-tabs {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}
.campaign-ruleset-tabs .btn {
    flex: 1;
}
.campaign-ruleset-tabs .btn.active {
    border-color: var(--accent);
    background: rgba(21, 101, 192, 0.34);
    color: var(--text-bright);
}
.campaign-section-title {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin: 4px 0 0;
}
.campaign-city-list,
.campaign-recruitment-list,
.campaign-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.campaign-city-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(13, 19, 33, 0.9);
    color: var(--text);
    padding: 9px 10px;
    text-align: left;
    cursor: pointer;
}
.campaign-city-row:hover,
.campaign-city-row.selected {
    border-color: var(--accent);
    background: rgba(21, 101, 192, 0.26);
}
.campaign-queue-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.campaign-army-marker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.conquest-marker-summary {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}
.conquest-marker-preview,
.conquest-banner-option-preview {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(180, 202, 238, 0.32);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f5f8ff;
    font-size: 1.05rem;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.22);
}
.conquest-marker-summary strong,
.conquest-marker-summary small {
    display: block;
}
.conquest-marker-summary small {
    color: var(--text-dim);
    font-size: 0.78rem;
}
.conquest-banner-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.conquest-banner-option {
    border: 1px solid rgba(58, 79, 122, 0.72);
    border-radius: 6px;
    background: rgba(8, 12, 20, 0.48);
    padding: 6px;
    cursor: pointer;
}
.conquest-banner-option:hover,
.conquest-banner-option.selected {
    border-color: var(--accent);
    background: rgba(21, 101, 192, 0.28);
}
.conquest-banner-option-preview {
    width: 100%;
    height: 34px;
    font-size: 0.95rem;
}
@media (max-width: 900px) {
    .conquest-setup-layout {
        grid-template-columns: 1fr;
    }
    .campaign-shell {
        overflow-y: auto;
    }
    .campaign-sidebar {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        width: calc(100% - 28px);
        max-height: none;
        margin: 14px;
    }
    .campaign-right {
        position: fixed;
        top: 14px;
        right: 14px;
        bottom: 14px;
        max-height: calc(100vh - 28px);
        margin: 0;
    }
    .campaign-left {
        position: fixed;
        top: 64px;
        left: 14px;
        width: min(280px, calc(100vw - 28px));
        max-height: calc(100vh - 92px);
        margin: 0;
    }
    .campaign-map-wrap {
        position: fixed;
        min-height: 100vh;
    }
}

#screen-map-editor {
    background:
        radial-gradient(circle at top left, rgba(74, 158, 255, 0.12), transparent 34%),
        linear-gradient(135deg, #09111b, #111a2a 54%, #0b111a);
    overflow: hidden;
}

.conquest-lab-shell {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.conquest-lab-map-wrap {
    position: absolute;
    inset: 0;
    background: #07111a;
}

#conquest-lab-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    touch-action: none;
}

.conquest-lab-map-controls {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 4;
}

.conquest-lab-panel {
    position: absolute;
    top: 14px;
    bottom: 14px;
    z-index: 3;
    width: min(360px, calc(100vw - 28px));
    overflow-y: auto;
    padding: 16px;
    border: 1px solid rgba(90, 113, 151, 0.34);
    border-radius: 8px;
    background: rgba(15, 23, 38, 0.9);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(8px);
}

.conquest-lab-left {
    left: 14px;
}

.conquest-lab-right {
    right: 14px;
}

.conquest-lab-list {
    max-height: calc(100vh - 330px);
}

.conquest-lab-list .editor-list-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conquest-lab-list .editor-list-item small {
    color: var(--text-dim);
    font-size: 0.76rem;
}

.conquest-lab-selected-title {
    color: var(--text-bright);
    font-weight: 700;
    line-height: 1.35;
}

.conquest-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.conquest-picker-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 26px;
}

.conquest-picker-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(118, 185, 255, 0.45);
    border-radius: 6px;
    background: rgba(43, 72, 116, 0.68);
    color: var(--text);
    padding: 4px 7px;
    font-size: 0.76rem;
    cursor: pointer;
}

.conquest-picker-chip span {
    color: #ffd166;
    font-weight: 700;
}

.conquest-picker-empty {
    color: var(--text-dim);
    font-size: 0.78rem;
    align-self: center;
}

.conquest-picker-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: start;
}

.conquest-picker-search-wrap {
    position: relative;
    min-width: 0;
}

.conquest-picker-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}

.conquest-picker-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.conquest-picker-suggestions {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid rgba(90, 113, 151, 0.65);
    border-radius: 6px;
    background: #0d1321;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
    padding: 4px;
}

.conquest-picker-suggestion {
    width: 100%;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: block;
    font: inherit;
    font-size: 0.82rem;
    overflow: hidden;
    padding: 7px 8px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conquest-picker-suggestion:hover,
.conquest-picker-suggestion:focus-visible {
    background: rgba(74, 158, 255, 0.18);
    color: var(--text-bright);
    outline: none;
}

.conquest-picker-suggestion-empty {
    color: var(--text-dim);
    font-size: 0.78rem;
    padding: 7px 8px;
}

.editor-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(90, 113, 151, 0.26);
    border-radius: 12px;
    background: rgba(9, 15, 25, 0.6);
    margin-bottom: 14px;
}

.editor-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8cb8ff;
}

.editor-help {
    color: var(--text-dim);
    font-size: 0.78rem;
    line-height: 1.45;
}

.editor-row {
    display: flex;
    gap: 8px;
}

.editor-row > * {
    flex: 1;
}

.editor-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.editor-field-grid-compact {
    grid-template-columns: 1fr;
}

.editor-field-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.editor-field-grid input,
.editor-field-grid select {
    width: 100%;
    min-width: 0;
}

.editor-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.editor-list-item {
    width: 100%;
    text-align: left;
    background: rgba(18, 30, 49, 0.94);
    border: 1px solid rgba(90, 113, 151, 0.28);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
}

.editor-list-item.selected {
    border-color: #ffd54f;
    box-shadow: 0 0 0 1px rgba(255, 213, 79, 0.4);
}

.editor-list-empty {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.editor-json-preview {
    min-height: 160px;
    max-height: 320px;
    overflow: auto;
    padding: 12px;
    border-radius: 10px;
    background: rgba(6, 10, 18, 0.9);
    border: 1px solid rgba(90, 113, 151, 0.2);
    color: #d8e3f3;
    font-size: 0.78rem;
    line-height: 1.4;
}

.editor-stats {
    margin-top: 4px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.side-panel {
    position: absolute;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 12px;
    overflow-y: auto;
}
.left-panel {
    left: 8px;
    top: 50px;
    bottom: 80px;
    width: 220px;
    border-radius: var(--panel-radius);
}
.right-panel {
    right: 8px;
    top: 50px;
    bottom: 80px;
    width: 240px;
    border-radius: var(--panel-radius);
}

/* ── HUD Bars ───────────────────────────────────────────── */
.hud-bar {
    position: absolute;
    left: 0; right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10;
}
.top-bar { top: 0; justify-content: center; }
.battle-menu-button {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    min-width: 0;
    padding: 0;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: rgba(212, 175, 55, 0.45);
    background: rgba(212, 175, 55, 0.12);
    font-size: 1.2rem;
    line-height: 1;
}
.battle-menu-button:hover {
    background: rgba(212, 175, 55, 0.22);
}
.hud-daynight {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.22);
    font-size: 18px;
    line-height: 1;
}
.hud-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #cfd8dc;
    cursor: pointer;
    user-select: none;
}
.hud-toggle input { margin: 0; cursor: pointer; }
.bottom-bar {
    bottom: 0;
    justify-content: center;
    gap: 0;
    padding: 4px 8px;
    height: 74px;
}

/* ── Unit Roster Bar ────────────────────────────────────── */
.army-follow-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding-right: 8px;
    flex-shrink: 0;
    max-width: min(240px, 30vw);
}
#follow-status {
    font-size: 11px;
    max-height: 30px;
    overflow-y: auto;
}
.unit-roster {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
    height: 100%;
    padding: 0 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.unit-roster::-webkit-scrollbar { height: 3px; }
.unit-roster::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.roster-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 3px 4px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s, opacity 0.15s;
    flex-shrink: 0;
    min-width: 48px;
    background: var(--bg-darkest);
    position: relative;
}
.roster-card:hover { border-color: var(--border-light); }
.roster-card.selected { border-color: var(--accent-gold); box-shadow: 0 0 6px var(--accent-gold); }
.roster-card.dead { opacity: 0.3; filter: grayscale(0.8); }
.roster-card.routed { opacity: 0.5; }
.roster-card.command-group-0 { --command-color: #7cc7ff; }
.roster-card.command-group-1 { --command-color: #ffb15f; }
.roster-card.command-group-2 { --command-color: #8ddf8a; }
.roster-card.command-group-3 { --command-color: #d88cff; }
.roster-card-img {
    width: 36px;
    height: 36px;
    image-rendering: pixelated;
}
.roster-card-general {
    position: absolute;
    top: 1px;
    right: 1px;
    font-size: 0.6rem;
    color: var(--accent-gold);
    text-shadow: 0 0 3px #000;
    pointer-events: none;
}
.roster-card-captain {
    position: absolute;
    top: 6px;
    left: 3px;
    width: 13px;
    height: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    background: var(--command-color, #7cc7ff);
    color: #061018;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 4px #000;
    pointer-events: none;
}
.roster-card-command-dot {
    position: absolute;
    top: 8px;
    left: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--command-color, #7cc7ff);
    box-shadow: 0 0 4px #000;
    pointer-events: none;
}
.roster-bars {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.roster-bar {
    height: 3px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}
.roster-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.2s;
}
.roster-bar-str .roster-bar-fill { background: var(--accent-green); }
.roster-bar-mor .roster-bar-fill { background: var(--accent-gold); }
.roster-bar-ammo .roster-bar-fill { background: #2196f3; }
.roster-bar-ammo.no-ammo { visibility: hidden; }

/* ── Battle Command Strip ───────────────────────────────── */
#unit-controls {
    position: absolute;
    left: 244px;
    right: 226px;
    bottom: 84px;
    z-index: 14;
    min-height: 54px;
    padding: 6px 8px;
    background: rgba(11, 17, 30, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
#unit-controls::-webkit-scrollbar { height: 3px; }
#unit-controls::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.command-cluster {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 4px;
    background: rgba(4, 8, 16, 0.36);
    border: 1px solid rgba(90, 113, 151, 0.28);
    border-radius: 6px;
}
#artillery-controls { align-items: stretch; }
.artillery-battery-controls { display: grid; grid-template-columns: auto auto auto; gap: 4px 8px; min-width: 300px; }
.artillery-battery-controls strong, .artillery-battery-controls small { grid-column: 1 / -1; font-size: 0.7rem; }
.artillery-battery-controls label { font-size: 0.7rem; white-space: nowrap; }
.artillery-battery-controls select { max-width: 110px; }
.artillery-gun-status { font-size: 0.72rem; padding: 2px 0; }
.command-toggle {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 1rem;
    line-height: 1;
    font-weight: 700;
}
.command-toggle.command-text {
    width: auto;
    min-width: 58px;
    padding: 0 10px;
    font-size: 0.75rem;
}
.command-toggle.active,
#unit-controls .btn-order.active {
    background: var(--accent);
    color: var(--bg-darkest);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.25);
}
.stance-cluster {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(2, 32px);
    align-items: center;
    justify-items: center;
    gap: 2px;
    padding: 3px 5px;
}
.stance-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.78rem;
}
.stance-hold { grid-column: 2; grid-row: 1; }
.stance-give { grid-column: 1; grid-row: 2; }
.stance-push { grid-column: 3; grid-row: 2; }
.general-cluster .formation-select {
    height: 36px;
    max-width: 150px;
    padding: 0 8px;
    font-size: 0.78rem;
}

/* ── Unit Panel ─────────────────────────────────────────── */
.unit-panel h4 {
    font-size: 0.9rem;
    color: var(--accent-gold);
    margin-bottom: 8px;
}
.unit-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 2px 0;
}
.unit-stat .label { color: var(--text-dim); }
.stat-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    margin: 3px 0;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.2s;
}
.stat-bar-strength .stat-bar-fill { background: var(--accent-green); }
.stat-bar-morale .stat-bar-fill { background: var(--accent-gold); }
.hint { color: var(--text-dim); font-size: 0.85rem; }

/* ── Total War-style unit info pane ─────────────────────────────── */
.left-panel.unit-panel {
    width: 290px;
    padding: 0;
    background: linear-gradient(180deg, rgba(30, 26, 21, 0.94), rgba(18, 16, 13, 0.94));
    border: 1px solid #6e5b47;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 24px rgba(0, 0, 0, 0.5);
}
/* Multi-select / group panels keep their normal inner padding. */
.left-panel.unit-panel > #unit-info-content:not(:has(> .tw-pane)) { padding: 12px; }

.tw-pane { font-size: 0.78rem; color: var(--text); }

.tw-header {
    display: flex;
    gap: 10px;
    padding: 10px;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--team) 45%, transparent), transparent 75%),
        rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid #6e5b47;
}
.tw-portrait {
    position: relative;
    flex: 0 0 64px;
    height: 76px;
    border: 2px solid #b8955a;
    border-radius: 3px;
    background:
        radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--team) 55%, #000), #0b0a09 80%);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 0 0 1px #000;
    overflow: hidden;
}
.tw-portrait-img {
    position: absolute;
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    object-fit: contain;
    image-rendering: auto;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7));
}
.tw-general {
    position: absolute;
    top: 1px;
    left: 3px;
    color: var(--accent-gold);
    font-size: 15px;
    text-shadow: 0 0 3px #000, 0 0 2px #000;
}
.tw-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tw-name {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: #f3e2b8;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tw-sub { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tw-rank { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.tw-rank-text { color: #e8c877; font-weight: 700; font-size: 0.74rem; }
.tw-cost { margin-left: auto; color: var(--text-dim); font-size: 0.7rem; }

/* Veterancy chevrons (match the on-map unit chevrons) */
.tw-chevrons { display: inline-flex; flex-direction: column-reverse; align-items: center; gap: 0; }
.tw-chevrons.empty { color: var(--text-dim); font-size: 0.7rem; font-style: italic; }
.tw-chevrons i {
    display: block;
    width: 9px;
    height: 9px;
    margin-top: -4px;
    border-left: 3px solid #ffd24a;
    border-top: 3px solid #ffd24a;
    transform: rotate(45deg);
    filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000);
}
.tw-chevrons i:last-child { margin-top: 4px; }

.tw-statebar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(110, 91, 71, 0.5);
}
.tw-pill {
    padding: 1px 7px;
    border: 1px solid #5a4a38;
    border-radius: 10px;
    background: rgba(60, 50, 38, 0.6);
    color: #e6dfd3;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tw-pill.combat { border-color: #a33; background: rgba(140, 30, 30, 0.55); color: #ffd6d6; }
.tw-pill.move { border-color: #3b6ea5; background: rgba(40, 80, 130, 0.5); }
.tw-pill.bad { border-color: #c44; background: rgba(170, 30, 30, 0.7); color: #fff; }
.tw-pill.guard { border-color: #26c6da; color: #9eeef8; }
.tw-pill.aggr { border-color: #ffa726; color: #ffd8a0; }
.tw-pill.enemy { border-color: #c94a4a; color: #ffb4b4; }

.tw-section { padding: 7px 10px 8px; border-bottom: 1px solid rgba(110, 91, 71, 0.35); }
.tw-section:last-child { border-bottom: none; }
.tw-section-title {
    margin-bottom: 5px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: #c9a65e;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tw-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(201, 166, 94, 0.5), transparent);
}

/* Vitals (troops / morale / fatigue / ammo / xp) */
.tw-vital { margin-bottom: 5px; }
.tw-vital:last-child { margin-bottom: 0; }
.tw-vital-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
.tw-vital-label { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tw-vital-state { font-size: 0.72rem; font-weight: 700; color: #e6dfd3; }
.tw-vital-value { margin-left: auto; font-variant-numeric: tabular-nums; color: #f3e9d6; font-weight: 600; }
.tw-vital-bar {
    height: 7px;
    background: #0b0a09;
    border: 1px solid #3a3026;
    border-radius: 1px;
    overflow: hidden;
}
.tw-vital-fill {
    height: 100%;
    transition: width 0.25s;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.tw-vital.troops .tw-vital-fill { background: linear-gradient(180deg, #5fbf6e, #2e8b57); }
.tw-vital.morale .tw-vital-fill { background: linear-gradient(180deg, #ffe27a, #c9a227); }
.tw-vital.fatigue .tw-vital-fill { background: linear-gradient(180deg, #ffb565, #d0701f); }
.tw-vital.ammo .tw-vital-fill { background: linear-gradient(180deg, #6fb4ff, #2a6fc0); }
.tw-vital.xp .tw-vital-fill { background: linear-gradient(180deg, #d9b3ff, #8e5bd0); }

.tw-pane .good { color: #7fd88f; }
.tw-pane .warn { color: #ffb74d; }
.tw-pane .bad { color: #ff6b6b; }

/* Stat rows: label | bar | value */
.tw-stat {
    display: grid;
    grid-template-columns: 96px 1fr 42px;
    align-items: center;
    gap: 6px;
    padding: 1.5px 0;
}
.tw-stat:hover { background: rgba(255, 220, 150, 0.05); }
.tw-stat-label { color: #cdbfa8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-stat-bar {
    position: relative;
    height: 6px;
    background: #0b0a09;
    border: 1px solid #3a3026;
    overflow: hidden;
}
.tw-stat-fill, .tw-stat-bonus { position: absolute; top: 0; bottom: 0; left: 0; }
.tw-stat-fill { background: linear-gradient(180deg, #e9d29a, #a8874a); }
.tw-stat-bonus { background: linear-gradient(180deg, #a6f0a0, #4caf50); }
.tw-stat-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: #f3e9d6; }
.tw-stat-value.buffed { color: #8fe28a; }

/* Attribute tags */
.tw-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tw-tag {
    padding: 2px 6px;
    border: 1px solid #6e5b47;
    background: rgba(80, 64, 44, 0.45);
    color: #ecdcbc;
    font-size: 0.7rem;
    border-radius: 2px;
    cursor: help;
}
.tw-tag.gold { border-color: #c9a227; color: #ffe27a; }
.tw-tag.dim { color: var(--text-dim); }
.tw-tag.skill { border-color: #8e5bd0; color: #e2c9ff; background: rgba(90, 50, 140, 0.35); }

/* Status key/values */
.tw-kv { display: flex; justify-content: space-between; gap: 8px; padding: 1.5px 0; }
.tw-kv-label { color: #cdbfa8; }
.tw-kv-value { text-align: right; font-weight: 600; }

/* Battle record */
.tw-record { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tw-record-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 2px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #3a3026;
}
.tw-record-value { font-size: 1rem; font-weight: 700; color: #f3e2b8; font-variant-numeric: tabular-nums; }
.tw-record-label { font-size: 0.64rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Lobby ──────────────────────────────────────────────── */
#screen-lobby {
    justify-content: center;
    align-items: center;
}
.panel-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.lobby-settings-row {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.lobby-setting {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lobby-setting label { white-space: nowrap; color: var(--text-dim); font-size: 0.85rem; }
.lobby-setting select {
    background: var(--bg-darkest);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
}
.lobby-setting input[type="color"] {
    width: 36px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-darkest);
    cursor: pointer;
    padding: 2px;
}
.lobby-teams {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.team-column {
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    padding: 12px;
    background: var(--bg-darkest);
}
.team-heading {
    margin: 0 0 10px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.team-slot-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.team-slot {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.team-slot:hover { border-color: var(--accent); }
.team-slot.claimed { border-color: var(--accent-green); }
.team-slot.self { border-color: var(--accent-gold); background: #1a1a0f; }
.team-slot.open { text-align: center; }
.slot-open-label { color: var(--text-dim); font-size: 0.85rem; }
.btn-add-bot {
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 0.75rem;
  border: 1px solid var(--border, #555);
  background: rgba(255,255,255,0.06);
  color: var(--text, #eee);
  border-radius: 3px;
  cursor: pointer;
}
.btn-add-bot:hover { background: rgba(255,255,255,0.14); }
.slot-bot-pill {
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 2px;
  background: rgba(255, 180, 60, 0.25);
  color: #ffc864;
}
.slot-player {
    display: flex;
    align-items: center;
    gap: 8px;
}
.slot-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.2);
}
.slot-name { font-size: 0.9rem; }
.slot-status { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }
.lobby-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.lobby-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}
.btn-lobby-action {
    min-width: 160px;
    max-width: 240px;
    padding: 8px 18px;
    flex: 0 0 auto;
}
.btn-lobby-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.6);
}
.army-color-setting {
    margin-left: auto;
}
.culture-icon-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: stretch;
}
.culture-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
    min-width: 78px;
}
.culture-icon-btn:hover {
    border-color: var(--accent);
    color: var(--text-bright);
}
.culture-icon-btn.selected {
    border-color: var(--accent-gold);
    background: #1a1a0f;
    color: var(--text-bright);
    box-shadow: 0 0 6px rgba(212, 160, 84, 0.35);
}
.culture-icon-glyph {
    font-size: 1.4rem;
    line-height: 1;
}
.culture-icon-label {
    font-size: 0.7rem;
    white-space: nowrap;
}
.army-select, .roster-quick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.roster-quick label { white-space: nowrap; }

/* ── Match Setup Screen ─────────────────────────────────── */
.match-setup-panel {
    max-width: 520px;
}
.match-setup-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}
.match-setup-map-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.match-setup-map-section label {
    color: var(--text-dim);
    font-size: 0.85rem;
}
.match-setup-map-section select {
    background: var(--bg-darkest);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.9rem;
    width: 100%;
}
#setup-map-preview {
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-darkest);
}
.match-setup-map-info {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.4;
}
.match-setup-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.match-setup-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.match-setup-field label {
    color: var(--text-dim);
    font-size: 0.85rem;
    white-space: nowrap;
}
.match-setup-field input[type="number"],
.match-setup-field select {
    background: var(--bg-darkest);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.9rem;
    width: 80px;
    text-align: center;
}
.match-setup-field select {
    width: 220px;
    text-align: left;
}
.match-setup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Lobby Countdown ────────────────────────────────────── */
.lobby-countdown {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-gold);
    padding: 8px 0;
    animation: countdown-pulse 1s ease-in-out infinite;
}
.conquest-lobby-timer {
    min-width: min(360px, 100%);
    border: 1px solid rgba(244, 208, 111, 0.35);
    border-radius: 8px;
    background: rgba(244, 208, 111, 0.08);
    color: var(--accent-gold);
    padding: 10px 14px;
    font-variant-numeric: tabular-nums;
}
.conquest-lobby-timer.locked {
    border-color: rgba(255, 107, 107, 0.38);
    background: rgba(255, 107, 107, 0.1);
    color: var(--accent-red);
}
@keyframes countdown-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
/* ── Lobby match info ───────────────────────────────────── */
.lobby-match-info {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

/* ── Setup ──────────────────────────────────────────────── */
#screen-setup { display: none; }
#screen-setup.active { display: block; }
#setup-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    touch-action: none;
}
#screen-setup .left-panel {
    top: 8px;
    bottom: 8px;
    z-index: 10;
}
.deploy-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    max-height: 40vh;
    overflow-y: auto;
}
.deploy-item {
    padding: 6px 8px;
    border-radius: 3px;
    background: var(--bg-darkest);
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
}
.deploy-item:hover { background: var(--bg-panel-hover); }
.deploy-item.selected { background: var(--accent); color: #000; }
.deploy-item.placed { opacity: 0.6; }
.deployment-locked .deploy-item,
.deployment-locked .formation-controls {
    opacity: 0.55;
    pointer-events: none;
}
#btn-ready.active {
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.35);
}
.formation-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.formation-controls label { font-size: 0.85rem; }
.formation-controls select { font-size: 0.82rem; padding: 4px 8px; }

/* ── Battle ─────────────────────────────────────────────── */
#screen-battle { display: none; }
#screen-battle.active { display: block; }
#battle-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: crosshair;
    touch-action: none;
}

/* ── Minimap ────────────────────────────────────────────── */
#minimap-container {
    position: absolute;
    bottom: 82px;
    right: 10px;
    border: 2px solid var(--border);
    border-radius: var(--panel-radius);
    overflow: hidden;
    z-index: 10;
}
#minimap-canvas { display: block; background: #1a2a1a; }

.world-map-overlay {
    z-index: 40;
}

.world-map-panel {
    width: min(1280px, calc(100vw - 48px));
    height: min(820px, calc(100vh - 72px));
    background: rgba(12, 19, 33, 0.98);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.world-map-panel .panel-header {
    padding: 14px 18px;
    align-items: flex-start;
}

.world-map-summary {
    margin-top: 4px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

#world-map-canvas {
    flex: 1;
    width: 100%;
    height: 100%;
    display: block;
    background: linear-gradient(180deg, #0b1322, #0e1629);
}

.city-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    pointer-events: none;
}

.city-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 15, 0.42);
    pointer-events: auto;
}

.city-panel {
    position: absolute;
    top: 24px;
    right: 24px;
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    background: linear-gradient(180deg, rgba(17, 26, 43, 0.98), rgba(11, 17, 30, 0.98));
    border: 1px solid var(--border-light);
    border-radius: 14px;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
}

.city-panel-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    overflow-y: auto;
}

.city-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.city-panel-kicker {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.city-panel-title {
    color: var(--text-bright);
    font-size: 1.4rem;
    font-weight: 700;
}

.city-panel-subtitle {
    color: var(--text-dim);
    font-size: 0.88rem;
    margin-top: 4px;
}

.city-panel-close {
    flex-shrink: 0;
}

.city-readonly-banner {
    padding: 10px 12px;
    border: 1px solid rgba(74, 158, 255, 0.28);
    border-radius: 10px;
    background: rgba(74, 158, 255, 0.08);
    color: var(--text-bright);
    font-size: 0.86rem;
}

.city-section {
    border: 1px solid rgba(58, 79, 122, 0.72);
    border-radius: 12px;
    background: rgba(10, 16, 27, 0.78);
    padding: 14px;
}

.city-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.city-section-title {
    color: var(--text-bright);
    font-size: 0.95rem;
    font-weight: 700;
}

.city-section-meta {
    color: var(--text-dim);
    font-size: 0.78rem;
}

.city-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.city-stat-card {
    border: 1px solid rgba(37, 51, 85, 0.9);
    border-radius: 10px;
    background: rgba(12, 19, 33, 0.92);
    padding: 10px;
}

.city-stat-label {
    color: var(--text-dim);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.city-stat-value {
    color: var(--text-bright);
    font-size: 1.08rem;
    font-weight: 700;
    margin-top: 4px;
}

.city-stat-detail {
    color: var(--text-dim);
    font-size: 0.76rem;
    margin-top: 4px;
}

.city-card-list {
    display: grid;
    gap: 10px;
}

.city-card-item {
    border: 1px solid rgba(37, 51, 85, 0.95);
    border-radius: 10px;
    background: rgba(8, 13, 23, 0.95);
    padding: 10px 12px;
}

.city-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.city-item-title {
    color: var(--text-bright);
    font-size: 0.92rem;
    font-weight: 700;
}

.city-item-subtitle {
    color: var(--text-dim);
    font-size: 0.78rem;
    margin-top: 2px;
}

.city-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.city-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(37, 51, 85, 0.9);
    color: var(--text);
    font-size: 0.72rem;
}

.city-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.city-empty {
    color: var(--text-dim);
    font-size: 0.84rem;
    font-style: italic;
}

.city-recruit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.city-recruit-card {
    border: 1px solid rgba(37, 51, 85, 0.9);
    border-radius: 10px;
    background: rgba(8, 13, 23, 0.95);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.city-recruit-name {
    color: var(--text-bright);
    font-weight: 700;
}

.city-recruit-meta {
    color: var(--text-dim);
    font-size: 0.78rem;
}

/* ── Army Manager ───────────────────────────────────────── */
#screen-armies {
    justify-content: center;
    align-items: center;
}
.army-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 30vh;
    overflow-y: auto;
}
.army-card {
    padding: 12px;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
}
.army-card h4 { margin-bottom: 4px; }
.army-card .unit-count { color: var(--text-dim); font-size: 0.85rem; }
.army-card-units {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.army-card-unit {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: var(--bg-panel);
    border-radius: 3px;
    border: 1px solid var(--border);
}
.army-creator {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.army-creator h3 { margin-bottom: 10px; font-size: 1.1rem; }
.roster-builder {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}
.roster-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.roster-row select { flex: 1; }
.roster-row .btn-tiny { flex-shrink: 0; }

/* ── Match List ─────────────────────────────────────────── */
#screen-match-list {
    justify-content: center;
    align-items: center;
}
.match-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.match-card {
    padding: 12px;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    cursor: pointer;
}
.match-card:hover { border-color: var(--accent); }

/* ── Results ────────────────────────────────────────────── */
#screen-results {
    justify-content: center;
    align-items: center;
}
.results-container {
    max-width: 500px;
    text-align: center;
}
.results-container h2 {
    margin-bottom: 16px;
    font-size: 1.6rem;
}
#results-content {
    text-align: left;
    margin-bottom: 20px;
}
.result-army {
    margin-bottom: 12px;
    padding: 10px;
    background: var(--bg-darkest);
    border-radius: var(--panel-radius);
}
.result-army h4 { margin-bottom: 6px; }
.result-unit {
    font-size: 0.82rem;
    padding: 2px 0;
    display: flex;
    justify-content: space-between;
}
.result-unit.destroyed { color: var(--accent-red); text-decoration: line-through; opacity: 0.7; }
.result-winner {
    font-size: 1.1rem;
    color: var(--accent-gold);
    margin-bottom: 10px;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-darkest); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Quick Roster Builder (inline in lobby) ─────────────── */
#quick-roster-builder {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 350px;
}
.quick-unit-chip {
    font-size: 0.75rem;
    padding: 3px 8px;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
}
.quick-unit-chip:hover { border-color: var(--accent-red); }

/* ── Match ID ───────────────────────────────────────────── */
.match-id {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: monospace;
}

/* ── Army Builder (Card-Based) ──────────────────────────── */
.army-builder-container {
    max-width: 1050px;
}
.army-builder-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.army-builder-top {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* ── Unit Card Grid ─────────────────────────────────────── */
.unit-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    flex: 1 1 0;
    min-width: 0;
    align-content: start;
}
.unit-card {
    padding: 10px;
    background: var(--bg-darkest);
    border: 2px solid var(--border);
    border-radius: var(--panel-radius);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 120px;
    position: relative;
}
.unit-card-add {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    background: var(--team-blue-bg);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
    z-index: 1;
}
.unit-card-add:hover {
    background: var(--accent);
    transform: scale(1.08);
}
.unit-card-add:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: var(--bg-darkest);
    transform: none;
}
.unit-card:hover {
    border-color: var(--border-light);
    background: var(--bg-panel-hover);
}
.unit-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}
.unit-card-sprite {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    object-fit: contain;
}
.unit-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-bright);
    text-align: center;
}
.unit-card-category {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.unit-card-category.infantry {
    background: #1b3a1b;
    color: #6dbf6d;
    border: 1px solid #2d5a2d;
}
.unit-card-category.cavalry {
    background: #3a2a1b;
    color: #d4a054;
    border: 1px solid #5a3d2d;
}
.unit-card-cost {
    font-size: 0.75rem;
    color: var(--accent-gold);
    font-weight: 600;
}
.unit-card-stats {
    display: flex;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-dim);
    flex-wrap: wrap;
    justify-content: center;
}
.unit-card-stats span {
    white-space: nowrap;
}

/* ── Unit Detail Panel ──────────────────────────────────── */
.unit-detail-panel {
    width: 290px;
    min-width: 290px;
    flex: 0 0 290px;
    align-self: flex-start;
    background: linear-gradient(180deg, #16181d 0%, var(--bg-darkest) 100%);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--panel-radius);
    padding: 12px 14px;
    margin-left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.35);
}
.detail-compare-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
}
.detail-compare-header .vs {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
}
.detail-sprite-small {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
    object-fit: contain;
}
.detail-compare-header .cmp-name {
    color: var(--text-bright);
    font-weight: 600;
    flex: 1;
}
.detail-compare-header .cmp-cost {
    color: var(--accent-gold);
    font-weight: 600;
}
.detail-header {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
}
.detail-sprite {
    grid-row: 1 / span 2;
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    object-fit: contain;
}
.detail-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bright);
}
.detail-header .unit-card-category {
    grid-column: 2;
    justify-self: start;
}
.detail-cost {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    font-size: 0.95rem;
    color: var(--accent-gold);
    font-weight: 700;
}
.detail-section {
    border-top: 1px solid var(--border);
    padding-top: 4px;
}
.detail-section-title {
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}
.detail-stat {
    display: grid;
    grid-template-columns: 80px 1fr 30px 32px;
    align-items: center;
    column-gap: 6px;
    font-size: 0.74rem;
    padding: 1px 0;
}
.detail-stat .label { color: var(--text-dim); }
.detail-stat .value {
    color: var(--text-bright);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.detail-stat .stat-bar {
    position: relative;
    height: 7px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}
.detail-stat .stat-bar-base {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #5a7fb5, #8aa9d8);
    border-radius: 3px;
}
.detail-stat .stat-bar-up {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #3da94a, #6bd970);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 4px rgba(107, 217, 112, 0.6);
}
.detail-stat .stat-bar-down {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #b03030, #e04545);
    border-radius: 3px;
    opacity: 0.85;
}
.detail-stat .stat-diff {
    text-align: right;
    font-weight: 700;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}
.detail-stat .stat-diff.up { color: #6bd970; }
.detail-stat .stat-diff.down { color: #e06363; }
.detail-stat .stat-diff.eq { color: var(--text-dim); }
.detail-add-btn {
    margin-top: auto;
    padding: 10px;
    width: 100%;
    background: var(--team-blue-bg);
    border: 1px solid var(--team-blue);
    border-radius: var(--panel-radius);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 600;
}
.detail-add-btn:hover:not(:disabled) {
    background: var(--team-blue);
}
.detail-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Army Bar (bottom row) ──────────────────────────────── */
.army-bar-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.army-bar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.army-bar-header input[type="text"] {
    flex: 1;
    min-width: 150px;
}
.budget-display {
    display: flex;
    align-items: center;
    gap: 6px;
}
.budget-text {
    font-size: 0.82rem;
    color: var(--text-dim);
    white-space: nowrap;
}
.budget-bar {
    width: 80px;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}
.budget-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent-green);
    transition: width 0.2s, background 0.2s;
}
.budget-bar-fill.warning { background: var(--accent-gold); }
.budget-bar-fill.over { background: var(--accent-red); }
.army-unit-count {
    font-size: 0.82rem;
    color: var(--text-dim);
    white-space: nowrap;
}
.army-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-height: 88px;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    margin-bottom: 10px;
    align-content: flex-start;
}
.army-bar-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-style: italic;
}

.army-command-toolbar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
}
.army-command-selected {
    min-width: 110px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-main);
    font-size: 0.82rem;
}
.army-command-limit {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 0.75rem;
}
.btn-mini {
    min-height: 0;
    padding: 4px 8px;
    font-size: 0.72rem;
}
.army-command-row {
    width: 100%;
    display: grid;
    grid-template-columns: 94px 1fr;
    gap: 8px;
    padding: 7px;
    background: #0f1318;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    cursor: pointer;
}
.army-command-row.active {
    border-color: var(--accent-gold);
    box-shadow: inset 0 0 0 1px #ffd70033;
}
.army-command-row.full {
    border-style: dashed;
}
.army-command-row-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    color: var(--text-main);
    font-size: 0.76rem;
}
.army-command-row-label span {
    color: var(--text-dim);
    font-size: 0.68rem;
}
.army-command-row-units {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 72px;
    align-items: flex-start;
}

/* ── Army Mini Card ─────────────────────────────────────── */
.army-mini-card {
    width: 68px;
    padding: 6px 4px;
    background: var(--bg-darkest);
    border: 2px solid var(--border);
    border-radius: var(--panel-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.army-mini-card:hover {
    border-color: var(--accent-red);
}
.army-mini-card:hover::after {
    content: '✕';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: var(--accent-red);
    color: #fff;
    border-radius: 50%;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.army-command-row .army-mini-card:hover::after {
    content: none;
}
.army-mini-card.general {
    border-color: var(--accent-gold);
    box-shadow: 0 0 6px #ffd70033;
}
.army-mini-card.captain {
    border-color: #7cc7ff;
    box-shadow: 0 0 6px #7cc7ff33;
}
.army-mini-card.sub-unit {
    border-color: #6b7b8c;
}
.army-mini-card.selected {
    outline: 2px solid var(--accent-blue);
    outline-offset: 1px;
}
.army-mini-card-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
}
.army-mini-card-sprite {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    object-fit: contain;
}
.army-mini-card-name {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.army-mini-card-general {
    font-size: 0.55rem;
    color: var(--accent-gold);
    cursor: pointer;
    padding: 0 2px;
}
.army-mini-card-general:hover {
    text-shadow: 0 0 4px var(--accent-gold);
}
.army-mini-card-general.muted {
    color: var(--text-dim);
    cursor: default;
}
.army-mini-card-general.muted:hover {
    text-shadow: none;
}
.army-mini-card-cost {
    font-size: 0.6rem;
    color: var(--accent-gold);
}

/* ── Roster Quick Section (Lobby) ───────────────────────── */
.roster-quick-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.roster-quick-section h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* ── Formation Editor Overlay ───────────────────────────── */
.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(8, 12, 20, 0.92);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.battle-menu-overlay {
    z-index: 1100;
    padding: 18px;
}
.battle-menu-panel {
    width: min(420px, 94vw);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    padding: 18px;
}
.battle-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.battle-menu-header h2 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.2;
}
.battle-menu-close {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
}
.battle-menu-actions {
    display: grid;
    gap: 10px;
}
.battle-menu-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 42px;
}
.btn-danger {
    background: rgba(160, 47, 47, 0.88);
    border-color: rgba(255, 126, 126, 0.55);
    color: #fff;
}
.btn-danger:hover {
    background: rgba(190, 58, 58, 0.95);
}

.active-match-modal {
    width: min(440px, 92vw);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    padding: 20px;
}
.active-match-modal h2 {
    margin: 0 0 10px;
    font-size: 1.35rem;
}
.active-match-modal p {
    margin: 0 0 16px;
    color: var(--text-dim);
    line-height: 1.45;
}
.active-match-actions {
    display: grid;
    gap: 10px;
}
.active-match-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 42px;
}

/* ── Auth-gated buttons ─────────────────────────────────── */
button[data-requires-auth="true"]:disabled,
.requires-auth-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

/* ── Campaign Ruleset Chooser Modal ─────────────────────── */
.ruleset-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px 24px;
    width: min(820px, 92vw);
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.ruleset-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.ruleset-modal-header h2 {
    margin: 0;
    color: var(--text-bright);
}
.ruleset-modal-intro {
    margin: 0 0 16px 0;
    color: var(--text-dim);
    font-size: 0.9rem;
}
.ruleset-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.ruleset-card {
    background: var(--bg-elevated, #1a2030);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text);
}
.ruleset-card.in-progress {
    border-color: var(--accent);
    background: rgba(21, 101, 192, 0.18);
}
.ruleset-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-bright);
}
.ruleset-card-blurb {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.35;
}
.ruleset-card-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 8px 10px;
}
.ruleset-card-summary .summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.ruleset-card-summary .summary-row .label {
    color: var(--text-dim);
}
.ruleset-card-summary .summary-row .value {
    color: var(--text-bright);
    font-weight: 600;
}
.ruleset-card-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

/* ── Starter Territory Picker Modal ─────────────────────── */
.starter-territory-overlay {
    z-index: 1100;
}
.starter-territory-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 22px 26px;
    width: min(960px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.starter-territory-header h2 {
    margin: 0 0 4px 0;
    color: var(--text-bright);
}
.starter-territory-header p {
    margin: 0 0 16px 0;
    color: var(--text-dim);
    font-size: 0.9rem;
}
.starter-territory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.starter-territory-card {
    background: var(--bg-elevated, #1a2030);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.starter-territory-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.starter-territory-card-name {
    font-weight: 700;
    color: var(--text-bright);
    font-size: 1.05rem;
}
.starter-territory-tier-badge {
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    color: var(--text-dim);
}
.starter-unlock-section {
    font-size: 0.85rem;
}
.starter-unlock-section .label {
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.starter-unit-icon-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.starter-unit-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 3px 6px;
    color: var(--text-bright);
    font-size: 0.78rem;
}
.starter-unit-chip img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}
.starter-tech-list {
    color: var(--text-bright);
    font-size: 0.8rem;
}
.starter-unlock-empty {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
}
.starter-territory-card-actions {
    margin-top: auto;
}
.starter-territory-card-actions .btn {
    width: 100%;
}

/* ── Conquest Culture Picker ───────────────────────────── */
.culture-picker-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 28px;
    width: min(880px, 92vw);
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.culture-picker-modal h2 {
    margin: 0 0 8px 0;
    color: var(--text-bright);
}
.culture-picker-intro {
    margin: 0 0 18px 0;
    color: var(--text-dim);
    font-size: 0.92rem;
}
.culture-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}
.culture-card {
    background: var(--bg-elevated, #1a2030);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.12s, transform 0.08s;
    font: inherit;
}
.culture-card:hover {
    border-color: var(--accent, #4a90e2);
    transform: translateY(-1px);
}
.culture-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.culture-card-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}
.culture-card-name {
    font-weight: 600;
    color: var(--text-bright);
}
.culture-card-row {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-top: 4px;
    line-height: 1.35;
}
.culture-card-row strong {
    color: var(--text);
}
.culture-card-none {
    color: var(--text-dim);
    font-style: italic;
}

/* ── Custom Campaign Units ───────────────────────────────────── */
.custom-unit-editor {
    display: grid;
    gap: 12px;
}

.custom-unit-library {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 12px;
}

.custom-unit-library-sidebar,
.custom-unit-library-editor {
    min-width: 0;
}

.custom-unit-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.custom-unit-library-header small {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 2px;
}

.custom-unit-library-list {
    display: grid;
    gap: 6px;
}

.custom-unit-library-item {
    width: 100%;
    border: 1px solid rgba(154, 178, 220, 0.22);
    border-radius: 6px;
    background: rgba(12, 20, 34, 0.72);
    color: var(--text);
    padding: 8px;
    text-align: left;
    cursor: pointer;
}

.custom-unit-library-item.active {
    border-color: rgba(244, 208, 111, 0.64);
    background: rgba(244, 208, 111, 0.1);
}

.custom-unit-library-item span {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 2px;
}

.custom-unit-template {
    border: 1px solid rgba(154, 178, 220, 0.28);
    border-radius: 8px;
    background: rgba(12, 20, 34, 0.72);
    padding: 12px;
}

.custom-unit-template-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.custom-unit-template-header small {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 2px;
}

.custom-unit-template-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.custom-unit-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 8px;
}

.custom-unit-form label {
    display: grid;
    gap: 4px;
    color: var(--text-dim);
    font-size: 0.76rem;
}

.custom-unit-form input,
.custom-unit-form select {
    width: 100%;
    min-height: 32px;
    border: 1px solid rgba(154, 178, 220, 0.3);
    border-radius: 6px;
    background: #101a2b;
    color: var(--text-bright);
    padding: 4px 8px;
}

.custom-training-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.custom-training-stepper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px 42px 30px;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(154, 178, 220, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.035);
    padding: 6px;
}

.custom-training-stepper span {
    color: var(--text);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-training-stepper input {
    width: 42px;
    min-height: 28px;
    border: 1px solid rgba(154, 178, 220, 0.22);
    border-radius: 6px;
    background: #101a2b;
    color: var(--text-bright);
    text-align: center;
}

@media (max-width: 760px) {
    .custom-unit-library {
        grid-template-columns: 1fr;
    }
}

.custom-unit-preview {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(154, 178, 220, 0.18);
}

.custom-unit-preview-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-bright);
    font-weight: 700;
    margin-bottom: 6px;
}

.custom-unit-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    gap: 6px;
}

.custom-unit-preview-grid span {
    border: 1px solid rgba(154, 178, 220, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 4px 6px;
    font-size: 0.74rem;
    text-align: center;
}

.unit-card.custom-unit-card {
    border-color: rgba(244, 208, 111, 0.48);
}
.fe-container {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 96vw;
    max-width: 1400px;
    height: 94vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.fe-header h2 {
    font-size: 1.2rem;
    color: var(--text-bright);
}
.fe-header-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.fe-header-controls input[type="text"] {
    width: 180px;
    padding: 6px 10px;
    font-size: 0.85rem;
}
.fe-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.fe-unit-list {
    width: 200px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.fe-unit-list h4 {
    padding: 10px 12px 6px;
    font-size: 0.9rem;
    color: var(--text-dim);
}
.fe-units-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}
.fe-unit-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: grab;
    user-select: none;
    font-size: 0.8rem;
    transition: background 0.1s;
}
.fe-unit-item:hover {
    background: var(--bg-panel-hover);
}
.fe-unit-item.on-grid {
    opacity: 0.35;
    cursor: default;
}
.fe-unit-item.dragging {
    opacity: 0.5;
}
.fe-unit-symbol {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}
.fe-unit-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fe-unit-bars {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 40px;
}
.fe-bar {
    height: 3px;
    border-radius: 1px;
    background: var(--bg-darkest);
}
.fe-bar-fill {
    height: 100%;
    border-radius: 1px;
}
.fe-bar-hp .fe-bar-fill { background: var(--accent-green); }
.fe-bar-morale .fe-bar-fill { background: var(--accent-gold); }
.fe-grid-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    min-width: 0;
}
#fe-grid-canvas {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-darkest);
    cursor: crosshair;
    max-width: 100%;
    max-height: 100%;
}
.fe-grid-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-dim);
}
.fe-saved-list {
    width: 200px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.fe-saved-list h4 {
    padding: 10px 12px 6px;
    font-size: 0.9rem;
    color: var(--text-dim);
}
.fe-saved-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}
.fe-saved-item {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.1s;
}
.fe-saved-item:hover {
    background: var(--bg-panel-hover);
}
.fe-saved-item.selected {
    border-color: var(--accent);
    background: var(--bg-panel-hover);
}
.fe-saved-item-name {
    color: var(--text-bright);
}
.fe-saved-item-count {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* March Order List */
.fe-march-scroll {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 6px;
}
.fe-march-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 3px;
    cursor: grab;
    font-size: 0.82rem;
    color: var(--text-bright);
}
.fe-march-item.fe-march-general {
    cursor: default;
    opacity: 0.7;
    border-color: #ffd700;
}
.fe-march-item.dragging {
    opacity: 0.4;
}
.fe-march-item.drag-over {
    border-color: var(--accent);
    background: rgba(74, 158, 255, 0.1);
}
.fe-march-pos {
    min-width: 18px;
    text-align: center;
    color: var(--text-dim);
    font-weight: bold;
}
.fe-march-sym {
    font-size: 1rem;
}
.fe-march-name {
    flex: 1;
}

.formation-select {
    padding: 6px 10px;
    font-size: 0.85rem;
    max-width: 160px;
}

/* ── Auth Modal ───────────────────────────────────────────── */

.auth-container {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 32px 28px;
    width: 340px;
    max-width: 90vw;
    text-align: center;
}
.auth-container h2 {
    margin-bottom: 18px;
    color: var(--text);
}
.auth-container form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auth-container input {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text);
    font-size: 0.95rem;
}
.auth-error {
    color: #ef5350;
    font-size: 0.85rem;
    padding: 6px 10px;
    background: rgba(239, 83, 80, 0.1);
    border-radius: 4px;
}
.auth-toggle {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-dim);
}
#auth-guest-btn {
    margin-top: 12px;
    width: 100%;
}
.auth-patreon {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-dim, #333);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}
.auth-patreon .btn { width: 100%; }
.auth-patreon .auth-hint {
    margin: 0;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-dim);
}
.requires-tier-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Account Status Bar ───────────────────────────────────── */

.account-bar {
    position: fixed;
    top: 8px;
    right: 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
}
/* Steam build (desktop app): Steam account only; website-account modes and login are hidden. */
body:not(.steam-build) #steam-account,
body.steam-build #account-status,
body.steam-build #btn-login-topbar,
body.steam-build #btn-logout,
body.steam-build #btn-campaign,
body.steam-build #btn-arena,
body.steam-build #btn-browse-matches,
body.steam-build #btn-profile,
body.steam-build #menu-auth-section { display: none !important; }
.account-bar .tier-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.account-bar .tier-badge.paid {
    background: #ffd600;
    color: #000;
}
.account-bar .tier-badge.free {
    background: var(--border);
    color: var(--text-dim);
}
.account-bar .tier-badge.guest {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
}

/* ── Persistence Notice ───────────────────────────────────── */

.persistence-notice {
    background: rgba(255, 214, 0, 0.1);
    border: 1px solid rgba(255, 214, 0, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 0.8rem;
    color: #ffd600;
    text-align: center;
}

/* ── Menu Auth Section ────────────────────────────────────── */

.menu-auth-section {
    margin-top: 12px;
}
.menu-auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    color: var(--text-dim);
    font-size: 0.8rem;
}
.menu-auth-divider::before,
.menu-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
#btn-menu-login {
    width: 100%;
}

/* ── Mobile Unit Info Bottom Sheet ────────────────────────── */

#mobile-unit-info {
    display: none;
}

/* ── Mobile Responsive ────────────────────────────────────── */

@media (max-width: 768px) {
    /* Hide desktop side panels */
    #screen-battle .left-panel,
    #screen-battle .right-panel {
        display: none;
    }

    /* Show mobile bottom sheet */
    #mobile-unit-info {
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 132px;
        z-index: 15;
        background: var(--bg-panel);
        border-top: 1px solid var(--border);
        padding: 8px 12px;
        max-height: 120px;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.2s ease-out;
        pointer-events: none;
    }
    #mobile-unit-info.visible {
        transform: translateY(0);
        pointer-events: auto;
    }
    #mobile-unit-info .mobile-unit-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 4px;
    }
    #mobile-unit-info .mobile-unit-name {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--accent-gold);
        flex: 1;
    }
    #mobile-unit-info .mobile-unit-type {
        font-size: 0.72rem;
        color: var(--text-dim);
    }
    #mobile-unit-info .mobile-unit-state {
        font-size: 0.72rem;
        padding: 1px 6px;
        border-radius: 3px;
        background: var(--bg-darkest);
    }
    #mobile-unit-info .mobile-unit-bars {
        display: flex;
        gap: 8px;
        align-items: center;
    }
    #mobile-unit-info .mobile-bar-group {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    #mobile-unit-info .mobile-bar-label {
        font-size: 0.65rem;
        color: var(--text-dim);
    }
    #mobile-unit-info .mobile-bar {
        height: 6px;
        background: var(--bg-input);
        border-radius: 3px;
        overflow: hidden;
    }
    #mobile-unit-info .mobile-bar-fill {
        height: 100%;
        border-radius: 3px;
        transition: width 0.2s;
    }
    #mobile-unit-info .mobile-bar-strength .mobile-bar-fill { background: var(--accent-green); }
    #mobile-unit-info .mobile-bar-morale .mobile-bar-fill { background: var(--accent-gold); }
    #mobile-unit-info .mobile-unit-stance {
        font-size: 0.72rem;
        color: var(--text);
        margin-top: 2px;
    }
    #mobile-unit-info .mobile-multi-summary {
        font-size: 0.78rem;
    }

    /* Compact bottom roster bar */
    .bottom-bar {
        height: 62px;
        padding: 3px 4px;
    }
    .roster-card {
        min-width: 40px;
        padding: 2px 3px;
    }
    .roster-card-img {
        width: 28px;
        height: 28px;
    }

    #unit-controls {
        left: 8px;
        right: 8px;
        bottom: 66px;
        min-height: 58px;
        justify-content: flex-start;
        padding: 5px 6px;
        gap: 5px;
    }
    .command-cluster {
        padding: 3px;
        gap: 3px;
    }
    .command-toggle {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 0.88rem;
    }
    .command-toggle.command-text {
        min-width: 46px;
        padding: 0 7px;
        font-size: 0.7rem;
    }
    .stance-cluster {
        grid-template-columns: repeat(3, 32px);
        grid-template-rows: repeat(2, 28px);
    }
    .stance-toggle {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 0.7rem;
    }
    .general-cluster .formation-select {
        max-width: 124px;
        height: 32px;
    }

    /* Reposition minimap */
    #minimap-container {
        right: 8px;
        left: auto;
        bottom: 132px;
    }
    #minimap-canvas {
        width: 140px;
        height: 93px;
    }

    /* Compact top bar */
    .top-bar {
        padding: 4px 10px;
        font-size: 0.82rem;
        gap: 8px;
    }
    .battle-menu-button {
        top: 8px;
        left: 8px;
        width: 38px;
        height: 38px;
    }

    .city-panel {
        top: auto;
        right: 8px;
        left: 8px;
        bottom: 76px;
        width: auto;
        max-height: min(68vh, 560px);
    }

    .city-panel-content {
        padding: 14px;
        gap: 12px;
    }

    .city-overview-grid {
        grid-template-columns: 1fr 1fr;
    }

    .city-recruit-grid {
        grid-template-columns: 1fr;
    }

    /* Army builder responsive */
    .army-builder-top {
        flex-direction: column;
    }
    .unit-detail-panel {
        width: 100%;
        min-width: auto;
        max-height: 300px;
    }
    .unit-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Setup panel responsive */
    #screen-setup .left-panel {
        width: 180px;
    }

    /* Menu responsive */
    .game-title {
        font-size: 1.8rem;
    }

    /* Formation editor responsive */
    .fe-container {
        width: 98vw;
        height: 92vh;
    }
    .fe-unit-list,
    .fe-saved-list {
        width: 140px;
    }

    /* Account bar */
    .account-bar {
        top: 4px;
        right: 6px;
        font-size: 0.72rem;
    }
}

@media (max-width: 430px) {
    /* Small phone adjustments */
    #minimap-canvas {
        width: 110px;
        height: 73px;
    }
    .roster-card {
        min-width: 36px;
    }
    .roster-card-img {
        width: 24px;
        height: 24px;
    }
    .unit-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .city-overview-grid {
        grid-template-columns: 1fr;
    }

    /* Setup panel collapses further */
    #screen-setup .left-panel {
        width: 160px;
        padding: 8px;
    }

    .game-title {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    .menu-container {
        padding: 0 16px;
    }

    /* Formation editor: hide side panels on small phones */
    .fe-unit-list,
    .fe-saved-list {
        display: none;
    }
}

/* ── Profile Screen ─────────────────────────────────────── */
#screen-profile {
    justify-content: center;
    align-items: center;
}
.profile-container {
    max-width: 500px;
    width: 100%;
}
.profile-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.profile-section h3 {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}
.profile-row .label {
    color: var(--text-dim);
    font-size: 0.9rem;
}
.profile-row .value {
    color: var(--text-bright);
    font-size: 0.9rem;
}
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.profile-formation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    margin-bottom: 6px;
}
.profile-formation-item .formation-name {
    color: var(--text);
    font-size: 0.9rem;
}
.profile-formations-list {
    max-height: 200px;
    overflow-y: auto;
}
.profile-formation-army-select {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.profile-formation-army-select label {
    color: var(--text-dim);
    font-size: 0.9rem;
    white-space: nowrap;
}
.profile-formation-army-select select {
    flex: 1;
}

/* ── Match List Controls ──────────────────────────────────── */
.match-list-controls {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    justify-content: space-between;
    align-items: center;
}

/* ── Group Order Buttons ─────────────────────────────────── */
.group-order-buttons {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.btn-group-order {
    flex: 1;
    min-width: 70px;
    padding: 8px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-group-order:active {
    transform: scale(0.96);
}
.btn-advance {
    background: #1b5e20;
    color: #c8e6c9;
}
.btn-advance:hover {
    background: #2e7d32;
}
.btn-halt-order {
    background: #37474f;
    color: #b0bec5;
}
.btn-halt-order:hover {
    background: #455a64;
}
.btn-retreat {
    background: #b71c1c;
    color: #ffcdd2;
}
.btn-retreat:hover {
    background: #c62828;
}
.group-number-badge {
    display: inline-block;
    background: var(--border);
    color: var(--text);
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
}

@media (max-width: 1100px) {
    .conquest-lab-shell {
        overflow-y: auto;
        padding-top: 58vh;
    }

    .conquest-lab-map-wrap {
        position: fixed;
        height: 58vh;
        bottom: auto;
    }

    .conquest-lab-map-controls {
        left: 14px;
        transform: none;
    }

    .conquest-lab-panel {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        width: calc(100% - 20px);
        margin: 10px;
    }

    .editor-field-grid {
        grid-template-columns: 1fr;
    }
}


/* ── Battle worker status overlay ───────────────────────── */
.worker-status-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    pointer-events: none;
}
.worker-status-card {
    background: #1a1a1f;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 24px 32px;
    color: #ddd;
    font: 14px/1.4 system-ui, sans-serif;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.worker-status-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #444;
    border-top-color: #6cf;
    border-radius: 50%;
    animation: worker-status-spin 1s linear infinite;
}
.worker-status-text {
    min-width: 200px;
}
@keyframes worker-status-spin {
    to { transform: rotate(360deg); }
}

/* ── WIDESCREEN PC GAME UI OVERRIDES ────────────────────────────────── */

/* Overlay glassmorphism */
.overlay {
    background: rgba(8, 7, 6, 0.82) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}
.auth-container, .ruleset-modal, .active-match-modal, .starter-territory-modal {
    background: rgba(26, 23, 20, 0.85) !important;
    border: 1px solid rgba(184, 134, 11, 0.3) !important;
    border-radius: 4px !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.85), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

/* 1. Skirmish Match Browser Overrides */
#screen-match-list .panel-container {
    max-width: 100vw;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    background: rgba(10, 9, 8, 0.65);
    display: flex;
    flex-direction: column;
    padding: 40px 60px;
}
#screen-match-list .match-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 24px;
    align-content: start;
}
#screen-match-list .match-card {
    background: rgba(26, 23, 20, 0.7);
    border: 1px solid rgba(184, 134, 11, 0.22);
    border-radius: 4px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}
#screen-match-list .match-card:hover {
    background: rgba(44, 38, 32, 0.85);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.45);
}
#screen-match-list .match-card strong {
    font-size: 1.15rem;
    color: var(--text-bright);
    margin-bottom: 4px;
}

/* 2. Match Setup Overrides */
#screen-match-setup .panel-container.match-setup-panel {
    max-width: 100vw;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    background: rgba(10, 9, 8, 0.65);
    display: flex;
    flex-direction: column;
    padding: 40px 60px;
}
#screen-match-setup .match-setup-body {
    display: flex;
    flex-direction: row !important;
    gap: 40px;
    flex: 1;
    overflow: hidden;
    margin-bottom: 24px;
}
#screen-match-setup .match-setup-map-section {
    flex: 1.3;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(22, 19, 16, 0.7);
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 0;
}
#screen-match-setup #setup-map-preview {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    max-height: 380px;
    border: 2px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    background: #090807;
}
#screen-match-setup .match-setup-options {
    flex: 1.1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    overflow-y: auto;
    padding: 24px;
    background: rgba(22, 19, 16, 0.7);
    border: 1px solid var(--border);
    border-radius: 4px;
    max-height: none;
    align-content: start;
}
#screen-match-setup .match-setup-field {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(184, 134, 11, 0.1);
    padding-bottom: 12px;
}
#screen-match-setup .match-setup-field label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
}
#screen-match-setup .match-setup-field input[type="number"],
#screen-match-setup .match-setup-field select {
    width: 100% !important;
    max-width: 100% !important;
    text-align: left !important;
}

/* 3. Army Manager Overrides */
#screen-armies .panel-container.army-builder-container {
    max-width: 100vw;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    background: rgba(10, 9, 8, 0.65);
    display: grid;
    grid-template-areas: 
        "header header"
        "list creator";
    grid-template-columns: 320px 1fr;
    grid-template-rows: auto 1fr;
    gap: 24px;
    padding: 30px 48px;
    overflow: hidden;
}
#screen-armies .panel-header {
    grid-area: header;
    margin-bottom: 0;
}
#screen-armies #army-list {
    grid-area: list;
    background: rgba(22, 19, 16, 0.7);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#screen-armies .army-creator {
    grid-area: creator;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: rgba(22, 19, 16, 0.5);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 24px;
    min-width: 0;
}
#screen-armies .army-creator h3 {
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
#screen-armies .army-builder-layout {
    display: flex;
    flex-direction: row;
    gap: 24px;
    flex: 1;
    overflow: hidden;
}
#screen-armies .army-builder-top {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 20px;
    overflow: hidden;
    min-width: 0;
}
#screen-armies #unit-card-grid {
    flex: 1.4;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding-right: 8px;
    height: 100%;
    align-content: start;
}
#screen-armies #unit-detail-panel {
    flex: 1;
    background: rgba(10, 9, 8, 0.85);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}
#screen-armies .army-bar-section {
    flex: 0 0 330px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(10, 9, 8, 0.6);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px;
    height: 100%;
    overflow: hidden;
}

/* 4. Match Lobby Overrides */
#screen-lobby .panel-container {
    max-width: 100vw;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    background: rgba(10, 9, 8, 0.65);
    display: grid;
    grid-template-areas: 
        "header header"
        "left right";
    grid-template-columns: 420px 1fr;
    grid-template-rows: auto 1fr;
    gap: 24px;
    padding: 30px 48px;
    overflow: hidden;
}
#screen-lobby .panel-header {
    grid-area: header;
    margin-bottom: 0;
}
#screen-lobby .lobby-left-col {
    grid-area: left;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
}
#screen-lobby .lobby-settings-row {
    background: rgba(22, 19, 16, 0.7);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 16px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
#screen-lobby #lobby-countdown {
    background: rgba(22, 19, 16, 0.7);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 10px 16px;
    margin: 0;
    text-align: center;
    color: var(--accent-gold);
    font-weight: bold;
}
#screen-lobby #lobby-teams {
    background: rgba(22, 19, 16, 0.7);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 20px;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}
#screen-lobby .lobby-controls {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: 100%;
    overflow: hidden;
    background: rgba(22, 19, 16, 0.5);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 24px;
}
#screen-lobby #lobby-roster-quick {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
#screen-lobby #lobby-roster-quick h3 {
    font-size: 1.15rem;
    color: var(--accent);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    flex: 0 0 auto;
}
#screen-lobby .army-builder-layout {
    display: flex;
    flex-direction: column !important;
    gap: 14px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
#screen-lobby .army-builder-top {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 16px;
    overflow: hidden;
    min-height: 0;
}
#screen-lobby #lobby-unit-card-grid {
    flex: 1.4;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important;
    gap: 8px !important;
    overflow-y: auto;
    height: 100%;
    align-content: start;
}
#screen-lobby #lobby-unit-card-grid .unit-card {
    min-width: 90px !important;
    padding: 6px !important;
    gap: 4px !important;
}
#screen-lobby #lobby-unit-card-grid .unit-card-sprite {
    width: 32px !important;
    height: 32px !important;
}
#screen-lobby #lobby-unit-card-grid .unit-card-name {
    font-size: 0.78rem !important;
}
#screen-lobby #lobby-unit-card-grid .unit-card-category {
    font-size: 0.62rem !important;
    padding: 0px 4px !important;
}
#screen-lobby #lobby-unit-card-grid .unit-card-stats {
    display: none !important; /* Hide stats inside card grid; detail panel shows them */
}
#screen-lobby #lobby-unit-detail-panel {
    flex: 1;
    background: rgba(10, 9, 8, 0.85);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    overflow-y: auto;
    height: 100%;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.5);
    font-size: 0.85rem;
}
#screen-lobby .army-bar-section {
    flex: 0 0 auto !important;
    width: 100% !important;
    background: rgba(10, 9, 8, 0.4);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}
#screen-lobby .army-bar-header {
    margin-bottom: 4px;
}
#screen-lobby #lobby-army-bar {
    min-height: 80px;
    height: auto;
    margin-bottom: 0;
    padding: 8px;
}
#screen-lobby .army-command-row {
    background: rgba(15, 19, 24, 0.7) !important;
    border: 1px solid var(--border) !important;
    padding: 8px !important;
    margin-bottom: 6px;
}
#screen-lobby .army-command-row-units {
    min-height: 52px !important;
}
#screen-lobby .army-mini-card {
    width: 58px !important;
    padding: 4px 3px !important;
    gap: 2px !important;
}
#screen-lobby .army-mini-card-sprite {
    width: 28px !important;
    height: 28px !important;
}
#screen-lobby .army-mini-card-name {
    font-size: 0.68rem !important;
}
#screen-lobby .army-mini-card-cost {
    font-size: 0.65rem !important;
    padding: 1px 4px !important;
}
#screen-lobby .lobby-action-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    flex: 0 0 auto;
}

/* 5. Profile Overrides */
#screen-profile .panel-container.profile-container {
    max-width: 100vw;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    background: rgba(10, 9, 8, 0.65);
    display: grid;
    grid-template-areas: 
        "header header"
        "left right";
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto 1fr;
    gap: 24px;
    padding: 30px 48px;
    overflow: hidden;
}
#screen-profile .panel-header {
    grid-area: header;
    margin-bottom: 0;
}
#screen-profile .profile-left-col {
    grid-area: left;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    height: 100%;
}
#screen-profile .profile-right-col {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    height: 100%;
    background: rgba(22, 19, 16, 0.5);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 24px;
}
#screen-profile .profile-section {
    background: rgba(22, 19, 16, 0.7);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 0;
}
#screen-profile .profile-section h3 {
    font-size: 1.15rem;
    color: var(--accent);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

/* 6. Commander & Arena Setup Overrides */
#screen-arena-setup .panel-container {
    max-width: 100vw;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    background: rgba(10, 9, 8, 0.65);
    display: flex;
    flex-direction: column;
    padding: 30px 48px;
}
#screen-arena-setup .arena-setup-layout {
    display: flex !important;
    flex-direction: row;
    gap: 24px !important;
    height: calc(100% - 60px) !important;
    overflow: hidden !important;
}
#screen-arena-setup .arena-general-panel {
    flex: 1.1 !important;
    background: rgba(22, 19, 16, 0.7) !important;
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
    padding: 20px !important;
}
#screen-arena-setup .arena-units-panel {
    flex: 2 !important;
    background: rgba(22, 19, 16, 0.7) !important;
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
    padding: 20px !important;
}
#screen-arena-setup .arena-roster-panel {
    flex: 1.2 !important;
    background: rgba(22, 19, 16, 0.8) !important;
    border: 1px solid var(--accent) !important;
    border-radius: 4px !important;
    padding: 20px !important;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.15);
}
#screen-arena-setup .general-card {
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
    background: rgba(10, 9, 8, 0.7) !important;
    padding: 16px !important;
    transition: all 0.22s ease !important;
}
#screen-arena-setup .general-card:hover {
    border-color: var(--border-light) !important;
    background: rgba(44, 38, 32, 0.5) !important;
    transform: translateY(-2px);
}
#screen-arena-setup .general-card.active {
    border-color: var(--accent) !important;
    background: rgba(212, 175, 55, 0.12) !important;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

/* ── Tutorials Screen & Tutorial Overlay HUD ─────────────────── */
.tutorials-panel {
    max-width: 900px;
    width: 90%;
}
.tutorials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.tutorial-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    height: 220px;
}
.tutorial-card.active {
    background: rgba(22, 19, 16, 0.5);
    border-color: rgba(184, 134, 11, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.tutorial-card.active:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 25px rgba(184, 134, 11, 0.15);
    transform: translateY(-2px);
}
.tutorial-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}
.tutorial-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}
.tutorial-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-bright);
}
.tutorial-card-body {
    flex-grow: 1;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text);
    margin-bottom: 15px;
}
.tutorial-card-footer {
    display: flex;
    justify-content: flex-end;
}
.badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.badge-active {
    background: rgba(40, 167, 69, 0.15);
    color: #2fb344;
    border: 1px solid rgba(40, 167, 69, 0.3);
}
.badge-locked {
    background: rgba(108, 117, 125, 0.15);
    color: #9ca3af;
    border: 1px solid rgba(108, 117, 125, 0.3);
}

/* Tutorial HUD Overlay */
.tutorial-hud-container {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 360px;
    z-index: 1000;
    animation: slideInRight 0.4s ease-out;
}
.tutorial-card-overlay {
    background: rgba(22, 19, 16, 0.9);
    border: 1px solid rgba(184, 134, 11, 0.45);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.tutorial-card-header-overlay {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.tutorial-card-progress {
    font-size: 0.78rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}
.tutorial-card-badge {
    background: rgba(184, 134, 11, 0.12);
    color: var(--accent);
    border: 1px solid rgba(184, 134, 11, 0.25);
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}
.tutorial-card-title {
    margin: 0 0 10px 0;
    font-size: 1.15rem;
    color: #fffdfa;
    font-weight: 700;
    border-bottom: 1px solid rgba(184, 134, 11, 0.2);
    padding-bottom: 6px;
}
.tutorial-card-body {
    font-size: 0.88rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
}
.tutorial-card-body strong {
    color: var(--accent);
}
.tutorial-card-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.tutorial-card-actions .btn {
    padding: 7px 14px;
    font-size: 0.82rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pulse-highlight {
    animation: pulseGlow 1.5s infinite alternate;
    border-color: #2fb344 !important;
}

@keyframes pulseGlow {
    from {
        box-shadow: 0 0 5px rgba(47, 179, 68, 0.4);
    }
    to {
        box-shadow: 0 0 18px rgba(47, 179, 68, 0.85);
    }
}

/* ── Conquest Saved Units & Roster Tabs ──────────────────────────────── */
.lobby-tabs-header {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.lobby-tab-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--panel-radius);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lobby-tab-btn:hover {
    color: var(--text-bright);
    border-color: var(--border-light);
    background: rgba(255, 255, 255, 0.02);
}

.lobby-tab-btn.active {
    color: var(--text-bright);
    background: rgba(212, 175, 55, 0.12);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Results Screen Save Units Panel */
.save-units-panel {
    background: rgba(20, 18, 15, 0.95);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    text-align: left;
}

.save-units-panel h3 {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.save-units-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.save-unit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 14px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.save-unit-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.save-unit-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.save-unit-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.save-unit-info {
    display: flex;
    flex-direction: column;
}

.save-unit-name {
    font-weight: bold;
    color: var(--text-bright);
}

.save-unit-stats {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.save-unit-cost {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
}

.save-units-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.save-slots-info {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.save-slots-info strong {
    color: var(--text-bright);
}

/* ── World Campaign Screen ──────────────────────────────── */
#screen-world-campaign {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #050a14;
    user-select: none;
}

#world-campaign-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
    display: block;
}

#world-campaign-canvas.is-grabbing {
    cursor: grabbing;
}

.wc-top-bar {
    position: absolute;
    top: 14px;
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 20;
    pointer-events: none;
}

.wc-top-bar > * {
    pointer-events: auto;
}

.wc-readout {
    background: rgba(10, 15, 24, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 7px 14px;
    color: #e0e6ed;
    font-family: monospace;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.wc-search-box {
    position: relative;
    width: 280px;
}

.wc-search-box input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(10, 15, 24, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 0.82rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    outline: none;
    transition: border-color 0.2s;
}

.wc-search-box input:focus {
    border-color: var(--accent-gold, #ffd700);
}

.wc-search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #0f1622;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 30;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

.wc-suggestion-item {
    padding: 8px 12px;
    font-size: 0.78rem;
    color: #cfd8dc;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wc-suggestion-item:last-child {
    border-bottom: none;
}

.wc-suggestion-item:hover {
    background: rgba(255, 215, 0, 0.15);
    color: #fff;
}

.wc-presets-select {
    padding: 8px 12px;
    background: rgba(10, 15, 24, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ffd700;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.wc-panel {
    position: absolute;
    top: 70px;
    right: 16px;
    width: 320px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    background: rgba(12, 18, 28, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.65);
    z-index: 20;
    color: #cfd8dc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#wc-panel[hidden],
#btn-wc-panel-toggle[hidden] {
    display: none;
}

.wc-battle-error {
    position: absolute;
    top: 70px;
    left: 16px;
    max-width: min(480px, calc(100vw - 32px));
    padding: 8px 12px;
    background: rgba(12, 18, 28, 0.92);
    border: 1px solid #ef5350;
    border-radius: 6px;
    color: #ef5350;
    font-size: 0.8rem;
    z-index: 21;
}

#wc-battle-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 15;
}

#wc-battle-hud[hidden] { display: none; }
#wc-battle-hud > * { pointer-events: auto; }
#wc-battle-hud .top-bar { top: 66px; right: 352px; left: 16px; width: auto; }
#wc-battle-hud .unit-panel { top: 112px; max-height: calc(100vh - 300px); }

#screen-world-campaign:has(#wc-panel[hidden]) #wc-battle-hud .top-bar { right: 16px; }

@media (max-width: 800px) {
    #wc-battle-hud .top-bar { right: 16px; }
    #wc-battle-hud .unit-panel { display: none; }
    #screen-world-campaign:has(#wc-battle-hud:not([hidden])) .wc-panel {
        top: 112px;
        width: 210px;
        max-height: calc(100vh - 310px);
    }
}

.wc-panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.wc-panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #ffd700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.wc-status {
    font-size: 0.72rem;
    color: #90a4ae;
}

.wc-how {
    margin: 0;
    font-size: 0.74rem;
    color: #90a4ae;
    line-height: 1.35;
}

.wc-layers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 0.75rem;
}

.wc-layers label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.wc-layers i {
    width: 14px;
    border-top: 3px solid #3b7dd8;
}

.wc-features-status {
    color: #90a4ae;
    font-size: 0.7rem;
}

.wc-features-status.has-error {
    color: #ffb74d;
}

.wc-meta, .wc-place {
    font-size: 0.75rem;
    color: #b0bec5;
    font-family: monospace;
}

.wc-summary {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wc-sum-title {
    font-size: 0.8rem;
    color: #eceff1;
}

.wc-counts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.wc-count-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #b0bec5;
}

.wc-count-row i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.wc-count-row span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wc-count-row b {
    color: #fff;
    font-family: monospace;
}

.wc-meta-line {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.72rem;
    color: #90a4ae;
}

.wc-note {
    font-size: 0.7rem;
    color: #78909c;
    font-style: italic;
    line-height: 1.3;
}

.wc-warn {
    font-size: 0.72rem;
    color: #ffb74d;
    background: rgba(255, 183, 77, 0.1);
    border: 1px solid rgba(255, 183, 77, 0.3);
    border-radius: 4px;
    padding: 6px 8px;
}

.wc-error {
    font-size: 0.74rem;
    color: #ef5350;
}

.wc-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.wc-actions .btn {
    width: 100%;
}

.wc-locked-head {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #90a4ae;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
    margin-top: 4px;
}

.wc-locked-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 140px;
    overflow-y: auto;
}

.wc-site-row {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
}

.wc-site-row.active {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.08);
}

.wc-site-btn {
    flex: 1;
    background: none;
    border: none;
    color: #e0e6ed;
    font-size: 0.74rem;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0;
}

.wc-site-del {
    background: none;
    border: none;
    color: #78909c;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
}

.wc-site-del:hover {
    color: #ef5350;
}

.wc-fine {
    font-size: 0.7rem;
    color: #78909c;
    line-height: 1.35;
    margin: 4px 0 0;
}

.wc-attrib {
    font-size: 0.65rem;
    color: #546e7a;
    line-height: 1.3;
    margin: 0;
}

.wc-attrib a {
    color: #90a4ae;
}

.wc-empty {
    font-size: 0.75rem;
    color: #78909c;
    font-style: italic;
    padding: 6px 0;
}

@media (max-width: 800px) {
    .wc-top-bar {
        flex-wrap: wrap;
        right: 8px;
        left: 8px;
    }
    .wc-search-box {
        width: 100%;
        order: 3;
    }
    .wc-panel {
        top: auto;
        bottom: 8px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 40vh;
    }
}

.wc-live-controls {
    display: grid;
    gap: 8px;
    padding-bottom: 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid #796b4f;
}
.wc-live-status { color: #e9d69e; font-size: 13px; }
.wc-ground-status {
    position: absolute;
    bottom: 22px;
    left: 16px;
    max-width: min(480px, calc(100vw - 32px));
    padding: 8px 12px;
    background: rgba(12, 18, 28, 0.92);
    color: #e9d69e;
    border: 1px solid #796b4f;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 21;
}
.wc-campaign-list { display: grid; gap: 16px; margin-top: 20px; }
#screen-world-campaign-browser .panel-container { width: min(760px, 94vw); padding: min(30px, 4vw); }
#wc-browser-rulesets { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.wc-campaign-card { border: 1px solid #756444; padding: 16px; border-radius: 6px; }
.wc-start-notice { color: #ffe3a0; font-weight: bold; font-size: 18px; }
.wc-deployment-dialog { background: #211e18; color: #eee1c4; border: 1px solid #a48b56; border-radius: 8px; padding: 24px; max-width: min(480px, 85vw); }
.wc-deployment-dialog::backdrop { background: #0009; }
#wc-browser-rulesets[hidden] { display: none; }
.wc-live-controls select { width: 100%; min-height: 30px; }
.wc-live-orders { display: flex; flex-wrap: wrap; gap: 6px; }
#wc-skirmish-tools > summary { cursor: pointer; margin-bottom: 12px; }

/* ── World Campaign Procedural Cities & Resource Bar ──────── */
.wc-resources-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px;
    background: rgba(16, 18, 24, 0.88);
    border: 1px solid rgba(255, 215, 0, 0.28);
    border-radius: 6px;
    font-size: 0.78rem;
    color: #eceff1;
    font-family: monospace;
}
.wc-resources-bar[hidden] { display: none; }
.wc-res-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.wc-res-chip b { color: #ffd700; }
.wc-res-rate { color: #81c784; font-size: 0.7rem; }
.wc-resource-strat {
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 4px;
    padding: 1px 6px;
    color: #ffe082;
}

.wc-city-panel {
    position: absolute;
    top: 58px;
    left: 16px;
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 82px);
    overflow-y: auto;
    background: rgba(14, 18, 26, 0.94);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 8px;
    padding: 14px 16px;
    color: #e0e6ed;
    z-index: 25;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wc-city-panel[hidden] { display: none; }
.wc-city-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}
.wc-city-tier {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffd700;
}
.wc-city-header h3 {
    margin: 2px 0 0;
    font-size: 1.1rem;
    color: #fff;
}
.wc-city-status {
    font-size: 0.78rem;
    color: #b0bec5;
}
.wc-city-rates {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.74rem;
    font-family: monospace;
}
.wc-city-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.wc-city-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wc-city-section-title {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ffd700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 4px;
}
.wc-city-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 0.76rem;
}
.wc-city-row-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.wc-city-row-meta b {
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wc-city-row-meta small {
    color: #90a4ae;
    font-size: 0.68rem;
}

/* ── Anything Wargame (AWE) ─────────────────────────────── */
.awe-panel { max-width: 960px; margin: 0 auto; overflow-y: auto; max-height: 100vh; }
.awe-list { display: flex; flex-direction: column; gap: 10px; }
.awe-section-title { margin: 14px 0 4px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.8; }
.awe-section-title-row { display: flex; align-items: center; justify-content: space-between; }
.awe-card, .awe-faction { border-left: 4px solid var(--awe-accent, #888); background: rgba(255, 255, 255, 0.05); padding: 10px 12px; border-radius: 6px; }
.awe-card h3, .awe-faction h3 { margin: 0 0 4px; }
.awe-card p { margin: 0 0 8px; opacity: 0.8; }
.awe-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.awe-faction { margin-bottom: 10px; }
.awe-faction h4 { margin: 10px 0 4px; font-size: 0.85rem; opacity: 0.85; }
.awe-faction-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.awe-faction-head input[type="color"] { width: 36px; height: 28px; padding: 0; border: none; background: none; }
.awe-army-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; }
.awe-error { color: #ff8a80; min-height: 1em; margin: 4px 0; }
.awe-wizard { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 100%; height: 100vh; background: rgba(10, 12, 16, 0.92); }
.awe-setup-form fieldset { border: none; padding: 0; }
.awe-setup-form fieldset label { display: flex; gap: 6px; align-items: center; }
.awe-wizard-head { display: flex; align-items: center; gap: 16px; padding: 8px calc(12px + var(--awe-account-bar-width, 0px)) 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); flex-wrap: wrap; }
.awe-wizard-head h2 { margin: 0; font-size: 1.1rem; white-space: nowrap; }
.awe-wizard-head-actions { display: flex; gap: 6px; margin-left: auto; }
.awe-steps { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.awe-step button { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid transparent; border-radius: 16px; color: inherit; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 0.85rem; }
.awe-step button:disabled { cursor: not-allowed; opacity: 0.4; }
.awe-step-num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); font-size: 0.75rem; }
.awe-step-current button { border-color: #ffd54a; }
.awe-step-current .awe-step-num { background: #ffd54a; color: #111; }
.awe-step-done .awe-step-num { background: #4caf50; color: #fff; }
.awe-wizard-body { display: grid; grid-template-columns: 1fr; min-height: 0; }
.awe-setup-form { overflow-y: auto; padding: 12px 16px; min-height: 0; }
.awe-wizard-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.awe-wizard-messages { flex: 1; min-width: 0; }
.awe-wizard-messages p { margin: 0; }
.awe-wizard-messages p:empty { display: none; }
/* Theatre: full-width map. Armies: form beside a locked map. Other steps: form only. */
#screen-awe-setup[data-step="theatre"] .awe-setup-form { display: none; }
#screen-awe-setup:not([data-step="theatre"]):not([data-step="armies"]) .awe-theatre { display: none; }
#screen-awe-setup:not([data-step="theatre"]):not([data-step="armies"]) .awe-setup-form > * { max-width: 760px; margin-left: auto; margin-right: auto; }
#screen-awe-setup[data-step="armies"] .awe-wizard-body { grid-template-columns: minmax(420px, 560px) 1fr; }
#screen-awe-setup:not([data-step="theatre"]) .awe-theatre-edit-tools,
#screen-awe-setup:not([data-step="theatre"]) [data-awe-tool="pan"] { display: none; }
.awe-theatre-edit-tools { display: contents; }
.awe-invalid { color: #ff8a80; }
.awe-chip.awe-invalid { background: rgba(255, 82, 82, 0.18); }
.awe-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; background: var(--awe-accent, #888); }
.awe-faction-rules { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.awe-faction-rules .awe-check { margin: 0; }
.awe-inline-field { display: flex; gap: 6px; align-items: center; }
.awe-inline-field input { width: 100px; }
.awe-roster-summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.85rem; padding: 4px 0; }
.awe-general { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.awe-review { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.awe-review dt { font-weight: bold; display: flex; gap: 6px; align-items: flex-start; }
.awe-review dd { margin: 0; }
.awe-review ul { margin: 4px 0 0; padding-left: 18px; }
.awe-review-faction::marker { color: var(--awe-accent, #888); }
.awe-problems { color: #ff8a80; }
.awe-field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.awe-field label { display: block; }
.awe-theatre { position: relative; display: flex; flex-direction: column; min-width: 0; }
.awe-theatre-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px; background: rgba(10, 12, 16, 0.85); }
.awe-theatre-tools .active, .awe-faction .active { outline: 2px solid #ffd54a; }
#awe-theatre-canvas { flex: 1; width: 100%; min-height: 0; display: block; touch-action: none; }
.awe-roster { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.awe-roster td { padding: 2px; }
.awe-roster td:first-child { width: 45%; }
.awe-roster select, .awe-roster input:not([type="radio"]) { width: 100%; }
.awe-roster-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 0.85rem; }
.awe-over { color: #ff8a80; font-weight: bold; }
.awe-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.awe-chip { background: rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 2px 8px; font-size: 0.8rem; }
.awe-prebuilt { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 6px; margin-top: 6px; }
.awe-rules { margin: 8px 0; }
.awe-check { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; margin: 8px 0; }
.awe-rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; align-items: start; }
.awe-rule-grid .awe-field { margin: 4px 0; }
.awe-rule-factions { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 6px; }
.awe-rule-factions th { text-align: left; font-weight: normal; opacity: 0.75; padding: 2px; }
.awe-rule-factions td { padding: 2px; }
.awe-rule-factions input[type="number"] { width: 100%; }
.awe-rule-faction { border-left: 3px solid var(--awe-accent, #888); padding-left: 6px !important; }
.awe-rule-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
