/* 우주냥다방 화면. 낮의 카페는 따뜻하게, 우주(밤 보라 + 별빛 노랑)는 강조색으로만. */
:root {
  --night: #2c2350;
  --night2: #4a3d7a;
  --star: #ffe27a;
  --cream: #fff7ea;
  --wood: #f3dfc1;
  --ink: #3a2e2a;
  --soft: #8a7b6b;
  --tile: #fffaf2;
  --tile2: #f7ecda;
  --ok: #5cc56b;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

#app { max-width: 480px; height: 100%; margin: 0 auto; display: flex; flex-direction: column;
  background: var(--cream); padding-top: env(safe-area-inset-top); }

/* 상단 */
#hud { display: flex; gap: 6px; padding: 8px 8px 4px; background: var(--night); }
.pill { background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; padding: 6px 10px;
  display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.pill small { opacity: .7; font-size: 11px; }
.pill.icon { width: 36px; justify-content: center; padding: 0; font-size: 18px; margin-left: auto; }
#lvBox { flex: 1; min-width: 0; }
.lvNum { font-size: 13px; }
.bar { flex: 1; height: 8px; background: rgba(255,255,255,.2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--star); transition: width .3s; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.en { background: #7ee0a0; box-shadow: 0 0 0 2px rgba(126,224,160,.35); }
.dot.co { background: var(--star); box-shadow: 0 0 0 2px rgba(255,226,122,.35); }

/* 주문 줄 */
#orders { display: flex; gap: 8px; padding: 8px; overflow-x: auto; background: var(--night);
  touch-action: pan-x; min-height: 112px; scrollbar-width: none; }
#orders::-webkit-scrollbar { display: none; }
.order { flex: 0 0 auto; min-width: 116px; background: var(--cream); border-radius: 14px; padding: 6px 8px;
  display: flex; flex-direction: column; gap: 4px; position: relative; }
.order .crew { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--soft); }
.order .badge { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.order .badge::after { content: ''; display: block; width: 6px; height: 6px; margin: 4px auto 0; background: var(--star);
  clip-path: polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%); }
.order .needs { display: flex; gap: 4px; }
.order .need { width: 44px; height: 44px; border-radius: 10px; background: var(--tile2); position: relative; }
.order .need.have { background: #dff5e2; }
.order .need.have::after { content: '✓'; position: absolute; right: -2px; bottom: -4px; background: var(--ok); color: #fff;
  border-radius: 50%; width: 16px; height: 16px; font-size: 11px; line-height: 16px; text-align: center; }
.order .rw { font-size: 11px; color: var(--soft); }
.order.ready { box-shadow: 0 0 0 3px var(--ok); }
.order .go { background: var(--ok); color: #fff; border-radius: 8px; padding: 3px 0; font-size: 13px; font-weight: 700; }

/* 보드 */
#boardWrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 6px; min-height: 0;
  background: var(--wood); position: relative; overflow: hidden; isolation: isolate; }
/* 보드 뒤 발도장 무늬가 천천히 흘러감 (냥다방과 같음, transform으로만 움직임) */
#boardWrap::before { content: ""; position: absolute; top: -240px; left: -120px; right: 0; bottom: 0; z-index: -1; pointer-events: none; opacity: .14; will-change: transform;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' fill='white'%3E%3Cg transform='translate(30 34) rotate(-20)'%3E%3Cellipse cx='0' cy='6' rx='9' ry='7.5'/%3E%3Ccircle cx='-10' cy='-5' r='3.6'/%3E%3Ccircle cx='-3.5' cy='-10' r='3.8'/%3E%3Ccircle cx='4' cy='-10' r='3.8'/%3E%3Ccircle cx='10.5' cy='-5' r='3.6'/%3E%3C/g%3E%3Cg transform='translate(90 92) rotate(18)'%3E%3Cellipse cx='0' cy='6' rx='9' ry='7.5'/%3E%3Ccircle cx='-10' cy='-5' r='3.6'/%3E%3Ccircle cx='-3.5' cy='-10' r='3.8'/%3E%3Ccircle cx='4' cy='-10' r='3.8'/%3E%3Ccircle cx='10.5' cy='-5' r='3.6'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 120px 120px;
  animation: pawDrift 70s linear infinite; }
@keyframes pawDrift { to { transform: translate3d(120px, 240px, 0); } }

/* 보드 연출 (냥다방에서 옮김) */
.cell > .art { position: relative; z-index: 1; }
/* 쓸 수 있는 장비: 뒤에서 금빛이 숨 쉬듯 */
.cell.ready::before { content: ""; position: absolute; inset: 8%; border-radius: 50%; background: radial-gradient(circle, rgba(255,246,201,.95), rgba(255,197,51,.55) 55%, transparent 72%); animation: genGlow 1.6s ease-in-out infinite alternate; }
@keyframes genGlow { from { transform: scale(.86); opacity: .7; } to { transform: scale(1.06); opacity: 1; } }
/* 고른 칸: 하얀 테두리가 두근두근 */
.cell.sel::after { content: ""; position: absolute; inset: 1px; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--night2); pointer-events: none; z-index: 2; animation: selPulse .6s ease-in-out infinite alternate; }
@keyframes selPulse { to { transform: scale(1.06); } }
/* 끌고 가는 물건과 합칠 수 있는 칸: 흔들흔들 */
.cell.tgt > .art { animation: tgt .5s ease-in-out infinite alternate; }
@keyframes tgt { from { transform: scale(1); } to { transform: scale(1.12) rotate(-4deg); } }
/* 높은 단계(끝에서 두 번째): 반짝이, 최고 단계: 후광 + 반짝이 둘 */
.cell .tw { position: absolute; right: 6%; top: 2%; z-index: 2; color: #fff; font-size: 13px; line-height: 1; pointer-events: none; text-shadow: 0 0 5px #ffb300, 0 0 2px #ffb300; animation: twinkle 1.5s ease-in-out infinite; }
.cell .tw.b { right: auto; left: 8%; top: auto; bottom: 10%; font-size: 10px; animation-delay: -.7s; }
.cell.t3::before { content: ""; position: absolute; inset: -4%; border-radius: 50%; background: radial-gradient(circle, rgba(255,236,150,1), rgba(255,197,51,.6) 48%, transparent 72%); animation: halo 1.3s ease-in-out infinite alternate; }
@keyframes twinkle { 0%, 100% { transform: scale(.4) rotate(0); opacity: .3; } 50% { transform: scale(1.15) rotate(40deg); opacity: 1; } }
@keyframes halo { from { transform: scale(.95); } to { transform: scale(1.1); } }
/* 얼음 칸: 물건이 얼음에 갇혀 있음. 같은 물건을 올리면 깨짐. 옮기거나 주문에 못 씀 */
.cell .ice { position: absolute; inset: 0; z-index: 3; border-radius: 12px; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.75), rgba(196,234,255,.55) 40%, rgba(140,205,250,.6)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.9), inset 0 -4px 8px rgba(80,150,210,.35); }
.cell .ice::before { content: ""; position: absolute; left: 14%; top: 10%; width: 34%; height: 12%; border-radius: 8px; background: rgba(255,255,255,.85); transform: rotate(-20deg); }
.cell .ice::after { content: ""; position: absolute; right: 16%; bottom: 14%; width: 14%; height: 8%; border-radius: 6px; background: rgba(255,255,255,.7); transform: rotate(-20deg); }
@media (prefers-reduced-motion: reduce) { #boardWrap::before, .cell.ready::before, .cell.sel::after, .cell.tgt > .art, .cell .tw, .cell.t3::before { animation: none; } }
#board { display: grid; gap: 4px; width: 100%; max-width: 440px; touch-action: none; }
#hud, #orders, #info, #bottom { flex: 0 0 auto; }
.cell { aspect-ratio: 1; background: var(--tile); border-radius: 12px; position: relative; display: flex;
  align-items: center; justify-content: center; }
.cell:nth-child(odd) { background: var(--tile2); }
.cell.sel { box-shadow: inset 0 0 0 3px var(--night2); }
.cell.hint { box-shadow: inset 0 0 0 3px var(--ok); }
.art { width: 92%; height: 92%; object-fit: contain; pointer-events: none; display: block; }
.cell .cool { position: absolute; inset: 0; border-radius: 12px; background: rgba(44,35,80,.55); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; text-align: center; }
.cell .left { position: absolute; left: 3px; top: 2px; font-size: 10px; background: var(--night); color: var(--star);
  border-radius: 6px; padding: 0 4px; font-weight: 700; }
.cell .grade { position: absolute; right: 3px; bottom: 1px; font-size: 10px; color: #f2b705; text-shadow: 0 1px 0 #7a5a00; letter-spacing: -1px; }
.cell .cool, .cell .left, .cell .grade, .cell .crown { z-index: 2; }
.cell.pop .art { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }

#ghost { position: fixed; width: 56px; height: 56px; pointer-events: none; z-index: 50; transform: translate(-50%,-50%); }
#ghost .art { width: 100%; height: 100%; }

/* 연출 (냥다방과 같음): 입자 캔버스와 떠오르는 글자. 누르기를 막지 않음 */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
#floats { position: fixed; inset: 0; pointer-events: none; z-index: 61; overflow: hidden; }
.float { position: absolute; left: 0; top: 0; font-size: 20px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 var(--night), 0 0 6px rgba(20,14,40,.6); white-space: nowrap; will-change: transform; }
.float.combo { color: var(--star); font-size: 26px; }
.float.emo { text-shadow: none; font-size: 22px; }
.bump { animation: bump .3s; }
@keyframes bump { 40% { transform: scale(1.18); } }

/* 아래 */
#info { padding: 4px 10px 6px; font-size: 13px; background: var(--wood); }
#info .irow { display: flex; align-items: center; gap: 6px; min-height: 32px; }
#infoText { flex: 1; min-width: 0; font-weight: 600; }
#infoBtn { background: var(--night2); color: #fff; border-radius: 10px; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.bag { background: var(--night); color: var(--star); border-radius: 10px; padding: 6px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.bag.lock { background: #b9b2a6; color: #eee; }
/* 아이템 줄 보기: 그림 + 화살표 */
#chain { display: flex; align-items: center; gap: 2px; overflow-x: auto; height: 40px; scrollbar-width: none; touch-action: pan-x; }
#chain::-webkit-scrollbar { display: none; }
#chain .ci { flex: 0 0 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.6); position: relative; }
#chain .ci.on { background: #fff; box-shadow: 0 0 0 2px var(--night2); }
#chain .ci.unk .art { filter: brightness(0); opacity: .18; }
#chain .ci .crown { width: 12px; right: -3px; bottom: -3px; }
#chain .ar { flex: 0 0 auto; width: 0; height: 0; border: 4px solid transparent; border-left: 6px solid #b39b7c; margin: 0 1px 0 3px; }
.crown { position: absolute; right: -2px; bottom: -2px; width: 24px; pointer-events: none; }
/* 짝 알려 주기: 두 칸이 서로 살짝 다가갔다 돌아옴 (transform만) */
.cell.magnet > .art { animation: magnet 1.6s ease-in-out infinite; }
@keyframes magnet { 0%, 55%, 100% { transform: none; } 22%, 34% { transform: translate(var(--dx), var(--dy)); } }
@media (prefers-reduced-motion: reduce) { .cell.magnet > .art { animation: none; } .cell.magnet { box-shadow: inset 0 0 0 2px var(--star); } }
#bottom button.dot, .tabs button.dot { position: relative; }
#bottom button.dot::after, .tabs button.dot::after { content: ''; position: absolute; top: 6px; right: 18%; width: 8px; height: 8px; border-radius: 50%; background: #ff5a6e; }

/* 이야기 장면 (화면 전체) */
#story { position: fixed; inset: 0; z-index: 35; max-width: 480px; margin: 0 auto; overflow: hidden; background: #111; }
#story .sbg { position: absolute; inset: 0; transition: background .4s; }
#story .sbgName { position: absolute; left: 12px; top: calc(12px + env(safe-area-inset-top)); font-size: 11px; color: rgba(255,255,255,.6); background: rgba(0,0,0,.25); padding: 2px 8px; border-radius: 8px; }
#story .stand { position: absolute; bottom: 150px; width: 46%; transition: opacity .2s, transform .2s, filter .2s; }
#story .stand.L { left: 2%; } #story .stand.R { right: 2%; }
#story .stand.dim { filter: brightness(.6); transform: scale(.95); }
#story .stand svg { width: 100%; display: block; }
#story .stand .nm { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: #5a4b3c; }
#story .stand .face { position: absolute; right: 6%; top: 6%; font-size: 11px; background: #fff; border-radius: 10px; padding: 2px 7px; color: var(--night2); font-weight: 700; }
#story .sbox { position: absolute; left: 10px; right: 10px; bottom: calc(14px + env(safe-area-inset-bottom)); min-height: 124px; background: #fff;
  border-radius: 18px; padding: 12px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
#story .sname { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; min-height: 18px; }
#story .sname .badge { width: 14px; height: 14px; border-radius: 50%; }
#story .sname small { color: var(--soft); font-weight: 600; }
#story .stext { font-size: 17px; line-height: 1.55; }
#story .snext { position: absolute; right: 14px; bottom: 8px; font-size: 11px; color: var(--soft); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
#story .sbox.narr { background: rgba(10,8,24,.82); color: #fff; text-align: center; }
#story .sbox.narr .sname { display: none; }
#story .sbox.hq { background: #0d2a1c; color: #7dffb0; font-family: monospace; border: 3px solid #3b5f4a; }
#story .sletter { position: absolute; left: 8%; right: 8%; top: 22%; background: #fff6df; border-radius: 6px; padding: 28px 22px; font-family: serif;
  font-size: 17px; line-height: 1.8; color: #5a4636; box-shadow: 0 8px 30px rgba(0,0,0,.35); transform: rotate(-1deg); }
#story .sctl { position: absolute; right: 10px; top: calc(10px + env(safe-area-inset-top)); display: flex; gap: 6px; }
#story .sctl button { background: rgba(0,0,0,.35); color: #fff; border-radius: 12px; padding: 6px 12px; font-size: 12px; font-weight: 700; }
#story .sctl button.on { background: var(--star); color: var(--night); }

/* 주머니 · 도감 · 설정 */
.bagRow { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px; }
.slot { flex: 0 0 56px; height: 56px; border-radius: 12px; background: var(--tile2); display: flex; align-items: center; justify-content: center; }
.slot.empty { background: #f1ebe0; border: 2px dashed #d8ccb8; }
.slot.buy { background: var(--night2); color: #fff; font-weight: 800; font-size: 18px; flex-direction: column; line-height: 1; }
.slot.buy small { font-size: 10px; font-weight: 600; margin-top: 2px; }
.cards, .packRow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.packRow { margin-top: 8px; }
.card { aspect-ratio: 3/4; border-radius: 10px; background: var(--cb); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative; padding: 4px; text-align: center; }
.card b { font-size: 12px; } .card i { font-style: normal; font-size: 10px; color: #c08a00; }
.card.no { background: #e8e2d6; } .card.no b { color: #aaa; }
.card .tag { position: absolute; top: -6px; right: -4px; background: #ff5a6e; color: #fff; font-size: 10px; font-weight: 800; border-radius: 8px; padding: 1px 6px; }
.setT { font-weight: 800; margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.setT small { color: var(--soft); font-weight: 600; } .setT .ok { color: var(--ok); }
.setT button, .rec button:disabled { font-size: 12px; }
.setT button { background: var(--ok); color: #fff; border-radius: 8px; padding: 3px 8px; margin-left: auto; }
.rec button:disabled { background: #c9c1b6; }
.hint { font-size: 12px; color: var(--soft); text-align: center; }
.inp { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid #e0d6c6; font: inherit; font-size: 15px; margin-top: 8px; -webkit-user-select: text; user-select: text; }
.pwBox { position: relative; }
.pwBox .inp { padding-right: 48px; }
.pwEye { position: absolute; right: 4px; top: calc(50% + 4px); transform: translateY(-50%); width: 40px; height: 36px; border: 0; background: none; padding: 0; color: #3a3330; display: flex; align-items: center; justify-content: center; }
.pwEye svg { display: block; }
.acMsg { min-height: 1.2em; color: #c0392b !important; }
.pic { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 800; font-size: 13px; flex: 0 0 auto;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }
.pic.framed { position: relative; overflow: visible; box-shadow: none; }
.pic .frame { position: absolute; inset: -32%; width: 164%; height: 164%; pointer-events: none; }
.pics { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pics button { border-radius: 50%; padding: 2px; }
.pics button.on { box-shadow: 0 0 0 3px var(--night2); }
.tabs button { font-size: 12px; }
.sub { display: flex; gap: 6px; }
.sub button { flex: 1; padding: 6px 0; border-radius: 10px; background: #efe5d4; font-size: 12px; font-weight: 700; }
.sub button.on { background: var(--star); color: var(--night); }
.rec.rank { gap: 8px; } .rec.rank .no { width: 22px; text-align: center; color: var(--night2); }
.rec.rank.me { box-shadow: 0 0 0 2px var(--star); }
.rec.fb .t { font-weight: 500; font-size: 14px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.rec.fb .kind { background: var(--night); color: #fff; border-radius: 6px; padding: 0 5px; font-size: 11px; }
.rec.fb .st { float: right; color: #a08a5e; }
.fbForm { display: flex; flex-direction: column; gap: 6px; background: #fff; border-radius: 14px; padding: 10px; }
.fbForm textarea { min-height: 70px; border-radius: 10px; border: 1px solid #e0d6c6; padding: 8px; font: inherit; resize: vertical; -webkit-user-select: text; user-select: text; }
.fbForm select { align-self: flex-start; padding: 4px 8px; border-radius: 8px; font: inherit; }
.fbForm button, .wide { background: var(--night2); color: #fff; border-radius: 10px; padding: 8px; font-weight: 700; }
.wide { width: 100%; }
#modal .box { max-height: 86vh; overflow-y: auto; }
#modal .box > .row button:disabled { opacity: .5; }
.opt { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid #f0e8dc; font-size: 14px; }
.opt input { width: 20px; height: 20px; }
/* 아래 줄: 지도 · 보드 · 기록 */
#bottom { display: flex; gap: 8px; align-items: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--night); }
#bottom button { flex: 1; color: rgba(255,255,255,.7); font-weight: 700; font-size: 14px; padding: 10px 0; border-radius: 14px; }
#bottom button.on { color: #fff; background: rgba(255,255,255,.14); }
#bottom button.main { flex: 1.3; background: rgba(255,226,122,.25); color: var(--star); font-size: 16px; }
#bottom button.main.on { background: var(--star); color: var(--night); }
.big { background: var(--star); color: var(--night); font-weight: 800; border-radius: 16px; padding: 12px 28px; font-size: 17px; }
.ghost { color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 14px; padding: 10px 20px; font-size: 14px; }
.ghost:disabled { opacity: .45; }

/* 화면 갈아 끼우기: transform과 opacity만 움직임 */
#views { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--cream);
  opacity: 0; transform: translateX(24px); visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s; }
.view.on { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition: opacity .2s ease, transform .2s ease; }
.view.left { transform: translateX(-24px); }
@media (prefers-reduced-motion: reduce) { .view, .view.on { transition: none; transform: none; } }
#v-board { background: var(--wood); }
.vhead { background: var(--night); color: #fff; padding: 10px 12px; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.vhead h2 { margin: 0; font-size: 17px; flex: 1; }
.vhead small { color: var(--star); }
.vhead .back { color: #fff; font-size: 14px; padding: 4px 6px; }
.list { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }

/* 지도 (임시 그림) */
#v-map { background: #e9f1dc; }
.map { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; }
.mapIn { position: relative; height: 230%; min-height: 900px; }
.zone { position: absolute; left: 0; right: 0; }
.zone span { position: absolute; left: 10px; top: 8px; font-size: 11px; font-weight: 800; color: rgba(0,0,0,.25); letter-spacing: .1em; }
.zone.z1 { top: 52%; height: 48%; background: radial-gradient(circle at 30% 60%, #d6e8c4 0 25%, transparent 26%), #e9f1dc; }
.zone.z2 { top: 33%; height: 19%; background: #f1ead8; }
.zone.z3 { top: 22%; height: 11%; background: linear-gradient(180deg, #bfe6f5, #f3e3b8); }
.zone.z4 { top: 0; height: 22%; background: linear-gradient(180deg, #2c2350, #8c86b8 70%, #cfd8e6); }
.zone.z4 span { color: rgba(255,255,255,.5); }
/* 지도 그림(9:16)이 있으면 조금 더 길게(9:21) 늘이고 양옆을 살짝 잘라 씀. 작전 10곳이 겹치지 않게. 구역 색은 끄고 이름만 남김 */
.mapIn.painted { height: auto; min-height: 0; aspect-ratio: 9 / 21; background: url(../assets/map/map-alley.jpg) center / cover no-repeat; }
.mapIn.painted .zone { background: none; }
.mapIn.painted .zone span { color: rgba(255,255,255,.9); text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.mapIn.painted .node .nm, .mapIn.painted .node .pg { background: rgba(255,250,240,.88); border-radius: 8px; padding: 0 5px; }
#v-map .mapTop { z-index: 2; }
/* 처음 하는 사람 안내 */
#guide { position: fixed; z-index: 34; pointer-events: none; border-radius: 14px; box-shadow: 0 0 0 3px var(--star), 0 0 0 9999px rgba(20,14,40,.18);
  animation: gpulse 1.2s ease-in-out infinite; transition: left .2s, top .2s, width .2s, height .2s; }
@keyframes gpulse { 50% { box-shadow: 0 0 0 6px var(--star), 0 0 0 9999px rgba(20,14,40,.18); } }
#guideTip { position: fixed; z-index: 34; pointer-events: none; left: 50%; transform: translateX(-50%); max-width: 300px; width: 86vw;
  background: #fff; border-radius: 14px; padding: 8px 12px; font-size: 13px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
#guideTip b { color: #c08a00; }
.map svg.path { position: absolute; inset: 0; width: 100%; height: 100%; }
.node { position: absolute; transform: translate(-50%,-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; width: 96px; }
.node .pin { width: 58px; height: 58px; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.12);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: var(--night2); position: relative; }
.node .pin img { width: 90%; height: 90%; object-fit: contain; pointer-events: none; }
.node .nm { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.2; }
.node .pg { font-size: 11px; color: var(--soft); text-align: center; }
.node.cur .pin { box-shadow: 0 0 0 3px var(--star), 0 3px 0 rgba(0,0,0,.12); }
.node.lock .pin { background: #cfcabf; color: #8f897d; }
.node.lock .nm { color: #8f897d; }
.node.done .pin::after { content: ''; position: absolute; right: -12px; top: -16px; width: 30px; height: 30px; background: url(../assets/ui/paw-flag.png) center / contain no-repeat; }
.mapTop { position: absolute; right: 12px; bottom: 10px; background: rgba(44,35,80,.85); color: #fff; border-radius: 12px; padding: 6px 10px; font-size: 12px; }
.mapTop b { color: var(--star); }

.mapBar { display: flex; gap: 8px; padding: 8px 12px; background: var(--night); flex: 0 0 auto; }
.mapBar button { flex: 1; background: rgba(255,255,255,.12); color: #fff; border-radius: 12px; padding: 8px 10px; font-size: 13px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; position: relative; }
.mapBar button b { color: var(--star); }
.mapBar button small { font-size: 11px; font-weight: 600; opacity: .75; }
.mapBar button.lock { opacity: .5; }
.mapBar button.dot::after { content: ''; position: absolute; top: 6px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #ff5a6e; }
#evBtn { background: linear-gradient(135deg, #e8833a, #8f4fc7); }

/* 시즌 이벤트 보드 */
body.ev #v-board, body.ev #boardWrap { background: #3a2c52; }
body.ev #info { background: #3a2c52; color: #fff; }
.evBar { flex: 1; background: var(--cream); border-radius: 14px; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.evTop { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.evTop b { flex: 1; color: #c0612a; font-size: 15px; }
.evTop span { color: var(--soft); font-size: 12px; }
.evTop button { background: var(--night2); color: #fff; border-radius: 10px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.evTrack { position: relative; height: 10px; background: #eadfcd; border-radius: 5px; margin: 6px 8px 6px 0; }
.evTrack i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffb347, #e8833a); border-radius: 5px; }
.evStep { position: absolute; top: 50%; transform: translate(-50%,-50%); z-index: 1; background: #fff; border: 2px solid #e0cdb0; border-radius: 9px;
  font-size: 10px; font-weight: 800; padding: 0 4px; color: var(--soft); }
.evStep.got { background: #e8833a; border-color: #e8833a; color: #fff; }
.evNow { font-size: 12px; color: var(--soft); }

/* 출근 도장 · 지령 */
.stamps { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
.stamps span { width: 32px; height: 32px; border-radius: 50%; background: #eee5d6; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #b0a493; }
.stamps span.on { background: var(--night2); color: var(--star); }
.rec.mission { text-align: left; margin-top: 6px; background: #faf5ec; }
.mbar { display: block; height: 6px; background: #eadfcd; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.mbar i { display: block; height: 100%; background: var(--ok); }
.rec .mark { color: var(--ok); font-weight: 800; font-size: 13px; }

/* 장소 */
.scene { flex: 0 0 38%; margin: 10px 12px 0; border-radius: 16px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #ffe9c7 0 62%, #c99a6b 62% 100%); }
.scene .ph { position: absolute; left: 10px; top: 8px; font-size: 11px; color: #9a7b5c; }
.scene .props { position: absolute; inset: auto 8px 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.scene .prop { background: rgba(255,255,255,.85); border-radius: 8px; padding: 2px 6px; font-size: 11px; font-weight: 700; }

/* 기록 */
.tabs { display: flex; gap: 6px; padding: 10px 12px 0; flex: 0 0 auto; }
.tabs button { flex: 1; padding: 8px 0; border-radius: 12px; background: #efe5d4; font-weight: 700; font-size: 13px; }
.tabs button.on { background: var(--night2); color: #fff; }
.rec { background: #fff; border-radius: 14px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.rec .badge { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; }
.rec .t { font-weight: 700; }
.rec .d { font-size: 12px; color: var(--soft); }
.rec .tx { flex: 1; }
.rec.lock { opacity: .45; }
.rec button { background: var(--night2); color: #fff; border-radius: 10px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
.empty { text-align: center; color: var(--soft); font-size: 13px; padding: 30px 0; }

/* 시작 화면 */
#title { position: fixed; inset: 0; z-index: 30; background: var(--night); max-width: 480px; margin: 0 auto;
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 22px; overflow: hidden; }
#title .cover { position: relative; width: 100%; height: 52vh; flex: 0 0 auto; }
#title .cover img { width: 100%; height: 100%; object-fit: cover; object-position: 38% 50%; display: block; }
#title .cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, var(--night) 100%); }
#title .logo { text-align: center; margin-top: -40px; position: relative; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
#title .logo small { color: var(--star); font-weight: 700; letter-spacing: .1em; }
#title .logo b { display: block; font-size: 36px; line-height: 1.15; margin-top: 6px; }
#title .tbtns { display: flex; flex-direction: column; gap: 10px; align-items: stretch; width: 220px; }
#title .tfoot { margin-top: auto; padding: 0 28px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
#title .tdemo { margin: 0; font-size: 11px; line-height: 1.45; opacity: .6; word-break: keep-all; max-width: 300px; }
#title .tver { opacity: .5; font-size: 11px; }
.task { background: #fff; border-radius: 14px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.task .t { font-weight: 700; }
.task .d { font-size: 12px; color: var(--soft); }
.task .tx { flex: 1; }
.task.done { opacity: .55; }
.task.lock { opacity: .4; }
.task button { background: var(--night2); color: #fff; border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 700; }
.task button:disabled { background: #c9c1b6; }
.task .mark { color: var(--ok); font-weight: 800; }

/* 덮개: 대화, 모달 */
#dialog { position: fixed; inset: 0; z-index: 40; background: rgba(20,14,40,.45); display: flex; align-items: flex-end; justify-content: center; }
#dialog .dlg { width: min(460px, 94vw); margin-bottom: calc(24px + env(safe-area-inset-bottom)); background: #fff; border-radius: 18px;
  padding: 14px 16px 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
#dialog .who { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
#dialog .who .badge { width: 14px; height: 14px; border-radius: 50%; }
#dialog .txt { font-size: 16px; line-height: 1.5; min-height: 48px; }
#dialog .next { text-align: right; font-size: 11px; color: var(--soft); margin-top: 6px; }
#dialog.narr .dlg { background: var(--night); color: #fff; }
#dialog.letter .dlg { background: #fff3d6; font-family: serif; }

#modal { position: fixed; inset: 0; z-index: 45; background: rgba(20,14,40,.45); display: flex; align-items: center; justify-content: center; }
#modal .box { position: relative; width: min(360px, 90vw); background: #fff; border-radius: 18px; padding: 16px; text-align: center; }
#modal .mX { position: absolute; right: 6px; top: 6px; width: 36px; height: 36px; border: 0; background: none; font-size: 18px; color: #8a7f78; padding: 0; z-index: 1; }
#modal .box.nudge { animation: nudge .35s; }
@keyframes nudge { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
#modal h3 { margin: 0 0 8px; padding: 0 28px; }
#modal p { margin: 6px 0; font-size: 14px; color: var(--soft); }
#modal .row { display: flex; gap: 8px; margin-top: 12px; }
#modal .row button { flex: 1; padding: 10px; border-radius: 12px; background: #eee; font-weight: 700; }
#modal .row button.main { background: var(--night2); color: #fff; }

#toast { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 60; background: var(--night); color: #fff;
  padding: 10px 16px; border-radius: 14px; font-size: 14px; pointer-events: none; max-width: 86vw; text-align: center; }

/* 냥다방에서 옮긴 움직임: 창이 통 튀어나옴, 알림이 올라옴, 전달 가능한 주문이 까딱임, 새 주문이 내려옴, 등급 업 큰 글자 */
#toast:not([hidden]) { animation: toastIn .3s cubic-bezier(.3,1.5,.5,1); }
@keyframes toastIn { from { transform: translateX(-50%) translateY(20px) scale(.8); opacity: 0; } }
#modal:not([hidden]) .box, #dialog:not([hidden]) .dlg { animation: modalIn .35s cubic-bezier(.3,1.5,.5,1); }
@keyframes modalIn { from { transform: scale(.7) translateY(30px); opacity: 0; } }
#modal .box.nudge { animation: nudge .35s; }
.order.ready { animation: readyBob .7s ease-in-out infinite alternate; }
@keyframes readyBob { to { transform: translateY(-4px); } }
.order.enter { animation: orderIn .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes orderIn { from { transform: translateY(-60px) scale(.7); opacity: 0; } }
.lvlup { position: fixed; left: 0; right: 0; top: 34%; z-index: 61; pointer-events: none; text-align: center; font-size: 40px; font-weight: 900; color: #fff;
  -webkit-text-stroke: 2px var(--night); paint-order: stroke fill; text-shadow: 0 4px 0 #ff6b7c; animation: lvl 2s cubic-bezier(.3,1.5,.5,1) forwards; }
@keyframes lvl { 0% { transform: scale(0) rotate(-12deg); opacity: 0; } 15% { transform: scale(1.15) rotate(3deg); opacity: 1; } 25% { transform: scale(1); } 80% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .order.ready, .order.enter, #toast:not([hidden]), #modal:not([hidden]) .box, #dialog:not([hidden]) .dlg { animation: none; } }
