/* 잃은 양 찾기 — 휴대폰 세로 우선. 색은 common/base.css 토큰 */
.ls-app { max-width: 760px; margin: 0 auto; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.ls-main { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0 16px 24px; }
body.ls-playing { overflow: hidden; overscroll-behavior: none; }
body.ls-playing .ls-app { height: 100vh; height: 100svh; }
body.ls-playing .ls-main { padding: 0; }

/* 시작 화면 */
.ls-cover { display: flex; align-items: flex-end; justify-content: center; gap: 4px; width: 100%; max-width: 420px; padding: 24px 12px;
  border-radius: var(--r-card); background: var(--sky); }
.ls-start { grid-template-columns: minmax(0, 1fr); width: 100%; }
.ls-cover img { width: 100%; height: auto; }
.ls-cover .ls-chip { min-width: 0; width: 17%; height: auto; }
.ls-cover .ls-chip:nth-child(3) { width: 30%; }
.ls-lead { max-width: 30em; }

/* 놀이 판 */
.ls-game { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ls-view { position: relative; flex: 1; min-height: 0; margin: 0 8px; overflow: hidden; overflow: clip; border-radius: 20px; background: var(--field);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; }
.ls-view.grab { cursor: grabbing; }
.ls-view:focus-visible { outline-offset: -4px; }
.ls-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.ls-map { display: block; max-width: none; }

.ls-hud { position: absolute; left: 8px; top: 8px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.ls-hud .chip { font-size: 16px; font-weight: 800; box-shadow: 0 3px 0 rgba(28, 37, 84, .15); font-variant-numeric: tabular-nums; }
.ls-zoom { position: absolute; right: 8px; top: 8px; display: grid; gap: 10px; }
.ls-zbtn { background: var(--cream); color: var(--ink); font-size: 32px; font-weight: 900; }
.ls-zbtn:disabled { color: rgba(28, 37, 84, .25); box-shadow: none; cursor: default; }
.ls-hint { position: absolute; left: 8px; bottom: 10px; width: 68px; height: 68px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--cream); box-shadow: 0 4px 0 rgba(28, 37, 84, .2); }
.ls-hint:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(28, 37, 84, .2); }
.ls-hint-mark { position: absolute; right: -2px; top: -4px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--cream); font-weight: 900; font-size: 18px; }
.ls-hint.nudge { animation: ls-wiggle .9s ease-in-out infinite; background: var(--gold); }
.ls-hint.nudge .ls-hint-mark { background: var(--joy); }
.ls-hint.nudge .ls-hint-mark::before { content: "!"; }
.ls-hint.nudge .ls-hint-mark { font-size: 0; }
.ls-hint.nudge .ls-hint-mark::before { font-size: 18px; }
.ls-chip { display: block; flex: none; overflow: visible; }

/* 키보드로 찾을 때 가운데 표시 */
.ls-reticle { display: none; position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border: 4px solid var(--ink); border-radius: 50%; box-shadow: 0 0 0 3px var(--cream); pointer-events: none; }
.ls-view.kb .ls-reticle { display: block; }

/* 말 한 줄 */
.ls-say { position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%); width: min(calc(100% - 16px), 440px); display: flex; align-items: center; gap: 8px;
  pointer-events: none; animation: ls-in .25s ease-out; }
.ls-say .bubble { flex: 1; box-shadow: 0 4px 0 rgba(28, 37, 84, .15); }
.ls-say .bubble::after { display: none; }

/* 서랍: 찾을 것 6칸 */
.ls-drawer { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
.ls-slot { position: relative; min-height: 66px; min-width: 0; padding: 4px 0 2px; border: 0; border-radius: 16px; cursor: pointer;
  display: grid; justify-items: center; align-content: center; gap: 0; background: var(--cream); box-shadow: 0 3px 0 rgba(28, 37, 84, .15); }
.ls-slot-name { font-size: 12px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.ls-slot-mark { position: absolute; right: 2px; top: 2px; min-width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; font-weight: 900; }
.ls-slot-mark:empty { display: none; }
.ls-slot.found { background: var(--gold); }
.ls-slot.found .ls-slot-mark { background: var(--ink); color: var(--cream); }
.ls-slot.found .ls-chip { opacity: .9; }
.ls-slot.locked { background: rgba(255, 246, 227, .55); cursor: default; }
.ls-slot.locked .ls-chip { filter: brightness(0) opacity(.35); }
.ls-slot.locked .ls-slot-mark { background: var(--lock-dark); color: #fff; }
.ls-slot.focused { box-shadow: 0 0 0 4px var(--ink), 0 3px 0 rgba(28, 37, 84, .15); }
.ls-slot.ls-unlock { animation: ls-pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.ls-slot.ls-flash { animation: ls-pop .5s ease-out; }

/* 지도 위 움직임 */
.ls-item { transform-box: view-box; }
.ls-item.popped { transition: transform .45s cubic-bezier(.3, 1.7, .5, 1); }
.ls-pose { transform-box: fill-box; transform-origin: 50% 100%; }
.ls-pose.act { animation: ls-hop .5s ease-in-out .45s 3; }
.ls-pose--dada.act { animation: ls-kick .45s ease-in-out .45s 3; }
.ls-pose--siwoo.act { animation: ls-wiggle .4s ease-in-out .45s 4; }
.ls-pose--yangmal.act { animation: ls-stretch 1.2s ease-in-out .45s 1; }
.ls-pose--mongsil.act { animation: ls-spin .8s ease-in-out .45s 1; transform-origin: 50% 50%; }
.ls-ring { fill: none; stroke: var(--gold); stroke-width: 7; stroke-dasharray: 10 6; }
.ls-ripple { fill: none; stroke: var(--cream); animation: ls-ripple .5s ease-out forwards; transform-box: fill-box; transform-origin: center; }
.ls-bob { transform-box: fill-box; transform-origin: 50% 100%; animation: ls-bob 2.6s ease-in-out infinite; }
.ls-bob.ls-nope { animation: ls-hop .4s ease-in-out 2; }
.ls-cloud { animation: ls-drift 28s ease-in-out infinite alternate; }
.ls-paused *, .ls-paused *::before, .ls-paused *::after { animation-play-state: paused !important; }

/* 시작 이야기 · 조작 안내 · 단계 글씨 */
.ls-intro { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end; padding: 16px; background: rgba(28, 37, 84, .25); cursor: pointer; }
.ls-intro-card { width: 100%; display: grid; gap: 14px; justify-items: center; padding: 16px; border-radius: var(--r-card); background: var(--sky);
  box-shadow: 0 6px 0 rgba(28, 37, 84, .2); animation: ls-rise .25s ease-out; }
.ls-intro-card .say-row { width: 100%; margin: 0; }
.ls-intro-card .bubble { font-size: 20px; }
.ls-tut { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 8px;
  padding: 16px 20px; border-radius: var(--r-card); background: rgba(28, 37, 84, .82); color: var(--cream); font-weight: 800; text-align: center; pointer-events: none; }
.ls-tut-hand { font-size: 44px; width: 1.8em; height: 1.8em; margin: 0 auto; background: url(../../assets/ui/finger.svg) center / contain no-repeat; animation: ls-swipe 1.6s ease-in-out infinite; }
.ls-banner { position: absolute; left: 12px; right: 12px; top: 30%; z-index: 9; padding: 18px; border-radius: var(--r-card); text-align: center;
  background: var(--gold); box-shadow: 0 6px 0 var(--gold-dark); pointer-events: none; animation: ls-pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.ls-banner-big { font-size: 24px; font-weight: 900; line-height: 1.35; }
.ls-banner-sub { font-weight: 700; }

/* 목자가 양을 메고 오는 장면 (친구들 동작보다 크게: 화면 전체) */
.ls-scene { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--sky); overflow: auto; }
.ls-scene-stage { position: relative; flex: 1 1 auto; min-height: 240px; display: grid; place-items: end center; overflow: hidden; }
.ls-scene-svg, .ls-scene-bg { width: 100%; height: auto; max-height: 100%; }
.ls-scene-bg { position: absolute; inset: 0; height: 100%; object-fit: cover; }
/* 잔치 그림 앞 아이 넷: 왼쪽 아래(상 앞)에 나란히, 키 비율 시우 100·다다 94·미미 76·봉봉 57, 발끝 같은 바닥선 */
.ls-scene-kids { position: absolute; left: 3%; bottom: 3%; height: 40%; display: flex; align-items: flex-end; gap: 2px; pointer-events: none; }
.ls-scene-kids > *, .ls-scene-kids > .fig { height: 100%; width: auto; flex: none; transform-origin: 50% 100%; }
.ls-scene-kids > :nth-child(2) { height: 94%; } .ls-scene-kids > :nth-child(3) { height: 76%; } .ls-scene-kids > :nth-child(4) { height: 57%; }
.ls-scene.arrived .ls-scene-kids > * { animation: ls-hop .5s ease-in-out infinite; }
.ls-scene.arrived .ls-scene-kids > :nth-child(2) { animation-delay: .12s; } .ls-scene.arrived .ls-scene-kids > :nth-child(3) { animation-delay: .24s; } .ls-scene.arrived .ls-scene-kids > :nth-child(4) { animation-delay: .36s; }
.ls-walker { transform: translate(-90px, 300px); animation: ls-walk 2.2s ease-out forwards; }
.ls-walk-bob { animation: ls-hop .35s ease-in-out 6; }
.ls-jump { transform-box: fill-box; transform-origin: 50% 100%; }
.ls-scene.arrived .ls-jump { animation: ls-hop .5s ease-in-out infinite; }
.ls-scene-text { background: #7CC77B; display: grid; gap: 12px; justify-items: center; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.ls-scene-text .bubble { width: 100%; }
.ls-verse { width: 100%; text-align: center; animation: ls-pop .5s ease-out; }
.ls-verse-text { font-size: 21px; font-weight: 800; line-height: 1.5; }
.ls-verse-ref { font-size: 15px; font-weight: 700; opacity: .75; }

/* 끝 화면 */
.ls-end { grid-template-columns: minmax(0, 1fr); }
.ls-party { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; }
.ls-party .ls-chip { min-width: 0; width: 18%; max-width: 72px; height: auto; }
.ls-party .ls-chip:nth-child(3) { width: 28%; max-width: 104px; }
.ls-stats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ls-stats .chip { font-size: 17px; font-weight: 800; background: var(--white); }
.ls-note { text-align: center; font-size: 15px; }

@keyframes ls-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes ls-in { from { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes ls-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes ls-hop { 50% { transform: translateY(-18px); } }
@keyframes ls-kick { 30% { transform: translateY(-16px) rotate(-10deg); } 60% { transform: translateY(-8px) rotate(8deg); } }
@keyframes ls-wiggle { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes ls-stretch { 30% { transform: scale(1.3, .8); } 60% { transform: scale(.9, 1.15); } }
@keyframes ls-spin { to { transform: rotate(360deg); } }
@keyframes ls-bob { 50% { transform: translateY(-4px) scale(1.02, .98); } }
@keyframes ls-drift { to { transform: translateX(60px); } }
@keyframes ls-ripple { from { opacity: 1; transform: scale(.4); } to { opacity: 0; transform: scale(1.6); } }
@keyframes ls-swipe { 0%, 100% { transform: translateX(-24px); } 50% { transform: translateX(24px); } }
@keyframes ls-walk { to { transform: translate(96px, 300px); } }
.ls-scene.arrived .ls-walker { animation: none; transform: translate(96px, 300px); }

/* 휴대폰 세로: 봉봉 버그 신고 단추(오른쪽 아래 44px, 고정)가 지도 판 모서리에 걸쳐 숨은 양을 찾다가 눌렸다 (밤 검수 10/30).
   서랍 오른쪽을 단추 폭 + 단추가 비켜 가는 여백(bug.js GAP 6)만큼 비워, 단추가 제자리(서랍 줄 안)에 앉고 지도 판과는 겹치지 않게 한다. */
@media (max-width: 767px) { body.ls-playing .ls-drawer { padding-right: calc(70px + env(safe-area-inset-right)); } }
@media (min-width: 761px) { .ls-view { margin: 0 16px; } .ls-drawer { padding-left: 16px; padding-right: 16px; gap: 8px; } }
@media (max-height: 640px) { .ls-slot { min-height: 58px; } .ls-slot-name { display: none; } }
@media (prefers-reduced-motion: reduce) { .ls-walker { transform: translate(96px, 300px); } }

/* 가로 휴대폰: 그림 왼쪽, 제목·설명·시작 오른쪽 (시작 단추가 첫 화면 안, 고칠 일 1) */
@media (orientation: landscape) and (max-height: 500px) {
  .ls-start { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-flow: dense; align-items: center; gap: 10px 20px; padding: 8px 0; }
  .ls-start > * { grid-column: 2; }
  .ls-start > .ls-cover { grid-column: 1; grid-row: 1 / span 9; width: min(100%, calc((100svh - 110px) * 1.3)); justify-self: center; padding: 8px; }
}
