:root {
  color-scheme: light;
  --bg: #f4f1e8;
  --ink: #171614;
  --muted: #6a655c;
  --line: #d8d0bf;
  --button: #ff4d2d;
  --button-dark: #21110d;
  --blue: #2d7cff;
  --yellow: #ffd43b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

button {
  font: inherit;
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100vw;
  height: 100svh;
  min-height: 520px;
  padding: max(22px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(23, 22, 20, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(23, 22, 20, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 82% 12%, rgba(255, 212, 59, 0.6), transparent 24%),
    linear-gradient(180deg, #fbf9f1 0%, var(--bg) 100%);
  background-size: 30px 30px, 30px 30px, auto, auto;
}

.top {
  z-index: 2;
  display: grid;
  gap: 10px;
}

.eyebrow {
  width: max-content;
  margin: 0;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(43px, 14vw, 68px);
  line-height: 0.92;
  letter-spacing: 0;
}

.message {
  min-height: 50px;
  max-width: 21rem;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.arena {
  position: relative;
  margin: 12px 0;
  border: 2px solid rgba(23, 22, 20, 0.1);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(45, 124, 255, 0.12), transparent 34%),
    rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.76);
  overflow: hidden;
}

.arena::before {
  content: "여기 안에 있음";
  position: absolute;
  left: 14px;
  top: 12px;
  color: rgba(23, 22, 20, 0.38);
  font-size: 12px;
  font-weight: 800;
}

.runaway-button {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 132px;
  height: 56px;
  border: 0;
  border-radius: 8px;
  background: var(--button);
  color: white;
  font-size: 18px;
  font-weight: 950;
  box-shadow:
    0 14px 0 var(--button-dark),
    0 22px 34px rgba(33, 17, 13, 0.22);
  transform: translate(-50%, -50%);
  transition:
    left 170ms cubic-bezier(0.2, 1.55, 0.32, 1),
    top 170ms cubic-bezier(0.2, 1.55, 0.32, 1),
    width 150ms ease,
    transform 90ms ease,
    background 150ms ease;
  will-change: left, top, transform;
}

.runaway-button.is-small {
  width: 104px;
  height: 48px;
  font-size: 15px;
}

.runaway-button.is-tiny {
  width: 82px;
  height: 42px;
  font-size: 13px;
}

.runaway-button.is-smug {
  background: var(--blue);
  box-shadow:
    0 14px 0 #111d39,
    0 22px 34px rgba(17, 29, 57, 0.24);
}

.runaway-button.is-fake {
  transform: translate(-50%, -50%) scale(0.88) rotate(-3deg);
}

.runaway-button.is-spin {
  transform: translate(-50%, -50%) rotate(8deg);
}

.decoy-button {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 132px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 77, 45, 0.42);
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
}

.decoy-button.show {
  animation: decoyFade 620ms ease-out forwards;
}

.ghost-tap {
  position: absolute;
  width: 54px;
  aspect-ratio: 1;
  border: 3px solid rgba(255, 77, 45, 0.55);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.5);
}

.ghost-tap.show {
  animation: tapRing 360ms ease-out;
}

.toast {
  position: absolute;
  left: 50%;
  top: 16px;
  z-index: 3;
  width: min(88%, 330px);
  padding: 12px 14px;
  border: 1px solid rgba(23, 22, 20, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  text-align: center;
  box-shadow: 0 16px 34px rgba(23, 22, 20, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -16px);
}

.toast.show {
  animation: toastDrop 1400ms ease forwards;
}

.scoreboard {
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.scoreboard div {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.scoreboard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.scoreboard strong {
  display: block;
  margin-top: 2px;
  font-size: 26px;
  line-height: 1;
}

.stage.rage {
  animation: annoyed 120ms steps(2, end) 3;
}

.stage.insult .eyebrow {
  background: var(--yellow);
  color: #1f1b08;
}

@keyframes tapRing {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.7);
  }
}

@keyframes decoyFade {
  0% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.64) rotate(11deg);
  }
}

@keyframes toastDrop {
  0% {
    opacity: 0;
    transform: translate(-50%, -16px);
  }
  12%,
  78% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
}

@keyframes annoyed {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-5px, 3px); }
  50% { transform: translate(4px, -3px); }
  75% { transform: translate(-2px, -4px); }
  100% { transform: translate(3px, 2px); }
}

@media (min-width: 720px) {
  body {
    display: grid;
    place-items: center;
    background: #23211d;
  }

  .stage {
    width: min(430px, 100vw);
    height: min(900px, 100svh);
    border-radius: 28px;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.3);
  }
}
