/* Earth Systems Detective: the case file and choices beside the case board, inside the practice shell's stage. */
.esd { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 12px; padding: 8px 12px; color: var(--tlg-text, #172c38); }
.esd-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 2px; }

/* the case file */
.esd-ticket { padding: 8px 12px 10px; border-radius: var(--tlg-radius-lg, 14px); border: 2px solid #c9a46a; background: #fbf5e6; color: #2b1d10;
  background-image: repeating-linear-gradient(0deg, transparent 0 25px, rgba(122, 90, 40, .12) 25px 26px); }
.esd-ticket-k { margin: 0 0 6px; font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps, .08em); color: #8a3b12; }
.esd-evidence { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.esd-evidence-k { font-size: 16px; font-weight: 800; padding: 1px 8px; border-radius: 6px; background: #c0262d; color: #fff; }
.esd-evidence-v { font-size: 19px; font-weight: 800; line-height: 1.3; }
.esd-chain { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.4; }
html[data-theme="dark"] .esd-ticket { background-color: #2c2116; color: #f6e9d6; border-color: #9a6b3e; background-image: repeating-linear-gradient(0deg, transparent 0 25px, rgba(255, 220, 160, .08) 25px 26px); }
html[data-theme="dark"] .esd-ticket-k { color: #ffbf8a; }

/* choices */
.esd-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.esd-field legend { padding: 0; margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.esd-spheres { display: grid; grid-template-columns: 1fr; gap: 8px; }
.esd-spheres.is-compact { grid-template-columns: repeat(2, 1fr); }
.esd-loops { display: grid; gap: 8px; }
.esd-choice { position: relative; font: inherit; cursor: pointer; color: var(--tlg-text, #172c38); background: var(--tlg-surface, #fff); border: 2px solid var(--tlg-border, #a5b6c1);
  border-radius: 12px; box-shadow: 0 2px 0 rgba(0, 0, 0, .1); touch-action: manipulation; display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 6px 22px 6px 8px; min-height: 58px; text-align: left; }
.esd-spheres.is-compact .esd-choice { min-height: 48px; grid-template-columns: 34px minmax(0, 1fr); padding: 4px 20px 4px 6px; }
.esd-choice-i svg { width: 44px; height: 40px; display: block; }
.esd-spheres.is-compact .esd-choice-i svg { width: 34px; height: 31px; }
.esd-choice-l { font-size: 17px; font-weight: 800; line-height: 1.2; }
.esd-sphere { border-left-width: 7px; }
.esd-sphere--geosphere { border-left-color: #7a4b2a; } .esd-sphere--hydrosphere { border-left-color: #1d5f9e; }
.esd-sphere--atmosphere { border-left-color: #4b5f8a; } .esd-sphere--biosphere { border-left-color: #2e6b2f; }
.esd-choice:hover:not(:disabled) { border-color: #8a3b12; }
.esd-sphere:hover:not(:disabled) { border-left-width: 7px; }
.esd-choice[aria-pressed="true"] { border-color: #c2410c; border-width: 3px; background: #fdf0e0; box-shadow: 0 0 0 3px rgba(194, 65, 12, .25); }
.esd-sphere[aria-pressed="true"] { border-left-width: 7px; }
html[data-theme="dark"] .esd-choice[aria-pressed="true"] { background: #3a2716; border-color: #ffbf8a; }
html[data-theme="dark"] .esd-sphere--geosphere { border-left-color: #c9926a; } html[data-theme="dark"] .esd-sphere--hydrosphere { border-left-color: #6fb2ec; }
html[data-theme="dark"] .esd-sphere--atmosphere { border-left-color: #9fb2dd; } html[data-theme="dark"] .esd-sphere--biosphere { border-left-color: #7fcf7a; }
.esd-choice:disabled { cursor: default; opacity: 1; }
.esd-choice.is-ok { border-color: #2e8b57; border-width: 3px; }
.esd-choice.is-bad { border-color: #b42318; border-style: dashed; border-width: 3px; }
.esd-mark { position: absolute; top: -9px; right: -7px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font-size: 16px; font-weight: 900; color: #fff !important; }
.esd-choice.is-ok .esd-mark { background: #1d6b40; } .esd-choice.is-bad .esd-mark { background: #b42318; }
.esd-msg { margin: 0; font-size: 16px; font-weight: 700; color: #8a3b12; }
.esd-msg:empty { display: none; }
html[data-theme="dark"] .esd-msg { color: #ffbf8a; }
.esd-about { font-size: 16px; line-height: 1.45; }
.esd-about summary { cursor: pointer; font-weight: 700; }
.esd-about p { margin: 6px 0 0; }

/* the case board */
.esd-view { position: relative; min-width: 0; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.esd-scene { position: relative; width: 100%; aspect-ratio: 720 / 600; border-radius: var(--tlg-radius-lg, 14px); overflow: hidden; border: var(--tlg-border-width, 1px) solid var(--tlg-border, #a5b6c1); user-select: none; -webkit-user-select: none; }
.esd-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.esd-t { font-family: var(--tlg-font-body, system-ui, sans-serif); fill: #1d2b2f; }
.esd-t-rail { font-size: 19px; font-weight: 800; fill: #f6e7c8; letter-spacing: .04em; }
.esd-t-dim { fill: #d9bf98; font-weight: 700; letter-spacing: 0; }
.esd-t-foot { font-size: 18px; font-weight: 700; fill: #f1e2c6; font-style: italic; }
.esd-t-stamp { font-size: 18px; font-weight: 900; fill: #ffffff; letter-spacing: .06em; paint-order: stroke; stroke: rgba(30, 20, 10, .65); stroke-width: 4px; }
.esd-t-card { font-size: 18px; font-weight: 900; fill: #ffffff; letter-spacing: .02em; }
.esd-t-sub { font-size: 18px; font-weight: 700; fill: #2b2418; }
.esd-t-tag { font-size: 19px; font-weight: 800; fill: #2b1d10; }
.esd-t-flag { font-size: 17px; font-weight: 900; fill: #ffffff; }
.esd-t-mol { font-size: 20px; font-weight: 900; fill: #1d2b2f; paint-order: stroke; stroke: #ffffff; stroke-width: 4px; }
.esd-t-sheet { font-size: 20px; font-weight: 900; fill: #8a1d1d; letter-spacing: .04em; }
.esd-t-node { font-size: 18px; font-weight: 700; fill: #1d2b2f; }
.esd-t-small { font-size: 18px; font-weight: 700; fill: #55606a; }
.esd-t-stampbig { font-size: 21px; font-weight: 900; letter-spacing: .04em; }
.esd-t-stampbig.is-ok { fill: #14532d; } .esd-t-stampbig.is-amp { fill: #8a1a10; } .esd-t-stampbig.is-stab { fill: #174a80; }

.esd-card-bg { fill: #fdfbf4; stroke: #c9b98f; stroke-width: 1.5; }
.esd-card-hit { fill: transparent; stroke: none; cursor: pointer; }
.esd.is-locked .esd-card-hit, .esd--feedback .esd-card-hit { cursor: default; }
.esd-card:hover .esd-card-hit { stroke: #c2410c; stroke-width: 3; stroke-opacity: .55; }
.esd.is-locked .esd-card:hover .esd-card-hit { stroke: none; }
.esd-card.is-chosen .esd-card-hit { stroke: #c2410c; stroke-width: 5; stroke-dasharray: 12 6; stroke-opacity: 1; }
.esd-card.is-ok .esd-card-hit { stroke: #1d7a46; stroke-width: 6; stroke-opacity: 1; stroke-dasharray: none; }
.esd-card.is-bad .esd-card-hit { stroke: #b42318; stroke-width: 5; stroke-dasharray: 8 6; stroke-opacity: 1; }
.esd-flag { fill: #1d2b2f; stroke: #ffffff; stroke-width: 1.5; }
.esd-card.is-ok .esd-flag { fill: #1d7a46; }

.esd-ring { fill: none; stroke: #ffd400; stroke-width: 5; stroke-dasharray: 9 5; filter: drop-shadow(0 0 2px #2a1a0c); }
.esd-handle { stroke: #3b2a1c; stroke-width: 7; stroke-linecap: round; }
.esd-tag { fill: #fff8df; stroke: #8a6a2a; stroke-width: 2; }
.esd-pending { fill: none; stroke: #c0262d; stroke-width: 4; stroke-dasharray: 6 4; }

.esd-yarn-sh { fill: none; stroke: rgba(40, 20, 10, .35); stroke-width: 7; stroke-linecap: round; transform: translate(2px, 3px); }
.esd-yarn { fill: none; stroke: #c0262d; stroke-width: 5; stroke-linecap: round; }
.esd-yarn.is-bad { stroke-dasharray: 10 8; }
.esd-yarn.is-ok { stroke: #1d7a46; stroke-width: 6; }
.esd-head { fill: #c0262d; stroke: #5a0f12; stroke-width: 1.5; }
.esd-head.is-ok { fill: #1d7a46; stroke: #0c3b20; }
.esd-token { fill: #ffd400; stroke: #3b2a1c; stroke-width: 2.5; }
.esd-chit rect { fill: #ffffff; stroke: #3b2a1c; stroke-width: 2; }
.esd-stamp { fill: rgba(255, 255, 255, .92); stroke-width: 3.5; }
.esd-stamp.is-ok { stroke: #1d7a46; } .esd-stamp.is-amp { stroke: #b42318; } .esd-stamp.is-stab { stroke: #1d5f9e; }

.esd-node rect { fill: #ffffff; stroke: #55606a; stroke-width: 2; }
.esd-node.is-start rect { fill: #fff1e6; stroke: #c2410c; }
.esd-loop-arrow { fill: none; stroke: #55606a; stroke-width: 3.5; stroke-linecap: round; }
.esd-loop-arrow.is-return { stroke-dasharray: 9 7; }
.esd-loop-head { fill: #55606a; }

/* reveal badge (over the rail) */
.esd-badge { position: absolute; left: 2%; right: 2%; top: 1%; padding: 7px 12px; border-radius: 10px; font-size: 17px; font-weight: 700; line-height: 1.3; pointer-events: none;
  background: rgba(255, 255, 255, .97); color: #10202c; border: 3px solid #245c70; box-shadow: 0 3px 8px rgba(0, 0, 0, .25); animation: esd-pop .25s ease-out; }
.esd-badge.is-ok { border-color: #1d6b40; }
.esd-badge.is-bad { border-color: #b42318; }
@keyframes esd-pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* briefing + start */
.esd-example-svg { display: block; width: 100%; height: auto; max-height: 460px; }
.esd-start-svg { display: block; width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) { .esd-badge { animation: none; } }
@media (max-width: 1100px) { .esd { grid-template-columns: 300px minmax(0, 1fr); } }
@media (max-width: 900px) {
  .esd { position: static; grid-template-columns: 1fr; }
  .esd-panel { overflow: visible; }
  .esd-view { display: block; order: -1; }
  .esd-scene { width: 100% !important; }
}

/* chain (cause-and-effect strip) */
.esd-spheres.is-row { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.esd-spheres.is-row .esd-choice { grid-template-columns: 1fr; justify-items: center; gap: 0; min-height: 50px; padding: 3px 2px; text-align: center; border-left-width: 2px; border-bottom-width: 6px; }
.esd-spheres.is-row .esd-choice-i svg { width: 30px; height: 26px; }
.esd-spheres.is-row .esd-choice-l { font-size: 16px; }
.esd-spheres.is-row .esd-sphere--geosphere { border-bottom-color: #7a4b2a; } .esd-spheres.is-row .esd-sphere--hydrosphere { border-bottom-color: #1d5f9e; }
.esd-spheres.is-row .esd-sphere--atmosphere { border-bottom-color: #4b5f8a; } .esd-spheres.is-row .esd-sphere--biosphere { border-bottom-color: #2e6b2f; }
.esd--chain .esd-field legend { margin-bottom: 3px; }
.esd--chain .esd-panel { gap: 7px; }
.esd-slot { cursor: pointer; }
.esd.is-locked .esd-slot { cursor: default; }
.esd-slot-empty { fill: #ffffff; stroke: #8a7a5a; stroke-width: 2; stroke-dasharray: 6 4; }
.esd-slot-ring { fill: transparent; stroke: none; }
.esd-slot.is-active .esd-slot-ring { stroke: #c2410c; stroke-width: 4; }
.esd-slot.is-ok .esd-slot-ring { stroke: #1d7a46; stroke-width: 4; }
.esd-slot.is-bad .esd-slot-ring { stroke: #b42318; stroke-width: 4; stroke-dasharray: 8 5; }
.esd-slot.is-ok .esd-slot-mark { fill: #1d7a46; } .esd-slot.is-bad .esd-slot-mark { fill: #b42318; }
.esd-t-slot { font-size: 18px; font-weight: 900; fill: #ffffff; }
.esd-t-mark { font-size: 18px; font-weight: 900; fill: #ffffff; }
.esd-t-fix { font-size: 18px; font-weight: 800; fill: #8a1a10; }
.esd-t-story { font-size: 18px; font-weight: 600; fill: #3b3020; font-style: italic; }
