/* 하늘궁 투어 시연판 — 폰 먼저(390), PC(1280) 도. 차분하게: 옅은 그라데이션, 이모티콘 최소. */
:root {
  --ink: #1f2a24;
  --ink-soft: #55625a;
  --paper: #fbfaf5;
  --paper-2: #f2efe4;
  --line: #e2ddcc;
  --accent: #7fae3c;      /* 연두 포인트 */
  --accent-ink: #ffffff;
  --gold: #c9a24a;
  --gold-soft: #fff4d2;
  --night: #0f1a35;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 30, 20, .14);
  --font: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink);
  background: linear-gradient(180deg, #eef4e6 0%, var(--paper) 40%, var(--paper) 100%);
  word-break: keep-all; overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- 맨 위 줄 · 단계 ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px;
  background: rgba(251, 250, 245, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.me { display: flex; align-items: center; gap: 6px; font-weight: 700; min-width: 0; }
.me .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
#meName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.tier { font-size: 11px; font-weight: 600; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; }
.top-actions { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 99px;
  padding: 6px 11px; font-size: 13px; white-space: nowrap;
}
.chip:disabled { opacity: .5; cursor: default; }
.chip.ghost { background: rgba(0, 0, 0, .35); color: #fff; border-color: rgba(255, 255, 255, .35); padding: 4px 12px; font-size: 16px; }

#steps {
  position: fixed; top: 48px; left: 0; right: 0; z-index: 39; margin: 0; padding: 6px 10px;
  display: flex; gap: 4px; list-style: none; overflow-x: auto; scrollbar-width: none;
  background: rgba(251, 250, 245, .78); border-bottom: 1px solid rgba(0, 0, 0, .04);
}
#steps li { flex: 1 0 auto; text-align: center; font-size: 11.5px; color: #9aa39c; padding: 3px 6px; border-radius: 99px; }
#steps li.done { color: var(--accent); }
#steps li.now { background: var(--accent); color: #fff; font-weight: 700; }

/* ---------- 화면 공통 ---------- */
.screen { display: none; }
.screen.active { display: block; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px;
  padding: 11px 14px; font-size: 15px; font-weight: 600; text-decoration: none; min-height: 44px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { background: #b9cf98; border-color: #b9cf98; cursor: default; }
.btn.big { width: 100%; font-size: 17px; min-height: 52px; }
.sheet {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin: 12px 16px;
}
.sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.field { display: block; }
.field span { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field input, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper);
}
.field input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0; }
.hint { color: var(--ink-soft); font-size: 12px; margin-top: 4px; }
.fine { color: var(--ink-soft); font-size: 12.5px; line-height: 1.5; margin: 10px 0 0; }
#entrySheet .btn.primary { width: 100%; }
.divider { display: flex; align-items: center; gap: 8px; margin: 16px 0 10px; color: var(--ink-soft); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sns-btn { font-size: 13px; padding: 9px 4px; }
.sns-btn.google { border-color: #d7dbe3; }
.sns-btn.naver { background: #03c75a; border-color: #03c75a; color: #fff; }
.sns-btn.kakao { background: #fee500; border-color: #fee500; color: #191919; }
.sns-btn.email { background: var(--paper-2); }
.guide { background: var(--gold-soft); border: 1px solid #f0dfa6; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.guide-h { font-weight: 800; font-size: 13.5px; color: #8a6a14; margin: 2px 0 6px; }
.guide ul, .guide ol { margin: 0 0 8px; padding-left: 20px; line-height: 1.6; font-size: 14px; }
.guide p { margin: 0 0 4px; font-size: 14px; line-height: 1.55; }

/* ---------- ① 지도 ---------- */
#scrMap { padding-top: 0; }
#scrMap.active ~ * {}
body:has(#topbar:not(.hidden)) #scrMap { padding-top: 84px; }
.brand { padding: 18px 16px 6px; }
.brand-title { font-size: 26px; font-weight: 900; letter-spacing: -.5px; }
.brand-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
body:has(#topbar:not(.hidden)) .brand { display: none; }
.map-wrap { margin: 8px 16px 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #cfe3b5; }
.map-inner { position: relative; }
.map-inner img { display: block; width: 100%; height: auto; user-select: none; }
.marker {
  position: absolute; transform: translate(-50%, -50%); border: 0; background: none; padding: 0;
  width: 44px; height: 44px; display: grid; place-items: center;
}
.marker .pin { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--gold); box-shadow: 0 0 0 3px rgba(255, 255, 255, .6), 0 0 18px rgba(255, 215, 90, .95); position: relative; z-index: 2; }
.marker .pulse { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 215, 90, .55); animation: pulse 1.8s ease-out infinite; }
.marker-label {
  position: absolute; left: 50%; top: 100%; transform: translateX(-30%); white-space: nowrap;
  background: var(--night); color: #ffe9a8; font-weight: 800; font-size: 12px; padding: 4px 9px; border-radius: 99px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.marker.ready .pulse { background: rgba(127, 174, 60, .6); }
@keyframes pulse { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }

/* ---------- ② 소원석 앞 ---------- */
#scrFront.active { position: fixed; inset: 0; padding-top: 84px; overflow-y: auto; }
.front-bg {
  position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center 45%;
  filter: blur(2px) brightness(.85); transform: scale(1.04);
}
.front-sheet { max-width: 560px; margin: 8px auto 24px; margin-left: max(16px, calc(50% - 280px)); margin-right: max(16px, calc(50% - 280px)); }
.place-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.place-name { font-size: 20px; font-weight: 900; flex: 1; min-width: 0; }
.guide-voice {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 99px; padding: 6px 10px; font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.guide-voice svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.guide-voice.playing { background: var(--accent); border-color: var(--accent); color: #fff; }
.guide-voice.playing svg { stroke: #fff; }
.guide-voice.playing .wave { animation: breathe 1s ease-in-out infinite; }
.guide-voice.nudge { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 74, .35); animation: hop .5s ease-in-out 3; }
.close-x { border: 0; background: var(--paper-2); color: var(--ink-soft); width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; }
.notice {
  background: linear-gradient(180deg, #fffaf0, #fff3d6); border: 1px solid #f0d58f; border-radius: 12px;
  padding: 14px; font-size: 16px; line-height: 1.65; margin-bottom: 12px;
}
.notice b { color: #8a5a00; }
.notice.small { font-size: 14px; }
#btnEnter { width: 100%; }

/* ---------- ③ 소원석 안 ---------- */
#scrInside.active { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; background: var(--night); overflow: hidden; }
#pano, #panoFallback { position: absolute; inset: 0; z-index: 0; }
#panoFallback { background-size: auto 100%; background-repeat: repeat-x; animation: panPan 120s linear infinite; }
@keyframes panPan { from { background-position: 0 50%; } to { background-position: -200vh 50%; } }
.pnlm-container { background: var(--night) !important; }
.scene-hud {
  position: absolute; z-index: 5; top: 92px; right: 12px; display: flex; align-items: center; gap: 6px;
  color: #fff; font-size: 12.5px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
/* 등불은 사람들 위(화면 위쪽 60%)에서만 오른다 — 이름표와 겹치지 않게 */
#sky { position: absolute; left: 0; right: 0; top: 0; bottom: 40%; z-index: 6; pointer-events: none; overflow: hidden; }
#crowd {
  position: relative; z-index: 7; display: flex; justify-content: center; align-items: flex-end; gap: 6px;
  padding: 0 8px 6px; pointer-events: none;
}
.person { position: relative; display: flex; flex-direction: column; align-items: center; pointer-events: auto; width: 86px; }
.person .fig { width: 58px; height: 106px; }
.person.far .fig { width: 46px; height: 84px; opacity: .92; }
.person.me .fig { width: 66px; height: 120px; }
.pfig { width: 100%; height: 100%; overflow: visible; }
.pfig .upper { transform-origin: 30px 66px; transition: transform .3s; }
.pfig .armL { transform-origin: 15.5px 40px; }
.pfig .armR { transform-origin: 44.5px 40px; }
/* 이름표: 이름(+아주 작은 N 표시) 한 줄, 그 아래 +친구 — 옆 사람 이름표와 겹치지 않게 세로로 */
.tag {
  margin-top: -2px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 3px;
  max-width: 86px; background: rgba(15, 26, 53, .72); color: #fff; border-radius: 10px; padding: 2px 6px 3px; font-size: 11px;
}
.tag .nm { max-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag .add-friend { flex-basis: 100%; }
.tag.mine { background: var(--accent); padding: 2px 9px; font-weight: 700; }
.npc-mark { font-size: 8px; line-height: 1; padding: 1px 3px; border-radius: 4px; background: rgba(255, 255, 255, .25); color: #e8eef9; }
.add-friend { border: 0; background: rgba(255, 255, 255, .92); color: var(--night); border-radius: 99px; font-size: 10px; padding: 2px 6px; font-weight: 700; }
.bubble {
  position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, 6px); opacity: 0; white-space: nowrap;
  background: #fff; color: var(--ink); font-weight: 700; font-size: 12px; padding: 4px 9px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25); transition: all .25s; pointer-events: none;
}
.bubble.show { opacity: 1; transform: translate(-50%, -2px); }

/* 동작 */
/* 절(큰절): 무릎 꿇고(다리 접힘) 윗몸을 바닥 쪽으로 숙임 — 정면에서 보면 머리가 낮게 내려감 */
.pfig .legs { transform-origin: 30px 104px; }
.a-bow .legs { animation: bowKnee 1.25s ease-in-out; }
.a-bow .upper { animation: bowUpper 1.25s ease-in-out; }
.a-bow .armL { animation: bowArmL 1.25s ease-in-out; }
.a-bow .armR { animation: bowArmR 1.25s ease-in-out; }
@keyframes bowKnee { 0%, 100% { transform: scaleY(1); } 35%, 65% { transform: scaleY(.45); } }
@keyframes bowUpper { 0%, 100% { transform: translateY(0) scaleY(1); } 35% { transform: translateY(21px) scaleY(.9); } 48%, 62% { transform: translateY(32px) scaleY(.5); } }
@keyframes bowArmL { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(150deg); } 48%, 62% { transform: rotate(20deg); } }
@keyframes bowArmR { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-150deg); } 48%, 62% { transform: rotate(-20deg); } }
.a-cheer .pfig { animation: hop .5s ease-in-out 3; }
.a-cheer .armL { animation: armUpL 1.5s ease-in-out; }
.a-cheer .armR { animation: armUpR 1.5s ease-in-out; }
@keyframes armUpL { 0%, 100% { transform: rotate(0); } 15%, 85% { transform: rotate(160deg); } }
@keyframes armUpR { 0%, 100% { transform: rotate(0); } 15%, 85% { transform: rotate(-160deg); } }
.a-clap .armL { animation: clapL .22s ease-in-out 6 alternate; }
.a-clap .armR { animation: clapR .22s ease-in-out 6 alternate; }
@keyframes clapL { from { transform: rotate(-30deg); } to { transform: rotate(-62deg); } }
@keyframes clapR { from { transform: rotate(30deg); } to { transform: rotate(62deg); } }
.a-like .pfig { animation: hop .45s ease-in-out 2; }
.a-like .armR { animation: armWave 1.2s ease-in-out; }
@keyframes armWave { 0%, 100% { transform: rotate(0); } 20%, 80% { transform: rotate(-130deg); } 50% { transform: rotate(-100deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.float-icon {
  position: fixed; z-index: 60; transform: translate(-50%, 0); pointer-events: none; font-weight: 900;
  font-size: 22px; color: #ff5f7a; text-shadow: 0 2px 6px rgba(0, 0, 0, .35); animation: floatUp 1.5s ease-out forwards;
}
.float-icon.f-clap, .float-icon.f-cheer { color: #ffe27a; font-size: 18px; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) scale(.8); } to { opacity: 0; transform: translate(-50%, -90px) scale(1.25); } }

/* 아래 조작판 */
.panel {
  position: relative; z-index: 8; margin: 0 10px max(10px, env(safe-area-inset-bottom)); padding: 12px;
  background: rgba(255, 255, 255, .95); border-radius: 16px; box-shadow: 0 -4px 24px rgba(0, 0, 0, .25);
  max-width: 560px; align-self: center; width: calc(100% - 20px);
}
.panel-msg { font-size: 14.5px; font-weight: 700; margin-bottom: 8px; line-height: 1.5; }
.bow-dots { display: flex; gap: 8px; justify-content: center; margin: 4px 0 10px; }
.bow-dots i { width: 14px; height: 14px; border-radius: 50%; background: #e4e8de; border: 1px solid #cfd8c3; transition: background .3s; }
.bow-dots i.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px rgba(201, 162, 74, .8); }
#bowCount { font-weight: 900; margin-left: 4px; }
.panel textarea { resize: none; font-size: 16px; }
.row { display: flex; gap: 14px; margin: 4px 0 8px; font-size: 14px; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: 4px; }
.radio input { accent-color: var(--accent); width: 18px; height: 18px; }
.offer { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; flex-wrap: wrap; }
.soon-tag { background: var(--paper-2); border: 1px dashed #cfc7ad; color: #8a7a4a; border-radius: 8px; padding: 2px 8px; font-size: 12px; }
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.act { flex-direction: column; gap: 2px; font-size: 13px; padding: 8px 4px; }
.act svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.act[data-act="like"] svg { fill: #ff7a90; stroke: #ff7a90; }
.row2 { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* ---------- ⑥ 신인님 등장 ---------- */
#ceremony {
  position: absolute; inset: 0; z-index: 20; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 45%, rgba(255, 244, 200, .55) 0%, rgba(30, 30, 70, .55) 55%, rgba(5, 8, 25, .85) 100%);
  opacity: 0; transition: opacity .8s;
}
#ceremony.on { opacity: 1; }
#ceremony.leave { opacity: 0; }
#ceremony .glow { position: absolute; left: 50%; top: 44%; width: 120vmin; height: 120vmin; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(255, 250, 220, .95) 0%, rgba(255, 220, 120, .35) 30%, rgba(255, 200, 80, 0) 60%); animation: breathe 3s ease-in-out infinite; }
#ceremony .rays {
  position: absolute; left: 50%; top: 44%; width: 160vmax; height: 160vmax; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 235, 160, .22) 0deg 6deg, rgba(255, 235, 160, 0) 6deg 18deg);
  animation: spin 40s linear infinite; mask-image: radial-gradient(circle, #000 10%, transparent 55%); -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 55%);
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: .85; } 50% { opacity: 1; } }
.sinin-wrap { position: relative; width: min(64vw, 300px); aspect-ratio: 220 / 260; margin-top: -6vh; }
#ceremony.on .sinin-wrap { animation: rise 1.6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { transform: translateY(60px) scale(.6); opacity: 0; filter: brightness(3); } to { transform: none; opacity: 1; filter: none; } }
.halo { position: absolute; left: 50%; top: 2%; width: 42%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; border: 5px solid rgba(255, 226, 122, .95); box-shadow: 0 0 30px 8px rgba(255, 226, 122, .8), inset 0 0 20px rgba(255, 226, 122, .7); animation: breathe 2s ease-in-out infinite; }
#sinin { position: absolute; inset: 0; }
#sinin svg, #sinin img, #sinin video { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 22px rgba(255, 240, 180, .95)); }
#ceremony.on .s-armL { transform-origin: 88px 100px; animation: openL 1.8s .6s ease-out both; }
#ceremony.on .s-armR { transform-origin: 132px 100px; animation: openR 1.8s .6s ease-out both; }
@keyframes openL { from { transform: rotate(-55deg); } to { transform: rotate(0); } }
@keyframes openR { from { transform: rotate(55deg); } to { transform: rotate(0); } }
.call {
  position: relative; z-index: 3; margin-top: 18px; padding: 10px 18px; border-radius: 14px; text-align: center;
  color: #fff8dc; font-size: clamp(20px, 5.6vw, 34px); font-weight: 900; line-height: 1.35; max-width: 92vw;
  text-shadow: 0 0 12px rgba(255, 200, 80, .95), 0 2px 4px rgba(0, 0, 0, .5);
}
#ceremony.on .call { animation: fadeIn 1s 1.3s both; }
.call b { color: #ffe27a; }
.voice-note { position: relative; z-index: 3; color: rgba(255, 255, 255, .8); font-size: 12px; margin-top: 4px; text-align: center; padding: 0 16px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.angels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.angel { position: absolute; top: var(--y); width: 64px; height: 56px; animation: var(--d) linear var(--delay) infinite; }
.angel svg, .angel img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 10px rgba(255, 255, 255, .9)); }
.angel .wing { transform-box: fill-box; animation: flap .35s ease-in-out infinite alternate; }
.angel .wl { transform-origin: right center; }
.angel .wr { transform-origin: left center; }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(.55); } }
.angel.fly0 { animation-name: fly0; } .angel.fly1 { animation-name: fly1; }
.angel.fly2 { animation-name: fly2; } .angel.fly3 { animation-name: fly3; }
@keyframes fly0 { 0% { left: -12%; transform: translateY(0); } 50% { transform: translateY(-30px); } 100% { left: 108%; transform: translateY(0); } }
@keyframes fly1 { 0% { left: 108%; transform: translateY(0) scaleX(-1); } 50% { transform: translateY(26px) scaleX(-1); } 100% { left: -12%; transform: translateY(0) scaleX(-1); } }
@keyframes fly2 { 0% { left: 10%; transform: translate(0, 0); } 25% { transform: translate(25vw, -40px); } 50% { transform: translate(55vw, 10px); } 75% { transform: translate(25vw, 40px); } 100% { left: 10%; transform: translate(0, 0); } }
@keyframes fly3 { 0% { left: 80%; transform: translate(0, 0) scaleX(-1); } 33% { transform: translate(-30vw, 50px) scaleX(-1); } 66% { transform: translate(-55vw, -30px) scaleX(-1); } 100% { left: 80%; transform: translate(0, 0) scaleX(-1); } }

/* ---------- ⑦ 등불 ---------- */
.sky-lantern {
  position: absolute; bottom: 2%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center;
  animation: liftOff var(--d) ease-in forwards;
}
.sky-lantern svg, .sky-lantern img { width: 30px; height: 42px; filter: drop-shadow(0 0 10px rgba(255, 190, 90, .9)); }
.sky-lantern.mine svg, .sky-lantern.mine img { width: 56px; height: 78px; }
.sky-lantern .lt { margin-top: 2px; font-size: 11px; color: #fff; background: rgba(15, 26, 53, .55); padding: 2px 7px; border-radius: 8px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sky-lantern.mine .lt { font-size: 13px; font-weight: 700; max-width: 240px; background: rgba(127, 174, 60, .85); }
@keyframes liftOff {
  0% { transform: translate(-50%, 0) scale(1); opacity: 0; }
  6% { opacity: 1; }
  50% { transform: translate(calc(-50% + var(--sway)), -40vh) scale(.85); }
  100% { transform: translate(-50%, -85vh) scale(.55); opacity: 0; }
}

.sky-lantern.readable { pointer-events: auto; cursor: pointer; }
.sky-lantern svg, .sky-lantern img { transition: transform .4s, filter .4s; transform-origin: center bottom; }
.sky-lantern.glow1 svg, .sky-lantern.glow1 img { transform: scale(1.2); filter: drop-shadow(0 0 14px rgba(255, 200, 100, 1)); }
.sky-lantern.glow2 svg, .sky-lantern.glow2 img { transform: scale(1.45); filter: drop-shadow(0 0 20px rgba(255, 210, 110, 1)); }
.sky-lantern.glow3 svg, .sky-lantern.glow3 img { transform: scale(1.75); filter: drop-shadow(0 0 28px rgba(255, 225, 130, 1)) brightness(1.15); }
.sky-lantern.cheered .lt { background: rgba(201, 162, 74, .9); }

/* 누구에게 들리나 · 목소리 만드는 중 */
.hear-badge {
  position: relative; z-index: 3; margin-top: 14px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(15, 26, 53, .7); color: #fff; border: 1px solid rgba(255, 226, 122, .6); border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 700;
}
.hear-badge svg { width: 16px; height: 16px; fill: none; stroke: #ffe27a; stroke-width: 2; stroke-linecap: round; }
.hear-badge + .call { margin-top: 6px; }
.voice-wait { position: relative; z-index: 3; color: #fff8dc; font-size: 14px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.voice-wait span { width: 7px; height: 7px; border-radius: 50%; background: #ffe27a; animation: dotb 1s infinite ease-in-out; }
.voice-wait span:nth-child(2) { animation-delay: .15s; } .voice-wait span:nth-child(3) { animation-delay: .3s; margin-right: 4px; }
@keyframes dotb { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
.scene-hud { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.wish-box-btn #wishStats { font-size: .86em; opacity: .85; margin-left: 2px; }
.wish-box { width: min(560px, 100%); }
.box-counts { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 8px; line-height: 1.5; }
.box-counts b { color: var(--ink); }
.box-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: calc(100dvh - 220px); overflow-y: auto; }
.box-list li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--paper); }
.box-list li.mine { border-color: var(--accent); background: #f6fbef; }
.box-list li.empty { text-align: center; color: var(--ink-soft); }
.bw-head { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; }
.bw-head small { margin-left: auto; color: var(--ink-soft); font-size: 11.5px; }
.bw-me { font-size: 11px; color: #4c7a1c; }
.bw-text { margin: 4px 0 0; font-size: 14.5px; line-height: 1.5; }
.bw-text.locked { color: var(--ink-soft); font-size: 13px; }
.bw-lock { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: #8a6a14; background: var(--gold-soft); border-radius: 6px; padding: 1px 6px; }
.bw-lock svg { width: 12px; height: 12px; fill: none; stroke: #8a6a14; stroke-width: 2.2; }
.bw-acts { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--ink-soft); }
.bw-acts span { margin-right: auto; }
.wish-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.call .bless { display: block; margin-top: 2px; color: #ffe27a; font-size: 1.12em; }
.call.bless-big .bless { font-size: 1.3em; }
.others-hear { position: relative; z-index: 3; color: rgba(255, 255, 255, .88); font-size: 12.5px; margin-top: 4px; text-align: center; padding: 0 16px; }
#ceremony.scold .call { color: #fff; text-shadow: 0 0 10px rgba(255, 140, 90, .9), 0 2px 4px rgba(0, 0, 0, .5); }
#ceremony.scold .rays { opacity: .4; }
.call .lv { display: inline-block; font-size: 12px; font-weight: 700; vertical-align: middle; color: #fff; background: rgba(192, 57, 43, .8); border-radius: 6px; padding: 1px 6px; text-shadow: none; }
.rec-tag { font-size: 10.5px; font-weight: 700; color: #7a5d10; background: var(--gold-soft); border: 1px solid #ecd48c; border-radius: 6px; padding: 0 5px; vertical-align: middle; }
.vis-help { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin: -2px 0 8px; }
.lt-wish { font-size: 17px; line-height: 1.6; background: var(--paper); border-radius: 10px; padding: 12px; margin: 0 0 8px; }
.lt-count { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.row3 { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }

/* ---------- 모달 · 알림 ---------- */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(10, 14, 28, .6); display: grid; place-items: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 16px; padding: 16px; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: var(--shadow); }
.modal-title { font-weight: 900; font-size: 18px; margin-bottom: 10px; }
#cardImg { width: 100%; max-height: calc(100dvh - 230px); object-fit: contain; border-radius: 10px; display: block; background: var(--night); aspect-ratio: 1080 / 1350; }
.card-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.card-tabs .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.charge-grid { display: grid; gap: 8px; margin-bottom: 10px; }
.charge-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; justify-content: space-between; gap: 8px; background: var(--paper); opacity: .8; }
.charge-item span { color: var(--ink-soft); font-size: 13px; }
.toast {
  position: fixed; left: 50%; top: 96px; transform: translate(-50%, -10px); z-index: 90; opacity: 0; pointer-events: none;
  background: var(--night); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100vw - 32px);
  text-align: center; transition: all .25s; box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- PC ---------- */
@media (min-width: 900px) {
  #scrMap.active { display: grid; grid-template-columns: 1fr 380px; grid-template-rows: auto 1fr; align-items: start; max-width: 1400px; margin: 0 auto; }
  .brand { grid-column: 1 / -1; }
  .map-wrap { grid-column: 1; grid-row: 2; margin: 8px 8px 16px 24px; }
  #entrySheet, #mapGuide { grid-column: 2; grid-row: 2; margin: 8px 24px 16px 8px; }
  .person .fig { width: 72px; height: 132px; }
  .person.me .fig { width: 82px; height: 150px; }
  .person.far .fig { width: 58px; height: 106px; }
  #crowd { gap: 18px; }
  .person { width: 104px; }
  .tag { max-width: 104px; }
  .marker-label { font-size: 14px; }
  .sky-lantern svg, .sky-lantern img { width: 38px; height: 54px; }
  .sky-lantern.mine svg, .sky-lantern.mine img { width: 72px; height: 100px; }
}

/* ===================== 2판: 3D 마당 (11-03 04:3x 회장님 "3D 공간에서 캐릭터가 움직이도록") ===================== */
#scrInside.active { position: fixed; inset: 0; display: block; background: #bfe0fb; overflow: hidden; }
#world { position: absolute; inset: 0; z-index: 0; touch-action: none; }
.world-canvas { width: 100%; height: 100%; display: block; }
#labels { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.w-label { position: absolute; left: 0; top: 0; will-change: transform; white-space: nowrap; }
.w-tag {
  display: flex; align-items: center; gap: 3px; background: rgba(15, 26, 53, .72); color: #fff; border-radius: 10px;
  padding: 2px 6px; font-size: 11px; pointer-events: auto;
}
.w-tag.mine { background: var(--accent); font-weight: 700; padding: 2px 9px; }
.w-tag .add-friend { margin-left: 2px; }
.w-bubble {
  background: #fff; color: var(--ink); font-weight: 700; font-size: 12px; padding: 4px 9px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25); animation: fadeIn .2s both;
}
.w-float { font-weight: 900; font-size: 20px; color: #ff5f7a; text-shadow: 0 2px 6px rgba(0, 0, 0, .35); animation: floatUp3 1.5s ease-out forwards; }
.w-float.f-clap, .w-float.f-cheer { color: #ffe27a; font-size: 17px; }
@keyframes floatUp3 { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -70px; } }
.w-note { background: rgba(15, 26, 53, .75); color: #ffe9a8; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.scene-hud { top: 92px; right: 10px; left: auto; z-index: 6; }
.walk-hint {
  position: absolute; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom));
  background: rgba(15, 26, 53, .72); color: #fff; font-size: 13px; padding: 6px 12px; border-radius: 99px; width: max-content; max-width: calc(100vw - 32px); text-align: center;
}
#joy {
  position: absolute; z-index: 7; left: 22px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 116px; height: 116px; border-radius: 50%;
  background: rgba(255, 255, 255, .28); border: 2px solid rgba(255, 255, 255, .7); box-shadow: 0 4px 16px rgba(0, 0, 0, .18); touch-action: none;
  display: grid; place-items: center;
}
#joyKnob { width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); pointer-events: none; }
#frontSheet {
  position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; margin: 0 10px max(10px, env(safe-area-inset-bottom));
  max-height: calc(100% - 110px); overflow-y: auto; max-width: 560px; margin-left: auto; margin-right: auto;
}
@media (max-width: 580px) { #frontSheet { left: 10px; right: 10px; margin: 0 0 max(10px, env(safe-area-inset-bottom)); } }
.panel { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; margin: 0 auto max(10px, env(safe-area-inset-bottom)); }
.tap-hint { margin: 0 0 8px; text-align: center; }
.row3b { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
/* 신인님 등장 때: 3D 마당이 보이도록 화면은 밝게 두고 글자만 아래쪽에 */
#ceremony {
  position: absolute; inset: 0; z-index: 9; pointer-events: none; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 246, 200, .35) 0%, rgba(255, 240, 190, 0) 60%);
  padding-bottom: calc(26px + env(safe-area-inset-bottom));
}
.cer-box {
  display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: min(720px, calc(100vw - 24px));
  background: rgba(15, 20, 45, .62); border: 1px solid rgba(255, 226, 122, .45); border-radius: 16px; padding: 12px 16px 14px;
}
#ceremony .call { margin-top: 2px; font-size: clamp(18px, 4.8vw, 30px); }
#ceremony .hear-badge { margin-top: 0; }
#panoView { position: absolute; inset: 0; z-index: 30; background: var(--night); }
#panoView #pano, #panoView #panoFallback { position: absolute; inset: 0; }
/* 배경 소리 (회장님 04:4x) — 왼쪽 위 작은 단추, 누르면 접히는 칸 */
.music-fab { position: absolute; z-index: 10; top: 92px; left: 10px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 5px 11px; }
.music-fab svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.music-fab.on { background: rgba(127, 174, 60, .85); border-color: rgba(255, 255, 255, .7); }
.music-panel {
  position: absolute; z-index: 11; top: 130px; left: 10px; width: min(330px, calc(100vw - 20px)); max-height: calc(100% - 290px); overflow-y: auto;
  background: rgba(255, 255, 255, .96); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 13.5px;
}
.mp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mp-modes { display: grid; gap: 4px; }
.mm { display: flex; align-items: center; gap: 6px; padding: 5px 4px; border-radius: 8px; }
.mm input { accent-color: var(--accent); width: 17px; height: 17px; }
.mm.off { color: #9aa39c; }
.mm.sel { background: #f1f8e6; }
.music-fab svg { color: #fff; }
.music-fab.blocked { background: #c9a24a; border-color: #fff; animation: hop .6s ease-in-out infinite; }
.mp-now b { color: var(--ink); } .mp-now b.warn { color: #b26a00; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-right: 5px; vertical-align: -1px; }
.eq i { width: 3px; background: var(--accent); animation: eqb .8s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; } .eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eqb { 0%, 100% { height: 3px; } 50% { height: 12px; } }
#music-on-tip { display: none; }
/* 소원석 첫 화면 = 360 실사 + 큰 [기도하기] (회장님 06:2x) */
.pano-intro { display: none; }
#panoView.intro .pano-intro {
  display: flex; flex-direction: column; align-items: center; gap: 6px; position: absolute; z-index: 6; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%); width: min(520px, calc(100% - 24px)); background: rgba(15, 20, 45, .66); border: 1px solid rgba(255, 226, 122, .5);
  border-radius: 16px; padding: 12px 16px 14px; color: #fff; text-align: center;
}
#panoView.intro #btnPanoClose { display: none; }
.pi-title { font-weight: 900; font-size: 18px; color: #ffe9a8; }
.pi-sub { font-size: 13px; opacity: .9; }
.pi-pray { width: 100%; min-height: 54px; font-size: 20px; letter-spacing: 2px; margin-top: 4px; box-shadow: 0 0 0 3px rgba(255, 226, 122, .35), 0 6px 18px rgba(0, 0, 0, .3); }
@media (orientation: landscape) and (max-height: 520px) { .pi-sub { display: none; } .pi-pray { min-height: 44px; font-size: 17px; } }
/* 360 실사 첫 화면 위에서도 배경 소리 단추가 보이게 */
.music-fab, .music-panel, .yt-box { z-index: 36; }
.yt-box.big { z-index: 45; }
.mp-nowrow { display: flex; align-items: center; gap: 8px; margin: 8px 0 6px; }
.mp-now { flex: 1; min-width: 0; color: var(--ink-soft); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-big { min-height: 42px; padding: 8px 12px; font-size: 14px; }
.mp-ctrl { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 6px; margin-bottom: 8px; }
.mp-rep[data-rep="off"] { color: var(--ink-soft); }
.mp-rep[data-rep="one"], .mp-rep[data-rep="all"] { border-color: var(--accent); color: #4c7a1c; }
.mp-list .no { display: inline-block; width: 20px; color: var(--ink-soft); font-size: 12px; }
.mp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.mp-list li { display: flex; align-items: center; gap: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 2px 6px; }
.mp-list li.now { border-color: var(--accent); background: #f1f8e6; }
.mp-list li.dragging { opacity: .6; box-shadow: var(--shadow); }
.mp-list .grip { cursor: grab; touch-action: none; padding: 4px 6px; color: var(--ink-soft); font-size: 16px; user-select: none; }
.mp-list .tt { flex: 1; text-align: left; border: 0; background: none; padding: 9px 0; font-size: 14px; min-height: 40px; }
/* 퍼가기 막힌 곡: 목록에 이유 + 유튜브에서 열기 (회장님 06:1x) */
.mp-list li { flex-wrap: wrap; }
.mp-list .yt-blk { flex-basis: 100%; padding: 0 0 6px 30px; font-size: 12px; color: #9a5b00; }
.mp-list .yt-blk a, .mp-note a { color: #2a6db0; font-weight: 700; }
.mp-note { margin: 4px 0 8px; padding: 6px 9px; border-radius: 8px; background: #fff6e0; color: #6b4a00; font-size: 12.5px; line-height: 1.45; }
/* 미니맵 (오른쪽 위, 360 단추 아래) — 회장님 05:1x */
.mini-map {
  position: absolute; z-index: 6; top: 130px; right: 10px; width: 118px; aspect-ratio: 2000 / 1409; padding: 0; border: 2px solid #fff;
  border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); background: #cfe3b5;
}
.mini-map img, .map-big-inner img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; }
.mini-map .mm-place, .map-big-inner .mm-place { position: absolute; transform: translate(-50%, -50%); border: 0; background: none; padding: 0; display: flex; align-items: center; gap: 3px; }
.mm-place .dot { width: 8px; height: 8px; border-radius: 50%; background: #3fbf3f; box-shadow: 0 0 0 2px #fff; display: block; }
.mm-place .lock { width: 10px; height: 10px; display: grid; place-items: center; background: rgba(15, 26, 53, .7); border-radius: 3px; }
.mm-place .lock svg { width: 8px; height: 8px; fill: none; stroke: #fff; stroke-width: 2.4; }
.mini-map .mm-place { pointer-events: none; }
.mm-me { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #e8423a; box-shadow: 0 0 0 2px #fff; animation: pulseMe 1.4s infinite; }
@keyframes pulseMe { 0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 2px rgba(232, 66, 58, .5); } 50% { box-shadow: 0 0 0 2px #fff, 0 0 0 7px rgba(232, 66, 58, 0); } }
.mm-pt { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; }
.mm-angels { background: #fff; box-shadow: 0 0 6px #fff; } .mm-sinin_walk { background: #ffd34d; } .mm-friends { background: #4aa3ff; }
.map-big-box { width: min(980px, 100%); }
.map-big-inner { position: relative; width: 100%; aspect-ratio: 2000 / 1409; border-radius: 10px; overflow: hidden; }
.map-big-inner .mm-place .dot { width: 14px; height: 14px; }
.map-big-inner .mm-place .lock { width: 16px; height: 16px; } .map-big-inner .mm-place .lock svg { width: 12px; height: 12px; }
.map-big-inner .mm-place span { background: rgba(15, 26, 53, .78); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.map-big-inner .mm-place.open span { background: #3a9a3a; font-weight: 700; }
.map-big-inner .mm-me { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
.map-big-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px; }
.map-big-list button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 7px 8px; font-size: 13px; }
.map-big-list li.open button { border-color: var(--accent); background: #f1f8e6; }
.map-big-list .no { display: inline-block; min-width: 20px; color: var(--ink-soft); font-size: 11px; }
.map-big-list small { color: var(--ink-soft); }
.open-tag { color: #3a8a1a; font-size: 12px; }
@media (min-width: 900px) { .mini-map { width: 210px; } }

/* 유튜브 작은 창 (왼쪽 위, 배경 소리 단추 아래) */
.yt-box { position: absolute; z-index: 10; top: 130px; left: 10px; width: 176px; background: #000; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.yt-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.yt-frame iframe, #ytPlayer { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-bar { display: flex; align-items: center; gap: 4px; padding: 4px; background: rgba(15, 26, 53, .92); }
.yt-title { flex: 1; min-width: 0; color: #fff; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-bar .chip { padding: 3px 7px; font-size: 11px; }
.yt-box.big { z-index: 40; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(92vw, 860px); }
body.yt-on .music-panel { top: 268px; max-height: calc(100% - 430px); }
@media (min-width: 900px) { .yt-box { width: 256px; } body.yt-on .music-panel { top: 318px; } }
.pano-hud { position: absolute; z-index: 5; top: 92px; right: 10px; display: flex; align-items: center; gap: 6px; color: #fff; font-size: 12.5px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); flex-wrap: wrap; justify-content: flex-end; }

/* ===================== 16:9 무대 · 반응형 (회장님 05:1x) =====================
 * 가로 = 16:9 무대(남는 곳은 어두운 띠), 조작판은 오른쪽에 붙음. 세로 = 꽉 찬 화면 + '가로로 돌려 주세요'.
 * 겹침 막기: 왼쪽 위 = 배경 소리·유튜브 창 / 오른쪽 위 = 360·미니맵(조작판이 열리면 미니맵 숨김) / 왼쪽 아래 = 조이스틱 / 오른쪽 = 조작판. */
:root { --top: 92px; --yth: 138px; --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); }
body.in-game { background: #0b1226; overflow: hidden; }
.scene-hud { top: var(--top); right: calc(10px + var(--sr)); }
.music-fab { top: var(--top); left: calc(10px + var(--sl)); }
.pano-hud { top: var(--top); }
.mini-map { top: calc(var(--top) + 38px); right: calc(10px + var(--sr)); }
.yt-box { top: calc(var(--top) + 38px); left: calc(10px + var(--sl)); }
.music-panel { top: calc(var(--top) + 38px); left: calc(10px + var(--sl)); max-height: calc(100% - var(--top) - 50px); }
body.yt-on .music-panel { top: calc(var(--top) + 46px + var(--yth)); max-height: calc(100% - var(--top) - var(--yth) - 58px); }
#joy { left: calc(22px + var(--sl)); }
.rotate-tip {
  position: absolute; z-index: 12; left: 10px; right: 10px; top: calc(var(--top) + 38px); display: flex; align-items: center; gap: 8px;
  background: rgba(15, 26, 53, .9); color: #fff; border-radius: 12px; padding: 8px 10px; font-size: 13px; line-height: 1.4;
}
.rotate-tip svg { width: 26px; height: 26px; flex: none; fill: none; stroke: #ffe27a; stroke-width: 1.8; stroke-linecap: round; animation: tilt 2s ease-in-out infinite; }
.rotate-tip .chip { flex: none; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (min-width: 900px) { :root { --yth: 182px; } }
@media (orientation: portrait) { .mini-map, .rotate-tip { top: calc(var(--top) + 76px); } }

@media (orientation: landscape) {
  #scrInside.active {
    inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(100vw, calc(100dvh * 16 / 9)); height: min(100dvh, calc(100vw * 9 / 16));
  }
  #scrInside .panel, #scrInside #frontSheet {
    left: auto; right: calc(8px + var(--sr)); top: calc(var(--top) + 40px); bottom: 8px; width: min(380px, 46%);
    margin: 0; max-width: none; max-height: none; overflow-y: auto; align-self: auto;
  }
  body.panel-open .mini-map { display: none; }
  .walk-hint { bottom: 16px; left: auto; right: 16px; transform: none; max-width: 46%; }
  #ceremony { padding-bottom: 14px; }
  .cer-box { max-width: min(720px, 80%); }
}
/* 폰 가로(높이가 낮음): 위 줄을 얇게, 단계 줄 숨김, 단추·창 작게 */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --top: 46px; --yth: 112px; }
  #topbar { height: 40px; }
  #steps { display: none !important; }
  body:has(#topbar:not(.hidden)) #scrMap { padding-top: 48px; }
  .chip { padding: 4px 9px; font-size: 12px; }
  .chip.ghost { font-size: 12px; padding: 4px 10px; }
  .mini-map { width: 104px; }
  .yt-box { width: 150px; }
  #joy { width: 96px; height: 96px; bottom: 12px; }
  #joyKnob { width: 44px; height: 44px; }
  #scrInside .panel, #scrInside #frontSheet { padding: 10px; font-size: 13px; }
  .panel-msg { font-size: 13px; margin-bottom: 6px; }
  .btn.big { min-height: 44px; font-size: 15px; }
  .btn { min-height: 38px; padding: 8px 10px; font-size: 13.5px; }
  .notice { font-size: 14px; padding: 10px; }
  .guide ul, .guide p { font-size: 13px; }
  .acts .act { padding: 5px 4px; }
  .cer-box { padding: 8px 12px 10px; }
  #ceremony .call { font-size: clamp(16px, 3.6vw, 24px); }
  .walk-hint { font-size: 12px; padding: 5px 10px; }
  .toast { top: 54px; }
}

/* ===================== 첫 화면 지도: 화면에 꽉 (회장님 06:3x) ===================== */
#scrMap.active { display: block !important; position: fixed; inset: 0; padding: 0 !important; overflow: hidden; background: #8cc06a; }
.map-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.map-stage.dragging { cursor: grabbing; }
.map-pan { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.map-pan img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.map-spots { position: absolute; inset: 0; }
.spot { position: absolute; width: 58px; height: 58px; transform: translate(-50%, -50%); border: 0; background: none; padding: 0; cursor: pointer; }
.spot .ring { position: absolute; inset: 6px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0); transition: all .2s; }
.spot:hover .ring, .spot.show .ring, .spot:focus-visible .ring { border-color: rgba(255, 255, 255, .95); background: rgba(255, 255, 255, .18); }
.spot.open .ring { border-color: #ffd34d; background: rgba(255, 211, 77, .25); box-shadow: 0 0 18px rgba(255, 211, 77, .9); }
.spot .pulse { position: absolute; inset: 0; border-radius: 50%; background: rgba(255, 211, 77, .5); animation: pulse 1.8s ease-out infinite; }
.spot .nm {
  position: absolute; left: 50%; top: 100%; transform: translate(-50%, 2px); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s;
  background: rgba(15, 26, 53, .85); color: #fff; font-size: 26px; font-weight: 700; padding: 3px 12px; border-radius: 99px;
}
.spot:hover .nm, .spot.show .nm, .spot.open .nm { opacity: 1; }
.spot.open .nm { background: #3a7a1a; }
.map-brand { position: absolute; z-index: 5; left: calc(12px + var(--sl)); bottom: 14px; background: rgba(255, 255, 255, .88); border-radius: 99px; padding: 5px 12px; font-size: 13px; box-shadow: var(--shadow); }
.map-brand span { color: var(--ink-soft); font-size: 12px; }
.map-zoom { position: absolute; z-index: 5; left: calc(12px + var(--sl)); bottom: 52px; display: flex; flex-direction: column; gap: 6px; }
.map-zoom .chip { width: 40px; height: 40px; padding: 0; font-size: 20px; font-weight: 700; box-shadow: var(--shadow); }
.entry-float {
  position: absolute; z-index: 20; right: calc(14px + var(--sr)); top: 60px; width: min(360px, 44%); max-height: calc(100% - 76px); overflow-y: auto;
  margin: 0 !important; background: rgba(255, 255, 255, .95);
}
body:not(:has(#topbar:not(.hidden))) .entry-float { top: 14px; }
.entry-float.small { width: min(320px, 44%); }
@media (orientation: portrait) {
  .entry-float, .entry-float.small { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: 52%; }
  .map-zoom { bottom: auto; top: 96px; }
  .map-brand { bottom: auto; top: 60px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .entry-float { top: 50px; max-height: calc(100% - 60px); padding: 10px; }
  .entry-float .sheet-title { font-size: 15px; margin-bottom: 6px; }
  .entry-float .fine { display: none; }
  .entry-float .divider { margin: 8px 0 6px; }
}
