/* 글꼴: SUIT (이 앱 안에 넣어 둬서 오프라인에서도 같은 모양으로 보여요) */
@font-face { font-family: "SUIT"; font-weight: 100 900; font-style: normal; font-display: swap; src: url("/fonts/SUIT-Variable.woff2") format("woff2"); }
/* 므메미무 키우기: 이 게임만의 스타일. 군더더기 없는 2D예요. 얇은 선, 연한 파스텔 면, 넉넉한 여백으로 맞췄어요. 폰(세로)을 기준으로 만들고 넓은 화면에서는 가운데에 모아요. */
:root {
  --paper: #f6f9fe;
  --surface: #ffffff;
  --wash: #eef4fc;
  --sky-100: #e3eefb;
  --sky-200: #cfe2f7;
  --sky-400: #8fb8e8;
  --accent: #3f73bd;
  --accent-deep: #2f5c9d;
  --on-accent: #ffffff;
  --ink: #2a3850;
  --muted: #66778f;
  --line: #e2eaf5;
  --danger: #b3261e;
  --shadow: rgba(60, 90, 140, 0.1);
  --font: "SUIT", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-brand: var(--font);
  --radius: 22px;
  --radius-sm: 16px;
  --gutter: 18px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body { margin: 0; background: linear-gradient(135deg, var(--th-soft) 0%, #ffffff 48%, var(--th-bg2) 100%) fixed, var(--paper); transition: background 0.4s; color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65; word-break: keep-all; overflow-wrap: break-word; -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; }
img { display: block; max-width: 100%; }
h1, h2 { margin: 0; font-weight: 800; line-height: 1.3; letter-spacing: -0.02em; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.field { font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; width: 100%; min-height: 50px; }
.field:hover { border-color: var(--sky-400); }
.field:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--sky-200); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; background: var(--th-deep); color: var(--on-accent); border: 0; border-radius: 999px; padding: 10px 24px; min-height: 50px; transition: background-color 0.15s var(--ease), transform 0.1s var(--ease); }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.quiet { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.quiet:hover { background: var(--wash); }
.btn.warn { background: #fff; color: var(--danger); box-shadow: inset 0 0 0 1.5px #f0cfcb; }
.btn.warn:hover { background: #fdecea; }
.btn.small { min-height: 44px; padding: 6px 18px; font-size: 0.9rem; }
.help { color: var(--muted); font-size: 0.85rem; }
.msg { min-height: 1lh; font-size: 0.95rem; }

.dlg { border: 0; border-radius: 28px; padding: 26px; width: min(92vw, 380px); color: var(--ink); background: #fff; box-shadow: 0 24px 60px rgba(40, 60, 100, 0.25); }
.dlg::backdrop { background: rgba(40, 56, 90, 0.4); }
.dlg h2 { font-size: 1.3rem; }
.form { display: grid; gap: 16px; }
.dlg .actions { display: flex; flex-wrap: wrap; gap: 10px; }

.pet-page {
  --tint: #e3f2fd;
  --pc: #5bb3f0;
  --bad: #c2362f;
  --warn: #9a5a00;
  --good: #3f73bd;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px var(--gutter) calc(56px + env(safe-area-inset-bottom));
  outline: none;
}
.pet-page :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pet-page [hidden], .notice[hidden] { display: none !important; }

.pet-head h1 { font-family: var(--font-brand); font-size: 1.25rem; font-weight: 600; line-height: 1.2; margin: 0; color: var(--ink); }
.pet-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }

.notice { margin-top: 8px; padding: 10px 14px; border-radius: var(--radius); background: var(--sky-100); }
.notice p { margin: 0 0 8px; font-size: 0.93rem; line-height: 1.4; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* 친구마다 화면 색이 달라져요 (body[data-char]) */
body { --th: #7fb6ea; --th-soft: #eaf4fd; --th-bg2: #f4f0ff; --th-deep: #2f6aa8; --th-line: #bcd9f4; }
body[data-char="memu"] { --heart: #3f8fe0; --heart-off: #cfe2f8; --th-band: #a9d8f8; --th: #7fb6ea; --th-soft: #e8f3fd; --th-bg2: #f2efff; --th-deep: #2f6aa8; --th-line: #bcd9f4; }
body[data-char="mwa"] { --heart: #8a63d2; --heart-off: #dcd0f3; --th-band: #f6dd80; --th: #eec23a; --th-soft: #fff6d6; --th-bg2: #fff0f0; --th-deep: #86600a; --th-line: #f5df94; }
body[data-char="mimeu"] { --heart: #ee5b9a; --heart-off: #f6cfe0; --th-band: #f8b6cf; --th: #f28fb4; --th-soft: #ffe9f1; --th-bg2: #f1eeff; --th-deep: #a93d6a; --th-line: #f8c4d8; }
body[data-char="meumo"] { --heart: #e02f3a; --heart-off: #f4c4c7; --th-band: #d1d1d9; --th: #aeaeb8; --th-soft: #f0f0f4; --th-bg2: #eef3fb; --th-deep: #55555f; --th-line: #d3d3da; }
body[data-char="myami"] { --heart: #2b2b33; --heart-off: #c9c9d0; --th-band: #a4a4ac; --th: #6f6f77; --th-soft: #e9e9ee; --th-bg2: #eef1f6; --th-deep: #3c3c44; --th-line: #bdbdc5; }

/* 큰 카드 하나에 방, 상태, 버튼, 친구 고르기를 모아요 */
.deck { margin-top: 14px; padding: 16px; border-radius: 32px; background: #fbfcff; box-shadow: 0 10px 34px var(--shadow); }
.deck-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pill { margin: 0; padding: 3px 16px; border: 1.5px solid var(--th); border-radius: 999px; background: var(--th-soft); color: var(--th-deep); font-size: 0.95rem; font-weight: 500; white-space: nowrap; }
.pill strong { font-weight: 500; }
.deck-stat { margin: -4px 4px 10px; color: var(--muted); font-size: 0.92rem; font-weight: 400; }
.deck-stat:empty { display: none; }

/* 방 */
.stage {
  --grid: color-mix(in srgb, var(--th) 60%, #fff);
  position: relative; overflow: hidden; border-radius: 22px; border: 9px solid var(--th-band, var(--th));
  aspect-ratio: 1 / 0.92; isolation: isolate;
  background: linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 18px 18px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 18px 18px, #fff;
  box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 0 1.5px var(--ink);
}
body[data-room="photo"] .stage { background: #25304a var(--room) center bottom / cover no-repeat; }
.stage .sky { position: absolute; inset: 0; z-index: -1; }
body[data-night="1"] .stage .sky { background: rgba(8, 14, 40, 0.42); }
.stage[data-status="sleeping"] { filter: brightness(0.9) saturate(0.9); }
.state-tag { position: absolute; z-index: 3; left: 14px; top: 10px; margin: 0; color: var(--muted); font-size: 0.82rem; font-weight: 400; }
body[data-room="photo"] .state-tag { padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: var(--ink); }
.state-tag:empty { display: none; }
.hearts { color: var(--heart, #ec5b9a); position: absolute; z-index: 3; right: 14px; top: 8px; margin: 0; font-size: 0.95rem; line-height: 1.7; letter-spacing: 1px; white-space: nowrap; }
body[data-room="photo"] .hearts { padding: 0 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); }
.hearts:empty { display: none; }
.hearts .off { color: var(--heart-off, #f0cddd); }

.bubble {
  position: absolute; z-index: 3; left: 14px; right: 14px; top: 38px; margin: 0; padding: 7px 18px; min-height: 42px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center;
  background: rgba(255, 255, 255, 0.9); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 999px; pointer-events: none;
  font-size: 0.98rem; font-weight: 400; line-height: 1.4;
}
.bubble:has(.babble:not([hidden])) { border-radius: 26px; }
/* MMMM PET처럼: 친구는 자기 말로 먼저 말하고, 뜻은 괄호로 아래 줄에 보여요 */
.bubble .babble { display: block; font-size: 1.1em; font-weight: 600; letter-spacing: 0.14em; line-height: 1.25; color: var(--th-deep); }
.bubble .babble[hidden] { display: none; }
.bubble .meaning { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; word-break: keep-all; overflow-wrap: anywhere; font-size: 0.92rem; font-weight: 400; color: var(--ink); }
.bubble::after { content: none; }
/* 대화하기: 작은 입력창 (위쪽에 떠서 키보드가 올라와도 가려지지 않고, 아래 친구 대답이 보여요) */
.chat-dlg { width: min(90vw, 340px); padding: 16px; margin: 8vh auto auto; border-radius: 22px; }
.chat-dlg h2 { font-size: 1.05rem; margin: 0; }
.chat-dlg .help { margin: 0 0 8px; font-size: 0.8rem; line-height: 1.4; }
.chat-dlg::backdrop { background: rgba(40, 56, 90, 0.18); }
.chat-row { display: flex; gap: 8px; align-items: center; }
.chat-row .field { flex: 1; min-width: 0; min-height: 44px; font-size: 16px; }
.chat-msg { margin: 6px 0 0; min-height: 1.2em; font-size: 0.85rem; color: var(--th-deep); }
.chat-msg:empty { display: none; }
.chat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.chat-top .btn { min-height: 34px; padding: 4px 12px; }
.chat-dlg .form { display: block; }
/* 머리를 가리면 줄여요 (game.js 가 정해요). 사용자가 더보기에서 작게/끄기도 고를 수 있어요 */
.bubble.tight, body[data-bubble="small"] .bubble { top: 34px; min-height: 0; padding: 4px 14px; }
.bubble.tight .babble, body[data-bubble="small"] .bubble .babble { display: none; }
.bubble.tight { border-radius: 999px; }
.bubble.tighter .meaning, body[data-bubble="small"] .bubble .meaning { font-size: 0.82rem; line-height: 1.3; }
body[data-bubble="small"] .bubble:has(.babble:not([hidden])) { border-radius: 999px; }
body[data-bubble="off"] .bubble { display: none; }

.pet-btn {
  position: absolute; z-index: 2; left: 50%; bottom: 11%; transform: translateX(calc(-50% + var(--dx, 0px))); transition: transform 1.1s cubic-bezier(0.45, 0.05, 0.3, 1);
  display: block; width: var(--pw, 62%); padding: 0; margin: 0; border: 0; background: none; cursor: pointer; color: inherit;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; border-radius: 24px;
}
.pet-btn[data-stage="baby"] { --pw: calc(38% * var(--bk, 1)); } /* 본체 크기를 기준으로 맞춰요 (--bk는 game.js가 정해요) */
.pet-btn[data-stage="kinder"] { --pw: calc(38% * var(--bk, 1)); }
.pet-btn[data-stage="adult"] { --pw: calc(41% * var(--bk, 1)); } /* 키가 큰 친구는 모자가 말풍선에 가리지 않게 조금 작게 */
.pet-btn[data-stage="egg"] { --pw: 30%; }
.pet-btn .sprite { transform: translateY(var(--sink, 0%)); position: relative; display: block; width: 100%; aspect-ratio: var(--ratio, 0.83); overflow: visible; }
.pet-btn .sprite img { position: absolute; left: 0; top: 0; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; pointer-events: none; transition: opacity var(--fade, 0.18s) ease-in-out; }
.pet-btn[data-stage="egg"] .sprite { display: none; }
.pet-btn:not([data-stage="egg"]) .egg-box { display: none; }
.egg-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.pet-btn[data-mood="back"] .sprite img { filter: none; }
.pet-btn[data-status="sick"] .sprite img { filter: saturate(0.55) hue-rotate(60deg) brightness(1.03); }

.badge { position: absolute; z-index: 4; left: 50%; bottom: 52%; margin-left: 20%; font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18)); }
.poops { position: absolute; z-index: 1; left: 0; right: 0; bottom: 6%; height: 12%; pointer-events: none; }
.poops span { position: absolute; bottom: 0; font-size: 2rem; line-height: 1; animation: bob 2.4s ease-in-out infinite; }
.poops span:nth-child(1) { left: 7%; }
.poops span:nth-child(2) { right: 8%; animation-delay: -0.8s; }
.poops span:nth-child(3) { left: 24%; bottom: 4%; font-size: 1.6rem; animation-delay: -1.5s; }

.fx { position: absolute; z-index: 5; inset: 0; pointer-events: none; overflow: hidden; }
.fx span { position: absolute; font-size: 1.7rem; line-height: 1; animation: floatup 1.3s ease-out forwards; }

/* 움직임: 말랑하게 눌렸다 펴지는 느낌으로 (발 쪽을 기준으로 늘고 줄어요) */
@keyframes idle { 0%, 100% { transform: translateY(0) scale(1, 1) rotate(0); } 25% { transform: translateY(0) scale(1.012, 0.985) rotate(-0.7deg); } 50% { transform: translateY(-2px) scale(0.992, 1.014) rotate(0); } 75% { transform: translateY(0) scale(1.012, 0.985) rotate(0.7deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, 0.98); } }
@keyframes jump { 0% { transform: translateY(0) scale(1, 1); } 16% { transform: translateY(0) scale(1.08, 0.88); } 42% { transform: translateY(-34px) scale(0.94, 1.1); } 66% { transform: translateY(0) scale(1.08, 0.9); } 82% { transform: translateY(-5px) scale(0.98, 1.03); } 100% { transform: translateY(0) scale(1, 1); } }
@keyframes step { 0% { transform: translateY(0) scale(1, 1); } 10% { transform: translateY(0) scale(1.05, 0.93); } 24% { transform: translateY(-12px) scale(0.97, 1.05); } 38% { transform: translateY(0) scale(1.04, 0.95); } 52% { transform: translateY(-9px) scale(0.98, 1.03); } 66% { transform: translateY(0) scale(1.03, 0.96); } 80% { transform: translateY(-5px) scale(0.99, 1.02); } 92% { transform: translateY(0) scale(1.02, 0.98); } 100% { transform: translateY(0) scale(1, 1); } }
@keyframes munch { 0%, 100% { transform: scale(1, 1); } 16% { transform: scale(1.04, 0.95); } 32% { transform: scale(0.98, 1.03); } 48% { transform: scale(1.04, 0.95); } 64% { transform: scale(0.98, 1.03); } 80% { transform: scale(1.02, 0.98); } }
@keyframes shake { 0%, 100% { transform: translateX(0) rotate(0); } 18% { transform: translateX(-6px) rotate(-2deg); } 38% { transform: translateX(6px) rotate(2deg); } 58% { transform: translateX(-4px) rotate(-1.4deg); } 78% { transform: translateX(3px) rotate(1deg); } }
@keyframes wiggle { 0% { transform: translateY(0) scale(1, 1); } 22% { transform: translateY(0) scale(1.06, 0.92); } 48% { transform: translateY(-8px) scale(0.97, 1.05); } 72% { transform: translateY(0) scale(1.03, 0.97); } 100% { transform: translateY(0) scale(1, 1); } }
@keyframes shiver { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.5px); } 75% { transform: translateX(1.5px); } }
@keyframes floatup { 0% { opacity: 0; transform: translateY(8px) scale(0.7); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-70px) scale(1.1); } }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 0) scale(0.8); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(10px, -34px) scale(1.2); } }
@keyframes eggwob { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-3deg); } 70% { transform: rotate(3deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.pet-btn .sprite, .pet-btn .egg-box { transform-origin: 50% 100%; }
.pet-btn[data-idle="bob"] .sprite { animation: idle 4.4s ease-in-out infinite; }
.pet-btn[data-idle="sleep"] .sprite { animation: breathe 4.2s ease-in-out infinite; }
.pet-btn[data-idle="sick"] .sprite { animation: shiver 0.4s linear infinite; }
.pet-btn[data-stage="egg"] .egg-box { animation: eggwob 3.2s ease-in-out infinite; }
.pet-btn[data-warm="1"] .egg-box { animation: eggwob 2.2s ease-in-out infinite; }
.pet-btn[data-warm="2"] .egg-box { animation: eggwob 0.9s ease-in-out infinite; }
.pet-btn.a-jump .sprite, .pet-btn.a-jump .egg-box { animation: jump 0.9s cubic-bezier(0.3, 0.6, 0.4, 1); }
.pet-btn.a-munch .sprite { animation: munch 1s ease-in-out; }
.pet-btn.a-shake .sprite { animation: shake 0.8s ease-in-out; }
.pet-btn.a-wiggle .sprite, .pet-btn.a-wiggle .egg-box { animation: wiggle 0.6s cubic-bezier(0.3, 0.6, 0.4, 1); }
.pet-btn.a-step .sprite { animation: step 1.1s ease-in-out; }
.fx .zz { animation: zz 1.8s ease-out forwards; font-weight: 800; color: #5a6fa8; font-size: 1.4rem; }

/* 상태 막대: 윤곽선 있는 작은 카드 */
.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.meter { min-width: 0; padding: 8px 10px 10px; border: 1.5px solid var(--ink); border-radius: 18px; background: #fff; }
.meter .m-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; font-size: 0.82rem; font-weight: 400; color: var(--muted); }
.meter .m-top span { white-space: nowrap; }
.meter .m-top em { font-style: normal; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.meter .bar { height: 8px; margin-top: 8px; border-radius: 999px; background: var(--th-soft); overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--th); transition: width 0.5s var(--ease), background-color 0.3s; }
.meter[data-level="mid"] .bar i { background: #f2bf56; }
.meter[data-level="low"] .bar i { background: #ef7f78; }

/* 돌보기 버튼: 흰 바탕에 얇은 윤곽선 */
.care { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 76px; padding: 8px 4px; font: inherit; font-weight: 500; font-size: 0.95rem; color: var(--ink); cursor: pointer;
  background: #fff; border: 1.5px solid var(--ink); border-radius: 18px; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s var(--ease), background-color 0.15s var(--ease), border-color 0.15s;
}
.act .ico { display: block; width: 26px; height: 26px; color: var(--th-deep); }
.act .ico svg { display: block; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.act .lbl { line-height: 1.2; }
.act:hover { background: var(--th-soft); }
.act:active { transform: scale(0.97); background: var(--th-soft); }
.act.hint { background: var(--th-soft); border-color: var(--th-deep); box-shadow: 0 0 0 2px var(--th-line); }
.act.wide { grid-column: 1 / -1; min-height: 64px; flex-direction: row; gap: 10px; }
/* 알일 때: 알 톡톡 깨우기가 왼쪽 3칸, 더보기가 오른쪽 1칸으로 한 줄을 채워요 */
.care .act.wide { grid-column: span 3; order: -1; min-height: 70px; }

/* 친구 고르기 (아래쪽 줄) */
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 12px; padding: 6px; border: 1.5px solid var(--ink); border-radius: 24px; background: #f4f6fc; }
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 70px; padding: 6px 2px; font: inherit; color: var(--muted); cursor: pointer;
  background: transparent; border: 1.5px solid transparent; border-radius: 16px; transition: background-color 0.15s var(--ease), border-color 0.15s;
}
.tab:hover { background: #fff; }
.tab[aria-selected="true"] { background: #fff; color: var(--ink); border-color: var(--tc, var(--th)); box-shadow: 0 0 0 2px var(--th-soft); }
.tab .thumb { position: relative; display: block; width: 46px; height: 52px; overflow: hidden; }
.tab .thumb img { position: absolute; display: block; max-width: none; height: auto; }
.tab .thumb.egg-thumb svg { position: absolute; left: 6px; bottom: 0; width: 34px; height: 42px; display: block; }
.tab .tname { font-size: 0.82rem; font-weight: 500; line-height: 1.2; }
.tab .dot { position: absolute; top: 4px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: #f26b63; box-shadow: 0 0 0 2px #fff; }

/* 더 보기 */
.more { margin-top: 14px; border-radius: var(--radius); background: #fff; box-shadow: 0 3px 12px var(--shadow); }
.more > summary { cursor: pointer; padding: 14px 18px; min-height: 54px; display: flex; align-items: center; font-weight: 700; font-size: 0.95rem; list-style: none; border-radius: var(--radius); }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.more[open] > summary::after { content: "▴"; }
.more-body { padding: 2px 18px 18px; }
.more-body .help { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.sync-status { margin: 0 0 10px; font-weight: 700; }
.sync-status.ok { color: var(--good); }
.sync-status.off { color: var(--warn); }
.code-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.code-row code { font-size: 1.2rem; font-weight: 800; letter-spacing: 0.08em; padding: 8px 14px; border-radius: 14px; background: var(--wash); user-select: all; }
.join label { display: block; font-weight: 700; margin-bottom: 6px; }
.join-row { display: flex; gap: 8px; }
.join-row .field { flex: 1; min-width: 0; text-transform: uppercase; }
.join .msg { min-height: 1.4em; margin: 6px 0 0; color: var(--bad); }
.join .msg.ok { color: var(--good); }
.record { margin: 0 0 10px; }
.tips { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 0.92rem; }
.tips li + li { margin-top: 6px; }

/* 놀이 */
.dlg .play { display: flex; flex-direction: column; gap: 10px; align-items: stretch; text-align: center; }
.play-face { margin: 0 auto; width: 120px; }
.play-face img { display: block; width: 100%; height: auto; }
.play-line { margin: 0; min-height: 3em; font-weight: 600; }
.play-hands { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.play-hands .btn { min-height: 56px; }

@media (max-width: 639px) {
  /* 폰에서는 방과 돌보기 버튼이 첫 화면에 다 보이게 설명 줄을 접어요 */
  .pet-head p { display: none; }
  .pet-page { padding-top: 14px; }
  .stage { aspect-ratio: 1 / 1.04; }
  .pet-btn { bottom: 8%; }
}
@media (min-width: 640px) {
  /* 맥처럼 넓은 화면에서도 방과 돌보기 버튼이 한 화면에 들어오게 방을 낮추고 친구 크기에 상한을 둬요 */
  .pet-page { padding-top: 24px; }
  .stage { aspect-ratio: 1 / 0.9; }
  .bubble { font-size: 1.1rem; }
  .pet-btn[data-stage="baby"] { --pw: calc(min(35%, 175px) * var(--bk, 1)); }
  .pet-btn[data-stage="kinder"] { --pw: calc(min(34%, 180px) * var(--bk, 1)); }
  .pet-btn[data-stage="adult"] { --pw: calc(min(36%, 195px) * var(--bk, 1)); }
  .pet-btn[data-stage="egg"] { --pw: min(30%, 150px); }
}
@media (max-width: 360px) {
  .tab .tname { font-size: 0.78rem; }
  .meters { gap: 8px 10px; }
  .act { font-size: 0.92rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pet-page *, .pet-page *::before, .pet-page *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .meter .bar i { background: Highlight; }
  .tab[aria-selected="true"] { outline: 3px solid Highlight; }
  .btn, .act, .tab, .more, .bubble { border: 2px solid ButtonText; }
}

/* ---- 도감 / 어른 모자 / 세이브 코드 ---- */
.book-btn { font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; min-height: 36px; padding: 3px 16px; border-radius: 999px; border: 1.5px solid var(--th); background: #fff; color: var(--th-deep); }
.book-btn:hover { background: var(--th-soft); }
.cape { position: absolute; left: 13%; width: 74%; pointer-events: none; z-index: 2; }
.cape[hidden], .head-copy[hidden] { display: none; }
.cape svg { display: block; width: 100%; height: auto; overflow: visible; }
.head-copy { position: absolute; inset: 0; z-index: 3; pointer-events: none; background-size: 100% 100%; background-repeat: no-repeat; }
.hat { position: absolute; pointer-events: none; z-index: 4; transform: rotate(-13deg); transform-origin: 50% 60%; }
.hat[hidden] { display: none; }
.hat svg { display: block; width: 100%; height: auto; overflow: visible; }
.pet-btn[data-stage="egg"] .hat { display: none; }
.save-area { min-height: 84px; resize: vertical; font-size: 0.78rem; line-height: 1.4; word-break: break-all; text-transform: none !important; }
/* 긴 창은 위아래로만 스크롤돼요. 창 안쪽 여백(26px)을 스크롤 영역이 직접 가져서 옆으로 삐져나오지 않아요 */
.dlg .book { max-height: 82vh; overflow-x: hidden; overflow-y: auto; margin: 0 -26px; padding: 0 26px; overscroll-behavior-x: none; }
.dlg h3 { margin: 0 0 6px; font-size: 1rem; }
.dex { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dex-c { text-align: center; font-size: 0.78rem; color: var(--ink); }
.dex-c .face { display: block; aspect-ratio: 1; border-radius: 16px; background: var(--wash); overflow: hidden; margin-bottom: 3px; }
.dex-c .face { position: relative; }
.dex-c img { position: absolute; max-width: none; height: auto; display: block; }
.dex-c[data-got="0"] img { filter: brightness(0) opacity(0.12); }
.dex-c small { display: block; color: var(--muted); }
.cur { padding: 12px 14px; border-radius: 18px; background: var(--th-soft); color: var(--ink); font-size: 0.92rem; }
.cur p { margin: 0 0 8px; }
.cur .row { display: flex; flex-wrap: wrap; gap: 8px; }
.cur .field { margin-bottom: 8px; }
.guest ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.88rem; }
.guest li { padding: 8px 12px; border-radius: 14px; background: var(--wash); }
.guest li small { display: block; color: var(--muted); }
.guest .none { color: var(--muted); background: none; padding: 0; }

/* ---- 2단계: 상점 · 미니게임 · 밤 · 가출 ---- */
.top-btns { display: inline-flex; gap: 6px; }
.deck-stat { display: flex; flex-wrap: wrap; gap: 0 4px; }
#whoCoins:not(:empty)::before { content: " · 🪙 "; }
.test-banner { background: #fff4d6; border-color: #f0d68a; }
.props { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.props .prop { position: absolute; translate: -50% -50%; height: auto; pointer-events: none; cursor: grab; touch-action: none; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.28)); }
.props .prop.drag { cursor: grabbing; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35)); scale: 1.06; animation: none; z-index: 4; }
.props .float { animation: float 4s ease-in-out infinite; }
.props .f2 { animation-duration: 5s; animation-direction: reverse; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.stage::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; background: rgba(10, 14, 40, 0.42); opacity: 0; transition: opacity 0.5s; border-radius: inherit; }
.stage[data-lamp="0"]::after { opacity: 1; }
.circles { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.circles[hidden] { display: none; }
.circles i { position: absolute; width: 11%; height: 3.4%; border-radius: 50%; background: rgba(70, 60, 120, 0.4); filter: blur(1.5px); transform: translate(-50%, -50%); }
.away-box { display: block; text-align: center; font-size: 3rem; padding: 18px 0 6px; }
.away-box[hidden] { display: none; }
.pet-btn[data-status="away"] .sprite { display: none; }
.hat.acc { transform: none; }
.mini .help { margin: 0; white-space: pre-line; line-height: 1.6; }
.mini-host { width: 100%; position: relative; }
.mini-canvas { display: block; width: 100%; border-radius: 18px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); }
.mini-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.mini-pad .btn { min-height: 96px; padding: 6px; font-size: 1.1rem; touch-action: none; }
.mini-score { margin: 0; min-height: 1.5em; text-align: center; font-weight: 700; color: var(--th-deep); }
.bubble-wrap { position: relative; width: 100%; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: #dff1ff; }
.bubble-wrap .bubble-face { position: absolute; left: 14%; top: 4%; width: 72%; }
.bubble-wrap .mini-canvas { position: absolute; inset: 0; background: transparent; box-shadow: none; touch-action: none; }
.games-list { display: grid; gap: 8px; }
.games-list .btn { justify-content: flex-start; min-height: 54px; }
.games-list .btn small { font-weight: 400; opacity: 0.85; margin-left: auto; }
.shop-coins { margin: 0; font-weight: 700; }
.shop-list { display: grid; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: var(--wash); }
.shop-item .ic { width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.8rem; flex: none; }
.shop-item .ic svg { width: 44px; max-height: 44px; height: auto; }
.shop-item .nm { flex: 1; font-weight: 700; min-width: 0; }
.shop-item .nm small { display: block; font-weight: 400; color: var(--muted); }
.shop-item .btn { min-height: 40px; padding: 4px 14px; font-size: 0.88rem; }
.care { grid-template-columns: repeat(4, 1fr); gap: 6px; }

/* ---- 3단계: 돌발 이벤트 · 육아 결과서 ---- */
.event-chip { position: absolute; z-index: 6; left: 50%; bottom: 1.5%; transform: translateX(-50%); font: inherit; font-weight: 700; font-size: 0.85rem; white-space: nowrap; cursor: pointer; padding: 4px 14px; min-height: 34px; border-radius: 999px; border: 2px solid var(--th-deep); background: #fff; color: var(--th-deep); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); animation: chip 1.8s ease-in-out infinite; }
.event-chip[hidden] { display: none; }
@keyframes chip { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.05); } }
.event-text { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.6; }
.event-choices { display: grid; gap: 8px; }
.event-choices .btn { white-space: normal; min-height: 54px; }
.event-result { margin: 0; min-height: 1.5em; color: var(--th-deep); font-weight: 700; }
.card-img { width: 100%; height: auto; border-radius: 16px; box-shadow: 0 2px 14px var(--shadow); display: block; }
.card-img:not([src]) { display: none; }
.card-msg { margin: 0; text-align: center; color: var(--muted); }
.card-msg:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .event-chip { animation: none; } }
#cardDlg, #eventDlg { max-height: 94vh; overflow: auto; }

.ach-sec h3 { margin: 0 0 6px; font-size: 1rem; }
.ach-sec ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ach-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--wash); font-size: 0.9rem; }
.ach-item[data-done="1"] { background: var(--th-soft); }
.ach-item .ck { width: 24px; text-align: center; flex: none; color: var(--muted); }
.ach-item .nm { flex: 1; min-width: 0; font-weight: 600; }
.ach-item .nm small { display: block; font-weight: 400; color: var(--muted); }
.ach-item .rw { flex: none; font-size: 0.82rem; color: var(--th-deep); font-weight: 600; }

.book-btn.photo { padding: 3px 12px; }
.face-acc { position: absolute; z-index: 4; pointer-events: none; }
.face-acc[hidden] { display: none; }
.face-acc svg { display: block; width: 100%; height: auto; overflow: visible; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mem-card { aspect-ratio: 1; font: inherit; font-size: 1.9rem; line-height: 1; cursor: pointer; border-radius: 16px; border: 1.5px solid var(--th); background: var(--th-soft); touch-action: manipulation; }
.mem-card[data-open="1"] { background: #fff; }
.shop-item .ic img { width: 44px; height: 32px; object-fit: cover; border-radius: 8px; }

/* 돌보기 버튼은 네 개로 줄이고, 나머지는 눌러서 여는 창에 묶었어요 */
.care .act { min-height: 70px; padding: 8px 2px; font-size: 0.9rem; }
.menu-item .mi { display: inline-grid; width: 26px; height: 26px; place-items: center; flex: none; color: var(--th-deep); }
.menu-item .mi svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu-item.hint { background: var(--th-soft); box-shadow: inset 0 0 0 1.5px var(--th-deep); }
.games-list .btn { gap: 10px; }
.menu-head { margin: 6px 2px 0; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.menu-head:first-child { margin-top: 0; }
.shop-item .ic img.prop-ic { width: 44px; height: 44px; object-fit: contain; border-radius: 0; }
#propsReset { justify-self: start; }

/* ---- 캐릭터별 고유 기믹 ---- */
.char-tag { margin: -6px 4px 10px; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
.char-tag b { color: var(--th-deep); font-weight: 600; }
.char-tag .stars { color: var(--th-deep); letter-spacing: 1px; }
.char-tag .hard { display: inline-block; padding: 0 7px; border-radius: 999px; background: #fde4e4; color: #c0392b; font-weight: 700; font-size: 0.72rem; }
.char-tag small { display: block; font-size: 0.78rem; color: var(--muted); }
.tab .tstar { font-size: 0.6rem; line-height: 1; letter-spacing: 0; color: var(--tc, var(--th)); }
.toast { position: fixed; z-index: 200; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); width: min(92vw, 420px); margin: 0; padding: 12px 16px; border-radius: 18px; background: #2a3850; color: #fff; font-size: 0.92rem; font-weight: 500; line-height: 1.45; text-align: center; box-shadow: 0 10px 30px rgba(20, 30, 60, 0.35); cursor: pointer; animation: toastIn 0.3s ease-out; }
.toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.red-eyes { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.red-eyes[hidden] { display: none; }
.red-eyes i { position: absolute; width: 8%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #ff3b4d 0 45%, rgba(255, 59, 77, 0.0) 72%); transform: translate(-50%, -50%); box-shadow: 0 0 14px 5px rgba(255, 40, 60, 0.7); animation: redPulse 1.2s ease-in-out infinite; }
@keyframes redPulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
.stage[data-red="1"] { filter: saturate(0.75) contrast(1.08); }
.stage[data-red="1"]::before { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at 50% 60%, rgba(120, 0, 20, 0.05), rgba(90, 0, 20, 0.55)); border-radius: inherit; }
.stage[data-red="1"] .bubble { background: rgba(42, 15, 24, 0.9); color: #ffd0d6; border-color: #ff5a6e; }
.stage[data-red="1"] .bubble .babble, .stage[data-red="1"] .bubble .meaning { color: #ffd0d6; }
.pet-btn[data-status="out"] .sprite, .pet-btn[data-status="away"] .sprite { display: none; }
@media (prefers-reduced-motion: reduce) { .red-eyes i, .toast { animation: none; } }

/* ---- 므모 '나만 봐' 들이밀기: 화면 코앞까지 줌인 ---- */
.cling-ov { position: fixed; inset: 0; z-index: 300; display: grid; grid-template-rows: auto 1fr auto auto; justify-items: center; align-items: center; gap: 10px; padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom)); background: radial-gradient(circle at 50% 45%, rgba(255, 235, 242, 0.96), rgba(238, 160, 190, 0.97)); overflow: hidden; }
.cling-ov[hidden] { display: none; }
.cling-ov.in { animation: clingIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.cling-ov.out { animation: clingOut 0.45s ease-in forwards; pointer-events: none; }
.cling-ov.shake .cling-img { animation: clingShake 0.45s ease-in-out; }
@keyframes clingIn { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes clingOut { to { opacity: 0; transform: scale(1.3); } }
@keyframes clingShake { 0%, 100% { translate: 0; } 20% { translate: -14px; } 40% { translate: 14px; } 60% { translate: -10px; } 80% { translate: 10px; } }
.cling-say { grid-row: 1; margin: 0; padding: 12px 20px; border-radius: 22px; background: #fff; color: #7a2a4a; font-size: 1.2rem; font-weight: 700; text-align: center; box-shadow: 0 6px 20px rgba(120, 40, 80, 0.25); max-width: 92vw; word-break: keep-all; }
.cling-img { grid-row: 2; width: min(120vw, 130vh, 760px); max-height: 74vh; object-fit: contain; object-position: 50% 30%; cursor: pointer; user-select: none; -webkit-user-drag: none; animation: clingBreathe 1.6s ease-in-out infinite; transform-origin: 50% 70%; filter: drop-shadow(0 12px 24px rgba(120, 40, 80, 0.35)); touch-action: manipulation; }
.cling-img.bump { animation: clingBump 0.4s ease-out; }
@keyframes clingBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes clingBump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.cling-steps { grid-row: 3; display: flex; gap: 16px; margin: 0; padding: 0; list-style: none; font-weight: 700; color: #7a2a4a; }
.cling-steps li[data-done="1"] { color: #2f8f5b; }
.cling-btns { grid-row: 4; display: flex; gap: 12px; width: min(92vw, 420px); }
.cling-btns .btn { flex: 1; background: #fff; color: #b8416f; box-shadow: inset 0 0 0 2px #f08fb4; min-height: 56px; font-size: 1.05rem; }
@media (prefers-reduced-motion: reduce) { .cling-ov.in, .cling-ov.out, .cling-img, .cling-ov.shake .cling-img { animation: none; } }

/* ---- 먀미 삐짐: 구석에서 혼자 중얼중얼 ---- */
.mutter { position: absolute; z-index: 3; left: 6%; bottom: 46%; margin: 0; max-width: 60%; font-size: 0.8rem; font-weight: 400; letter-spacing: -0.02em; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); opacity: 0; pointer-events: none; }
.mutter[hidden] { display: none; }
.mutter.go { animation: mutterGo 3.6s ease-in-out forwards; }
@keyframes mutterGo { 0% { opacity: 0; transform: translateY(6px); } 18% { opacity: 0.55; transform: translateY(0); } 75% { opacity: 0.5; } 100% { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .mutter.go { animation: none; opacity: 0.5; } }

/* ---- 첫 화면을 한눈에: 위쪽 안내와 여백을 줄여서 아래 친구 탭까지 스크롤 없이 보여요 ---- */
.pet-page { padding-top: 8px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.pet-head h1 { font-size: 1.15rem; line-height: 1.15; }
.notice { margin-top: 6px; padding: 8px 12px; }
.notice p { margin: 0 0 6px; font-size: 0.9rem; line-height: 1.35; }
.notice .btn.small { min-height: 34px; padding: 2px 14px; }
.deck { margin-top: 8px; padding: 12px; border-radius: 28px; }
.deck-top { margin-bottom: 6px; }
.deck-stat { margin: 0 4px 4px; font-size: 0.88rem; }
.meters { margin-top: 8px; gap: 6px; }
.meter { padding: 6px 8px 8px; }
.meter .bar { margin-top: 6px; }
.care { margin-top: 8px; }
.care .act { min-height: 60px; }
.care .act.wide { min-height: 60px; }
.tabs { margin-top: 8px; padding: 4px; }
.tab { min-height: 64px; padding: 4px 2px; }
@media (min-width: 640px) {
  .pet-page { padding-top: 10px; }
}
/* 화면이 낮으면 방을 조금 낮춰서 친구 탭까지 보이게 해요 (안내 줄이 떠 있으면 그만큼 더 낮춰요) */
.pet-page { --chrome: 430px; }
.pet-page:has(#connectHint:not([hidden])) { --chrome: 530px; }
.stage { width: 100%; max-height: max(220px, calc(100svh - var(--chrome))); }
@media (min-width: 640px) {
  /* 넓은 화면에서는 방을 찌그러뜨리지 않고, 화면 높이에 맞춰 칸 너비를 줄여요 */
  .pet-page { max-width: clamp(380px, calc((100svh - var(--chrome)) * 1.11 + 22px), 560px); }
  .stage { max-height: none; }
}

/* ---- 언어 버튼과 중국어 글자 ---- */
.pet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lang { display: inline-flex; flex: none; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
.lang button { font: inherit; font-size: 0.8rem; font-weight: 500; line-height: 1; padding: 7px 10px; min-height: 30px; color: var(--muted); background: transparent; border: 0; cursor: pointer; touch-action: manipulation; }
.lang button + button { border-left: 1.5px solid var(--ink); }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }
html[lang="zh-TW"] body { word-break: normal; line-break: strict; }
/* 글이 긴 언어(영어 등)에서도 메뉴 줄의 설명이 잘리지 않게 줄을 바꿔요 */
.menu-item { height: auto; min-height: 52px; text-align: left; }
.menu-item > span:not(.mi) { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.menu-item small { flex: 0 1 46%; min-width: 0; margin-left: auto; text-align: right; line-height: 1.25; overflow-wrap: anywhere; white-space: normal; }

/* 가이드(튜토리얼) */
.pet-head .guide-btn { margin-left: auto; font: inherit; font-size: 0.8rem; font-weight: 600; line-height: 1; padding: 7px 12px; min-height: 30px; color: var(--ink); background: #fff; border: 1.5px solid var(--ink); border-radius: 999px; cursor: pointer; touch-action: manipulation; }
.guide { gap: 12px; }
.guide-count { margin: 0; font-size: 0.85rem; color: var(--muted); }
.guide h2 { margin: 0; }
.guide-text { margin: 0; line-height: 1.6; min-height: 6.4em; white-space: pre-line; }
.guide-dots { display: flex; gap: 6px; justify-content: center; }
.guide-dots i { width: 8px; height: 8px; border-radius: 50%; background: #d9dde8; }
.guide-dots i.on { background: var(--ink); }
.shop-list .help { margin: 0; }
.update-text { margin: 0; font-size: 1.05rem; line-height: 1.5; }

/* 놀러 가기 */
.id-tag { position: absolute; left: 50%; top: 0; transform: translate(-50%, -100%); z-index: 4; white-space: nowrap; pointer-events: none; font-size: 0.72rem; font-weight: 700; line-height: 1; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: var(--ink); border: 1.2px solid var(--ink); }
.id-tag[hidden] { display: none; }
.visit-banner { background: #e7f6ec; border-color: #9fd3b0; }
.visit-who { font-size: 1.05rem; }
body[data-visit] #actions, body[data-visit] #shopBtn, body[data-visit] #bookBtn, body[data-visit] #eventChip, body[data-visit] #syncBox, body[data-visit] #saveBox, body[data-visit] #recordBox, body[data-visit] #connectHint, body[data-visit] #homeBtn { display: none !important; }
.home-row { display: flex; gap: 8px; align-items: center; }
.home-row input { flex: 1 1 auto; min-width: 0; font: inherit; padding: 9px 12px; border: 1.5px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); }
.home-tag { flex: none; font-weight: 700; color: var(--muted); }
.home-mine { margin: 0 0 8px; font-weight: 600; word-break: break-all; }
.home-recent { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.dlg .form.book { grid-template-columns: minmax(0, 1fr); }
.home-row input { width: 100%; }
@media (max-width: 440px) {
  /* 🏠 📷 상점 도감 네 버튼이 좁은 폰 화면에도 한 줄에 들어오게 해요 */
  .deck-top { gap: 6px; }
  .pill { padding: 3px 10px; font-size: 0.85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .top-btns { gap: 4px; flex: none; }
  .book-btn { padding: 3px 11px; font-size: 0.88rem; }
  .book-btn.photo { padding: 3px 9px; }
}

/* 탐색 버튼: 친구 색에 맞춰 눈에 띄게 */
.care { grid-template-columns: repeat(5, 1fr); gap: 5px; }
.act[data-kind="explore"] { background: linear-gradient(160deg, var(--th-soft), var(--th-line)); border-color: var(--th-deep); box-shadow: inset 0 0 0 1px var(--th); }
.act[data-kind="explore"] .lbl { font-weight: 700; color: var(--th-deep); }
.act[data-kind="explore"]:hover { background: var(--th-line); }
.care .act { font-size: 0.82rem; padding-left: 1px; padding-right: 1px; }
.care .act.wide { grid-column: span 5; }

/* 스타샤드 칩 */
.shard-chip { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; border: 1.5px solid var(--th-deep); background: var(--th-soft); color: var(--th-deep); font-size: 0.78rem; font-weight: 700; line-height: 1.5; vertical-align: 1px; }
.shard-chip[hidden] { display: none; }
.shard-chip[data-awake="1"] { background: #1c1b2b; border-color: #8f8cc9; color: #e6e4ff; }

/* 검은 각성 */
.pet-btn[data-awakened="1"] { --pw: calc(41% * var(--bk, 1)); }
@media (min-width: 640px) { .pet-btn[data-awakened="1"] { --pw: calc(min(36%, 195px) * var(--bk, 1)); } }
.pet-btn[data-awakened="1"]::before { content: ""; position: absolute; left: 50%; top: 52%; width: 130%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; z-index: -1; background: radial-gradient(circle, rgba(60, 50, 110, 0.5) 0%, rgba(40, 34, 90, 0.28) 45%, rgba(40, 34, 90, 0) 70%); animation: auraPulse 3.4s ease-in-out infinite; }
.pet-btn[data-awakened="1"]::after { content: "✦ ✧ ✦"; position: absolute; left: 50%; top: -4%; transform: translateX(-50%); font-size: 0.8rem; letter-spacing: 0.9em; color: #d9d6ff; text-shadow: 0 0 6px #8f8cff; pointer-events: none; animation: starTwinkle 2.2s ease-in-out infinite; }
@keyframes auraPulse { 0%, 100% { opacity: 0.75; transform: translate(-50%, -50%) scale(0.96); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } }
@keyframes starTwinkle { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.awaken-chip { bottom: 11%; background: #1c1b2b; color: #e6e4ff; border-color: #8f8cc9; }
.awaken-flash { position: absolute; inset: 0; z-index: 9; pointer-events: none; background: radial-gradient(circle at 50% 60%, #fff 0%, #cfc8ff 35%, rgba(20, 16, 50, 0.85) 100%); opacity: 0; }
.awaken-flash[hidden] { display: none; }
.awaken-flash.go { animation: awakeFlash 2s ease-out; }
@keyframes awakeFlash { 0% { opacity: 0; } 12% { opacity: 1; } 35% { opacity: 0.9; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pet-btn[data-awakened="1"]::before, .pet-btn[data-awakened="1"]::after { animation: none; } .awaken-flash.go { animation-duration: 0.6s; } }
body[data-visit] #awakenChip { display: none !important; }

/* 도감: 검은 각성 */
.awake-sec h3 { margin-top: 6px; }
.awake-dex { grid-template-columns: repeat(2, 1fr); gap: 8px; }
.awake-c .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.awake-c .pair .face { margin-bottom: 3px; }
.awake-c .face.black { background: #1c1b2b; color: #8f8cc9; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.awake-c[data-got="0"] .pair .face:first-child img { filter: none; opacity: 0.5; }

/* 긴 창(상점, 도감, 놀러 가기)은 아래로 내려도 닫기 버튼이 항상 보여요 */
.dlg .book > .actions { position: sticky; bottom: -26px; z-index: 5; margin: 0 -26px -26px; padding: 12px 26px 22px; background: linear-gradient(rgba(255, 255, 255, 0), #fff 28%); }
.dlg .book > .actions .btn { width: 100%; }

/* 미니게임 시작 버튼은 눈에 띄게 (살짝 커지며 빛나요) */
#miniStart:not(:disabled) { min-width: 150px; font-size: 1.1rem; background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); color: var(--btn-ink); box-shadow: 0 0 0 4px var(--btn-glow), 0 8px 20px var(--btn-glow); animation: startPulse 1.3s ease-in-out infinite; }
@keyframes startPulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 4px var(--btn-glow), 0 8px 20px var(--btn-glow); } 50% { transform: scale(1.06); box-shadow: 0 0 0 9px transparent, 0 10px 24px var(--btn-glow); } }
@media (prefers-reduced-motion: reduce) { #miniStart:not(:disabled) { animation: none; } }

/* 누르면 진행되는 버튼(시작, 다음, 사기, 저장…)은 모두 같은 색, 취소·닫기(quiet)는 색 없이 */
.btn:not(.quiet):not(.warn):not([disabled]) { background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); color: var(--btn-ink); box-shadow: 0 6px 14px var(--btn-glow); }
/* 친구마다 진행 버튼 색이 달라요 */
body { --btn-ink: #fff; --btn-a: #6fb4f5; --btn-b: #3f84d8; --btn-glow: rgba(63, 132, 216, 0.38); }
body[data-char="memu"] { --btn-a: #6fb4f5; --btn-b: #3f84d8; --btn-glow: rgba(63, 132, 216, 0.38); }
body[data-char="mwa"] { --btn-a: #ffe45c; --btn-b: #ffcf1a; --btn-glow: rgba(255, 207, 26, 0.45); --btn-ink: #4d3500; } /* 개나리색: 밝아서 글자는 진하게 */
body[data-char="mimeu"] { --btn-a: #ff9cc4; --btn-b: #ec5393; --btn-glow: rgba(236, 83, 147, 0.38); }
body[data-char="meumo"] { --btn-a: #e8606a; --btn-b: #c42f3b; --btn-glow: rgba(196, 47, 59, 0.38); }
body[data-char="myami"] { --btn-a: #6d6d78; --btn-b: #34343c; --btn-glow: rgba(52, 52, 60, 0.4); }
.btn.quiet { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.quiet:hover { background: var(--wash); }
.menu-item.btn.quiet, .shop-item .btn.quiet, .event-choices .btn.quiet { background: #fff; color: var(--ink); }
.btn.quiet:hover { filter: none; box-shadow: inset 0 0 0 1.5px var(--th-line); }
.menu-item > span:not(.mi) { line-height: 1.3; }

/* 폰에서 주소창 때문에 방이 낮아지면 친구도 같이 작아져서 말풍선이 머리와 모자를 가리지 않게 해요 */
.stage { container-type: size; }
.pet-btn[data-stage="baby"], .pet-btn[data-stage="kinder"], .pet-btn[data-stage="adult"] { max-width: calc((92cqh - 96px) * 0.8 * var(--bk, 1)); }

/* 오늘 아직 대화하지 않았으면 방 오른쪽 아래에 말걸기 버튼이 떠요 (이벤트 버튼은 가운데) */
.event-chip.chat-chip { left: auto; right: 10px; bottom: 2%; transform: none; padding: 4px 11px; animation: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.event-chip.chat-chip.fresh { animation: chatchip 2.2s ease-in-out infinite; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
@keyframes chatchip { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .event-chip.chat-chip.fresh { animation: none; } }

/* 상점 액세서리 (투명 PNG) */
.hat.acc, .face-acc, .neck-acc { position: absolute; pointer-events: none; transform: none; }
.neck-acc { z-index: 3; }
.neck-acc[hidden] { display: none; }
.pet-btn .sprite .hat img, .pet-btn .sprite .face-acc img, .pet-btn .sprite .neck-acc img { position: static; display: block; width: 100%; height: auto; filter: none; pointer-events: none; transition: none; }
.shop-item .ic img.acc-ic { width: 44px; height: 44px; object-fit: contain; border-radius: 0; }
.shop-tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.shop-tabs .btn { min-height: 40px; padding: 4px 14px; }
.shop-tabs .btn[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* 놀러 가면 내 친구도 같이 보여요 (말풍선은 놀러 온 집 친구만 나와요) */
.pet-btn.guest { left: 4%; bottom: 9%; transform: none; width: var(--gw, 30%); pointer-events: none; z-index: 2; transition: none; cursor: default; }
.pet-btn.guest[hidden] { display: none; }
.pet-btn.guest .sprite { animation: idle 4.4s ease-in-out 0.9s infinite; }
.guest-tag { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: var(--ink); font-size: 0.72rem; line-height: 1.5; white-space: nowrap; }
body[data-guest="1"] .pet-btn:not(.guest) { --dx: 14%; }

/* 각성 표시: 이름 줄 오른쪽 끝에 네모난 단추로 딱 맞춰요 (줄이 모자라면 아래 줄 오른쪽 끝으로 가요) */
button.shard-chip { font-family: inherit; font-size: 0.78rem; cursor: default; -webkit-tap-highlight-color: transparent; border-radius: 8px; margin: 0 0 0 auto; padding: 2px 10px; line-height: 1.5; vertical-align: baseline; white-space: nowrap; }
button.shard-chip[data-can="1"] { cursor: pointer; min-height: 30px; }

/* hidden 속성을 단추의 display 가 덮어써서 첫 쪽에 "이전"이 보이던 문제 */
.btn[hidden] { display: none !important; }

/* 사진 찍는 순간에는 움직임을 멈춰서 모자·안경·몸의 위치가 맞게 해요 */
body.snap .pet-btn, body.snap .pet-btn .sprite, body.snap .pet-btn .egg-box { animation: none !important; transition: none !important; }

/* 방 꾸미기(소품 옮기기): 상점의 "위치 바꾸기"를 눌렀을 때만 소품을 끌 수 있어요. 평소에는 눌러도 안 움직여요 */
body[data-edit="1"] .props .prop { pointer-events: auto; outline: 2px dashed rgba(255, 255, 255, 0.9); outline-offset: 4px; border-radius: 10px; }
body[data-edit="1"] .pet-btn, body[data-edit="1"] .event-chip, body[data-edit="1"] .bubble, body[data-edit="1"] .mutter { pointer-events: none; }
body[data-edit="1"] .bubble, body[data-edit="1"] .mutter { opacity: 0; }
.edit-bar { position: absolute; left: 10px; right: 10px; top: 10px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 16px; background: rgba(255, 255, 255, 0.95); box-shadow: 0 4px 14px rgba(20, 30, 60, 0.25); }
.edit-bar[hidden] { display: none; }
.edit-bar .edit-msg { flex: 1; font-weight: 700; font-size: 0.88rem; min-width: 0; }
.edit-bar .btn { min-height: 36px; padding: 4px 12px; font-size: 0.85rem; flex: none; }
