﻿:root {
  --bg-1: #0b1b25;
  --bg-2: #102c3a;
  --panel: #0d131a;
  --ink: #f5f7fb;
  --muted: #96a2b1;
  --accent: #ffcf5a;
  --accent-2: #3dd9ff;
  --good: #55e9a6;
  --bad: #ff6a6a;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Gmarket Sans", "Pretendard", "Apple SD Gothic Neo", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(700px 420px at 12% 10%, rgba(61, 217, 255, 0.2), transparent 60%),
    radial-gradient(700px 420px at 88% 15%, rgba(255, 207, 90, 0.16), transparent 60%),
    linear-gradient(150deg, var(--bg-1), var(--bg-2));
  display: grid;
  place-items: center;
  padding: 16px;
  
}

.stage {
  width: min(920px, 100%);
  min-height: min(560px, 100%);
  display: grid;
  gap: 20px;
  align-content: center;
  position: relative;
}

.level-tabs {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  background: rgba(13, 19, 26, 0.7);
  border: 1px solid #263849;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.level-tab {
  border: 1px solid #2d4254;
  background: #0f1821;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: border 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.level-tab:hover {
  border-color: var(--accent-2);
  color: var(--ink);
}

.level-tab.is-active {
  border-color: var(--accent);
  color: var(--ink);
  background: #13202c;
}

.brand {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 40px);
  letter-spacing: -0.5px;
}

.replay {
  height: 48px;
  width: 64px;
  border-radius: 16px;
  border: 1px solid #345162;
  background: #0f1821;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.15s ease, border 0.15s ease, box-shadow 0.15s ease;
  animation: replayGlow 1.6s infinite;
}

.replay:focus,
.replay:focus-visible,
.choice:focus,
.choice:focus-visible {
  outline: none;
  box-shadow: none;
}

.replay:hover {
  transform: translateY(-2px);
  border-color: var(--accent-2);
  box-shadow: 0 12px 25px rgba(61, 217, 255, 0.2);
}

.board {
  background: rgba(13, 19, 26, 0.72);
  border-radius: 28px;
  border: 1px solid #263849;
  padding: clamp(16px, 3vw, 24px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 20px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.choice {
  height: clamp(120px, 28vw, 200px);
  min-height: 120px;
  border-radius: 22px;
  border: 1px solid #2d4254;
  background: linear-gradient(160deg, rgba(22, 30, 40, 0.95), rgba(15, 24, 33, 0.9));
  color: var(--ink);
  font-size: clamp(48px, 10vw, 84px);
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform 0.18s ease, border 0.18s ease, box-shadow 0.18s ease;
}

.choice:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 14px 30px rgba(255, 207, 90, 0.15);
}

.choice.good {
  border-color: var(--good);
  box-shadow: 0 0 0 3px rgba(85, 233, 166, 0.25);
  animation: goodPulse 0.6s ease;
}

.choice.bad {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px rgba(255, 106, 106, 0.25);
  animation: badPulse 0.4s ease;
}

.status {
  display: grid;
  justify-items: start;
}

.pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(61, 217, 255, 0.6);
  animation: glow 1.6s infinite;
}

@keyframes glow {
  0% { box-shadow: 0 0 0 0 rgba(61, 217, 255, 0.6); }
  70% { box-shadow: 0 0 0 16px rgba(61, 217, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 217, 255, 0); }
}

@keyframes goodPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes badPulse {
  0% { transform: translateX(0); }
  30% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  100% { transform: translateX(0); }
}

@keyframes replayGlow {
  0% { box-shadow: 0 0 0 0 rgba(61, 217, 255, 0.6); border-color: #345162; }
  60% { box-shadow: 0 0 0 10px rgba(61, 217, 255, 0); border-color: var(--accent-2); }
  100% { box-shadow: 0 0 0 0 rgba(61, 217, 255, 0); border-color: #345162; }
}

@media (max-width: 680px) {
  body {
    padding: 12px;
  }

  .stage {
    min-height: 100%;
  }

  .brand {
    grid-template-columns: 1fr auto;
  }

  .board {
    grid-template-columns: 1fr;
  }

  .choice {
    height: 110px;
    min-height: 110px;
  }
}

/* =========================
   Touch devices (Galaxy Chrome 포함)
   - tap highlight 제거
   - focus/active에서만 테두리/그림자 제거
   - sticky hover는 "기본 상태"에만 무력화 (good/bad는 유지)
   ========================= */

@media (pointer: coarse) {
  /* 1) 터치 하이라이트만 제거 (상시 box-shadow 제거 금지) */
  button,
  .choice,
  .choiceBtn,
  .replay,
  #replayBtn {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
    touch-action: manipulation;
  }

  /* 2) 선택 버튼만 focus/active에서 box-shadow 제거 */
  button:active,
  button:focus,
  button:focus-visible,
  .choice:active,
  .choice:focus,
  .choice:focus-visible,
  .choiceBtn:active,
  .choiceBtn:focus,
  .choiceBtn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
  }

  /* 2-b) replay는 outline만 제거 (반짝임 유지) */
  .replay:active,
  .replay:focus,
  .replay:focus-visible,
  #replayBtn:active,
  #replayBtn:focus,
  #replayBtn:focus-visible {
    outline: none !important;
    /* box-shadow는 제거하지 않음 */
  }

  /* 2-c) replay active/focus에서도 glow 애니메이션 유지 */
  .replay:active,
  .replay:focus,
  .replay:focus-visible,
  #replayBtn:active,
  #replayBtn:focus,
  #replayBtn:focus-visible {
    animation: replayGlow 1.6s infinite;
    box-shadow: 0 0 0 0 rgba(61, 217, 255, 0.6) !important;
  }

  /* 3) ★ 핵심: sticky hover는 "기본 상태"에만 무력화
        (good/bad 상태에서는 테두리/애니메이션을 절대 건드리지 않음) */
  .choice:not(.good):not(.bad):hover {
    transform: none !important;
    border-color: #2d4254 !important;
    box-shadow: none !important;
  }

  .replay:hover {
  transform: none !important;
  border-color: #345162 !important;
  /* box-shadow 제거 금지: glow 유지 */
}

}

/* hover:none 판정되는 브라우저에 대한 추가 방어 (pointer:coarse가 더 중요) */
@media (hover: none) {
  .choice:not(.good):not(.bad):hover {
    transform: none !important;
    box-shadow: none !important;
  }
  .replay:hover {
    transform: none !important;
    /* box-shadow 제거 금지: glow 유지 */
  }
}


/* 데스크톱: 키보드 포커스 링 유지 */
@media (hover: hover) and (pointer: fine) {
  .replay:focus-visible,
  .choice:focus-visible {
    outline: 3px solid var(--accent-2);
    outline-offset: 2px;
  }
}
