/* Wave 1 native viewport presentation. The game is no longer a scaled canvas. */

.shell-bar__identity {
  overflow: visible;
}

.play-workspace {
  width: 100%;
  height: 100%;
  min-height: 0;
}

#app {
  width: 100%;
  max-width: 960px;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
}

.ink-stage {
  position: relative;
  inset: auto;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  transform: none;
}

.ink-screen {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: 28px minmax(0, 1fr) 60px;
  background: var(--board);
}

.ink-stage .screen-content {
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.hud-content {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) 110px;
}

.year-strip {
  position: relative;
  z-index: 20;
  display: flex;
  width: 100%;
  height: 28px;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 1px solid var(--soft-line);
  background: var(--board);
  color: var(--muted);
  font-family: var(--mono);
}

.ink-year {
  order: -1;
  margin: 0;
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.2;
  white-space: nowrap;
}

.year-strip__actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.ink-replay {
  min-width: 0;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
}

.ink-replay:not(:disabled) {
  color: var(--ink);
}

.ink-replay:disabled {
  cursor: default;
  opacity: 0.35;
}

/* Market board */

.board-section {
  position: relative;
  display: flex;
  width: 100%;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.market-board {
  display: grid;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding: 0 12px 0 6px;
  border: 0;
  grid-template-rows: 26px minmax(0, 1fr) 44px;
}

.board-legend {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 26px;
  min-height: 26px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 0 calc(var(--plot-rail) + 4px);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.board-legend__copy {
  display: inline-flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}

.board-legend__glyph {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: conic-gradient(
    var(--volt) 0 33.333%,
    var(--kiln) 33.333% 66.666%,
    var(--para) 66.666% 100%
  );
}

.board-legend__label,
.price-rail .price-axis-title,
.iq-axis .iq-axis__label {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.rate-path {
  display: inline-flex;
  min-width: 0;
  height: 14px;
  min-height: 14px;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  overflow: hidden;
}

.rate-path svg {
  display: block;
  width: clamp(32px, 12vw, 72px);
  height: 14px;
  min-width: 24px;
  flex: 1 1 72px;
  overflow: visible;
}

.rate-path polyline {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
}

.rate-path circle {
  fill: var(--muted);
}

.rate-path b {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

@media (max-width: 359px) {
  .rate-path svg {
    display: none;
  }

  /* The shortest reveal viewport needs three extra pixels per market row
     once every donut is inscribed. Recover that space from the lab cards
     while keeping their identity and all three operating metrics visible. */
  .reveal-screen .hud-content {
    grid-template-rows: minmax(0, 1fr) 86px;
  }

  .reveal-screen .fleet-section {
    height: 86px;
    min-height: 86px;
    flex-basis: 86px;
    padding: 4px 6px 5px;
  }

  .reveal-screen .fleet-grid,
  .reveal-screen .fleet-card {
    height: 76px;
  }

  .reveal-screen .fleet-card {
    padding: 4px;
    grid-template-rows: 28px minmax(0, 1fr);
  }
}

@media (max-width: 375px) and (max-height: 600px) {
  .task-cell:has(.token-number) .task-label,
  .task-cell:has(.token-number) .task-state {
    font-size: 8px;
    line-height: 1.4;
  }

  .task-cell:has(.token-number) .task-label {
    top: 0;
  }

  .task-cell:has(.token-number) .task-state {
    bottom: 0;
  }
}

.board-plot {
  position: relative;
  display: grid;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  grid-template-columns: var(--plot-rail) minmax(0, 1fr);
}

.price-rail {
  position: relative;
  display: grid;
  width: var(--plot-rail);
  height: 100%;
  min-height: 0;
  grid-column: 1;
  grid-template-rows: repeat(6, minmax(0, 1fr));
}

.price-rail > span:not(.price-axis-title) {
  display: flex;
  min-height: 0;
  align-items: center;
  justify-content: flex-end;
  padding-right: 5px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.price-axis-title {
  position: absolute;
  z-index: 2;
  top: -21px;
  right: auto;
  bottom: auto;
  left: 0;
  display: block;
  width: var(--plot-rail);
  height: auto;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  transform: none;
}

.market-grid {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  grid-column: 2;
  grid-template-rows: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    rgb(138 143 152 / 0%),
    rgb(138 143 152 / 5.5%)
  );
}

.market-row {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.board-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
  background: transparent;
  color: var(--ink);
}

button.board-cell {
  padding: 0;
  cursor: pointer;
}

.task-label,
.task-state {
  position: absolute;
  z-index: 3;
  right: 1px;
  left: 1px;
  max-width: none;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: -0.05em;
  line-height: 1.4;
  text-align: left;
  text-overflow: clip;
  white-space: nowrap;
}

.task-label {
  top: 3px;
}

.task-state {
  bottom: 3px;
  font-size: 10px;
  letter-spacing: -0.025em;
}

.task-cell.is-locked .task-label {
  top: 50%;
  color: var(--muted-deep);
  text-align: center;
  transform: translateY(-50%);
}

.task-cell.is-pending .task-label {
  color: var(--ink);
}

.task-cell.is-pending .task-state {
  color: var(--muted);
}

.work-token {
  position: relative;
  z-index: 2;
  top: auto;
  left: auto;
  display: grid;
  width: clamp(15px, 4.8vw, 22px);
  height: clamp(15px, 4.8vw, 22px);
  place-items: center;
  border-radius: 50%;
  transform: none;
}

.work-token--xs {
  width: 25px;
  height: 25px;
}

.work-token--sm {
  width: 25px;
  height: 25px;
}

.work-token--md {
  width: 26px;
  height: 26px;
}

.work-token--lg {
  width: 27px;
  height: 27px;
}

.work-token--xl {
  width: 28px;
  height: 28px;
}

.work-token--xxl {
  width: 30px;
  height: 30px;
}

.work-token--question {
  font: 700 10px/1 var(--mono);
}

.going-rate-line {
  position: absolute;
  z-index: 10;
  right: 0;
  left: 0;
  height: 0;
  border-top: 1px dashed rgb(206 255 0 / 58%);
  pointer-events: none;
}

.going-rate-line::before {
  display: none;
}

.going-rate-line [data-going-rate-rule] {
  position: absolute;
  right: 3px;
  top: 0;
  display: inline-flex;
  min-height: 18px;
  align-items: center;
  padding: 0 4px;
  background: var(--board);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-50%);
  white-space: nowrap;
}

.iq-axis {
  position: relative;
  display: grid;
  width: 100%;
  height: 44px;
  min-height: 44px;
  margin: 0;
  grid-template-columns: var(--plot-rail) minmax(0, 1fr);
  grid-template-rows: 26px 18px;
}

.iq-axis__label {
  position: static;
  display: flex;
  width: auto;
  grid-column: 1;
  grid-row: 2;
  align-items: center;
  justify-content: flex-end;
  padding-right: 5px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.iq-track {
  position: relative;
  width: auto;
  height: 44px;
  min-width: 0;
  grid-column: 2;
  grid-row: 1 / 3;
  border-top: 1px solid var(--soft-line);
}

.iq-marker {
  --iq-nudge: 0px;

  position: absolute;
  z-index: 2;
  top: -2px;
  left: var(--iq-position, 0%);
  display: inline-flex;
  line-height: 0;
  transform: translateX(calc(-50% + var(--iq-nudge)));
}

.iq-marker--player {
  --iq-nudge: 0px;

  z-index: 3;
  color: var(--volt);
}

.iq-marker--rivalA {
  --iq-nudge: 0px;
  color: var(--kiln);
}

.iq-marker--rivalB {
  --iq-nudge: 0px;
  color: var(--para);
}

.iq-ticks {
  position: absolute;
  top: 26px;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
}

.iq-ticks span {
  position: absolute;
  bottom: 1px;
  left: var(--iq-position, 0%);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
}

.iq-ticks span:first-child {
  transform: none;
}

.intro-lab-marker,
.intro-frontier {
  left: var(--iq-position, 0%);
}

/* The clear-beat explainer is a ticker segment now (see .payback-ticker
   above) — it must never render as an in-flow box that reflows the plot. */

/* Three compact labs */

.fleet-section {
  display: block;
  width: 100%;
  height: 110px;
  min-height: 110px;
  flex: 0 0 110px;
  margin: 0;
  padding: 5px 6px 6px;
  border-top: 1px solid var(--line);
}

.fleet-grid {
  display: grid;
  width: 100%;
  height: 99px;
  min-height: 0;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}

.fleet-card {
  display: grid;
  width: 100%;
  height: 99px;
  min-width: 0;
  min-height: 0;
  padding: 6px 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 38px minmax(0, 1fr);
  text-align: left;
}

.fleet-card.is-player {
  padding-left: 4px;
  border-color: var(--line);
  border-left: 3px solid var(--volt);
}

.lab-card__identity {
  display: grid;
  min-width: 0;
  grid-template-columns: 20px minmax(0, 1fr);
  grid-template-rows: 1fr;
  gap: 4px;
}

.fleet-marker {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  grid-column: 1;
  grid-row: 1;
  line-height: 0;
}

.fleet-marker svg {
  width: 20px;
  height: 20px;
}

.lab-card__name {
  display: flex;
  min-width: 0;
  align-self: start;
  flex-direction: column;
  grid-column: 2;
  grid-row: 1;
  line-height: 1.15;
}

.lab-card__name strong {
  overflow: visible;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: normal;
}

.lab-card__name small {
  display: none;
}

.you-mark {
  margin-left: 2px;
  color: var(--volt);
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.lab-card__metrics {
  display: grid;
  min-width: 0;
  min-height: 0;
  align-items: start;
  gap: 2px;
  grid-column: 1;
  grid-row: 2;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.65fr) minmax(0, 0.85fr);
  font-variant-numeric: tabular-nums;
}

.lab-gold,
.lab-iq,
.lab-fleet {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-style: normal;
  line-height: 1.15;
}

.lab-gold small,
.lab-iq small,
.lab-fleet small {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.lab-gold b,
.lab-iq b,
.lab-fleet b {
  color: var(--ink);
  font-size: clamp(10px, 3.3vw, 14px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  white-space: nowrap;
}

.lab-gold i {
  max-width: 100%;
  overflow: visible;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 7px;
  font-style: normal;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab-gold i.is-player-delta {
  color: var(--volt);
}

/* Direct action bars */

.viewport-action-bar {
  position: relative;
  z-index: 26;
  width: 100%;
  height: 60px;
  min-height: 60px;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  background: var(--field);
}

.opening-actions .button-primary,
.decision-actions .button-primary {
  width: 100%;
  height: 60px;
  min-height: 60px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: var(--volt);
  box-shadow: none;
  color: var(--field);
  font-size: 12px;
  font-weight: 800;
}

.opening-actions .button-primary:disabled,
.decision-actions .button-primary:disabled {
  background: var(--muted-deep);
  color: var(--field);
}

.report-board-bar {
  display: flex;
  height: 60px;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.report-board-bar .button-primary {
  min-height: 42px;
  border-radius: 0;
  background: var(--volt);
  box-shadow: none;
  color: var(--field);
}

.report-screen:has(.route-overlay:not([hidden])) .report-board-bar {
  visibility: hidden;
}

/* The decision sheet scrolls independently; Commit remains in the bar. */

.flow-overlay,
.decision-dock {
  position: absolute;
  z-index: 30;
  top: auto;
  right: 0;
  bottom: 60px;
  left: 0;
  display: flex;
  width: 100%;
  max-height: min(370px, calc(100% - 88px));
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: rgb(6 10 15 / 98%);
  box-shadow: 0 -18px 40px -24px rgb(0 0 0 / 90%);
}

.flow-overlay__head h1 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.1;
}

.decision-dock fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.decision-dock legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.segment-option label {
  display: flex;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 5px 3px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--raised);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.segment-option label strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.15;
}

.segment-option label small {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.2;
}

.segment-option input:checked + label {
  border-color: var(--volt);
  background: rgb(206 255 0 / 10%);
  color: var(--volt);
}

.decision-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.decision-preview span,
.decision-preview .preview-reserve {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 5px 3px;
  border: 1px solid var(--soft-line);
  border-radius: 0;
}

.decision-preview small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.2;
}

.decision-preview b {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.2;
}

.preview-reserve em {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  font-style: normal;
  line-height: 1.15;
  text-align: center;
}

.decision-preview .preview-reserve {
  gap: 3px;
}

/* Reveal controls share the same 60px viewport band. */

.reveal-footer {
  display: grid;
  height: 60px;
  min-height: 60px;
  gap: 2px 6px;
  margin: 0;
  padding: 4px 6px;
  border-top: 1px solid var(--line);
  grid-template-columns: minmax(0, 1fr) 112px;
  grid-template-rows: 2px 23px 23px;
}

.reveal-progress {
  width: 100%;
  height: 2px;
  grid-column: 1 / -1;
  grid-row: 1;
}

/* Caption ticker — a stock-ticker marquee in a LAYOUT-RESERVED 23px row.
   The absolute requirement: board plot + x-axis pixel coordinates never
   change; captions (including the clear-beat explainer channel) live inside
   this fixed row and can never reflow the plot. */
.payback-ticker {
  overflow: hidden;
  min-width: 0;
  align-self: center;
  grid-column: 1;
  grid-row: 2;
}

.payback-ticker__track {
  display: inline-block;
  width: max-content;
  padding-left: 100%;
  animation: payback-ticker-marquee var(--ticker-duration, 16s) linear infinite;
  white-space: nowrap;
  will-change: transform;
}

.payback-ticker:hover .payback-ticker__track,
.payback-ticker:active .payback-ticker__track {
  animation-play-state: paused;
}

.payback-ticker__seg {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.02em;
  line-height: 23px;
}

.payback-ticker__kicker {
  color: var(--ink);
  font-weight: 700;
}

.payback-ticker__seg.clear-explainer {
  margin-left: 14px;
  color: var(--ink);
}

.payback-ticker__seg[hidden] {
  display: none;
}

@keyframes payback-ticker-marquee {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .payback-ticker__track {
    display: flex;
    overflow: hidden;
    width: auto;
    padding-left: 0;
    animation: none !important;
    gap: 14px;
  }

  .payback-ticker__seg {
    overflow: hidden;
    min-width: 0;
    flex: 0 1 auto;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The explainer channel leads the static line and never gets truncated
     away by the beat caption (batch-2 review: it was clipped to zero px). */
  .payback-ticker__seg.clear-explainer:not([hidden]) {
    order: -1;
    flex: 0 0 auto;
    max-width: 100%;
    margin-left: 0;
  }
}

.reveal-copy p {
  color: var(--muted);
  text-align: left;
}

.market-pressure-strip {
  display: grid;
  height: 23px;
  min-width: 0;
  align-items: center;
  gap: 2px 3px;
  grid-column: 1;
  grid-row: 3;
  grid-template-columns: 36px minmax(0, 1fr) 36px minmax(0, 1fr);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1;
}

.market-pressure-strip > strong {
  display: none;
}

.pressure-bar {
  display: block;
  width: 100%;
  height: 6px;
}

.reveal-controls {
  display: grid;
  min-width: 0;
  align-items: stretch;
  gap: 3px;
  padding-right: 4px;
  grid-column: 2;
  grid-row: 2 / 4;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reveal-controls .button {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 3px;
  border-radius: 0;
  font-size: 8px;
}

.reveal-controls:has([data-report-cta]:not([hidden])) > :not([data-report-cta]) {
  display: none;
}

.reveal-controls [data-report-cta]:not([hidden]) {
  display: grid;
  min-height: 46px;
  grid-column: 1 / -1;
  background: var(--volt);
  box-shadow: none;
  color: var(--field);
}

/* Responsive dialogs and inspector */

.route-overlay,
.ink-overlay {
  position: absolute;
  inset: 0;
}

#app:has(> .scoreloop-overlay) > .ink-stage {
  visibility: hidden;
}

.route-overlay {
  z-index: 32;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgb(6 10 15 / 88%);
}

.route-overlay__card {
  display: flex;
  width: min(100%, 540px);
  max-height: 100%;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--raised);
  box-shadow: 0 20px 44px -20px rgb(0 0 0 / 90%);
}

.receipt-head > span,
.route-overlay__card > p:first-child,
.route-overlay__card h2,
.causal-notes,
.standings > div,
.receipt-grid > span,
.receipt-grid > strong {
  font-size: 10px;
  line-height: 1.25;
}

.receipt-head h1,
.verdict-overlay h1 {
  font-size: 22px;
  line-height: 1.05;
}

.receipt-grid > span,
.receipt-grid > strong {
  min-height: 28px;
  padding: 7px 4px;
}

.ink-overlay {
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgb(6 10 15 / 78%);
}

.market-intro .intro-caption {
  width: 100%;
  padding: 6px 8px;
  background: #060a0f;
}

.ink-popover {
  display: flex;
  width: min(100%, 560px);
  max-height: calc(100% - 16px);
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--raised);
  box-shadow: 0 18px 40px -20px rgb(0 0 0 / 85%);
}

.dialog-head {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dialog-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.dialog-head button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 50%;
}

.dialog-body {
  min-width: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.task-inspector {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.task-inspector__headline {
  display: -webkit-box;
  min-height: 16px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.025em;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-inspector__figure {
  display: block;
  width: min(100%, 330px);
  height: auto;
  align-self: center;
  overflow: hidden;
}

.task-inspector__figure--tall,
.task-inspector__figure--pending {
  aspect-ratio: 165 / 56;
}

.task-inspector__figure--strip {
  aspect-ratio: 165 / 13;
}

.task-market__ceiling-frame,
.task-market__pending-frame,
.task-market__share-frame {
  fill: transparent;
  stroke: var(--line);
  stroke-width: 1;
}

.task-market__segment--player {
  fill: var(--volt);
}

.task-market__segment--rivalA {
  fill: var(--kiln);
}

.task-market__segment--rivalB {
  fill: var(--para);
}

.task-market__hatch-line {
  stroke: var(--muted);
  stroke-width: 1;
}

.task-market__rate {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.task-market__premium-bracket {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
}

.task-inspector__extent {
  display: flex;
  width: min(100%, 330px);
  align-items: center;
  align-self: center;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
}

.task-inspector__shares {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 4px;
  list-style: none;
}

.task-share {
  display: grid;
  min-height: 18px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.2;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 6px;
}

.task-share__swatch {
  width: 10px;
  height: 10px;
  border: 1px solid var(--line);
}

.task-share--player .task-share__swatch {
  border-color: var(--volt);
  background: var(--volt);
}

.task-share--rivalA .task-share__swatch {
  border-color: var(--kiln);
  background: var(--kiln);
}

.task-share--rivalB .task-share__swatch {
  border-color: var(--para);
  background: var(--para);
}

.task-share--unserved .task-share__swatch {
  background: repeating-linear-gradient(
    135deg,
    transparent 0 3px,
    var(--muted) 3px 4px
  );
}

.task-share__name,
.task-share__values {
  min-width: 0;
  white-space: nowrap;
}

.task-share--player .task-share__name {
  color: var(--volt);
}

.task-share--unserved .task-share__values {
  color: var(--loss);
}

.task-inspector__rates {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin: 0;
  padding: 7px 0;
  border-top: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.task-inspector__rates strong {
  color: var(--ink);
}

.task-inspector__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}

.task-inspector__remainder {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.35;
}

.task-inspector__footer .button {
  min-height: 34px;
  flex: none;
  border-radius: 0;
}

/* Dossiers use a flat single-card surface on touch layouts. */

.dossier-overlay {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: grid;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: 58px minmax(0, 1fr) 48px;
  background: #0b1016;
  color: var(--ink);
}

.dossier-header {
  min-height: 58px;
  padding: 8px 12px;
}

.dossier-header__title strong {
  overflow: visible;
  font-size: 15px;
  line-height: 1.3;
  text-overflow: clip;
}

.dossier-header__title small {
  font-size: 11px;
  line-height: 1.2;
}

.dossier-coverflow {
  position: relative;
  display: block;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  perspective: none;
}

.dossier-panel,
.dossier-panel.is-near-left,
.dossier-panel.is-near-right,
.dossier-panel.is-outer-left,
.dossier-panel.is-outer-right {
  position: relative;
  inset: auto;
  display: none;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transform: none;
}

.dossier-panel.is-active,
.dossier-panel.is-center {
  position: relative;
  inset: auto;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.dossier-panel__surface {
  width: 100%;
  height: 100%;
  padding: 12px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.dossier-arrow {
  display: none;
}

.dossier-equations b {
  overflow: visible;
  text-overflow: clip;
}

.dossier-tabs {
  min-height: 48px;
  padding: 6px 8px;
}

.dossier-tab {
  min-height: 34px;
  border-radius: 0;
  font-size: 11px;
}

.dossier-tab.is-active {
  border-color: var(--volt);
  background: var(--volt);
  color: var(--field);
}

/* Title */

.title-screen .ink-screen {
  display: block;
}

.title-main {
  display: flex;
  width: 100%;
  max-width: 760px;
  height: 100%;
  min-height: 0;
  gap: 0;
  margin: 0 auto;
  padding: clamp(20px, 6vh, 54px) clamp(16px, 5vw, 44px);
}

.title-composition {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
}

.title-main h1 {
  margin: 18px 0 0;
  font-size: clamp(52px, 18vw, 92px);
  line-height: 0.9;
}

.title-thesis {
  max-width: 440px;
  margin: 18px 0 0;
  font-size: clamp(12px, 3vw, 17px);
  line-height: 1.25;
}

.title-actions {
  width: 100%;
  flex: 0 0 auto;
}

.title-actions .button-primary {
  width: 100%;
  height: 60px;
  min-height: 60px;
  border: 0;
  border-radius: 0;
  background: var(--volt);
  box-shadow: none;
  color: var(--field);
  font-size: 12px;
}

@media (max-height: 640px) {
  .title-main {
    padding-block: 14px;
  }

  .title-main h1 {
    font-size: clamp(48px, 16vw, 68px);
  }

  .title-thesis {
    margin-top: 10px;
  }

  .flow-overlay,
  .decision-dock {
    max-height: calc(100% - 88px);
  }
}

@media (min-width: 680px) {
  .market-board {
    padding-right: 12px;
    padding-left: 12px;
  }

  .task-label,
  .task-state {
    font-size: 11px;
  }

  .price-rail > span:not(.price-axis-title),
  .iq-ticks span,
  .board-legend {
    font-size: 12px;
  }

  .price-axis-title,
  .iq-axis__label {
    font-size: 13px;
  }

  .board-legend__label,
  .price-rail .price-axis-title,
  .iq-axis .iq-axis__label {
    font-size: 14px;
  }

  .fleet-section {
    padding-inline: 12px;
  }

  .fleet-grid {
    gap: 8px;
  }

  .fleet-card {
    padding-inline: 10px;
  }

  .lab-card__name strong {
    font-size: 12px;
  }

  .flow-overlay,
  .decision-dock {
    right: 12px;
    left: auto;
    width: min(540px, calc(100% - 24px));
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }
}

@media (min-width: 1152px) {
  .play-workspace #app {
    max-width: var(--content-max);
  }

  body:has(.play-workspace) .shell-switch__tab.is-active {
    border-bottom: 2px solid var(--volt);
    background: transparent;
    color: var(--volt);
  }

  .segment-option input:checked + label,
  .dossier-tab.is-active {
    border-color: var(--ink);
    background: var(--ink);
    box-shadow: none;
    color: var(--field);
  }

  .segment-option input:checked + label strong,
  .segment-option input:checked + label small {
    color: var(--field);
  }

  .segment-option input:checked:focus-visible + label,
  .dossier-tab.is-active:focus-visible {
    outline-color: var(--ink);
  }

  .dossier-panel__kicker {
    color: var(--muted);
  }

  .dossier-headline strong {
    color: var(--ink);
  }

  .reveal-progress i {
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--volt);
  }

  .drawer-handle {
    position: absolute;
    z-index: 25;
    top: 28px;
    right: 0;
    bottom: 60px;
    display: grid;
    width: 28px;
    min-width: 28px;
    place-items: center;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: var(--raised);
    color: var(--muted);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 10px;
  }

  .drawer-handle span {
    letter-spacing: 0.08em;
    writing-mode: vertical-rl;
  }

  .drawer-handle:hover,
  .drawer-handle:focus-visible {
    color: var(--ink);
    outline-color: var(--ink);
  }

  .decision-screen:not(.is-peeking) .drawer-handle,
  .report-screen:not(.is-peeking) .drawer-handle {
    display: none;
  }

  .decision-screen.is-peeking .drawer-handle,
  .report-screen.is-peeking .drawer-handle {
    bottom: 44px;
  }

  .dossier-overlay.is-drawer {
    position: absolute;
    z-index: 45;
    inset: 0;
    display: block;
    overflow: hidden;
    background: rgb(0 0 0 / 55%);
    touch-action: auto;
  }

  .dossier-drawer {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
    width: clamp(520px, 44vw, 640px);
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-left: 1px solid var(--line);
    background: var(--board);
    color: var(--ink);
    font-size: 11px;
    grid-template-rows: 66px minmax(0, 1fr) 58px;
    animation: dossier-drawer-in 160ms ease-out both;
  }

  .dossier-drawer .dossier-header {
    min-height: 66px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--board);
  }

  .dossier-drawer .dossier-header__title strong {
    overflow: visible;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: clip;
  }

  .dossier-drawer .dossier-header__title small {
    font-size: 11px;
    line-height: 1.2;
  }

  .dossier-drawer .dossier-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 18px;
  }

  .dossier-drawer .dossier-coverflow {
    min-height: 0;
    padding: 0;
  }

  .dossier-drawer .dossier-panel__surface {
    gap: 12px;
    padding: 24px;
    background: var(--board);
    font-size: 11px;
  }

  .dossier-drawer .dossier-panel__kicker {
    font-size: 11px;
  }

  .dossier-drawer .dossier-panel h3 {
    margin: 0;
    font-size: 18px;
  }

  .dossier-drawer .dossier-headline {
    min-height: 32px;
    margin: 0;
  }

  .dossier-drawer .dossier-headline strong {
    color: var(--ink);
    font-size: 32px;
  }

  .dossier-drawer .dossier-headline span {
    font-size: 11px;
  }

  .dossier-drawer .dossier-equations {
    margin: 0;
    gap: 5px;
    font-size: 11px;
  }

  .dossier-drawer .dossier-equations li {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .dossier-drawer .dossier-equations small,
  .dossier-drawer .dossier-footnote,
  .dossier-drawer .dossier-empty {
    margin: 0;
    font-size: 11px;
  }

  .dossier-drawer svg.dossier-chart,
  .dossier-drawer svg.dossier-chart--money {
    width: 100%;
    height: auto;
    max-width: none;
    max-height: none;
    flex: 0 0 auto;
  }

  .dossier-drawer svg.dossier-chart:not(.dossier-chart--money) {
    max-height: 240px;
  }

  .dossier-drawer svg.dossier-chart--economics {
    max-height: none;
  }

  .dossier-drawer .dossier-chart-legend {
    min-height: 18px;
    margin: 0;
    gap: 5px 12px;
    font-size: 11px;
  }

  .dossier-drawer .dossier-chart-key {
    width: 10px;
    height: 10px;
  }

  .dossier-drawer .dossier-table {
    font-size: 12px;
    line-height: 1.25;
  }

  .dossier-drawer .dossier-table th,
  .dossier-drawer .dossier-table td {
    height: 30px;
    padding: 6px 3px;
    font-size: 12px;
  }

  .dossier-drawer .dossier-summary dt {
    font-size: 11px;
  }

  .dossier-drawer .dossier-summary dd {
    font-size: 12px;
  }

  .dossier-drawer .dossier-tabs {
    min-height: 58px;
    padding: 7px 10px;
    border-top: 1px solid var(--line);
    background: var(--board);
  }

  .dossier-drawer .dossier-tab {
    min-height: 42px;
    font-size: 11px;
  }

  .decision-screen .ink-screen {
    background: #000;
  }

  .report-screen .ink-screen,
  .verdict-screen .ink-screen {
    background: #000;
  }

  .decision-screen:not(.is-peeking) .year-strip,
  .decision-screen:not(.is-peeking) .screen-content {
    display: none;
  }

  .report-screen:not(.is-peeking) .year-strip,
  .report-screen:not(.is-peeking) .screen-content,
  .verdict-screen .year-strip,
  .verdict-screen .screen-content {
    display: none;
  }

  .takeover-stack {
    position: absolute;
    z-index: 32;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px 48px;
    background: #000;
  }

  .takeover-stack .decision-dock {
    position: relative;
    inset: auto;
    width: min(560px, calc(100vw - 96px));
    max-height: calc(100dvh - var(--shell-h) - 108px);
    gap: 16px;
    padding: 28px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--line);
    background: var(--board);
    box-shadow: none;
    animation: decision-card-in 120ms ease-out both;
  }

  .takeover-stack .flow-overlay__head {
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }

  .takeover-stack .flow-overlay__head h1 {
    font-size: 18px;
    font-weight: 800;
  }

  .takeover-peek,
  .peek-return {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
  }

  .takeover-peek {
    flex: none;
  }

  .takeover-peek:hover,
  .takeover-peek:focus-visible,
  .peek-return:hover,
  .peek-return:focus-visible {
    border-color: var(--ink);
    color: var(--ink);
    outline-color: var(--ink);
  }

  .takeover-stack .decision-dock legend {
    font-size: 11px;
  }

  .takeover-stack .segment-option label {
    min-height: 68px;
  }

  .takeover-stack .segment-option label strong {
    font-size: 16px;
  }

  .takeover-stack .segment-option label small {
    font-size: 10px;
  }

  .takeover-stack .decision-preview small,
  .takeover-stack .preview-reserve em {
    font-size: 10px;
  }

  .takeover-stack .decision-preview span,
  .takeover-stack .decision-preview .preview-reserve {
    gap: 5px;
  }

  .takeover-stack .decision-preview b {
    font-size: 16px;
  }

  .takeover-stack .decision-actions {
    position: relative;
    width: min(560px, calc(100vw - 96px));
    flex: 0 0 60px;
    border: 1px solid var(--line);
    border-top: 0;
    background: var(--field);
  }

  .report-screen .route-overlay,
  .verdict-screen .route-overlay {
    padding: 24px 48px;
    background: #000;
  }

  .report-screen .route-overlay__card,
  .verdict-screen .route-overlay__card {
    width: min(600px, calc(100vw - 96px));
    max-height: calc(100dvh - var(--shell-h) - 48px);
    gap: 10px;
    padding: 28px;
    border: 1px solid var(--line);
    background: var(--board);
    box-shadow: none;
  }

  .report-screen .receipt-head h1 {
    font-size: 20px;
    font-weight: 800;
  }

  .report-screen .receipt-grid > span,
  .report-screen .receipt-grid > strong {
    min-height: 30px;
    padding: 7px 4px;
    font-size: 13px;
  }

  .report-screen .receipt-grid > strong.is-total {
    font-size: 15px;
  }

  .report-screen .standings > div {
    min-height: 28px;
    font-size: 12px;
  }

  .report-screen .causal-notes {
    font-size: 12px;
    line-height: 1.5;
  }

  .report-screen .report-actions,
  .verdict-screen .verdict-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .report-screen .report-actions .button,
  .verdict-screen .verdict-actions .button {
    min-height: 38px;
    border-radius: 0;
  }

  .report-screen .report-actions .button-primary,
  .verdict-screen .verdict-actions .button-primary {
    width: 100%;
    height: 60px;
    min-height: 60px;
    border: 0;
    background: var(--volt);
    box-shadow: none;
    color: var(--field);
    font-size: 12px;
    grid-column: 1 / -1;
  }

  .verdict-screen .verdict-overlay h1 {
    font-size: 22px;
  }

  .decision-screen.is-peeking .ink-screen,
  .report-screen.is-peeking .ink-screen {
    grid-template-rows: 28px minmax(0, 1fr) 44px;
    background: var(--board);
  }

  .decision-screen.is-peeking .takeover-stack,
  .report-screen.is-peeking .route-overlay {
    display: none;
  }

  .decision-screen.is-peeking .year-strip,
  .report-screen.is-peeking .year-strip {
    display: flex;
  }

  .decision-screen.is-peeking .screen-content,
  .report-screen.is-peeking .screen-content {
    display: grid;
  }

  .peek-strip {
    z-index: 35;
    display: none;
    height: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 5px 12px;
    border-top: 1px solid var(--line);
    background: var(--raised);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
  }

  .decision-screen.is-peeking .peek-strip,
  .report-screen.is-peeking .peek-strip {
    display: flex;
  }

  .peek-strip .peek-return {
    min-height: 34px;
    flex: none;
  }

  @keyframes decision-card-in {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  @keyframes dossier-drawer-in {
    from {
      transform: translateX(100%);
    }

    to {
      transform: translateX(0);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .ink-stage *,
  .ink-stage *::before,
  .ink-stage *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (forced-colors: active) {
  .ink-stage,
  .ink-screen,
  .fleet-card,
  .route-overlay__card,
  .ink-popover,
  .decision-dock,
  .dossier-panel__surface {
    border-color: CanvasText;
    background: Canvas;
    color: CanvasText;
    forced-color-adjust: auto;
  }

  .going-rate-line,
  .work-token,
  .task-inspector__figure,
  .iq-marker {
    forced-color-adjust: none;
  }

  .opening-actions .button-primary,
  .decision-actions .button-primary,
  .title-actions .button-primary {
    border: 1px solid CanvasText;
  }
}
