/* 필드로그 보물찾기(js/treasure.js) */

/* 필드로그 화면 카드 */
.th-card { background: #fff; border-radius: 24px; padding: 20px; display: grid; gap: 16px; margin: 18px 0 0; }
.th-card-head { display: flex; gap: 14px; align-items: center; }
.th-card-head img { width: 84px; flex: none; }
.th-card-head h2 { margin: 2px 0 6px; font-size: 22px; color: var(--brand); }
.th-card-head p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.th-kicker { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--accent); }
.th-spots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.th-spot { background: var(--sky); border-radius: 16px; padding: 10px 6px; display: grid; justify-items: center; gap: 2px; text-align: center; }
.th-spot img { width: 52px; filter: grayscale(.5); opacity: .75; }
.th-spot b { font-size: 14px; }
.th-spot span { font-size: 12px; color: var(--muted); }
.th-spot.on { background: var(--accent-soft); }
.th-spot.on img { filter: none; opacity: 1; }
.th-spot.on span { color: var(--accent); font-weight: 700; }
.th-live { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; color: var(--brand); }
.th-wait { margin: 0; text-align: center; color: var(--muted); font-size: 15px; }
.th-done { background: var(--brand); color: #fff; border-radius: 16px; padding: 14px; text-align: center; font-weight: 700; }
.th-demo { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px dashed #d8dedc; padding-top: 12px; }
.th-demo > span { font-size: 12px; font-weight: 700; color: var(--muted); }

/* 전체 화면 */
.th { position: fixed; inset: 0; z-index: 900; background: var(--sky); display: flex; flex-direction: column; overflow: hidden; }
.th-top { position: relative; z-index: 3; display: flex; align-items: center; gap: 8px; padding: max(12px, env(safe-area-inset-top)) 14px 10px; }
.th-top b { flex: 1; font-size: 17px; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-x { width: 44px; height: 44px; border: 0; border-radius: 14px; background: #fff; display: grid; place-items: center; color: var(--brand); cursor: pointer; }
.th-pill { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: #fff; font-size: 14px; font-weight: 700; color: var(--brand); }
.th-pill:empty { display: none; }
.th-pill.org { background: var(--accent); color: #fff; }

.th-start { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px 20px 32px; text-align: center; overflow-y: auto; }
.th-start h1 { margin: 0; font-size: 28px; color: var(--brand); }
.th-start p { margin: 0; color: var(--muted); line-height: 1.55; max-width: 340px; }
.th-start > img { width: 170px; }
.th-bob { animation: th-bob 2.2s ease-in-out infinite; }
@keyframes th-bob { 50% { transform: translateY(-12px) rotate(-3deg); } }
.th-rules { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 8px; width: 100%; max-width: 360px; }
.th-rules li { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 14px; padding: 12px 14px; font-size: 15px; text-align: left; }
.th-rules svg { color: var(--accent); flex: none; }
.th-start .k-btn { max-width: 360px; }
.th-small { font-size: 13px !important; color: var(--muted); margin: 0; text-align: center; }

/* 레이더 */
.th-radar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 18px max(18px, env(safe-area-inset-bottom)); overflow-y: auto; }
.th-target { text-align: center; }
.th-target span { display: inline-block; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.th-target h1 { margin: 8px 0 4px; font-size: 30px; color: var(--brand); }
.th-target p { margin: 0; color: var(--muted); font-size: 15px; }
.th-dial { position: relative; width: min(66vw, 260px); aspect-ratio: 1; display: grid; place-items: center; margin: 6px 0; }
.th-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #fff 0 58%, var(--brand-soft) 59% 100%); }
.th-ring.r2 { inset: 0; background: none; box-shadow: 0 0 0 0 rgba(255, 99, 52, .35); animation: th-ping 2s ease-out infinite; }
@keyframes th-ping { to { box-shadow: 0 0 0 26px rgba(255, 99, 52, 0); } }
.th-arrow { position: absolute; inset: 14%; display: grid; place-items: start center; transition: transform .25s ease-out; }
.th-arrow svg { width: 34%; fill: var(--accent); margin-top: -2%; }
.th-arrow.dim svg { fill: #c8d0cd; }
.th-dial-chest { position: relative; width: 44%; }
.th-radar.near .th-dial-chest { animation: th-bob 1.2s ease-in-out infinite; }
.th-radar.near .th-ring { background: radial-gradient(circle, #fff 0 58%, var(--accent-soft) 59% 100%); }
.th-dist { display: grid; justify-items: center; gap: 2px; }
.th-dist b { font-size: 40px; color: var(--brand); line-height: 1.1; }
.th-dist span { font-size: 13px; color: var(--muted); }
.th-walk { margin: 0; text-align: center; font-size: 15px; color: var(--ink); background: #fff; border-radius: 14px; padding: 12px 14px; }
.th-cta { animation: th-cta 1.2s ease-in-out infinite; }
@keyframes th-cta { 50% { transform: scale(1.03); } }
.th-demo-btn { align-self: center; }
.th-tabs { display: flex; gap: 6px; width: 100%; margin-top: auto; }
.th-tabs button { flex: 1; min-width: 0; border: 0; border-radius: 14px; background: #fff; padding: 8px 4px; display: grid; justify-items: center; gap: 2px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.th-tabs img { width: 34px; }
.th-tabs .on { background: var(--brand); color: #fff; }
.th-tabs .done { background: var(--accent-soft); color: var(--accent); }

/* 카메라 */
.th-cam { position: absolute; inset: 0; background: #0f1a17; overflow: hidden; }
.th-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.th-cam.live video { opacity: 1; }
.th-cam-photo { position: absolute; inset: 0; background-position: center; background-size: cover; background-repeat: no-repeat; opacity: 0; }
.th-cam.nocam .th-cam-photo { opacity: 1; }
.th-cam .th-top b { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.th-cam-hint { position: absolute; z-index: 3; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 64px); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; white-space: nowrap; background: rgba(16, 75, 58, .88); color: #fff; font-size: 15px; font-weight: 700; padding: 10px 16px; border-radius: 999px; }
.th-edge { position: absolute; z-index: 2; top: 50%; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
.th-edge.l { left: 10px; } .th-edge.r { right: 10px; }
.th-edge.on { opacity: 1; animation: th-cta 1s ease-in-out infinite; }
.th-chest { position: absolute; left: 0; top: 0; z-index: 2; width: 140px; height: 140px; border: 0; padding: 0; background: none; cursor: pointer; opacity: 0; transition: opacity .25s; will-change: transform; }
.th-chest.show { opacity: 1; }
.th-chest img { width: 100%; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .45)); }
.th-chest i { position: absolute; inset: -18px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 214, 102, .55), transparent 65%); z-index: -1; animation: th-glow 1.4s ease-in-out infinite; }
@keyframes th-glow { 50% { transform: scale(1.15); opacity: .6; } }
.th-chest.shake img { animation: th-shake .5s linear infinite; }
@keyframes th-shake { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.th-chest.open img { animation: th-pop .5s ease-out; }
@keyframes th-pop { from { transform: scale(.7); } 60% { transform: scale(1.18); } }
.th-cam-foot { position: absolute; z-index: 3; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; justify-content: center; }
.th-coin { position: fixed; z-index: 1000; width: 36px; pointer-events: none; animation: th-coin 1.2s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes th-coin { 60% { transform: translate(var(--dx), var(--dy)) rotate(200deg); opacity: 1; } to { transform: translate(var(--dx), calc(var(--dy) + 80px)) rotate(320deg); opacity: 0; } }

/* 퀴즈 시트 */
.th-sheet { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; padding: 0 12px max(12px, env(safe-area-inset-bottom)); animation: th-up .3s ease-out; }
@keyframes th-up { from { transform: translateY(100%); } }
.th-sheet-card { background: #fff; border-radius: 24px; padding: 20px; display: grid; gap: 14px; }
.th-sheet-card h2 { margin: 0; font-size: 21px; line-height: 1.4; color: var(--ink); }
.th-hintbox { background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; display: grid; gap: 4px; font-size: 15px; }
.th-hintbox b { color: var(--accent); }
.th-hintbox span { color: var(--muted); font-size: 13px; }

/* 완주 도장 */
.th-stamp { width: 150px; height: 150px; border-radius: 50%; border: 6px solid var(--accent); color: var(--accent); display: grid; place-items: center; font-size: 28px; font-weight: 700; line-height: 1.15; animation: th-stamp .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes th-stamp { from { transform: scale(2.2); opacity: 0; } }

/* 두드리기 */
.th-chest { touch-action: manipulation; }
.th-chest.knock img { animation: th-knock .22s ease-out; }
@keyframes th-knock { 40% { transform: scale(.9) rotate(-4deg); } }
.th-spot .th-spot-photo { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; filter: none; opacity: 1; cursor: zoom-in; }

/* 사진 미션 */
.th-mission { justify-items: center; text-align: center; }
.th-mission > img { width: 150px; margin-top: -60px; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .25)); }
.th-mission p { margin: 0; color: var(--muted); line-height: 1.55; }
.th-cam.photo .th-cam-hint { white-space: normal; text-align: center; width: calc(100% - 32px); justify-content: center; font-size: 14px; }
.th-cam.selfie video { transform: scaleX(-1); }
.th-ph { position: absolute; inset: 0; z-index: 2; }
.th-ph-face { position: absolute; border: 3px dashed rgba(255, 255, 255, .85); border-radius: 50%; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .12); pointer-events: none; }
.th-ph-cap { position: absolute; left: 0; top: 0; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); transform-origin: center; }
.th-ph-tools { position: absolute; left: 16px; right: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 76px); display: flex; align-items: center; gap: 10px; }
.th-ph-flip { width: 48px; height: 48px; flex: none; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--brand); display: grid; place-items: center; cursor: pointer; }
.th-ph-size { flex: 1; display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .92); border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.th-ph-size input { flex: 1; accent-color: var(--accent); }
.th-ph-bar { position: absolute; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
.th-flash { position: absolute; inset: 0; z-index: 5; background: #fff; animation: th-flash .4s ease-out forwards; pointer-events: none; }
@keyframes th-flash { from { opacity: .9; } to { opacity: 0; } }
.th-review { position: absolute; inset: 0; z-index: 4; background: rgba(8, 30, 23, .72); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.th-review-card { width: 100%; max-width: 420px; background: #fff; border-radius: 24px; padding: 16px; display: grid; gap: 12px; }
.th-review-card > img { width: 100%; max-height: 56dvh; object-fit: contain; border-radius: 14px; background: var(--sky); }
.th-review-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.th-review-acts .k-btn { padding: 0 10px; font-size: 16px; background: var(--sky); }

/* === 카메라 한 화면 개편(10-16 저녁) === */
.th-cam-top { position: absolute; z-index: 4; left: 0; right: 0; top: 0; }
.th-cam-top .th-top b { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.th-cam-body { position: absolute; inset: 0; z-index: 3; }
.th-seg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.th-cam.nocam .th-cam-photo { opacity: 1; }
/* 나침반 힌트 */
.th-hud { position: absolute; left: 14px; right: 14px; top: calc(max(12px, env(safe-area-inset-top)) + 60px); display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .94); border-radius: 22px; padding: 10px 14px; }
.th-hud-dial { position: relative; width: 64px; height: 64px; flex: none; border-radius: 50%; background: var(--brand-soft); }
.th-hud-dial .th-arrow { inset: 6px; }
.th-hud-dial .th-arrow svg { width: 46%; margin-top: 0; }
.th-hud-txt { display: grid; gap: 1px; min-width: 0; }
.th-hud-txt span { font-size: 12px; font-weight: 700; color: var(--accent); }
.th-hud-txt b { font-size: 20px; color: var(--brand); }
.th-hud-txt em { font-style: normal; font-size: 14px; color: var(--muted); }
.th-cam.is-near .th-hud-dial { background: var(--accent-soft); animation: th-cta 1s ease-in-out infinite; }
.th-cam .th-cam-hint { top: auto; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 128px); white-space: normal; text-align: center; width: max-content; max-width: calc(100% - 32px); justify-content: center; font-size: 14px; }
.th-hunt-foot { position: absolute; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; }
.th-hunt-foot .th-tabs { margin: 0; }
.th-hunt-foot .th-tabs button { background: rgba(255, 255, 255, .94); }
.th-hunt-foot .th-tabs .on { background: var(--brand); }
.th-hunt-foot .th-tabs .done { background: var(--accent-soft); }
/* 미션 팝업 */
.th-pop { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 18px; background: rgba(8, 30, 23, .55); overflow: hidden; animation: fade .2s; }
.th-pop-ray { position: absolute; inset: -60%; background: repeating-conic-gradient(rgba(255, 214, 102, .22) 0 10deg, transparent 10deg 20deg); animation: spin 12s linear infinite; }
.th-pop-card { position: relative; width: 100%; max-width: 380px; background: #fff; border-radius: 28px; padding: 22px 20px 20px; display: grid; gap: 10px; justify-items: center; text-align: center; animation: th-boing .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes th-boing { from { transform: scale(.3); opacity: 0; } }
.th-pop-badge { margin-top: -40px; background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; padding: 8px 18px; border-radius: 999px; }
.th-pop-wear { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 130px; }
.th-pop-wear img { max-height: 120px; max-width: 46%; object-fit: contain; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .2)); animation: th-bob 2s ease-in-out infinite; }
.th-pop-wear img:nth-child(2) { animation-delay: .4s; }
.th-pop-card h2 { margin: 0; font-size: 24px; color: var(--brand); }
.th-pop-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 15px; }
/* 포토존 */
.th-ph-guide { position: absolute; border: 3px dashed rgba(255, 255, 255, .9); border-radius: 50%; pointer-events: none; }
.th-ph-guide.back { border-radius: 40% 40% 24px 24px; }
.th-ph-item { position: absolute; left: 0; top: 0; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .3)); transform-origin: center; }
.th-ph-item.drag { outline: 2px dashed rgba(255, 99, 52, .9); outline-offset: 4px; border-radius: 8px; }
.th-ph-tools { position: absolute; left: 12px; right: 12px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 76px); display: flex; align-items: center; gap: 8px; }
.th-ph-round { flex: none; height: 52px; min-width: 52px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .94); color: var(--brand); display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.th-ph-round img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.th-ph-round.on { background: var(--accent); color: #fff; }
.th-ph-round.loading { opacity: .6; }
.th-ph-size { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .94); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.th-cam.photo .th-cam-hint { bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 62px); }
.th-cam .th-review, .th-cam .th-sheet { z-index: 7; }
.th-ph-size input { flex: 1; min-width: 0; width: 100%; accent-color: var(--accent); }

/* 미래의 나(졸업 사진) */
.th-future { display: grid; gap: 6px; background: var(--accent-soft); border-radius: 16px; padding: 12px 14px; }
.th-future b { color: var(--brand); font-size: 16px; }
.th-future span { color: var(--muted); font-size: 13px; }
.th-future-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.th-future-chips button { border: 0; border-radius: 999px; padding: 9px 14px; background: #fff; color: var(--brand); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.th-future-chips button.on { background: var(--accent); color: #fff; }
.th-review-card > img { max-height: 48dvh; }
/* 탐방 수료증 */
.th-cert { width: min(300px, 78vw); border-radius: 12px; box-shadow: 0 12px 30px rgba(16, 75, 58, .25); animation: th-boing .55s cubic-bezier(.3, 1.6, .5, 1); }
.th-finish .k-btn-soft { background: #fff; max-width: 360px; }

/* 손가락 터치가 버튼까지 닿게: 옷 레이어는 옷 그림만 터치를 받고, 버튼 줄은 그 위에 */
.th-ph { pointer-events: none; }
.th-ph .th-ph-item { pointer-events: auto; }
.th-ph-tools, .th-ph-bar { z-index: 4; }
.th-cam .th-cam-hint { z-index: 4; pointer-events: none; }

/* 두 번 탭 확대와 터치 지연 없애기 */
.th button, .th input, .kid .k-btn { touch-action: manipulation; }
