.story-page {
  max-width: 1240px;
  padding-bottom: 4rem;
}
.story-page h1 {
  max-width: 18ch;
}
.story-card {
  padding: clamp(1rem, 3vw, 1.8rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 1rem 0;
  background: var(--surface);
}
.story-card h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  line-height: 1.3;
  margin: 0 0 1rem;
}
.story-card > label,
.story-card fieldset > label {
  display: block;
  margin: 1rem 0 0.4rem;
  font-weight: 650;
}
.story-page select,
.story-page input {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
.story-page button {
  min-height: 44px;
  white-space: normal;
  text-align: left;
}
.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}
.story-page button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.story-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.story-grid .story-card {
  margin: 0;
  min-width: 0;
}
.story-grid .story-card:last-child {
  grid-column: 1/-1;
}
.story-page dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(7rem, 0.7fr) minmax(0, 1.3fr);
  gap: 0.6rem 1rem;
}
.story-page dt {
  color: var(--muted);
}
.story-page dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.story-page pre {
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: 28rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
}
.story-page details > summary {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  padding: 1rem 0;
  min-height: 48px;
  font-weight: 650;
  list-style: none;
}
.story-page summary::-webkit-details-marker {
  display: none;
}
.story-page details[open] > summary > span {
  transform: rotate(45deg);
}
.story-page fieldset {
  border: 1px solid var(--line);
  padding: 1rem;
  min-width: 0;
}
.story-page fieldset button {
  margin-top: 1rem;
}
.story-outcome {
  border-left: 4px solid var(--accent);
  padding: 4px 0 4px 20px;
}
#story-feedback:empty {
  display: none;
}
.story-page [hidden] {
  display: none !important;
}
.story-page :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
#story-history-note {
  font-weight: 650;
}
.story-card p {
  overflow-wrap: anywhere;
}
@media (max-width: 650px) {
  .story-grid {
    grid-template-columns: 1fr;
  }
  .story-page dl {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .story-page dd {
    margin-bottom: 0.7rem;
  }
  .story-actions {
    display: grid;
  }
  .story-page select {
    font-size: 0.95rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .story-page * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.story-page details > summary {
  align-items: center;
  overflow-wrap: anywhere;
}
.story-page details > summary > span {
  flex: 0 0 1.2em;
  width: 1.2em;
  height: 1.2em;
  line-height: 1.2em;
  text-align: center;
}

/* Keep action and observable consequence in one reading region. */
.story-outcome {
  margin-block: 1rem;
  padding-block: 1rem;
  border-block: 1px solid var(--line);
}
.story-outcome h2 {
  margin-bottom: 0.6rem;
}
.story-outcome p {
  margin-block: 0.5rem;
}
#story-compact-bytes,
#story-draft-diff {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}
