/* =============================================================================
   Groundswell Shared Game Layout
   Unified layout classes for all COIN-series games.
   ============================================================================= */

/* Board offset: push main content right of the card panel */
main.gs-game {
    margin-left: 340px;
    width: auto;
}

/* =============================================================================
   Card Panel (left sidebar, 340px fixed)
   ============================================================================= */

.gs-card-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 340px;
    height: 100vh;
    background: #0d0d14;
    border-right: 2px solid #2a2a3a;
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 0;
    z-index: 900;
    box-sizing: border-box;
    overflow-y: auto;
}

/* Close button — hidden on desktop, shown on mobile */
.gs-panel-close {
    display: none;
}

.gs-card-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 2px;
    padding: 6px;
    border-radius: 6px;
}

.gs-card-section.gs-current {
    background: #141420;
    border: 1px solid #3a3a5a;
}

.gs-card-section.gs-next {
    background: #0f0f18;
    border: 1px solid #1e1e2e;
    opacity: 0.85;
}

.gs-card-section.gs-next:hover {
    opacity: 1;
}

.gs-card-label {
    color: #666;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    flex-shrink: 0;
}

.gs-current .gs-card-label {
    color: #4fc3f7;
}

.gs-card-title {
    color: #eee;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.gs-card-factions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    margin: 2px 0;
    flex-wrap: wrap;
}

.gs-faction-chip {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.gs-card-img-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gs-card-img {
    flex: 1;
    width: 100%;
    object-fit: contain;
    object-position: top center;
    border-radius: 4px;
    cursor: pointer;
    min-height: 0;
}

.gs-card-img:hover {
    filter: brightness(1.08);
}

/* Text fallback when image fails to load */
.gs-card-text-fallback {
    flex: 1;
    overflow-y: auto;
    font-size: 11px;
    line-height: 1.4;
    min-height: 0;
}

.gs-card-text-unshaded {
    background: #1a1a28;
    border-left: 3px solid #c8a87c;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 0 4px 4px 0;
    color: #ddd;
}

.gs-card-text-unshaded::before {
    content: "Unshaded";
    display: block;
    color: #c8a87c;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.gs-card-text-shaded {
    background: #1a1a28;
    border-left: 3px solid #888;
    padding: 6px 8px;
    border-radius: 0 4px 4px 0;
    color: #bbb;
}

.gs-card-text-shaded::before {
    content: "Shaded";
    display: block;
    color: #888;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.gs-card-divider {
    border-top: 1px solid #2a2a3a;
    margin: 4px 0;
    flex-shrink: 0;
}

.gs-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid #2a2a3a;
    flex-shrink: 0;
}

.gs-deck-info {
    color: #666;
    font-size: 11px;
}

.gs-card-btns {
    display: flex;
    gap: 4px;
}

.gs-panel-btn {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid;
}

.gs-panel-btn.gs-draw {
    background: #2a4a2a;
    border-color: #4a8a4a;
    color: #8f8;
}

.gs-panel-btn.gs-build {
    background: #2a2a4a;
    border-color: #4a4a8a;
    color: #88f;
}

.gs-panel-btn:hover {
    filter: brightness(1.2);
}

/* Debug set card row */
.gs-debug-card-row {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-top: 6px;
    border-top: 1px solid #2a2a3a;
    margin-top: 4px;
}

.gs-debug-card-input {
    width: 48px;
    background: #1a1a28;
    border: 1px solid #333;
    color: #ccc;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.gs-debug-card-btn {
    background: #3a2a10;
    border: 1px solid #665530;
    color: #c8a87c;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
}

/* =============================================================================
   Collapsible Status Panel (wraps info bar)
   ============================================================================= */

.gs-status-panel {
    background: #1a293c;
    border-bottom: 1px solid #334;
    /* Stack above the floating forces panel (z-index 800) so the status row
       and its "?" legend button are always clickable */
    position: relative;
    z-index: 860;
}

.gs-status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 1rem;
    cursor: pointer;
    user-select: none;
}

.gs-status-toggle {
    color: #888;
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.gs-status-panel:not(.collapsed) .gs-status-toggle {
    transform: rotate(90deg);
}

.gs-status-title {
    color: #999;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gs-status-summary {
    color: #aaa;
    font-size: 0.75rem;
    margin-left: auto;
}

.gs-status-panel:not(.collapsed) .gs-status-summary {
    display: none;
}

.gs-status-panel.collapsed .gs-status-body {
    display: none;
}

/* Events row (mobile-only, inside status panel body) */
.gs-events-row {
    display: none;
    padding: 0.4rem 1rem;
    gap: 1rem;
    border-bottom: 1px solid #223;
}

@media (max-width: 768px) {
    .gs-events-row { display: flex !important; }
}

.gs-event-card {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

.gs-event-label {
    color: #999;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.gs-event-thumb {
    height: 48px;
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.gs-event-name {
    color: #ddd;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =============================================================================
   Info Bar (horizontal bar below game header)
   ============================================================================= */

.gs-info-bar {
}

.gs-info-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.4rem 1rem;
    flex-wrap: wrap;
}

.gs-info-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.gs-info-label {
    color: #999;
    font-size: 0.8rem;
}

.gs-info-value {
    font-weight: bold;
    font-size: 0.9rem;
}

.gs-info-divider {
    border-left: 1px solid #444;
    height: 24px;
}

.gs-info-resources {
    display: flex;
    gap: 0.8rem;
    font-size: 0.8rem;
}

.gs-info-scores {
    display: flex;
    gap: 0.8rem;
    font-size: 0.8rem;
}

/* Second row in info bar (for CL bot controls etc.) */
.gs-info-row-2 {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.3rem 1rem;
    border-top: 1px solid #223;
    flex-wrap: wrap;
}

.gs-info-btn-group {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.gs-info-btn-label {
    color: #999;
    font-size: 0.8rem;
}

/* =============================================================================
   Sequence Bar (horizontal bar below info bar)
   ============================================================================= */

.gs-seq-bar {
    background: #1a1a2e;
    border-bottom: 2px solid #334;
    padding: 0.4rem 1rem;
    /* Stack above the floating forces panel (z-index 800) */
    position: relative;
    z-index: 855;
}

.gs-seq-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.gs-seq-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gs-seq-divider {
    border-left: 1px solid #444;
    height: 28px;
}

.gs-seq-label {
    color: #999;
    font-size: 0.75rem;
    white-space: nowrap;
}

.gs-seq-phase {
    padding: 0.15rem 0.5rem;
    background: #333;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #aaa;
    font-weight: bold;
}

.gs-seq-phase.active {
    background: #1a3a5a;
    color: #4fc3f7;
}

/* Faction order slots */
.gs-seq-factions {
    display: flex;
    gap: 0.25rem;
}

.gs-seq-faction {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.1rem 0.35rem;
    background: #2a2a3a;
    border-radius: 3px;
    min-width: 36px;
    border: 1px solid transparent;
}

.gs-seq-faction.eligible {
    border-color: #4fc3f7;
}

.gs-seq-faction.ineligible {
    opacity: 0.4;
}

.gs-seq-faction.acting {
    background: #2a3a4a;
    border: 2px solid #ffb74d;
    box-shadow: 0 0 4px rgba(255, 183, 77, 0.3);
}

.gs-seq-faction .gs-seq-rank {
    font-size: 0.55rem;
    color: #666;
    line-height: 1;
}

.gs-seq-faction .gs-seq-faction-abbr {
    font-weight: bold;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Cylinder position display */
.gs-seq-cylinders {
    display: flex;
    gap: 0.3rem;
}

.gs-seq-cyl {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.1rem 0.3rem;
    background: #2a2a3a;
    border-radius: 3px;
    font-size: 0.65rem;
}

.gs-seq-cyl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.gs-seq-cyl-box {
    color: #888;
}

/* Acting faction label */
.gs-seq-acting-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #ddd;
    white-space: nowrap;
}

.gs-seq-acting-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: bold;
    color: #fff;
}

.gs-seq-position-badge {
    padding: 0.1rem 0.3rem;
    background: #333;
    border-radius: 3px;
    font-size: 0.65rem;
    color: #888;
}

/* Action buttons (horizontal row) */
.gs-seq-btn-row {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.gs-seq-action-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #333;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.gs-seq-action-btn:hover {
    background: #444;
    border-color: #4fc3f7;
}

.gs-seq-action-btn.pass {
    border-color: #555;
    color: #aaa;
}

.gs-seq-action-btn.pass:hover {
    border-color: #888;
    color: #fff;
}

/* My turn: larger, more prominent buttons */
.gs-seq-action-btn.my-turn {
    padding: 0.45rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: #2a3a4a;
    border-color: #4fc3f7;
    box-shadow: 0 0 6px rgba(79, 195, 247, 0.15);
}

.gs-seq-action-btn.my-turn:hover {
    background: #3a4a5a;
    border-color: #81d4fa;
    box-shadow: 0 0 10px rgba(79, 195, 247, 0.3);
}

.gs-seq-action-btn.my-turn.pass {
    background: #333;
    border-color: #666;
    box-shadow: none;
}

.gs-seq-action-btn.my-turn.pass:hover {
    background: #444;
    border-color: #999;
}

/* Not my turn: greyed out, unclickable */
.gs-seq-action-btn.locked {
    background: #252530;
    border-color: #333;
    color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

.gs-seq-action-btn.locked:hover {
    background: #252530;
    border-color: #333;
    color: #666;
}

.gs-seq-action-btn.locked.pass {
    color: #555;
}

.gs-seq-action-btn .gs-seq-btn-icon {
    font-size: 0.85rem;
}

.gs-seq-action-btn.my-turn .gs-seq-btn-icon {
    font-size: 0.95rem;
}

/* End Turn / Next Round flow buttons */
.gs-seq-flow-btn {
    padding: 0.25rem 0.8rem;
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
}

.gs-seq-flow-btn.end-turn {
    background: #2e7d32;
}

.gs-seq-flow-btn.end-turn:hover {
    background: #388e3c;
}

.gs-seq-flow-btn.next-round {
    background: #1565c0;
}

.gs-seq-flow-btn.next-round:hover {
    background: #1976d2;
}

.gs-seq-flow-info {
    font-size: 0.75rem;
    color: #888;
    margin-right: 0.5rem;
}

/* Bot controls in sequence bar */
.gs-seq-bots {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

.gs-seq-bot-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    background: #252535;
}

.gs-seq-bot-btn:hover {
    background: #353545;
    border-color: #666;
}

.gs-seq-bot-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.gs-seq-bot-btn.all {
    background: #1a3a1a;
    border-color: #4a6a4a;
}

.gs-seq-bot-btn.all:hover {
    background: #2a4a2a;
}

.gs-seq-bot-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: bold;
    color: #fff;
}

/* AI controls (for RDR) */
.gs-seq-ai-row {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.gs-seq-ai-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
}

.gs-seq-ai-btn.step {
    background: #1a5276;
}

.gs-seq-ai-btn.step:hover {
    background: #1f6f9f;
    border-color: #4fc3f7;
}

.gs-seq-ai-btn.auto {
    background: #1a4a1a;
}

.gs-seq-ai-btn.auto:hover {
    background: #2a6a2a;
    border-color: #66bb6a;
}

.gs-seq-ai-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gs-seq-ai-btn .ai-icon {
    font-size: 0.85rem;
}

/* =============================================================================
   Forces Panel (fixed right, collapsible)
   ============================================================================= */

.gs-forces-panel {
    position: fixed;
    right: 10px;
    top: 50px;
    width: 230px;
    background: #1e1e2e;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 0.8rem;
    z-index: 800;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.gs-forces-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #333;
    background: #252538;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    user-select: none;
}

.gs-forces-header h3 {
    margin: 0;
    font-size: 0.85rem;
    color: #ddd;
}

.gs-forces-collapse-icon {
    font-size: 0.6rem;
    color: #888;
    transition: transform 0.2s;
}

.gs-forces-panel.collapsed .gs-forces-collapse-icon {
    transform: rotate(-90deg);
}

.gs-forces-panel.collapsed .gs-forces-body {
    display: none;
}

.gs-forces-panel.collapsed .gs-forces-header {
    border-bottom: none;
    border-radius: 8px;
}

.gs-forces-body {
    padding: 0.4rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.gs-forces-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.3;
}

.gs-forces-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gs-forces-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: #999;
    width: 34px;
    flex-shrink: 0;
}

.gs-forces-pieces {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.7rem;
    color: #aaa;
}

.gs-force-count {
    white-space: nowrap;
}

.gs-force-count .avail {
    font-weight: 700;
    color: #ddd;
}

.gs-force-count .total {
    color: #666;
}

.gs-force-count .label {
    color: #777;
    font-size: 0.65rem;
}

.gs-force-count .cas {
    color: #d94a4a;
    font-size: 0.6rem;
}

.gs-force-count.depleted .avail {
    color: #d94a4a;
}

/* =============================================================================
   Action Log (fixed bottom-right, collapsible)
   ============================================================================= */

.gs-action-log {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 340px;
    max-height: 400px;
    background: #111122;
    border: 1px solid #333;
    border-bottom: none;
    border-right: none;
    border-radius: 8px 0 0 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    box-shadow: -2px -2px 12px rgba(0,0,0,0.4);
    font-size: 0.8rem;
}

.gs-action-log.collapsed .gs-log-body {
    display: none;
}

.gs-action-log.collapsed {
    max-height: none;
}

.gs-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.7rem;
    background: #1a1a2e;
    border-bottom: 1px solid #333;
    border-radius: 8px 0 0 0;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.gs-log-title {
    font-weight: bold;
    color: #aab;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
}

.gs-log-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.gs-log-filter {
    background: #222238;
    border: 1px solid #444;
    color: #ccc;
    font-size: 0.7rem;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    cursor: pointer;
}

.gs-log-btn {
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 0.25rem;
    line-height: 1;
}

.gs-log-btn:hover {
    color: #ccc;
}

.gs-log-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    max-height: 340px;
}

.gs-log-entries {
    padding: 0.3rem 0;
}

.gs-log-entry {
    padding: 0.25rem 0.7rem;
    border-bottom: 1px solid #1a1a28;
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    line-height: 1.3;
}

.gs-log-entry:hover {
    background: #1a1a30;
}

.gs-log-entry.hidden-by-filter {
    display: none;
}

.gs-log-time {
    color: #555;
    font-size: 0.65rem;
    flex-shrink: 0;
    min-width: 38px;
    padding-top: 1px;
}

.gs-log-faction-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.gs-log-faction-dot.faction-system { background: #666; }

.gs-log-text {
    color: #bbc;
    word-break: break-word;
}

.gs-log-text .log-faction-name {
    font-weight: 600;
}

.gs-log-text .log-highlight {
    color: #e8d44d;
}

.gs-log-empty {
    color: #555;
    text-align: center;
    padding: 2rem 1rem;
    font-style: italic;
}

.gs-log-round-divider {
    text-align: center;
    padding: 0.3rem 0.7rem;
    color: #555;
    font-size: 0.7rem;
    border-bottom: 1px solid #222;
    background: #0e0e1a;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* =============================================================================
   Propaganda / Special Round button (shared style)
   ============================================================================= */

.gs-special-round-btn {
    background: #3a2a10;
    border: 1px solid #c8a87c;
    color: #c8a87c;
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.gs-special-round-btn:hover {
    background: #4a3a20;
    border-color: #e0c090;
}

/* =============================================================================
   Execution Phase UI (shared across all COIN game wizards)
   ============================================================================= */

.execution-phase {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.execution-header {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #1a2a3a, #1a1a2a);
    border-radius: 8px;
    border: 1px solid #444;
}

.execution-header h3 {
    margin: 0 0 0.5rem 0;
    color: #fff;
    font-size: 1.1rem;
}

.execution-header p {
    margin: 0;
    color: #888;
    font-size: 0.9rem;
}

.execution-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.execution-group {
    background: #2a2a3a;
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
}

.execution-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #1a1a2e;
    border-bottom: 1px solid #333;
}

.execution-group-icon {
    font-size: 1.2rem;
}

.execution-group-title {
    font-weight: 600;
    color: #fff;
    flex-grow: 1;
}

.execution-group-status {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.execution-group-status.pending {
    background: #3a3a1a;
    color: #ffb74d;
}

.execution-group-status.in-progress {
    background: #1a3a5a;
    color: #4fc3f7;
}

.execution-group-status.complete {
    background: #1a3a1a;
    color: #66bb6a;
}

.execution-group.operation .execution-group-header {
    border-left: 4px solid #4fc3f7;
}

.execution-group.special-activity .execution-group-header {
    border-left: 4px solid #9c27b0;
}

.execution-items {
    padding: 0.5rem;
}

.execution-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.execution-item:last-child {
    margin-bottom: 0;
}

.execution-item:hover:not(.disabled):not(.complete) {
    border-color: #666;
    background: #2a2a3a;
}

.execution-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.execution-item.complete {
    opacity: 0.7;
    cursor: default;
}

.execution-item.complete .item-status {
    color: #66bb6a;
}

.execution-item .item-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #666;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.execution-item.complete .item-checkbox {
    background: #1a3a1a;
    border-color: #66bb6a;
    color: #66bb6a;
}

.execution-item .item-name {
    flex-grow: 1;
    color: #fff;
    font-weight: 500;
}

.execution-item .item-detail {
    color: #888;
    font-size: 0.85rem;
}

.execution-item .item-status {
    font-size: 0.8rem;
    color: #888;
}

.execution-item .execute-btn {
    padding: 0.3rem 0.75rem;
    background: #4fc3f7;
    color: #000;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.execution-item .execute-btn:hover {
    background: #81d4fa;
}

.execution-item.special-activity .execute-btn {
    background: #9c27b0;
    color: #fff;
}

.execution-item.special-activity .execute-btn:hover {
    background: #ba68c8;
}

.execute-all-btn {
    padding: 0.25rem 0.6rem;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-left: auto;
}

.execution-group.operation .execute-all-btn {
    background: #4fc3f7;
    color: #000;
}

.execution-group.operation .execute-all-btn:hover {
    background: #81d4fa;
}

.execution-group.special-activity .execute-all-btn {
    background: #9c27b0;
    color: #fff;
}

.execution-group.special-activity .execute-all-btn:hover {
    background: #ba68c8;
}

.execution-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #1a1a2e;
    border-radius: 8px;
    border: 1px solid #333;
}

.progress-bar {
    flex-grow: 1;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4fc3f7, #9c27b0);
    transition: width 0.3s ease;
}

.progress-text {
    color: #888;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* =============================================================================
   Mobile Tab Bar (hidden on desktop)
   ============================================================================= */

.gs-mobile-tabs {
    display: none;
}

/* =============================================================================
   Mobile Responsive Layout
   ============================================================================= */

@media (max-width: 768px) {
    /* Flex column layout for mobile reordering */
    main.gs-game,
    main {
        margin-left: 0 !important;
        width: 100% !important;
        display: flex;
        flex-direction: column;
    }

    /* Mobile order: Status(0) → Sequence(0) → Map(1) → Hands(2) */
    .render-view { order: 1; }
    .gs-player-hands-wrap { order: 2; }

    /* Card panel → left drawer (off-screen by default).
       Overlay panels stack above the chrome rows (which carry z-index
       855-1000 on desktop to clear the floating forces panel).
       Height stops above the tab bar so the Board tab stays reachable. */
    .gs-card-panel {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1100;
        height: calc(100vh - 56px);
    }
    .gs-card-panel.gs-panel-open {
        transform: translateX(0);
    }

    /* Close button visible on mobile panels */
    .gs-panel-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 6px;
        right: 6px;
        width: 32px;
        height: 32px;
        background: #2a2a3a;
        border: 1px solid #444;
        border-radius: 6px;
        color: #aaa;
        font-size: 1.3rem;
        cursor: pointer;
        z-index: 10;
        line-height: 1;
    }
    .gs-panel-close:hover {
        background: #3a3a4a;
        color: #fff;
    }

    /* Forces panel → right drawer (off-screen by default).
       Height is capped to content so the sheet isn't mostly empty black. */
    .gs-forces-panel {
        right: -250px !important;
        top: 0 !important;
        height: auto;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        border-radius: 0 0 0 8px !important;
        transition: right 0.25s ease;
        z-index: 1100;
    }
    .gs-forces-panel.gs-panel-open {
        right: 0 !important;
    }
    /* Drawer header: title and close button flexed apart (close lives inside
       .gs-forces-header on mobile); the desktop collapse caret is hidden */
    .gs-forces-panel .gs-forces-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }
    .gs-forces-panel .gs-forces-collapse-icon {
        display: none;
    }
    .gs-forces-panel .gs-panel-close {
        position: static;
        margin-left: auto;
        flex-shrink: 0;
    }

    /* Action log → slide-up sheet opened from the Log tab */
    .gs-action-log,
    .action-log-panel {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 56px;
        width: 100% !important;
        max-height: 70vh;
        border: none;
        border-top: 1px solid #333;
        border-radius: 12px 12px 0 0 !important;
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.55);
        /* Clear both its own height and the 56px tab-bar gap when hidden */
        transform: translateY(calc(100% + 64px));
        transition: transform 0.25s ease;
        z-index: 1100;
    }

    .gs-action-log.gs-panel-open,
    .action-log-panel.gs-panel-open {
        transform: translateY(0);
    }

    .gs-action-log .gs-log-body,
    .action-log-panel .gs-log-body {
        max-height: 50vh;
    }

    /* Injected close button on the log sheet (header controls shift left) */
    .gs-action-log .gs-panel-close {
        position: absolute;
        top: 4px;
        right: 4px;
        left: auto;
    }
    .gs-action-log.gs-panel-open .gs-log-controls {
        margin-right: 48px;
    }

    /* Tab bar at bottom of screen (>=44px touch targets).
       Stacks above the panel backdrop (955) so e.g. the Board tab still
       works while an overlay panel is open, but below the panels (960). */
    .gs-mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: #111122;
        border-top: 1px solid #333;
        z-index: 1060;
        align-items: stretch;
    }

    .gs-mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #888;
        font-size: 0.65rem;
        cursor: pointer;
        gap: 2px;
        padding: 0;
    }
    .gs-mobile-tab .gs-tab-icon {
        font-size: 1.1rem;
    }
    .gs-mobile-tab.active {
        color: #4fc3f7;
        background: #1a1a2e;
    }

    /* Board padding so it doesn't hide behind tab bar */
    .game-container {
        padding-bottom: 56px;
    }

    /* Compact wizard tweaks for narrow viewports */
    .wizard-compact {
        right: 4px !important;
        top: 4px !important;
        max-width: calc(100vw - 8px) !important;
    }

    /* Zoom controls: responsive override lives at the end of this file
       (after the base .gs-zoom-controls rule, which would otherwise win) */

    /* ----- >=44px touch targets (chips, toolbar, tabs, close buttons) ----- */
    .gs-panel-close {
        width: 44px;
        height: 44px;
    }

    .gs-zoom-btn {
        width: 44px;
        height: 44px;
    }

    .gs-seq-faction {
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }

    .gs-seq-action-btn,
    .gs-seq-flow-btn,
    .gs-special-round-btn,
    .gs-seq-bot-btn,
    .gs-seq-ai-btn {
        min-height: 44px;
    }

    .game-header .game-lobby-btn,
    .gs-dev-toggle {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .gs-dev-toggle {
        min-width: 44px;
        justify-content: center;
    }

    .gs-log-btn,
    .gs-log-filter {
        min-width: 44px;
        min-height: 44px;
    }

    .gs-status-legend-btn::after {
        /* Expand the hit area of the small "?" button to >=44px */
        content: '';
        position: absolute;
        inset: -10px;
    }

    /* ----- Status line: horizontal scroll with fade hint, not wrapping ----- */
    .gs-status-header {
        overflow: hidden;
    }
    .gs-status-summary {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-right: 20px;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
        mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
    }
    .gs-status-summary::-webkit-scrollbar {
        display: none;
    }
}

/* =============================================================================
   Game Header: player strip + collapsible dev cluster
   ============================================================================= */

.game-header {
    position: relative;
    /* Toolbar stacks above the floating forces panel (z-index 800) so the
       dev-cluster dropdown and toolbar buttons are never covered */
    z-index: 1000;
}

.gs-player-strip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.9rem 0.25rem 0.45rem;
    background: #10101c;
    border: 1px solid #2a2a3a;
    border-radius: 8px;
}

.gs-player-chip {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #555;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.gs-player-identity {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.gs-player-faction-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
    white-space: nowrap;
}

.gs-player-turn-status {
    color: #99a;
    font-size: 0.7rem;
    white-space: nowrap;
}

.gs-player-turn-status.my-turn {
    color: #6fdc8c;
    font-weight: 600;
}

.gs-game-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-dev-toggle {
    background: #1a1a2e;
    border: 1px solid #444;
    color: #999;
    border-radius: 6px;
    min-width: 34px;
    min-height: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    flex-shrink: 0;
}

.gs-dev-toggle:hover,
.gs-dev-toggle.active {
    color: #fff;
    border-color: #4fc3f7;
    background: #22223a;
}

.gs-dev-cluster {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0.75rem;
    z-index: 1500;
    background: #15151f;
    border: 1px solid #3a3a4a;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.gs-dev-cluster.open {
    display: flex;
}

/* =============================================================================
   Generic tooltip ([data-gs-tip]) and status-line legend
   ============================================================================= */

.gs-tooltip {
    position: fixed;
    z-index: 2000;
    max-width: 280px;
    background: #0d0d16;
    color: #dde;
    border: 1px solid #4fc3f7;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.75rem;
    line-height: 1.35;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.gs-tooltip.hidden {
    display: none;
}

.gs-status-legend-btn {
    position: relative;
    margin-left: 0.45rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1e2a3c;
    border: 1px solid #3f5a78;
    color: #8fc3f0;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}

.gs-status-legend-btn:hover {
    background: #2a3a52;
    color: #fff;
}

.gs-status-legend-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1600;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.gs-status-legend-overlay.hidden {
    display: none;
}

.gs-status-legend-panel {
    background: #15151f;
    border: 1px solid #3a3a5a;
    border-radius: 10px;
    width: min(460px, 92vw);
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}

.gs-status-legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #2a2a3a;
    color: #fff;
    font-weight: 600;
    position: sticky;
    top: 0;
    background: #15151f;
}

.gs-status-legend-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    min-width: 32px;
    min-height: 32px;
}

.gs-status-legend-close:hover {
    color: #fff;
}

.gs-legend-row {
    display: flex;
    gap: 0.8rem;
    padding: 0.45rem 1rem;
    border-bottom: 1px solid #1e1e2c;
}

.gs-legend-row:last-child {
    border-bottom: none;
}

.gs-legend-token {
    min-width: 120px;
    color: #4fc3f7;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.gs-legend-desc {
    color: #bbc;
    font-size: 0.8rem;
    line-height: 1.35;
}

/* =============================================================================
   Async-return digest banner ("While you were away")
   ============================================================================= */

@keyframes gs-digest-in {
    from { opacity: 0; margin-top: -8px; }
    to { opacity: 1; margin-top: 0; }
}

.gs-digest-banner {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1400;
    width: min(540px, 92vw);
    background: #141426;
    border: 1px solid rgba(79, 195, 247, 0.65);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
    animation: gs-digest-in 0.3s ease-out;
}

.gs-digest-banner.hidden {
    display: none;
}

.gs-digest-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid #2a2a44;
}

.gs-digest-title {
    color: #4fc3f7;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.gs-digest-count {
    color: #778;
    font-size: 0.75rem;
}

.gs-digest-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #889;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 6px;
    min-width: 32px;
    min-height: 32px;
}

.gs-digest-close:hover {
    color: #fff;
}

.gs-digest-list {
    list-style: none;
    margin: 0;
    padding: 0.4rem 0;
    max-height: 240px;
    overflow-y: auto;
}

.gs-digest-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.3rem 0.9rem;
    color: #ccd;
    font-size: 0.82rem;
    line-height: 1.35;
}

.gs-digest-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    background: #666;
}

.gs-digest-earlier {
    color: #667;
    font-style: italic;
}

@media (max-width: 768px) {
    /* Mobile: full-width sheet from the top */
    .gs-digest-banner {
        top: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        border-radius: 0 0 12px 12px;
        border-left: none;
        border-right: none;
        border-top: none;
    }

    .gs-digest-close {
        min-width: 44px;
        min-height: 44px;
    }
}

/* =============================================================================
   Panel backdrop (shared by mobile tabs and tablet card drawer)
   ============================================================================= */

.gs-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    /* Above the chrome rows (855-1000), below the tab bar (1060) and the
       overlay panels (1100) */
    z-index: 1050;
}

.gs-mobile-backdrop.visible {
    display: block;
}

/* =============================================================================
   Tablet / small laptop breakpoint (769-1100px):
   card sidebar collapses to a drawer, board gets full width
   ============================================================================= */

.gs-card-drawer-toggle {
    display: none;
    position: fixed;
    left: 12px;
    bottom: 56px;
    z-index: 940;
    align-items: center;
    gap: 6px;
    background: rgba(17, 17, 34, 0.92);
    border: 1px solid #444;
    color: #ccc;
    border-radius: 8px;
    padding: 8px 14px;
    min-height: 44px;
    cursor: pointer;
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
}

.gs-card-drawer-toggle:hover,
.gs-card-drawer-toggle.active {
    border-color: #4fc3f7;
    color: #fff;
}

@media (min-width: 769px) and (max-width: 1100px) {
    main.gs-game,
    main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Card panel → left drawer (off-screen by default), above the
       chrome rows (z-index 855-1000) */
    .gs-card-panel {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1100;
    }

    .gs-card-panel.gs-panel-open {
        transform: translateX(0);
    }

    /* Close button visible inside the drawer */
    .gs-panel-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 6px;
        right: 6px;
        width: 36px;
        height: 36px;
        background: #2a2a3a;
        border: 1px solid #444;
        border-radius: 6px;
        color: #aaa;
        font-size: 1.3rem;
        cursor: pointer;
        z-index: 10;
        line-height: 1;
    }

    .gs-card-drawer-toggle {
        display: inline-flex;
    }

    /* Zoom controls override lives at the end of this file (after the
       base .gs-zoom-controls rule, which would otherwise win) */
}

/* =============================================================================
   Zoom Controls
   ============================================================================= */

.gs-zoom-controls {
    position: fixed;
    bottom: 12px;
    left: 352px;
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(17, 17, 34, 0.9);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 3px;
    z-index: 850;
    backdrop-filter: blur(4px);
    user-select: none;
}

.gs-zoom-btn {
    width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a3a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
}

.gs-zoom-btn:hover {
    background: #3a3a4a;
    border-color: #4fc3f7;
    color: #fff;
}

.gs-zoom-btn:active {
    background: #4a4a5a;
}

.gs-zoom-level {
    min-width: 44px;
    text-align: center;
    color: #aaa;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0 4px;
}

/* Responsive zoom-control placement. These must come after the base
   .gs-zoom-controls rule above — equal specificity means source order
   decides, and the base rule would otherwise override the breakpoints. */

@media (min-width: 769px) and (max-width: 1100px) {
    /* Card sidebar is a drawer here, so follow the board to the left edge */
    .gs-zoom-controls {
        left: 12px;
    }
}

@media (max-width: 768px) {
    /* Above the mobile tab bar; desktop left offset is off-screen on phones */
    .gs-zoom-controls {
        bottom: 64px;
        left: 12px;
    }
}
