*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a1a;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#game-canvas {
    display: block;
    position: fixed;
    top: 40px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 40px);
    cursor: grab;
}

#game-canvas:active {
    cursor: grabbing;
}

/* ── Menu Bar ─────────────────────────────────────────────────────────────── */
.menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(15, 15, 25, 0.95);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 8px;
    z-index: 99999;
    border-bottom: 1px solid rgba(255, 255, 255, 0.11);
    overflow: visible;
}

.menu-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ccc;
    padding: 4px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    letter-spacing: 0.03em;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.38);
    color: #fff;
    transform: translateY(-1px);
}

.menu-btn.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.menu-round-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    letter-spacing: 0.04em;
    pointer-events: none;
    user-select: none;
}

.menu-bar-sep {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.menu-round-boxes {
    display: flex;
    gap: 4px;
    align-items: center;
}

.round-box {
    width: 13px;
    height: 13px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 2px;
    background: transparent;
}

.round-box.filled {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(255, 255, 255, 0.75);
}

.menu-turn-label {
    color: rgba(255, 255, 255, 0.75);
}

.menu-phase-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.menu-player-name {
    font-weight: 600;
}

.menu-vp-circles {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.menu-vp-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    flex-shrink: 0;
    opacity: 0.65;
    transition: box-shadow 0.25s, opacity 0.25s;
    user-select: none;
}

.menu-vp-circle.is-logged-in-active {
    opacity: 1;
    /* box-shadow glow is set via inline style using each player's HexColor */
}

/* ── Right-side panel (Reveal Space + Move Ship tabs) ────────────────────── */
.reveal-panel {
    position: fixed;
    top: 40px;
    right: 0;
    bottom: 0;
    width: 36px;          /* collapsed: only the tab handle */
    display: flex;
    flex-direction: row;
    z-index: 150;
    transition: width 0.22s ease;
    pointer-events: all;
}

.reveal-panel.open {
    width: 256px;         /* 36px tabs + 220px content */
}

.reveal-panel-tabs {
    width: 36px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.reveal-panel-tab {
    flex: 1;
    background: #0f0f19;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.reveal-panel-tab:hover {
    color: #fff;
    background: #1a1a28;
}

.reveal-panel-tab.active {
    color: #cc88ff;
    border-left-color: rgba(200, 100, 200, 0.5);
    background: #1e051e;
}

.reveal-panel-content {
    flex: 1;
    overflow-y: auto;
    background: #0f0f19;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 14px 20px;
    display: none;
}

.reveal-panel.open .reveal-panel-content {
    display: block;
}

.reveal-panel-content.not-my-turn {
    pointer-events: none;
}

/* ── Move Ship panel content ─────────────────────────────────────────────── */
.move-panel-info {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.move-panel-info p {
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    line-height: 1.5;
}

.move-panel-rule {
    color: rgba(255, 220, 100, 0.8) !important;
    font-size: 11px !important;
}

.move-panel-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.25);
}

.move-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.move-stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.move-stat-value {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}

.move-stat-value.warn {
    color: #ff8888;
}

.move-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.move-accept-btn {
    padding: 0.5rem 0.75rem;
    background: rgba(20, 100, 40, 0.45);
    border: 1px solid rgba(80, 200, 100, 0.5);
    border-radius: 7px;
    color: rgba(160, 255, 180, 0.9);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
}

.move-accept-btn:hover:not(:disabled) {
    background: rgba(30, 140, 60, 0.65);
    border-color: rgba(100, 220, 120, 0.8);
    color: #fff;
}

.move-accept-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.move-cancel-btn {
    padding: 0.5rem 0.75rem;
    background: rgba(100, 20, 20, 0.35);
    border: 1px solid rgba(200, 80, 80, 0.4);
    border-radius: 7px;
    color: rgba(255, 160, 160, 0.8);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
}

.move-cancel-btn:hover {
    background: rgba(160, 30, 30, 0.55);
    border-color: rgba(220, 100, 100, 0.7);
    color: #fff;
}

/* ── Action Bar (bottom center) ──────────────────────────────────────────── */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: row;
    gap: 12px;
    padding: 10px 20px 14px;
    background: rgba(10, 10, 26, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    pointer-events: all;
}

.action-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    width: 110px;
    flex: 0 0 110px;
}

.action-slot.action-slot-stacked {
    justify-content: center;
    gap: 6px;
}

.action-slot.action-slot-stacked .action-btn {
    width: 100%;
}

.action-cost-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.action-cost {
    font-size: 12px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.55);
    letter-spacing: 0.04em;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.action-cost.warn {
    border-color: rgba(255, 80, 80, 0.85);
    color: #ff8888;
    background: rgba(80, 0, 0, 0.45);
}

.action-cost.action-cost-inactive {
    background: #111;
    border-color: #444;
    color: transparent;
}

.sector-discount-badge {
    font-size: 11px;
    font-weight: 700;
    color: #7fff7f;
    background: rgba(0, 80, 0, 0.65);
    border: 1px solid rgba(127, 255, 127, 0.55);
    border-radius: 4px;
    padding: 1px 6px;
    letter-spacing: 0.03em;
    cursor: default;
    user-select: none;
    line-height: 1.4;
}

.action-btn {
    padding: 0.45rem 0.75rem;
    flex: 1;
    background: rgba(80, 0, 80, 0.3);
    border: 1px solid rgba(200, 100, 200, 0.35);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.13s;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-btn:hover {
    background: rgba(128, 0, 128, 0.45);
    border-color: rgba(220, 130, 220, 0.6);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.action-btn.selected {
    background: rgba(160, 0, 160, 0.55);
    border-color: rgba(220, 140, 220, 0.9);
    color: #fff;
    box-shadow: 0 0 10px rgba(160, 0, 200, 0.4);
    transform: translateY(-1px);
}

.action-bar-separator {
    width: 1px;
    align-self: stretch;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 0;
    flex-shrink: 0;
}

.action-btn.action-btn-reveal-space {
    background: rgba(30, 90, 180, 0.3);
    border-color: rgba(109, 177, 255, 0.45);
    color: rgba(109, 177, 255, 0.85);
}

.action-btn.action-btn-reveal-space:hover {
    background: rgba(50, 120, 220, 0.45);
    border-color: rgba(109, 177, 255, 0.75);
    color: #fff;
}

.action-btn.action-btn-reveal-space.selected {
    background: rgba(50, 130, 230, 0.55);
    border-color: rgba(109, 177, 255, 0.95);
    color: #fff;
    box-shadow: 0 0 10px rgba(109, 177, 255, 0.4);
}

.action-btn.action-btn-move-ship {
    background: rgba(30, 100, 40, 0.3);
    border-color: rgba(84, 196, 94, 0.45);
    color: rgba(84, 196, 94, 0.85);
}

.action-btn.action-btn-move-ship:hover {
    background: rgba(45, 140, 55, 0.45);
    border-color: rgba(84, 196, 94, 0.75);
    color: #fff;
}

.action-btn.action-btn-move-ship.selected {
    background: rgba(50, 155, 60, 0.55);
    border-color: rgba(84, 196, 94, 0.95);
    color: #fff;
    box-shadow: 0 0 10px rgba(84, 196, 94, 0.4);
}

.action-btn.action-btn-deploy-harvester {
    background: rgba(80, 30, 100, 0.3);
    border-color: rgba(224, 143, 255, 0.45);
    color: rgba(224, 143, 255, 0.85);
}

.action-btn.action-btn-deploy-harvester:hover {
    background: rgba(110, 50, 140, 0.45);
    border-color: rgba(224, 143, 255, 0.75);
    color: #fff;
}

.action-btn.action-btn-deploy-harvester.selected {
    background: rgba(120, 60, 155, 0.55);
    border-color: rgba(224, 143, 255, 0.95);
    color: #fff;
    box-shadow: 0 0 10px rgba(224, 143, 255, 0.4);
}

.action-btn.action-btn-visit-planet {
    background: rgba(100, 10, 10, 0.3);
    border-color: rgba(232, 19, 19, 0.45);
    color: rgba(255, 110, 110, 0.85);
}

.action-btn.action-btn-visit-planet:hover {
    background: rgba(140, 15, 15, 0.45);
    border-color: rgba(232, 19, 19, 0.75);
    color: #fff;
}

.action-btn.action-btn-visit-planet.selected {
    background: rgba(160, 20, 20, 0.55);
    border-color: rgba(232, 19, 19, 0.95);
    color: #fff;
    box-shadow: 0 0 10px rgba(232, 19, 19, 0.4);
}

.action-btn-cards {
    background: rgba(40, 40, 80, 0.35);
    border-color: rgba(160, 160, 240, 0.4);
    color: rgba(200, 200, 255, 0.8);
}

.action-btn-cards:hover {
    background: rgba(60, 60, 120, 0.55);
    border-color: rgba(180, 180, 255, 0.7);
    color: #fff;
}

.action-btn-pass {
    background: rgba(40, 80, 40, 0.35);
    border-color: rgba(100, 200, 100, 0.4);
    color: rgba(180, 255, 180, 0.8);
}

.action-btn-pass:hover {
    background: rgba(60, 140, 60, 0.55);
    border-color: rgba(120, 220, 120, 0.7);
    color: #fff;
}

.action-btn-end-turn {
    background: rgba(20, 60, 120, 0.35);
    border-color: rgba(80, 160, 255, 0.4);
    color: rgba(160, 210, 255, 0.8);
}

.action-btn-end-turn:hover:not(:disabled) {
    background: rgba(30, 90, 180, 0.55);
    border-color: rgba(100, 180, 255, 0.7);
    color: #fff;
}

.action-btn:disabled,
.action-btn-pass:disabled,
.action-btn-end-turn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

/* ── Harvester Panel (Deploy Harvester tab) ──────────────────────────────── */
.harvester-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.harvester-panel-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
    line-height: 1.5;
}

.harvester-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.harvester-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: background 0.18s, border-color 0.18s, transform 0.13s;
}

.harvester-item.available {
    cursor: pointer;
}

.harvester-item.available:hover {
    background: rgba(224, 143, 255, 0.12);
    border-color: rgba(224, 143, 255, 0.4);
    transform: translateX(3px);
}

.harvester-item.unavailable {
    opacity: 0.38;
    cursor: default;
}

.harvester-disc-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--harvester-color);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.harvester-disc-center {
    width: 75%;
    height: 75%;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.harvester-disc-label {
    font-size: 13px;
    font-weight: 700;
    color: #111;
    line-height: 1;
}

.harvester-item-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

/* Harvester tab accent color */
.reveal-panel-tab-harvester.active {
    color: #E08FFF;
    border-left-color: rgba(224, 143, 255, 0.5);
    background: #1a0923;
}

/* Visit Planet tab accent color */
.reveal-panel-tab-visit-planet.active {
    color: #ff6b6b;
    border-left-color: rgba(232, 19, 19, 0.5);
    background: #1f0606;
}

/* Ship Upgrade tab accent color */
.reveal-panel-tab-ship-upgrade.active {
    color: #CED4DB;
    border-left-color: rgba(206, 212, 219, 0.5);
    background: #161d23;
}

/* Wider panel for Ship Upgrade (shows SVG upgrade map) */
.reveal-panel.open.wide {
    width: 500px;   /* 36px tabs + 464px content */
}

/* ── Ship Upgrade action button ─────────────────────────────────────────── */
.action-btn.action-btn-ship-upgrade {
    background: rgba(60, 80, 100, 0.3);
    border-color: rgba(206, 212, 219, 0.45);
    color: rgba(206, 212, 219, 0.85);
}

.action-btn.action-btn-ship-upgrade:hover {
    background: rgba(80, 105, 130, 0.45);
    border-color: rgba(206, 212, 219, 0.75);
    color: #fff;
}

.action-btn.action-btn-ship-upgrade.selected {
    background: rgba(90, 115, 140, 0.55);
    border-color: rgba(206, 212, 219, 0.95);
    color: #fff;
    box-shadow: 0 0 10px rgba(206, 212, 219, 0.3);
}

/* ── Upgrade map SVG panel ──────────────────────────────────────────────── */
.upgrade-map-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
}

.upgrade-map-svg {
    display: block;
    max-width: 100%;
    overflow: visible;
}

/* ── Upgrade hover tile preview (fixed area below the map) ─────────────── */
.upgrade-tile-preview {
    height: 134px;   /* fixed: 110px image + 2×10px padding + 2×2px border */
    box-sizing: border-box;
    border: 1px solid rgba(140, 140, 255, 0.2);
    border-radius: 8px;
    background: rgba(12, 12, 30, 0.75);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.upgrade-tile-preview-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.upgrade-tile-preview-img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 6px;
    transform: rotate(0deg);
    filter: drop-shadow(0 0 8px rgba(120, 140, 255, 0.4));
}

.upgrade-tile-preview-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upgrade-tile-preview-name {
    font-size: 14px;
    font-weight: 700;
    color: rgba(200, 210, 255, 0.95);
    letter-spacing: 0.04em;
}

.upgrade-tile-preview-desc {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(180, 185, 210, 0.75);
}

.upgrade-tile-preview-empty {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    font-style: italic;
    margin: auto;
    text-align: center;
}

/* ── Tech grid panel ────────────────────────────────────────────────────── */
.tech-grid-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
}

.tech-grid-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

.tech-grid-hint {
    font-size: 11px;
    color: rgba(255, 220, 100, 0.8);
    text-align: center;
    line-height: 1.4;
}

.tech-grid-svg {
    display: block;
    overflow: visible;
}

/* ── Upgrade preview in ActionPanel Phase B ─────────────────────────────── */
.upgrade-preview-wrap {
    display: flex;
    justify-content: center;
    margin: 6px 0;
}

.upgrade-preview-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(206, 212, 219, 0.35);
    background: rgba(30, 30, 60, 0.6);
}

/* ── Free action (Spend AT) panel ───────────────────────────────────────── */
.free-action-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    width: 90px;
    flex: 0 0 90px;
    align-self: stretch;
}

.free-action-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    flex: 1;
    min-height: 72px;
    padding: 8px 10px;
    border: 1.5px dashed rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.free-action-drop-zone.drag-over {
    border-color: rgba(255, 220, 80, 0.75);
    background: rgba(255, 220, 80, 0.08);
    box-shadow: inset 0 0 14px rgba(255, 220, 80, 0.12);
}

.free-action-label {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    user-select: none;
}

.free-action-tokens {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn-cancel-free {
    background: rgba(100, 30, 30, 0.35);
    border-color: rgba(220, 80, 80, 0.45);
    color: rgba(255, 160, 160, 0.85);
    width: 100%;
}

.action-btn-cancel-free:hover {
    background: rgba(160, 40, 40, 0.55);
    border-color: rgba(240, 100, 100, 0.7);
    color: #fff;
}

/* ── Turn info panel ─────────────────────────────────────────────────────── */
@keyframes turn-panel-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.turn-info-panel {
    position: fixed;
    top: 44px;
    left: 50%;
    transform: translateX(-50%);
    width: 420px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 7px 20px;
    color: rgba(255, 255, 255, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(10, 10, 26, 0.90);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-sizing: border-box;
    user-select: none;
    z-index: 120;
    pointer-events: none;
    animation: turn-panel-in 0.25s ease;
    transition: color 0.35s, border-color 0.35s, box-shadow 0.35s;
}

.turn-info-panel.turn-info-my-turn {
    color: #ffe87a;
    border-color: rgba(255, 200, 0, 0.75);
    box-shadow: 0 0 16px rgba(255, 200, 0, 0.30);
}

/* ── Player board anchor (fixed wrapper for info panel + board) ───────────── */
.player-board-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    pointer-events: none;
}

.player-board-container > * {
    pointer-events: all;
}

/* ── Player Board rename ─────────────────────────────────────────────────── */
.player-board {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: rgba(10, 10, 26, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: none;  /* set inline per player color */
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    pointer-events: all;
    overflow: visible;
}

.action-board-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    padding: 10px 20px 14px;
}

/* ── Token discs ─────────────────────────────────────────────────────────── */
.token-slots {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: center;
    margin-top: 4px;
}

.token-disc {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--token-color, #888);
    background: transparent;
    flex-shrink: 0;
    overflow: hidden;
    transition: background 0.18s, opacity 0.18s, transform 0.15s, box-shadow 0.15s;
}

.token-disc.filled {
    background: var(--token-color, #888);
}

.token-disc-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    border-radius: 50%;
}

.token-disc.toggled {
    opacity: 0.35;
    filter: grayscale(0.4);
}

.token-disc.clickable {
    cursor: pointer;
}

.token-disc.clickable:hover {
    transform: scale(1.25);
    box-shadow: 0 0 10px var(--token-color, #888);
}

/* ── Token-choice dialog (income phase) ─────────────────────────────────── */
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes dialog-scale-in {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}

.token-choice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fade-in 0.2s ease;
}

.token-choice-dialog {
    background: rgba(12, 12, 28, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 28px 36px 32px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    animation: dialog-scale-in 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.tcd-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.06em;
    text-align: center;
}

.tcd-player {
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    opacity: 0.85;
}

.tcd-discs {
    display: flex;
    flex-direction: row;
    gap: 28px;
    margin-top: 4px;
}

.tcd-disc {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s;
}

.tcd-disc:hover:not(:disabled) {
    transform: scale(1.08);
}

.tcd-disc-img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    box-shadow: 0 0 14px var(--token-color, #888);
    transition: box-shadow 0.15s;
}

.tcd-disc:hover:not(:disabled) .tcd-disc-img {
    box-shadow: 0 0 24px var(--token-color, #888);
}

.tcd-disc-label {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.tcd-disc-disabled,
.tcd-disc:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tile-tray {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.tile-tray-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tile-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #c0c0d0;
    min-width: 16px;
    text-align: center;
}

.tile-count-empty {
    color: #802020;
}

.hex-tile-2d {
    cursor: pointer;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
    transition: filter 0.15s;
}

.hex-tile-2d:hover {
    filter: drop-shadow(0 2px 10px rgba(160, 0, 160, 0.7));
}

.hex-tile-2d:hover polygon {
    fill: #a030a0;
}

.tile-tray-disabled .hex-tile-2d {
    cursor: not-allowed;
    opacity: 0.4;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.tile-tray-disabled .hex-tile-2d:hover {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.tile-tray-disabled .hex-tile-2d:hover polygon {
    fill: #800080;
}

.hex-tile-2d-unaffordable {
    cursor: not-allowed;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.hex-tile-2d-unaffordable polygon {
    fill: #802020 !important;
}

.hex-tile-2d-unaffordable:hover {
    filter: drop-shadow(0 2px 8px rgba(180, 0, 0, 0.5));
}

.hex-tile-2d-unaffordable:hover polygon {
    fill: #aa2020 !important;
}

/* ── Debug Overlay (removed) */

/* ── Lobby ──────────────────────────────────────────────────────────────── */
.lobby-container {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0a0a1a;
    gap: 2rem;
}

.lobby-title {
    color: #cc88ff;
    font-size: 3rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-shadow: 0 0 24px #800080;
}

.lobby-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(128, 0, 128, 0.4);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    backdrop-filter: blur(10px);
    min-width: 300px;
}

.lobby-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.lobby-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(128, 0, 128, 0.5);
    border-radius: 6px;
    color: #fff;
    font-size: 1.2rem;
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: border-color 0.2s;
}

.lobby-input:focus {
    border-color: #cc88ff;
}

.lobby-btn {
    margin-top: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #800080, #400060);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: filter 0.2s;
}

.lobby-btn:hover {
    filter: brightness(1.35);
}

.lobby-btn-secondary {
    margin-top: 0.25rem;
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.lobby-btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.lobby-join-info {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    margin: 0;
    text-align: center;
}

.lobby-error {
    color: #ff6666;
    font-size: 0.85rem;
    text-align: center;
    margin: 0;
}

/* ── Player Switcher ─────────────────────────────────────────────────────── */
.player-switcher {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.player-btn {
    padding: 3px 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
}

.player-btn.active {
    font-weight: bold;
    color: #fff;
    border-color: currentColor;
}

/* ── Game Debug Panel (removed) */

/* ── Active Player Panel (lower left) ───────────────────────────────────── */
.active-player-card {
    position: fixed;
    bottom: 1rem;
    left: 88px;
    z-index: 150;
    pointer-events: none;
    text-align: center;
}

/* Resource cluster: large energy circle with tholin overlaid bottom-right */
.apc-resource-cluster {
    position: relative;
    display: inline-flex;
    justify-content: center;
    margin: 0 auto 0;
    padding-right: 20px;
    padding-bottom: 20px;
}

.apc-energy-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(30, 50, 70, 0.92);
    border: 2.5px solid rgba(80, 160, 255, 0.45);
    box-shadow: 0 0 18px rgba(80, 160, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: border-color 0.35s, box-shadow 0.35s;
}

.apc-energy-value {
    font-size: 3.2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.apc-energy-main {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
}

.apc-energy-icon {
    font-size: 1.6rem;
    line-height: 1;
    color: rgba(150, 210, 255, 0.9);
}

.apc-tholin-circle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(50, 30, 55, 0.95);
    border: 2px solid rgba(160, 90, 210, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: border-color 0.35s;
}

.apc-tholin-value {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.apc-tholin-icon {
    font-size: 1rem;
    line-height: 1;
    color: rgba(210, 170, 255, 0.9);
}

.apc-energy-used {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(150, 210, 255, 0.7);
    text-align: center;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
/* ── Phase Toast (removed — notifications now in game log panel) */



@keyframes active-turn-pulse {
    0%   { box-shadow: 0 0 12px rgba(200, 168, 0, 0.35); }
    50%  { box-shadow: 0 0 22px rgba(200, 168, 0, 0.65); }
    100% { box-shadow: 0 0 12px rgba(200, 168, 0, 0.35); }
}

.other-player-card {
    background: rgba(18, 16, 32, 0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    /* border-left set inline with player color */
    border-radius: 8px;
    padding: 0.4rem 0.65rem 0.4rem 0.55rem;
    width: 160px;
    flex: 0 0 160px;
    display: flex;
    flex-direction: column;
    gap: 0;
    pointer-events: auto;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}

.other-player-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.other-player-card.is-active-turn {
    border: 1px solid #c8a800;
    border-left: 3px solid #c8a800;
    box-shadow: 0 0 12px rgba(200, 168, 0, 0.35);
    animation: active-turn-pulse 1.8s ease-in-out 1;
}

.other-player-card.is-logged-in {
    border-color: rgba(255, 255, 255, 0.30);
    background: rgba(35, 33, 55, 0.97);
}

/* Header row: name + star + done badge */
.opc-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    min-height: 1.15rem;
}

.opc-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

.opc-name {
    font-size: 1.0rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.opc-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 6px;
}

.opc-stat {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.opc-label {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.2;
}

.opc-value {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.1;
}

.opc-done-badge {
    margin-left: auto;
    color: rgba(100, 220, 100, 0.85);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Admin Menu ────────────────────────────────────────────────────────────── */
.admin-menu-wrap {
    position: relative;
}

.admin-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: rgba(15, 10, 30, 0.97);
    border: 1px solid rgba(200, 100, 200, 0.35);
    border-radius: 10px;
    min-width: 260px;
    z-index: 9100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.admin-dropdown-item:hover {
    background: rgba(128, 0, 128, 0.35);
    border-color: rgba(200, 100, 200, 0.45);
    color: #fff;
}

.admin-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9099;
}

/* ── Waiting for Players Overlay ──────────────────────────────────────────── */
.waiting-overlay {
    position: fixed;
    top: 40px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    animation: fade-in 0.2s ease;
}

.waiting-dialog {
    background: rgba(12, 12, 28, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 2.2rem 2.8rem 2rem;
    min-width: 320px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    animation: dialog-scale-in 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.waiting-title {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.waiting-message {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    margin-bottom: 1.4rem;
}

.waiting-slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.waiting-slot {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.waiting-slot.filled {
    background: rgba(80, 200, 80, 0.1);
    border: 1px solid rgba(80, 200, 80, 0.25);
    color: rgba(255, 255, 255, 0.8);
}

.waiting-slot.empty {
    background: rgba(255, 100, 100, 0.08);
    border: 1px solid rgba(255, 100, 100, 0.2);
    color: rgba(255, 255, 255, 0.4);
}

.waiting-slot-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.waiting-slot-done {
    margin-left: auto;
    color: rgba(80, 200, 80, 0.8);
    font-size: 0.8rem;
}

/* ── All Players – vertical left column ─────────────────────────────────── */
.players-top-bar {
    position: fixed;
    top: 44px;
    left: 88px;
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    pointer-events: none;
    align-items: flex-start;
    width: max-content;
}

/* ── Income Panel (left side) ───────────────────────────────────────────── */
.income-panel {
    position: fixed;
    top: 40px;
    left: 0;
    bottom: 0;
    width: 80px;
    background: #0a1a3a;
    padding: 12px 6px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.income-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.income-track-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
    user-select: none;
}

.income-track-divider {
    width: 80%;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 2px 0;
}

.income-track-boxes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    position: relative;
}

/* Vertical connector line running through the center of all boxes */
.income-track-boxes::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;           /* padding-left(6) + half box(14) = 20px */
    transform: translateX(-50%);
    width: 3px;
    background: rgba(100, 160, 255, 0.2);
    border-radius: 2px;
    z-index: 0;
}

.income-track-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
    width: 100%;
    justify-content: flex-start;
    padding-left: 6px;
    margin-bottom: 14px;
}

.income-track-row:last-child {
    margin-bottom: 0;
}

.income-box {
    width: 28px;
    height: 28px;
    border: 1.5px solid rgba(100, 160, 255, 0.4);
    border-radius: 5px;
    background: #0a1a3a;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.income-box-size {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1;
    user-select: none;
}

.income-box.filled .income-box-size {
    color: rgba(255, 255, 255, 0.85);
}

.income-box.filled {
    background: #4488ff;
    border-color: #88bbff;
    box-shadow: 0 0 8px rgba(68, 136, 255, 0.7);
}

.income-box-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.55);
    min-width: 20px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 2px;
}

.income-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.6));
}

.income-icon-text {
    font-size: 13px;
    line-height: 1;
}

/* ── Game Log Panel (top right) ──── */
.game-log-panel {
    position: fixed;
    top: 44px;
    right: 16px;
    width: 400px;
    height: 130px;
    background: rgba(10, 12, 20, 0.90);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.game-log-header {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
    user-select: none;
}

.game-log-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.game-log-list::-webkit-scrollbar {
    width: 4px;
}
.game-log-list::-webkit-scrollbar-track {
    background: transparent;
}
.game-log-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

@keyframes log-entry-in {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: none; }
}

.game-log-entry {
    display: flex;
    gap: 6px;
    align-items: baseline;
    line-height: 1.4;
    animation: log-entry-in 0.2s ease;
}

.game-log-ts {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.game-log-player {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    margin-right: 2px;
}

.game-log-msg {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.game-log-entry.notification .game-log-ts {
    color: rgba(255, 200, 60, 0.6);
}

.game-log-entry.notification .game-log-msg {
    color: rgba(255, 220, 100, 0.95);
    font-weight: 600;
}

/* ── Action Tracks panel (inside player board, below action row) ─────────── */
.action-tracks-panel {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
    padding: 8px 20px;
    background: #141420;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    overflow-x: auto;
}

/* Spacer that aligns the track columns under the action slots.
   Width = toggle(32) + sep(1+24) + stacked(110) + sep(1+24) + free-action(90) + sep(1+24) = 307px */
.action-tracks-tech {
    flex-shrink: 0;
    width: 307px;
    padding-right: 8px;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 2× scaled TechGrid inside the expanded panel */
.action-tracks-tech .tech-grid-svg {
    width: 296px !important;
    height: 276px !important;
}

.at-panel-tracks {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

/* ── Inline action track (vertical, under each action button) ────────────── */
.action-track-vert {
    width: 100%;
}

.action-track-vert-boxes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    position: relative;
}

/* Vertical connector line through box centres */
.action-track-vert-boxes::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 14px;
    transform: translateX(-50%);
    width: 3px;
    background: rgba(100, 160, 255, 0.18);
    border-radius: 2px;
    z-index: 0;
}

.action-track-vert-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    position: relative;
    z-index: 1;
    width: 100%;
    justify-content: flex-start;
    padding-left: 0;
    margin-bottom: 8px;
}

.action-track-vert-row:last-child {
    margin-bottom: 0;
}

.action-track-vert-box {
    width: 28px;
    height: 28px;
    border: 1.5px solid rgba(100, 160, 255, 0.4);
    border-radius: 5px;
    background: #0a1a3a;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-track-vert-box.filled {
    background: #4488ff;
    border-color: #88bbff;
    box-shadow: 0 0 6px rgba(68, 136, 255, 0.6);
}

.action-track-vert-box.filled .action-track-vert-num {
    color: #fff;
}

.action-track-vert-num {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1;
    user-select: none;
}

.action-track-vert-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

/* +1/+3 token disc — always filled, distinct glow */
.token-disc.plus-token {
    outline: 2px solid rgba(255, 220, 80, 0.6);
    outline-offset: 1px;
}

.token-disc.plus-token.clickable:hover {
    outline-color: rgba(255, 220, 80, 1);
    transform: scale(1.25);
}

/* ── +1/+3 Discard dialog ────────────────────────────────────────────────── */
.plus-discard-desc {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    line-height: 1.5;
    margin: 0 0 4px;
}

.sector-bonus-desc {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    line-height: 1.5;
    margin: 0 0 8px;
}

.plus-discard-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

/* ── Level 6 choice dialog ───────────────────────────────────────────────── */
.cleanup-level6-dialog {
    min-width: 340px;
}

.level6-desc {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    line-height: 1.5;
    margin: 0 0 4px;
}

/* ── Cleanup Rewards dialog ──────────────────────────────────────────────── */
.cleanup-rewards-dialog {
    min-width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    align-items: flex-start;
}

.cleanup-player-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 4px;
}

.cleanup-player-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cleanup-player-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.03em;
}

.cleanup-rewards-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 18px;
}

.cleanup-reward-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.cleanup-track-label {
    color: rgba(255, 255, 255, 0.45);
    min-width: 140px;
    flex-shrink: 0;
}

.cleanup-reward-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
}

.cleanup-reward-text {
    color: rgba(255, 255, 255, 0.85);
}

.cleanup-continue-btn {
    margin-top: 16px;
    align-self: center;
}

/* ── Action Tracks expanded panel rows ───────────────────────────────────── */
.at-panel-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 110px;
    flex: 0 0 110px;
}

.at-panel-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.04em;
    text-align: center;
    white-space: nowrap;
}

.action-tracks-toggle-btn {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 4px 8px;
    width: 32px;
    flex: 0 0 32px;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    align-self: stretch;
    flex-shrink: 0;
}

/* ── Turn Penalty Widget (inline in player board) ──────────────────────────── */
.tpp-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 14px;
    min-width: 56px;
    background: rgba(25, 20, 45, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.18s, background 0.18s, transform 0.15s;
    align-self: center;
}
.tpp-widget:hover {
    background: rgba(45, 38, 70, 0.92);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.06);
}
.tpp-widget.open {
    border-color: rgba(255, 200, 60, 0.55);
    background: rgba(50, 42, 70, 0.95);
}
.tpp-widget-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}
.tpp-widget-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    line-height: 1.3;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Turn Penalty Slide-Up Detail Panel ─────────────────────────────────────── */
.tpp-detail-panel {
    position: fixed;
    bottom: calc(100px + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 250;
    background: rgba(12, 10, 24, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 18px 24px 16px;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.65);
    animation: tpp-slide-up 0.18s ease-out;
}

@keyframes tpp-slide-up {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.tpp-horizontal-track {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
}

.tpp-turn-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 88px;
    padding: 12px 10px 10px;
    border: 2px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(25, 22, 42, 0.85);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.tpp-turn-box.active {
    border-color: rgba(255, 200, 60, 0.8);
    background: rgba(60, 52, 20, 0.92);
    box-shadow: 0 0 12px rgba(255, 200, 60, 0.25);
}

.tpp-turn-box.paid {
    opacity: 0.45;
}

.tpp-turn-box.upcoming {
    opacity: 0.6;
}

.tpp-box-turn {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1;
}

.tpp-box-penalty {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.tpp-turn-box.active .tpp-box-penalty {
    color: #ffd040;
    text-shadow: 0 0 8px rgba(255, 200, 60, 0.6);
}

.tpp-box-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.05em;
}

.tpp-connector {
    width: 28px;
    height: 2px;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}
/* ── Must-Pass Dialog ─────────────────────────────────────────────────────── */
.must-pass-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fade-in 0.2s ease;
}

.must-pass-dialog {
    background: rgba(12, 12, 28, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 32px 40px 28px;
    min-width: 320px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    animation: dialog-scale-in 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.must-pass-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.must-pass-message {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

.must-pass-ok {
    margin-top: 8px;
    padding: 9px 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.15s;
}

.must-pass-ok:hover {
    background: rgba(255, 255, 255, 0.18);
}

.action-tracks-toggle-btn:hover {
    background: rgba(60, 60, 80, 0.7);
    color: #fff;
}

.action-tracks-toggle-btn.active {
    background: rgba(40, 40, 60, 0.85);
    border-color: rgba(180, 160, 255, 0.4);
    color: #cc88ff;
}

/* ── Visit Planet — path/card selection panel ───────────────────────────── */
.visit-planet-select-info {
    padding: 8px 0 4px;
}

.visit-planet-select-info p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 4px;
}

.vp-confirm-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
}

/* ── Planet card market ─────────────────────────────────────────────────── */
.planet-card-market {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 12px;
    padding-top: 10px;
}

.pcm-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 8px;
}

.pcm-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.planet-card-market-item {
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
    cursor: default;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.13s;
}

.planet-card-market-item.selectable {
    cursor: pointer;
}

.planet-card-market-item.selectable:hover {
    border-color: rgba(232, 19, 19, 0.6);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    transform: translateY(-3px);
}

.planet-card-market-item.selected {
    border-color: rgba(232, 19, 19, 0.95);
    box-shadow: 0 0 10px rgba(232, 19, 19, 0.5);
}

/* Market cards — no rotation, portrait orientation */
.planet-card-img-rotated {
    display: block;
    width: 104px;
    height: 160px;
    object-fit: cover;
}

/* ── Planet Cards Inventory Dialog ──────────────────────────────────────── */
.pci-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: fade-in 0.2s ease;
}

.pci-dialog {
    background: rgba(12, 12, 28, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 20px 24px 16px;
    min-width: 340px;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    animation: dialog-scale-in 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.pci-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.pci-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
}

.pci-tab {
    flex: 1;
    padding: 6px 10px;
    background: #0f0f19;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.pci-tab.active {
    color: #fff;
    border-bottom-color: rgba(160, 160, 255, 0.7);
}

.pci-tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.8);
}

.pci-content {
    flex: 1;
    overflow-y: auto;
    min-height: 120px;
    max-height: calc(80vh - 160px);
}

.pci-empty {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

.pci-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 4px 0;
}

.pci-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* Playing-card proportions ~2:3 */
.pci-card {
    width: 144px;
    height: 216px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    overflow: hidden;
}

.pci-card-played {
    opacity: 0.45;
    filter: grayscale(0.4);
}

.pci-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pci-play-btn {
    padding: 3px 10px;
    font-size: 12px;
    background: rgba(30, 130, 30, 0.4);
    border: 1px solid rgba(80, 200, 80, 0.5);
    border-radius: 4px;
    color: rgba(160, 255, 160, 0.9);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pci-play-btn:hover {
    background: rgba(40, 180, 40, 0.6);
    border-color: rgba(100, 230, 100, 0.8);
    color: #fff;
}

.pci-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pci-cancel-btn {
    padding: 6px 18px;
    background: rgba(80, 80, 80, 0.4);
    border: 1px solid rgba(160, 160, 160, 0.4);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pci-cancel-btn:hover {
    background: rgba(100, 100, 100, 0.6);
    color: #fff;
}

/* ── Asteroid & Black Hole Token UI ─────────────────────────────────────────── */

.asteroid-token-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.asteroid-token-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.asteroid-token-item:hover:not(.asteroid-token-used) {
    background: rgba(255,255,255,0.08);
    border-color: rgba(160,200,255,0.4);
}

.asteroid-token-used {
    opacity: 0.5;
    cursor: default;
}

.asteroid-disc {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0d0d1f;
    border: 2px solid rgba(180,180,220,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.asteroid-disc-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.asteroid-token-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    line-height: 1.3;
}

.asteroid-token-status {
    font-size: 11px;
}

.asteroid-card-selected .pci-card {
    border: 2px solid rgba(100,200,100,0.8);
}

.asteroid-card-check {
    text-align: center;
    color: #6fce6f;
    font-size: 14px;
    font-weight: bold;
}

.token-choice-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
}

.token-choice-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}
