/* Energy Story Cards: the Motion Storyboard inside the practice shell's stage (about 1066 x 628 at 1366 x 768).
 * Foundations: every word in the play area is 18 px or more; every tap target is 48 px or more.
 * Pictures sit on a lit slide that stays the same in light and dark (the art is drawn for it). Energy colors are the
 * site energy key (Sim Kit): gravitational blue, kinetic green, elastic purple, thermal orange, chemical gold; sound gray. */
.es { position: absolute; inset: 0; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 14px; padding: 10px 14px; color: #1b2733; font-size: 18px; line-height: 1.3;
  background: linear-gradient(#eef4f9, #dde8f1);
  --es-panel: rgba(255, 255, 255, .96); --es-line: #a9bccb; --es-soft: #44525f; --es-accent: #2f6b4f; --es-accent-bg: #e1f0e7; --es-slide: #fbfdff; --es-ink: #1b2733;
  --e-gravitational: #2f6fd6; --e-kinetic: #2f9d57; --e-elastic: #8b4fd1; --e-thermal: #e0612a; --e-chemical: #c8a400; --e-sound: #6b7480; }
html[data-theme="dark"] .es { color: #eaf0f5; background: linear-gradient(#19202a, #12171e);
  --es-panel: rgba(30, 37, 46, .97); --es-line: #56677a; --es-soft: #c9d5df; --es-accent: #8fd6ad; --es-accent-bg: #1f3529; }
.es *, .es *::before, .es *::after { box-sizing: border-box; }
.es p, .es figure, .es figcaption, .es ol { margin: 0; padding: 0; }
.es button { font: inherit; color: inherit; }
.es svg { display: block; }
.es :focus-visible { outline: 4px solid #ffb000; outline-offset: 2px; }

/* ── picture (left) ── */
.es .es-scenebox { container: esscene / inline-size; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; background: var(--es-panel); border: 1.5px solid var(--es-line); }
.es-scene-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; padding: 8px; border-radius: 10px; background: var(--es-slide); color: var(--es-ink); box-shadow: inset 0 0 0 1px rgba(40, 60, 80, .2); overflow: hidden; }
.es p.es-cap { flex: none; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.es.is-revealed .es-scenebox { border-color: var(--es-accent); box-shadow: 0 0 0 3px var(--es-accent-bg); }
.es-scene-body svg { width: 100%; height: auto; border-radius: 8px; }

/* energy bars (HTML) */
.es-bars { display: inline-flex; align-items: flex-end; gap: 6px; padding: 4px 6px; border-radius: 8px; background: #fff; box-shadow: inset 0 0 0 1px #c9d4de; color: var(--es-ink); }
.es-bar { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.es-bar-track { position: relative; display: block; width: 26px; height: 92px; border-radius: 4px; background: repeating-linear-gradient(#f2f5f8 0 9px, #e3e9ef 9px 10px); border-bottom: 2px solid #44525f; }
.es-bar-fill { position: absolute; left: 2px; right: 2px; bottom: 0; border-radius: 3px 3px 0 0; box-shadow: inset -4px 0 0 rgba(0, 0, 0, .15), inset 3px 0 0 rgba(255, 255, 255, .25); }
.es-fill--gravitational { background: var(--e-gravitational); } .es-fill--kinetic { background: var(--e-kinetic); } .es-fill--elastic { background: var(--e-elastic); }
.es-fill--thermal { background: var(--e-thermal); } .es-fill--chemical { background: var(--e-chemical); } .es-fill--sound { background: var(--e-sound); }
.es-bar-ic svg, .es-chip-ic svg { width: 24px; height: 24px; }
.es-bars--sm .es-bar-track { width: 20px; height: 62px; }
.es-bars--sm .es-bar-ic svg { width: 20px; height: 20px; }
.es-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; font-weight: 600; }
.es-chip { display: inline-flex; align-items: center; gap: 4px; }
.es-barbox { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.es-barcap { font-weight: 700; }
.es-barsarrow { font-size: 28px; font-weight: 800; color: var(--es-soft); align-self: center; }

/* order: three pictures, each with its card space */
.es-strip { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.es--order { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.es-panel { display: grid; grid-template-columns: 210px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 4px 10px; align-items: start; align-content: center; }
.es-panel .es-pic { grid-column: 1; grid-row: 1 / 3; align-self: center; }
.es-pcap { grid-column: 2; grid-row: 1; }
.es-panel .es-slot { grid-column: 2; grid-row: 2; }
.es.is-revealed .es-panel { grid-template-columns: 150px minmax(0, 1fr) auto; }
.es-pcap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 700; }
.es-num { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #22303f; color: #fff; font-size: 18px; }
.es-pbars { grid-column: 3; grid-row: 1 / 3; align-self: center; }
.es-pbars:empty { display: none; }
html .es-slot { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 64px; padding: 6px 10px; border-radius: 12px; border: 2.5px dashed #7d8fa0; background: #f3f7fa; text-align: left; cursor: pointer; color: var(--es-ink); }
.es-slot-t { color: #5a6774; font-weight: 600; }
html .es-slot.is-filled { border-style: solid; background: #fff; }
html .es-slot:disabled { cursor: default; opacity: 1; }
html .es-slot.is-right { box-shadow: 0 0 0 3px #2f9a5c; }
html .es-slot.is-moved { box-shadow: 0 0 0 3px #e0a21c; }
.es-moved { flex: none; padding: 2px 8px; border-radius: 999px; background: #fff1cc; color: #6a4a00; font-weight: 700; }

/* biggest */
.es-big { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 0; }
.es-bigpic { flex: 1 1 auto; min-width: 0; }
.es-bigbars:empty { display: none; }

/* collide */
.es-frames { display: flex; flex-direction: column; gap: 8px; }
.es-frame { display: flex; flex-direction: column; gap: 4px; }
.es-frame figcaption { color: var(--es-ink); }

/* kinetic */
.es-lanes { display: flex; flex-direction: column; gap: 10px; }
.es-lanefig { display: flex; flex-direction: column; gap: 4px; }
.es-lanefig figcaption { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.es-lane-k { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #22303f; color: #fff; }
.es-kebar { display: flex; align-items: center; gap: 8px; }
.es-kebar:empty { display: none; }
.es-kebar-ic svg { width: 26px; height: 26px; }
.es-kebar-track { flex: 1 1 auto; height: 20px; border-radius: 6px; background: #e9eef2; box-shadow: inset 0 0 0 1px #c3ced8; }
.es-kebar-fill { display: block; height: 100%; border-radius: 6px; background: var(--e-kinetic); }

/* stops */
.es-stopbox { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.es-stoppic { width: 100%; }
.es-stopbars { display: flex; align-items: flex-end; gap: 12px; }
.es-stopbars:empty { display: none; }

/* ── task (right) ── */
.es-task { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; container-type: inline-size; }
.es-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; min-height: 48px; flex-wrap: wrap; }
.es p.es-title { min-width: 0; padding: 6px 14px; border-radius: 12px; background: var(--es-panel); border: 1.5px solid var(--es-line); }
.es-title b { font-size: 20px; }
html .es-say { flex: none; min-height: 48px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--es-line); background: var(--es-panel); font-weight: 700; cursor: pointer; white-space: nowrap; }
.es-say[aria-pressed="true"] { border-color: var(--es-accent); }
.es-say:hover { background: var(--es-accent-bg); }
.es-k { flex: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.es-k span { color: var(--es-soft); }
.es-msg { font-weight: 700; flex: none; }
.es-msg:empty { display: none; }
.es button:disabled { opacity: 1; cursor: default; }

.es-choices { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
html .es-choice { position: relative; display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 8px 12px 8px 8px; border-radius: 14px; border: 2.5px solid var(--es-line); background: var(--es-panel); text-align: left; cursor: pointer; }
.es-cpic { flex: none; display: grid; place-items: center; width: 108px; height: 72px; background: var(--es-slide); border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(40, 60, 80, .2); overflow: hidden; }
.es-cpic > svg { width: 100%; height: 100%; }
.es-cpic > svg.es-icon { width: 52px; height: 52px; }
.es-icpair { display: flex; gap: 6px; }
.es-icpair svg { width: 44px; height: 44px; }
.es-choice-t { flex: 1 1 auto; min-width: 0; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
html .es-choice:hover:not(:disabled) { border-color: var(--es-accent); background: var(--es-accent-bg); }
html .es-choice.is-chosen { border-color: var(--es-accent); box-shadow: 0 0 0 3px var(--es-accent); }

/* order: card tray */
.es-tray { flex: none; display: flex; flex-direction: column; gap: 10px; }
html .es-card { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 12px 8px 8px; border-radius: 12px; border: 2.5px solid; border-left-width: 10px; background: var(--es-panel); text-align: left; cursor: pointer; }
html .es-card:hover:not(:disabled) { background: var(--es-accent-bg); }
.es-card[hidden] { display: none; }
.es-card-ic { flex: none; display: flex; gap: 3px; }
.es-card-ic svg { width: 34px; height: 34px; }
.es-card-t { flex: 1 1 auto; min-width: 0; font-weight: 700; line-height: 1.22; overflow-wrap: anywhere; }
.es-card--gravitational { border-color: var(--e-gravitational) !important; } .es-card--kinetic { border-color: var(--e-kinetic) !important; } .es-card--elastic { border-color: var(--e-elastic) !important; }
.es-card--thermal { border-color: var(--e-thermal) !important; } .es-card--chemical { border-color: var(--e-chemical) !important; }
html .es-slot.is-filled { border-left-width: 10px; }
.es-traydone { flex: none; font-weight: 700; padding: 8px 12px; border-radius: 10px; background: var(--es-accent-bg); }
.es-traydone[hidden] { display: none; }

/* ✓ / ✗ after Check: at the end of the choice, never on a picture */
.es-mark { display: none; }
.es.is-revealed .es-mark:not(:empty) { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; font-size: 20px; font-weight: 800; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
html .es.is-revealed .es-choice.is-right { border-color: #2f9a5c; box-shadow: 0 0 0 3px #2f9a5c; }
html .es.is-revealed .es-choice.is-wrong { border-color: #c4473d; box-shadow: 0 0 0 3px #c4473d; }
.es.is-revealed .is-right .es-mark, .es.is-revealed .es-slot .es-mark { background: #17663a; }
.es.is-revealed .is-wrong .es-mark { background: #a3241f; }

/* ── Briefing example and Start art ── */
.es-example { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.es-example figure { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.es-example figcaption { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; line-height: 1.3; }
.es-ex-pic svg { width: 100%; height: auto; border-radius: 8px; }
.ps-brief .es-ex-card { cursor: default; width: 100%; min-height: 0; color: #1b2733; background: #fff; }
.ps-brief .es-ex-card .es-card-ic svg { width: 26px; height: 26px; }
.ps-brief--drawer .es-example { grid-template-columns: 1fr; }
.es-start { width: 100%; height: 100%; display: grid; place-items: center; background: #eaf4fb; border-radius: 12px; overflow: hidden; }
.es-start svg { width: 100%; height: 100%; }

/* ── Foundations: 18 px for the shell's words beside the play area too ── */
body[data-activity="energy-story-cards"] .ps-bubble, body[data-activity="energy-story-cards"] .ps-cust-detail, body[data-activity="energy-story-cards"] .ps-feedback,
body[data-activity="energy-story-cards"] .ps-hint, body[data-activity="energy-story-cards"] .ps-gloss, body[data-activity="energy-story-cards"] .ps-cust-who,
body[data-activity="energy-story-cards"] .ps-nudge { font-size: 18px; line-height: 1.3; }
body[data-activity="energy-story-cards"] .ps-cust-detail { color: var(--tlg-text); }
body[data-activity="energy-story-cards"] .ps-say { width: 48px; height: 48px; font-size: 22px; margin: -2px -4px 4px 8px; }
body[data-activity="energy-story-cards"] .ps-hint-btn { min-height: 48px; }
body[data-activity="energy-story-cards"] .ps-hint .ps-hint-note { font-size: 16px; }
body[data-activity="energy-story-cards"] .ps-side:has(.ps-feedback:not([hidden])) .ps-cust-detail,
body[data-activity="energy-story-cards"] .ps-side:has(.ps-feedback:not([hidden])) .ps-hint { display: none; }

/* narrower task column: smaller choice pictures */
@container (max-width: 420px) {
  .es-cpic { width: 88px; height: 60px; }
  html .es-choice { gap: 10px; }
}
/* a narrow picture panel */
@container esscene (max-width: 520px) {
  .es-panel, .es.is-revealed .es-panel { grid-template-columns: 140px minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .es-panel .es-pic { grid-row: 1 / 3; }
  .es-pbars { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
  .es-big { flex-direction: column; }
}
@media (max-width: 1180px) and (min-width: 901px) {
  .es { overflow-y: auto; align-items: start; }
  .es-scene-body { flex: none; overflow: visible; }
}
@media (max-width: 900px) {
  .es, .es--order { position: relative; inset: auto; overflow: visible; grid-template-columns: minmax(0, 1fr); padding: 10px 10px 16px; }
  .es-scene-body { overflow: visible; }
  .es-example { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .es-panel, .es.is-revealed .es-panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .es-panel .es-pic, .es-pcap, .es-panel .es-slot, .es-pbars { grid-column: 1; grid-row: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .es-choice, .es-card { transition: border-color .12s, background-color .12s, box-shadow .12s; }
  .es.is-revealed .es-scenebox { animation: es-pop .35s ease-out; }
  .es-bar-fill, .es-kebar-fill { animation: es-grow .5s ease-out; transform-origin: bottom left; }
  @keyframes es-pop { 0% { transform: scale(.98); opacity: .6; } 100% { transform: scale(1); opacity: 1; } }
  @keyframes es-grow { 0% { transform: scale(0, 0); } 100% { transform: scale(1, 1); } }
}
.es-pic, .es-bigpic, .es-collpic, .es-lanepic, .es-stoppic { display: block; }
