.story-host {
  width: 100%;
  margin: 0;
  color: #201b17;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  text-align: left;
}

.story-host * {
  box-sizing: border-box;
}

.story-host button,
.story-host textarea {
  font-family: inherit;
}

.story-workflow,
.story-personalise {
  width: 100%;
  padding-bottom: 0;
}

.story-workflow-visual,
.story-personalise-visual {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid rgba(35, 28, 24, .22);
  border-radius: 16px;
  background: #d7b28f url("/assets/koala-about-dunes.webp") center / cover no-repeat;
  box-shadow: 0 18px 34px rgba(43, 30, 22, .12);
  isolation: isolate;
}

.story-personalise-visual {
  min-height: 390px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.story-workflow-visual::after,
.story-personalise-visual::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(105deg, rgba(255, 249, 239, .2), rgba(35, 22, 16, .16));
  content: "";
  pointer-events: none;
}

.story-personalise-visual::after {
  background: linear-gradient(105deg, rgba(255, 249, 239, .2), rgba(35, 22, 16, .12));
}

.story-workflow-workspace {
  position: absolute;
  z-index: 1;
  inset: 40px 106px 34px 44px;
  overflow: hidden;
  border: 1px solid rgba(88, 54, 34, .13);
  border-radius: 20px;
  background: rgba(255, 252, 246, .89);
  box-shadow: 0 20px 40px rgba(72, 32, 15, .13);
  transition: background-color 180ms ease-out, opacity 180ms ease-out;
}

/* story.js puts is-back-to-work on the scene container, not the workspace;
   match both placements so the "back to work" refocus always lands. */
.is-back-to-work .story-workflow-workspace,
.story-workflow-workspace.is-back-to-work {
  background: rgba(255, 252, 246, .98);
}

.story-workflow-toolbar {
  align-items: center;
  height: 42px;
  display: flex;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(88, 54, 34, .1);
  color: rgba(42, 31, 24, .62);
  font-size: 11px;
  letter-spacing: .02em;
}

.story-workflow-toolbar-label {
  color: rgba(42, 31, 24, .5);
  font-size: 11px;
  letter-spacing: .03em;
}

.story-window-dots {
  display: inline-flex;
  gap: 5px;
}

.story-window-dots span {
  width: 7px;
  height: 7px;
  display: block;
  border-radius: 50%;
}

.story-window-dot--red { background: #db8b74; }
.story-window-dot--gold { background: #d7b36c; }
.story-window-dot--green { background: #83ad81; }

.story-workflow-document {
  max-width: 520px;
  padding: 42px 54px;
}

.story-workflow-kicker {
  color: #9a4f35;
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .1em;
  margin: 0 0 11px;
  text-transform: uppercase;
}

.story-workflow-document h3 {
  margin: 0;
  color: #2d211b;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 680;
  letter-spacing: -.055em;
  line-height: .98;
}

.story-workflow-lede {
  margin: 13px 0 30px;
  color: rgba(45, 33, 27, .66);
  font-size: 15px;
  line-height: 1.4;
}

.story-workflow-list {
  display: grid;
  gap: 13px;
}

.story-workflow-row {
  align-items: center;
  display: flex;
  gap: 9px;
  color: rgba(45, 33, 27, .82);
  font-size: 13px;
}

.story-workflow-check {
  align-items: center;
  border: 1px solid rgba(45, 33, 27, .26);
  border-radius: 50%;
  color: #54765e;
  display: inline-flex;
  flex: 0 0 18px;
  font-size: 11px;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.story-native-scene {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

.story-detach {
  width: 100%;
  min-height: 244px;
  height: 100%;
}

.story-detach-visual {
  position: relative;
  min-height: 244px;
  height: 100%;
  overflow: hidden;
  background: #526255 url("/assets/koala-forest.webp") center / cover no-repeat;
  isolation: isolate;
}

.story-detach-visual::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(100deg, rgba(20, 30, 23, .14), rgba(243, 234, 216, .08));
  content: "";
  pointer-events: none;
}

.story-interaction-visual {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

.story-host--interaction .story-native-scene {
  pointer-events: none;
}

.story-host--interaction .story-card {
  transition: transform 520ms cubic-bezier(.22, .8, .26, 1), opacity 180ms ease-out;
}

.story-host--interaction .story-card--detached .story-card-surface {
  border-radius: 22px;
}

.story-host--interaction .story-card-title {
  font-size: clamp(16px, 1.35vw, 20px);
}

.story-host--interaction .story-card-body {
  font-size: clamp(14px, 1.12vw, 17px);
  line-height: 1.45;
}

.story-personalise-controls button {
  font: inherit;
}

.story-rail-shape {
  position: absolute;
  top: 0;
  right: 0;
  display: block;
  overflow: visible;
  pointer-events: none;
}

.story-rail-hit {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 44px;
  pointer-events: auto;
}

.story-rail-column {
  position: absolute;
  z-index: 6;
  right: 0;
  width: 64px;
  opacity: 1;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
  pointer-events: auto;
}

.story-rail-column.is-collapsed {
  opacity: 0;
  transform: translateX(54px);
  pointer-events: none;
}

.story-note-list {
  position: absolute;
  right: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden auto;
  scrollbar-width: none;
}

.story-note-list::-webkit-scrollbar {
  display: none;
}

.story-note,
.story-plus {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--story-note-colour, #1f201f);
  color: var(--story-note-ink, #f8f8f5);
  cursor: pointer;
}

.story-note:focus-visible,
.story-plus:focus-visible {
  outline: 2px solid var(--story-note-ink, #f8f8f5);
  outline-offset: 2px;
}

.story-note .story-icon {
  width: 30px;
  height: 27px;
  filter: var(--story-note-icon-filter, brightness(0) invert(1));
}

.story-plus {
  position: absolute;
  right: 10px;
  background: transparent;
}

.story-plus .story-icon {
  width: 28px;
  height: 26px;
  filter: var(--story-rail-icon-filter, brightness(0) invert(1));
}

.story-card {
  position: absolute;
  z-index: 5;
  display: block;
  color: var(--story-card-ink, #f8f8f5);
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  transform-origin: right center;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.story-card--hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(.01);
}

.story-card-shape {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  overflow: visible;
  pointer-events: none;
}

.story-card-surface {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--story-card-body-width, 320px);
  height: 164px;
  overflow: hidden;
  border-radius: 20px;
  color: var(--story-card-ink, #f8f8f5);
  text-align: left;
}

.story-card-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px;
  text-align: left;
}

.story-card-content-inner {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.story-card-header {
  align-items: center;
  width: 100%;
  height: 24px;
  min-height: 24px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.story-card-title {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-host--personalise .story-card-title {
  font-size: clamp(15px, 1.35vw, 20px);
}

.story-card-body {
  margin: 10px 0 0;
  color: inherit;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-line;
}

.story-card-editor {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  margin-top: 8px;
  padding: 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
}

.story-host--personalise .story-card-body,
.story-host--personalise .story-card-editor {
  font-size: clamp(14px, 1.18vw, 18px);
  line-height: 1.4;
}

.story-card-editor::selection {
  background: rgba(255, 255, 255, .26);
}

.story-card-editor.is-bold { font-weight: 700; }
.story-card-editor.is-italic { font-style: italic; }
.story-card-editor.is-underlined { text-decoration: underline; text-underline-offset: 3px; }

.story-format-note-image {
  border-radius: 7px;
  display: block;
  flex: 0 0 auto;
  height: clamp(100px, 10vw, 140px);
  margin-top: 10px;
  max-width: 100%;
  object-fit: cover;
  object-position: center;
  opacity: .92;
  width: clamp(160px, 17vw, 230px);
}

.story-step-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: 24px;
  margin-right: clamp(18px, 3vw, 32px);
  margin-left: clamp(18px, 3vw, 32px);
  border-top: 1px solid rgba(49, 30, 20, .14);
}

.story-step-button {
  align-items: center;
  min-height: 42px;
  display: inline-flex;
  gap: 9px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgba(49, 30, 20, .53);
  cursor: pointer;
  font-size: 13px;
  font-weight: 620;
}

.story-step-button[aria-selected="true"] {
  border-bottom-color: #a35e40;
  color: #8f4f35;
}

.story-step-button:focus-visible,
.story-format-button:focus-visible,
.story-palette-button:focus-visible {
  outline: 2px solid #a35e40;
  outline-offset: 3px;
}

.story-step-number {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
}

.story-step-status {
  min-height: 1.2em;
  margin: 11px clamp(18px, 3vw, 32px) 0;
  color: rgba(49, 30, 20, .56);
  font-size: 12px;
}

.story-personalise-controls {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  gap: 22px 30px;
  margin: 0;
  padding-top: 24px;
  border-top: 1px solid rgba(49, 30, 20, .14);
}

.story-palette-group,
.story-format-group {
  align-items: center;
  display: flex;
  gap: 10px;
}

.story-control-label {
  margin-right: 3px;
  color: rgba(49, 30, 20, .58);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.personalise-controls-slot .story-palette-group {
  flex: 0 1 100%;
  flex-wrap: wrap;
  min-width: 0;
  row-gap: 8px;
}

.personalise-controls-slot .story-palette-group .story-control-label {
  flex: 0 0 100%;
  margin-right: 0;
}

.story-palette-button {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--story-swatch);
  cursor: pointer;
}

.story-palette-button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #f8eee2, 0 0 0 4px #a35e40;
}

.story-format-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(49, 30, 20, .2);
  background: transparent;
  color: #4c3124;
  cursor: pointer;
  font-size: 13px;
}

.story-format-button[aria-label="Italic sample"] { font-style: italic; }
.story-format-button[aria-label="Underline sample"] { text-decoration: underline; text-underline-offset: 3px; }

.story-format-button[aria-pressed="true"] {
  border-bottom-color: #a35e40;
  background: rgba(163, 94, 64, .13);
}

.story-reveal-content.story-reveal-ready {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 680ms ease-out, transform 680ms cubic-bezier(.2, .8, .2, 1);
}

.story-reveal-content.story-reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

.story-reveal-piece.story-reveal-ready {
  opacity: 0;
  transform: translate3d(0, 28px, 0) scale(.985);
  transition: opacity 720ms cubic-bezier(.23, 1, .32, 1), transform 720ms cubic-bezier(.23, 1, .32, 1);
  transition-delay: calc(var(--story-reveal-index, 0) * 90ms);
}

.story-reveal-piece.story-reveal-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.storage-illustration .storage-sheet {
  transition: transform 760ms cubic-bezier(.23, 1, .32, 1), opacity 760ms ease-out;
}

.storage-illustration .storage-sheet[data-storage-sheet="0"] { transition-delay: 80ms; }
.storage-illustration .storage-sheet[data-storage-sheet="1"] { transition-delay: 150ms; }
.storage-illustration .storage-sheet[data-storage-sheet="2"] { transition-delay: 220ms; }

.storage-illustration.is-collected .storage-sheet[data-storage-sheet="0"] {
  opacity: .86;
  transform: translate3d(180%, 46%, 0) rotate(-5deg) scale(.82);
}

.storage-illustration.is-collected .storage-sheet[data-storage-sheet="1"] {
  opacity: .88;
  transform: translate3d(125%, 38%, 0) rotate(3deg) scale(.86);
}

.storage-illustration.is-collected .storage-sheet[data-storage-sheet="2"] {
  opacity: .9;
  transform: translate3d(62%, 30%, 0) rotate(8deg) scale(.9);
}

@media (max-width: 760px) {
  .story-host {
    width: 100%;
    margin: 0;
  }

  .story-workflow-visual,
  .story-personalise-visual {
    min-height: 360px;
    border-radius: 14px;
  }

  .story-detach,
  .story-detach-visual {
    min-height: 220px;
  }

  .story-personalise-visual {
    min-height: 340px;
    border-radius: 0;
  }

  .story-workflow-workspace {
    inset: 26px 76px 24px 20px;
  }

  .story-workflow-document {
    padding: 30px 24px;
  }

  .story-step-controls {
    gap: 17px;
  }

  .story-step-button {
    font-size: 12px;
  }

  .story-personalise-controls {
    gap: 18px 24px;
    padding-top: 20px;
  }

  .story-palette-group {
    flex-wrap: wrap;
    column-gap: 8px;
    row-gap: 8px;
    max-width: 100%;
  }

  .story-palette-group .story-control-label {
    flex: 0 0 100%;
    margin-right: 0;
  }

  .story-host--personalise .story-card-title {
    font-size: 16px;
  }

  .story-host--interaction .story-card-title {
    font-size: 16px;
  }

  .story-host--personalise .story-card-body,
  .story-host--personalise .story-card-editor {
    font-size: 14px;
  }

  .story-host--interaction .story-card-body {
    font-size: 14px;
  }

  .story-host--personalise .story-format-note-image {
    height: 100px;
    width: 160px;
  }
}

@media (max-width: 600px) {
  .story-palette-button {
    width: 24px;
    height: 24px;
  }

  .story-palette-group { column-gap: 6px; }

}

@media (prefers-reduced-motion: reduce) {
  .story-workflow-workspace,
  .story-rail-column,
  .story-card,
  .story-host--interaction .story-card,
  .story-reveal-content.story-reveal-ready,
  .story-reveal-content.story-reveal-visible,
  .story-reveal-piece.story-reveal-ready,
  .story-reveal-piece.story-reveal-visible,
  .storage-illustration .storage-sheet {
    opacity: 1;
    transition: none;
    transform: none;
  }
}
