/* We Are Agency — studio shell. Notion Beige (spec/design.md).
   Flat on purpose: no gradients; tertiary coral is the single accent. */
:root {
  --primary:   #191918;
  --secondary: #8C877D;
  --tertiary:  #C26B5B;
  --neutral:   #F7F6F3;
  --surface:   #FFFFFF;
  --on-primary:#FFFFFF;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  --s-sm: 8px;
  --s-md: 16px;
  --s-lg: 32px;

  --line: rgba(140,135,125,0.22);   /* secondary @ low alpha — hairline borders */
  --line-strong: rgba(140,135,125,0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--neutral);
  color: var(--primary);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#view { position: relative; z-index: 1; min-height: 100%; }

/* Ambient motes — only visible on the landing (toggled via body class). */
#motes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
body.is-landing #motes { opacity: 1; }

.label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--secondary);
  font-weight: 500;
}

button { font-family: inherit; }

/* The single accent action. Reserved — one per screen. */
.btn-primary {
  background: var(--tertiary);
  color: var(--on-primary);
  border: none;
  border-radius: var(--r-md);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.45; cursor: default; }

.btn-quiet {
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font-size: 0.88rem;
  padding: 6px 4px;
  transition: color 0.15s ease;
}
.btn-quiet:hover { color: var(--primary); }

.link-accent {
  color: var(--tertiary);
  cursor: pointer;
  font-weight: 500;
}

/* ───────────────────────── Landing ───────────────────────── */
.landing {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--s-lg);
}
.landing__mark {
  flex: 0 0 auto;
  letter-spacing: 0.3em;
}
.landing__center {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--s-lg);
  padding: var(--s-lg) 0;
}
.landing__lines {
  position: relative;
  /* Reserve space for the tallest *wrapped* line so the Enter button below
     never collides with the text as lines crossfade in place. */
  min-height: 4.6em;
  width: min(620px, 90vw);
  display: grid;
  place-items: center;
}
.landing__line {
  grid-area: 1 / 1;        /* all lines share one cell: overlap to crossfade, cell sizes to tallest */
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--primary);
  opacity: 0;
  transition: opacity 1.4s ease;
}
.landing__line.is-on { opacity: 1; }

.landing__enter {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tertiary);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 10px 4px;
}
.landing__enter .arrow { transition: transform 0.25s ease; }
.landing__enter:hover .arrow { transform: translateX(5px); }

.landing__foot {
  flex: 0 0 auto;
  text-align: center;
  color: var(--secondary);
  font-size: 0.78rem;
}

/* ───────────────────────── Auth ───────────────────────── */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-lg);
  gap: var(--s-md);
}
.auth__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-lg);
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}
.auth__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.auth__sub { margin: 0; color: var(--secondary); font-size: 0.9rem; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.72rem; letter-spacing: 0.04em; color: var(--secondary); text-transform: uppercase; }
.field input {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--primary);
  background: var(--neutral);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 12px;
  transition: border-color 0.15s ease;
}
.field input:focus { outline: none; border-color: var(--tertiary); }

.auth__error {
  color: var(--tertiary);
  font-size: 0.82rem;
  min-height: 1.1em;
  margin: -4px 0 0;
}
.auth__toggle { font-size: 0.88rem; color: var(--secondary); text-align: center; margin: 0; }
.auth__back { margin-top: 2px; }

/* ───────────────────────── Dashboard ───────────────────────── */
.dash { max-width: 1080px; margin: 0 auto; padding: var(--s-lg); }
.dash__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--s-lg);
}
.dash__mark { letter-spacing: 0.3em; }
.dash__user { display: flex; align-items: center; gap: var(--s-md); }
.dash__who { color: var(--secondary); font-size: 0.85rem; }

.dash__head { margin: var(--s-md) 0 var(--s-lg); }
.dash__title { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.dash__hint { color: var(--secondary); margin: 6px 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: var(--s-md);
}

.story {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.story:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.story__title { font-size: 1.15rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.story__spacer { flex: 1 1 auto; }
.story__meta { color: var(--secondary); font-size: 0.78rem; }
.story__state {
  color: var(--tertiary);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* the create card — always last */
.story--new {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  border-style: dashed;
  border-color: var(--line-strong);
  color: var(--secondary);
  background: transparent;
}
.story--new:hover { color: var(--tertiary); border-color: var(--tertiary); }
.story--new .plus {
  width: 44px; height: 44px;
  display: grid; place-items: center;
}
.story--new .plus svg { display: block; }
.story--new__label { font-size: 0.9rem; font-weight: 500; }

/* ───────────────────────── Modal ───────────────────────── */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(25,25,24,0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-md);
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-lg);
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}
.modal__title { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.modal__sub { color: var(--secondary); font-size: 0.88rem; margin: -8px 0 0; }
.modal__row { display: flex; gap: var(--s-sm); justify-content: flex-end; align-items: center; }

/* ───────────────────────── Story placeholder ───────────────────────── */
.stage { max-width: 720px; margin: 0 auto; padding: var(--s-lg); min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; }
.stage__bar { padding-bottom: var(--s-lg); }
.stage__center { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: var(--s-md); }
.stage__title { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; letter-spacing: -0.03em; margin: 0; }
.stage__body { color: var(--secondary); max-width: 38ch; }

@media (prefers-reduced-motion: reduce) {
  .landing__line, .landing__enter .arrow, .story { transition: none; }
}

/* ───────────────────────── Story stage (conversational studio) ───────────── */
.stagex {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}
.stagex--loading { display: grid; place-items: center; }

/* conversation column */
.convo {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}
.convo__bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--s-md);
  padding: var(--s-md) var(--s-lg);
  border-bottom: 1px solid var(--line);
}
.convo__title { font-weight: 600; letter-spacing: -0.01em; }
.convo__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s-lg);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}
.convo__seed { color: var(--secondary); max-width: 42ch; margin: auto 0; font-size: 1.05rem; line-height: 1.5; }

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg--you { align-self: flex-end; background: var(--tertiary); color: var(--on-primary); border-bottom-right-radius: var(--r-sm); }
.msg--ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: var(--r-sm); }
.msg--thinking { display: inline-flex; gap: 5px; }
.msg--thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--secondary); animation: blink 1.2s infinite both; }
.msg--thinking span:nth-child(2) { animation-delay: 0.2s; }
.msg--thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

/* choose strip */
.choose { align-self: stretch; display: flex; flex-direction: column; gap: var(--s-sm); margin-top: 4px; }
.choose__head { margin-top: var(--s-sm); }
.choose__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-sm); }
.opt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--primary);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.opt:hover { border-color: var(--tertiary); transform: translateY(-2px); }
.opt__title { font-weight: 600; margin-bottom: 4px; }
.opt__body { font-size: 0.9rem; line-height: 1.5; }
.opt__why { margin-top: 8px; font-size: 0.74rem; color: var(--secondary); font-style: italic; }
.choose__more { align-self: flex-start; }

/* the "+1" write-your-own card */
.opt--own { grid-column: 1 / -1; border-style: dashed; border-color: var(--line-strong); display: flex; flex-direction: column; gap: 10px; cursor: default; }
.opt--own:hover { transform: none; border-color: var(--tertiary); }
.opt--own .opt__title { color: var(--secondary); }
.opt--own__row { display: flex; gap: 6px; }
.opt--own__input {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 0.9rem; color: var(--primary);
  background: var(--neutral); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px;
}
.opt--own__input:focus { outline: none; border-color: var(--tertiary); }
.opt--own__go {
  flex: 0 0 auto; background: var(--tertiary); color: var(--on-primary); border: none;
  border-radius: var(--r-md); padding: 0 12px; font-size: 1rem; cursor: pointer;
}

/* concept sketch on a card */
.opt__art { height: 132px; border-radius: var(--r-md); overflow: hidden; margin-bottom: 10px; background: var(--neutral); }
.opt__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opt__art--loading { background: var(--line-strong); animation: sketchpulse 1.4s ease-in-out infinite; }
@keyframes sketchpulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.7; } }

/* preview imagery */
.plate__img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r-md); margin-bottom: var(--s-sm); display: block; }
.chip { display: inline-flex; align-items: center; gap: 7px; }
.chip__img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

/* tensions — what's at stake */
.tension { padding: 10px 0; border-bottom: 1px solid var(--line); }
.tension:last-child { border-bottom: none; }
.tension__q { font-weight: 600; line-height: 1.4; }
.tension__poles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 0.78rem; }
.pole { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--secondary); }
.pole--toward { border-color: rgba(194, 107, 91, 0.5); color: var(--tertiary); }
.pole--away::before { content: "⚔ "; }
.tension--resolved { opacity: 0.5; }
.tension--resolved .tension__q { font-weight: 500; }
.tension__setup { font-size: 0.82rem; color: var(--secondary); padding: 4px 0; }
.tension__setup span { opacity: 0.7; }

/* click-to-focus affordances in the preview */
.plate--click, .chip--click, .tension--click { cursor: pointer; }
.plate--click { transition: border-color 0.15s ease; }
.plate--click:hover { border-color: var(--tertiary); }
.chip--click { transition: border-color 0.15s ease, color 0.15s ease; }
.chip--click:hover { border-color: var(--tertiary); color: var(--tertiary); }
.tension--click { margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--r-md); transition: background 0.15s ease; }
.tension--click:hover { background: rgba(194, 107, 91, 0.07); }

/* preview detail view */
.detail { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--s-lg); display: flex; flex-direction: column; gap: var(--s-sm); }
.detail__back { align-self: flex-start; padding-left: 0; margin-bottom: var(--s-sm); }
.detail__img { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; margin: 0 auto; object-fit: contain; border-radius: var(--r-lg); background: var(--neutral); }
.detail__img--empty { aspect-ratio: 3 / 2; display: grid; place-items: center; background: var(--neutral); border: 1px dashed var(--line-strong); color: var(--secondary); font-size: 0.85rem; }
.detail__tag { margin-top: var(--s-sm); }
.detail__name { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0 0; }
.detail__name--q { font-size: 1.3rem; line-height: 1.3; }
.detail__prose { margin: 0; line-height: 1.6; color: var(--primary); }
.detail__meta { font-size: 0.8rem; color: var(--secondary); font-style: italic; }
.detail__acts { display: flex; flex-direction: column; gap: var(--s-sm); margin-top: var(--s-md); }
.detail__act { text-align: left; }

/* current scene (the stage) */
.scene { cursor: pointer; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; transition: border-color 0.15s ease; }
.scene:hover { border-color: var(--tertiary); }
.scene__img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.scene__name { padding: 10px 12px; font-weight: 600; }

/* structure (acts & scenes) */
.struct__act { font-weight: 700; letter-spacing: -0.01em; margin-top: 8px; }
.struct__act:first-child { margin-top: 0; }
.struct__scene { color: var(--secondary); font-size: 0.88rem; padding: 3px 0 3px 12px; }
.struct__scene span { color: var(--tertiary); }

/* relationships */
.rel { padding: 6px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.rel:last-child { border-bottom: none; }
.rel__who { font-weight: 600; }
.rel__rel { color: var(--secondary); font-style: italic; }

/* compose */
.convo__compose { flex: 0 0 auto; border-top: 1px solid var(--line); padding: var(--s-md) var(--s-lg); display: flex; flex-direction: column; gap: var(--s-sm); }
.dial { display: flex; align-items: center; gap: var(--s-sm); }
.dial__end { font-size: 0.72rem; letter-spacing: 0.04em; color: var(--secondary); white-space: nowrap; }
.dial input[type="range"] { flex: 1 1 auto; accent-color: var(--tertiary); }
.steer { display: flex; gap: var(--s-sm); }
.steer__input {
  flex: 1 1 auto;
  font: inherit;
  color: var(--primary);
  background: var(--neutral);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 14px;
}
.steer__input:focus { outline: none; border-color: var(--tertiary); }
.steer__send { padding: 0 18px; font-size: 1.1rem; line-height: 1; }

/* preview column */
.preview { display: flex; flex-direction: column; min-height: 0; background: var(--neutral); }
.preview__inner { flex: 1 1 auto; overflow-y: auto; padding: var(--s-lg); display: flex; flex-direction: column; gap: var(--s-lg); }
.plate { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-lg); }
.plate--empty { display: grid; place-items: center; min-height: 160px; text-align: center; }
.plate__tag { display: block; margin-bottom: var(--s-sm); }
.plate__name { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; color: var(--tertiary); margin-bottom: var(--s-sm); }
.plate__prose { margin: 0; color: var(--primary); line-height: 1.6; }
.rail__tag { display: block; margin-bottom: var(--s-sm); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-sm); }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 0.82rem; }
.spine__beat { padding: 10px 0; border-bottom: 1px solid var(--line); line-height: 1.55; }
.spine__beat:last-child { border-bottom: none; }
.spine__empty { color: var(--secondary); font-style: italic; }
.preview__play { flex: 0 0 auto; border-top: 1px solid var(--line); padding: var(--s-md) var(--s-lg); text-align: left; }
.preview__play:disabled { opacity: 0.4; cursor: default; }

/* play overlay */
.play { width: min(640px, 100%); }
.play__read { max-height: 60vh; overflow-y: auto; }
.play__read p { line-height: 1.7; margin: 0 0 1em; }

@media (max-width: 860px) {
  .stagex { grid-template-columns: 1fr; }
  .preview { display: none; }   /* conversation-first on small screens (v1) */
}

/* ───────────────────────── Node workspace (the core loop) ───────────────── */
.ws { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.ws--loading { display: grid; place-items: center; }
.ws__bar { flex: 0 0 auto; display: flex; align-items: center; gap: var(--s-md); padding: var(--s-md) var(--s-lg); border-bottom: 1px solid var(--line); }
.ws__title { font-weight: 600; letter-spacing: -0.01em; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws__main { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.ws__stage { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.ws__art { flex: 1 1 auto; min-height: 0; position: relative; display: grid; place-items: center; padding: var(--s-lg); background: var(--neutral); overflow: hidden; }
.ws__art.is-drawing { cursor: crosshair; }
.plate-wrap { position: relative; display: inline-block; max-width: 100%; max-height: 100%; line-height: 0; }
.ws__plate { display: block; max-width: 100%; max-height: calc(100dvh - 160px); border-radius: var(--r-md); }
.ws__plate--loading { width: 60vmin; aspect-ratio: 3/2; display: grid; place-items: center; background: var(--line-strong); border-radius: var(--r-md); animation: sketchpulse 1.4s ease-in-out infinite; }
.ws__tools { flex: 0 0 auto; display: flex; gap: var(--s-sm); padding: var(--s-md) var(--s-lg); border-top: 1px solid var(--line); }
.ws__tools .is-on { color: var(--tertiary); }

/* segment overlay boxes */
.seg-box { position: absolute; border: 2px solid var(--tertiary); border-radius: var(--r-sm); background: rgba(194,107,91,0.12); cursor: pointer; }
.seg-box--sel { background: rgba(194,107,91,0.28); box-shadow: 0 0 0 2px var(--surface); }
.seg-box--draft { background: rgba(194,107,91,0.18); border-style: dashed; pointer-events: none; }
.seg-box__lbl { position: absolute; top: -1.5em; left: 0; font-size: 0.7rem; background: var(--tertiary); color: var(--on-primary); padding: 1px 6px; border-radius: var(--r-sm); white-space: nowrap; }

/* right panel */
.ws__panel { min-width: 0; overflow-y: auto; padding: var(--s-lg); display: flex; flex-direction: column; gap: var(--s-lg); }
.ws__kv { line-height: 1.6; }
.ws__kv b { color: var(--secondary); font-weight: 600; margin-right: 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.ws__muted { color: var(--secondary); font-style: italic; font-size: 0.88rem; }
.seg-list { display: flex; flex-direction: column; gap: 4px; }
.seg-row { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; cursor: pointer; font: inherit; color: var(--primary); transition: border-color 0.15s ease; }
.seg-row:hover, .seg-row.is-sel { border-color: var(--tertiary); }

/* interaction (affordance) cards */
.ix { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; margin-bottom: var(--s-sm); }
.ix--prop { border-style: dashed; }
.ix__verb { font-weight: 700; text-transform: lowercase; letter-spacing: 0.01em; }
.ix__lbl { font-size: 0.9rem; line-height: 1.5; margin: 4px 0 8px; }
.ix__row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-sm); }
.ix__add { padding: 6px 14px; font-size: 0.85rem; }

/* first-node form */
.ws--first { display: flex; flex-direction: column; }
.first { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; max-width: 560px; margin: 0 auto; padding: var(--s-lg); width: 100%; }
.first__h { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.first__sub { color: var(--secondary); margin: 0 0 var(--s-lg); }
.first__form { display: flex; flex-direction: column; gap: var(--s-md); }
.first__ta { font: inherit; min-height: 120px; resize: vertical; background: var(--neutral); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; line-height: 1.5; }
.first__ta:focus { outline: none; border-color: var(--tertiary); }
.first__row { display: flex; gap: var(--s-sm); }
.first__row .steer__input { flex: 1 1 auto; }

/* story map */
.map { width: min(720px, 100%); }
.map__nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-sm); max-height: 56vh; overflow-y: auto; }
.map__node { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; cursor: pointer; background: var(--surface); display: flex; flex-direction: column; font: inherit; text-align: left; }
.map__node.is-cur { border-color: var(--tertiary); }
.map__node img, .map__ph { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; background: var(--neutral); }
.map__node span { padding: 6px 8px; font-size: 0.8rem; }
.map__edges { margin-top: var(--s-md); display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 860px) {
  .ws__main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .ws__panel { max-height: 45vh; border-top: 1px solid var(--line); }
}

/* segmentation: tinted masks (luminance) + invisible hit areas + spinner */
.seg-mask {
  position: absolute; inset: 0; background: var(--tertiary); opacity: 0.34;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-mode: luminance; mask-mode: luminance;
  pointer-events: none; transition: opacity 0.15s ease;
}
.seg-mask--sel { opacity: 0.6; }
.seg-hit { position: absolute; cursor: pointer; border-radius: var(--r-sm); }
.seg-hit:hover { outline: 2px solid var(--tertiary); }
.seg-hit--sel { outline: 2px solid var(--surface); box-shadow: 0 0 0 3px var(--tertiary); }
.ws__spin { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px; background: rgba(247, 246, 243, 0.55); }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--tertiary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
