:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #6e6e73;
  --line: #e3e3e6;
  --card: #ffffff;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --move: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- End state board ---------- */

.board {
  display: grid;
  grid-template-columns: 1fr minmax(0, 440px) 1fr;
  align-items: center;
  gap: 56px;
  max-width: 1280px;
  height: 100vh;
  margin: 0 auto;
  padding: 40px 48px;
}

.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-slop { align-items: center; text-align: center; }
.col-thesis { max-width: 340px; justify-self: end; }
.col-ingredients { max-width: 300px; }

.ingredients { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.ingredient {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 14px;
}

.ingredient-art { width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: var(--card); }
.ingredient-name { font-family: var(--serif); font-size: 22px; line-height: 1.1; }
.ingredient-meta { font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.slop-frame {
  width: min(440px, 52vh);
  aspect-ratio: 1;
  border-radius: 24px;
  overflow: hidden;
  background: var(--card);
}

.slop-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 6vh, 64px);
  line-height: 1;
}

.ca {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.ca-label { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .06em; }
.ca-value { min-width: 0; font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ca-copy, .replay {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s var(--move), opacity .15s;
}

.ca-copy { flex: none; padding: 8px 16px; background: var(--ink); color: var(--bg); }
.ca-copy:active, .replay:active { transform: scale(.96); }

.ca-copy:disabled { opacity: .35; cursor: default; }

.thesis { display: flex; flex-direction: column; gap: 12px; }
.thesis p { text-wrap: pretty; }

.replay {
  align-self: flex-start;
  padding: 8px 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.replay:hover { color: var(--ink); }

/* Board pieces fade in once the mix lands */
.board .col-ingredients,
.board .col-thesis,
.board .slop-name,
.board .ca,
.board #slop-credit,
.board .slop-frame {
  transition: opacity .6s var(--move), transform .6s var(--move);
}

.is-intro .board .col-ingredients,
.is-intro .board .col-thesis,
.is-intro .board .slop-name,
.is-intro .board .ca,
.is-intro .board #slop-credit {
  opacity: 0;
  transform: translateY(8px);
}

.is-intro .board .slop-frame { opacity: 0; }

.is-done .board .slop-name { transition-delay: .1s; }
.is-done .board .ca { transition-delay: .2s; }
.is-done .board .col-ingredients { transition-delay: .35s; }
.is-done .board .col-thesis { transition-delay: .45s; }

/* ---------- The show ---------- */

.show {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.tile {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  will-change: transform, opacity, filter;
}

.tile-art { border-radius: 20px; overflow: hidden; background: var(--card); }
.tile-model { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tile-name { font-family: var(--serif); font-size: 22px; line-height: 1; margin-top: -4px; }

.goo { position: absolute; inset: 0; overflow: visible; }

.drop {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}

.flash {
  position: fixed;
  inset: 0;
  background: #111;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Idle life ---------- */

/* Tiles bob while they wait to be mixed */
.bob {
  width: 100%;
  height: 100%;
  animation: bob 1.6s cubic-bezier(.45, 0, .55, 1) infinite;
  animation-delay: calc(var(--i) * -.4s);
  transform-origin: 50% 85%;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  45% { transform: translateY(-8px) scale(.98, 1.03); }
  55% { transform: translateY(-8px) scale(.98, 1.03); }
  90% { transform: translateY(0) scale(1.03, .97); }
}

/* The slop jiggles like jelly */
.is-done .slop-frame img {
  animation: jelly 3.2s cubic-bezier(.45, 0, .55, 1) infinite 1s;
  transform-origin: 50% 90%;
}

@keyframes jelly {
  0%, 100% { transform: scale(1, 1); }
  20% { transform: scale(1.03, .97); }
  40% { transform: scale(.98, 1.03) translateY(-4px); }
  60% { transform: scale(1.02, .985); }
  80% { transform: scale(.995, 1.01); }
}

.slop-frame { cursor: pointer; }
.slop-frame:hover img { animation-duration: 1.1s; }

/* Ingredients nod along, out of step with each other */
.is-done .ingredient-art img {
  animation: bob 2.4s cubic-bezier(.45, 0, .55, 1) infinite;
  animation-delay: calc(var(--i) * -.6s);
  transform-origin: 50% 85%;
}

/* Name letters drop in one by one */
.slop-name span { display: inline-block; }
.is-done .slop-name span {
  animation: drop-in .7s cubic-bezier(.3, 1.5, .5, 1) backwards;
  animation-delay: calc(.35s + var(--i) * .06s);
}

@keyframes drop-in {
  0% { transform: translateY(-60px) rotate(-12deg); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bob, .is-done .slop-frame img, .is-done .ingredient-art img, .is-done .slop-name span { animation: none; }
}

/* ---------- Narrow screens: stack and scroll ---------- */

@media (max-width: 900px) {
  body { overflow: auto; }
  .board {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
    gap: 40px;
    padding: 32px 20px 80px;
  }
  .col-slop { order: -1; }
  .col-thesis, .col-ingredients { max-width: none; justify-self: stretch; }
  .slop-frame { width: min(100%, 420px); }
  .ingredients { gap: 10px; }
  .ingredient { grid-template-columns: 52px 1fr; gap: 10px; }
  .ingredient-art { width: 52px; height: 52px; border-radius: 12px; }
  .ingredient-name { font-size: 19px; }
  .ca { width: 100%; }
  .ca-value { flex: 1; min-width: 0; text-align: left; }
}


.tile-art, .ingredient-art { background: transparent; }

/* Clicking around Blep shouldn't select text; the CA stays selectable */
.slop-name, .slop-frame, #slop-credit, .tile, .ingredient-art { -webkit-user-select: none; user-select: none; }

/* Show the whole CA on desktop: the pill may run wider than the art column */
@media (min-width: 901px) {
  .col-slop .ca { width: max-content; max-width: calc(100vw - 40px); }
}
