:root {
  --navy: #050b1d;
  --panel: #0b1430;
  --lime: #baff00;
  --cyan: #23d9ed;
  --white: #f6f7ef;
  --muted: #8993ad;
  --danger: #ff4d6d;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--white);
  background:
    radial-gradient(circle at 20% 20%, rgba(35, 217, 237, .09), transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(186, 255, 0, .08), transparent 28%),
    var(--navy);
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  opacity: .18;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 40px 40px;
}

button { font: inherit; }

.game-shell { min-height: 100vh; position: relative; }

.hud {
  height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 32px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: rgba(5,11,29,.72);
  backdrop-filter: blur(12px);
}

.brand { font-weight: 800; letter-spacing: -.03em; }
.brand span, .brand b { color: var(--lime); }
.timer { font-size: 24px; font-weight: 900; color: var(--lime); }
.score { justify-self: end; font-size: 24px; font-weight: 900; }
.score span { color: var(--danger); }
.test-status { position:fixed; z-index:30; top:86px; right:24px; padding:9px 12px; border:1px solid rgba(35,217,237,.45); border-radius:10px; color:var(--cyan); background:rgba(5,11,29,.88); font-size:10px; font-weight:950; letter-spacing:.1em; }

.intro, .result {
  min-height: calc(100vh - 126px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .18em;
}

h1, h2 { margin: 0; line-height: .96; letter-spacing: -.07em; text-wrap: balance; word-break: keep-all; }
h1 { font-size: clamp(64px, 9vw, 138px); }
h1 em { color: var(--lime); font-style: normal; }
h2 { font-size: clamp(70px, 10vw, 150px); color: var(--lime); }

.description { max-width: 720px; color: #bac1d2; line-height: 1.7; margin: 30px 0; text-wrap: balance; word-break: keep-all; }

.mode-picker { width: min(720px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 20px; }
.mode-card { min-height: 128px; padding: 18px; border: 1px solid rgba(255,255,255,.13); border-radius: 20px; color: var(--white); background: rgba(11,20,48,.82); cursor: pointer; text-align: left; transition: border-color .16s ease, transform .16s ease, background .16s ease; }
.mode-card:hover { transform: translateY(-3px); border-color: rgba(35,217,237,.55); }
.mode-card.selected { border-color: var(--cyan); background: rgba(35,217,237,.1); box-shadow: inset 0 0 0 1px rgba(35,217,237,.25), 0 12px 32px rgba(0,0,0,.22); }
.mode-card.nightmare.selected { border-color: var(--danger); background: rgba(255,77,109,.1); box-shadow: inset 0 0 0 1px rgba(255,77,109,.25), 0 12px 32px rgba(0,0,0,.22); }
.mode-card span, .mode-card strong, .mode-card small { display: block; }
.mode-badge { margin-bottom: 9px; color: var(--cyan); font-size: 9px; font-weight: 950; letter-spacing: .13em; }
.nightmare .mode-badge { color: var(--danger); }
.mode-card strong { font-size: 21px; }
.mode-card small { margin-top: 7px; color: var(--muted); line-height: 1.45; word-break: keep-all; }

.start-button {
  border: 0;
  border-radius: 16px;
  padding: 17px 34px;
  color: var(--navy);
  background: var(--lime);
  box-shadow: 0 0 38px rgba(186,255,0,.22);
  font-weight: 950;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.start-button:hover { transform: translateY(-3px); box-shadow: 0 0 50px rgba(186,255,0,.36); }
.tip { color: var(--muted); font-size: 12px; margin-top: 16px; }

.arena {
  position: relative;
  height: calc(100vh - 126px);
  overflow: hidden;
}

#arena, #arena * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.arena::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px dashed rgba(186,255,0,.24);
  border-radius: 24px;
  pointer-events: none;
}

.boss-ui {
  position: absolute;
  z-index: 5;
  top: 24px;
  left: 50%;
  width: min(520px, calc(100% - 96px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.level-message {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  white-space: nowrap;
}

.health-track { height: 12px; margin-top: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.08); }
.health-fill { width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--danger), #ff8a4d); box-shadow: 0 0 24px rgba(255,77,109,.45); transition: width .25s ease; }
.taunt { max-width: 100%; margin: 10px auto 0; color: var(--white); font-size: 15px; font-weight: 850; line-height: 1.35; text-wrap: balance; word-break: keep-all; }

.target {
  z-index: 3;
  position: absolute;
  left: calc(50% - 64px);
  top: calc(50% - 64px);
  width: 128px;
  height: 128px;
  border: 0;
  border-radius: 36px;
  color: var(--navy);
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(35,217,237,.72), 0 0 30px rgba(35,217,237,.46), 0 20px 60px rgba(0,0,0,.35);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: left .18s cubic-bezier(.2,.9,.3,1.15), top .18s cubic-bezier(.2,.9,.3,1.15), transform .12s ease;
}

.target:hover { transform: rotate(-3deg) scale(1.04); }
.target:active { transform: scale(.92); }
.target-face { display: block; font-size: 25px; font-weight: 950; line-height: 1; }
.target-label { display: block; margin-top: 6px; font-weight: 950; font-size: 13px; }

.target.danger { background: var(--danger); color: white; }
.target.tiny { width: 94px; height: 94px; border-radius: 28px; }
.target.micro { width: 76px; height: 76px; border-radius: 22px; }
.target.nightmare-compact { width: 84px; height: 84px; border-radius: 24px; }
.target.micro.nightmare-fast { width: 66px; height: 66px; border-radius: 19px; }
.target.final-target { width: 64px; height: 64px; border-radius: 19px; animation: true-target-pulse .8s ease-in-out infinite alternate; }
.target.nightmare-target { width: 52px; height: 52px; border-radius: 15px; animation: nightmare-pulse .42s ease-in-out infinite alternate; }
.target.nightmare-target .target-face { font-size: 12px; }
.target.nightmare-target .target-label { margin-top: 0; font-size: 7px; }
.target.vulnerable {
  width: 78px;
  height: 78px;
  color: var(--navy);
  background: var(--cyan);
  animation: vulnerable .34s ease-in-out infinite alternate;
}
.target.micro .target-face, .decoy span { font-size: 19px; }
.target.final-target .target-face { font-size: 17px; }
.target.micro .target-label, .target.final-target .target-label { margin-top: 3px; font-size: 10px; }

.decoys { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.decoy { position: absolute; width: 64px; height: 64px; border: 2px solid rgba(255,255,255,.16); border-radius: 19px; color: rgba(255,255,255,.78); background: #a52c49; box-shadow: 0 16px 40px rgba(0,0,0,.35); cursor: pointer; pointer-events: auto; transition: transform .15s ease, opacity .2s ease; }
.decoy:hover { transform: scale(1.06) rotate(4deg); }
.decoy span, .decoy b { display: block; }
.decoy b { margin-top: 2px; font-size: 8px; }
.decoy.caught-decoy { opacity: .15; transform: scale(.4) rotate(25deg); pointer-events: none; }

.penalty { position: absolute; z-index: 10; left: 50%; top: 48%; opacity: 0; transform: translate(-50%, -50%) scale(.5); color: var(--danger); font-size: clamp(70px, 12vw, 170px); font-weight: 950; pointer-events: none; }
.penalty.show { animation: penalty .6s ease-out; }

.result-score { margin: 25px 0; font-size: 92px; font-weight: 950; color: var(--lime); }
.result-score small { font-size: 24px; color: var(--muted); }
#resultTitle { white-space: nowrap; }
#resultText { max-width: 680px; margin-inline: auto; color: #bac1d2; line-height: 1.6; text-wrap: balance; word-break: keep-all; }
.result-meta { display: flex; align-items: center; gap: 12px; margin: -8px 0 18px; }
.result-meta span { color: var(--muted); font-size: 12px; font-weight: 800; }
.result-meta code { padding: 8px 11px; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; color: var(--cyan); background: rgba(255,255,255,.05); font-weight: 900; }
.test-summary { width:min(640px,100%); margin:0 0 18px; padding:16px; border:1px solid rgba(35,217,237,.24); border-radius:16px; background:rgba(11,20,48,.72); }
.test-summary>strong { display:block; margin-bottom:10px; color:var(--cyan); font-size:11px; letter-spacing:.13em; }
.test-summary ol { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:0; padding:0; list-style:none; }
.test-summary li { display:grid; grid-template-columns:24px 1fr 1fr 1fr; gap:7px; padding:7px 9px; border-radius:8px; color:var(--muted); background:rgba(255,255,255,.035); font-size:9px; text-align:left; }
.test-summary li b { color:var(--white); }
.text-button { margin-top:10px; border:0; color:var(--muted); background:transparent; font-size:9px; text-decoration:underline; cursor:pointer; }
.copy-button { margin: 0 0 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; padding: 11px 18px; color: var(--white); background: transparent; cursor: pointer; }

footer {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
}
footer a { color: var(--cyan); text-decoration: none; font-weight: 800; }

.shake { animation: shake .26s linear; }
.flash { animation: flash .32s ease; }
.wrong { animation: wrong .32s ease; }

@keyframes shake {
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

@keyframes flash {
  50% { background-color: rgba(186,255,0,.15); }
}

@keyframes wrong { 50% { background-color: rgba(255,77,109,.2); } }
@keyframes penalty { 35% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -70%) scale(1.15); } }
@keyframes true-target-pulse {
  from { box-shadow: 0 0 0 4px rgba(35,217,237,.55), 0 0 20px rgba(35,217,237,.32), 0 20px 60px rgba(0,0,0,.35); }
  to { box-shadow: 0 0 0 7px rgba(35,217,237,.9), 0 0 42px rgba(35,217,237,.68), 0 20px 60px rgba(0,0,0,.35); }
}
@keyframes vulnerable {
  from { transform: scale(.96); box-shadow: 0 0 0 5px rgba(186,255,0,.65), 0 0 28px rgba(186,255,0,.5); }
  to { transform: scale(1.08); box-shadow: 0 0 0 9px rgba(186,255,0,.95), 0 0 54px rgba(186,255,0,.82); }
}
@keyframes nightmare-pulse {
  from { box-shadow: 0 0 0 3px rgba(255,77,109,.5), 0 0 14px rgba(255,77,109,.3); }
  to { box-shadow: 0 0 0 5px rgba(255,77,109,.88), 0 0 28px rgba(255,77,109,.6); }
}

@media (max-width: 640px) {
  .hud { height: 62px; padding: 0 16px; }
  .brand { font-size: 13px; }
  .timer, .score { font-size: 18px; }
  .arena { height: calc(100vh - 106px); }
  .intro, .result { min-height: calc(100vh - 106px); }
  h1 { font-size: 46px; line-height: 1.04; }
  h2 { font-size: 58px; letter-spacing: -.055em; }
  .boss-ui { width: calc(100% - 48px); }
  .level-message { font-size: 11px; letter-spacing: .07em; }
  .taunt { font-size: 13px; }
  .test-status { top:70px; right:12px; }
  .result-meta { flex-wrap:wrap; justify-content:center; }
  .test-summary ol { grid-template-columns:1fr; }
  .mode-picker { grid-template-columns: 1fr; max-width: 430px; }
  .mode-card { min-height: 96px; }
  footer { height: 44px; padding: 0 16px; }
  footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
