.financial-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.financial-table th,
.financial-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

.financial-table th {
    background: #f5f5f5;
    font-weight: 600;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    padding: 20px;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    position: relative;
}

.view {
    width: 100%;
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
}

#main-view {
    transform: translateX(0);
}

#detail-view {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
}

body.detail-active #main-view {
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
}

body.detail-active #detail-view {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

.header {
    text-align: center;
    margin-bottom: 10px;
}

.header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 24px;
}

.wojak-image {
    width: 144px;
    height: 144px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 12px;
    border: none;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.wojak-image.is-malding {
    transform: scale(1.06);
}

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    position: relative;
    min-width: 240px;
    max-width: 476px;
    padding: 12px 32px 12px 14px;
    /* extra right padding for close button */
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    color: #0f172a;
    background: #ffffff;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.hide {
    opacity: 0;
    transform: translateY(-8px);
}

.toast-info {
    border-color: #bfdbfe;
}

.toast-warn {
    border-color: #fca5a5;
    background: #fff7f7;
}

.toast-macro {
    border-color: #fca5a5;
    background: #fff1f2;
    font-size: 17px;
    line-height: 1.4;
    padding: 15px 34px 15px 16px;
}

.toast-macro-good {
    border-color: #86efac;
    background: #ecfdf3;
    font-size: 17px;
    line-height: 1.4;
    padding: 15px 34px 15px 16px;
}

.toast-macro-bad {
    border-color: #fca5a5;
    background: #fff1f2;
    font-size: 17px;
    line-height: 1.4;
    padding: 15px 34px 15px 16px;
}

.toast-error {
    border-color: #fca5a5;
    background: #fff1f2;
}

.toast-success {
    border-color: #bbf7d0;
    background: #ecfdf3;
}

.toast-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 2px;
}

.lead-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.lead-avatar-name {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    line-height: 1.2;
    min-height: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.lead-avatar-name:empty {
    display: none;
}

.lead-avatar-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.lead-avatar-label {
    display: inline-block;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-avatar-stack {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-width: 220px;
    min-width: 220px;
    justify-self: start;
    align-self: center;
}

.party-avatars {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    align-self: flex-end;
    flex-wrap: nowrap;
    max-width: none;
    justify-content: flex-start;
}

.party-avatar {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.party-avatar img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.party-avatar-name {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
    line-height: 1.2;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.party-avatar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.party-avatar-label {
    display: inline-block;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Shrink avatars by 20% when 4+ players (many-players class on header-content) */
.header-content.many-players .party-avatar {
    width: 80px;
    height: 80px;
    border-radius: 8px;
}

.header-content.many-players .party-avatar-name {
    margin-top: 3px;
    font-size: 10px;
}

.header-content.many-players .party-avatar-dot {
    width: 8px;
    height: 8px;
}

.header-content.many-players .party-avatar-label {
    max-width: 64px;
}

.header-content.many-players .lead-avatar .wojak-image {
    width: 115px;
    height: 115px;
    border-radius: 10px;
}

.header-content.many-players .lead-avatar {
    gap: 6px;
}

.header-content.many-players .lead-avatar .lead-avatar-name {
    font-size: 13px;
    gap: 6px;
}

.header-content.many-players .lead-avatar .lead-avatar-dot {
    width: 10px;
    height: 10px;
}

.header-content.many-players .lead-avatar .lead-avatar-label {
    max-width: 96px;
}

.financial-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-self: center;
}

.header-controls {
    justify-self: end;
    align-self: start;
    margin-top: 26px;
    margin-right: -20px;
}

#multiplayerBtn {
    font-size: 16px;
    padding: 13px 26px;
    font-weight: 500;
}

.drip-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    flex-shrink: 0;
}

body:not(.multiplayer-active) .drip-toggle {
    margin-left: 12px;
}

.drip-label {
    font-size: 16px;
    text-transform: none;
    color: #111;
    letter-spacing: 0;
}

.drip-toggle input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #097a32;
    border-radius: 4px;
    background: #ffffff;
    position: relative;
    cursor: pointer;
}

.drip-toggle input[type="checkbox"]:checked {
    background: #097a32;
    border-color: #097a32;
}

.drip-toggle input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.net-worth {
    font-size: 48px;
    font-weight: 600;
    color: #00c742;
    margin-bottom: 5px;
    letter-spacing: -1.5px;
}

.date {
    font-size: 18px;
    color: #555;
    font-weight: 500;
}

.sub-financial-display {
    font-size: 14px;
    color: #666;
    font-weight: 400;
    margin-top: 8px;
}

.macro-events-bar {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 10px auto 0;
    max-width: 800px;
}

.macro-events-bar.active {
    display: flex;
}

.macro-event-pill {
    background: #f97316;
    color: #fff;
    font-size: 11px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.25);
}

.chart-container {
    background: #fdfdfd;
    border-radius: 12px;
    padding: 20px;
    height: 400px;
    position: relative;
    border: 1px solid #e8e8e8;
    margin-bottom: 20px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
    max-width: 900px;
    /* Allow more width for groups */
    margin-left: auto;
    margin-right: auto;
}

.controls-group-left {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 1;
    padding-right: 5px;
    /* Half of the 10px gap between buttons */
}

.controls-group-right {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex: 1;
    padding-left: 5px;
    /* Half of the 10px gap between buttons */
}

/* Multiplayer Overrides */
body.multiplayer-active .controls {
    gap: 10px;
}

body.multiplayer-active .controls-group-left,
body.multiplayer-active .controls-group-right {
    flex: initial;
    padding: 0;
    justify-content: center;
}

.debug-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

button {
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #aaa;
}

button:active:not(:disabled) {
    transform: scale(0.98);
}

button:disabled {
    cursor: not-allowed;
    background-color: #f9f9f9;
    color: #aaa;
}

button.speed-active {
    background: #00c742;
    color: white;
    border-color: #00a827;
}

.detail-actions-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.company-detail-controls {
    margin-top: 0;
    align-items: center;
}

.company-detail-controls .time-controls-row {
    justify-content: flex-end;
}

.company-detail-controls label {
    left: auto;
    right: 50%;
    transform: translateX(50%);
    /* Since we align right, we might need to adjust label centering relative to the slider group */
    /* Actually, the slider wrap is column flex, align-items center. So label is centered to the slider. */
    /* But if we align-items: flex-end on the wrapper, the label might shift. */
    /* Let's keep align-items: center on the wrapper, but align-self: flex-end on the container in the header. */
}

/* Hide detail controls in multiplayer */
body.multiplayer-active .company-detail-controls {
    display: none !important;
}

.speed-slider-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-weight: 600;
    color: #1f2937;
    position: relative;
}

.speed-slider-wrap label {
    position: absolute;
    bottom: -17px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 15px;
    white-space: nowrap;
    pointer-events: none;
}

.time-controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.playback-controls {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    overflow: visible;
}

.playback-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1.5px solid #097a32;
    background: transparent;
    color: #097a32;
    cursor: pointer;
    border-radius: 6px;
    /* Rounded square */
}

.playback-btn svg {
    width: 14px;
    height: 14px;
}

.playback-btn:hover {
    background-color: transparent !important;
    color: #097a32 !important;
    border-color: #097a32 !important;
}

.playback-btn:active {
    background-color: #dcfce7 !important;
}

.speed-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    min-width: 179px;
}

#speedSlider {
    width: 162px;
    margin: 0;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
}

#speedSlider::-webkit-slider-runnable-track {
    background: #f0fff4;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    height: 8px;
}

#speedSlider::-moz-range-track {
    background: #f0fff4;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    height: 8px;
}

#speedSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 17px;
    /* ~25% larger for WebKit (Chrome/Edge/Safari) */
    height: 17px;
    margin-top: -4.5px;
    /* centers thumb on 8px track */
    border-radius: 50%;
    background: #097a32;
    border: 2px solid #097a32;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

#speedSlider::-moz-range-thumb {
    width: 11.22px;
    /* ~2% larger than previous Firefox size */
    height: 11.22px;
    border-radius: 50%;
    background: #097a32;
    border: 2px solid #097a32;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

#speedThumbLabel {
    position: absolute;
    top: -18px;
    left: 0;
    transform: translateX(-50%);
    font-size: 14px;
    color: #0a7a32;
    font-weight: 700;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
    #speedThumbLabel {
        top: -22px;
        /* raise label a bit more for WebKit browsers (Chrome/Edge/Safari) */
    }
}

button.speed-active:hover {
    background: #00a827;
}

.portfolio,
.companies-section {
    margin-top: 30px;
    width: 100%;
}

.portfolio-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.venture-market-section {
    margin-top: 30px;
    width: 100%;
}

.venture-market-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 0;
    padding-bottom: 0;
}

.market-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Changed to space-between */
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.market-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    /* Space between the two dropdowns */
}

.sort-controls,
.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-controls label,
.filter-controls label {
    font-weight: 500;
    color: #555;
}

.sort-controls select,
.filter-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.sort-controls select:focus,
.filter-controls select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.companies-grid,
.portfolio-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.company-box,
.portfolio-item {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s ease;
    cursor: grab;
}

.company-box,
.portfolio-item {
    cursor: pointer;
}

.company-box:hover,
.company-box.hovered,
.portfolio-item:hover {
    border-color: #999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: none;
}

.companies-grid {
    pointer-events: auto;
}

.company-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.company-info,
.portfolio-info {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.portfolio-stake {
    display: inline-block;
    margin-top: 4px;
    font-size: 13px;
    color: #555;
}

.vc-quick-lead-btn {
    margin-top: 12px;
    width: 100%;
    font-size: 13px;
    padding: 6px 10px;
}

.vc-quick-lead-btn:disabled {
    background-color: #c9c9c9;
    border-color: #b5b5b5;
    color: #666;
    cursor: not-allowed;
}

.company-valuation,
.portfolio-value {
    color: #000;
    font-weight: 500;
}

.company-sector,
.portfolio-name,
.company-stage,
.company-status,
.company-note {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.company-status,
.company-sector {
    font-style: italic;
}

.company-note {
    color: #666;
    font-style: normal;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.detail-header-right {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.detail-title {
    font-size: 36px;
    font-weight: 600;
}

.detail-title-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.detail-sector {
    font-size: 18px;
    color: #555;
    margin-top: 8px;
}

.detail-subtext {
    font-size: 16px;
    color: #777;
    margin-top: 4px;
}

.detail-meta {
    margin-top: 8px;
}

.detail-mission {
    margin: 4px 0;
    color: #374151;
    font-size: 15px;
}

.detail-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.detail-pill,
.detail-location {
    background: #eef2ff;
    color: #1f2937;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 13px;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
}

.detail-location {
    background: transparent;
    color: #555;
    padding: 0;
}

#back-btn {
    background-color: #f0f0f0;
}

.investment-panel {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    display: block;
}

.investment-panel h3 {
    font-size: 20px;
    margin-bottom: 15px;
}

.investment-stats-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 10px;
    font-size: 16px;
}

.stake-label,
.cash-label {
    text-align: center;
}

.investment-input {
    flex: 1 1 0;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 0;
    height: 40px;
    align-self: flex-start;
}

.buy-btn {
    background-color: #28a745;
}

.buy-btn:hover {
    background-color: #218838;
}

.sell-btn {
    background-color: #dc3545;
}

.sell-btn:hover {
    background-color: #b52a37;
}

.investment-actions {
    display: flex;
    gap: 10px;
}

.investment-actions button {
    flex: 1;
    min-width: 110px;
}

.investment-stats>div {
    margin-bottom: 6px;
}

.investment-stats>div:last-child {
    margin-bottom: 0;
}

.stat-value {
    font-weight: 600;
    color: #00c742;
}

.investment-actions input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
}

.investment-actions .buy-btn {
    background-color: #28a745;
    color: white;
}

.investment-actions .sell-btn {
    background-color: #dc3545;
    color: white;
}

.banking-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.banking-modal.active {
    display: flex;
}

.banking-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 640px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.banking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    position: relative;
    min-height: 140px;
}

.boomer-wojak-icon {
    height: 138px;
    width: auto;
    object-fit: contain;
    position: absolute;
    left: 47%;
    top: 44%;
    transform: translate(-50%, -50%);
}

.banking-title {
    font-size: 24px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-btn:hover {
    color: #333;
}

.banking-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.stat-box {
    background: #f8f8f8;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
}

.stat-value.positive {
    color: #00c742;
}

.stat-value.negative {
    color: #dc3545;
}

.banking-controls {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 20px;
}

.banking-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-grow: 1;
}

.input-label {
    font-size: 15px;
    color: #00c742;
    font-weight: 500;
    text-align: center;
}

.banking-button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.banking-controls input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    height: 50px;
    /* Match approx height of button rows if needed, or just let it be */
}

.banking-button-grid button {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.borrow-btn {
    background-color: #007bff;
    color: white;
}

.borrow-btn:hover {
    background-color: #007bff;
}

.repay-btn {
    background-color: #28a745;
    color: white;
}

.repay-btn:hover {
    background-color: #28a745;
}

.banking-info {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 15px;
    font-size: 14px;
    color: #0056b3;
}

/* Pipeline Styles */
.product-name-label {
    font-weight: 650;
    text-align: center;
    margin-bottom: 12px;
    color: #374151;
    /* Dark gray for the label */
    font-size: 18px;
}

.pipeline {
    display: flex;
    align-items: flex-start;
    /* Align items to top to handle multi-line labels */
    justify-content: space-between;
    position: relative;
    padding: 20px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 15px;
}

.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 80px;
    /* Give stages a fixed width */
}

.stage-node {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    /* Prevent node from shrinking */
}

.stage.completed .stage-node {
    background: #22c55e;
    /* Green for success */
    color: white;
    box-shadow: 0 1.5px 3px rgba(34, 197, 94, 0.2);
}

.stage.failed .stage-node {
    background: #ef4444;
    /* Red for failure */
    color: white;
    box-shadow: 0 1.5px 3px rgba(239, 68, 68, 0.2);
}

.stage.incomplete .stage-node {
    background: #e5e7eb;
    color: #9ca3af;
    border: 1.5px solid #d1d5db;
}

.stage.current .stage-node {
    background: #f97316;
    /* Orange for current */
    color: white;
    box-shadow: 0 3px 6px rgba(249, 115, 22, 0.3);
    animation: pulse 2s infinite;
}

.stage.incomplete.current .stage-node {
    background: #3b82f6 !important;
    color: white !important;
    border: 1.5px solid #2563eb;
    box-shadow: 0 3px 6px rgba(59, 130, 246, 0.3);
}

.stage.completed.current .stage-node {
    background: #22c55e !important;
    color: white !important;
    box-shadow: 0 3px 6px rgba(34, 197, 94, 0.3);
    border: none;
}

.stage.completed.current.current-uncertain .stage-node {
    background: #f97316 !important;
    color: white !important;
    box-shadow: 0 3px 6px rgba(249, 115, 22, 0.3);
    border: none;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

.stage-label {
    margin-top: 8px;
    text-align: center;
    font-weight: 500;
    font-size: 12px;
    max-width: 120px;
    line-height: 1.3;
    color: #4b5563;
}

.stage.completed .stage-label,
.stage.current .stage-label {
    font-weight: 600;
}

.stage.failed .stage-label {
    color: #b91c1c;
    font-weight: 600;
}

.connector {
    flex-grow: 1;
    height: 4px;
    margin: 0 -1px;
    /* Overlap slightly with nodes */
    position: relative;
    border-radius: 2px;
    top: 18px;
    /* Align with center of node */
}

.connector.completed {
    background: #22c55e;
}

.connector.failed {
    background: #ef4444;
}

.connector.incomplete {
    background: #e5e7eb;
}

.connector-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 0;
    overflow: visible;
    z-index: 5;
    pointer-events: none;
}

.info-prob {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 800;
    color: #000000;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.info-time {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 800;
    color: #000000;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.pipeline-header.subsequent {
    margin-top: 25px;
}

.product-name-header {
    font-size: 16px;
    font-weight: 600;
    color: #4b5563;
}

.pipeline-section {
    /* This class is now just a simple container */
}

.no-pipeline {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.investment-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    text-align: left;
}

.investment-title-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
    gap: 16px;
    width: 100%;
}

.investment-title-row> :first-child {
    justify-self: start;
}

.investment-title-row> :nth-child(2) {
    justify-self: center;
}

.investment-title-row> :last-child {
    justify-self: end;
}

.vc-detail-timer-inline {
    font-size: 16px;
    font-weight: 600;
    color: #444;
    text-align: right;
    white-space: nowrap;
}

.vc-detail-overview {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 16px;
    color: #444;
}

.vc-detail-line {
    font-weight: 600;
}

.vc-investment-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.vc-option-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.vc-option-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.vc-option-label {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.vc-option-value {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.vc-option-amount {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
}

.vc-option-actions {
    display: flex;
    justify-content: center;
}

.vc-option-buy {
    background: #635bff;
    color: #fff;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    text-align: center;
}

.vc-detail-description {
    line-height: 1.5;
    color: #555;
}

.vc-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.vc-detail-note {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.vc-detail-note.negative {
    color: #b91c1c;
}

.vc-detail-note.positive {
    color: #0f766e;
}

.invest-panel {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px 15px;
    align-items: center;
}

.invest-panel>.investment-actions:nth-of-type(1) {
    grid-area: 1 / 3;
}

.invest-panel>.investment-actions:nth-of-type(2) {
    grid-area: 2 / 3;
}

.invest-panel .investment-title {
    grid-area: 1 / 1;
}

.invest-panel .investment-stats-row {
    grid-area: 1 / 2;
}

.invest-panel .investment-input {
    grid-area: 2 / 1 / 3 / 3;
}

.company-box.bankrupt {
    border: 1px solid #ff9aa2;
    background: #fff1f1;
    opacity: 0.85;
}

.company-box.bankrupt .company-name {
    color: #d32f2f;
}

#chartjs-tooltip {
    opacity: 1;
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    pointer-events: none;
    transform: translate(-50%, 0);
    transition: all .1s ease;
    padding: 6px 10px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#chartjs-tooltip table {
    margin: 0;
    padding: 0;
}

#chartjs-tooltip th {
    font-weight: normal;
    text-align: left;
    padding-bottom: 4px;
    color: #a0a0a0;
}

#chartjs-tooltip td {
    font-weight: normal;
    color: #e0e0e0;
}

#chartjs-tooltip span.bold-value {
    font-weight: 800;
    color: #fff;
}

.chartjs-tooltip {
    opacity: 1;
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 3px;
    pointer-events: none;
    transform: translate(-50%, 0);
    transition: all .1s ease;
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    font-size: 12px;
    padding: 6px;
    z-index: 100;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    justify-self: end;
}

.header-controls button {
    padding: 8px 16px;
    font-size: 14px;
}

/* Multiplayer Modal Adjustments */
#multiplayerModal .banking-panel {
    max-width: 750px;
    position: relative;
}

#multiplayerModal .banking-header {
    min-height: 180px;
}

#multiplayerModal .banking-title {
    font-size: 32px;
    margin-left: 1%;
}

.multiplayer-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
    width: 100%;
}

.multiplayer-action-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    justify-content: flex-start;
    width: 100%;
}

.multiplayer-name-inline {
    flex: 0 0 260px;
    max-width: 320px;
    margin-right: auto;
}

.multiplayer-name-inline .input-label {
    text-align: center;
    color: #22c55e;
    font-weight: 700;
}

.multiplayer-name-inline input {
    text-align: center;
}

.mp-name-error {
    display: none;
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    text-align: center;
}

.mp-name-error.visible {
    display: block;
}

.multiplayer-actions {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
    justify-content: flex-end;
}

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

.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.multiplayer-state {
    display: none;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
}

.multiplayer-state.active {
    display: block;
}

.mp-join-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.join-action-btn {
    display: inline-flex;
    align-items: center;
    min-width: 90px;
    justify-content: center;
}

.mp-join-row input {
    flex: 1;
}

.mp-roster-panel {
    width: 50%;
    min-width: 380px;
    max-width: 520px;
    margin: 6px auto 0;
}

.multiplayer-state.joined .join-code-label,
.multiplayer-state.joined .mp-join-row input {
    display: none;
}

.multiplayer-state.joined .mp-join-row {
    justify-content: center;
    gap: 0;
    width: 100%;
}

.join-action-btn.joined {
    background-color: #22c55e;
    color: #ffffff;
    cursor: default;
    pointer-events: none;
    box-shadow: none;
}

.join-action-btn.joined:hover {
    background-color: #22c55e;
}

.mp-waiting-host {
    display: none;
    margin-top: 10px;
    font-size: 14px;
    color: #1f2937;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    width: 100%;
}

.multiplayer-state.joined .mp-waiting-host {
    display: block;
}

.mp-coldstart-hint {
    display: none;
    margin-top: 10px;
    font-size: 13px;
    color: #111111;
    text-align: center;
    line-height: 1.4;
}

.party-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

#mpPartyCodeDisplay {
    flex: 1;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: #ffffff;
}

.copy-code-btn {
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #0f172a;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.05s ease, opacity 0.1s ease;
}

.copy-code-btn:active {
    transform: translateY(1px);
}

.players-label {
    margin-top: 8px;
    white-space: nowrap;
}

.mp-player-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.mp-player-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    width: 100%;
}

.mp-player-placeholder {
    color: #64748b;
    font-style: italic;
}

.mp-player-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0f172a;
}

.mp-player-name {
    font-weight: 600;
    color: #0f172a;
    flex: 1;
    text-align: left;
}

.start-game-btn {
    width: 100%;
    margin-top: 6px;
}

.multiplayer-wojaks {
    position: absolute;
    left: 57.5%;
    top: 53%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 20px;
    pointer-events: none;
}

.multiplayer-wojak-icon {
    height: 136px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.15));
}

/* Character Selection Overlay */
.character-overlay {
    position: absolute;
    inset: 0;
    background: #ffffff;
    color: #0f172a;
    border-radius: 16px;
    display: none;
    flex-direction: column;
    justify-content: center;
    padding: 28px;
    gap: 18px;
    z-index: 5;
    border: 1px solid #e2e8f0;
}

.character-overlay.active {
    display: flex;
}

.character-overlay-header h3 {
    margin: 0 0 6px;
    font-size: 22px;
    color: #0f172a;
}

.character-overlay-header p {
    margin: 0;
    color: #334155;
}

.character-option-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 14px;
}

.character-option {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
    color: #0f172a;
    overflow: visible;
}

.character-art {
    width: 150px;
    height: 150px;
    max-width: 100%;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.character-option img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
    display: block;
}

.character-option span {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.character-option:hover {
    transform: translateY(-2px);
    border-color: #22c55e;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.character-option:active {
    transform: translateY(0);
}

.character-option.selected {
    border-color: #22c55e;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.character-overlay-actions {
    display: flex;
    justify-content: flex-end;
}

.secondary-btn {
    background: #1f2937;
    color: #e2e8f0;
    border: 1px solid #334155;
}

.character-option.locked {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: #cbd5e1;
    box-shadow: none;
    transform: none;
}

.character-option.locked:hover {
    transform: none;
    box-shadow: none;
}

/* Specific tweaks to prevent edge cropping for non-square sprites (multiplayer only) */
.character-option--grug img,
.character-option--zoomer img {
    max-width: 100%;
    max-height: 100%;
}

.detail-location {
    font-size: 18px;
    color: #888;
    font-weight: 400;
}

.detail-founders {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    font-size: 14px;
    color: #333;
    margin-top: 10px;
}

.detail-founders-label {
    font-weight: 600;
    margin-bottom: 2px;
    color: #555;
}

.detail-founder-name {
    margin-bottom: 2px;
}

/* Bankruptcy Popup */
.bankruptcy-popup {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.bankruptcy-popup.show {
    display: flex;
}

.bankruptcy-content {
    background: #ffffff;
    width: min(384px, 90vw);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    position: relative;
}

.bankruptcy-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(30%, -30%);
    border: none;
    background: #ffffff;
    width: 29px;
    height: 29px;
    border-radius: 50%;
    border: 1px solid #000000;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
    font-size: 16px;
    cursor: pointer;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.bankruptcy-close-btn:hover {
    background: #f8fafc;
}

.bankruptcy-text {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: #0f172a;
    text-align: center;
}

.bankruptcy-liquidation-text {
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    color: #475569;
    text-align: center;
}

.bankruptcy-wojak {
    width: 60%;
    height: auto;
    object-fit: contain;
}

.bankruptcy-btn {
    background: #16a34a;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    min-width: 140px;
    font-size: 14px;
}

.bankruptcy-btn:hover {
    background: #15803d;
}

#multiplayerEndOkayBtn {
    background: #22c55e;
}

#multiplayerEndOkayBtn:hover {
    background: #16a34a;
}

/* Timeline End Popup */
.timeline-end-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
}

.timeline-end-subtitle {
    margin: -8px 0 0 0;
    font-size: 14px;
    font-weight: 400;
    color: #0f172a;
    text-align: center;
}

.timeline-end-wojak {
    width: 45%;
    height: auto;
    object-fit: contain;
}

.timeline-end-networth {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.timeline-end-label {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: #475569;
    text-align: center;
}

.timeline-end-amount {
    margin: 0;
    font-size: 24px;
    font-weight: 400;
    color: #22c55e;
    text-align: center;
}

/* Multiplayer end popup */
.mp-end-leaderboard {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0 6px 0;
}

.mp-end-heading {
    font-weight: 700;
}

.mp-end-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
}

.mp-end-rank {
    font-weight: 700;
    color: #0f172a;
    min-width: 28px;
}

.mp-end-name {
    flex: 1;
    font-weight: 600;
    color: #0f172a;
}

.mp-end-networth {
    font-weight: 700;
}

.mp-end-avatar {
    height: 64px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.vc-option-header {
    width: 100%;
    text-align: left;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.vc-round-dilution {
    font-size: 16px;
    font-weight: 600;
    color: #444;
    white-space: nowrap;
}