.flow-phase1-screen {
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

.flow-phase1-shell,
.flow-run-shell {
  width: min(100% - 32px, 980px);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 72px) 0;
}

.flow-phase1-shell {
  display: grid;
  gap: 24px;
  align-content: center;
  min-height: 100dvh;
}

.flow-phase1-kicker {
  font: 700 0.78rem/1.2 var(--font-ui, inherit);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.66;
}

.flow-phase1-shell h1 {
  margin: 0;
  font-size: clamp(3rem, 9vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.055em;
}

.flow-phase1-lead,
.flow-phase1-note,
.flow-run-copy > p {
  margin: 0;
  max-width: 760px;
  line-height: 1.65;
}

.flow-phase1-lead {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.flow-phase1-note,
.flow-run-copy > p {
  opacity: 0.68;
}

.flow-phase1-brief,
.flow-run-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.flow-phase1-brief span,
.flow-run-diagnostics span {
  display: inline-flex;
  gap: 0.45em;
  align-items: baseline;
}

.flow-phase1-start {
  justify-self: start;
  min-width: 180px;
}

.flow-run-shell {
  display: grid;
  gap: clamp(28px, 5vw, 56px);
}

.flow-run-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.flow-run-header > div {
  display: grid;
  gap: 4px;
  text-align: right;
}

.flow-run-header span,
.flow-gameplay-hud span,
.flow-final-score span,
.flow-analysis-heading span {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.62;
}

.flow-run-header strong,
.flow-gameplay-hud strong,
.flow-final-score strong,
.flow-natural-analysis strong {
  font-variant-numeric: tabular-nums;
}

.flow-gameplay-hud {
  display: grid;
  grid-template-columns: minmax(100px, auto) minmax(220px, 1fr) minmax(110px, auto) minmax(110px, auto);
  gap: 20px;
  align-items: end;
  padding: 16px 0;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.flow-score-block,
.flow-momentum-block,
.flow-meter-block,
.flow-cadence-block {
  display: grid;
  gap: 8px;
}

.flow-score-block strong,
.flow-momentum-block strong,
.flow-cadence-block strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.flow-momentum-block,
.flow-cadence-block {
  text-align: right;
}

.flow-cadence-block small {
  font: 600 0.7rem/1.2 var(--font-ui, inherit);
  opacity: 0.62;
}

.flow-meter-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.flow-meter {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 1px solid currentColor;
}

.flow-meter > span {
  display: block;
  height: 100%;
  background: currentColor;
  transition: width 110ms ease;
}

.flow-run-copy {
  display: grid;
  gap: 24px;
}

.flow-passages {
  width: 100%;
}

.flow-passage {
  font-family: var(--font-body, ui-monospace, "SFMono-Regular", Consolas, monospace);
  font-size: clamp(1.28rem, 2.6vw, 2rem);
  line-height: 1.75;
  letter-spacing: 0.012em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: none;
}

.flow-char {
  position: relative;
  transition: opacity 100ms ease, background-color 100ms ease, color 100ms ease;
}

.flow-char--pending {
  opacity: 0.38;
}

.flow-char--correct {
  opacity: 1;
}

.flow-char--incorrect {
  opacity: 1;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
}

.flow-char--current::after {
  content: "";
  position: absolute;
  left: -0.08em;
  top: 0.05em;
  width: 2px;
  height: 1.25em;
  background: currentColor;
  animation: flow-caret-blink 1s steps(1, end) infinite;
}

.flow-input-capture {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.flow-complete-shell {
  max-width: 860px;
}

.flow-final-score {
  display: grid;
  gap: 4px;
  padding: 18px 0;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.flow-final-score strong {
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  line-height: 0.95;
}

.flow-result-metrics {
  row-gap: 16px;
}

.flow-natural-analysis {
  display: grid;
  gap: 14px;
  padding: 18px 0;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.flow-analysis-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
}

.flow-natural-analysis ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.flow-natural-analysis li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: baseline;
}

.flow-natural-analysis li small,
.flow-natural-analysis p {
  opacity: 0.62;
}

.flow-natural-analysis p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
}

.flow-score-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font: 600 0.82rem/1.5 var(--font-ui, inherit);
  opacity: 0.72;
}

.flow-score-breakdown span:not(:last-child)::after {
  content: " ·";
}

.flow-complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@keyframes flow-caret-blink {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .flow-char,
  .flow-meter > span {
    transition: none;
  }
  .flow-char--current::after {
    animation: none;
  }
}

@media (max-width: 640px) {
  .flow-phase1-shell,
  .flow-run-shell {
    width: min(100% - 24px, 980px);
    padding-top: 20px;
    padding-bottom: 32px;
  }
  .flow-run-header {
    align-items: flex-start;
  }
  .flow-gameplay-hud {
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
  }
  .flow-meter-block {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .flow-momentum-block,
  .flow-cadence-block {
    text-align: right;
  }
  .flow-cadence-block {
    grid-column: 2;
    grid-row: 1;
  }
  .flow-momentum-block {
    grid-column: 1;
    grid-row: 3;
    text-align: left;
  }
  .flow-cadence-block {
    grid-row: 3;
  }
  .flow-natural-analysis li {
    grid-template-columns: 1fr auto;
  }
  .flow-natural-analysis li small {
    grid-column: 1 / -1;
  }
  .flow-passage {
    font-size: clamp(1.18rem, 5.4vw, 1.48rem);
    line-height: 1.68;
  }
}
