/* ===== Base Reset & Typography ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f5f7fa;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1e4b69;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px 16px;
}

/* ===== Container ===== */
.container {
    max-width: 960px;
    width: 100%;
}

h1 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e4b69;
    margin-bottom: 4px;
}

.subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 32px;
}

/* ===== Lifecycle Wrapper ===== */
.lifecycle-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* ===== Rows ===== */
.row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

/* ===== Stage Cards ===== */
.stage {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 12px 14px;
    min-width: 120px;
    max-width: 150px;
    flex: 1;
    text-align: center;
    cursor: pointer;
    border: 2px solid var(--stage-color);
    border-top: 5px solid var(--stage-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.stage:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stage.highlighted {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--stage-color) 40%, transparent);
    background: color-mix(in srgb, var(--stage-color) 6%, #ffffff);
}

.stage-number {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--stage-color);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.stage-icon {
    font-size: 1.6rem;
    margin-bottom: 6px;
    line-height: 1;
}

.stage-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e4b69;
    white-space: nowrap;
}

/* ===== Tooltips ===== */
.tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #f1f5f9;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
    width: 240px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}

.stage:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Bottom row tooltips appear below instead */
.bottom-row .tooltip {
    bottom: auto;
    top: calc(100% + 12px);
}

.bottom-row .tooltip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #1e293b;
}

.tooltip strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #ffffff;
}

.tooltip p {
    margin: 4px 0;
    color: #cbd5e1;
}

.pm-role {
    margin-top: 6px !important;
    color: #93c5fd !important;
}

.pm-badge {
    display: inline-block;
    background: #3b82f6;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

/* ===== Arrows (horizontal) ===== */
.arrow {
    font-size: 1.4rem;
    color: #94a3b8;
    flex-shrink: 0;
    line-height: 1;
}

.right-arrow {
    transform: rotate(0deg);
}

.left-arrow {
    transform: rotate(180deg);
}

/* ===== Vertical Connectors ===== */
.vertical-connector {
    display: flex;
    justify-content: center;
    padding: 2px 0;
}

.vertical-connector .arrow {
    font-size: 1.5rem;
    color: #94a3b8;
}

.right-connector {
    align-self: flex-end;
    margin-right: 60px;
}

.left-connector {
    align-self: flex-start;
    margin-left: 60px;
}

.down-arrow {
    transform: rotate(0deg);
}

.up-arrow {
    transform: rotate(0deg);
}

/* ===== Won't Fix Branch ===== */
.wontfix-branch {
    position: absolute;
    bottom: -44px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.wontfix-arrow {
    font-size: 1.2rem;
    color: #94a3b8;
    line-height: 1;
    margin-bottom: 2px;
}

.wontfix-badge {
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1.5px dashed #94a3b8;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== Reopened Branch ===== */
.reopened-branch {
    position: absolute;
    top: -50px;
    left: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    width: 200px;
    transform: translateX(-10%);
}

.reopened-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #ef4444;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.reopened-arrow-svg {
    width: 200px;
    height: 50px;
    overflow: visible;
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
    .row {
        gap: 4px;
    }

    .stage {
        min-width: 80px;
        max-width: 110px;
        padding: 12px 8px 10px;
    }

    .stage-icon {
        font-size: 1.3rem;
    }

    .stage-label {
        font-size: 0.7rem;
    }

    .arrow {
        font-size: 1rem;
    }

    .tooltip {
        width: 200px;
    }

    .reopened-branch {
        display: none;
    }

    .wontfix-branch {
        display: none;
    }
}
