:root {
  --paper: #fff4dc;
  --paper-2: #ffe9b8;
  --ink: #1c1630;
  --mute: #5c5470;
  --pop: #ff5a36;
  --lemon: #ffe56b;
  --sky: #6ec8ff;
  --mint: #7ce0b8;
  --grape: #7b5cff;
  --cream: #fff8ee;
  --shadow: 4px 5px 0 var(--ink);
  --display: "Caprasimo", "Cooper Black", "Arial Black", serif;
  --hand: "Shantell Sans", "Trebuchet MS", sans-serif;
  --pad: max(18px, env(safe-area-inset-left));
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--hand);
}

body {
  background:
    radial-gradient(circle at 12% 18%, #ffe9a8 0 18%, transparent 42%),
    radial-gradient(circle at 88% 8%, #ffc9b8 0 16%, transparent 40%),
    radial-gradient(circle at 80% 86%, #bfe9ff 0 20%, transparent 44%),
    var(--paper);
}

.blobs,
.dots {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 46% 54% 58% 42%;
  opacity: 0.55;
  animation: blob 14s ease-in-out infinite;
}

.blob.coral {
  width: 42vw;
  height: 42vw;
  max-width: 280px;
  max-height: 280px;
  background: #ff8a6e;
  top: -8%;
  right: -10%;
}

.blob.sky {
  width: 36vw;
  height: 36vw;
  max-width: 220px;
  max-height: 220px;
  background: var(--sky);
  bottom: 8%;
  left: -12%;
  animation-delay: -4s;
}

.blob.mint {
  width: 28vw;
  height: 28vw;
  max-width: 160px;
  max-height: 160px;
  background: var(--mint);
  top: 42%;
  right: -8%;
  animation-delay: -8s;
}

.blob.grape {
  width: 22vw;
  height: 22vw;
  max-width: 120px;
  max-height: 120px;
  background: var(--grape);
  top: 12%;
  left: 4%;
  opacity: 0.28;
  animation-delay: -2s;
}

.dots {
  opacity: 0.35;
  background-image: radial-gradient(var(--ink) 1.1px, transparent 1.2px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top)) var(--pad) calc(22px + env(safe-area-inset-bottom));
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
}

input {
  width: 100%;
  background: var(--cream);
  border: 3px solid var(--ink);
  color: var(--ink);
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

input:focus {
  outline: 3px solid var(--pop);
  outline-offset: 2px;
}

input::placeholder {
  color: #9a90b0;
  font-weight: 400;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.brand {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.03em;
  transform: rotate(-3deg);
  color: var(--pop);
  text-shadow: 2px 2px 0 var(--ink);
}

.meta {
  font-size: 13px;
  font-weight: 700;
  color: var(--mute);
}

.ghost {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  min-height: 44px;
  padding: 0 8px;
  text-decoration: underline wavy var(--pop);
  text-underline-offset: 4px;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: min(560px, 100%);
  margin: 0 auto;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.4rem, 18vw, 6rem);
  letter-spacing: -0.04em;
  line-height: 0.86;
  text-align: center;
  transform: rotate(-2deg);
  text-shadow: 4px 5px 0 #fff, 7px 8px 0 var(--ink);
}

.lede {
  margin: 0;
  text-align: center;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.15rem, 4.6vw, 1.5rem);
  color: var(--mute);
  max-width: 24ch;
  line-height: 1.3;
}

.pips {
  display: flex;
  gap: 14px;
  margin: 6px 0 2px;
}

.pip {
  width: 22px;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
  animation: bob 2.4s ease-in-out infinite;
}

.pip:nth-child(1) {
  background: var(--pop);
}
.pip:nth-child(2) {
  background: var(--lemon);
  animation-delay: 0.2s;
}
.pip:nth-child(3) {
  background: var(--sky);
  animation-delay: 0.4s;
}
.pip:nth-child(4) {
  background: var(--mint);
  animation-delay: 0.6s;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, 100%);
}

.btn {
  min-height: 54px;
  padding: 0 18px;
  background: var(--pop);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translate(3px, 4px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn.secondary {
  background: var(--cream);
  color: var(--ink);
}

.btn.danger {
  background: var(--grape);
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  transform: none;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, 100%);
}

.code-input {
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.28em;
  font-family: var(--display);
  font-size: 26px;
}

.stamp {
  font-family: var(--display);
  font-size: clamp(2.2rem, 12vw, 3.8rem);
  letter-spacing: 0.12em;
  color: var(--ink);
  background: var(--lemon);
  border: 3px dashed var(--ink);
  border-radius: 28px;
  padding: 14px 14px 10px;
  line-height: 1;
  text-align: center;
  transform: rotate(-2deg);
  box-shadow: var(--shadow);
}

.row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.row .btn {
  flex: 1;
}

.row .who-inline {
  flex: 1.4;
  align-self: center;
  font-size: 1.1rem;
  font-weight: 800;
}

.seats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.seat {
  min-height: 96px;
  border: 3px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  border-radius: 28px 22px 32px 18px;
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt, -2deg));
}

.seat:nth-child(1) {
  --tilt: -3deg;
  background: var(--lemon);
}
.seat:nth-child(2) {
  --tilt: 2.4deg;
  background: #ffb7a8;
}
.seat:nth-child(3) {
  --tilt: -1.8deg;
  background: #b3e7ff;
}
.seat:nth-child(4) {
  --tilt: 3.1deg;
  background: #c9f7c4;
}

.seat.you {
  outline: 3px dashed var(--pop);
  outline-offset: 3px;
}

.seat.saw {
  box-shadow: 6px 7px 0 var(--pop);
}

.seat.out {
  opacity: 0.42;
  filter: grayscale(0.4);
}

.seat.turn {
  animation: pulse 1.1s ease-in-out infinite;
}

.seat .who {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.seat .tag {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mute);
}

.seat.saw .tag {
  color: var(--pop);
}

.seen-slip {
  width: min(280px, 86vw);
  background: var(--lemon);
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 12px 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: rotate(2deg);
  box-shadow: var(--shadow);
}

.seen-slip .eyebrow,
.seen-slip .foot {
  color: var(--ink);
}

.seen-slip b {
  font-family: var(--display);
  font-size: clamp(1.6rem, 6vw, 2.3rem);
  line-height: 1;
}

.card {
  width: min(280px, 86vw);
  aspect-ratio: 2.45 / 3.5;
  background: var(--cream);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 26px;
  box-shadow:
    8px 10px 0 var(--ink),
    0 0 0 10px var(--lemon);
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  transform: rotate(-2.5deg);
  animation: pop-in 0.55s cubic-bezier(0.2, 1.4, 0.3, 1) both;
}

.card.blank {
  background: var(--ink);
  color: var(--cream);
  box-shadow:
    8px 10px 0 var(--pop),
    0 0 0 10px var(--grape);
}

.eyebrow,
.foot {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}

.card.blank .eyebrow,
.card.blank .foot {
  color: var(--lemon);
}

.word {
  font-family: var(--display);
  font-size: clamp(2.2rem, 10vw, 3.3rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.word.nothing {
  font-family: var(--hand);
  font-style: italic;
  font-size: 1.8rem;
  color: var(--mute);
}

.hint {
  margin: 0;
  text-align: center;
  max-width: 34ch;
  color: var(--mute);
  font-size: 1.05rem;
  line-height: 1.4;
}

.clues {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 3px 3px 0 var(--ink);
}

.slip b {
  font-family: var(--display);
  font-weight: 400;
}

.slip .who {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--mute);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  background: var(--ink);
  color: var(--lemon);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: min(92vw, 420px);
  box-shadow: var(--shadow);
}

.how {
  width: min(440px, 100%);
  color: var(--mute);
  font-size: 1.08rem;
  line-height: 1.45;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 28px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
}

.how h2 {
  font-family: var(--display);
  font-size: 2rem;
  margin: 0 0 12px;
  color: var(--ink);
}

.how ol {
  margin: 0;
  padding-left: 1.15em;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fine {
  font-size: 13px;
  font-weight: 700;
  color: var(--mute);
  text-align: center;
}

.winner {
  text-align: center;
}

.winner h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  transform: rotate(-2deg);
}

.reveal-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reveal-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 12px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 700;
}

.role {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pop);
}

@keyframes bob {
  50% {
    transform: translateY(-7px);
  }
}

@keyframes blob {
  50% {
    border-radius: 58% 42% 46% 54%;
    transform: translate(8px, -10px) rotate(8deg);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(28px) rotate(-12deg) scale(0.86);
  }
  to {
    opacity: 1;
    transform: rotate(-2.5deg) scale(1);
  }
}

@keyframes pulse {
  50% {
    transform: rotate(var(--tilt, 0deg)) scale(1.04);
  }
}

@media (min-width: 720px) {
  .seats {
    grid-template-columns: repeat(4, 1fr);
  }
}
