/* Responsive, keyboard-accessible decision games for Volumes III and IV. */
.quarto-title-block .description {
  border-left: 3px solid #715390;
  border-radius: 0 7px 7px 0;
  background: #f8f6fa;
  padding: 0.6rem 0.8rem;
  line-height: 1.45;
}
.quarto-title-block .description::before {
  content: "First move";
  display: block;
  margin-bottom: 0.2rem;
  color: #715390;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mlsp-arcade {
  --arcade-accent: #715390;
  --arcade-soft: #f4eef8;
  max-width: 820px;
  margin: 1.6rem auto 2rem;
  border: 1px solid #ded7e5;
  border-top: 5px solid var(--arcade-accent);
  border-radius: 13px;
  background: #fff;
  color: #252a31;
  box-shadow: 0 10px 28px rgba(30, 20, 40, 0.08);
  overflow: hidden;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.mlsp-arcade[data-volume="4"] {
  --arcade-accent: #267454;
  --arcade-soft: #eef7f1;
  border-color: #c9dbcf;
  border-top-color: var(--arcade-accent);
}
.mlsp-arcade-head { position: relative; padding: 1.3rem 1.45rem 1rem; background: var(--arcade-soft); }
.mlsp-arcade-volume { color: var(--arcade-accent); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.mlsp-arcade-head h2 { margin: 0.25rem 0 0.45rem; font-size: clamp(1.35rem, 3vw, 1.75rem); border: 0; }
.mlsp-arcade-head p { margin: 0; line-height: 1.48; }
.mlsp-arcade-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.3rem; padding: 0.75rem 1.45rem; border-bottom: 1px solid #e6e6e6; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.mlsp-arcade-stats strong { color: var(--arcade-accent); }
.mlsp-round-dots { display: inline-flex; gap: 0.3rem; margin-left: auto; }
.mlsp-round-dots span { display: block; width: 0.75rem; height: 0.75rem; border: 1px solid #bbc0c6; border-radius: 50%; }
.mlsp-round-dots .current { background: var(--arcade-accent); border-color: var(--arcade-accent); }
.mlsp-round-dots .won { background: #3d9e5a; border-color: #3d9e5a; }
.mlsp-round-dots .lost { background: #c44; border-color: #c44; }
.mlsp-arcade-body { padding: 1.25rem 1.45rem; }
.mlsp-arcade-body p { line-height: 1.48; }
.mlsp-arcade-feedback { min-height: 2.7rem; margin: 0; padding: 0.8rem 1.45rem; background: #f7f8fa; border-top: 1px solid #eceef0; line-height: 1.4; font-size: 0.9rem; }
.mlsp-arcade-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; padding: 0.9rem 1.45rem 1.2rem; }
.mlsp-arcade button { font: inherit; cursor: pointer; }
.mlsp-arcade button:focus-visible { outline: 3px solid #2779b8; outline-offset: 2px; }
.mlsp-arcade button:disabled { cursor: default; }
.mlsp-arcade-actions button { border: 1px solid var(--arcade-accent); border-radius: 8px; background: var(--arcade-accent); color: #fff; min-height: 44px; padding: 0.6rem 1rem; font-weight: 700; }
.mlsp-arcade-actions button:hover:not(:disabled) { filter: brightness(0.9); }
.mlsp-arcade-actions button:disabled { opacity: 0.45; }
.mlsp-result-emblem { display: grid; place-items: center; width: 4rem; height: 4rem; margin: 0 auto 0.6rem; border: 3px solid var(--arcade-accent); border-radius: 50%; color: var(--arcade-accent); font-size: 2.2rem; font-weight: 700; }
.mlsp-arcade-body:has(.mlsp-result-emblem) { text-align: center; }
.mlsp-robot-mark { position: absolute; right: 1.4rem; top: 1rem; width: 37px; height: 28px; border-radius: 8px; background: #267454; box-shadow: inset 0 -5px 0 #164e38; transform: rotate(-5deg); }
.mlsp-robot-mark::before { content: ""; position: absolute; left: 9px; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: #fff; box-shadow: 14px 0 0 #fff; }
.mlsp-robot-mark::after { content: ""; position: absolute; left: 7px; bottom: -5px; width: 7px; height: 7px; border-radius: 50%; background: #1e3740; box-shadow: 18px 0 0 #1e3740; }
.mlsp-robot-mark i { position: absolute; left: 17px; top: -6px; height: 7px; border-left: 2px solid #267454; }
.mlsp-robot-mark i::after { content: ""; position: absolute; left: -3px; top: -3px; width: 5px; height: 5px; border-radius: 50%; background: #e8aa39; }

/* A little digital agent advances between missions and tool events. */
.mlsp-agent-track { position: relative; height: 68px; margin: 0 0 1rem; }
.mlsp-agent-rail { position: absolute; left: 8%; right: 8%; top: 52px; border-top: 2px dashed #b7a9c4; }
.mlsp-agent-station { position: absolute; left: calc(8% + var(--station) * 28%); top: 42px; display: grid; place-items: center; width: 19px; height: 19px; transform: translateX(-50%); border: 2px solid #b7a9c4; border-radius: 50%; background: #fff; color: #675a70; font-size: 0.62rem; font-weight: 700; }
.mlsp-agent-station.visited { border-color: #715390; background: #715390; color: #fff; }
.mlsp-agent-sprite { position: absolute; left: calc(8% + var(--agent-step) * 28%); top: 4px; width: 27px; height: 38px; transform: translateX(-50%); filter: drop-shadow(0 3px 2px rgba(38, 28, 47, 0.17)); }
.mlsp-agent-sprite.moving { animation: mlsp-agent-hop 0.55s ease-out both; }
.mlsp-agent-head { position: absolute; left: 2px; top: 5px; width: 23px; height: 21px; border: 2px solid #543d70; border-radius: 9px 9px 7px 7px; background: #d9c6e9; }
.mlsp-agent-head::before, .mlsp-agent-head::after { content: ""; position: absolute; top: 7px; width: 3px; height: 4px; border-radius: 50%; background: #2d2635; }
.mlsp-agent-head::before { left: 5px; }
.mlsp-agent-head::after { right: 5px; }
.mlsp-agent-head b { position: absolute; left: 9px; bottom: 3px; width: 4px; height: 2px; border-radius: 50%; background: #715390; }
.mlsp-agent-antenna { position: absolute; left: 13px; top: 0; height: 7px; border-left: 2px solid #543d70; }
.mlsp-agent-antenna::after { content: ""; position: absolute; left: -3px; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: #e8aa39; }
.mlsp-agent-body { position: absolute; left: 5px; top: 24px; width: 17px; height: 12px; border: 2px solid #543d70; border-radius: 4px 4px 7px 7px; background: #715390; }
.mlsp-agent-body::before, .mlsp-agent-body::after { content: ""; position: absolute; bottom: -5px; width: 3px; height: 5px; border-radius: 2px; background: #543d70; }
.mlsp-agent-body::before { left: 2px; }
.mlsp-agent-body::after { right: 2px; }
@keyframes mlsp-agent-hop {
  from { left: calc(8% + var(--agent-from) * 28%); transform: translate(-50%, 0); }
  45% { transform: translate(-50%, -10px); }
  to { left: calc(8% + var(--agent-step) * 28%); transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) { .mlsp-agent-sprite.moving { animation: none; } }

/* Context Cache */
.mlsp-meter-label { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.38rem; font-size: 0.84rem; }
.mlsp-meter { height: 0.75rem; overflow: hidden; border-radius: 1rem; background: #e8e9eb; }
.mlsp-meter span { display: block; height: 100%; border-radius: inherit; background: var(--arcade-accent); transition: width 0.2s ease; }
.mlsp-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.65rem; margin-top: 1.15rem; }
.mlsp-clue { min-height: 86px; border: 1px solid #d3d5da; border-radius: 9px; background: #fff; padding: 0.75rem; text-align: left; }
.mlsp-clue > span:first-child { display: flex; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.4rem; }
.mlsp-clue strong { font-size: 0.91rem; }
.mlsp-clue small { color: #5c6470; white-space: nowrap; }
.mlsp-clue > span:last-child { color: #545c66; font-size: 0.83rem; }
.mlsp-clue.selected { border-color: var(--arcade-accent); background: var(--arcade-soft); box-shadow: inset 0 0 0 1px var(--arcade-accent); }
.mlsp-clue.needed { border-color: #3d9e5a; box-shadow: inset 0 0 0 1px #3d9e5a; }
.mlsp-clue:disabled, .mlsp-trail-actions button:disabled, .mlsp-stage button:disabled { opacity: 1; color: inherit; }

/* Tool Trail */
.mlsp-event-card { border-left: 5px solid var(--arcade-accent); border-radius: 8px; padding: 0.9rem 1rem; background: var(--arcade-soft); }
.mlsp-event-card > span, .mlsp-safety-panel > span { color: var(--arcade-accent); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.09em; }
.mlsp-event-card h3 { margin: 0.3rem 0; font-size: 1.1rem; }
.mlsp-event-card p { margin: 0.25rem 0; }
.mlsp-trail-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; margin-top: 1rem; }
.mlsp-trail-actions button { min-height: 84px; border: 1px solid #cfc5d7; border-radius: 8px; background: #fff; padding: 0.65rem; text-align: left; }
.mlsp-trail-actions button:hover:not(:disabled) { border-color: var(--arcade-accent); background: var(--arcade-soft); }
.mlsp-trail-actions button.selected-good { border-color: #3d9e5a; background: #eef8f0; box-shadow: inset 0 0 0 1px #3d9e5a; }
.mlsp-trail-actions button.selected-bad { border-color: #c44; background: #fff1f1; box-shadow: inset 0 0 0 1px #c44; }
.mlsp-trail-actions strong, .mlsp-trail-actions small { display: block; }
.mlsp-trail-actions small { margin-top: 0.35rem; color: #5c6470; line-height: 1.25; }

/* Latency Line */
.mlsp-arcade-targets { display: flex; justify-content: space-between; gap: 0.8rem; margin-bottom: 0.7rem; font-size: 0.9rem; }
.mlsp-latency-plot { position: relative; display: flex; width: 100%; height: 2.25rem; border-radius: 5px; background: repeating-linear-gradient(90deg, #f1f3f4, #f1f3f4 9.8%, #e5e8e9 10%); overflow: hidden; }
.mlsp-latency-plot::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--deadline-pct) - 3px); border-left: 3px solid #c44; }
.mlsp-latency-plot div { display: grid; place-items: center; min-width: 0; overflow: hidden; background: #37799f; color: #fff; border-right: 2px solid #fff; font-size: 0.75rem; white-space: nowrap; }
.mlsp-latency-plot div:nth-child(2) { background: #715390; }
.mlsp-latency-plot div:nth-child(3) { background: #267454; }
.mlsp-meter-label .over { color: #b12a34; }
.mlsp-stage-list { display: grid; gap: 0.8rem; margin-top: 1.1rem; }
.mlsp-stage { display: grid; grid-template-columns: 7rem 1fr; gap: 0.65rem; align-items: center; }
.mlsp-stage > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.mlsp-stage button { min-height: 58px; border: 1px solid #cbd4ce; border-radius: 7px; background: #fff; line-height: 1.15; }
.mlsp-stage button small { display: block; margin-top: 0.24rem; color: #59636c; font-size: 0.75rem; }
.mlsp-stage button.selected { border-color: var(--arcade-accent); background: var(--arcade-soft); box-shadow: inset 0 0 0 1px var(--arcade-accent); }

/* Safety Gate */
.mlsp-safety-layout { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(180px, 0.72fr); gap: 1rem; align-items: center; }
.mlsp-safety-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.3rem; }
.mlsp-safety-grid > span { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid #d8e0db; border-radius: 6px; background: #f2f6f3; color: #667a6c; font-size: 1.5rem; }
.mlsp-safety-grid .hazard { background: #f9d6d5; color: #a52d34; border-color: #e5aeb2; }
.mlsp-safety-grid .dock { background: #e6dfed; color: #715390; }
.mlsp-safety-grid .proposal { outline: 3px solid #d6a335; outline-offset: -3px; }
.mlsp-safety-grid .rover { background: #267454; color: #fff; border-color: #267454; }
.mlsp-rover-sprite { position: relative; display: block; width: 25px; height: 18px; border-radius: 5px 5px 3px 3px; background: #fff; box-shadow: inset 0 -4px 0 #cfe5d5; }
.mlsp-rover-sprite::before { content: ""; position: absolute; left: 6px; top: 6px; width: 3px; height: 3px; border-radius: 50%; background: #1e3740; box-shadow: 10px 0 0 #1e3740; }
.mlsp-rover-sprite::after { content: ""; position: absolute; left: 3px; bottom: -4px; width: 5px; height: 5px; border-radius: 50%; background: #1e3740; box-shadow: 14px 0 0 #1e3740; }
.mlsp-rover-sprite i { position: absolute; left: 12px; top: -6px; height: 7px; border-left: 2px solid #fff; }
.mlsp-rover-sprite i::after { content: ""; position: absolute; left: -3px; top: -3px; width: 5px; height: 5px; border-radius: 50%; background: #f6c05e; }
.mlsp-safety-panel { border-left: 4px solid var(--arcade-accent); padding: 0.8rem 1rem; background: var(--arcade-soft); border-radius: 8px; }
.mlsp-safety-panel strong { display: block; margin: 0.3rem 0; font-size: 1.55rem; }
.mlsp-safety-panel p { margin: 0.45rem 0 0; font-size: 0.86rem; }

@media (max-width: 620px) {
  .mlsp-arcade-head, .mlsp-arcade-body { padding: 1rem; }
  .mlsp-arcade-stats, .mlsp-arcade-feedback, .mlsp-arcade-actions { padding-left: 1rem; padding-right: 1rem; }
  .mlsp-trail-actions { grid-template-columns: 1fr; }
  .mlsp-trail-actions button { min-height: 56px; }
  .mlsp-stage { grid-template-columns: 1fr; }
  .mlsp-safety-layout { grid-template-columns: 1fr; }
  .mlsp-safety-panel { order: -1; }
}
