/* 우편함: 보내기 · 받은 우편 · 기록 · 클리커, 도착 · 결과 창, EDIT 창의 받은 물건 */
.mb { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; background: var(--paper); }
.mb__tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; background: var(--tool); border-bottom: 1px solid #000; }
.mb__tab { height: 30px; padding: 0 12px; background: var(--dark); color: #fff; border: 1px solid #000; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.mb__tab.is-on { background: #fff; color: #111; }
.mb__tab b { min-width: 18px; height: 18px; padding: 0 5px; background: #e0261b; color: #fff; border-radius: 9px; font-size: 11px; line-height: 18px; text-align: center; }
.mb__body { padding: 12px 14px; overflow: auto; display: grid; gap: 12px; align-content: start; }
.mb__to { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.mb__to .btn.is-on { background: #111; color: #fff; }
.mb__arrow { color: var(--muted); font-weight: 800; margin: 0 2px; }
.mb__h { margin: 4px 0 -4px; font-size: 12.5px; font-weight: 800; }
.mb__hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.mb__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.mb__it { display: grid; justify-items: center; gap: 5px; padding: 10px 4px 8px; background: #fff; border: 1px solid #000; box-shadow: 2px 2px 0 #000; font-size: 12px; font-weight: 700; color: #111; }
.mb__it img { width: 36px; height: 36px; image-rendering: pixelated; }
.mb__it:hover { background: #f0f0f0; }
.mb__it.is-on { background: #111; color: #fff; box-shadow: 2px 2px 0 var(--accent); }
.mb__it.is-on img { background: #fff; outline: 3px solid #fff; }
.mc__add { display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; background: #fff; border: 1px dashed #000; font-size: 13px; font-weight: 800; color: #111; }
.mc__add img { width: 20px; image-rendering: pixelated; }
.mc { display: grid; grid-template-columns: 104px 1fr; gap: 12px; padding: 10px; background: #fff; border: 1px solid #000; box-shadow: 2px 2px 0 var(--accent); }
.mc__pv { display: grid; place-items: center; aspect-ratio: 1; background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 14px 14px; border: 1px solid #000; }
.mc__pv img { width: 86%; height: 86%; object-fit: contain; }
.mc__f { display: grid; gap: 6px; align-content: start; font-size: 12.5px; }
.mc__f label { display: grid; gap: 3px; font-weight: 700; }
.mc__f small { color: var(--muted); font-size: 11.5px; }
.mc__acts { display: flex; gap: 4px; }
.mb__note { position: relative; }
.mb__note textarea { width: 100%; height: 78px; resize: none; padding-bottom: 20px; font: 14px/1.6 var(--font-read); }
.mb__note small { position: absolute; right: 8px; bottom: 7px; color: var(--muted); font-size: 11px; }
.mb__foot { display: flex; justify-content: flex-end; }
.mb__foot .btn { min-width: 110px; }
.mlog { display: grid; background: #fff; border: 1px solid #000; }
.mlog__r { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; border: 0; border-bottom: 1px solid #ddd; background: none; text-align: left; font-size: 13px; color: #111; }
.mlog__r:last-child { border-bottom: 0; }
.mlog__r time { color: var(--muted); font-size: 11.5px; }
.mlog__r span { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mlog__r img { width: 22px; height: 22px; image-rendering: pixelated; flex: none; }
.mlog__r img.own { image-rendering: auto; object-fit: contain; }
.mlog__st { padding: 2px 8px; border: 1px solid #000; font-size: 11.5px; font-weight: 800; font-style: normal; white-space: nowrap; }
.mlog__st.ok { background: #111; color: #fff; }
.mlog__st.no { background: #fff; color: #777; }
.mlog__st.wait { background: var(--accent-hi); color: #111; }

/* 클리커 칸 */
.mk { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.mk__c { padding: 10px; background: #fff; border: 1px solid #000; box-shadow: 2px 2px 0 #000; }
.mk__c h3 { margin: 0 0 8px; font-size: 13.5px; font-weight: 800; }
.mk__fig { display: grid; place-items: center; height: 170px; margin-bottom: 8px; border: 1px solid #000; background: var(--clk-bg); }
.mk__fig .clk { width: 150px; height: 150px; }
.mk__slots { display: grid; gap: 6px; }
.mk__s { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.mk__th { width: 34px; height: 34px; border: 1px solid #000; background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.mk__th img { width: 100%; height: 100%; object-fit: contain; }
.mk__s > span:last-child { display: flex; gap: 4px; }

/* 클리커 그림 (몸 + 얼굴, 누르면 눌린 얼굴 · 꾹) */
:root { --clk-bg: #e4e4e4 radial-gradient(rgba(0, 0, 0, .09) 1px, transparent 1.5px) 0 0 / 12px 12px; }
.clk { position: relative; display: block; width: 180px; height: 180px; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.clk img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.clk__h { transform-origin: 50% 68%; animation: clk-breathe 3.4s ease-in-out infinite; }
.clk__h2 { opacity: 0; }
.clk.is-press .clk__h { animation: none; transform: translateY(4px) scale(1.01, .97); }
.clk.is-press .clk__h2 { opacity: 1; }
.clk.is-press:has(.clk__h2) .clk__h:not(.clk__h2) { opacity: 0; }
@keyframes clk-breathe { 50% { transform: translateY(-1.5%); } }
.clk--none { display: grid; place-items: center; cursor: default; }
.clk--none img { position: static; width: 120px; height: 120px; object-fit: cover; border: 1px solid #000; box-shadow: 3px 3px 0 #000; }
.clk--none b { display: grid; place-items: center; width: 110px; height: 110px; background: #fff; border: 1px solid #000; box-shadow: 3px 3px 0 #000; font-size: 44px; }
@media (prefers-reduced-motion: reduce) { .clk__h { animation: none; } }

/* 우편 칸: 클리커 + 말풍선 (우편함 창 안) */
.mb__body--stage { padding: 0; display: block; }
.mst { position: relative; display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 100%; padding: 16px 18px 48px; box-sizing: border-box; background: var(--clk-bg); }
.mst__fig .clk { width: 190px; height: 190px; }
.mst__fig .clk--none b, .mst__fig .clk--none img { width: 120px; height: 120px; }
.mst__nav { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 800; }
.mst--empty { flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding-bottom: 26px; }
.mst--empty img { width: 84px; height: 84px; padding: 10px; background: #111; border: 1px solid #000; box-shadow: 3px 3px 0 #000; image-rendering: pixelated; }
.mst--empty p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.mp__bub { position: relative; flex: 0 1 300px; margin-top: -40px; padding: 12px 14px 10px; background: #fff; color: #111; border: 1px solid #000; box-shadow: 4px 4px 0 #000; }
.mp__bub::before { content: ""; position: absolute; right: -14px; top: 50%; margin-top: -4px; border: 8px solid transparent; border-left: 14px solid #000; border-right: 0; }
.mp__bub::after { content: ""; position: absolute; right: -11px; top: 50%; margin-top: -3px; border: 7px solid transparent; border-left: 12px solid #fff; border-right: 0; }
.mp__note { margin: 0 0 8px; font: 14.5px/1.7 var(--font-read); white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.mp__it { display: flex; align-items: center; gap: 10px; }
.mp__note + .mp__it { padding-top: 10px; border-top: 1px dashed #bbb; }
.mp__it img { flex: none; width: 46px; height: 46px; padding: 5px; box-sizing: border-box; background: #f4f4f4; border: 1px solid #000; image-rendering: pixelated; }
.mp__it img.own { image-rendering: auto; object-fit: contain; }
.mp__line { margin: 0; color: #333; font-size: 12.5px; font-weight: 700; word-break: keep-all; }
.mp__line small { display: block; margin-top: 2px; color: var(--muted); font-weight: 500; font-size: 11px; }
.mp__acts { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.mp__acts .btn { min-width: 64px; }
.mp__no { background: #fff; color: #111; }
.mlog__r.is-open { cursor: pointer; }
.mlog__r.is-open:hover { background: #f0f0f0; }
@media (max-width: 720px) {
  .mst { flex-direction: column; align-items: center; gap: 14px; padding: 14px 14px 52px; }
  .mp__bub { flex: none; width: 100%; margin: 0; }
  .mp__bub::before { right: auto; top: auto; margin-top: 0; left: 50%; bottom: -14px; margin-left: -8px; border: 8px solid transparent; border-top: 14px solid #000; border-bottom: 0; }
  .mp__bub::after { right: auto; top: auto; margin-top: 0; left: 50%; bottom: -11px; margin-left: -7px; border: 7px solid transparent; border-top: 12px solid #fff; border-bottom: 0; }
  .mst__fig .clk { width: 170px; height: 170px; }
}

/* EDIT 창: 받은 물건 */
.cc__gifts { grid-column: 1 / -1; margin-top: 14px; padding-top: 12px; border-top: 1px solid #000; }
.cc__gifts h4 { margin: 0 0 8px; font-size: 12.5px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.cc__gifts h4 img { width: 18px; image-rendering: pixelated; }
.cc__shelf { display: flex; flex-wrap: wrap; gap: 8px; }
.cc__g { position: relative; width: 46px; height: 46px; display: grid; place-items: center; background: #fff; border: 1px solid #000; box-shadow: 2px 2px 0 #000; }
.cc__g img { width: 30px; height: 30px; image-rendering: pixelated; }
.cc__g img.own { width: 38px; height: 38px; image-rendering: auto; object-fit: contain; }
.cc__g i { position: absolute; right: -6px; bottom: -6px; min-width: 16px; height: 16px; padding: 0 3px; background: #111; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; font-style: normal; text-align: center; border: 1px solid #fff; }

@media (max-width: 720px) {
  .mb__grid { grid-template-columns: repeat(4, 1fr); }
  .mlog__r { grid-template-columns: 1fr auto; } .mlog__r time { grid-column: 1 / -1; }
}

/* 바탕 화면의 우체통 (소품) */
.mbox { position: absolute; left: 22px; bottom: calc(var(--tb) + 12px); z-index: 1; width: 60px; height: 60px; padding: 0; border: 0; background: none; cursor: pointer; }
.mbox[hidden] { display: none; }
.mbox img { width: 100%; height: 100%; image-rendering: pixelated; transition: transform .15s;  }
.mbox:hover img { filter: brightness(1.1); }
.mbox.has-new::after { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #e0261b; box-shadow: 0 0 0 2px #000; }
body.is-sticker-edit .mbox { pointer-events: none; opacity: .5; }
@media (max-width: 720px) { .mbox { width: 52px; height: 52px; left: 14px; } }
/* 좁은 화면에서 옆으로 넘치지 않게 */
.mb__body { grid-template-columns: minmax(0, 1fr); }
.mb__body > * { min-width: 0; }
.mc__f { min-width: 0; }
.mc__f .field { width: 100%; box-sizing: border-box; }
@media (max-width: 720px) { .mc { grid-template-columns: 84px minmax(0, 1fr); } }
