/* Bulíky — a pasture at dusk in the style of an old pub poster: a sly bull behind a fence. */

@font-face {
  font-family: 'Alfa Slab One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/alfa-slab-one-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20C4;
}
@font-face {
  font-family: 'Alfa Slab One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/alfa-slab-one-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/figtree-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20C4;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/figtree-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  --outline: #1d1b26;
  --grass: #1f4a3a;
  --grass-deep: #16362b;
  --card: #f8f0dc;
  --card-dim: #e8dec4;
  --cream: #f3e7cb;
  --gold: #e6b04a;
  --gold-deep: #c28d2c;
  --red: #b23f2b;
  --red-pale: #f3d6ca;
  --green: #2f7a50;
  --green-pale: #d3e8c6;
  --ink-soft: #5b5a69;

  --font-display: 'Alfa Slab One', Rockwell, Georgia, serif;
  --font-text: 'Figtree', system-ui, sans-serif;

  --border: 2px solid var(--outline);
  --radius: 10px;
  --drop: 0 3px 0 var(--outline);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --scene-h: 205px;
  --issue-top: 3.4rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--grass-deep);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--outline);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.45;
  background:
    radial-gradient(circle at 12% 30%, #1a4031 0 3px, transparent 4px) 0 0 / 46px 52px,
    radial-gradient(circle at 70% 75%, #1a4031 0 2px, transparent 3px) 0 0 / 38px 44px,
    var(--grass-deep);
}

/* Short phones: a lower scene, so all four answers fit without scrolling. */
@media (max-height: 700px) and (max-width: 47.99rem) {
  :root {
    --scene-h: 182px;
  }
}

body[data-view='intro'] {
  --scene-h: clamp(270px, 40dvh, 340px);
  --issue-top: clamp(5.4rem, 24vw, 6.6rem);
}

.defs {
  position: absolute;
}

[hidden] {
  display: none !important;
}

.world {
  position: relative;
  width: min(100%, 30rem);
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--grass);
}

@media (min-width: 30.5rem) {
  .world {
    border-inline: var(--border);
  }
}

/* On phones the page is the meadow itself, so nothing darker shows under the last screen. */
@media (max-width: 30.49rem) {
  html,
  body {
    background: var(--grass);
  }
}

/* ---------- Scene ---------- */

.scene {
  position: relative;
  height: var(--scene-h);
  overflow: hidden;
  border-bottom: var(--border);
  transition: height 0.45s var(--ease-out);
}

.scene__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cloud--a {
  animation: drift 38s linear infinite alternate;
}

.cloud--b {
  animation: drift 52s linear infinite alternate-reverse;
}

.bull__horn {
  fill: var(--cream);
  stroke: var(--outline);
  stroke-width: 4;
  stroke-linejoin: round;
}

.bull__ear ellipse {
  fill: #8c3222;
  stroke: var(--outline);
  stroke-width: 4;
}

.eye {
  fill: #fff;
  stroke: var(--outline);
  stroke-width: 3.5;
}

.pupil {
  fill: var(--outline);
}

.brow,
.squint {
  fill: none;
  stroke: var(--outline);
  stroke-width: 5;
  stroke-linecap: round;
}

.eyes,
.hit {
  display: none;
}

.scene[data-hits='1'] .hit--1,
.scene[data-hits='2'] :is(.hit--1, .hit--2),
.scene[data-hits='3'] :is(.hit--1, .hit--2, .hit--3),
.scene[data-hits='4'] :is(.hit--1, .hit--2, .hit--3, .hit--4),
.scene[data-hits='5'] .hit {
  display: block;
}

.stars {
  transform-box: fill-box;
  transform-origin: center;
  animation: wobble 1.6s ease-in-out infinite;
}

.scene[data-mood='idle'] .eyes--idle,
.scene[data-mood='laugh'] .eyes--laugh,
.scene[data-mood='shock'] .eyes--shock {
  display: block;
}

.eyes__blink {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 5.5s infinite;
}

.bull__bob {
  animation: breathe 3.6s ease-in-out infinite;
}

.scene[data-mood='laugh'] .bull__bob {
  animation: laugh 0.36s ease-in-out 5;
}

.scene[data-mood='shock'] .bull__bob {
  animation: recoil 0.5s var(--ease-out) both;
}

.bull__ring {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: swing 2.8s ease-in-out infinite;
}

.bull__ear {
  transform-box: fill-box;
}

.bull__ear--left {
  transform-origin: 100% 50%;
  animation: flick 6.5s infinite;
}

.logo {
  position: absolute;
  top: 0.2rem;
  left: 1rem;
  padding-block: 0.4rem;
  color: var(--card);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-shadow: 0 2px 0 var(--outline), 0 0 18px rgb(29 27 38 / 0.35);
  transition: font-size 0.45s var(--ease-out);
}

body[data-view='intro'] .logo {
  font-size: clamp(2.9rem, 14.5vw, 3.8rem);
  top: 0.5rem;
}

.issue {
  position: absolute;
  top: var(--issue-top);
  left: 1rem;
  margin: 0;
  padding: 0.05rem 0.6rem;
  border: 2px solid var(--outline);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.8rem;
  font-weight: 800;
  transition: top 0.45s var(--ease-out);
}

.issue:empty {
  display: none;
}

.bubble {
  position: absolute;
  left: 1rem;
  /* Hangs under the issue pill and grows downwards, so long lines never cover it. */
  top: calc(var(--issue-top) + 2.15rem);
  width: min(47%, 12.5rem);
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: var(--border);
  border-radius: 10px;
  background: #fff;
  font-weight: 800;
  font-size: 0.98rem;
  line-height: 1.25;
  box-shadow: 0 4px 0 var(--outline);
  transform-origin: 100% 60%;
}

.bubble:empty {
  display: none;
}

.bubble::after {
  content: '';
  position: absolute;
  right: -11px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-top: var(--border);
  border-right: var(--border);
  background: #fff;
  transform: rotate(45deg);
}

.bubble--pop {
  animation: pop 0.4s var(--ease-out) both;
}

/* ---------- Stage ---------- */

.stage {
  position: relative;
  padding: 0 1rem 3.5rem;
}

.screen > * {
  animation: rise 0.45s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.loading,
.failure {
  margin: 0;
  padding-top: 2rem;
  color: var(--cream);
  font-weight: 800;
  text-align: center;
}

.board {
  position: relative;
  margin-top: -1.35rem;
  padding: 0.75rem 1.1rem 0.9rem;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--drop);
}

.board__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.1rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.headword {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 11vw, 3rem);
  line-height: 1.12;
  letter-spacing: 0.005em;
  overflow-wrap: anywhere;
}

.headword--long {
  font-size: clamp(1.8rem, 8.6vw, 2.5rem);
}

.kind {
  margin: 0;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ink-soft);
}

.board__text {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.dots {
  display: flex;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dot {
  display: grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
  border: 2px solid var(--outline);
  border-radius: 50%;
  background: var(--card-dim);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.dot--current {
  background: var(--gold);
}

.dot--right {
  background: var(--green);
}

.dot--wrong {
  background: var(--red);
}

.dots--big .dot {
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.05rem;
}

.onGrass {
  margin: 1.1rem 0.15rem 0;
  color: var(--cream);
  font-weight: 700;
}

.onGrass strong {
  color: #fff;
  font-weight: 900;
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.6rem;
  padding: 0.5rem 1.3rem 0.35rem;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--outline);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.1;
  cursor: pointer;
  box-shadow:
    inset 0 -3px 0 var(--gold-deep),
    0 4px 0 var(--outline);
  transition:
    transform 0.12s var(--ease-out),
    box-shadow 0.12s var(--ease-out);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 -3px 0 var(--gold-deep),
    0 5px 0 var(--outline);
}

.button:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 -2px 0 var(--gold-deep),
    0 1px 0 var(--outline);
}

.button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.button--quiet {
  width: auto;
  min-height: 2.9rem;
  padding: 0.3rem 0.5rem;
  border-color: transparent;
  background: none;
  box-shadow: none;
  color: var(--cream);
  font-family: var(--font-text);
  font-size: 1rem;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.button--quiet:hover,
.button--quiet:active {
  transform: none;
  box-shadow: none;
  color: #fff;
}

:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--outline);
}

.actions {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  margin-top: 1.4rem;
}

.actions--sticky {
  position: sticky;
  bottom: 0;
  margin-inline: -1rem;
  padding: 0.75rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--grass) 70%, transparent);
}

/* ---------- Intro ---------- */

.steps {
  display: grid;
  gap: 0.6rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.3rem 1fr;
  align-items: center;
  gap: 0.75rem;
  color: var(--cream);
  font-weight: 700;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding-top: 0.15rem;
  border: var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--outline);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.2rem;
  box-shadow: 0 3px 0 var(--outline);
}

.steps strong {
  color: #fff;
  font-weight: 900;
}

/* ---------- Motion ---------- */

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 12px;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    scale: 0.6;
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    scale: 2.1;
    rotate: -10deg;
  }
}

@keyframes cheer {
  40% {
    scale: 1.03;
  }
}

@keyframes shake {
  20%,
  60% {
    translate: -5px 0;
  }
  40%,
  80% {
    translate: 5px 0;
  }
}

@keyframes drift {
  from {
    transform: translateX(-14px);
  }
  to {
    transform: translateX(26px);
  }
}

@keyframes breathe {
  50% {
    transform: translateY(2.5px);
  }
}

@keyframes laugh {
  50% {
    transform: translateY(-7px) rotate(-2deg);
  }
}

@keyframes recoil {
  30% {
    transform: translate(5px, -6px) rotate(3deg);
  }
}

@keyframes wobble {
  0%,
  100% {
    transform: rotate(-9deg) translateY(0);
  }
  50% {
    transform: rotate(9deg) translateY(-3px);
  }
}

@keyframes blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  97% {
    transform: scaleY(0.08);
  }
}

@keyframes swing {
  0%,
  100% {
    transform: rotate(-7deg);
  }
  50% {
    transform: rotate(7deg);
  }
}

@keyframes flick {
  0%,
  90%,
  100% {
    transform: rotate(0);
  }
  93% {
    transform: rotate(-16deg);
  }
  96% {
    transform: rotate(6deg);
  }
}

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