@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --bg: #000;
  --text: #fff;
  --muted: #e2e2e2;
  --soft: rgba(255, 255, 255, 0.62);
  --yellow: #fff989;
  --green: #59ac51;
  --red: #c75555;
  --overlay: rgba(0, 0, 0, 0.6);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px;
}

a {
  color: var(--yellow);
}

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
.card:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

/* Buttons: outlined white pills that fill on hover, green for the main action */

.button {
  min-width: 12.5rem;
  padding: 0.7rem 1.6rem;
  border: 0.125rem solid #fff;
  border-radius: 2.5rem;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0.9375rem 2.5rem rgba(0, 0, 0, 0.1);
  transition: background 0.1s ease-in, color 0.1s ease-in, transform 0.1s ease-in;
}

.button:active {
  transform: scale(0.95);
}

.button.go {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

/* Only real pointers get hover, touch screens keep it stuck after a tap */
@media (hover: hover) {
  .button:hover {
    background: #fff;
    color: #000;
  }

  .button.go:hover {
    background: var(--green);
    color: #fff;
    filter: brightness(1.08);
  }
}

/* Play triangle after the label */
.button.play::after {
  content: "";
  display: inline-block;
  margin-left: 10px;
  border-style: solid;
  border-width: 0.4rem 0 0.4rem 0.6rem;
  border-color: transparent transparent transparent #fff;
}

.button:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* Poster wall behind the start and result screens */

.wall {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.wall::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.4) 80%);
}

.wall-tiles {
  position: absolute;
  inset: -25%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  align-content: start;
  transform: rotate(-8deg);
  animation: drift 60s linear infinite alternate;
}

.wall-tiles span {
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  animation: tile-in 0.8s ease-out both;
}

@keyframes tile-in {
  from {
    opacity: 0;
  }
}

body[data-screen="round"] .wall,
body[data-screen="round"] footer {
  display: none;
}

/* Start */

.start {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.logo {
  margin: 0 0 10px;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.logo span {
  color: var(--yellow);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}

.intro {
  margin: 12px 0 28px;
  color: var(--muted);
  font-size: 1.15rem;
}

.error {
  margin: 14px 0 0;
  color: var(--red);
  font-weight: 800;
}

.disclaimer {
  max-width: 440px;
  margin: 32px auto 0;
  color: var(--soft);
  font-size: 0.85rem;
}

/* Round: two full height halves, like a split screen */

.round {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: #000;
  overflow: hidden;
}

.progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
}

#progress-bar {
  height: 100%;
  width: 0;
  background: var(--yellow);
  transition: width 0.4s ease-out;
}

.round-bar {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  font-weight: 800;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

@media (orientation: portrait) {
  .board {
    grid-template-columns: none;
    grid-template-rows: 1fr 1fr;
  }
}

.card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background: #111;
  color: #fff;
  text-align: center;
  cursor: pointer;
}

.card-art {
  position: absolute;
  inset: 0;
  transition: transform 0.6s ease, filter 0.3s ease;
}

.card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay);
  transition: background 0.3s ease;
}

/* Genre posters are darker already, so they need less overlay */
.card-art.no-image::after {
  background: rgba(0, 0, 0, 0.3);
}

.card-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 90%;
  padding: 24px 12px;
  transition: opacity 0.3s ease;
}

.card-genre {
  color: var(--yellow);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-title {
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
  cursor: text;
}

.card-title::before {
  content: "\201C";
}

.card-title::after {
  content: "\201D";
}

.card-pick {
  margin-top: 14px;
  min-width: 10rem;
  padding: 0.55rem 1.4rem;
  border: 0.125rem solid #fff;
  border-radius: 2.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  transition: background 0.1s ease-in, color 0.1s ease-in;
}

@media (hover: hover) {
  .card:hover .card-art {
    transform: scale(1.04);
  }

  .card:hover .card-pick {
    background: #fff;
    color: #000;
  }
}

.card:active .card-pick {
  transform: scale(0.95);
}

.card.chosen .card-art::after {
  background: rgba(0, 0, 0, 0.2);
}

.card.chosen .card-pick {
  background: #fff;
  color: #000;
}

.card.chosen .card-title {
  animation: pop 0.45s ease;
}

.card.dimmed .card-art {
  filter: grayscale(1) brightness(0.45);
}

.card.dimmed .card-body {
  opacity: 0.35;
}

.vs {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: 3.5rem;
  height: 3.5rem;
  margin: -1.75rem 0 0 -1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 1.25rem;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.vs-check {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  transform: scale(0);
}

.vs-check svg {
  width: 55%;
  fill: none;
  stroke: #fff;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
}

.vs.win .vs-check {
  animation: pop-in 0.35s cubic-bezier(0.3, 1.6, 0.6, 1) forwards;
}

.vs.win .vs-check svg {
  animation: draw 0.3s 0.15s ease forwards;
}

/* Two rings that ripple out of the circle on a pick */
.vs::before,
.vs::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid var(--green);
  border-radius: 50%;
  opacity: 0;
}

.vs.win::before {
  animation: ripple 0.7s ease-out;
}

.vs.win::after {
  animation: ripple 0.7s 0.15s ease-out;
}

.spark {
  position: fixed;
  z-index: 20;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  pointer-events: none;
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Result */

.result {
  text-align: center;
  padding-top: 7vh;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: fade-up 0.5s both;
}

#result-label {
  margin: 4px 0 14px;
  font-size: clamp(3.2rem, 15vw, 6rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  outline: none;
}

#result-label.landed {
  color: var(--yellow);
  text-shadow: 0 0 48px rgba(255, 249, 137, 0.35);
  animation: land 0.6s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}

#result-text {
  max-width: 480px;
  margin: 0 auto;
  font-size: 1.15rem;
}

.actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

/* Share menu */

.share-dialog {
  width: min(26rem, calc(100% - 32px));
  padding: 0;
  border: 0.125rem solid #fff;
  border-radius: 1.5rem;
  background: #111;
  color: var(--text);
}

.share-dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

/* The padding sits here, so a click on the dialog element itself is a click outside the menu */
.share-body {
  display: grid;
  gap: 12px;
  padding: 26px 20px 20px;
  text-align: center;
}

.share-body h2 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.share-preview {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

.share-dialog .button {
  min-width: 0;
  padding: 0.55rem 0.8rem;
  font-size: 1rem;
  text-decoration: none;
}

.share-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 8px;
}

.share-hint {
  margin: -4px 0 0;
  color: var(--soft);
  font-size: 0.9rem;
}

.share-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

/* Text and buttons wait until the verdict has landed */
.result.rolling .reveal {
  visibility: hidden;
}

.result:not(.rolling) .reveal {
  animation: fade-up 0.5s both;
  animation-delay: calc(var(--i, 0) * 120ms + 150ms);
}

/* The result GIF or picture pops in right under the verdict */
.result-media {
  display: flex;
  justify-content: center;
  margin: 4px 0 22px;
}

.result-media > * {
  display: block;
  max-width: min(100%, 520px);
  max-height: min(32vh, 340px);
  border-radius: 14px;
  background: #111;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}

.result:not(.rolling) .reveal.result-media {
  animation: media-pop 0.6s cubic-bezier(0.2, 0.8, 0.3, 1.25) 150ms both;
}

/* Clear distance from the buttons so nobody hits the ad by accident */
.ad-slot {
  width: 300px;
  height: 250px;
  margin: 56px auto 0;
  overflow: hidden;
}

/* Footer and text pages */

footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 20px 16px 28px;
  font-size: 0.85rem;
}

footer a {
  color: var(--soft);
  text-decoration: none;
}

footer a:hover {
  color: #fff;
}

.page h1 {
  margin: 8px 0 16px;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
}

.page h2 {
  margin: 28px 0 6px;
  font-size: 1.15rem;
}

.page p,
.page li {
  color: var(--muted);
}

.page .back {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 800;
  text-decoration: none;
}

/* Animations */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  40% {
    transform: scale(1.12);
  }
}

@keyframes pop-in {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes ripple {
  from {
    opacity: 0.9;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(3.2);
  }
}

@keyframes land {
  0% {
    transform: scale(1.7);
    opacity: 0.4;
  }
  60% {
    transform: scale(0.94);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes media-pop {
  from {
    opacity: 0;
    transform: scale(0.5) rotate(-4deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes drift {
  to {
    transform: rotate(-8deg) translateY(-8%);
  }
}

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