/*
 * The Optimizer's Run card and its "strategy race" (optimizerwait, Steve 2026-11-24).
 * Markup: js/app/optimize-tab/optimizeWizard.js (the card) and optimizerRace.js (the chart).
 * Mockup: .automation/planning/optimizerwait/mockup-a-transition.html
 */

/* ---- the Run card, balanced: both columns start level, the four choices are one size (set by script),
        and the health note has a row of its own, so it no longer makes the left side taller than the right ---- */
#opt-wiz-panel.owz-panel { align-items: start; }
#opt-wiz-panel .owz-center { align-self: center; }
#opt-wiz-panel .owz-option { box-sizing: border-box; }
/* The line under the ring wraps, so it never takes room from the two columns. */
#opt-wiz-panel .owz-runhint { max-width: 270px; }
/* A card too narrow for three columns (the inputs column open on a small window; set by script from the card's own
   width, never a window breakpoint): the ring on top, the two columns side by side under it. */
#opt-wiz-panel.owz-narrow { grid-template-columns: 1fr 1fr; row-gap: 20px; }
#opt-wiz-panel.owz-narrow > .owz-center { grid-column: 1 / -1; order: -1; }
#opt-wiz-panel .owz-aca-row { grid-column: 1 / -1; display: flex; gap: 14px; align-items: baseline; border-top: 1px solid var(--ui-borders-borderLight); margin-top: 20px; padding-top: 14px; transition: opacity 0.3s ease; }
#opt-wiz-panel .owz-aca-row .owz-col-label { flex: 0 0 auto; white-space: nowrap; margin-top: 0 !important; }
#opt-wiz-panel .owz-aca-row + .owz-footnote { margin-top: 14px; }

/* ---- leaving the card: pictures of the side columns, the line under the ring and the health note fade away
        over the running card (the two columns slide a little outward) ---- */
#opt-wiz-panel .owz-ghost { position: absolute; margin: 0 !important; box-sizing: border-box; pointer-events: none; opacity: 1; z-index: 2;
    transition: opacity 0.3s ease, transform 0.36s ease; }
#opt-wiz-panel .owz-ghost.owz-ghost-out { opacity: 0; }
#opt-wiz-panel .owz-ghost.owz-ghost-out[data-dir="-1"] { transform: translateX(-18px); }
#opt-wiz-panel .owz-ghost.owz-ghost-out[data-dir="1"] { transform: translateX(18px); }

/* ---- the race ---- */
#opt-wiz-panel.owz-racing { display: flex; flex-direction: column; position: relative; }
#opt-wiz-panel.owz-racing > .owz-race { flex: 1 1 auto; }
#opt-wiz-panel.owz-racing > .owz-footnote { flex: 0 0 auto; }
.owz-race { display: flex; gap: 26px; align-items: stretch; }
.owz-race-chart { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.owz-race-chart, .owz-race-side > :not(.owz-race-top), .owz-race-top > .owz-status { transition: opacity 0.4s ease; }
.owz-race-pre .owz-race-chart, .owz-race-pre .owz-race-side > :not(.owz-race-top), .owz-race-pre .owz-race-top > .owz-status { opacity: 0; }
.owz-race-plot { position: relative; flex: 1 1 auto; min-height: 250px; margin-top: 6px; }
.owz-race-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.owz-race-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--ui-text-secondaryText); font-size: var(--text-xs, 12px); }
.owz-race-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.owz-race-legend i.orr-out { background: transparent; border: 1.5px solid var(--color-gray-400); }

.owz-race-side { flex: 0 0 300px; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--ui-borders-borderLight); padding-left: 24px; transition: border-color 0.4s ease; }
.owz-race-pre .owz-race-side { border-left-color: transparent; }
.owz-race-top { display: flex; align-items: center; gap: 14px; min-height: 76px; }
.owz-race-top .owz-status { text-align: left; }
.owz-race-trying { color: var(--ui-text-secondaryText); line-height: 1.45; min-height: 40px; font-size: var(--text-small, 14px); }
.owz-race-best { background: rgba(var(--color-blue-6-rgb), 0.08); border-radius: 10px; padding: 11px 13px; }
.owz-race-best-lab { color: var(--ui-text-secondaryText); font-size: var(--text-xs, 12px); }
.owz-race-best-num { display: inline-block; font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--color-semantic-success); font-variant-numeric: tabular-nums; transition: transform 0.25s ease; }
.owz-race-best-num.is-bump { transform: scale(1.09); }
.owz-race-best-what { color: var(--ui-text-secondaryText); margin-top: 2px; min-height: 18px; font-size: var(--text-small, 14px); }
.owz-race-side #opt-wiz-cancel { align-self: flex-start; margin-top: auto; }

/* the gauge: the Run ring, small */
#opt-wiz-panel .owz-ring.owz-ring-sm { width: 76px; height: 76px; flex: 0 0 76px; will-change: transform; }
#opt-wiz-panel .owz-ring-sm .owz-ring-num { font-size: 18px; }
#opt-wiz-panel .owz-ring-sm .owz-pct-sign { font-size: var(--text-2xs, 11px); }

/* the chart's own marks */
.orr-grid { stroke: var(--ui-borders-borderLight); stroke-width: 1; }
.orr-today { stroke: var(--ui-text-secondaryText); stroke-width: 1.5; stroke-dasharray: 6 5; }
.orr-axis { fill: var(--ui-text-secondaryText); font-size: var(--text-2xs, 11px); }
.orr-axis-title { fill: var(--ui-text-secondaryText); font-size: var(--text-xs, 12px); }
.orr-today-lab { fill: var(--ui-text-secondaryText); font-size: var(--text-xs, 12px); font-weight: 500; }
.orr-best-lab { fill: var(--color-semantic-success); font-size: var(--text-xs, 12px); font-weight: 700; }
.orr-dot { transition: cx 0.35s ease, cy 0.38s cubic-bezier(.3, 1.5, .5, 1), opacity 0.2s ease, r 0.3s ease; }
.orr-halo { fill: none; stroke: var(--color-semantic-success); stroke-width: 2.5; transition: cx 0.35s ease, cy 0.35s ease, opacity 0.2s ease; }
.orr-k-order { fill: var(--color-blue-6); background: var(--color-blue-6); }
.orr-k-fixed { fill: var(--color-teal-3); background: var(--color-teal-3); }
.orr-k-fill { fill: var(--color-purple-3); background: var(--color-purple-3); }
.orr-k-tune { fill: var(--color-orange-3); background: var(--color-orange-3); }
.orr-dot.orr-out { fill: transparent; stroke: var(--color-gray-400); stroke-width: 1.5; }
/* A new dot's drop, played by an HTML stand-in the compositor eases (optimizerRace.js dropIn): the search keeps the
   main thread too busy for an SVG circle's own transition to show (Steve 2026-11-26). Its colour is its kind's. */
.orr-ghost { position: absolute; border-radius: 50%; pointer-events: none; will-change: transform, opacity; }
.orr-ghost.orr-out { background: transparent; border: 1.5px solid var(--color-gray-400); box-sizing: border-box; }

@media (max-width: 1100px) {
    .owz-race { flex-direction: column; }
    .owz-race-side { flex-basis: auto; border-left: 0; padding-left: 0; }
    #opt-wiz-panel .owz-aca-row { flex-direction: column; gap: 4px; }
}
