/* Shared simulation flow: starting line (3 cards), then stat bars, scenario, choices, outcome */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Starting line: 3 cards only; after selection, .sim-main (stats + scenario + choices) is shown */
.sim-game {
    padding: 1.5rem 0 3rem;
    max-width: 54rem;
    margin: 0 auto;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    padding-inline: 2.25rem;
}
.sim-game h1 {
    text-align: center;
    margin-bottom: 0.35rem;
    font-size: 2.4rem;
    font-family: 'Press Start 2P', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7c3aed; /* solid purple */
    text-shadow:
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        2px 2px 0 #000,
        0 0 10px rgba(0, 0, 0, 0.45);
}
#sim-title + .sim-timeline + .sim-page-intro + .sim-page-subtitle-start {
    text-align: center;
    margin: -0.25rem auto 0.75rem auto;
    font-size: 1.55rem;
    font-weight: 700;
    color: #7c3aed;
    text-shadow:
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        2px 2px 0 #000;
}
#sim-subtitle {
    text-align: center;
    margin: 0.35rem 0 0.6rem 0;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3b82f6;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    width: 100%;
    display: block;
}
.sim-subtitle-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.sim-subtitle-icon {
    font-size: 1.05rem;
    line-height: 1;
}
#sim-subtitle.sim-subtitle--surprise {
    color: #f59e0b !important; /* amber-500 */
}
#sim-subtitle.sim-subtitle--surprise-negative {
    color: #dc2626 !important; /* red-600 */
}

.sim-starting-line {
    margin-top: 4rem;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    isolation: isolate;
}
.sim-starting-line-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
    justify-content: center;
    width: 100%;
    max-width: 52rem;
}
.sim-starting-line-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.sim-starting-line-index {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: #7c3aed;
    border: 2px solid #000;
    color: #f9fafb;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.45);
}
@media (max-width: 768px) {
    .sim-starting-line {
        margin-top: 1.5rem;
    }
    .sim-starting-line-cards {
        grid-template-columns: 1fr;
    }
    .sim-starting-line-card {
        min-height: 0;
        padding: 1.5rem 1.75rem;
    }
}
.sim-starting-line-card {
    display: block;
    width: 100%;
    min-height: 12rem;
    background:
        radial-gradient(circle at top left, rgba(124, 58, 237, 0.18), transparent 60%),
        linear-gradient(145deg, #ffffff 0%, #f9fafb 40%, #eef2ff 100%);
    border: 2px solid rgba(124, 58, 237, 0.7);
    border-radius: 1.1rem;
    padding: 2rem 2.25rem;
    cursor: pointer;
    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background 0.25s ease,
        box-shadow 0.25s ease;
    text-align: left;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
    font: inherit;
    color: inherit;
    position: relative;
}
.sim-starting-line-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
    border-color: #6366f1;
    background: #f9fafb;
    animation: sim-starting-line-pulse-purple 0.7s ease-in-out infinite alternate;
}
.sim-starting-line-card.sim-starting-line-card--selected {
    animation: sim-starting-line-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes sim-starting-line-pulse-purple {
    from {
        transform: translateY(-1px) scale(1);
        box-shadow:
            0 0 0 0 rgba(124, 58, 237, 0.6),
            0 10px 20px rgba(15, 23, 42, 0.3);
        border-color: #7c3aed;
    }
    to {
        transform: translateY(-3px) scale(1.02);
        box-shadow:
            0 0 0 6px rgba(124, 58, 237, 0.85),
            0 16px 32px rgba(15, 23, 42, 0.4);
        border-color: #a855f7;
    }
}
@keyframes sim-starting-line-pulse {
    from {
        transform: translateY(-1px) scale(1);
        box-shadow:
            0 0 0 0 rgba(79, 70, 229, 0.5),
            0 10px 20px rgba(79, 70, 229, 0.35);
        border-color: #6366f1;
    }
    25% {
        transform: translateY(-3px) scale(1.01);
        box-shadow:
            0 0 0 4px rgba(59, 130, 246, 0.5),
            0 12px 26px rgba(59, 130, 246, 0.45);
        border-color: #3b82f6;
    }
    50% {
        transform: translateY(-4px) scale(1.02);
        box-shadow:
            0 0 0 6px rgba(56, 189, 248, 0.6),
            0 16px 32px rgba(56, 189, 248, 0.55);
        border-color: #0ea5e9;
    }
    75% {
        transform: translateY(-3px) scale(1.015);
        box-shadow:
            0 0 0 6px rgba(252, 211, 77, 0.65),
            0 16px 32px rgba(248, 113, 113, 0.6);
        border-color: #f97316; /* orange accent */
    }
    to {
        transform: translateY(-2px) scale(1.01);
        box-shadow:
            0 0 0 3px rgba(248, 113, 113, 0.75),
            0 12px 26px rgba(234, 179, 8, 0.65);
        border-color: #ef4444; /* red accent */
    }
}
.sim-starting-line-card-content {
    display: block;
    position: relative;
}
.sim-starting-line-card-badge {
    display: none;
}
.sim-starting-line-card-title {
    font-size: 1.1rem;
    line-height: 1.45;
    color: #020617;
    font-weight: 800;
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.sim-starting-line-card-body {
    font-size: 0.97rem;
    line-height: 1.65;
    color: #334155;
    font-weight: 500;
}
.sim-starting-line-card-body-p {
    margin: 0 0 0.6rem 0;
}
.sim-starting-line-card-body-p:last-child {
    margin-bottom: 0;
}

/* Shared card style for scenario, decisions, and stats */
.sim-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

/* Main game area: hidden on starting line; after choice, scenario top + decisions left + stats right */
.sim-game .sim-main.sim-main--hidden {
    display: none !important;
}
.sim-game .sim-main {
    margin-top: 0;
    display: grid !important;
    grid-template-columns: 1fr 260px;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "subtitle subtitle"
        "timeline timeline"
        "scenario scenario"
        "choices stats";
    column-gap: 1.5rem;
    row-gap: 1rem;
    align-items: start;
}
.sim-game .sim-main > #sim-subtitle {
    grid-area: subtitle;
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    text-align: center;
    width: 100%;
    margin: 0 0 0.35rem 0;
}
.sim-game #sim-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 auto 0.5rem auto;
    justify-content: center;
    font-size: 0.8rem;
}
.sim-timeline-step {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.sim-timeline-step--completed {
    background: #ecfdf3;
    border-color: #22c55e;
    color: #166534;
}
.sim-timeline-step--current {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}
.sim-timeline-step--upcoming {
    opacity: 0.7;
}
.sim-timeline-step--outcome {
    background: #eff6ff;
    border-style: solid;
    border-color: #3b82f6;
    color: #1d4ed8;
}
.sim-timeline-step--surprise {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #b45309;
}
.sim-game .sim-main .sim-scenario {
    grid-area: scenario;
}
.sim-game .sim-main .sim-choices {
    grid-area: choices;
}
.sim-game .sim-main .sim-stats-wrap {
    grid-area: stats;
    margin-bottom: 0;
    min-width: 0;
}

/* Mobile: stack scenario, then decisions, then stats */
@media (max-width: 640px) {
    .sim-game .sim-main {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "subtitle"
            "scenario"
            "choices"
            "stats";
    }
    .sim-game .sim-main > #sim-subtitle {
        grid-column: 1 / -1;
        margin: 0.15rem 0 0.45rem 0;
    }
}

.sim-stats-wrap {
    margin-bottom: 0;
}
.sim-stats-panel {
    background: #ffffff;
    border: 2px solid rgba(129, 140, 248, 0.5);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    box-shadow:
        0 16px 36px rgba(15, 23, 42, 0.18),
        0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}
.sim-stats-heading {
    font-size: 0.78rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.sim-stats {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-top: 0;
}
.sim-stat {
    min-width: 0;
}
.sim-stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    margin-bottom: 0.25rem;
}
.sim-stat-bar {
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #e0f2fe 0%, #e0f2fe 50%, #fee2e2 100%);
    overflow: hidden;
    margin-bottom: 0.2rem;
    position: relative;
}
.sim-stat-fill {
    height: 100%;
    border-radius: 999px;
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.12),
        0 0 14px rgba(56, 189, 248, 0.9);
    transition: width 0.5s ease-out;
}
.sim-stat-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
}
.sim-game .sim-main .sim-outcome {
    grid-area: choices;
}

/* Coffee shop outcome: tweak "All simulations" button to white background + blue text */
.sim-game .sim-outcome-actions .btn.btn-outline {
    background: #ffffff;
    color: var(--primary-color);
    border-color: #e2e8f0;
}
.sim-game .sim-outcome-actions .btn.btn-outline:hover {
    background: #f1f5f9;
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.sim-scenario {
    margin-bottom: 0;
    transition: opacity 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    background: #ffffff;
    border-color: rgba(148, 163, 184, 0.8);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}
.sim-scenario.sim-scenario--hidden {
    display: none;
}
.sim-scenario-text {
    margin: 0;
    color: #0f172a;
    line-height: 1.7;
    font-size: 1.08rem;
}
.sim-scenario-heading {
    margin-bottom: 0.5rem;
}
.sim-scenario-heading-line1 {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}
.sim-scenario-heading-line1--bonus {
    color: #f59e0b;
}
.sim-scenario-heading-line1--critical {
    color: #dc2626;
}
.sim-scenario-heading-line2 {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
}
.sim-choices {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0;
}
.sim-choices.sim-choices--hidden {
    display: none;
}
.sim-choice-btn {
    width: 100%;
    text-align: left;
    padding: 1rem 1.25rem;
    border: 2px solid var(--primary-color);
    border-radius: 0.65rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.3s ease;
    box-shadow:
        0 0 0 1px #000000,
        0 8px 16px rgba(15, 23, 42, 0.35);
}
.sim-choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45);
    border-color: var(--primary-dark);
}
.sim-choice-btn.sim-choice-btn--dim {
    opacity: 0.8;
    filter: brightness(0.93);
}
.sim-choice-btn.sim-choice-btn--selected {
    animation: sim-choice-pulse 3s ease-in-out 0s 1 forwards;
}
@keyframes sim-choice-pulse {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.0);
    }
    40% {
        transform: translateY(-3px) scale(1.02);
        box-shadow:
            0 0 0 6px rgba(37, 99, 235, 0.5),
            0 14px 30px rgba(37, 99, 235, 0.6);
    }
    100% {
        transform: translateY(-1px) scale(1.01);
        box-shadow:
            0 0 0 3px rgba(37, 99, 235, 0.45),
            0 10px 24px rgba(37, 99, 235, 0.5);
        border-color: var(--primary-dark);
    }
}

/* Soft transition when steps change (scenario, choices, or outcome) */
.sim-step-animate {
    animation: sim-step-fade 400ms ease-out;
}
@keyframes sim-step-fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.sim-outcome {
    display: none;
    padding: 2rem;
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 0.75rem;
    margin-top: 1rem;
}
.sim-outcome.sim-outcome--visible {
    display: block;
    animation: sim-outcome-in 0.4s ease;
}
@keyframes sim-outcome-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.sim-outcome-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #166534;
    margin-bottom: 0.5rem;
}
.sim-outcome-message {
    color: #15803d;
    line-height: 1.8;
    margin-bottom: 1.25rem;
}
.sim-outcome-surprises {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(22, 163, 74, 0.35);
    font-size: 1rem;
}
.sim-outcome-surprises-title {
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.sim-outcome-surprises-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.sim-outcome-surprise-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #166534;
}
.sim-outcome-surprise-icon {
    font-size: 0.95rem;
}
.sim-outcome-actions .btn {
    border-radius: 0.5rem;
    font-weight: 600;
}
