.so-menu,
.so-play,
.so-replay {
  --so-ink: #493823;
  --so-border: #e5d6bc;
  --so-paper: #fffaef;
  --so-accent: #256d61;
  --so-blue: #22649c;
  max-width: 790px;
  margin: 0 auto;
}

.so-menu h2,
.so-replay h2 { margin-bottom: 14px; }

.so-preview-note {
  margin: 0 auto 14px;
  padding: 9px 14px;
  max-width: 38rem;
  border-radius: 12px;
  background: var(--so-paper);
  color: var(--so-ink);
  font-size: 14px;
}

.so-cards,
.so-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.so-story.kg-card {
  padding: 8px 8px 12px;
  min-height: 64px;
  background: var(--so-paper);
  border-color: var(--so-border);
}

.so-story.kg-card:hover { border-color: #b78545; }
.so-story .kg-card__name { margin: 4px 0; }
.so-story__done { color: #386344; font-size: 12px; font-weight: 800; }

.so-message {
  min-height: 2.8em;
  margin: 6px auto 12px;
  max-width: 34rem;
  color: var(--so-ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
}

.so-row { margin: 0 auto 14px; max-width: 700px; }
.so-tray { padding: 8px; border-radius: 14px; background: #f3f7f6; }
.so-tray[hidden] { display: none; }

.so-card,
.so-slot,
.so-marker {
  min-width: 0;
  border: 2px solid var(--so-border);
  border-radius: 14px;
  background: #fffdfa;
  color: var(--so-ink);
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.so-card { padding: 6px; box-shadow: 0 3px 0 #e8dfcd; }
.so-slot { padding: 7px; min-height: 108px; }
.so-slot--empty { border-style: dashed; background: var(--so-paper); }
.so-solved .so-slot { border-color: #6caa96; background: #eaf7ef; cursor: default; }
.so-story:focus-visible, .so-card:focus-visible, .so-slot:focus-visible, .so-marker:focus-visible {
  outline: 3px solid var(--so-blue);
  outline-offset: 2px;
}

.so-slot__label {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  min-height: 28px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
}

.so-number {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #fce7bd;
  color: #6d3d13;
  font-weight: 900;
}

.so-picture { display: block; }
.so-picture__art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 9px;
}

.so-story .so-picture__art { aspect-ratio: 4 / 3; object-fit: cover; }
.so-picture__caption {
  display: grid;
  place-items: center;
  min-height: 56px;
  padding: 5px 1px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.so-selected { border-color: var(--so-blue); background: #eaf5ff; }
.so-highlight { border-color: #946117; box-shadow: 0 0 0 3px #ffdf83; }

.so-controls { margin: 8px auto 0; }
.so-controls button:disabled { opacity: .5; cursor: default; }

.so-replay__frame {
  margin: 0 auto 10px;
  padding: 10px;
  max-width: 360px;
  border: 2px solid var(--so-border);
  border-radius: 16px;
  background: var(--so-paper);
  animation: so-replay-in .35s ease-out;
}

.so-replay__caption {
  display: grid;
  place-items: center;
  margin-top: 5px;
  min-height: 2.6em;
  color: var(--so-ink);
  font-weight: 900;
}

.so-marker { min-width: 44px; min-height: 44px; font-weight: 900; }
.so-marker[aria-current='true'] { background: var(--so-accent); color: #fff; border-color: var(--so-accent); }

@keyframes so-replay-in {
  from { opacity: .15; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 520px) {
  .so-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .so-cards, .so-row { gap: 8px; }
  .so-slot, .so-card, .so-tray { padding: 5px; }
  .so-slot { min-height: 100px; }
  .so-slot__label { font-size: 11px; gap: 3px; }
  .so-number { width: 18px; height: 18px; flex-basis: 18px; }
  .so-picture__caption { font-size: 12px; }
}
