/* Stories live card (Phase B Step 3). Ink = their words; pencil = KoLi, muted + erasable.
   No teal here — the Story step keeps its one teal moment on the primary CTA. */
.story-card {
  display: grid;
  gap: 8px;
  margin: 10px auto 6px;
  max-width: 560px;
  width: 100%;
  text-align: left;
}
.story-card.is-mobile-tabs {
  max-height: 260px;
}
.story-card-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
}
.story-card-tab {
  flex: 1;
  appearance: none;
  border: 1px solid rgba(184, 205, 216, 0.2);
  background: rgba(12, 19, 24, 0.25);
  color: rgba(184, 205, 216, 0.75);
  border-radius: 999px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.story-card-tab.is-active {
  background: rgba(238, 244, 247, 0.12);
  border-color: rgba(238, 244, 247, 0.55);
  color: #eef4f7;
}
.story-card-tab.is-filled:not(.is-active) {
  color: rgba(238, 244, 247, 0.85);
}
.story-card-slot {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(184, 205, 216, 0.14);
  background: rgba(12, 19, 24, 0.35);
  min-height: 0;
}
.story-card.is-mobile-tabs .story-card-slot {
  max-height: 200px;
  overflow: auto;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 14px), transparent 100%);
}
.story-card-label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pc-mist, #7a99ab);
}
.story-card-body {
  display: grid;
  gap: 4px;
}
.story-card-ink-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
}
.story-card-ink {
  font-size: 0.92rem;
  line-height: 1.4;
  color: #eef4f7;
}
.story-card-ink.is-new {
  animation: story-card-ink-in 420ms ease-out both;
}
@keyframes story-card-ink-in {
  from { opacity: 0; transform: translateY(3px); color: #b8b0a5; }
  to { opacity: 1; transform: none; }
}
.story-card-empty {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(184, 205, 216, 0.42);
}
.story-card-pencil {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px dashed rgba(184, 205, 216, 0.3);
  border-radius: 8px;
  font-style: italic;
  font-size: 0.82rem;
  color: rgba(184, 205, 216, 0.7);
}
.story-card-pencil-kind {
  font-style: normal;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}
.story-card-pencil-text {
  flex: 1;
}
.story-card-pencil-erase {
  appearance: none;
  border: none;
  background: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  margin: -12px -8px -12px 0;
  padding: 0;
  cursor: pointer;
}
.story-card.is-busy .story-card-slot::after {
  content: '';
  display: block;
  height: 3px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(184, 205, 216, 0.35), transparent);
  background-size: 200% 100%;
  animation: story-card-shimmer 1.2s linear infinite;
}
@keyframes story-card-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@media (min-width: 768px) {
  .story-card:not(.is-mobile-tabs) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 920px;
    gap: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .story-card-ink.is-new,
  .story-card.is-busy .story-card-slot::after { animation: none; }
}

/* Step 4 — "pick a line" arrival + Interview handoff. Quiet: no teal on lines;
   the handoff CTA (precoach-cta) is the view's one teal moment after save. */
.story-lines {
  margin: 4px 0 14px;
}
.story-lines-q {
  margin: 0 0 6px;
  font-family: Newsreader, Georgia, serif;
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--pc-halo, #b8cdd8);
}
.story-lines-sub {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--pc-mist, #7a99ab);
}
.story-lines-list {
  display: grid;
  gap: 6px;
}
.story-line {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(184, 205, 216, 0.16);
  background: rgba(12, 19, 24, 0.3);
  color: #eef4f7;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.story-line:hover {
  border-color: rgba(184, 205, 216, 0.34);
}
.story-line.is-active {
  border-color: rgba(238, 244, 247, 0.7);
  background: rgba(184, 205, 216, 0.1);
}
.story-line:disabled {
  opacity: 0.5;
  cursor: default;
}
.story-line-text {
  font-size: 0.9rem;
  line-height: 1.35;
}
.story-line-src {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pc-mist, #7a99ab);
}
.story-handoff {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 6px 0 10px;
}
.story-handoff-caption {
  margin: 0;
  font-size: 0.78rem;
  color: var(--pc-mist, #7a99ab);
  text-align: center;
}

/* Live captions — grow from deltas only (no unspoken teleprompter). */
.story-live-caption {
  flex: 1 1 auto;
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  text-align: center;
  min-height: 4.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18%);
}
.story-caption-eyebrow {
  margin: 0;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(184, 205, 216, 0.55);
}
.story-caption-prev {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
  color: rgba(184, 205, 216, 0.55);
}
.story-caption-current {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.35;
  color: #eef4f7;
  white-space: pre-wrap;
}
.story-caption-current.is-live::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  animation: story-caret 1.1s steps(1) infinite;
}
.story-live-caption.is-user-turn .story-caption-current {
  font-size: 1.15rem;
  color: rgba(184, 205, 216, 0.7);
}
.story-live-caption.is-user-turn .story-caption-current.is-live::after {
  display: none;
}
@keyframes story-caret {
  50% { opacity: 0; }
}

/* Voice status pill (connecting / speaking / listening / cap). */
.story-voice-status {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(184, 205, 216, 0.2);
  background: rgba(12, 19, 24, 0.45);
  color: #eef4f7;
}
.story-voice-status.hidden {
  display: none;
}
.story-voice-disc {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(184, 205, 216, 0.25);
  flex: none;
  position: relative;
}
.story-voice-status.is-connecting .story-voice-disc::after,
.story-voice-status.is-busy .story-voice-disc::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 2px solid transparent;
  border-top-color: #eef4f7;
  border-radius: 50%;
  animation: story-spin 0.8s linear infinite;
}
.story-voice-status.is-you-talking .story-voice-disc {
  background: #0f6b5c;
}
.story-voice-status.is-cap {
  border-color: #e5a000;
  background: rgba(243, 230, 207, 0.18);
  color: #f3e6cf;
}
.story-voice-copy {
  display: grid;
  gap: 1px;
  text-align: left;
}
.story-voice-title {
  font-size: 0.88rem;
  font-weight: 600;
}
.story-voice-sub {
  font-size: 0.72rem;
  opacity: 0.75;
}
@keyframes story-spin {
  to { transform: rotate(360deg); }
}

/* Or start from chips */
.story-start-from {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
}
.story-start-from-label {
  font-size: 0.78rem;
  color: var(--pc-mist, #7a99ab);
}
.story-start-chip {
  appearance: none;
  border: 1px solid rgba(184, 205, 216, 0.22);
  background: rgba(12, 19, 24, 0.28);
  color: #eef4f7;
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.story-start-chip.is-active {
  border-color: rgba(238, 244, 247, 0.7);
  background: rgba(184, 205, 216, 0.12);
}
.story-start-chip:disabled {
  opacity: 0.45;
  cursor: default;
}
.precoach-story-lib-panel.is-collapsed {
  display: none;
}

/* Review / save drawer as sheet */
.story-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(7, 7, 13, 0.32);
}
.story-drawer-scrim.hidden {
  display: none;
}
.precoach-story-end-shell #precoach-story-end-drawer.sb-save-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  max-height: min(88vh, 720px);
  overflow: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: #0c1318;
  border: 1px solid rgba(184, 205, 216, 0.16);
  border-bottom: none;
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.35);
  transform: translateY(0);
  transition: transform 280ms ease-out;
}
.precoach-story-end-shell #precoach-story-end-drawer.sb-save-drawer.hidden {
  display: block;
  pointer-events: none;
  transform: translateY(110%);
  visibility: hidden;
}
.story-drawer-header {
  margin-bottom: 12px;
}
.story-drawer-title {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 600;
}
.story-drawer-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--pc-mist, #7a99ab);
}
.story-drawer-field.is-pencil textarea,
.story-drawer-field.is-pencil input {
  border-style: dashed;
  font-style: italic;
}
.story-drawer-field.is-kept textarea,
.story-drawer-field.is-kept input {
  border-style: solid;
  font-style: normal;
}
.story-drawer-field-tools {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.story-drawer-keep,
.story-drawer-erase {
  appearance: none;
  border: 1px solid rgba(184, 205, 216, 0.28);
  background: transparent;
  color: #eef4f7;
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  min-height: 28px;
}
.story-drawer-erase {
  min-width: 44px;
  min-height: 44px;
  border: none;
  font-size: 1rem;
  color: rgba(184, 205, 216, 0.7);
}
.story-drawer-evidence {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed rgba(184, 205, 216, 0.3);
  border-radius: 12px;
}
.story-drawer-evidence.hidden {
  display: none;
}
.story-drawer-evidence.is-confirmed {
  border-style: solid;
}
.story-drawer-footer {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.story-drawer-not-now {
  appearance: none;
  border: none;
  background: none;
  color: rgba(184, 205, 216, 0.8);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px;
}
.story-drawer-back-lines {
  appearance: none;
  border: none;
  background: none;
  color: rgba(184, 205, 216, 0.55);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px;
}
@media (min-width: 900px) {
  .precoach-story-end-shell #precoach-story-end-drawer.sb-save-drawer {
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(560px, 92vw);
    max-height: none;
    border-radius: 0;
    border-bottom: 1px solid rgba(184, 205, 216, 0.16);
  }
  .precoach-story-end-shell #precoach-story-end-drawer.sb-save-drawer.hidden {
    transform: translateX(110%);
  }
}

/* Hide bottom nav for whole Story step */
body.is-story-step .bottom-nav,
body.is-story-step .bottom-nav.is-story-hidden {
  display: none !important;
}

.precoach-story-end-shell.is-drawer-open > :not(#precoach-story-end-drawer):not(#precoach-story-drawer-scrim) {
  pointer-events: none;
  user-select: none;
}
.story-live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
}
.story-live-bar.hidden {
  display: none;
}
.story-live-end {
  appearance: none;
  border: 1px solid rgba(184, 205, 216, 0.28);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.story-live-bar-meta {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pc-mist, #7a99ab);
}
.story-live-focus {
  margin: 0 0 10px;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--pc-mist, #7a99ab);
  text-align: center;
}
.precoach-story-end-shell.is-story-live .sb-mist-stage {
  min-height: 0;
  margin: 12px 0 0;
}
.precoach-story-end-shell.is-story-live .sb-mist {
  min-height: 88px;
  padding: 12px 12px 16px;
  justify-content: center;
}
.precoach-story-end-shell.is-story-live .kouli-voice-stage-inner {
  min-height: 48px;
}
.precoach-story-end-shell.is-story-live .story-live-caption {
  min-height: 5.5rem;
  margin: 4px auto 12px;
}
.precoach-story-end-shell.is-story-live .story-card {
  margin: 0 auto 8px;
}
.precoach-story-end-shell.is-story-ready #precoach-story-focus-banner {
  display: none !important;
}
.story-talk-caption {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--pc-mist, #7a99ab);
  text-align: center;
}
.story-drawer-draft-tag {
  font-style: italic;
  font-weight: 400;
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
}
.story-drawer-field.is-kept .story-drawer-draft-tag {
  display: none;
}
.story-drawer-tell-meta {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.7;
  font-size: 0.78rem;
}
.story-drawer-evidence-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}
.story-drawer-evidence-text {
  margin: 4px 0 0;
  font-size: 0.9rem;
}
.precoach-story-end-shell.is-story-live .story-start-from,
.precoach-story-end-shell.is-story-live .precoach-story-lib {
  display: none;
}
.precoach-story-end-shell.is-story-ready #precoach-story-handoff:not(.hidden) ~ .sb-mist-stage {
  margin-top: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .story-caption-current.is-live::after,
  .story-voice-status.is-connecting .story-voice-disc::after {
    animation: none;
  }
  .precoach-story-end-shell #precoach-story-end-drawer.sb-save-drawer {
    transition: none;
  }
}
