/* ═══════════════════════════════════════════════════════════
   Session runner modal — global (loaded on every page)
   ═══════════════════════════════════════════════════════════ */

.session-runner-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.session-runner {
    background: var(--tm-surface-elevated, #fff);
    color: var(--tm-text, #0f172a);
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.session-runner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--tm-border, #e2e8f0);
    background: var(--tm-surface-alt, #f1f5f9);
    flex-shrink: 0;
}

.session-runner-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.session-runner-name {
    font-weight: 700;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-runner-progress {
    font-size: 0.72rem;
    color: var(--tm-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.session-runner-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.session-runner-abandon {
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 0.75rem;
    color: var(--tm-text-muted, #64748b);
    cursor: pointer;
    border-radius: 4px;
    font-family: inherit;
    font-weight: 600;
}

.session-runner-abandon:hover {
    color: var(--tm-danger, #dc2626);
    background: var(--tm-danger-subtle, #fee2e2);
}

.session-runner-close {
    background: none;
    border: none;
    padding: 0 8px;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--tm-text-muted, #64748b);
    cursor: pointer;
    border-radius: 4px;
    font-family: inherit;
}

.session-runner-close:hover {
    color: var(--tm-text, #0f172a);
    background: var(--tm-surface, #f8fafc);
}

.session-runner-body {
    padding: 28px 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 240px;
}

.session-step {
    text-align: center;
}

.session-round {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--tm-text-subtle, #94a3b8);
    margin-bottom: 8px;
}

.session-metric-name {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--tm-text, #0f172a);
    line-height: 1.15;
}

.session-planned {
    font-size: 1rem;
    color: var(--tm-text-muted, #64748b);
}

.session-inputs {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}

.session-inputs label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    max-width: 150px;
}

.session-inputs label > span {
    font-size: 0.72rem;
    color: var(--tm-text-muted, #64748b);
    text-align: center;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.session-inputs input {
    padding: 14px 10px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--tm-border, #e2e8f0);
    border-radius: 8px;
    background: var(--tm-surface-elevated, #fff);
    color: var(--tm-text, #0f172a);
    font-weight: 700;
    font-family: inherit;
    width: 100%;
    transition: border-color 120ms ease;
}

.session-inputs input:focus {
    outline: none;
    border-color: var(--tm-primary, #0d9488);
}

.session-runner-footer {
    display: flex;
    justify-content: space-between;
    /* The footer can hold up to five actions (Skip, plus Later / Partial / Done / Start timer on
       a duration step). Five of them do not fit across a 480px popup, so the row wraps instead
       of letting the buttons compete for the same line. */
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
    border-top: 1px solid var(--tm-border, #e2e8f0);
    background: var(--tm-surface-alt, #f1f5f9);
    flex-shrink: 0;
}

.session-runner-footer .btn {
    /* No fixed floor: a floor of 90px pushes five buttons past the popup width. Let them size to
       their labels and share the row, wrapping when the labels need more room. */
    min-width: 0;
    flex: 0 1 auto;
    font-weight: 600;
}

.session-footer-actions {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.session-summary {
    text-align: center;
    padding: 8px 0;
}

.session-summary h2 {
    font-size: 1.5rem;
    margin: 0 0 24px;
    color: var(--tm-success, #16a34a);
    font-weight: 700;
}

.session-summary-counts {
    display: flex;
    justify-content: center;
    gap: 28px;
    font-size: 0.72rem;
    color: var(--tm-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.session-summary-counts strong {
    font-size: 2.2rem;
    display: block;
    color: var(--tm-primary, #0d9488);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
    text-transform: none;
    letter-spacing: normal;
}

/* ─── Timer display ─────────────────────────────────────── */

.session-timer-display {
    margin: 24px auto 0;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--tm-primary, #0d9488);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color 180ms ease;
}

.session-timer-display.idle {
    color: var(--tm-text-subtle, #94a3b8);
    font-weight: 400;
}

.session-timer-display.running {
    color: var(--tm-danger, #dc2626);
    animation: session-timer-pulse 2s ease-in-out infinite;
}

.session-timer-display.stopped {
    color: var(--tm-primary, #0d9488);
}

@keyframes session-timer-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.65; }
}

@media (prefers-reduced-motion: reduce) {
    .session-timer-display.running { animation: none; }
}

@media (max-width: 480px) {
    .session-runner-backdrop { padding: 0; }
    .session-runner {
        max-height: 100vh;
        /* Prefer the dynamic viewport where it is supported, so the sheet is not cut off by a
           mobile browser's address bar. A browser that does not know dvh keeps the 100vh above. */
        max-height: 100dvh;
        border-radius: 0;
    }
    .session-runner-body { padding: 20px 14px; }
    .session-metric-name { font-size: 1.6rem; }
    .session-inputs {
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 18px;
    }
    .session-inputs label { max-width: none; }
    .session-inputs input {
        padding: 12px 8px;
        font-size: 1.3rem;
    }
    .session-timer-display { font-size: 2.5rem; margin-top: 18px; }

    /* The base rules already wrap the row and let each button size to its label, so a phone only
       needs a tighter gap and smaller buttons. */
    .session-runner-footer {
        gap: 6px;
        padding: 10px 12px;
    }
    .session-runner-footer .btn {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
}