/* Cost and memory budgets replay: "Where the memory went". */
.ef { display: grid; gap: 12px; font-variant-numeric: tabular-nums; }
.ef-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 12px; }
.ef-head > .rp-label { margin: 0; }
.ef-head-tag { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.ef-head-tag .rp-tag { min-width: 92px; justify-content: center; }
.ef-title { font-size: 13px; color: var(--cream, #f1ebe0); }
.ef-box { display: grid; gap: 10px; align-content: start; }
.ef-foot { margin: 0; font-size: 12px; color: var(--muted, #a9b1c2); }
.ef-snap, .ef-snap * { transition: none !important; }

/* Bars. Stacked: name + value, track, note. Fixed line boxes keep the stage height still. */
.ef-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name val" "track track" "note note"; gap: 4px 12px; align-items: center; }
.ef-row-head { display: contents; }
.ef-row .ef-name { grid-area: name; }
.ef-row .ef-val { grid-area: val; }
.ef-row .ef-track { grid-area: track; }
.ef-row .ef-note { grid-area: note; }
.ef-name { font-size: 13px; line-height: 20px; color: var(--cream, #f1ebe0); }
.ef-val { font-size: 14px; line-height: 20px; text-align: right; white-space: nowrap; }
.ef-val.is-pending { font-size: 12px; color: var(--muted, #a9b1c2); }
.ef-track { position: relative; height: 16px; border-radius: 4px; background: rgba(var(--cream-rgb),.07); }
.ef-fill { position: absolute; top: 0; bottom: 0; left: 0; width: calc(var(--f, 0) * 100%); border-radius: 4px; background: var(--brass, #e9b46c); transition: width .9s var(--rp-ease); }
.ef-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 18px; font-size: 12px; color: var(--muted, #a9b1c2); transition: color .4s; }
.ef-note.ok { color: var(--rp-ok); }
.ef-note.warn { color: var(--rp-warn); }
.ef-guard .ef-note, .ef-rev .ef-note, .ef-dnote { min-height: 26px; }
.ef-line { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: rgba(var(--cream-rgb),.7); }
.ef-axis { display: grid; grid-template-columns: minmax(0, 1fr); }
.ef-scale { position: relative; height: 18px; font-size: 12px; color: var(--muted, #a9b1c2); }
.ef-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ef-scale span:first-child { transform: none; }
.ef-scale span:last-child { transform: translateX(-100%); }
.ef-state { font-size: 13px; line-height: 20px; color: var(--muted, #a9b1c2); }
.ef-state.ok { color: var(--rp-ok); }
.ef-state.warn { color: var(--rp-warn); }

/* Mode 1: chunks stream into one temporary MP4 inside the container. */
.ef-src { display: grid; gap: 8px; }
.ef-src > .rp-label { margin: 0; }
.ef-tiles { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 4px; }
.ef-tile { display: block; height: 14px; border-radius: 3px; border: 1px solid rgba(var(--cream-rgb),.16); background: rgba(var(--cream-rgb),.03); transition: background-color .3s var(--rp-ease), border-color .3s var(--rp-ease); }
.ef-tile.is-in { background: var(--brass, #e9b46c); border-color: var(--brass, #e9b46c); transition-delay: var(--d, 0ms); }
.ef-mem .ef-track { background: rgba(var(--cream-rgb),.07) repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), rgba(var(--cream-rgb),.1) calc(25% - 1px) 25%); }
.ef-mem .ef-fill { transition-duration: 1.4s; }
.ef-rss .ef-fill { background: var(--sky, #8fb3d9); }
.ef-cg .ef-fill { background: rgba(var(--brass-rgb),.2); box-shadow: inset 0 0 0 1px var(--brass, #e9b46c); }
.ef-cg .ef-inner { background: rgba(var(--brass-rgb),.5); box-shadow: none; }
.ef-cg.is-key .ef-name { color: var(--brass, #e9b46c); }
.ef-cg.is-key .ef-track { box-shadow: 0 0 0 2px rgba(var(--brass-rgb),.25); }
.ef-moov { position: absolute; top: 0; bottom: 0; left: max(0px, calc(100% - 40px)); width: 40px; display: grid; place-items: center; z-index: 1; border-radius: 3px; font: 600 12px/1 ui-monospace, 'Cascadia Mono', Consolas, monospace; color: var(--bg, #121826); background: var(--cream, #f1ebe0); opacity: 0; transition: left 1.4s var(--rp-ease), opacity .3s; }
.ef-track[data-moov="end"] .ef-moov, .ef-track[data-moov="front"] .ef-moov { opacity: 1; }
.ef-track[data-moov="front"] .ef-moov { left: 0; }
.ef-track.is-up .ef-fill::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 22%; border-radius: inherit; background: linear-gradient(90deg, transparent, rgba(var(--bg-rgb),.5), transparent); animation: ef-scan 1.5s linear infinite; }
@keyframes ef-scan { from { transform: translateX(0); } to { transform: translateX(355%); } }
.ef-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ef-chip { display: grid; gap: 2px; padding: 9px 12px; }
.ef-chip .rp-label { margin: 0; }

/* Mode 2: the admission guard. */
.ef-terms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.ef-term { position: relative; display: grid; align-content: start; gap: 2px; }
.ef-term + .ef-term::before { content: "+"; position: absolute; left: -17px; top: 50%; transform: translateY(-50%); font-size: 16px; line-height: 1; color: var(--brass, #e9b46c); }
.ef-term .rp-label, .ef-sc .rp-label { margin: 0; }
.ef-v { font-size: 13px; color: var(--cream, #f1ebe0); }
.ef-limit { background: var(--rp-warn); }
.ef-est .ef-fill { background: rgba(var(--brass-rgb),.35); box-shadow: inset 0 0 0 1px var(--brass, #e9b46c); }
.ef-over .ef-fill { background: rgba(var(--brass-rgb),.35); border-radius: 4px 0 0 4px; }
.ef-over .ef-excess { background: var(--rp-bad); border-radius: 0 4px 4px 0; transition-delay: .6s; }
.ef-over.rp-shake { animation-delay: .9s; }
.ef-scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ef-sc { display: grid; align-content: start; gap: 2px; }
.ef-sc.ef-ok.is-active { border-color: var(--rp-ok); }
.ef-sc.ef-warn.is-active { border-color: var(--rp-warn); }

/* Mode 3: measured capture, the cost model and the repricing. */
.ef-cost { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: stretch; }
.ef-col { display: grid; gap: 12px; align-content: start; }
.ef-model .ef-fill { background: rgba(var(--cream-rgb),.3); }
.ef-cost .ef-meas .ef-fill, .ef-costrow .ef-fill { border-radius: 4px 0 0 4px; }
.ef-cost .ef-meas .ef-excess { background: var(--rp-warn); border-radius: 0 4px 4px 0; transition-delay: .6s; }
.ef-costrow .ef-fin { background: var(--cream, #f1ebe0); border-radius: 0; }
.ef-costrow .ef-dl { background: var(--muted, #a9b1c2); opacity: .75; border-radius: 0 4px 4px 0; }
.ef-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.ef-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; background: var(--brass, #e9b46c); }
.ef-legend .ef-c2::before { background: var(--cream, #f1ebe0); }
.ef-legend .ef-c3::before { background: var(--muted, #a9b1c2); opacity: .75; }
.ef-rev .ef-fill { background: var(--sky, #8fb3d9); }
.ef-rev .ef-gap { background: repeating-linear-gradient(135deg, rgba(227,154,134,.75) 0 4px, rgba(227,154,134,.25) 4px 8px); border-radius: 0; transition-delay: .5s; }
.ef-dnote { flex-direction: column; align-items: flex-start; gap: 4px; }
.ef-mult { display: flex; align-items: baseline; gap: 12px; font: 400 34px/1.1 var(--font-display, 'Gambarino', Georgia, serif); }
.ef-m { color: var(--muted, #a9b1c2); opacity: .45; transition: color .4s, opacity .4s; }
.ef-m.is-on { color: var(--brass, #e9b46c); opacity: 1; }
.ef-arrow { font: 400 18px/1 var(--font-body, sans-serif); color: var(--muted, #a9b1c2); }
.ef-quotes { width: 100%; border-collapse: collapse; font-size: 13px; }
.ef-quotes th, .ef-quotes td { padding: 6px 0 6px 10px; text-align: right; font-weight: 400; border-bottom: 1px solid rgba(var(--cream-rgb),.08); transition: color .4s; }
.ef-quotes th:first-child { padding-left: 0; text-align: left; color: var(--muted, #a9b1c2); }
.ef-quotes thead th { font-size: 12px; color: var(--muted, #a9b1c2); }
.ef-quotes thead th.is-on { color: var(--brass, #e9b46c); }
.ef-quotes td.is-on { color: var(--cream, #f1ebe0); }
.ef-quotes td.is-off { color: rgba(var(--muted-rgb),.6); }
.ef-caveat { margin: 0; padding-left: 10px; border-left: 2px solid rgba(var(--cream-rgb),.1); font-size: 12px; color: var(--muted, #a9b1c2); transition: color .4s, border-color .4s; }
.ef-caveat.is-on { color: var(--cream, #f1ebe0); border-left-color: var(--brass, #e9b46c); }

/* The multiplier toggle lives in the player's action row. */
.ef-toggle span { color: var(--muted, #a9b1c2); }
.ef-toggle span.is-on { color: var(--cream, #f1ebe0); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Wide screens: Memory and Guard bars read as a chart, label | track | value. */
@media (min-width: 700px) {
  .ef-mem, .ef-guard { --lab: 220px; }
  .ef-guard { --lab: 236px; }
  .ef-mem .ef-row, .ef-guard .ef-row, .ef-axis { grid-template-columns: var(--lab) minmax(0, 1fr) 92px; grid-template-areas: "name track val" "note track val"; gap: 0 16px; }
  .ef-mem .ef-axis .ef-scale, .ef-guard .ef-axis .ef-scale { grid-column: 2; }
  .ef-cost .ef-axis { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .ef-cost { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .ef-tiles { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
  .ef-tile { height: 12px; }
  .ef-box { padding: 10px 12px; gap: 8px; }
  .ef-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .ef-chip { padding: 7px 10px; }
  .ef-terms { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ef-term { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 10px 8px 28px; }
  .ef-term + .ef-term::before { left: 10px; }
  .ef-term .ef-v { text-align: right; min-width: 0; }
  .ef-mult { font-size: 28px; }
  .ef-quotes th, .ef-quotes td { padding-top: 4px; padding-bottom: 4px; }
}
