/* dk-games — 반응속도 게임 (고양이 깨우기) */

.reaction-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 18px 96px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reaction-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reaction-topbar .auth-slot {
  margin-left: auto;
}

.reaction-back {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.reaction-back:hover { color: var(--accent-deep); }

.reaction-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 메인 스테이지 ---------- */

.reaction-stage {
  position: relative;
  margin-top: 16px;
  border-radius: 28px;
  overflow: hidden;
  height: min(64vh, 520px);
  border: 3px solid #f8c98a;
  background: #fff8ec;
  box-shadow: 0 10px 30px rgba(217, 122, 60, 0.15);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.reaction-stage:focus { outline: none; box-shadow: 0 0 0 4px rgba(217, 122, 60, 0.3), 0 10px 30px rgba(217, 122, 60, 0.15); }

.reaction-stage[data-state="waiting"] {
  background: #fef0d6;
}

.reaction-stage[data-state="ready"] {
  background: #ffe7c2;
  border-color: #d97a3c;
  animation: stage-flash 0.4s ease-out;
}

@keyframes stage-flash {
  0% { background: #fff7d4; }
  100% { background: #ffe7c2; }
}

.reaction-stage[data-state="result"] {
  cursor: default;
  background: #fff8ec;
}

.reaction-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 220, 170, 0.6) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255, 200, 150, 0.5) 0, transparent 40%);
  pointer-events: none;
}

/* ---------- 고양이 ---------- */

.reaction-cat {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.reaction-cat img {
  width: clamp(200px, 50vw, 320px);
  height: auto;
  border-radius: 28px;
  box-shadow: 0 12px 30px rgba(217, 122, 60, 0.2);
  transition: transform 0.3s ease;
}

.reaction-stage[data-state="waiting"] .reaction-cat img {
  animation: cat-snore 2.4s ease-in-out infinite;
}

@keyframes cat-snore {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(2px) scale(1.01); }
}

.reaction-stage[data-state="ready"] .reaction-cat img {
  transform: scale(1.04);
}

/* ---------- zZz ---------- */

.reaction-zzz {
  position: absolute;
  top: calc(50% - 130px);
  left: calc(50% + 60px);
  display: flex;
  gap: 4px;
  font-family: "SUIT", sans-serif;
  font-weight: 800;
  color: #b06a30;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.reaction-stage[data-state="idle"] .reaction-zzz,
.reaction-stage[data-state="waiting"] .reaction-zzz {
  opacity: 1;
}

.reaction-zzz span:nth-child(1) { font-size: 16px; animation: zzz-float 2s ease-in-out infinite 0s; }
.reaction-zzz span:nth-child(2) { font-size: 22px; animation: zzz-float 2s ease-in-out infinite 0.4s; }
.reaction-zzz span:nth-child(3) { font-size: 28px; animation: zzz-float 2s ease-in-out infinite 0.8s; }

@keyframes zzz-float {
  0% { transform: translate(0, 0); opacity: 0.5; }
  50% { transform: translate(8px, -10px); opacity: 1; }
  100% { transform: translate(16px, -20px); opacity: 0; }
}

/* ---------- 나비 ---------- */

.reaction-butterfly {
  position: absolute;
  top: calc(50% - 160px);
  left: 50%;
  transform: translateX(-50%) scale(0.4);
  font-size: 64px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reaction-stage[data-state="ready"] .reaction-butterfly {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  animation: butterfly-flap 0.6s ease-in-out infinite alternate;
}

@keyframes butterfly-flap {
  0% { transform: translateX(-50%) scale(1) rotate(-6deg); }
  100% { transform: translateX(-50%) scale(1.06) rotate(6deg); }
}

/* ---------- 안내 텍스트 ---------- */

.reaction-overlay {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  padding: 0 20px;
}

.reaction-prompt {
  font-family: "SUIT", sans-serif;
  font-weight: 900;
  font-size: clamp(22px, 5vw, 30px);
  color: #5b3a1a;
  letter-spacing: -0.01em;
}

.reaction-sub {
  margin-top: 6px;
  font-family: "SUIT", sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: #8a6240;
}

.reaction-stage[data-state="result"] .reaction-overlay,
.reaction-stage[data-state="falsestart"] .reaction-overlay {
  display: none;
}

.reaction-stage[data-state="ready"] .reaction-prompt {
  color: #d97a3c;
}

.reaction-stage[data-state="ready"] .reaction-prompt::after {
  content: " 👆";
}

/* ---------- 결과 화면 ---------- */

.reaction-result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 250, 240, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 5;
  padding: 20px;
  animation: result-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes result-pop {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.reaction-result[hidden] { display: none; }

.reaction-result-emoji {
  font-size: 48px;
  animation: result-bounce 1.2s ease-in-out infinite;
}

@keyframes result-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.reaction-result-time {
  margin-top: 6px;
  font-family: "SUIT", sans-serif;
  font-weight: 900;
  font-size: clamp(40px, 9vw, 56px);
  color: #5b3a1a;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.reaction-unit {
  font-size: 0.4em;
  font-weight: 700;
  color: #a37346;
}

.reaction-result-score {
  margin-top: 12px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #f0c190;
  box-shadow: 0 4px 12px rgba(217, 122, 60, 0.15);
}

.reaction-result-score-value {
  font-family: "SUIT", sans-serif;
  font-weight: 900;
  font-size: 28px;
  color: #d97a3c;
}

.reaction-result-score-label {
  font-family: "SUIT", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #8a6240;
}

.reaction-result-hint {
  margin-top: 12px;
  font-family: "SUIT", sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #5b3a1a;
}

.reaction-result-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

.btn-primary,
.btn-secondary {
  font-family: "SUIT", sans-serif;
  font-weight: 800;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  border: 0;
  text-decoration: none;
}

.btn-primary {
  background: #d97a3c;
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 122, 60, 0.35);
}
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: #fff;
  color: #5b3a1a;
  border: 2px solid #f0c190;
  display: inline-flex;
  align-items: center;
}

/* ---------- 너무 빨리 누름 ---------- */

.reaction-falsestart {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 230, 230, 0.96);
  z-index: 6;
  text-align: center;
  padding: 20px;
  animation: falsestart-shake 0.4s ease;
}

@keyframes falsestart-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.reaction-falsestart[hidden] { display: none; }

.reaction-falsestart-emoji {
  font-size: 56px;
}

.reaction-falsestart-msg {
  margin-top: 8px;
  font-family: "SUIT", sans-serif;
  font-weight: 900;
  font-size: 24px;
  color: #c0392b;
}

.reaction-falsestart-sub {
  margin-top: 6px;
  font-family: "SUIT", sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: #8a6240;
}

/* ---------- 베스트 + 리더보드 ---------- */

.reaction-best {
  margin: 14px 4px 0;
  font-family: "SUIT", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #8a6240;
  text-align: center;
  min-height: 18px;
}

.maze-leaderboard {
  margin-top: 32px;
  padding: 18px;
  background: #fff;
  border-radius: 20px;
  border: 2px solid #f0c190;
  box-shadow: 0 6px 18px rgba(217, 122, 60, 0.1);
}

.lb-title {
  margin: 0 0 12px;
  font-family: "SUIT", sans-serif;
  font-weight: 900;
  font-size: 18px;
  color: #5b3a1a;
}
