:root {
  --ink: #2f3f55;
  --muted: #5f738a;
  --sky: #7ec8ff;
  --sky-deep: #5bb0f0;
  --cream: #fff8ec;
  --lemon: #ffe27a;
  --red: #ff6b7a;
  --red-deep: #e8485a;
  --green: #5fd36a;
  --green-deep: #3bb84a;
  --pink: #ff6b9d;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: "Jua", system-ui, sans-serif;
  color: var(--ink);
  background: #1a3a58;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage {
  position: relative;
  width: min(100vw, calc(100dvh * 0.557));
  height: min(100dvh, calc(100vw / 0.557));
  max-width: 420px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.55), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(255, 226, 122, 0.35), transparent 24%),
    linear-gradient(180deg, var(--sky), #b8e2ff 55%, #fff1c8);
}

.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.home {
  pointer-events: auto;
  text-decoration: none;
  color: #fff;
  background: rgba(30, 50, 70, 0.45);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.score-pill {
  background: rgba(30, 50, 70, 0.45);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.score-pill b {
  color: var(--lemon);
  font-size: 16px;
}

.score-pill.soft b {
  color: #c8ecff;
}

.arena {
  appearance: none;
  border: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 72px 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  background: transparent;
  color: inherit;
  font: inherit;
  transition: background 0.18s ease;
}

.arena.mode-wait {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 107, 122, 0.42), transparent 42%),
    linear-gradient(180deg, rgba(255, 107, 122, 0.55), rgba(232, 72, 90, 0.72));
  animation: waitPulse 1.1s ease-in-out infinite, waitShake 2.4s ease-in-out infinite;
}

.arena.mode-ready {
  background:
    radial-gradient(circle at 50% 42%, rgba(95, 211, 106, 0.5), transparent 44%),
    linear-gradient(180deg, rgba(95, 211, 106, 0.62), rgba(59, 184, 74, 0.78));
  animation: readyPulse 0.55s ease-in-out infinite;
}

.arena.mode-idle {
  background: transparent;
  pointer-events: none;
}

.arena.mode-wait,
.arena.mode-ready {
  pointer-events: auto;
}

.signal {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  margin-bottom: 4px;
  box-shadow:
    inset 0 -8px 0 rgba(0, 0, 0, 0.12),
    0 10px 24px rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.arena.mode-wait .signal {
  background: radial-gradient(circle at 35% 30%, #ffd0d5, var(--red) 55%, var(--red-deep));
  box-shadow:
    inset 0 -8px 0 rgba(0, 0, 0, 0.14),
    0 0 0 8px rgba(255, 255, 255, 0.18),
    0 0 28px rgba(255, 80, 90, 0.55);
}

.arena.mode-ready .signal {
  background: radial-gradient(circle at 35% 30%, #d8ffe0, var(--green) 55%, var(--green-deep));
  transform: scale(1.08);
  box-shadow:
    inset 0 -8px 0 rgba(0, 0, 0, 0.14),
    0 0 0 10px rgba(255, 255, 255, 0.22),
    0 0 36px rgba(70, 210, 90, 0.65);
}

.mascot {
  width: min(46vw, 190px);
  height: auto;
  filter: drop-shadow(0 10px 16px rgba(40, 60, 90, 0.22));
  pointer-events: none;
}

.arena-msg {
  margin: 4px 0 0;
  font-family: "Bagel Fat One", "Jua", cursive;
  font-size: clamp(28px, 8vw, 36px);
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.arena-sub {
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

@keyframes waitPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.06);
  }
}

@keyframes waitShake {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  20% {
    transform: translate3d(-1.5px, 0.5px, 0);
  }
  40% {
    transform: translate3d(1.5px, -0.8px, 0);
  }
  60% {
    transform: translate3d(-1px, 0.6px, 0);
  }
  80% {
    transform: translate3d(1px, -0.4px, 0);
  }
}

@keyframes readyPulse {
  0%,
  100% {
    filter: brightness(1.02) saturate(1.05);
  }
  50% {
    filter: brightness(1.12) saturate(1.15);
  }
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 56px 16px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.55), transparent 28%),
    linear-gradient(180deg, rgba(126, 200, 255, 0.94), rgba(255, 236, 180, 0.96));
}

.overlay.hidden {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(180deg, #ff8ab5, #ff4f8b);
  box-shadow: 0 4px 0 #d93f74;
}

.badge.soft {
  background: linear-gradient(180deg, #7ad0ff, #4aa8ef);
  box-shadow: 0 4px 0 #2f7fc0;
}

.badge.warn {
  background: linear-gradient(180deg, #ff9a6b, #ff5a3d);
  box-shadow: 0 4px 0 #c94428;
}

.hero-art {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 28px;
  box-shadow: 0 10px 24px rgba(40, 70, 100, 0.2);
}

.hero-art.small {
  width: 110px;
  height: 110px;
  border-radius: 22px;
}

.overlay h1 {
  margin: 2px 0 0;
  font-family: "Bagel Fat One", "Jua", cursive;
  font-weight: 400;
  font-size: clamp(34px, 9vw, 42px);
  color: var(--ink);
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.45);
}

.overlay p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.45;
}

.result-label {
  margin-top: 2px !important;
  font-size: 14px !important;
  letter-spacing: 0.04em;
  color: var(--muted) !important;
}

.result-ms {
  margin: 0 !important;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  color: var(--ink) !important;
  line-height: 1 !important;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.5);
}

.result-ms b {
  font-family: "Bagel Fat One", "Jua", cursive;
  font-size: clamp(64px, 18vw, 84px);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: #ff4f8b;
}

.result-ms span {
  font-family: "Bagel Fat One", "Jua", cursive;
  font-size: clamp(28px, 8vw, 34px);
  color: var(--sky-deep);
}

.result-note {
  min-height: 1.2em;
  font-size: 16px !important;
  color: var(--ink) !important;
}

.result-best {
  font-size: 14px !important;
}

.btn {
  appearance: none;
  border: none;
  min-width: 168px;
  min-height: 48px;
  margin-top: 6px;
  padding: 0 22px;
  border-radius: 999px;
  font: inherit;
  font-size: 18px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #ff8ab5, #ff4f8b);
  box-shadow: 0 5px 0 #d93f74;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #d93f74;
}

.btn.soft {
  background: linear-gradient(180deg, #7ad0ff, #4aa8ef);
  box-shadow: 0 5px 0 #2f7fc0;
}

.btn.soft:active {
  box-shadow: 0 3px 0 #2f7fc0;
}

.btn.kakao {
  color: #191919;
  background: linear-gradient(180deg, #fee500, #f5d800);
  box-shadow: 0 5px 0 #c4a800;
}

.btn.kakao:active {
  box-shadow: 0 3px 0 #c4a800;
}

.share-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(300px, 100%);
  margin-top: 4px;
}

.share-row .btn {
  min-width: 0;
  width: 100%;
  font-size: 15px;
  min-height: 44px;
  margin-top: 0;
}

.share-msg {
  min-height: 1.2em;
  margin: 0 !important;
  font-size: 13px !important;
  color: #2f7a45 !important;
}

.link {
  margin-top: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
