/* =========================================================
   WORDSTRIKE FLOW — PHASE 7A
   Micro-results, session continuity, momentum feedback.
   Public Flow only; no setup or blocking result surfaces.
   ========================================================= */

.flow-v4-session-strip {
  display: grid;
  grid-template-columns: 0.7fr 1.2fr 1.35fr 1.2fr 1fr;
  width: 100%;
  border-top: 1px solid var(--flow-line);
  border-bottom: 1px solid var(--flow-line);
}

.flow-v4-session-strip > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 12px 10px;
  border-right: 1px solid var(--flow-line);
}

.flow-v4-session-strip > div:first-child {
  padding-left: 0;
}

.flow-v4-session-strip > div:last-child {
  padding-right: 0;
  border-right: 0;
  text-align: right;
}

.flow-v4-session-strip span {
  overflow: hidden;
  color: var(--flow-ink-muted);
  font-family: var(--flow-data-face);
  font-size: 0.5rem;
  letter-spacing: 0.11em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.flow-v4-session-strip strong {
  overflow: hidden;
  color: var(--flow-ink-soft);
  font-family: var(--flow-data-face);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-v4-micro-result {
  position: fixed;
  z-index: 24;
  top: clamp(82px, 11vh, 118px);
  right: clamp(18px, 3vw, 42px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title score"
    "metrics score";
  gap: 6px 22px;
  width: min(calc(100vw - 36px), 430px);
  padding: 14px 16px;
  border: 1px solid var(--flow-line-strong);
  border-left: 2px solid var(--flow-signal);
  background: var(--flow-bg-deep);
  box-shadow: 0 14px 40px rgb(0 0 0 / 28%);
  color: var(--flow-ink);
  pointer-events: none;
  animation: flow-v4-result-in 180ms ease-out both;
}

.flow-v4-micro-result.is-leaving {
  animation: flow-v4-result-out 180ms ease-in both;
}

.flow-v4-micro-result.is-saved {
  border-left-color: var(--flow-ink-muted);
}

.flow-v4-micro-result-title {
  grid-area: title;
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.flow-v4-micro-result-title strong,
.flow-v4-micro-result-title span,
.flow-v4-micro-result-metrics,
.flow-v4-micro-result-score small {
  font-family: var(--flow-data-face);
  text-transform: uppercase;
}

.flow-v4-micro-result-title strong {
  overflow: hidden;
  color: var(--flow-signal);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-v4-micro-result.is-saved .flow-v4-micro-result-title strong {
  color: var(--flow-ink-soft);
}

.flow-v4-micro-result-title span {
  overflow: hidden;
  color: var(--flow-ink-muted);
  font-size: 0.51rem;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-v4-micro-result-score {
  grid-area: score;
  align-self: center;
  color: var(--flow-ink);
  font-family: var(--flow-reading-face);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.flow-v4-micro-result-score small {
  color: var(--flow-ink-muted);
  font-size: 0.48rem;
  letter-spacing: 0.1em;
}

.flow-v4-micro-result-metrics {
  grid-area: metrics;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: var(--flow-ink-muted);
  font-size: 0.52rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

@keyframes flow-v4-result-in {
  from {
    opacity: 0;
    transform: translateY(-7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flow-v4-result-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}

@media (max-width: 720px) {
  .flow-v4-session-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .flow-v4-session-strip > div {
    padding: 8px 6px 9px;
  }

  .flow-v4-session-strip > div:first-child {
    padding-left: 0;
  }

  .flow-v4-session-strip > div:last-child {
    padding-right: 0;
  }

  .flow-v4-session-strip span {
    font-size: 0.44rem;
    letter-spacing: 0.06em;
  }

  .flow-v4-session-strip strong {
    font-size: 0.62rem;
  }

  .flow-v4-micro-result {
    top: 74px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

@media (max-width: 440px) {
  .flow-v4-session-strip > div {
    padding-inline: 4px;
  }

  .flow-v4-session-strip span {
    font-size: 0.41rem;
    letter-spacing: 0.035em;
  }

  .flow-v4-session-strip strong {
    font-size: 0.56rem;
  }

  .flow-v4-micro-result {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "score"
      "metrics";
    gap: 5px;
    padding: 12px 13px;
  }

  .flow-v4-micro-result-score {
    font-size: 1.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-v4-micro-result,
  .flow-v4-micro-result.is-leaving {
    animation: none;
  }
}


/* =========================================================
   WORDSTRIKE FLOW — PHASE 7B
   Passive milestones, long-term progression, cosmetic titles.
   ========================================================= */

.flow-v4-progression-strip {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 2.3fr);
  gap: 18px;
  align-items: center;
  width: 100%;
  padding: 9px 0 10px;
  border-bottom: 1px solid var(--flow-line);
}

.flow-v4-progression-title,
.flow-v4-progression-track {
  min-width: 0;
}

.flow-v4-progression-title {
  display: grid;
  gap: 3px;
}

.flow-v4-progression-title span,
.flow-v4-progression-heading span,
.flow-v4-progression-track small,
.flow-v4-milestone-reward span,
.flow-v4-milestone-reward em {
  color: var(--flow-ink-muted);
  font-family: var(--flow-data-face);
  text-transform: uppercase;
}

.flow-v4-progression-title span,
.flow-v4-progression-heading span {
  font-size: 0.46rem;
  letter-spacing: 0.1em;
}

.flow-v4-progression-title strong {
  overflow: hidden;
  color: var(--flow-signal);
  font-family: var(--flow-data-face);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.flow-v4-progression-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.flow-v4-progression-heading strong {
  color: var(--flow-ink-soft);
  font-family: var(--flow-data-face);
  font-size: 0.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.065em;
}

.flow-v4-progression-bar {
  position: relative;
  overflow: hidden;
  height: 3px;
  background: color-mix(in srgb, var(--flow-line) 72%, transparent);
}

.flow-v4-progression-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 2px;
  background: var(--flow-signal);
  transition: width 220ms ease-out;
}

.flow-v4-progression-track small {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: 0.45rem;
  letter-spacing: 0.055em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-v4-micro-result.has-reward {
  grid-template-areas:
    "title score"
    "metrics score"
    "reward reward";
}

.flow-v4-milestone-reward {
  grid-area: reward;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid var(--flow-line);
}

.flow-v4-milestone-reward span,
.flow-v4-milestone-reward em {
  font-size: 0.47rem;
  font-style: normal;
  letter-spacing: 0.075em;
  white-space: nowrap;
}

.flow-v4-milestone-reward strong {
  overflow: hidden;
  color: var(--flow-signal);
  font-family: var(--flow-data-face);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.flow-v4-milestone-reward em {
  color: var(--flow-ink-soft);
}

@media (max-width: 720px) {
  .flow-v4-progression-strip {
    grid-template-columns: minmax(92px, 0.75fr) minmax(0, 2.25fr);
    gap: 10px;
    padding-block: 8px 9px;
  }

  .flow-v4-progression-title strong {
    font-size: 0.58rem;
  }

  .flow-v4-progression-track small {
    font-size: 0.42rem;
  }
}

@media (max-width: 440px) {
  .flow-v4-progression-strip {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .flow-v4-progression-title {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
  }

  .flow-v4-micro-result.has-reward {
    grid-template-areas:
      "title"
      "score"
      "metrics"
      "reward";
  }

  .flow-v4-milestone-reward {
    grid-template-columns: 1fr auto;
  }

  .flow-v4-milestone-reward span {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-v4-progression-bar > span {
    transition: none;
  }
}


/* =========================================================
   WORDSTRIKE FLOW — PHASE 7C
   HUD hierarchy, identity, source context, progression polish.
   ========================================================= */

.flow-v5-run-header {
  display: grid !important;
  grid-template-columns: auto minmax(118px, 0.52fr) minmax(0, 1.4fr) auto;
  align-items: center !important;
  gap: clamp(12px, 2vw, 22px) !important;
  width: 100%;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--flow-line);
}

.flow-v5-run-header > div {
  min-width: 0;
  text-align: left;
}

.flow-v5-brand {
  display: grid !important;
  gap: 3px !important;
}

.flow-v5-brand strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--flow-ink);
  font-family: var(--flow-data-face);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.18em;
  line-height: 1;
}

.flow-v5-brand strong i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--flow-signal);
  box-shadow: 0 0 0 3px var(--flow-signal-faint);
}

.flow-v5-brand span,
.flow-v5-source span,
.flow-v5-source small,
.flow-game-v2-hud[data-flow-hud-v5="true"] small {
  color: var(--flow-ink-muted);
  font-family: var(--flow-data-face);
  text-transform: uppercase;
}

.flow-v5-brand span {
  font-size: 0.45rem;
  letter-spacing: 0.09em;
}

.flow-v5-source {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "position title"
    "position meta";
  column-gap: 10px;
  row-gap: 2px !important;
  align-items: center;
  min-width: 0;
}

.flow-v5-source > span {
  grid-area: position;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 58px;
  padding-right: 10px;
  border-right: 1px solid var(--flow-line);
  font-size: 0.45rem;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.flow-v5-source > strong {
  grid-area: title;
  overflow: hidden;
  color: var(--flow-ink-soft);
  font-family: var(--flow-reading-face);
  font-size: 0.78rem;
  font-weight: 560;
  letter-spacing: 0.005em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-v5-source > small {
  grid-area: meta;
  overflow: hidden;
  font-size: 0.43rem;
  letter-spacing: 0.065em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-v5-run-tools {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 12px;
  align-items: center;
}

.flow-v5-run-tools label {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px;
}

.flow-v5-run-tools label > span {
  align-self: center;
  color: var(--flow-ink-muted);
  font-size: 0.46rem;
  letter-spacing: 0.08em;
}

.flow-v5-run-tools .flow-v3-tab-hint {
  grid-column: 1 / -1;
  justify-self: end;
  font-size: 0.45rem;
  letter-spacing: 0.075em;
}

.flow-game-v2-hud[data-flow-hud-v5="true"] {
  grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--flow-line-strong);
  border-left: 2px solid var(--flow-signal);
  background:
    linear-gradient(90deg, var(--flow-signal-faint), transparent 26%),
    var(--flow-bg-deep);
}

.flow-game-v2-hud[data-flow-hud-v5="true"] > div {
  align-content: center;
  min-height: 76px;
  padding: 11px 15px 10px;
  border-right: 1px solid var(--flow-line);
  text-align: left;
}

.flow-game-v2-hud[data-flow-hud-v5="true"] > div:first-child,
.flow-game-v2-hud[data-flow-hud-v5="true"] > div:last-child {
  padding-inline: 15px;
}

.flow-game-v2-hud[data-flow-hud-v5="true"] > div:last-child {
  border-right: 0;
  text-align: right;
}

.flow-game-v2-hud[data-flow-hud-v5="true"] > div:nth-child(2),
.flow-game-v2-hud[data-flow-hud-v5="true"] > div:nth-child(3) {
  text-align: center;
}

.flow-game-v2-hud[data-flow-hud-v5="true"] span {
  font-size: 0.49rem;
  letter-spacing: 0.11em;
}

.flow-game-v2-hud[data-flow-hud-v5="true"] strong {
  font-size: clamp(1.22rem, 2.5vw, 1.72rem);
  font-weight: 540;
}

.flow-game-v2-hud[data-flow-hud-v5="true"] .flow-v5-hud-score strong {
  color: var(--flow-signal);
  font-size: clamp(1.62rem, 3vw, 2.22rem);
}

.flow-game-v2-hud[data-flow-hud-v5="true"] small {
  margin-top: 1px;
  font-size: 0.39rem;
  letter-spacing: 0.085em;
}

.flow-v5-session-meta {
  overflow: hidden;
  border: 1px solid var(--flow-line);
  background: color-mix(in srgb, var(--flow-bg-deep) 94%, var(--flow-signal) 6%);
}

.flow-v5-session-meta .flow-v4-session-strip {
  border-top: 0;
  border-bottom-color: var(--flow-line);
}

.flow-v5-session-meta .flow-v4-session-strip > div:first-child {
  padding-left: 12px;
}

.flow-v5-session-meta .flow-v4-session-strip > div:last-child {
  padding-right: 12px;
}

.flow-v5-session-meta .flow-v4-progression-strip {
  padding: 8px 12px 9px;
  border-bottom: 0;
}

.flow-v5-session-meta .flow-v4-progression-title strong {
  font-size: 0.62rem;
}

.flow-v5-session-meta .flow-v4-progression-bar {
  height: 2px;
}

.flow-v5-session-meta .flow-v4-progression-track small {
  margin-top: 4px;
}

.flow-v4-micro-result.has-reward {
  border-left-width: 3px;
}

@media (max-width: 840px) {
  .flow-v5-run-header {
    grid-template-columns: auto minmax(104px, 0.55fr) minmax(0, 1fr);
  }

  .flow-v5-run-tools {
    grid-column: 1 / -1;
    grid-template-columns: auto 1fr;
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid var(--flow-line);
  }

  .flow-v5-run-tools .flow-v3-tab-hint {
    grid-column: auto;
    justify-self: end;
    align-self: center;
  }
}

@media (max-width: 620px) {
  .flow-v5-run-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 12px !important;
  }

  .flow-v5-brand {
    align-self: center;
  }

  .flow-v5-source {
    grid-column: 1 / -1;
    order: 4;
    padding-top: 8px;
    border-top: 1px solid var(--flow-line);
  }

  .flow-v5-run-tools {
    grid-column: 1 / -1;
    order: 5;
  }

  .flow-game-v2-hud[data-flow-hud-v5="true"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-game-v2-hud[data-flow-hud-v5="true"] > div {
    min-height: 66px;
    border-bottom: 1px solid var(--flow-line);
  }

  .flow-game-v2-hud[data-flow-hud-v5="true"] > div:nth-child(2) {
    border-right: 0;
    text-align: right;
  }

  .flow-game-v2-hud[data-flow-hud-v5="true"] > div:nth-child(3) {
    border-bottom: 0;
    text-align: left;
  }

  .flow-game-v2-hud[data-flow-hud-v5="true"] > div:last-child {
    border-bottom: 0;
  }

  .flow-v5-session-meta .flow-v4-session-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flow-v5-session-meta .flow-v4-session-strip > div {
    border-bottom: 1px solid var(--flow-line);
  }

  .flow-v5-session-meta .flow-v4-session-strip > div:nth-child(3) {
    border-right: 0;
  }

  .flow-v5-session-meta .flow-v4-session-strip > div:nth-child(4),
  .flow-v5-session-meta .flow-v4-session-strip > div:nth-child(5) {
    border-bottom: 0;
  }

  .flow-v5-session-meta .flow-v4-session-strip > div:nth-child(4) {
    grid-column: 1 / span 2;
  }

  .flow-v5-session-meta .flow-v4-session-strip > div:nth-child(5) {
    grid-column: 3;
  }
}

@media (max-width: 440px) {
  .flow-v5-run-header .screen-back-button {
    min-height: 36px;
  }

  .flow-v5-brand strong {
    font-size: 0.7rem;
  }

  .flow-v5-source > span {
    min-width: 52px;
    font-size: 0.41rem;
  }

  .flow-v5-source > strong {
    font-size: 0.7rem;
  }

  .flow-v5-source > small {
    font-size: 0.39rem;
  }

  .flow-v5-run-tools {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .flow-v5-run-tools label {
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .flow-v5-run-tools select {
    min-width: 0;
    max-width: 128px;
  }

  .flow-v5-run-tools .flow-v3-tab-hint {
    font-size: 0.41rem;
  }

  .flow-game-v2-hud[data-flow-hud-v5="true"] > div {
    padding: 9px 10px;
  }

  .flow-v5-session-meta .flow-v4-progression-strip {
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-v5-brand strong i {
    box-shadow: none;
  }
}


/* =========================================================
   FLOW V3: text-first active run
   Keep the run surface focused on typing. Progression/session
   history remains recorded but does not occupy the live viewport.
   ========================================================= */

.flow-run-screen[data-flow-stream-v3="true"] .flow-v5-session-meta {
  display: none;
}

.flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] {
  position: static;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: visible;
  border: 0;
  border-top: 1px solid var(--flow-line);
  border-bottom: 1px solid var(--flow-line);
  border-left: 0;
  background: transparent;
}

.flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] > div {
  align-content: center;
  min-height: 42px;
  padding: 6px 10px 7px;
  border-right: 1px solid var(--flow-line);
  border-bottom: 0;
}

.flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] > div:first-child {
  padding-left: 0;
}

.flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] span {
  font-size: 0.42rem;
  letter-spacing: 0.09em;
}

.flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] strong,
.flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] .flow-v5-hud-score strong {
  font-family: var(--flow-data-face);
  font-size: clamp(0.88rem, 1.7vw, 1.05rem);
  font-weight: 620;
  line-height: 1.05;
}

.flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] small {
  display: none;
}

.flow-run-screen[data-flow-stream-v3="true"] .flow-v5-run-header {
  padding-bottom: 8px;
}

@media (max-width: 620px) {
  .flow-run-screen[data-flow-stream-v3="true"] .flow-v5-brand span,
  .flow-run-screen[data-flow-stream-v3="true"] .flow-v5-source small {
    display: none;
  }

  .flow-run-screen[data-flow-stream-v3="true"] .flow-v5-run-header {
    gap: 7px 10px !important;
    padding-bottom: 7px;
  }

  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] > div {
    min-height: 38px;
    padding: 5px 5px 6px;
    border-bottom: 0;
    text-align: left;
  }

  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] > div:nth-child(2),
  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] > div:nth-child(3),
  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] > div:last-child {
    text-align: center;
  }

  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] > div:last-child {
    text-align: right;
  }

  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] span {
    font-size: 0.36rem;
    letter-spacing: 0.055em;
  }

  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] strong,
  .flow-run-screen[data-flow-stream-v3="true"] .flow-game-v2-hud[data-flow-hud-v5="true"] .flow-v5-hud-score strong {
    font-size: clamp(0.76rem, 3.2vw, 0.92rem);
  }
}
