.selection-cover {
  float: right;
  margin: -26px 0 13px 20px;
  width: clamp(200px, 27%, 310px);
  height: 118px;
  object-fit: cover;
  object-position: center 59%;
  border: 1px solid #c3a47b;
  border-radius: 14px;
  background: #eee5d3;
}
.selection-mission { clear: both; }
.selection-stage { overflow: visible; }
.selection-stage [hidden] { display: none; }
.selection-route {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}
.selection-route li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 6px;
  background: #eef2f6;
  color: #405775;
  border-radius: 100px;
  font-size: .83rem;
  font-weight: 650;
}
.selection-route span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: #fff;
  color: #14243a;
  border-radius: 50%;
}
.selection-route li[aria-current] { background: #14243a; color: white; }
.selection-route .selection-done { background: #e4f4ed; color: #176044; }
.selection-route li[aria-current] span { background: #ffda85; }
.selection-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: start;
  gap: 12px 20px;
  grid-template-areas: "work demo" "work log";
  margin-top: 12px;
}
.selection-work { grid-area: work; min-width: 0; }
.selection-body:not(:has(.selection-demo)) { grid-template-areas: "work log"; }
.selection-body .selection-log { grid-area: log; margin: 0; min-width: 0; }
.selection-demo { grid-area: demo; min-width: 0; }
.selection-instruction {
  margin: 0 0 14px;
  color: #354b67;
  line-height: 1.55;
}
.selection-editor { display: grid; gap: 8px; color: #283f5b; font-weight: 700; }
.selection-editor textarea, .selection-sample {
  font: 500 1rem/1.8 Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.selection-editor textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px;
  border: 1px solid #8395ac;
  border-radius: 10px;
  background: #f8fafc;
  color: #14243a;
  resize: vertical;
}
.selection-editor textarea:focus-visible { outline: 3px solid #4968e4; outline-offset: 2px; }
.selection-editor textarea::selection { background: #ffda85; color: #14243a; }
.selection-demo, .selection-log { border-radius: 14px; padding: 16px; }
.selection-demo {
  color: #f2f6fc;
  background: #14243a radial-gradient(ellipse at 95% -40%, #396286, transparent 70%);
}
.selection-stage h3 { margin: 0 0 12px; font-size: .94rem; }
.selection-chord, .selection-commands { display: flex; flex-wrap: wrap; gap: 7px; }
.selection-chord kbd {
  padding: 4px 8px;
  background: #ffda85;
  color: #14243a;
  border-radius: 5px;
  font-family: inherit;
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.45;
  border-bottom: 2px solid #b79254;
}
.selection-sample { margin: 10px 0; }
.selection-sample mark { background: #ffda85; color: #18283f; }
.selection-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  vertical-align: -.12em;
  background: #ffda85;
}
.selection-demo-button {
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid #7890ab;
  border-radius: 6px;
  background: transparent;
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: .82rem;
}
.selection-log { margin-top: 12px; background: #edf4f7; color: #234763; }
.selection-log ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.selection-log li { line-height: 1.5; font-size: .86rem; }
.selection-log .selection-received { animation: selection-received 460ms ease-out both; font-weight: 700; color: #176044; }
@keyframes selection-received { from { opacity: .4; transform: translateX(5px); } }
.selection-tools { margin-top: 12px; color: #314b6f; }
.selection-tools summary { width: fit-content; padding: 8px 0; cursor: pointer; font-size: .88rem; font-weight: 650; }
.selection-commands:not(:empty) { margin: 5px 0 8px; }
.selection-tokens { padding: 6px; border-radius: 8px; background: #f3f6fa; white-space: pre-wrap; }
.selection-token {
  min-height: 38px;
  margin-block: 2px;
  border-radius: 5px;
  padding: 3px 6px;
  border: 1px solid #a1b2c7;
  background: white;
  color: #14243a;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.selection-token[aria-pressed=true], .selection-shift[aria-pressed=true] { background: #ffda85; color: #14243a; }
.selection-feedback { margin: 12px 0; min-height: 1.6em; line-height: 1.45; color: #28465e; overflow-wrap: anywhere; }
.selection-primary { margin-right: 8px; }
.selection-stage > .selection-log { max-width: 27rem; margin-bottom: 16px; }
@media (max-width: 750px) {
  .selection-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "demo" "work" "log"; }
  .selection-body:not(:has(.selection-demo)) { grid-template-areas: "work" "log"; }
  .selection-route { margin-bottom: 16px; gap: 5px; }
  .selection-route li { padding: 4px 7px 4px 4px; font-size: .75rem; }
  .selection-primary { margin-bottom: 6px; }
}
@media (max-width: 620px) {
  .selection-cover {
    display: block;
    float: none;
    width: 100%;
    height: 70px;
    margin: 0 0 10px;
  }
  .selection-chapter .learning-intro { margin-bottom: 12px; }
  .selection-demo {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 6px 8px;
    padding: 12px;
  }
  .selection-demo h3 { grid-column: 1 / -1; margin: 0; }
  .selection-demo-button { grid-row: 2; grid-column: 2; min-height: 40px; }
  .selection-sample { grid-column: 1 / -1; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .selection-log .selection-received { animation: none; }
}
