/* The arcade is a short guided walk through three familiar situations. Keep
   the visual language tactile while letting each result sit beside its scene. */
.county-arcade-page {
  padding-bottom: 90px;
}

.county-arcade-page [hidden] {
  display: none !important;
}

.county-arcade-page .arcade-hero {
  display: block;
  padding: clamp(30px, 5vw, 58px) 0 24px;
}

.arcade-hero h1 {
  max-width: 18ch;
  margin: 0;
  color: var(--county-ink);
  font-family: ui-rounded, "Avenir Next Rounded", "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(2.8rem, 6vw, 5.4rem);
  font-weight: 950;
  letter-spacing: -.075em;
  line-height: .89;
}

.arcade-hero .arcade-lede {
  max-width: 48rem;
  margin: 16px 0 0;
  color: var(--county-muted);
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  line-height: 1.4;
}

.arcade-hero .arcade-boundary {
  max-width: 48rem;
  margin: 12px 0 0;
  color: var(--county-ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
}

.arcade-hero .editorial-byline {
  margin: 11px 0 0;
  color: var(--county-coral-dark);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.arcade-scene-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 2px 0 18px;
}

.arcade-scene-nav a {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 3px solid var(--county-line);
  border-radius: 11px;
  background: var(--county-white);
  color: var(--county-ink);
  box-shadow: 3px 3px 0 var(--county-shadow);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
}

.arcade-scene-nav a:hover {
  background: var(--county-yellow);
  color: var(--county-ink);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--county-shadow);
}

.arcade-scene-nav a:first-child { background: var(--county-coral); }
.arcade-scene-nav a:nth-child(2) { background: var(--county-yellow); }
.arcade-scene-nav a:nth-child(3) { background: var(--county-teal); }
.arcade-scene-nav a span:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.county-arcade-page .button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 13px;
  border: 3px solid var(--county-line);
  border-radius: 10px;
  background: var(--county-coral);
  color: var(--county-ink);
  box-shadow: 3px 3px 0 var(--county-shadow);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.12;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.county-arcade-page .button:hover {
  background: var(--county-yellow);
  color: var(--county-ink);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--county-shadow);
}

.county-arcade-page .button:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--county-shadow);
}

.county-arcade-page .button--secondary { background: var(--county-white); }

.county-arcade-page .scene-controls .button:disabled {
  cursor: not-allowed;
  background: var(--county-paper-deep);
  color: var(--county-muted);
  border-style: dashed;
  opacity: 1;
  box-shadow: 2px 2px 0 var(--county-shadow);
}

.arcade-scene {
  scroll-margin-top: 100px;
  margin-top: 42px;
  padding: clamp(20px, 4vw, 42px);
  border: 4px solid var(--county-line);
  border-radius: 27px;
  background: var(--county-white);
  box-shadow: 8px 8px 0 var(--county-shadow);
}

.arcade-scene__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 23px;
}

.arcade-scene__heading h2 {
  max-width: 18ch;
  margin: 0;
  color: var(--county-ink);
  font-family: ui-rounded, "Avenir Next Rounded", "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 950;
  letter-spacing: -.06em;
  line-height: .95;
}

.arcade-scene__heading p:not(.county-kicker) {
  max-width: 35rem;
  margin: 9px 0 0;
  color: var(--county-muted);
  font-size: 16px;
  line-height: 1.46;
}

.arcade-scene__badge {
  flex: 0 0 auto;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 6px 10px;
  border: 2px solid var(--county-line);
  border-radius: 8px;
  background: var(--county-paper-deep);
  color: var(--county-ink);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .07em;
  line-height: 1.1;
  text-transform: uppercase;
}

.scene-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr);
  gap: 18px;
  align-items: stretch;
}

.scene-visual,
.scene-readout {
  min-width: 0;
  border: 3px solid var(--county-line);
  border-radius: 17px;
}

.scene-visual {
  padding: 15px;
  background: var(--county-paper-deep);
  overflow: hidden;
}

.scene-visual__label,
.scene-readout__eyebrow,
.scene-result__eyebrow {
  margin: 0 0 11px;
  color: var(--county-coral-dark);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.scene-visual__label { margin-left: 2px; }

.scene-readout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  background: var(--county-paper);
}

.scene-readout > strong {
  color: var(--county-ink);
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  font-weight: 950;
  letter-spacing: -.035em;
  line-height: 1.05;
}

.scene-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 17px 0 0;
}

.scene-metrics > div {
  min-width: 0;
  padding: 9px 8px;
  border: 2px solid var(--county-line);
  border-radius: 8px;
  background: var(--county-white);
}

.scene-metrics span,
.scene-metrics b {
  display: block;
}

.scene-metrics span {
  color: var(--county-muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.15;
  text-transform: uppercase;
}

.scene-metrics b {
  margin-top: 5px;
  color: var(--county-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.scene-conclusion {
  margin: 17px 0 0;
  padding: 11px 13px;
  border: 3px solid var(--county-line);
  border-radius: 4px 14px 14px 14px;
  background: var(--county-yellow);
  color: var(--county-ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.scene-controls {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
}

.scene-controls .button {
  flex: 0 0 auto;
}

.scene-controls progress {
  flex: 1 1 120px;
  min-width: 90px;
  height: 12px;
  accent-color: var(--county-coral);
}

.scene-status {
  flex: 0 1 18rem;
  color: var(--county-muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}

.scene-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 17px;
  padding: 16px 17px;
  border: 3px solid var(--county-line);
  border-radius: 13px;
  background: var(--county-coral);
  color: var(--county-ink);
}

.scene-result__eyebrow { margin-bottom: 5px; color: inherit; }
.scene-result h3 { margin: 0; font-size: 20px; line-height: 1.05; }
.scene-result p:not(.scene-result__eyebrow) { max-width: 48rem; margin: 7px 0 0; font-size: 14px; line-height: 1.35; }

.scene-experiment,
.scene-notes {
  margin-top: 14px;
  border: 2px solid var(--county-line);
  border-radius: 11px;
  background: var(--county-paper);
}

.scene-experiment > summary,
.scene-notes > summary {
  cursor: pointer;
  padding: 11px 13px;
  color: var(--county-ink);
  font-size: 14px;
  font-weight: 900;
}

.experiment-body {
  display: grid;
  gap: 11px;
  padding: 0 13px 14px;
  border-top: 2px solid var(--county-line);
}

.experiment-body fieldset {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.experiment-body legend {
  margin-bottom: 1px;
  color: var(--county-muted);
  font-size: 12px;
  font-weight: 800;
}

.experiment-body label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--county-ink);
  font-size: 14px;
  font-weight: 750;
}

.experiment-body input[type="range"] { width: 100%; accent-color: var(--county-coral); }
.experiment-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.experiment-status { margin: 0; color: var(--county-muted); font-size: 13px; line-height: 1.35; }

.experiment-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.experiment-stats > div {
  padding: 8px;
  border: 2px solid var(--county-line);
  border-radius: 7px;
  background: var(--county-white);
}

.experiment-stats dt { color: var(--county-muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.experiment-stats dd { margin: 4px 0 0; color: var(--county-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; font-weight: 900; }

.scene-notes { background: transparent; }
.scene-notes p { margin: 0; padding: 0 13px 12px; color: var(--county-muted); font-size: 13px; line-height: 1.45; }
.scene-notes p + p { padding-top: 0; }
.scene-notes a { color: var(--county-coral-dark); font-weight: 800; }

.scene-boundary {
  margin: 16px 0 0;
  padding: 11px 13px;
  border-left: 5px solid var(--county-coral);
  background: var(--county-paper-deep);
  color: var(--county-muted);
  font-size: 13px;
  line-height: 1.42;
}

/* Queue scene */
.queue-illustration {
  display: block;
  width: 100%;
  max-height: 132px;
  margin-bottom: 13px;
}

.queue-illustration text {
  fill: var(--county-ink);
  font-family: ui-rounded, "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
}

.queue-counters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.queue-counter {
  min-width: 0;
  padding: 11px;
  border: 3px solid var(--county-line);
  border-radius: 12px;
  background: var(--county-white);
}

.queue-counter--arrival { border-top: 8px solid var(--county-coral); }
.queue-counter--offer { border-top: 8px solid var(--county-teal); }
.queue-counter__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 7px;
}
.queue-counter h3 { margin: 0; font-size: 15px; line-height: 1.05; }
.queue-counter__heading span { flex: 0 0 auto; color: var(--county-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; font-weight: 900; }
.queue-order-list { display: grid; gap: 5px; min-height: 150px; margin: 10px 0 0; padding: 0; list-style: none; }
.queue-order {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  min-height: 25px;
  padding: 4px 5px;
  border: 2px solid var(--county-line);
  border-radius: 6px;
  background: var(--county-paper);
  color: var(--county-muted);
  font-size: 11px;
  line-height: 1.05;
  opacity: 1;
}
.queue-order__position { color: var(--county-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; font-weight: 900; }
.queue-order strong { min-width: 0; overflow-wrap: anywhere; color: var(--county-ink); font-size: 12px; }
.queue-order__offer { color: var(--county-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.queue-order.is-serving { background: var(--county-yellow); color: var(--county-ink); opacity: 1; transform: translateX(3px); }
.queue-order.is-served { background: var(--county-teal); color: var(--county-ink); opacity: 1; }
.queue-order.is-served strong { text-decoration: line-through; text-decoration-thickness: 2px; }
.queue-counter__note { min-height: 34px; margin: 9px 0 0; color: var(--county-muted); font-size: 11px; line-height: 1.3; }

/* Shared earnings scene */
.variance-counters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.variance-card { min-width: 0; padding: 13px; border: 3px solid var(--county-line); border-radius: 12px; background: var(--county-white); }
.variance-card--solo { border-top: 8px solid var(--county-coral); }
.variance-card--shared { border-top: 8px solid var(--county-teal); }
.variance-card__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 7px; }
.variance-card h3 { margin: 0; font-size: 17px; line-height: 1.05; }
.variance-card__heading span { color: var(--county-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; font-weight: 900; text-align: right; }
.variance-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin-top: 15px; }
.variance-cell { aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--county-line); border-radius: 5px; background: var(--county-paper); color: var(--county-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; font-weight: 900; opacity: .42; }
.variance-cell.is-seen { opacity: 1; }
.variance-cell.is-win { background: var(--county-coral); color: var(--county-ink); }
.variance-cell.is-credit { background: var(--county-teal); color: var(--county-ink); }
.variance-cell.is-unseen { border-style: dashed; }
.variance-card p { min-height: 38px; margin: 12px 0 0; color: var(--county-muted); font-size: 12px; line-height: 1.3; }

/* Issuance calendar scene */
.emission-calendar { padding: 12px 13px 11px; border: 3px solid var(--county-line); border-radius: 13px; background: var(--county-paper); }
.emission-calendar__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--county-muted); font-size: 12px; font-weight: 850; }
.emission-calendar__header strong { color: var(--county-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; }
.emission-bars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; gap: 8px; height: 225px; margin-top: 18px; padding: 0 4px; border-bottom: 3px solid var(--county-line); }
.emission-bar-slot { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: end; height: 100%; gap: 6px; }
.emission-bar {
  position: relative;
  width: min(100%, 82px);
  height: 132px;
  border: 3px solid var(--county-line);
  border-radius: 10px 10px 5px 5px;
  background: var(--county-white);
  overflow: hidden;
}

.emission-bar::before {
  position: absolute;
  z-index: 2;
  top: 13px;
  left: 50%;
  width: 27px;
  height: 27px;
  border: 7px solid var(--county-coral);
  border-radius: 50%;
  background: transparent;
  content: "";
  transform: translateX(-50%);
}

.emission-bar::after {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: 7px;
  height: 2px;
  background: var(--county-line);
  content: "";
}

.emission-bar__fill {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  height: calc(var(--emission-fraction) * 100%);
  min-height: 8px;
  border: 2px solid var(--county-line);
  border-radius: 5px 5px 2px 2px;
  background: var(--county-coral);
  transition: height 180ms ease, background-color 180ms ease;
}

.emission-bar-slot.is-unseen .emission-bar { opacity: .2; }
.emission-bar-slot.is-current .emission-bar { box-shadow: 4px 0 0 var(--county-ink); }
.emission-bar-slot.is-current .emission-bar__fill { background: var(--county-teal); }
.emission-bar-slot.is-current .emission-bar-label { color: var(--county-ink); }
.emission-bar-label { color: var(--county-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; font-weight: 900; }
.emission-bar-value { color: var(--county-muted); font-size: 10px; font-weight: 850; }
.emission-axis { display: flex; justify-content: space-between; gap: 4px; margin-top: 8px; color: var(--county-muted); font-size: 10px; font-weight: 800; }

/* Accent fills carry their own ink pair. This keeps the control labels and
   the small queue rows readable in both county themes. */
.county-arcade-page .arcade-scene-nav a,
.county-arcade-page .scene-controls .button:not(.button--secondary),
.county-arcade-page .queue-order.is-serving,
.county-arcade-page .queue-order.is-served,
.county-arcade-page .variance-cell.is-win,
.county-arcade-page .variance-cell.is-credit {
  color: var(--county-ink-on-color);
}

.county-arcade-page .queue-order.is-serving strong,
.county-arcade-page .queue-order.is-serving .queue-order__position,
.county-arcade-page .queue-order.is-serving .queue-order__offer,
.county-arcade-page .queue-order.is-served strong,
.county-arcade-page .queue-order.is-served .queue-order__position,
.county-arcade-page .queue-order.is-served .queue-order__offer {
  color: var(--county-ink-on-color);
}

:root[data-theme="dark"] .county-arcade-page .scene-conclusion,
:root[data-theme="dark"] .county-arcade-page .scene-result,
:root[data-theme="dark"] .county-arcade-page .queue-order.is-serving,
:root[data-theme="dark"] .county-arcade-page .queue-order.is-served,
:root[data-theme="dark"] .county-arcade-page .variance-cell.is-win,
:root[data-theme="dark"] .county-arcade-page .variance-cell.is-credit {
  color: var(--county-ink-on-color);
}

:root[data-theme="dark"] .county-arcade-page .scene-result h3,
:root[data-theme="dark"] .county-arcade-page .scene-result p,
:root[data-theme="dark"] .county-arcade-page .scene-result__eyebrow,
:root[data-theme="dark"] .county-arcade-page .scene-conclusion {
  color: var(--county-ink-on-color);
}

:root[data-theme="dark"] .county-arcade-page .arcade-boundary {
  color: var(--county-ink);
}

@media (max-width: 980px) {
  .scene-stage { grid-template-columns: 1fr; }
  /* The visual is the event. Keep its readout immediately after it on a
     narrow screen so the consequence follows the action in reading order. */
  .scene-readout { min-height: 0; }
}

@media (max-width: 760px) {
  .county-arcade-page .arcade-hero { padding: 24px 0 16px; }
  .arcade-hero h1 { max-width: none; font-size: clamp(2.7rem, 11vw, 4rem); }
  .arcade-scene-nav { display: none; }
  .arcade-scene-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .arcade-scene-nav a {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 52px;
    padding: 8px 7px;
    font-size: 11px;
  }
  .arcade-scene-nav a span[aria-hidden="true"] { display: none; }
  .arcade-scene { margin-top: 30px; border-width: 3px; border-radius: 19px; box-shadow: 5px 5px 0 var(--county-shadow); }
  .arcade-scene__heading { display: block; }
  .arcade-scene__badge { margin-top: 15px; }
  .scene-controls { align-items: stretch; flex-wrap: wrap; }
  .scene-controls progress { order: 3; flex-basis: 100%; }
  .scene-status { flex-basis: 100%; }
}

@media (max-width: 520px) {
  .arcade-scene { padding: 16px; }
  .queue-counters,
  .variance-counters { grid-template-columns: 1fr; }
  .queue-order-list { min-height: 0; }
  .scene-metrics { grid-template-columns: 1fr; }
  .scene-metrics > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .scene-metrics b { margin-top: 0; }
  .scene-result { display: block; }
  .scene-result .button { width: 100%; margin-top: 13px; }
  .experiment-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .emission-bars { height: 185px; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .emission-bar { transition: none; }
  .queue-order.is-serving { transform: none; }
}
