/* Scale of Space Sort: the Cosmic Sorting Desk 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 are dark "space slides" that stay the same in light and dark mode (the art is drawn for them). */
.ss { position: absolute; inset: 0; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 14px; padding: 10px 14px; color: #1d2040; font-size: 18px; line-height: 1.3;
  background: linear-gradient(#eef0fa, #dfe3f3);
  --ss-panel: rgba(255, 255, 255, .96); --ss-line: #a9b0d6; --ss-soft: #444a72; --ss-accent: #3b3f9e; --ss-accent-bg: #e3e5f7;
  --ss-slide: #f7f8fe; --ss-ink: #1d2040; --ss-gold: #9a6a00; }
html[data-theme="dark"] .ss { color: #eceefb; background: linear-gradient(#141729, #0d0f1c);
  --ss-panel: rgba(30, 33, 56, .97); --ss-line: #4f5688; --ss-soft: #c9cdf0; --ss-accent: #aab1ff; --ss-accent-bg: #282d55;
  --ss-slide: #1a1e38; --ss-ink: #eceefb; --ss-gold: #ffd84a; }
.ss *, .ss *::before, .ss *::after { box-sizing: border-box; }
.ss p, .ss figure, .ss figcaption { margin: 0; padding: 0; }
.ss button { font: inherit; color: inherit; }
.ss svg { display: block; }
.ss :focus-visible { outline: 4px solid #ffb000; outline-offset: 2px; }

/* ── picture (left) ── */
.ss .ss-scenebox { container: ssscene / inline-size; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; background: var(--ss-panel); border: 1.5px solid var(--ss-line); }
.ss-scene-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--ss-slide); color: var(--ss-ink); box-shadow: inset 0 0 0 1px rgba(40, 50, 110, .2); overflow: hidden; }
.ss p.ss-cap { flex: none; font-weight: 600; }
.ss p.ss-model { flex: none; color: var(--ss-soft); font-style: italic; }
.ss.is-revealed .ss-scenebox { border-color: var(--ss-accent); box-shadow: 0 0 0 3px var(--ss-accent-bg); }
.ss-slide { display: block; width: 100%; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1.5px #3a4170; background: #070c24; }
.ss-slide svg { width: 100%; height: auto; }
.ss-slide.ss-wide { max-width: 500px; }

/* two objects side by side (nest, scale) */
.ss-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; max-width: 500px; }
.ss-card2 { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.ss-card2 figcaption { display: flex; flex-direction: column; text-align: center; line-height: 1.25; }
.ss-card2 figcaption span { color: var(--ss-soft); }
.ss-pair-labels { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 500px; text-align: center; margin-top: -4px; }
.ss-pair-labels--pull { grid-template-columns: 1fr 1fr; }
.ss p.ss-fact { text-align: center; padding: 6px 12px; border-radius: 10px; background: var(--ss-accent-bg); border: 1.5px solid var(--ss-line); }

/* the sorting shelf (order) */
.ss-shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
html .ss-slot { position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 6px; min-height: 190px; padding: 8px; border-radius: 12px; border: 2.5px dashed var(--ss-line); background: var(--ss-panel); text-align: center; cursor: pointer; }
.ss-slot:disabled { cursor: default; }
.ss-slot.is-filled { border-style: solid; border-color: var(--ss-accent); }
.ss-slot-t { color: var(--ss-soft); font-weight: 700; }
.ss-slot .ss-cardpic { display: block; width: 100%; border-radius: 8px; overflow: hidden; }
.ss-slot .ss-cardpic svg { width: 100%; height: auto; }
.ss-slot .ss-card-t { font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.ss-slot-note { line-height: 1.2; color: var(--ss-soft); }
html .ss.is-revealed .ss-slot.is-right { border-color: #2f9a5c; box-shadow: 0 0 0 3px #2f9a5c; }
html .ss.is-revealed .ss-slot.is-moved { border-color: #c98a12; box-shadow: 0 0 0 3px #c98a12; }
html .ss.is-revealed .ss-slot .ss-mark.is-text { width: auto; height: auto; min-height: 30px; padding: 2px 12px; border-radius: 999px; font-size: 18px; font-weight: 700; background: #8a5a00; }
.ss p.ss-way { display: flex; align-items: center; gap: 10px; width: 100%; font-weight: 700; color: var(--ss-soft); }
.ss-way-line { flex: 1 1 auto; height: 3px; background: var(--ss-line); position: relative; border-radius: 2px; }
.ss-way-line::after { content: ''; position: absolute; right: -2px; top: -6px; border: 7.5px solid transparent; border-left: 11px solid var(--ss-line); border-right: 0; }

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

.ss-tray { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
html .ss-card { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 8px 12px 8px 8px; border-radius: 14px; border: 2.5px solid var(--ss-line); background: var(--ss-panel); text-align: left; cursor: pointer; }
.ss-card[hidden] { display: none; }
.ss-card .ss-cardpic { flex: none; display: block; width: 138px; border-radius: 8px; overflow: hidden; }
.ss-tray--distance .ss-card .ss-cardpic { width: 170px; }
.ss-card .ss-cardpic svg { width: 100%; height: auto; }
.ss-card .ss-card-t { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
html .ss-card:hover:not(:disabled) { border-color: var(--ss-accent); background: var(--ss-accent-bg); }

.ss-choices { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
html .ss-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(--ss-line); background: var(--ss-panel); text-align: left; cursor: pointer; }
.ss-cpic { flex: none; display: block; width: 150px; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px #3a4170; background: #070c24; }
.ss-cpic > svg { width: 100%; height: auto; }
.ss-choices--scale .ss-cpic { width: 180px; }
.ss-choice-t { flex: 1 1 auto; min-width: 0; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
html .ss-choice:hover:not(:disabled) { border-color: var(--ss-accent); background: var(--ss-accent-bg); }
html .ss-choice.is-chosen { border-color: var(--ss-accent); box-shadow: 0 0 0 3px var(--ss-accent); }

/* ✓ / ✗ after Check: at the end of the choice or slot, never on a picture */
.ss-mark { display: none; }
.ss.is-revealed .ss-choice .ss-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); }
.ss.is-revealed .ss-slot .ss-mark:not(:empty) { display: grid; place-items: center; align-self: center; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; font-weight: 800; color: #fff; background: #17663a; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
html .ss.is-revealed .ss-choice.is-right { border-color: #2f9a5c; box-shadow: 0 0 0 3px #2f9a5c; }
html .ss.is-revealed .ss-choice.is-wrong { border-color: #c4473d; box-shadow: 0 0 0 3px #c4473d; }
.ss.is-revealed .ss-choice.is-right .ss-mark { background: #17663a; }
.ss.is-revealed .ss-choice.is-wrong .ss-mark { background: #a3241f; }

/* ── Briefing example and Start art ── */
.ss-example { position: static; display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 14px; align-items: start; padding: 0; background: none; overflow: visible; color: inherit; }
.ss-example figure { display: flex; flex-direction: column; gap: 6px; }
.ss-example figcaption { line-height: 1.3; }
.ss-ex-pic { display: block; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px rgba(40, 50, 110, .4); background: #070c24; }
.ss-ex-pic svg { width: 100%; height: auto; }
.ps-brief--drawer .ss-example { grid-template-columns: 1fr; }
.ss-start { width: 100%; height: 100%; display: grid; place-items: center; background: #070c24; border-radius: 12px; overflow: hidden; }
.ss-start svg { width: 100%; height: 100%; }

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

/* a narrower right column: smaller pictures */
@container (max-width: 440px) {
  .ss-cpic { width: 120px; }
  .ss-choices--scale .ss-cpic { width: 150px; }
  .ss-card .ss-cardpic { width: 112px; }
  .ss-tray--distance .ss-card .ss-cardpic { width: 140px; }
  html .ss-choice, html .ss-card { gap: 10px; }
}
/* a narrow picture panel */
@container ssscene (max-width: 460px) {
  .ss-two { gap: 8px; }
  /* the shelf becomes three rows, so long names never break mid-word */
  .ss-shelf { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  html .ss-slot { flex-direction: row; align-items: center; min-height: 64px; text-align: left; padding: 6px 10px 6px 6px; }
  .ss-slot .ss-cardpic { width: 110px; flex: none; }
  .ss--distance .ss-slot .ss-cardpic { width: 130px; }
  .ss-slot .ss-card-t { overflow-wrap: normal; }
  .ss-slot.is-filled { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; }
  .ss-slot.is-filled .ss-cardpic { grid-row: 1 / span 3; }
  .ss-slot.is-filled .ss-mark { grid-column: 3; grid-row: 1 / span 3; }
  html .ss.is-revealed .ss-slot.is-filled .ss-mark.is-text { grid-column: 2; grid-row: 3; justify-self: start; }
  .ss-slot-note { grid-column: 2; }
}
@media (max-width: 1180px) and (min-width: 901px) {
  .ss { overflow-y: auto; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .ss-scene-body { flex: none; overflow: visible; }
}
@media (max-width: 900px) {
  .ss { position: relative; inset: auto; overflow: visible; grid-template-columns: minmax(0, 1fr); padding: 10px 10px 16px; }
  .ss-scene-body { overflow: visible; }
  .ss-example { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .ss-cpic { width: 104px; }
  .ss-choices--scale .ss-cpic { width: 130px; }
  .ss-card .ss-cardpic { width: 96px; }
  .ss-tray--distance .ss-card .ss-cardpic { width: 120px; }
  .ss-slot .ss-cardpic { width: 92px; }
  .ss--distance .ss-slot .ss-cardpic { width: 110px; }
}
@media (prefers-reduced-motion: no-preference) {
  .ss-choice, .ss-card, .ss-slot { transition: border-color .12s, background-color .12s, box-shadow .12s; }
  .ss.is-revealed .ss-scenebox { animation: ss-pop .35s ease-out; }
  @keyframes ss-pop { 0% { transform: scale(.98); opacity: .6; } 100% { transform: scale(1); opacity: 1; } }
}
