/* =====================================================================
   공통 레이아웃 · 대기 · 난이도 · 성공 · 결과 · 오류 화면 — P2 맞춤법 탐정단
   스테이지 1920×1080 고정(미디어쿼리 없음). 색은 tokens.css, 모션은 motion.css.
   ⚠ data-anim 요소에는 transform 으로 위치를 잡지 않는다 (등장 애니메이션이 덮어쓴다).
   ===================================================================== */

/* ── 리셋 · 스테이지 ── */
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden; background: #000;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;              /* 2인 멀티터치 — 확대·스크롤·당겨서 새로고침 전부 차단 */
  overscroll-behavior: none;
}
body { color: var(--c-ink); font-family: var(--font-ui); cursor: none; word-break: keep-all; }
body.is-dev { cursor: auto; }
button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: inherit; -webkit-appearance: none; appearance: none; touch-action: none;
}
svg { display: block; width: 100%; height: 100%; }
.page p, .page h1, .page h2, .page h3, .page ol, .page ul { margin: 0; }

#stage-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#app {
  position: relative; flex: none; width: var(--stage-w); height: var(--stage-h); overflow: hidden;
  background: linear-gradient(158deg, #F6F7F8 0%, var(--c-bg) 42%, var(--c-bg-2) 100%);
  transform: scale(var(--app-scale)); transform-origin: center center;
}

/* 키비주얼의 붉은 원 · 푸른 원을 바탕에 옅게 (실버 천 위 두 원) */
.backdrop { position: absolute; inset: 0; pointer-events: none; }
.backdrop i { position: absolute; border-radius: 50%; }
.backdrop__red {
  width: 980px; height: 980px; left: -430px; bottom: -560px;
  background: radial-gradient(circle at 62% 38%, rgba(228, 60, 48, .20), rgba(228, 60, 48, .07) 58%, transparent 71%);
}
.backdrop__blue {
  width: 900px; height: 900px; right: -340px; top: -470px;
  background: radial-gradient(circle at 38% 62%, rgba(12, 72, 156, .18), rgba(12, 72, 156, .06) 58%, transparent 71%);
}

#view { position: absolute; inset: 0; z-index: 1; }
.page { position: absolute; inset: 0; }
.is-locked button, .is-locked .tok, .is-locked [data-act] { pointer-events: none; }

/* ── 공용 조각 ── */
.kicker { font-size: 30px; font-weight: 800; color: var(--c-red); letter-spacing: .04em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 96px; padding: 0 60px; border-radius: var(--r-pill);
  font-size: 38px; font-weight: 800;
  transition: transform var(--dur-fast) var(--ease-soft), box-shadow var(--dur-fast) var(--ease-soft);
}
.btn--primary { background: var(--c-blue); color: #fff; box-shadow: 0 14px 30px rgba(12, 72, 156, .30); }
.btn:active { transform: scale(.96); box-shadow: 0 6px 14px rgba(12, 72, 156, .25); }
.auto-note { font-size: 26px; font-weight: 600; color: var(--c-dim); }

.chip { display: inline-block; padding: 6px 18px; border-radius: var(--r-pill); font-size: 24px; font-weight: 800; }
.chip--found  { background: var(--c-blue); color: #fff; }
.chip--missed { background: var(--c-red); color: #fff; }

/* ── 상단 바 ── */
.topbar { position: absolute; left: 0; right: 0; top: 0; height: 124px; z-index: 5; pointer-events: none; }
.home-btn {
  position: absolute; left: 36px; top: 26px; width: 86px; height: 86px; padding: 21px; box-sizing: border-box;
  border-radius: 50%; background: rgba(255, 255, 255, .55); color: var(--c-ink-2);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border: 1.5px solid rgba(255, 255, 255, .8); box-shadow: 0 14px 34px rgba(27, 36, 64, .10);
  pointer-events: auto; transition: transform var(--dur-fast) var(--ease-soft);
}
.home-btn:active { transform: scale(.9); }
.topbar__title {
  position: absolute; top: 26px; left: 0; right: 0; margin: 0 auto;
  width: max-content; max-width: 1320px; height: 86px; box-sizing: border-box; padding: 0 60px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); background: rgba(255, 255, 255, .6); box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border: 1.5px solid rgba(255, 255, 255, .8);
  font-family: var(--font-display); font-size: 42px; font-weight: 800; letter-spacing: .05em; white-space: nowrap;
}
.topbar__title--seed   { box-shadow: inset 0 -7px 0 var(--c-seed), var(--shadow-card); }
.topbar__title--sprout { box-shadow: inset 0 -7px 0 var(--c-sprout), var(--shadow-card); }
.topbar__title--tree   { box-shadow: inset 0 -7px 0 var(--c-tree), var(--shadow-card); }

/* ── 난이도 뱃지 ── */
.lv-badge {
  display: inline-flex; align-items: center; gap: 10px; height: 58px; padding: 0 24px 0 14px; box-sizing: border-box;
  border-radius: var(--r-pill); font-size: 29px; font-weight: 800; color: #fff; white-space: nowrap;
}
.lv-badge i { width: 36px; height: 36px; flex: none; }
.lv-badge small { font-size: 22px; font-weight: 700; opacity: .85; margin-left: 2px; }
.lv-badge--seed   { background: var(--c-seed); color: #3A2800; }
.lv-badge--sprout { background: var(--c-sprout); }
.lv-badge--tree   { background: var(--c-tree); }

/* =====================================================================
   STEP 1 대기 화면
   ===================================================================== */
.waiting__copy { position: absolute; left: 150px; top: 136px; width: 1060px; }
.waiting__title {
  margin-top: 14px !important; font-family: var(--font-display); font-size: 134px; font-weight: 900;
  line-height: 1.08; letter-spacing: -.01em; color: var(--c-ink); white-space: nowrap;
}
.waiting__lens { display: inline-block; width: 112px; height: 112px; margin-right: 22px; vertical-align: -10px; color: var(--c-red); }
.waiting__lens svg { stroke-width: 4.4; }
.waiting__tagline { margin-top: 18px !important; font-size: 44px; font-weight: 800; color: var(--c-blue); }
.waiting__lead { margin-top: 40px !important; font-size: 42px; font-weight: 600; line-height: 1.55; color: var(--c-ink); }
.rules { list-style: none; padding: 0; margin-top: 48px !important; display: flex; flex-wrap: wrap; gap: 16px 18px; max-width: 1120px; }
.rule {
  display: inline-flex; align-items: center; gap: 14px; height: 76px; padding: 0 30px 0 12px; box-sizing: border-box;
  border-radius: var(--r-pill); background: var(--c-card); box-shadow: var(--shadow-card);
  font-size: 31px; font-weight: 700; white-space: nowrap;
}
.rule b {
  width: 54px; height: 54px; border-radius: 50%; background: var(--c-red); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 900;
}

/* 오른쪽 장식: 원고 종이 + 돋보기 (시안 전 자리표시) */
.waiting__art { position: absolute; right: 96px; top: 210px; width: 560px; height: 700px; }
.paper {
  position: absolute; left: 60px; top: 30px; width: 470px; height: 600px; border-radius: 26px;
  background: var(--c-card); box-shadow: var(--shadow-pop);
}
.paper__title { position: absolute; left: 50px; top: 56px; width: 250px; height: 34px; border-radius: 10px; background: var(--c-blue); opacity: .85; }
.paper__bar { position: absolute; left: 50px; height: 22px; border-radius: 11px; background: #E4E7EB; }
.paper__word { position: absolute; left: 76px; top: 470px; font-size: 66px; font-weight: 900; color: var(--c-red); letter-spacing: .02em; }
.lens-big { position: absolute; left: -10px; top: 356px; width: 400px; height: 400px; pointer-events: none; }
.lens-big__glass {
  position: absolute; left: 20px; top: 20px; width: 270px; height: 270px; border-radius: 50%; box-sizing: border-box;
  border: 26px solid var(--c-blue); background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .28), rgba(84, 144, 192, .08) 60%);
  box-shadow: 0 16px 36px rgba(12, 72, 156, .3);
}
.lens-big__handle {
  position: absolute; left: 262px; top: 250px; width: 150px; height: 46px; border-radius: 23px;
  background: var(--c-red); transform: rotate(45deg); transform-origin: left center; box-shadow: 0 10px 22px rgba(228, 60, 48, .3);
}

.waiting__prompt { position: absolute; left: 0; right: 0; bottom: 72px; display: flex; justify-content: center; }
.prompt {
  display: inline-flex; align-items: center; height: 104px; padding: 0 76px; border-radius: var(--r-pill);
  background: var(--c-blue); color: #fff; font-size: 42px; font-weight: 800; box-shadow: 0 16px 36px rgba(12, 72, 156, .32);
}
.prompt.tap-ring::after { border-color: var(--c-blue); }

/* =====================================================================
   STEP 2 난이도 선택
   ===================================================================== */
.level__title {
  position: absolute; top: 158px; left: 0; right: 0; text-align: center;
  font-family: var(--font-display); font-size: 74px; font-weight: 900;
}
.level__lead { position: absolute; top: 260px; left: 0; right: 0; text-align: center; font-size: 34px; font-weight: 600; color: var(--c-ink-2); }
.lv-cards { position: absolute; left: 0; right: 0; top: 340px; display: flex; justify-content: center; gap: 60px; }
.lv-card {
  position: relative; width: 500px; height: 650px; display: flex; flex-direction: column; align-items: center;
  border-radius: 40px; background: var(--c-card); box-shadow: var(--shadow-card); overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-soft), box-shadow var(--dur-fast) var(--ease-soft);
}
.lv-card:active { transform: scale(.97); }
.lv-card.is-picked { box-shadow: 0 0 0 8px var(--c-yellow), var(--shadow-pop); }
.lv-card__top { position: relative; width: 100%; height: 250px; display: flex; align-items: center; justify-content: center; color: #fff; }
.lv-card--seed .lv-card__top   { background: linear-gradient(160deg, #FFC94A, var(--c-seed)); color: #5A3D00; }
.lv-card--sprout .lv-card__top { background: linear-gradient(160deg, #6EA9DB, var(--c-sprout)); }
.lv-card--tree .lv-card__top   { background: linear-gradient(160deg, #2466BC, var(--c-tree)); }
.lv-card__icon { width: 150px; height: 150px; }
.lv-card__icon svg { stroke-width: 2.6; }
.lv-card__grade {
  position: absolute; top: 24px; right: 24px; padding: 8px 22px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .92); color: var(--c-ink); font-size: 28px; font-weight: 800;
}
.lv-card__name { margin-top: 42px; font-family: var(--font-display); font-size: 68px; font-weight: 900; }
.lv-card__target { margin-top: 10px; font-size: 34px; font-weight: 700; color: var(--c-ink-2); }
.lv-card__places-label { margin-top: 40px; font-size: 24px; font-weight: 800; color: var(--c-dim); letter-spacing: .1em; }
.lv-card__places { list-style: none; padding: 0; margin: 12px 0 0 !important; display: flex; flex-direction: column; gap: 6px; font-size: 31px; font-weight: 700; text-align: center; }

/* =====================================================================
   성공 화면
   ===================================================================== */
.page--success { overflow: hidden; }
.rays {
  position: absolute; left: 960px; top: 540px; width: 2800px; height: 2800px; margin: -1400px 0 0 -1400px;
  background: repeating-conic-gradient(from 0deg, rgba(252, 192, 72, .26) 0deg 9deg, transparent 9deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 62%); mask-image: radial-gradient(circle, #000 10%, transparent 62%);
  animation: spin 60s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
  position: absolute; top: -60px; width: 18px; height: 30px; border-radius: 4px;
  animation: fall 3.4s linear infinite; animation-delay: var(--d); transform: rotate(var(--r));
}
@keyframes fall { to { transform: translateY(1220px) rotate(calc(var(--r) + 540deg)); } }
.success__body { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; }
.success__badge {
  width: 190px; height: 190px; padding: 40px; box-sizing: border-box; border-radius: 50%;
  background: var(--c-blue); color: #fff; box-shadow: 0 20px 44px rgba(12, 72, 156, .35);
}
.success__badge svg { stroke-width: 5; }
.success__title { font-family: var(--font-display); font-size: 180px; font-weight: 900; line-height: 1.05; color: var(--c-ink); }
.success__lead { font-size: 50px; font-weight: 700; color: var(--c-ink-2); }
.success__time { font-size: 38px; font-weight: 800; color: var(--c-blue); background: var(--c-card); padding: 12px 36px; border-radius: var(--r-pill); box-shadow: var(--shadow-card); }
.success__btn { margin-top: 26px; }
/* 돋보기 세종 — 왼쪽 벽에 완전히 붙여서 빼꼼 (소스 = 탐정단포토존_세종대왕, 여백은 크롭됨) */
.success__sejong { position: absolute; left: 0; bottom: 110px; height: 700px; pointer-events: none; }
body.fx-off .rays, body.fx-off .confetti i { animation: none; }

/* =====================================================================
   STEP 6 결과
   ===================================================================== */
.result__card {
  position: absolute; left: 290px; top: 80px; width: 1340px; height: 920px; box-sizing: border-box; padding: 52px 72px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center;
  border-radius: 48px; background: var(--c-card); box-shadow: var(--shadow-pop);
  --tier: var(--c-blue);
}
.result--g0 .result__card { --tier: var(--c-red); }
.result--g1 .result__card { --tier: var(--c-blue); }
.result--g2 .result__card { --tier: var(--c-sky); }
.result--g3 .result__card { --tier: var(--c-ink-2); }
.result__grade { display: flex; flex-direction: column; align-items: center; gap: 18px; max-width: 100%; }
.result__medal {
  width: 128px; height: 128px; padding: 28px; box-sizing: border-box; border-radius: 50%; flex: none;
  background: var(--tier); color: #fff; box-shadow: 0 0 0 10px color-mix(in srgb, var(--tier) 20%, transparent);
}
.result__medal svg { stroke-width: 4.6; }
/* 등급명은 최대 12자("다시 도전하는 한글 탐정")까지 온다 — 넘치면 어절 단위로 줄바꿈 */
.result__name { font-family: var(--font-display); font-size: 92px; font-weight: 900; line-height: 1.12; color: var(--tier); text-align: center; }
.result__count { font-size: 50px; font-weight: 800; }
.meter { list-style: none; padding: 0; display: flex; gap: 14px; }
.meter li { width: 62px; height: 62px; padding: 13px; box-sizing: border-box; border-radius: 50%; background: #E6E9ED; color: #B4BAC3; }
.meter li.is-on { background: var(--tier); color: #fff; }
.result__msg { font-size: 38px; font-weight: 600; color: var(--c-ink-2); }
.result__stats { list-style: none; padding: 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.stat { height: 58px; display: inline-flex; align-items: center; padding: 0 26px; border-radius: var(--r-pill); background: #F1F3F6; font-size: 29px; font-weight: 700; color: var(--c-ink-2); }
.result__foot { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 16px; }

/* =====================================================================
   문제 데이터 오류 (운영자용)
   ===================================================================== */
.page--fatal { background: #F4F5F7; display: flex; align-items: center; justify-content: center; }
.fatal {
  width: 1500px; max-height: 960px; overflow: hidden; box-sizing: border-box; padding: 56px 72px;
  background: #fff; border-radius: 32px; border-top: 16px solid var(--c-red); box-shadow: var(--shadow-pop);
}
.fatal__kicker { font-size: 28px; font-weight: 700; color: var(--c-dim); }
.fatal__title { margin-top: 8px !important; font-size: 80px; font-weight: 900; color: var(--c-red); }
.fatal__file { margin-top: 10px !important; font-size: 30px; font-weight: 700; color: var(--c-ink-2); font-family: Consolas, monospace; }
.fatal__list { margin-top: 28px !important; padding-left: 40px; font-size: 27px; line-height: 1.5; color: var(--c-ink); }
.fatal__list li { word-break: break-all; }
.fatal__more { margin-top: 10px !important; font-size: 26px; color: var(--c-dim); }
.fatal__hint { margin-top: 30px; padding: 22px 28px; border-radius: 18px; background: #FFF6E0; font-size: 27px; line-height: 1.55; color: #5A4300; }
