html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
}

/* The pasture fills the window above a 96 px progress strip. */
.game {
  display: grid;
  grid-template-rows: 1fr 96px;
  width: 100vw;
  height: 100vh;
}

.viewport {
  position: relative;
  min-height: 0;
}

#pasture {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#pasture.dragging {
  cursor: grabbing;
}

/* The game is lost: the pasture drains of color and dims before the lose screen. */
#pasture {
  transition: filter 1.5s ease;
}

.viewport.lost #pasture {
  filter: grayscale(0.7) brightness(0.85);
}

/* A telephoto lens darkens toward the edges. */
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgb(0 0 0 / 55%) 100%);
}

.zoom-readout {
  position: absolute;
  top: 16px;
  left: 20px;
  pointer-events: none;
  color: #fff;
  font:
    700 20px/1 ui-monospace,
    'SF Mono',
    Menlo,
    Consolas,
    monospace;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 2px rgb(0 0 0 / 80%);
}

.strip {
  display: flex;
  gap: 32px;
  align-items: center;
  padding: 0 20px;
  overflow: hidden;
  color: #fff;
  background: #1b2614;
  border-top: 2px solid #0e140a;
  font:
    700 14px/1.3 ui-monospace,
    'SF Mono',
    Menlo,
    Consolas,
    monospace;
}

.strip section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strip-level {
  font-size: 16px;
}

.strip-label {
  color: #d6ebc0;
}

.slots {
  display: flex;
  gap: 4px;
}

.slot {
  width: 14px;
  height: 14px;
  border: 2px solid #6f8a5c;
  background: transparent;
}

.horse-meter .slot.filled {
  border-color: #2f8cff;
  background: #2f8cff;
}

.strike-meter .slot {
  border-radius: 50%;
}

.strike-meter .slot.filled {
  border-color: #ff3b30;
  background: #ff3b30;
}

.strip-looked {
  flex: 1;
  min-width: 0;
}

.chips {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}

.chip {
  display: flex;
  flex: none;
  gap: 6px;
  align-items: center;
  padding: 2px 8px 2px 4px;
  background: #2a3a20;
  border: 2px solid transparent;
  font-weight: 400;
  white-space: nowrap;
}

.chip.horse {
  border-color: #2f8cff;
}

.chip.non-horse {
  border-color: #ff3b30;
}

.chip canvas {
  width: 36px;
  height: 24px;
  image-rendering: pixelated;
}

/* Full-window screens: the opening lines, level complete, and the end of the game. */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 10vw;
  color: #fff;
  background: #000;
  font:
    700 36px/1.3 system-ui,
    sans-serif;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.screen.shown {
  opacity: 1;
  pointer-events: auto;
}

.screen.intro {
  cursor: pointer;
  transition: none;
}

/* The game fades away slowly behind the end screens. */
.screen.end {
  transition: opacity 1.5s ease;
}

.screen-stats {
  display: flex;
  gap: 48px;
  font-size: 18px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 40px;
}

.stat-label {
  color: #bbb;
  font-weight: 400;
}

.screen-log {
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
  max-height: 30vh;
  overflow-y: auto;
  font:
    400 14px/1.3 ui-monospace,
    'SF Mono',
    Menlo,
    Consolas,
    monospace;
}

.horse-again {
  padding: 12px 32px;
  color: #000;
  background: #fff;
  border: none;
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}

.horse-again:hover,
.horse-again:focus-visible {
  background: #d6ebc0;
}

.screen-credits {
  color: #888;
  font-size: 13px;
  font-weight: 400;
}

/* The mute button sits at the strip's right end and stays above the full-window screens, so the
   music can be muted at any time. */
.mute {
  position: relative;
  z-index: 1;
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 0;
  color: #fff;
  background: #2a3a20;
  border: 2px solid #6f8a5c;
  cursor: pointer;
}

.mute:hover,
.mute:focus-visible {
  background: #3a4f2c;
}

.mute svg {
  width: 24px;
  height: 24px;
}

.mute .cross,
.mute[aria-pressed='true'] .waves {
  display: none;
}

.mute[aria-pressed='true'] .cross {
  display: inline;
}
