/* 코인 🪙 은 어느 기기에서나 같은 금색 동전으로 (그 글자 하나만 바꾸는 작은 글꼴) */
@font-face { font-family: "FDCoin"; src: url("/coin.woff2") format("woff2"); unicode-range: U+1FA99; font-display: block; }
:root {
  --ink: #3d3a35;
  --muted: #8a8378;
  --card: rgba(255, 252, 246, 0.94);
  --glass: rgba(255, 252, 246, 0.82);
  --line: rgba(80, 60, 30, 0.12);
  --accent: #e08a4f;
  --accent-ink: #fff;
  --shelter: #c9773f;
  --near: #5f9a6b;
  --shadow: 0 8px 30px rgba(60, 40, 20, 0.18);
}

* { box-sizing: border-box; }
/* 가로로 돌려도 iOS가 글자를 멋대로 키우지 않게, 스크롤·당겨서 새로고침으로 화면이 밀리지 않게 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #e8eff3; color: var(--ink);
  font-family: "FDCoin", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Hiragino Sans", system-ui, sans-serif; }
/* 한국어는 띄어쓰기에서만 줄을 바꾼다 (단어가 반으로 잘리지 않게), 너무 긴 단어만 어디서든 */
html { word-break: keep-all; overflow-wrap: anywhere; }
.msg, .msg * { word-break: keep-all; }
canvas#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* 아이폰 홈 화면 앱(상태 표시줄까지 쓰는 모드)은 화면 높이가 상태 표시줄만큼 짧게 잡혀서 아래에 빈 띠가 생긴다 → 그만큼 늘린다 */
/* --gap: 화면이 실제보다 짧게 잡힌 만큼 (client.js 가 재서 넣는다, 보통 0) */
:root { --gap: 0px; --bot: max(14px, calc(env(safe-area-inset-bottom) + 10px)); }
canvas#world { height: calc(100% + var(--gap)); }
/* 아래쪽 채팅·메뉴는 홈 바 위로 넉넉히 (홈 바가 있으면 그 높이 + 10px, 없으면 14px) */
.hidden { display: none !important; }
button, input, select { font: inherit; color: inherit; }

/* ---------- 입장 ---------- */
#join { position: fixed; inset: 0; display: flex; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 244, 220, 0.55), rgba(90, 130, 80, 0.55)); backdrop-filter: blur(3px); overflow-y: auto; }
.card { margin: auto; width: 100%; max-width: 440px; min-width: 0; background: var(--card); border-radius: 24px; padding: 22px 24px 24px; box-shadow: var(--shadow); }
.dogpreview { display: grid; place-items: center; margin: -6px 0 2px; }
.dogpreview canvas { max-width: 100%; height: auto; }
.card h1 { margin: 0; font-size: 26px; text-align: center; letter-spacing: -0.02em; }
.card .sub { overflow-wrap: anywhere; margin: 6px 0 16px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.45; }
.card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin: 10px 0 6px; min-width: 0; }
/* minmax(0, 1fr): 입력칸의 기본 최소 폭 때문에 칸이 밖으로 밀려나지 않게 */
.card .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.card input, .card select { width: 100%; min-width: 0; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; font-size: 16px; color: var(--ink); outline: none; }
.card input:focus, .card select:focus { border-color: var(--accent); }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 236px; overflow-y: auto; padding: 3px; }
.chips button { border: 1px solid var(--line); background: #efeadf; border-radius: 14px; padding: 4px 4px 6px; font-size: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.2; }
.chips button img { width: 64px; height: 40px; display: block; }
.chips button span { max-width: 100%; text-align: center; font-size: 11.5px; line-height: 1.15; }
.chips button.on { background: #fde3c8; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 3px var(--accent); }
.swatches button.natural { position: relative; }
.swatches button.natural::after { content: '✦'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: rgba(255,255,255,0.95); text-shadow: 0 0 2px rgba(0,0,0,0.45); }
.sh-coats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--muted); }
.sh-coats .swatches { gap: 6px; }
.sh-coats .swatches button { width: 26px; height: 26px; }
#enterBtn { width: 100%; margin-top: 18px; padding: 13px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 700; cursor: pointer; }
#enterBtn:hover { filter: brightness(1.05); }

/* ---------- HUD ---------- */
#hud { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); max-width: calc(100vw - 28px); align-items: flex-start; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.pill { max-width: 100%; min-width: 0; background: var(--glass); backdrop-filter: blur(8px); border-radius: 14px; padding: 9px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.pill b { font-size: 15px; }
.pill span { font-size: 12px; color: var(--muted); }
.pill.small { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; align-items: center; padding: 7px 14px; }
.pill.small > span { color: var(--ink); }
.happy { display: flex; align-items: center; gap: 6px; }
.happy i { width: 70px; height: 8px; border-radius: 4px; background: rgba(0,0,0,0.08); overflow: hidden; }
.happy b { display: block; height: 100%; width: 50%; background: linear-gradient(90deg, #f6a6a0, #f2797b); border-radius: 4px; transition: width .4s; }

#minimap { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); width: 200px; height: 104px; cursor: pointer; border-radius: 14px; box-shadow: var(--shadow); border: 3px solid var(--glass); }

/* ---------- 채팅 ---------- */
#chat { position: fixed; left: calc(14px + env(safe-area-inset-left)); bottom: calc(var(--bot) - var(--gap)); width: min(380px, calc(100vw - 28px)); display: flex; flex-direction: column; gap: 8px; }
#log { max-height: 38vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 4px 2px;
  mask-image: linear-gradient(to bottom, transparent, #000 24px); scrollbar-width: none; }
#log .fading { opacity: 0; transition: opacity 5s; }
#log::-webkit-scrollbar { display: none; }
.msg { align-self: flex-start; max-width: 100%; background: var(--glass); backdrop-filter: blur(8px); border-radius: 12px; padding: 6px 10px; font-size: 14px; line-height: 1.4; box-shadow: 0 2px 10px rgba(60,40,20,0.08); }
.msg .tag { font-size: 10px; font-weight: 700; color: #fff; border-radius: 6px; padding: 1px 5px; margin-right: 5px; vertical-align: 1px; }
.msg .tag.shelter { background: var(--shelter); }
.msg .tag.near { background: var(--near); }
.msg .who { font-weight: 700; margin-right: 4px; }
.msg .orig { display: block; font-size: 12px; color: var(--muted); }
.msg .tr { font-size: 10px; color: var(--muted); margin-left: 6px; cursor: pointer; text-decoration: underline dotted; white-space: nowrap; }
.msg.sys { background: rgba(255,255,255,0.5); color: var(--muted); font-size: 12px; }
.msg.mine { background: rgba(255, 236, 214, 0.92); }
#chatForm { display: flex; gap: 6px; }
#chatInput { flex: 1; min-width: 0; border: 0; border-radius: 14px; padding: 12px 14px; background: var(--card); box-shadow: var(--shadow); outline: none; font-size: 16px; }
#chatInput:focus { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
#chatSend { flex: none; width: 44px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-size: 16px; box-shadow: var(--shadow); cursor: pointer; }
#langSwitch { border: 0; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); padding: 0 8px; font-size: 16px; max-width: 92px; }

#actions { position: fixed; right: calc(14px + env(safe-area-inset-right)); bottom: calc(var(--bot) - var(--gap)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#actionsMenu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#actions.closed #actionsMenu { display: none; }
/* 걸어가는 동안: 아래 채팅창·메뉴를 거의 투명하게 (멈추면 다시 보인다) */
#chat, #actions { transition: opacity .35s; }
body.walking #chat, body.walking #actions { opacity: .12; }
@media (hover: hover) { body.walking #chat:hover, body.walking #actions:hover { opacity: 1; } }
#menuToggle { position: relative; font-weight: 700; }
#menuToggle b { font-size: 15px; }
#menuToggle.dot::after { content: ''; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #e2574c; box-shadow: 0 0 0 2px var(--card); }
#actions:not(.closed) #menuToggle.dot::after { display: none; }
#actions button { border: 0; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); padding: 10px 12px; font-size: 14px; cursor: pointer; white-space: nowrap; }
#actions button:active { transform: scale(0.96); }
#actions button.on { background: var(--accent); color: #fff; }
/* 클린 모드: 공원만 보이게 */
body.clean #hud, body.clean #chat, body.clean #minimap, body.clean #help { display: none !important; }
body.clean #menuToggle:not(:hover) { opacity: 0.55; }
#actions button.primary { background: #fde3c8; font-weight: 700; }

/* ---------- 강아지 가까이 보기 ---------- */
#closeup { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(60, 45, 30, 0.45); backdrop-filter: blur(4px); z-index: 10; }
.cu-card { width: min(560px, 100%); background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 32px); overflow-y: auto; }
.cu-head { display: flex; align-items: center; gap: 12px; }
.cu-head > b { font-size: 18px; flex: 1; min-width: 0; }
.cu-bond { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cu-bond i { width: 90px; height: 8px; border-radius: 4px; background: rgba(0,0,0,0.08); overflow: hidden; }
.cu-bond b { display: block; height: 100%; background: linear-gradient(90deg, #f6a6a0, #f2797b); border-radius: 4px; transition: width .3s; }
#cuClose, .cu-x { border: 0; background: rgba(0,0,0,0.06); width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer; }
#cuCanvas { width: 100%; height: min(320px, 42vh); border-radius: 18px; display: block; touch-action: none; cursor: grab; }
#cuCanvas:active { cursor: grabbing; }
.cu-hint { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.cu-tricks { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.cu-tricks button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; }
.cu-tricks button .ico { font-size: 22px; line-height: 1; }
.cu-tricks button:hover { border-color: var(--accent); background: #fff6ec; }
.cu-tricks button:active { transform: scale(0.95); }
/* 강아지 프로필 */
#profile, #catCard { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(60, 45, 30, 0.45); backdrop-filter: blur(4px); z-index: 10; }
.pf-card { width: min(520px, 100%); background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.pf-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pf-photo { aspect-ratio: 1; border-radius: 18px; background: #f3ece0; display: grid; place-items: center; overflow: hidden; text-align: center; font-size: 13px; color: var(--muted); padding: 8px; }
.pf-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
#pfCanvas, #catCanvas { width: 100%; aspect-ratio: 1; border-radius: 18px; display: block; }
.pf-sub { margin: 0; text-align: center; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pf-actions button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 14px; font-size: 14px; cursor: pointer; }
.pf-actions button.warn { color: #c2453a; border-color: #f0c4bf; }
.pf-actions button:disabled { opacity: 0.6; cursor: default; }
.pf-actions button.main { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
@media (max-width: 420px) { .pf-body { grid-template-columns: 1fr; } .pf-photo, #pfCanvas, #catCanvas { max-height: 34dvh; justify-self: center; width: min(100%, 34dvh); } }
/* 개러리아 백화점 안: 1층 가게 칸들 */
#dept, #cafe { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(40, 40, 55, 0.45); backdrop-filter: blur(4px); z-index: 10; }
.dp-card { width: min(760px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; border-radius: 24px; box-shadow: var(--shadow); padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(#f7f3ec, #efe7da); }
.dp-floor { font-weight: 800; color: #d9b24a; background: #2f3a4a; border-radius: 8px; padding: 2px 10px; font-size: 13px; }
.dp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 12px; border-radius: 18px; background: repeating-linear-gradient(90deg, #e9e1d3 0 60px, #e3d9c8 60px 120px); }
.dp-store { position: relative; border: 0; border-radius: 14px; background: #fff; padding: 30px 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,0.08);
  animation: shDrop .4s cubic-bezier(.2, 1.4, .4, 1) both; color: var(--ink); min-height: 150px; }
.dp-store .dp-awn { position: absolute; left: 0; right: 0; top: 0; height: 20px; border-radius: 14px 14px 0 0; background: repeating-linear-gradient(90deg, var(--c) 0 18px, #fff 18px 36px); }
.dp-store .dp-ico { font-size: 34px; line-height: 1.1; }
.dp-store b { font-size: 17px; }
.dp-store small { font-size: 12px; color: var(--muted); text-align: center; }
.dp-store i { font-style: normal; font-size: 12px; color: #c2337a; font-weight: 700; }
.dp-store:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0,0,0,0.08), 0 0 0 3px var(--c); }
.dp-store.empty { background: rgba(255,255,255,0.45); border: 2px dashed #bfb3a0; box-shadow: none; --c: #cfc6b8; color: #8a7f70; }
.dp-store.empty .dp-ico { filter: grayscale(1); opacity: 0.6; }
/* 코지눅 카페 안 */
#cafe { background: rgba(60, 40, 20, 0.5); }
.cf-card { width: min(820px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: #f6ecdc; border-radius: 24px; box-shadow: var(--shadow); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; color: #4a3020; }
#cfCanvas { width: 100%; height: min(420px, 50dvh); border-radius: 18px; display: block; background: #efe0c8; }
.cf-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.cf-menu button { border: 0; border-radius: 14px; background: #9a6440; color: #fff3e2; padding: 10px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; }
.cf-menu button span { font-size: 24px; }
.cf-menu button:hover { background: #7a4a2a; }
.cf-menu button:active { transform: scale(0.95); }
/* 앱으로 설치하는 방법 */
#install { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(60, 45, 30, 0.45); backdrop-filter: blur(4px); z-index: 12; }
.in-card { width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.in-intro { margin: 0; font-size: 15px; line-height: 1.6; }
.in-note { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.in-now { border: 0; border-radius: 14px; padding: 13px; font-size: 16px; font-weight: 800; color: #fff; background: #e0603a; cursor: pointer; }
.in-dev { background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: 0 1px 4px rgba(80,60,30,0.1); }
.in-dev.mine { box-shadow: 0 0 0 3px var(--accent); }
.in-dev h4 { margin: 0 0 8px; font-size: 15px; }
.in-dev ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.in-dev li { font-size: 14px; line-height: 1.55; }
.in-dev kbd { font-family: inherit; background: #f3ece0; border-radius: 6px; padding: 1px 6px; font-weight: 700; white-space: nowrap; }
.in-warn { background: #fff3e6; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.55; }
/* 옷가게 그르르 */
#shop { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(90, 40, 50, 0.4); backdrop-filter: blur(4px); z-index: 10; }
.sh-card { width: min(600px, 100%); background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100dvh - 32px); overflow-y: auto; }
#shCanvas { width: 100%; height: min(230px, 26vh); border-radius: 18px; display: block; flex: none; }
.sh-name { margin: 0; text-align: center; font-weight: 700; font-size: 15px; }
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.sh-grid button { border: 2px solid transparent; background: #fff; border-radius: 14px; padding: 4px 2px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12px; color: var(--ink); position: relative;
  animation: shDrop .42s cubic-bezier(.2, 1.4, .4, 1) both; box-shadow: 0 1px 3px rgba(80, 60, 30, 0.12); }
.sh-grid img { width: 72px; height: 60px; pointer-events: none; }
.sh-grid button:hover { background: #fff6f8; }
.sh-grid button.on { border-color: #f28aa6; background: #fff0f4; }
.sh-grid button:active { transform: scale(0.95); }
.sh-grid button.snow::before { content: '❄️'; position: absolute; top: 3px; left: 6px; font-size: 11px; }
.sh-grid button.snow { background: #f3f8fc; }
@keyframes shDrop { from { opacity: 0; transform: translateY(-18px) rotate(-6deg) scale(0.8); } to { opacity: 1; transform: none; } }
#shWear { position: sticky; bottom: 0; box-shadow: 0 -6px 12px rgba(255,252,246,0.9); border: 0; border-radius: 14px; padding: 12px; font-size: 16px; font-weight: 700; background: #f28aa6; color: #fff; cursor: pointer; }
#shop.gaeis { background: rgba(50, 50, 90, 0.4); }
#shop.gaeis .sh-grid button.on { border-color: #7a8be0; background: #f0f2ff; }
#shop.gaeis #shWear { background: #6f7fd8; }
#shop.market { background: rgba(90, 60, 20, 0.4); }
#shop.market .sh-grid button.on { border-color: #f2b33d; background: #fff8e8; }
#shop.market #shWear { background: #f08a3c; }
#shop.salon { background: rgba(40, 80, 75, 0.4); }
#shop.salon .sh-grid button.on { border-color: #5fae9f; background: #eef8f6; }
#shop.salon #shWear { background: #5fae9f; }
.sh-info { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 13px; color: #3f3a4a; background: #f3eefa; border-radius: 12px; padding: 8px 10px; }
.sh-info a { color: #c2337a; font-weight: 700; text-decoration: none; }
#shWear:disabled { background: #ece6dc; color: var(--muted); cursor: default; }

#help { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 12px; color: rgba(40,50,30,0.7); background: rgba(255,255,255,0.5); padding: 4px 6px 4px 12px; border-radius: 999px; display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 500px); text-align: center; }
/* 알림: 눈밭(흰 배경) 위에서도 또렷하게 — 부드러운 짙은 청회색 바탕에 흰 글씨 */
#toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); text-align: center; background: rgba(58, 66, 82, 0.94); color: #fdfbf6; padding: 11px 18px; border-radius: 14px; box-shadow: 0 6px 20px rgba(30, 36, 48, 0.28); font-size: 14.5px; font-weight: 600; line-height: 1.45; letter-spacing: -0.1px; }

/* 지금 할 수 있는 일 큰 버튼 (휴대폰) · 조이스틱 */
@keyframes ctxPop { from { transform: translateX(-50%) scale(0.8); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#ctxBtn { display: none; }
#joy { position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 1.5px solid rgba(255,255,255,0.32); pointer-events: none; z-index: 6; display: grid; place-items: center; }
#joy i { width: 46px; height: 46px; border-radius: 50%; background: rgba(255,253,248,0.35); }
#helpClose { border: 0; background: rgba(0,0,0,0.08); color: inherit; width: 20px; height: 20px; border-radius: 50%; font-size: 10px; cursor: pointer; flex: none; padding: 0; }
/* 도움말이 HUD·미니맵과 겹칠 만큼 좁으면 숨긴다 */
@media (max-width: 1000px) { #help { display: none !important; } }

@media (max-width: 720px) {
  #minimap { display: none !important; }
  /* 휴대폰: 맨 위에 짧은 사용법 한 줄, 왼쪽 위 안내는 작게 */
  #help:not(.hidden) { display: flex !important; } #help { top: calc(6px + env(safe-area-inset-top)); left: 8px; right: 8px; transform: none; max-width: none; font-size: 10.5px; line-height: 1.35; padding: 3px 10px; border-radius: 10px; }
  body.clean #help { display: none !important; }
  #hud { top: calc(34px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); gap: 5px; }
  .pill { padding: 5px 10px; border-radius: 11px; }
  .pill b { font-size: 12.5px; }
  #zoneHint { display: none; }
  .pill.small { padding: 4px 10px; font-size: 11px; }
  .happy i { width: 44px; height: 6px; }
  #ctxBtn { display: block; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bot) - var(--gap) + 46px + 5.4em + 14px); z-index: 7; border: 0; border-radius: 999px; padding: 13px 22px; font-size: 16px; font-weight: 800; color: #fff; background: #e0603a; box-shadow: 0 6px 18px rgba(224,96,58,0.45); max-width: calc(100vw - 32px); text-align: center; line-height: 1.25; animation: ctxPop .25s ease-out; }
  #ctxBtn.hidden { display: none; }
  /* 휴대폰: 대화 칸은 두 줄 높이만, 손가락으로 위로 올리면 지난 대화를 볼 수 있다 (PC 처럼). 칸 밖은 터치가 공원으로 지나간다 */
  #log { max-height: 5.4em; overflow-y: auto; pointer-events: auto; touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to bottom, transparent, #000 14px); }
  #log > .msg { flex: none; } /* 긴 대화도 잘리지 않게 (대화 칸을 위로 올려 끝까지 볼 수 있다) */
  #log.more::before { content: '▲'; position: sticky; top: 0; align-self: center; font-size: 9px; line-height: 1; color: rgba(61,58,53,0.55); }
  #chat { pointer-events: none; }
  #chatForm { pointer-events: auto; }
  /* 휴대폰: 채팅창 옆에 둥근 ☰ 버튼만. 열면 그 위에 행동 버튼들이 뜬다 */
  #chat { bottom: calc(var(--bot) - var(--gap)); width: calc(100vw - 28px - 58px); }
  /* 메뉴 칸이 화면 폭 전체라 채팅창을 덮는다 → 빈 곳은 터치가 통과하게, 버튼만 받게 */
  #actions { left: 14px; right: 14px; pointer-events: none; }
  #actionsMenu, #menuToggle { pointer-events: auto; }
  #actionsMenu { width: 100%; background: rgba(255,253,248,0.72); backdrop-filter: blur(8px); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); }
  #actions button { padding: 10px 4px; font-size: 13px; }
  #menuToggle { width: 48px; height: 46px; padding: 0 !important; border-radius: 14px !important; }
  #menuToggle span { display: none; }
  #menuToggle b { font-size: 18px; }
  .pill.small { gap: 4px 10px; }
}

/* 휴대폰·낮은 화면: 입장 화면이 스크롤 없이 한 화면에 들어오게 (미리보기·글씨·여백을 줄이고, 견종은 옆으로 넘기는 두 줄) */
@media (max-width: 720px), (max-height: 860px) {
  #join { padding: calc(8px + env(safe-area-inset-top)) 10px calc(8px + env(safe-area-inset-bottom)); }
  .card { padding: 10px 16px 14px; border-radius: 20px; }
  .dogpreview { margin: 0; }
  .dogpreview canvas { height: min(84px, 10dvh); width: auto; }
  .card h1 { font-size: 20px; }
  .card .sub { margin: 2px 0 6px; font-size: 12px; line-height: 1.35; }
  .card label { margin: 6px 0 4px; font-size: 12px; gap: 4px; }
  .card input, .card select { padding: 8px 10px; }
  .chips { grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-template-columns: none; grid-auto-columns: 74px; overflow-x: auto; overflow-y: hidden; max-height: none; padding: 3px 3px 6px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  @media (hover: hover) { .chips { scrollbar-width: thin; cursor: grab; user-select: none; } .chips::-webkit-scrollbar { display: block; height: 6px; } .chips::-webkit-scrollbar-thumb { background: rgba(0,0,0,.25); border-radius: 3px; } .chips button img { pointer-events: none; -webkit-user-drag: none; } }
  .chips button img { width: 54px; height: 34px; }
  .swatches { flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding: 3px; scrollbar-width: none; }
  .swatches::-webkit-scrollbar { display: none; }
  .swatches button { width: 27px; height: 27px; flex: none; }
  #enterBtn { margin-top: 10px; padding: 12px; }
}
/* 아주 낮은 화면 (아이폰 SE 등): 설명 줄을 숨기고 미리보기를 더 작게 */
@media (max-height: 620px) {
  .card .sub { display: none; }
  .dogpreview canvas { height: 52px; }
  .card h1 { font-size: 18px; }
  .card label { margin: 4px 0 3px; }
  #enterBtn { margin-top: 8px; padding: 10px; }
  #join { padding-top: calc(4px + env(safe-area-inset-top)); padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .card { padding: 8px 14px 10px; }
  .card input, .card select { padding: 7px 10px; }
}
/* 아주 좁은 화면 (폴더블 커버 화면 등): 채팅 줄을 줄여 입력칸이 보이게, 메뉴는 두 칸 */
@media (max-width: 340px) {
  #langSwitch { max-width: 58px; padding: 0 2px; font-size: 13px; }
  #chatSend { padding: 0 10px; }
  #chatInput { padding: 10px; font-size: 15px; }
  #actionsMenu { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #actions button { font-size: 12px; padding: 9px 2px; }
  #hud .pill.small { font-size: 10px; }
  #hud { top: calc(52px + env(safe-area-inset-top)) !important; } /* 위 사용법이 두 줄이 되니 그 아래로 */
}
/* 낮은 가로 화면 (휴대폰 가로·폴드 가로 등): 미니맵과 위 설명을 숨기고 메뉴 버튼을 작게 */
@media (max-height: 500px) {
  #minimap { display: none !important; }
  #zoneHint { display: none; }
  #actions button { padding: 7px 10px; font-size: 13px; }
  #actionsMenu { gap: 5px; }
}
/* 아주 좁은 화면: 이름 칸을 한 줄씩, 여백도 조금 줄인다 */
@media (max-width: 360px) {
  #join { padding: 10px; }
  .card { padding: 18px 16px 20px; }
  .card .row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .card h1 { font-size: 22px; }
  .cu-bond i { width: 56px; }
}

/* 낮은 가로 화면(휴대폰 가로): 채팅 기록을 줄인다 */
@media (max-height: 480px) {
  #log { max-height: 30vh; }
  .card { padding-top: 12px; }
}

/* ---------- 쉼터 미니게임 창 ---------- */
.modal { position: fixed; inset: 0; display: flex; padding: 16px; background: rgba(60, 45, 30, 0.45); backdrop-filter: blur(4px); z-index: 10; overflow-y: auto; }
.g-card { margin: auto; width: 100%; max-width: 460px; min-width: 0; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.g-head { display: flex; align-items: center; gap: 10px; }
.g-head b { flex: 1; min-width: 0; font-size: 17px; }
#gClose { border: 0; background: rgba(0,0,0,0.06); width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer; flex: none; }
#gBody { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.g-game { background: #fff6ec; border-radius: 16px; padding: 10px 12px; }
.g-game b { font-size: 15px; }
.g-game p { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.g-rooms, .g-members, .g-invite { display: flex; flex-direction: column; gap: 6px; }
.g-room, .g-member { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 14px; min-width: 0; }
.g-room > span:first-child, .g-member > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-member.ready { border-color: #8cc58a; background: #f1faef; }
.g-member.empty { color: var(--muted); justify-content: center; border-style: dashed; }
.g-room .st, .g-member .st { font-size: 12px; color: var(--muted); flex: none; }
.g-hint { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.g-create, .g-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.g-create > span { font-size: 13px; color: var(--muted); }
.g-create select { border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 16px; background: #fff; }
.g-card button:not(#gClose), #inviteCard button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 14px; font-size: 14px; cursor: pointer; flex: none; }
.g-card button.primary:not(#gClose), #inviteCard button.primary, .tg-result-card button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.g-card button.ghost:not(#gClose) { background: transparent; }
.g-card button:disabled { opacity: 0.6; cursor: default; }
.g-actions button { flex: 1 1 120px; }
#roomPill { position: fixed; right: 14px; bottom: 120px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; padding: 8px 14px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow); cursor: pointer; z-index: 5; }
#inviteCard { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); width: min(400px, calc(100vw - 28px)); background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; z-index: 12; font-size: 14px; }
#inviteCard > div { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- 꼬리잡기 게임 화면 ---------- */
#tagGame { position: fixed; inset: 0; z-index: 20; background: #6f9e5c; overflow: hidden; }
#tagCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.tg-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.tg-pill, .tg-role { background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow); white-space: nowrap; }
.tg-role.tagger { background: #e2574c; color: #fff; }
.tg-role.citizen { background: #5f9a6b; color: #fff; }
.tg-feed { position: absolute; top: 56px; left: 0; right: 0; text-align: center; color: #fff; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,0.4); pointer-events: none; padding: 0 12px; }
.tg-bottom { position: absolute; left: 10px; right: 10px; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.tg-energy { display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(320px, 100%); }
.tg-energy i { display: block; width: 100%; height: 14px; border-radius: 7px; background: rgba(0,0,0,0.25); overflow: hidden; box-shadow: var(--shadow); }
.tg-energy b { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ffd25e, #ff8a3d); border-radius: 7px; }
.tg-energy b.low { background: #b9b2a6; }
.tg-energy b.on { background: linear-gradient(90deg, #ff8a3d, #ff4f6d); }
.tg-energy small, .tg-hint { color: #fff; font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); text-align: center; }
#tgSprint { position: absolute; right: 16px; bottom: 104px; width: 84px; height: 84px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.9); font-size: 15px; font-weight: 700; box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; }
#tgSprint.on { background: #ff8a3d; color: #fff; }
#tgSprint.cd { background: rgba(255,255,255,0.55); color: #8a8378; }
@media (hover: hover) and (pointer: fine) { #tgSprint { display: none; } }
#tgResult { position: absolute; inset: 0; display: flex; padding: 16px; background: rgba(40,30,20,0.35); }
.tg-result-card { margin: auto; background: var(--card); border-radius: 22px; padding: 22px 26px; text-align: center; box-shadow: var(--shadow); max-width: 100%; }
.tg-result-card b { font-size: 26px; display: block; }
.tg-result-card p { margin: 8px 0 16px; color: var(--muted); }
.tg-result-card button { border: 0; border-radius: 12px; padding: 10px 18px; font-size: 15px; cursor: pointer; }

/* ---------- 큰 지도 ---------- */
.bm-card { margin: auto; width: 100%; max-width: 980px; min-width: 0; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.bm-where { font-size: 13px; color: var(--muted); min-width: 0; text-align: right; }
#bmClose { border: 0; background: rgba(0,0,0,0.06); width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer; flex: none; }
#bigmapCanvas { width: 100%; aspect-ratio: 10400 / 5400; max-height: calc(100vh - 190px); border-radius: 14px; display: block; cursor: crosshair; touch-action: none; }
/* 센트럴파크: 가로로 긴 공원을 높이에 맞춰 크게, 옆으로 끌어서 넘겨 본다 (위아래 띠는 이름표 자리) */
#bigmap.central #bigmapCanvas { aspect-ratio: auto; height: min(52dvh, 430px); cursor: grab; }
#bigmap.central #bigmapCanvas:active { cursor: grabbing; }
.bm-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
#bmClear { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; font-size: 13px; cursor: pointer; }

/* ---------- 미니게임 목록 ---------- */
.g-list { display: flex; flex-direction: column; gap: 8px; }
.g-card button.g-pick { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px; border-radius: 16px; background: #fff6ec; border: 1px solid #f1dcc4; width: 100%; }
.g-card button.g-pick:not(:disabled):hover { border-color: var(--accent); }
.g-pick-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.g-pick-txt b { font-size: 15px; }
.g-pick-txt small { font-size: 12px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.g-pick .st { font-size: 13px; color: var(--accent); font-weight: 700; flex: none; }
.g-card button.g-pick.locked { background: #f3f1ee; border-color: var(--line); filter: grayscale(0.7); opacity: 0.75; }
.g-pick.locked .st { color: var(--muted); }
.g-card button.g-back { align-self: flex-start; border: 0; padding: 4px 6px; color: var(--muted); }

/* ---------- 쿵쿵따 게임 화면 ---------- */
#wordGame, .wgame { position: fixed; inset: 0; z-index: 20; display: flex; padding: 14px; overflow-y: auto; background: radial-gradient(circle at 50% 20%, #fff3df, #f2d9b8 70%); }
.wg-card { margin: auto; width: 100%; max-width: 480px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.wg-top { display: flex; align-items: center; gap: 10px; }
.wg-top b { flex: 1; font-size: 20px; }
.wg-top button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.wg-players { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.wg-chip { background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; box-shadow: var(--shadow); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; transition: transform 0.15s; }
.wg-chip.me { border: 2px solid var(--accent); }
.wg-chip.turn { background: var(--accent); color: #fff; transform: scale(1.08); }
.wg-chip.out { opacity: 0.45; text-decoration: line-through; }
.wg-stage { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 18px 14px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wg-word { font-size: 44px; font-weight: 800; letter-spacing: 4px; color: #4a3a2a; line-height: 1.1; }
.wg-word em { font-style: normal; color: var(--accent); }
.wg-arrow { color: var(--muted); font-size: 16px; line-height: 1; }
.wg-need { display: flex; gap: 6px; }
.wg-need i { font-style: normal; min-width: 46px; height: 46px; padding: 0 4px; border-radius: 12px; border: 2px dashed #e2c9a8; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #4a3a2a; }
.wg-need i.first { border-style: solid; border-color: var(--accent); background: #fff3e6; }
.wg-beats { display: flex; gap: 10px; margin-top: 4px; }
.wg-beats i { font-style: normal; width: 52px; height: 52px; border-radius: 50%; background: #efe6da; color: #b3a593; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; transition: transform 0.08s, background 0.08s; }
.wg-beats i.on { background: #c8875a; color: #fff; transform: scale(1.12); }
.wg-beats i:last-child.on { background: #e2574c; }
.wg-bar { width: min(240px, 100%); height: 8px; border-radius: 4px; background: #efe6da; overflow: hidden; }
.wg-bar b { display: block; height: 100%; width: 0; background: #8cc58a; border-radius: 4px; }
.wg-bar b.low { background: #e2574c; }
/* 차례 표시: 내 차례면 화면 전체가 확실하게 (큰 배너 + 반짝이는 테두리 + 입력칸 강조), 남의 차례면 회색으로 기다리기 */
.wg-turn { text-align: center; font-weight: 800; font-size: 17px; padding: 10px 12px; border-radius: 16px; background: #efe6da; color: #8a7a66; min-height: 22px; transition: background .2s, color .2s; }
.wg-turn.me { background: var(--accent); color: #fff; font-size: 24px; animation: wgPulse 0.9s ease-in-out infinite; box-shadow: 0 6px 18px rgba(224,138,79,0.45); }
.wg-turn.hidden2 { visibility: hidden; }
@keyframes wgPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
#wordGame.myturn { background: radial-gradient(circle at 50% 20%, #ffe9cf, #f6c58f 75%); }
#wordGame.myturn .wg-stage { box-shadow: 0 0 0 4px var(--accent), var(--shadow); }
#wordGame.myturn .wg-form input { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(224,138,79,0.3); background: #fffaf3; }
#wordGame.myturn .wg-form button { animation: wgPulse 0.9s ease-in-out infinite; }
#wordGame.waiting .wg-form input { background: #f3eee6; color: #9a8f80; }
#wordGame.waiting .wg-form button { background: #c9bfb2; }
.wg-chip.turn::before { content: '👉 '; }
.wg-status { font-weight: 700; font-size: 15px; min-height: 20px; text-align: center; }
.wg-status.me { color: var(--accent); }
.wg-status.out { color: #c2453a; }
.wg-form { display: flex; gap: 8px; }
.wg-form input { flex: 1; min-width: 0; font-size: 22px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; text-align: center; letter-spacing: 3px; }
.wg-form input:focus { outline: none; border-color: var(--accent); }
.wg-form button { border: 0; border-radius: 14px; padding: 0 18px; font-size: 16px; font-weight: 700; background: var(--accent); color: #fff; cursor: pointer; }
.wg-form input.shake { animation: wgShake 0.3s; border-color: #e2574c; }
@keyframes wgShake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.wg-msg { min-height: 20px; text-align: center; font-size: 14px; font-weight: 600; color: #4f8c48; }
.wg-msg.bad { color: #c2453a; }
.wg-used small { color: var(--muted); font-size: 12px; }
.wg-chain { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.wg-chain span { flex: none; background: #fff; border-radius: 10px; padding: 4px 9px; font-size: 14px; }
.wg-chain span.start { background: #f3e3cf; }
.wg-chain span.mine { background: #ffe2c8; }
.wg-chain span + span::before { content: '→ '; color: var(--muted); }
#wgResult, .wg-result { position: fixed; inset: 0; display: flex; padding: 16px; background: rgba(40,30,20,0.35); z-index: 21; }

/* ---------- 초성 퀴즈 · 눈치 게임 ---------- */
.wg-round { font-size: 13px; color: var(--muted); font-weight: 700; }
.wg-chip b { margin-left: 4px; color: var(--accent); }
.wg-chip.turn b { color: #fff; }
.qz-cat { background: #fff3e6; color: #a0623a; border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 700; }
.qz-cho { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.qz-cho i { font-style: normal; min-width: 52px; height: 58px; border-radius: 14px; background: #fff8ef; border: 2px solid #ecd3b4; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; color: #4a3a2a; }
.qz-cho i.open { border-color: var(--accent); color: var(--accent); }
.qz-cho.done i { background: #eaf6e8; border-color: #8cc58a; color: #3f7a3a; }
.qz-hint { min-height: 18px; font-size: 13px; color: var(--muted); }
.qz-feed { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow-y: auto; }
.qz-feed span { font-size: 13px; background: rgba(255,255,255,0.7); border-radius: 10px; padding: 4px 10px; }
.qz-feed span.right { background: #eaf6e8; font-weight: 700; }
.nc-num { font-size: 76px; font-weight: 900; line-height: 1; color: #4a3a2a; min-height: 76px; transition: transform 0.1s; }
.nc-num.pop { animation: ncPop 0.3s; }
.nc-num.bad { color: #e2574c; }
@keyframes ncPop { 40% { transform: scale(1.3); } }
.nc-who { min-height: 20px; font-weight: 700; color: var(--muted); }
.wg-chip.called { background: #eaf6e8; }
.wg-chip.lost { background: #fde3df; color: #b2392f; }
.nc-call { align-self: center; width: 150px; height: 150px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 24px; font-weight: 800; box-shadow: 0 6px 0 #b8693d, var(--shadow); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.nc-call:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #b8693d, var(--shadow); }
.nc-call:disabled { background: #d9cfc3; box-shadow: 0 6px 0 #bfb3a5; cursor: default; }

/* ---------------- 산책 수첩 (미션 · 도감 · 스탬프 · 보물) · 사진 ---------------- */
#missionChip { pointer-events: auto; border: 0; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; padding: 7px 12px; }
#missionChip.done { background: #e3f3d8; }
#solo, #photo, #fishShop, #bank, #pet, #foodShop, #cloud, #cloudPick, #naming, #inventory { position: fixed; inset: 0; display: grid; place-items: center; padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); background: rgba(60, 45, 30, 0.45); backdrop-filter: blur(4px); z-index: 10; }
.so-card { width: min(520px, 100%); max-height: 100%; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
#soloTabs { display: flex; gap: 6px; overflow-x: auto; flex: none; padding: 2px; scrollbar-width: none; }
#soloTabs::-webkit-scrollbar { display: none; }
#soloTabs button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
#soloTabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
#soloBody { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.so-sub { margin: 0; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.4; }
.so-mission { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.so-mission.done { background: #eef7e6; border-color: #cfe6bd; }
.so-micon { font-size: 22px; flex: none; width: 30px; text-align: center; }
.so-mmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.so-mmain i { display: block; height: 7px; border-radius: 4px; background: #eee6d8; overflow: hidden; }
.so-mmain i b { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.so-mission.done .so-mmain i b { background: #7fbf5a; }
.so-mnum { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.so-days { margin: 4px 0 0; text-align: center; font-size: 13.5px; font-weight: 600; }
.so-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.so-cell { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 92px; justify-content: center; }
.so-cell.off { background: #f3eee5; }
.so-cell.off .so-name { color: var(--muted); }
.so-cell.stamp.off .so-icon { filter: grayscale(1); opacity: 0.3; }
.so-cell.stamp:not(.off) { background: #fdeede; border-color: var(--accent); }
.so-icon { font-size: 30px; line-height: 1.1; }
.so-cat { width: 64px; height: 56px; display: block; }
.so-cat.off { filter: brightness(0); opacity: 0.22; }
.so-name { font-size: 12.5px; font-weight: 600; text-align: center; line-height: 1.25; overflow-wrap: anywhere; }
.so-grade { font-size: 10px; letter-spacing: 1px; color: #c9bfae; line-height: 1; }
.so-grade.g1 { color: #7fae5a; } .so-grade.g2 { color: #5a8fd0; } .so-grade.g3 { color: #e0a020; }
.so-count { position: absolute; top: 5px; right: 7px; font-size: 11px; color: var(--muted); }
#photoImg { width: 100%; max-height: 58dvh; object-fit: contain; border-radius: 12px; background: #f3ece0; min-height: 0; }
.so-btn { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 16px; font-size: 14.5px; cursor: pointer; text-decoration: none; color: var(--ink); font-family: inherit; }
.so-btn.main { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
@media (max-width: 420px) { #soloTabs { gap: 3px; } #soloTabs button { padding: 7px 6px; font-size: 12px; flex: 1 1 auto; text-align: center; } .so-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; } .so-cell { min-height: 84px; padding: 8px 4px 6px; } .so-icon { font-size: 26px; } .so-card { padding: 12px 10px 12px; border-radius: 20px; } }

/* ---------------- 보물·물고기 발견 화면 ---------------- */
.so-grade.g4 { color: #38b6e8; }
#reveal { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; pointer-events: none; z-index: 9; }
#rvCard { pointer-events: auto; cursor: pointer; position: relative; width: min(280px, 100%); background: var(--card); border-radius: 26px; box-shadow: var(--shadow), 0 0 0 3px #e9e1d3; padding: 16px 16px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; animation: rvPop .45s cubic-bezier(.2, 1.5, .4, 1); margin-bottom: 12dvh; }
#rvHead { font-size: 14px; font-weight: 700; color: var(--muted); overflow-wrap: anywhere; }
#rvIconBox { position: relative; width: 132px; height: 132px; border-radius: 50%; background: #f6efe3; display: grid; place-items: center; margin: 4px 0 2px; }
#rvIcon { font-size: 78px; line-height: 1; animation: rvIcon .6s cubic-bezier(.2, 1.6, .4, 1) both; }
#rvName { font-size: 20px; overflow-wrap: anywhere; }
#rvStars { font-size: 15px; letter-spacing: 2px; }
#rvMsg { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
#rvHint { font-size: 11px; color: var(--muted); margin-top: 2px; }
#rvFx { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.rv-p { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); animation: rvBurst 1.5s ease-out both; }
/* 물고기: 낚싯줄에 매달려 흔들린다 */
.rv-line { display: none; }
#rvCard.fish .rv-line { display: block; position: absolute; left: calc(50% - 1px); top: 3px; width: 2px; height: 42px; background: #a59c8e; border-radius: 1px; } /* 낚싯줄: 동그라미 안쪽 위에서 물고기까지 */
#rvCard.fish #rvIcon { transform-origin: 50% -34px; margin-top: 12px; animation: rvIcon .6s cubic-bezier(.2, 1.6, .4, 1) both, rvSwing 1.6s ease-in-out .6s infinite; }
/* 등급별 꾸밈 */
#rvCard.g1 { box-shadow: var(--shadow), 0 0 0 3px #b9dba0; }
#rvCard.g2 { box-shadow: var(--shadow), 0 0 0 3px #8db8ea, 0 0 26px rgba(90, 143, 208, .45); }
#rvCard.g2 #rvIconBox { box-shadow: 0 0 0 4px rgba(90, 143, 208, .25); }
#rvCard.g3 { box-shadow: var(--shadow), 0 0 0 4px #f0b93a, 0 0 40px rgba(240, 180, 40, .7); animation: rvPop .45s cubic-bezier(.2, 1.5, .4, 1), rvGlowGold 1.4s ease-in-out .45s infinite; }
#rvCard.g3 #rvIconBox { background: radial-gradient(circle, #fff7d6, #fbe6a8); box-shadow: 0 0 0 4px rgba(240, 185, 58, .4); }
#rvCard.g3 #rvName { color: #b97a00; }
#rvCard.g4 { background: linear-gradient(160deg, #ffffff, #e6f8ff 55%, #f3e9ff); box-shadow: var(--shadow), 0 0 0 4px #5fd0f5, 0 0 60px rgba(95, 208, 245, .9); animation: rvPop .5s cubic-bezier(.2, 1.7, .4, 1), rvGlowDia 1.1s ease-in-out .5s infinite; }
#rvCard.g4 #rvIconBox { background: conic-gradient(from 0deg, #c9f1ff, #f3d9ff, #fff3c4, #c9ffe6, #c9f1ff); box-shadow: 0 0 0 5px rgba(95, 208, 245, .45); animation: rvSpin 5s linear infinite; }
#rvCard.g4 #rvIcon { animation: rvIcon .6s cubic-bezier(.2, 1.6, .4, 1) both, rvSpinBack 5s linear infinite; }
#rvCard.g4.fish #rvIcon { animation: rvIcon .6s cubic-bezier(.2, 1.6, .4, 1) both, rvSpinBack 5s linear infinite; }
#rvCard.g4 .rv-line { display: none; }
#rvCard.g4.fish #rvIcon { transform-origin: center; }
.so-icon.two { font-size: 21px; white-space: nowrap; line-height: 1.6; }
#rvCard.g4 #rvName { font-size: 22px; background: linear-gradient(90deg, #2aa7e0, #a05be0, #2aa7e0); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes rvPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rvIcon { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }
@keyframes rvSwing { 0%, 100% { rotate: -7deg; } 50% { rotate: 7deg; } }
@keyframes rvBurst { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 40px)) rotate(var(--rot)) scale(1); opacity: 0; } }
@keyframes rvGlowGold { 0%, 100% { box-shadow: var(--shadow), 0 0 0 4px #f0b93a, 0 0 30px rgba(240, 180, 40, .5); } 50% { box-shadow: var(--shadow), 0 0 0 4px #ffd564, 0 0 56px rgba(240, 180, 40, .95); } }
@keyframes rvGlowDia { 0%, 100% { box-shadow: var(--shadow), 0 0 0 4px #5fd0f5, 0 0 40px rgba(95, 208, 245, .6); } 50% { box-shadow: var(--shadow), 0 0 0 4px #c59bff, 0 0 80px rgba(170, 130, 255, .95); } }
@keyframes rvSpin { to { rotate: 360deg; } }
@keyframes rvSpinBack { to { rotate: -360deg; } }
@media (max-height: 560px) { #rvIconBox { width: 92px; height: 92px; } #rvIcon { font-size: 54px; } #rvCard { margin-bottom: 0; padding: 10px 14px; gap: 3px; } }

/* 입질·보물 줍기: PC 에서도 주황 버튼으로 (가운데 아래), 입질은 두근두근 */
#ctxBtn.urgent:not(.hidden) { display: block; position: fixed; left: 50%; transform: translateX(-50%); z-index: 7; border: 0; border-radius: 999px; padding: 13px 22px; font-size: 16px; font-weight: 800; color: #fff; background: #e0603a; box-shadow: 0 6px 18px rgba(224,96,58,0.45); cursor: pointer; white-space: nowrap; font-family: inherit; }
@media (min-width: 721px) { #ctxBtn.urgent:not(.hidden) { bottom: 110px; font-size: 18px; padding: 15px 28px; } }
#ctxBtn.bite:not(.hidden) { animation: ctxBite .55s ease-in-out infinite; background: #e2452f; box-shadow: 0 0 0 0 rgba(226,69,47,.6), 0 6px 18px rgba(224,96,58,0.45); }
@keyframes ctxBite { 0%, 100% { transform: translateX(-50%) scale(1); box-shadow: 0 0 0 0 rgba(226,69,47,.55), 0 6px 18px rgba(224,96,58,0.45); } 50% { transform: translateX(-50%) scale(1.12); box-shadow: 0 0 0 14px rgba(226,69,47,0), 0 6px 18px rgba(224,96,58,0.45); } }

/* ---------------- 물고기 그림 · 수량 · 낚시가게 ---------------- */
.fish-ic { display: block; }
.so-cell .fish-ic { margin: 2px 0; }
#rvIcon .fish-ic { margin: 0 auto; }
#rvCount { font-size: 13px; font-weight: 700; color: var(--muted); min-height: 0; }
#rvCount:empty { display: none; }
#rvShot { margin-top: 4px; padding: 9px 16px; font-size: 14px; }
.so-count { font-weight: 700; color: #7a6f60; background: rgba(255,255,255,.75); border-radius: 8px; padding: 1px 5px; }
#fsBody { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.fs-h { margin: 4px 0 0; font-size: 14px; }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 8px; }
.fs-item { position: relative; border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 10px 8px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; font-family: inherit; color: var(--ink); min-height: 96px; justify-content: center; text-align: center; }
.fs-item.on { background: #fdeede; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.fs-item b { font-size: 14px; overflow-wrap: anywhere; }
.fs-ic { font-size: 28px; line-height: 1.1; }
.fs-rod { width: 54px; height: 7px; border-radius: 4px; rotate: -24deg; margin: 12px 0 10px; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.fs-fx { font-size: 11.5px; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.fs-on { position: absolute; top: 6px; right: 8px; font-size: 10.5px; font-weight: 700; color: var(--accent); }
@media (max-width: 420px) { .fs-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; } .fs-item { min-height: 88px; padding: 8px 6px; } }

/* ---------------- 코인: 가게 가격 · 낚시가게 사기 · 개뱅크 ---------------- */
.fs-item { cursor: default; }
.fs-item:not(.none):not(.on) { cursor: pointer; }
.fs-item.none { background: #f6f2ea; }
.fs-item.none > b, .fs-item.none > .fs-fx { opacity: .75; }
.fs-stock { font-size: 11px; font-weight: 700; color: #7a6f60; }
.fs-stock:empty { display: none; }
.fs-buy { margin-top: 4px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; padding: 6px 10px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.fs-buy.poor { background: #cfc6b8; }
#bkBody { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 2px; }
.bk-row { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.bk-ic { flex: none; width: 48px; display: grid; place-items: center; font-size: 26px; }
.bk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; overflow-wrap: anywhere; }
.bk-price { font-size: 11.5px; color: var(--muted); }
.bk-btns { flex: none; display: flex; flex-direction: column; gap: 4px; }
.bk-btns .so-btn { padding: 6px 10px; font-size: 12.5px; white-space: nowrap; }
#bkAll { flex: none; }
/* 옷·가발·장난감·침대 가게: 값표 */
.sh-grid button { position: relative; }
.sh-price { position: absolute; top: 4px; right: 4px; font-size: 10.5px; font-weight: 800; line-height: 1; padding: 3px 5px; border-radius: 8px; background: #fff3c9; color: #8a6400; box-shadow: 0 1px 2px rgba(0,0,0,.12); white-space: nowrap; }
.sh-price.own { background: #e3f3d8; color: #3f7a2a; }
#shWear.poor { background: #cfc6b8; }

/* 안 산 물건: 자물쇠 (눌러서 미리보기는 된다). 사면 풀린다 */
.sh-grid button.locked img { filter: grayscale(.45); opacity: .72; }
.sh-grid button.locked.on img { filter: none; opacity: 1; }
.sh-lock { position: absolute; left: 5px; top: 4px; font-size: 13px; font-style: normal; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.sh-price { font-style: normal; }

/* ---------------- 반려견 키우기 ---------------- */
#petChip, #invChip { pointer-events: auto; border: 0; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; padding: 7px 12px; }
#petChip.need { background: #ffe1d6; animation: petNeed 1.2s ease-in-out infinite; }
@keyframes petNeed { 50% { box-shadow: 0 0 0 4px rgba(224, 96, 58, .28), var(--shadow); } }
#petBody, #fdBody { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.pt-row { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.pt-row.warn { background: #fff0ea; border-color: #f0b9a6; }
.pt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.pt-head span { font-size: 12.5px; color: var(--muted); }
.pt-row.warn .pt-head span { color: #c2453a; font-weight: 700; }
.pt-row i { display: block; height: 8px; border-radius: 4px; background: #eee6d8; overflow: hidden; }
.pt-row i b { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* 레벨 업: 내 강아지 그림 */
#rvCard.dog #rvIcon { animation: rvIcon .6s cubic-bezier(.2, 1.6, .4, 1) both; }
#rvCard.g4.dog #rvIconBox { animation: none; }
#rvCard.g4.dog #rvIcon { animation: rvIcon .6s cubic-bezier(.2, 1.6, .4, 1) both; }

/* ---------------- 튜토리얼 (길냥이 나비) ---------------- */
#tut { position: fixed; z-index: 9; left: 50%; transform: translateX(-50%); top: calc(14px + env(safe-area-inset-top)); width: min(560px, calc(100vw - 24px)); display: flex; gap: 10px; align-items: flex-start; background: #fffaf0; border: 2px solid #f0b56a; border-radius: 18px; padding: 10px 12px 10px 8px; box-shadow: 0 8px 26px rgba(60, 45, 30, .22); animation: tutIn .35s ease-out; }
#tut.hidden { display: none; }
#tutCat { flex: none; width: 56px; height: 56px; background: #fdebd3; border-radius: 50%; }
.tut-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tut-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; color: #b8732a; }
.tut-head span { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
#tutText { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; word-break: keep-all; }
.tut-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#tutHint { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; color: #d06a2e; }
#tutHint.hidden { display: block; visibility: hidden; }
#tutSkip { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; padding: 6px 4px; cursor: pointer; text-decoration: underline; }
#tutNext { border: 0; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 800; padding: 8px 16px; border-radius: 12px; cursor: pointer; }
#tutNext.hidden, #tutSkip.hidden { display: none; }
body.tut #help { display: none !important; }
body.tut #toast { top: var(--tutB, 80px); }
.tut-glow { position: relative; z-index: 8; animation: tutGlow 1.1s ease-in-out infinite; }
@keyframes tutGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(240, 150, 60, .0), var(--shadow); } 50% { box-shadow: 0 0 0 5px rgba(240, 150, 60, .55), var(--shadow); } }
@keyframes tutIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 720px) { #tut { width: calc(100vw - 20px); padding: 8px 10px 8px 6px; gap: 8px; } #tutCat { width: 46px; height: 46px; } #tutText { font-size: 13.5px; line-height: 1.45; } }

/* ---------------- 계정 (로그인 · 서버 저장) ---------------- */
#cloudPick { z-index: 12; }
#clBody { display: flex; flex-direction: column; gap: 10px; }
.cl-login { display: flex; flex-direction: column; gap: 8px; }
.cl-btn { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #dadce0; background: #fff; color: #1f1f1f; border-radius: 12px; padding: 12px 16px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.cl-btn.apple { background: #000; color: #fff; border-color: #000; }
.cl-btn:hover { filter: brightness(.97); }
#cpCards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cp-card { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 12px 10px; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; font: inherit; cursor: pointer; color: var(--ink); }
.cp-card b { font-size: 14px; }
.cp-card span { white-space: pre-line; font-size: 13px; line-height: 1.5; color: var(--muted); }
.cp-card i { font-style: normal; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: 10px; }
.cloud-join { display: block; width: 100%; margin-top: 8px; border: 0; background: none; color: #8a7f70; font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 6px; }
@media (max-width: 420px) { #cpCards { grid-template-columns: 1fr; } }

/* 강아지별 레벨 · 잠긴 이름 · 털 색 */
#breeds button { position: relative; }
.br-lv { position: absolute; top: 3px; right: 4px; font-style: normal; font-size: 10px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 7px; padding: 1px 5px; line-height: 1.3; }
label.locked input { background: #f1ece3; color: #6f665b; }
label.locked > span::after { content: ' 🔒'; }
#coats.locked button:disabled { opacity: .25; cursor: default; }
.sh-coats.hidden { display: none; }

/* 로그인 먼저: 로그인 전에는 입장 칸 대신 로그인 버튼 (언어는 고를 수 있다) */
#loginGate { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
#loginGate.hidden { display: none; }
#gateText { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); text-align: center; word-break: keep-all; }
#joinForm.need-login > :not(.dogpreview):not(h1):not(.sub):not(#loginGate):not(label:first-of-type) { display: none !important; }

/* 사용자 이름 중복 안내 */
.name-err { margin: -2px 0 2px; font-size: 12.5px; font-weight: 700; color: #c2453a; }
.name-err.ok { color: #3f7a2a; }
.name-err.hidden { display: none; }
#name.bad { box-shadow: 0 0 0 2px #e57a6e; }

/* ---------------- 작명소 ---------------- */
#nmBody { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.nm-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.nm-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; flex-wrap: wrap; }
.nm-price { font-size: 13px; font-weight: 800; color: #8a6400; background: #fff3c9; border-radius: 8px; padding: 3px 8px; }
.nm-now { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.nm-card input { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 15px; background: #fbf8f2; min-width: 0; }
.nm-msg { margin: 0; min-height: 0; font-size: 12.5px; font-weight: 700; }
.nm-msg:empty { display: none; }
.nm-msg.bad { color: #c2453a; }
.nm-card .so-btn.poor { background: #cfc6b8; border-color: #cfc6b8; }
.nm-dogs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.nm-dog { border: 1px solid var(--line); background: #fbf8f2; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.nm-dog.on { background: #fdeede; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); font-weight: 700; }

/* 주황 버튼은 터치 기기(휴대폰 · 태블릿)에서 쓴다. PC 는 말풍선 + 키 (입질 · 보물 줍기 · 화장실처럼 급한 것만 PC 에도 주황 버튼) */
body.touch #ctxBtn:not(.hidden) { display: block; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bot) - var(--gap) + 46px + 5.4em + 14px); z-index: 7; border: 0; border-radius: 999px; padding: 13px 22px; font-size: 16px; font-weight: 800; color: #fff; background: #e0603a; box-shadow: 0 6px 18px rgba(224,96,58,0.45); max-width: calc(100vw - 32px); text-align: center; line-height: 1.25; animation: ctxPop .25s ease-out; }
body:not(.touch) #ctxBtn:not(.urgent) { display: none !important; }
@media (min-width: 721px) { body.touch #ctxBtn:not(.hidden) { bottom: 110px; font-size: 18px; padding: 15px 28px; } }

/* 가게: 위 미리보기는 고정, 아래 목록만 위아래로 넘긴다 */
.sh-card { overflow: hidden; }
.sh-card > * { flex: none; }
.sh-card > .sh-grid { flex: 1 1 auto; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; align-content: start; -webkit-overflow-scrolling: touch; }

.fs-rodic { width: 78px; height: 40px; display: block; margin: 2px 0; }

/* 구매 완료 카드: 화면 가운데에 잠깐 (무엇을 · 얼마 냈고 · 얼마 남았는지) */
#boughtCard { position: fixed; left: 50%; top: 50%; z-index: 300; min-width: 220px; max-width: calc(100vw - 48px); padding: 18px 22px 16px; border-radius: 22px; background: #fffaf0; border: 3px solid #f0b21a; box-shadow: 0 14px 40px rgba(60,40,10,0.35); text-align: center; color: var(--ink); opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(0.85); transition: opacity 0.18s, transform 0.18s; }
#boughtCard.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); animation: bc-pop 0.32s ease-out; }
@keyframes bc-pop { 0% { transform: translate(-50%, -50%) scale(0.7); } 60% { transform: translate(-50%, -50%) scale(1.06); } 100% { transform: translate(-50%, -50%) scale(1); } }
#boughtCard .bc-ic { font-size: 44px; line-height: 1.1; margin: 0 auto 4px; display: block; }
#boughtCard canvas.bc-ic { width: 110px; height: 56px; }
#boughtCard .bc-head { display: block; font-size: 19px; color: #2f8a3e; }
#boughtCard .bc-name { margin-top: 4px; font-size: 15px; font-weight: 700; }
#boughtCard .bc-paid { margin-top: 8px; font-size: 15px; font-weight: 800; color: #c0392b; }
#boughtCard .bc-left { margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.fs-buy.sure, .so-btn.sure { background: #c0392b !important; color: #fff !important; animation: sure-pulse 0.7s ease-in-out infinite alternate; }
@keyframes sure-pulse { to { transform: scale(1.05); } }
/* 미션 보상 · 코인 버는 법 */
.so-mpay { flex: none; font-size: 12.5px; font-weight: 800; color: #a86a12; background: #fff3cc; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.so-mission.done .so-mpay { opacity: 0.5; }
.so-earn { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: #fff7e0; border: 1px solid #f1d58a; }
.so-earn b { display: block; font-size: 14.5px; margin-bottom: 4px; }
.so-earn p { margin: 3px 0; font-size: 13.5px; line-height: 1.45; }

.legal-links { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.legal-links a { color: var(--muted); }

/* 휴대폰에서 채팅 칠 때: 키보드 뒤로 숨는 오른쪽 메뉴는 잠깐 감춘다 */
body.typing #actions { opacity: 0; pointer-events: none; }

/* 가방 */
#invTabs { display: flex; gap: 6px; overflow-x: auto; flex: none; padding: 2px; scrollbar-width: none; }
#invTabs::-webkit-scrollbar { display: none; }
#invTabs button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; font-size: 13.5px; cursor: pointer; white-space: nowrap; color: var(--ink); font-family: inherit; }
#invTabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
#invBody { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 2px; overscroll-behavior: contain; }
#inventory .so-card { height: min(640px, 100%); }
.inv-empty { padding: 6px 0 4px; }
.hud-row { display: flex; gap: 6px; align-items: center; }
