:root {
  --machine-ink: #071323;
  --machine-paper: #fffaf0;
  --machine-gold: #f8c35a;
  --machine-coral: #d9563f;
  --machine-cyan: #56c9d8;
  --machine-blue: #28527a;
  --machine-muted: #a9b8c5;
}

* { box-sizing: border-box; }

.game-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.hero-stage {
  min-height: 300px;
  margin: 22px;
}

.hero-stage > img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: block;
  object-fit: cover;
}

.hero-tag {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: calc(100% - 36px);
  padding: 7px 10px;
  color: var(--machine-paper);
  background: var(--machine-ink);
  border-radius: 5px;
  font-size: .75rem;
  font-weight: 950;
  letter-spacing: .055em;
}

.intro-copy h1 {
  max-width: 780px;
  margin: 8px auto;
  font-size: clamp(2.3rem, 8vw, 5.5rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.intro-copy .eyebrow,
.intro-copy .dek,
.intro-copy .source-note,
.intro-copy > #start {
  display: block;
  width: min(100%, 760px);
  margin-inline: auto;
}

.intro-copy .dek {
  margin-block: 12px 18px;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 800;
}

.source-note {
  color: #526477;
  font-size: .8rem;
  line-height: 1.55;
}

.rule-visuals {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.rule-visuals img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 1;
  display: block;
  object-fit: contain;
  border: 1px solid var(--machine-muted);
  border-radius: 7px;
  background: #dbe6ef;
}

#play {
  --machine-column-width: min(100%, 54dvh);
  width: min(620px, calc(100% - 16px));
  height: calc(var(--hg-visual-viewport-height, 100dvh) - var(--hg-game-header-block, 76px) - 10px);
  min-height: 0;
  max-height: 900px;
  margin: 8px auto 18px;
  padding: 0;
  display: grid;
  grid-template-rows: 38px 50px minmax(0, 1fr) 38px;
  gap: 6px;
  align-content: start;
}

#play[hidden],
#result[hidden],
.result-art[hidden] {
  display: none !important;
}

.machine-status {
  width: var(--machine-column-width);
  justify-self: center;
  min-width: 0;
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  align-items: stretch;
  color: var(--machine-ink);
  background: rgba(255, 250, 240, .94);
  border: 2px solid var(--machine-ink);
  border-radius: 9px;
  overflow: hidden;
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .02em;
}

.machine-status > span {
  min-width: 0;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  line-height: 1.1;
}

.machine-status > span + span {
  border-left: 1px solid var(--machine-muted);
}

.machine-status b {
  font-size: .9rem;
  white-space: nowrap;
}

.vote-state {
  color: var(--machine-paper);
  background: var(--machine-coral);
}

#release-rail {
  position: relative;
  width: var(--machine-column-width);
  min-height: 52px;
  padding: 0;
  justify-self: center;
  overflow: hidden;
  color: var(--machine-paper);
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(20% - 2px), rgba(40,82,122,.2) calc(20% - 2px) 20%),
    #f6f8f9;
  border: 4px solid var(--machine-ink);
  border-radius: 10px;
  box-shadow: 0 5px 0 var(--machine-coral);
  font: inherit;
  font-size: .76rem;
  font-weight: 950;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .1s, box-shadow .1s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#release-rail:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--machine-ink);
}

#release-rail[aria-disabled="true"] {
  color: #526477;
  background: #dbe6ef;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.release-label {
  position: absolute;
  top: 4px;
  left: 50%;
  z-index: 3;
  min-width: 154px;
  padding: 2px 10px;
  color: var(--machine-paper);
  background: var(--machine-ink);
  border-radius: 999px;
  font-size: .67rem;
  letter-spacing: .03em;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

#release-marker {
  position: absolute;
  top: 27px;
  bottom: 3px;
  left: 50%;
  width: 30px;
  border: 3px solid var(--machine-ink);
  border-radius: 5px 5px 9px 9px;
  background: var(--machine-coral);
  box-shadow: 2px 2px 0 rgba(7, 19, 35, .22);
  transform: translateX(-50%);
  pointer-events: none;
}

#release-marker::after {
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 0;
  height: 0;
  border-top: 9px solid var(--machine-ink);
  border-right: 8px solid transparent;
  border-left: 8px solid transparent;
  content: "";
  transform: translateX(-50%);
}

.machine-stage {
  position: relative;
  width: var(--machine-column-width);
  height: 100%;
  max-width: 100%;
  margin-inline: auto;
  min-height: 0;
  aspect-ratio: 7 / 9;
  overflow: hidden;
  background: var(--machine-paper);
  border: 4px solid var(--machine-ink);
  border-radius: 16px;
  box-shadow: 0 6px 0 rgba(7,19,35,.2);
  isolation: isolate;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.machine-world,
.machine-stage canvas,
.progress-layer,
.shutter-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.machine-world {
  z-index: 0;
  display: block;
}

.progress-layer {
  z-index: 1;
  pointer-events: none;
}

.bay-progress {
  opacity: 0;
  transition: opacity .18s;
}

.bay-progress[data-live="true"] {
  opacity: 1;
}

#machine-canvas {
  z-index: 3;
  display: block;
  pointer-events: none;
}

.shutter-layer {
  z-index: 4;
  pointer-events: none;
}

.shutter {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center bottom;
  transform: translateY(55px);
  transition: opacity .12s, transform .2s cubic-bezier(.2,.9,.25,1.2);
}

.shutter[data-raised="true"] {
  opacity: 1;
  transform: translateY(0);
}

.strain {
  opacity: 0;
}

.strain[data-visible="true"] {
  opacity: 1;
}

.feedback {
  width: var(--machine-column-width);
  justify-self: center;
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  color: var(--machine-ink);
  background: rgba(255,255,255,.9);
  border: 0;
  border-left: 5px solid var(--machine-cyan);
  border-radius: 7px;
  box-shadow: 0 2px 0 rgba(7,19,35,.13);
  font-size: .73rem;
  font-weight: 800;
  line-height: 1.25;
  pointer-events: none;
}

.feedback[data-cue="warning"] {
  border-left-color: var(--machine-coral);
}

.feedback[data-cue="success"] {
  border-left-color: var(--machine-gold);
}

#result {
  width: min(100% - 16px, 980px);
  margin: 12px auto 28px;
  padding: clamp(16px, 3vw, 30px);
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(280px, .95fr);
  gap: 28px;
  align-items: center;
  color: var(--machine-ink);
  background: var(--machine-paper);
  border: 4px solid var(--machine-ink);
  border-radius: 24px;
  box-shadow: 0 9px 0 rgba(7,19,35,.18);
}

.result-art {
  overflow: hidden;
  border: 4px solid var(--machine-ink);
  border-radius: 16px;
  box-shadow: 7px 7px 0 rgba(7,19,35,.2);
}

.result-art img {
  width: 100%;
  height: auto;
  display: block;
}

.result-copy h2 {
  margin: 6px 0;
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: .98;
  letter-spacing: -.045em;
}

.score-line {
  margin: 10px 0 2px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.score-line strong {
  font-size: clamp(3rem, 10vw, 6.5rem);
  line-height: .9;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.result-stats span {
  padding: 8px 6px;
  color: var(--machine-ink);
  background: #fff;
  border-left: 4px solid var(--machine-cyan);
  border-radius: 6px;
  font-size: .72rem;
  text-align: center;
}

.result-stats b {
  display: block;
  font-size: 1.05rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.news-links,
.editorial-info {
  line-height: 1.6;
}

.news-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: .82rem;
}

.editorial-info {
  width: min(calc(100% - 28px), 920px);
  margin: 20px auto 40px;
  padding: 18px;
  color: var(--machine-ink);
  background: rgba(255,255,255,.75);
  border-left: 6px solid var(--machine-coral);
  border-radius: 9px;
}

.editorial-info h2 {
  margin-top: 0;
}

.editorial-info a {
  color: var(--machine-blue);
  font-weight: 800;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body.hg-game-active {
  overflow: hidden;
}

@media (max-width: 680px) {
  .hero-stage {
    min-height: 184px;
    margin: 10px;
  }

  .hero-stage > img {
    min-height: 184px;
  }

  .hero-tag {
    left: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
    font-size: .64rem;
  }

  .rule-visuals {
    grid-template-columns: 1fr;
  }

  .intro-copy h1 {
    font-size: clamp(2.25rem, 13vw, 3.35rem);
  }

  #play {
    --machine-column-width: min(100%, 54dvh);
    width: calc(100% - 12px);
    height: calc(var(--hg-visual-viewport-height, 100dvh) - var(--hg-game-header-block, 64px) - 10px);
    min-height: 0;
    max-height: 576px;
    margin-top: 4px;
    grid-template-rows: 34px 52px minmax(0, 1fr) 38px;
    gap: 4px;
  }

  .machine-stage {
    width: auto;
    height: 100%;
    max-width: 100%;
    margin-inline: auto;
    aspect-ratio: 7 / 9;
  }

  .machine-status {
    font-size: .59rem;
  }

  .machine-status b {
    font-size: .8rem;
  }

  #release-rail {
    min-height: 52px;
    border-width: 3px;
    font-size: .7rem;
  }

  .feedback {
    min-height: 38px;
    padding-block: 4px;
    font-size: .67rem;
  }

  #result {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .result-copy h2 {
    font-size: 2.5rem;
  }

  .actions > * {
    flex: 1 1 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 355px) {
  .machine-status .vote-state {
    font-size: .53rem;
  }

  .machine-status > span {
    padding-inline: 3px;
  }
}

@media (orientation: landscape) and (max-height: 420px) {
  #play {
    --machine-column-width: 100%;
    max-width: none;
    grid-template-columns: minmax(230px, .9fr) minmax(230px, 1.1fr);
    grid-template-rows: 34px 48px minmax(0, 1fr) 38px;
    column-gap: 8px;
  }

  .machine-status {
    grid-column: 1;
    grid-row: 1;
  }

  #release-rail {
    grid-column: 1;
    grid-row: 2;
  }

  .machine-stage {
    grid-column: 2;
    grid-row: 1 / 5;
    width: auto;
  }

  .feedback {
    grid-column: 1;
    grid-row: 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bay-progress,
  .shutter {
    transition: none;
  }
}
