:root {
  --ink: #071426;
  --ink-2: #102a4d;
  --paper: #fffefa;
  --cloud: #f3f8ff;
  --blue: #1f7ae0;
  --blue-dark: #0c4d9b;
  --gold: #d6a338;
  --gold-light: #ffe6a3;
  --green: #28b463;
  --red: #e5574f;
  --line: #071426;
  --shadow: 6px 6px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Public Sans", sans-serif;
  background:
    linear-gradient(90deg, rgba(7, 20, 38, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(7, 20, 38, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, #ffffff 0%, #edf7ff 42%, #fff2c8 100%);
  background-size: 18px 18px, 18px 18px, auto;
}

a {
  color: inherit;
}

.site-shell {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.brand {
  width: fit-content;
  padding: 13px 16px;
  border: 4px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.76rem, 2vw, 0.95rem);
  text-decoration: none;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-actions a,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0;
  cursor: pointer;
}

.nav-actions a {
  padding: 10px 12px;
  background: var(--paper);
  font-size: 0.78rem;
}

.nav-actions .admin-link,
.primary-button {
  color: #fff;
  background: var(--blue);
}

.secondary-button {
  color: var(--ink);
  background: var(--gold-light);
}

.primary-button,
.secondary-button {
  padding: 12px 16px;
  font-family: "Public Sans", sans-serif;
  font-size: 0.82rem;
}

.nav-actions a:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--line);
}

.hero {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 118px);
}

.hero-copy,
.game-screen,
.pixel-card,
.analyzer-band,
.lead-band,
.metric-strip article {
  border: 4px solid var(--line);
  background: rgba(255, 254, 250, 0.94);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  align-content: center;
  padding: clamp(22px, 4vw, 42px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue-dark);
  font-family: "Press Start 2P", monospace;
  font-size: 0.65rem;
  line-height: 1.7;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(2.1rem, 5vw, 4.9rem);
  line-height: 1.08;
  color: var(--ink);
  text-shadow: 5px 5px 0 var(--gold-light);
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.55rem);
  line-height: 1.03;
}

.lede,
.pixel-card p,
.analyzer-band p,
.lead-band p {
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.game-screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 640px;
  overflow: hidden;
  background: #dff2ff;
}

.screen-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 4px solid var(--line);
  color: #fff;
  background: var(--blue-dark);
  font-family: "Press Start 2P", monospace;
  font-size: 0.64rem;
  line-height: 1.5;
}

.screen-header strong {
  color: var(--gold-light);
}

.office-floor {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0 48%, transparent 48%),
    linear-gradient(90deg, rgba(7, 20, 38, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(7, 20, 38, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #bfe6ff 0 50%, #f8d985 50% 100%);
  background-size: auto, 32px 32px, 32px 32px, auto;
}

.office-floor::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 62px;
  height: 92px;
  border-top: 4px solid var(--line);
  border-bottom: 4px solid var(--line);
  background: repeating-linear-gradient(90deg, #f8c75b 0 18px, #f4b947 18px 36px);
}

.stage-desk {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 5px;
  width: 128px;
  min-height: 108px;
  padding: 12px 8px 8px;
  border: 4px solid var(--line);
  background: var(--paper);
  box-shadow: 5px 5px 0 rgba(7, 20, 38, 0.92);
  text-align: center;
}

.stage-desk strong {
  font-family: "Press Start 2P", monospace;
  font-size: 0.53rem;
  line-height: 1.5;
}

.stage-desk small {
  color: var(--blue-dark);
  font-weight: 900;
  line-height: 1.2;
}

.stage-ingest {
  left: 4%;
  top: 46px;
}

.stage-acq {
  left: 24%;
  top: 188px;
}

.stage-underwrite {
  left: 44%;
  top: 54px;
}

.stage-buyers {
  right: 22%;
  top: 188px;
}

.stage-dispo {
  right: 4%;
  top: 48px;
}

.worker {
  position: relative;
  display: block;
  width: 34px;
  height: 38px;
  margin: 0 auto 2px;
  image-rendering: pixelated;
  background:
    linear-gradient(var(--ink) 0 0) 10px 0 / 14px 8px no-repeat,
    linear-gradient(#ffd6a8 0 0) 7px 8px / 20px 12px no-repeat,
    linear-gradient(var(--blue) 0 0) 6px 20px / 22px 14px no-repeat,
    linear-gradient(var(--ink) 0 0) 6px 34px / 8px 4px no-repeat,
    linear-gradient(var(--ink) 0 0) 20px 34px / 8px 4px no-repeat;
  animation: workerBounce 0.9s steps(2, end) infinite;
}

.worker-b {
  filter: hue-rotate(35deg);
  animation-delay: 0.16s;
}

.worker-c {
  filter: hue-rotate(95deg);
  animation-delay: 0.28s;
}

.worker-d {
  filter: hue-rotate(160deg);
  animation-delay: 0.42s;
}

.worker-e {
  filter: hue-rotate(220deg);
  animation-delay: 0.56s;
}

@keyframes workerBounce {
  50% {
    transform: translateY(-4px);
  }
}

.pipeline-track {
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 96px;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9%;
}

.pipeline-track span {
  display: block;
  height: 8px;
  border: 2px solid var(--line);
  background: var(--blue);
  box-shadow: 3px 3px 0 var(--line);
}

.moving-leads {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.lead-token,
.engine-waiting {
  position: absolute;
  min-width: 180px;
  max-width: 220px;
  border: 4px solid var(--line);
  background: #fff;
  box-shadow: 5px 5px 0 var(--line);
  padding: 10px;
  font-size: 0.76rem;
  font-weight: 900;
}

.lead-token {
  left: -230px;
  bottom: 112px;
  animation: moveLead 17s linear infinite;
}

.lead-token:nth-child(2) {
  animation-delay: -5s;
  bottom: 132px;
}

.lead-token:nth-child(3) {
  animation-delay: -10s;
  bottom: 104px;
}

.lead-token:nth-child(4) {
  animation-delay: -14s;
  bottom: 152px;
}

.lead-token strong {
  display: block;
  margin-bottom: 5px;
  color: var(--blue-dark);
}

.lead-token span {
  display: block;
  color: var(--ink-2);
  font-size: 0.7rem;
  line-height: 1.25;
}

.lead-token.qualified {
  background: #eafff2;
}

.lead-token.packet {
  background: #fff4cf;
}

.lead-token.rejected {
  background: #ffe7e5;
}

.engine-waiting {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

@keyframes moveLead {
  0% {
    transform: translateX(0) translateY(0);
  }
  24% {
    transform: translateX(24vw) translateY(-62px);
  }
  48% {
    transform: translateX(43vw) translateY(0);
  }
  72% {
    transform: translateX(61vw) translateY(-60px);
  }
  100% {
    transform: translateX(calc(100vw + 280px)) translateY(0);
  }
}

.battle-panel {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 14px;
  padding: 16px;
  border-top: 4px solid var(--line);
  background: var(--paper);
}

.panel-label {
  display: block;
  margin-bottom: 8px;
  color: var(--blue-dark);
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  text-transform: uppercase;
}

#runSummary {
  display: block;
  font-size: 1.25rem;
  line-height: 1.1;
}

#liveTicker {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#liveTicker li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-2);
  font-weight: 800;
  line-height: 1.35;
}

#liveTicker li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--blue);
  font-family: "Press Start 2P", monospace;
  font-size: 0.62rem;
}

.metric-strip,
.process-grid,
.lead-grid {
  display: grid;
  gap: 16px;
}

.metric-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 20px 0;
}

.metric-strip article {
  padding: 18px;
  background: #fff;
}

.metric-strip span,
.pixel-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--blue-dark);
  font-family: "Press Start 2P", monospace;
  font-size: 0.57rem;
  line-height: 1.5;
  text-transform: uppercase;
}

.metric-strip strong {
  display: block;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 0.95;
}

.process-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

.pixel-card,
.analyzer-band,
.lead-band {
  padding: clamp(20px, 3vw, 30px);
}

.pixel-card h2 {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

.analyzer-band,
.lead-band {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 20px;
  background:
    linear-gradient(135deg, rgba(31, 122, 224, 0.1), rgba(214, 163, 56, 0.22)),
    var(--paper);
}

.analyzer-result {
  grid-column: 1 / -1;
  border: 3px solid var(--line);
  background: #fff;
  box-shadow: 4px 4px 0 var(--line);
  padding: 14px;
  color: var(--ink-2);
  font-weight: 900;
  line-height: 1.5;
}

.lead-form {
  display: grid;
  gap: 12px;
}

.lead-form label {
  display: grid;
  gap: 7px;
}

.lead-form span {
  color: var(--blue-dark);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.lead-form input,
.lead-form select,
.lead-form textarea {
  width: 100%;
  border: 3px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: 3px 3px 0 var(--line);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 12px;
}

.lead-form textarea {
  resize: vertical;
}

.lead-form input:focus,
.lead-form select:focus,
.lead-form textarea:focus {
  outline: 4px solid rgba(31, 122, 224, 0.28);
  outline-offset: 2px;
}

.lead-form button {
  border-radius: 0;
  justify-self: start;
}

.lead-grid {
  grid-template-columns: 1fr;
}

.buyer-band {
  background:
    linear-gradient(135deg, rgba(214, 163, 56, 0.24), rgba(31, 122, 224, 0.08)),
    var(--paper);
}

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

@media (max-width: 1040px) {
  .hero,
  .analyzer-band,
  .lead-band {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .game-screen {
    min-height: 600px;
  }
}

@media (max-width: 820px) {
  .topbar,
  .metric-strip,
  .process-grid,
  .battle-panel {
    grid-template-columns: 1fr;
  }

  .nav-actions {
    justify-content: stretch;
  }

  .nav-actions a {
    flex: 1 1 135px;
  }

  .game-screen {
    min-height: 720px;
  }

  .office-floor {
    min-height: 540px;
  }

  .stage-desk {
    width: 118px;
    min-height: 100px;
  }

  .stage-ingest {
    left: 4%;
    top: 24px;
  }

  .stage-acq {
    left: auto;
    right: 4%;
    top: 24px;
  }

  .stage-underwrite {
    left: 4%;
    top: 178px;
  }

  .stage-buyers {
    right: 4%;
    top: 178px;
  }

  .stage-dispo {
    left: 50%;
    right: auto;
    top: 330px;
    transform: translateX(-50%);
  }

  .lead-token {
    min-width: 150px;
    max-width: 170px;
    animation-name: moveLeadMobile;
  }
}

@keyframes moveLeadMobile {
  0% {
    transform: translateX(0) translateY(0);
  }
  35% {
    transform: translateX(46vw) translateY(-96px);
  }
  70% {
    transform: translateX(18vw) translateY(-235px);
  }
  100% {
    transform: translateX(calc(100vw + 230px)) translateY(-150px);
  }
}

@media (max-width: 560px) {
  .site-shell {
    width: min(100% - 18px, 1220px);
  }

  .hero-copy,
  .pixel-card,
  .analyzer-band,
  .lead-band {
    padding: 18px;
  }

  h1 {
    font-size: 2rem;
  }

  .brand {
    width: 100%;
    text-align: center;
  }

  .screen-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
