/* ==========================================================================
   Eternal Flow: Jim's Welcome
   ========================================================================== */

.screen-welcome .main { padding: var(--topbar-h) 0 0; }

.flow {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 2rem 1.5rem;
  overflow: hidden;
  background: var(--surface-lowest);
}

/* CRT background: dithered underwater city, faded into the abyss. */
.flow__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.flow__city {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.4;
  mix-blend-mode: screen;
  image-rendering: pixelated;
}
.flow__bg::before,
.flow__bg::after { content: ""; position: absolute; inset: 0; }
.flow__bg::before { background: linear-gradient(to top, var(--bg) 0%, rgb(18 18 29 / 0.6) 35%, transparent 70%); }
.flow__bg::after {
  background-image: radial-gradient(rgb(255 255 255 / 0.07) 1px, transparent 1px);
  background-size: 4px 4px;
}

/* ---- Title --------------------------------------------------------------- */
.flow__head { text-align: center; }
.flow__title {
  display: inline-block;
  padding-bottom: 0.5rem;
  color: var(--cyan);
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.06em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 rgb(0 0 0 / 0.8);
  background: linear-gradient(var(--peach), var(--peach)) bottom / 100% 4px no-repeat;
  filter: drop-shadow(4px 4px 0 #000);
}
.flow__kicker {
  margin-top: 0.875rem;
  color: var(--peach);
  font: 700 0.6875rem var(--font-head);
  letter-spacing: 0.3em;
}

/* ---- Stage: cast + dialogue ------------------------------------------------ */
.flow-stage {
  flex: 1;
  width: 100%;
  max-width: 64rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.flow-cast {
  flex: 1;
  min-height: 15rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 3rem 2rem;
}
.flow-cast__actor { position: relative; margin: 0; }
.flow-cast__actor img {
  image-rendering: pixelated;
  object-fit: cover;
  transition: filter 0.2s steps(3), transform 0.2s steps(3);
}
.flow-cast__actor--jim { margin-top: 2.5rem; }
.flow-cast__actor--jim img {
  width: 12rem;
  height: 12rem;
  border-right: 8px solid rgb(0 220 229 / 0.3);
}
.flow-cast__tag {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.75rem;
  padding: 0.25rem 1rem;
  border: 2px solid var(--cyan);
  background: var(--surface-highest);
  color: var(--cyan);
  font: 700 1rem var(--font-head);
  letter-spacing: -0.03em;
}
.flow-cast__actor--krill { margin-top: 5rem; }
.flow-cast__actor--krill img {
  width: 8rem;
  height: 8rem;
  opacity: 0.8;
  filter: brightness(0.5) contrast(1.5);
}
.flow-cast__actor.is-speaking img { transform: translateY(-6px); }
.flow-cast__actor--jim.is-speaking img { filter: drop-shadow(0 0 14px rgb(0 220 229 / 0.55)); }
.flow-cast__actor--krill.is-speaking img { opacity: 1; filter: drop-shadow(0 0 14px rgb(213 186 255 / 0.55)); }

/* ---- Dialogue box ---------------------------------------------------------- */
.flow-dialog {
  display: flex;
  background: var(--surface-high);
  border: 6px solid var(--surface-bright);
  box-shadow:
    12px 12px 0 #000,
    inset 4px 4px 0 rgb(0 0 0 / 0.5),
    inset -4px -4px 0 rgb(255 255 255 / 0.1);
}
.flow-dialog__portrait {
  flex: 0 0 25%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  border-right: 6px solid var(--surface-bright);
  background-color: var(--surface-lowest);
  background-image: radial-gradient(var(--surface-container) 2px, transparent 2px);
  background-size: 8px 8px;
  text-align: center;
}
.flow-dialog__frame {
  position: relative;
  width: 100%;
  max-width: 12.5rem;
  padding: 4px;
  border: 4px solid var(--accent);
  background: #000;
}
.flow-dialog__frame img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  image-rendering: pixelated;
}
.flow-dialog__lvl {
  position: absolute;
  right: -0.75rem;
  bottom: -0.75rem;
  padding: 0 0.5rem;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 0.75rem/1.5 var(--font-head);
}
.flow-dialog__name {
  margin-top: 1.25rem;
  color: var(--accent);
  font: 700 1.25rem/1.1 var(--font-head);
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.flow-dialog__title {
  margin-top: 0.375rem;
  color: var(--cyan);
  font: 700 0.625rem var(--font-head);
  letter-spacing: 0.2em;
}

.flow-dialog__body {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  min-height: 16rem;
  padding: 2.5rem;
}
.flow-dialog__pager {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 4px;
  padding: 0;
  list-style: none;
}
.flow-dialog__pager li { width: 8px; height: 8px; background: rgb(0 220 229 / 0.2); }
.flow-dialog__pager li.is-past { background: rgb(0 220 229 / 0.5); }
.flow-dialog__pager li.is-current { background: var(--cyan); }

.flow-dialog__text {
  margin: 0;
  color: var(--on-surface);
  font: italic 700 clamp(1.375rem, 2.6vw, 2.125rem)/1.18 var(--font-head);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 rgb(0 0 0 / 0.8);
  animation: flow-type 0.35s steps(6) both;
}

.flow-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}
.flow-dialog__actions form { display: contents; }

.flow-respect {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-right: auto;
  color: var(--peach);
  font: 700 0.75rem var(--font-head);
  letter-spacing: 0.2em;
}
.flow-respect .ms { font-size: 1.125rem; color: var(--orange); }
.flow-respect strong { color: var(--on-surface); font-size: 1rem; letter-spacing: 0.05em; animation: bump 0.4s steps(3); }

/* Arcade buttons with a chunky bottom lip. */
.flow-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  border: 0;
  border-bottom: 6px solid var(--lip);
  background: var(--face);
  color: var(--ink);
  box-shadow: 4px 4px 0 rgb(0 0 0 / 0.5);
  font: 700 1.125rem/1.1 var(--font-head);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.flow-btn:active { transform: translateY(4px); border-bottom-width: 2px; margin-bottom: 4px; }
.flow-btn--respect { --face: var(--cyan); --ink: var(--on-cyan); --lip: #004f53; }
.flow-btn--respect:hover { --face: var(--peach); --ink: var(--on-orange); --lip: #7f2b00; }
.flow-btn--continue { --face: var(--surface-highest); --ink: var(--cyan); --lip: #000; }
.flow-btn--continue:hover { --face: var(--cyan-deep); }
.flow-btn--enter { --face: var(--orange); --ink: #000; --lip: var(--on-orange); }
.flow-btn--enter:hover { --face: var(--peach); }
.flow-btn__arrow { animation: pulse 1.2s steps(2) infinite; }

/* ---- Status strip ---------------------------------------------------------- */
.flow__status {
  width: 100%;
  max-width: 64rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-top: 1.5rem;
  color: rgb(0 220 229 / 0.6);
  font: 700 0.75rem var(--font-head);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.flow__signals { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.flow__signals li { display: inline-flex; align-items: center; gap: 0.375rem; }
.flow__dot { width: 8px; height: 8px; border-radius: 50%; }
.flow__dot--cyan { background: var(--cyan); animation: pulse 2s steps(2) infinite; }
.flow__dot--peach { background: var(--peach); }
.flow__disc {
  padding: 0.25rem 1rem;
  border: 1px solid rgb(0 220 229 / 0.4);
  background: rgb(0 220 229 / 0.2);
}

@keyframes flow-type {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  .flow { padding: 1.5rem 1rem 1.25rem; }
  .flow-cast { padding: 2.5rem 0.5rem 1.5rem; min-height: 0; }
  .flow-cast__actor--jim { margin-top: 1rem; }
  .flow-cast__actor--jim img { width: 8rem; height: 8rem; }
  .flow-cast__actor--krill { margin-top: 2.5rem; }
  .flow-cast__actor--krill img { width: 5.5rem; height: 5.5rem; }
  .flow-dialog { flex-direction: column; }
  .flow-dialog__portrait {
    flex-direction: row;
    gap: 1rem;
    justify-content: flex-start;
    border-right: 0;
    border-bottom: 6px solid var(--surface-bright);
    text-align: left;
  }
  .flow-dialog__frame { width: 5.5rem; flex-shrink: 0; }
  .flow-dialog__who { min-width: 0; }
  .flow-dialog__name { margin-top: 0; }
  .flow-dialog__body { padding: 1.75rem 1.25rem 1.25rem; min-height: 0; gap: 1.5rem; }
}
@media (max-width: 520px) {
  .flow-dialog__actions { justify-content: stretch; }
  .flow-respect { width: 100%; }
  .flow-btn { flex: 1 1 100%; justify-content: center; padding: 0.875rem 1rem; font-size: 1rem; }
  .flow__status { justify-content: center; text-align: center; }
}
