/* ============================================
   Simulation Theater
   Overlay that covers the lineup pool while a simulation runs. The pool is
   still mounted underneath (scroll position and grid state survive) — this
   just blurs it out and takes over the panel.

   Layout mirrors .generation-progress: centred column, one accent colour,
   the panel header (and its Run Sims / cancel button) stays reachable.
   ============================================ */

.panel-content.sim-theater-host {
    position: relative;
}

.sim-theater-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: color-mix(in srgb, var(--liq-bg-primary) 88%, transparent);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    overflow-y: auto;
}

/* color-mix fallback for older engines */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    .sim-theater-overlay {
        background: var(--liq-bg-primary);
        opacity: 0.98;
    }
}

/* Backdrop blur is the most expensive effect a phone GPU can be asked
   for, and it recomposites on every counter repaint - measured as a
   real sim slowdown on mobile. A more opaque ground replaces it. */
@media (max-width: 768px), (pointer: coarse) {
    .sim-theater-overlay {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: color-mix(in srgb, var(--liq-bg-primary) 96%, transparent);
    }
}

.sim-theater {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

/* ---------- hero counter ---------- */

.sim-theater-hero {
    margin-bottom: 1.1rem;
}

.sim-theater-count {
    font-size: clamp(1.75rem, 6vw, 2.6rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--liq-text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.sim-theater-count-label {
    margin-top: 0.15rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--liq-accent-green);
}

.sim-theater-scale {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--liq-text-secondary);
}

/* ---------- progress bar ---------- */

.sim-theater-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--liq-bg-tertiary);
    overflow: hidden;
}

.sim-theater-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: var(--liq-accent-green);
    transition: width 0.4s ease-out;
}

/* Indeterminate: stages with no measurable progress (queue, finalize,
   assign) sweep instead of sitting at a misleading percentage. */
.sim-theater-bar-fill.is-indeterminate {
    width: 35%;
    transition: none;
    animation: sim-theater-sweep 1.4s ease-in-out infinite;
}

@keyframes sim-theater-sweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(320%); }
}

.sim-theater-meta {
    margin-top: 0.45rem;
    min-height: 1.1em;
    font-size: 0.75rem;
    color: var(--liq-text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---------- stage rail ---------- */

.sim-theater-stages {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    text-align: left;
}

.sim-theater-stage {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.3rem 0;
    font-size: 0.82rem;
    color: var(--liq-text-secondary);
}

.sim-theater-stage-icon {
    flex: 0 0 1.15rem;
    text-align: center;
    line-height: 1.4;
}

.sim-theater-stage-body {
    flex: 1 1 auto;
    min-width: 0;
}

.sim-theater-stage-detail {
    font-size: 0.72rem;
    color: var(--liq-text-secondary);
    opacity: 0.85;
}

/* pending */
.sim-theater-stage.is-pending {
    opacity: 0.45;
}

/* done */
.sim-theater-stage.is-done .sim-theater-stage-icon {
    color: var(--liq-accent-green);
}

/* active */
.sim-theater-stage.is-active {
    color: var(--liq-text-primary);
    font-weight: 600;
}

.sim-theater-stage.is-active .sim-theater-stage-icon {
    color: var(--liq-accent-green);
    animation: sim-theater-pulse 1.5s ease-in-out infinite;
}

@keyframes sim-theater-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ---------- note (the honest warning for the blocking greedy) ---------- */

.sim-theater-note {
    margin-top: 0.9rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--liq-border-color);
    border-radius: 6px;
    background: var(--liq-bg-secondary);
    font-size: 0.73rem;
    color: var(--liq-text-secondary);
    text-align: left;
}

.sim-theater-note:empty {
    display: none;
}
