/* 먼작귀 마을. 크림 종이에 갈색 선, 스티커 같은 둥근 버튼. 반투명 헤더 금지 */
:root {
  --cream: #FFF8EC; --paper: #FFFDF7; --grass: #BFE3A6; --grass-d: #8FC777; --sky: #CFE8F7; --pink: #F6C6D0; --pink-d: #EC9FB0;
  --line: #6B4F3A; --ink: #4A3628; --soft: #75604F; --hair: #E8DAC4; --yellow: #FBE7A1; --red: #E5786D;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --dock-h: 54px; --chat-h: 44px; --acts-r: 10px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--cream); -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; user-select: none; -webkit-user-select: none; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
input { user-select: text; -webkit-user-select: text; }
[hidden] { display: none !important; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#stage { position: absolute; inset: 0; background: var(--sky); }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: 0; }
#ui { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#ui > * { pointer-events: auto; }

/* 버튼 */
.btn {
  min-height: 48px; padding: 0 20px; border-radius: 16px; background: var(--paper); border: 2.5px solid var(--line);
  box-shadow: 0 3px 0 var(--line); font-weight: 800; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.go { background: var(--pink); }
.btn.green { background: var(--grass); }
.btn.wide { width: 100%; }
.link { min-height: 44px; padding: 0 12px; font-weight: 700; font-size: 14px; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; }

/* 첫 화면 */
#title { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--cream); z-index: 30; display: flex; flex-direction: column; }
.t-hero { flex: 1 0 auto; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: calc(24px + var(--sat)) 24px calc(24px + var(--sab)); background: linear-gradient(var(--sky) 0 56%, var(--grass) 56% 100%); position: relative; overflow: hidden; }
.t-hero::before { content: ""; position: absolute; left: -20%; right: -20%; top: 50%; height: 16%; border-radius: 50%; background: var(--grass); border-top: 3px solid var(--grass-d); }
.t-card { position: relative; width: min(340px, 100%); background: var(--cream); border: 3px solid var(--line); border-radius: 28px; padding: 22px 20px 18px; text-align: center; box-shadow: 0 5px 0 var(--line); }
.t-card h1 { margin: 0; font-size: 36px; font-weight: 900; letter-spacing: -1px; }
.t-card p { margin: 4px 0 16px; color: var(--soft); font-weight: 700; font-size: 14px; }
.t-card .btn { margin-top: 8px; }
.t-trio { position: relative; display: flex; align-items: flex-end; justify-content: center; margin-bottom: -22px; z-index: 1; }
.t-trio img { width: 104px; height: 104px; object-fit: contain; margin: 0 -10px; filter: drop-shadow(0 3px 0 #6B4F3A55); }
.t-trio img:nth-child(2) { width: 124px; height: 124px; }
.t-note { position: relative; margin: 6px 0 0; font-size: 12px; color: var(--ink); font-weight: 600; text-align: center; }
.t-pick { min-height: 100%; display: flex; flex-direction: column; padding: var(--sat) var(--sar) 0 var(--sal); }
.t-head { padding: 14px 16px 8px; display: flex; align-items: center; gap: 8px; }
.t-head h2 { margin: 0; font-size: 20px; font-weight: 900; flex: 1; }
.t-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 4px 12px 12px; align-content: start; }
.t-c { background: var(--paper); border: 2.5px solid var(--hair); border-radius: 16px; padding: 4px 2px 6px; text-align: center; min-height: 44px; display: flex; flex-direction: column; align-items: center; transition: transform .1s; }
.t-c img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.t-c b { font-size: 12px; font-weight: 800; line-height: 1.2; word-break: keep-all; }
.t-c small { font-size: 12px; color: var(--soft); font-weight: 600; line-height: 1.2; word-break: keep-all; margin-top: 1px; }
.t-c[aria-pressed="true"] { border-color: var(--line); background: var(--pink); box-shadow: 0 3px 0 var(--line); transform: translateY(-2px); }
.t-c[aria-pressed="true"] small { color: var(--ink); }
.t-foot { position: sticky; bottom: 0; background: var(--cream); border-top: 2px solid var(--hair); padding: 10px 12px calc(10px + var(--sab)); display: flex; gap: 8px; }
.t-foot input { flex: 1; min-width: 0; height: 48px; border-radius: 14px; border: 2.5px solid var(--line); background: var(--paper); padding: 0 14px; font-size: 16px; font-weight: 700; outline: 0; }
.t-err { color: #B4483D; font-size: 14px; font-weight: 700; margin: 8px 0 0; }
.t-pick > .t-err { padding: 0 16px 6px; text-align: center; }
.t-warn { margin-top: 8px; }
.t-warn p { margin: 0 0 4px; color: #B4483D; font-size: 13.5px; line-height: 1.45; word-break: keep-all; }
.tab-off { display: flex; align-items: center; justify-content: center; padding: 24px; }
.t-load { position: absolute; inset: 0; z-index: 35; background: var(--cream); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; }
@media (min-width: 760px) {
  .t-pick { width: 880px; max-width: 100%; margin: 0 auto; }
  .t-grid { grid-template-columns: repeat(8, 1fr); padding: 8px 16px 16px; }
  .t-foot { border: 0; background: none; position: static; padding: 8px 16px 24px; }
}

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.h-me { position: absolute; left: calc(8px + var(--sal)); top: calc(8px + var(--sat)); width: 176px; background: var(--cream); border: 2.5px solid var(--line); border-radius: 18px; padding: 6px 8px 6px 6px; display: grid; grid-template-columns: 44px 1fr; gap: 2px 7px; box-shadow: 0 2px 0 var(--line); }
.h-face { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 50%; background-color: var(--sky); background-repeat: no-repeat; border: 2px solid var(--line); }
.h-name { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; line-height: 1.2; }
.h-money { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; align-self: center; line-height: 1.2; }
.h-bars { grid-column: 1 / 3; display: grid; gap: 3px; margin-top: 3px; }
.h-bar { display: grid; grid-template-columns: 18px 1fr 24px; gap: 4px; align-items: center; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.h-bar .i { width: 18px; height: 18px; stroke-width: 2; }
.h-bar i { display: block; height: 9px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--paper); overflow: hidden; }
.h-bar u { display: block; height: 100%; background: var(--grass); transition: width .3s; }
.h-bar.calm u { background: var(--sky); }
.h-bar.low u { background: var(--red); }
.h-right { position: absolute; right: calc(8px + var(--sar)); top: calc(8px + var(--sat)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.h-right > * { pointer-events: auto; }
.h-chip { min-height: 30px; padding: 4px 10px; display: flex; align-items: center; background: var(--cream); border: 2.5px solid var(--line); border-radius: 12px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.h-map { width: 84px; height: 84px; border-radius: 50%; border: 2.5px solid var(--line); overflow: hidden; background: var(--grass); box-shadow: 0 2px 0 var(--line); }
.h-map canvas { display: block; width: 100%; height: 100%; }
.h-dmping { background: var(--pink); min-height: 44px; }

#log { position: absolute; left: calc(8px + var(--sal)); top: calc(112px + var(--sat)); width: min(250px, calc(100% - 112px)); background: var(--cream); border: 2px solid var(--hair); border-radius: 12px; padding: 4px 8px; font-size: 12.5px; line-height: 1.4; font-weight: 600; max-height: 64px; overflow: hidden; cursor: pointer; }
#log.open { max-height: 36dvh; overflow-y: auto; border-color: var(--line); }
#log p { margin: 0; word-break: break-word; }
#log b { font-weight: 800; }
/* 좁은 화면: 오른쪽 칩이 떠 있으면 로그가 그 왼쪽까지만 */
@media (max-width: 759px) { #hud:has(#jobQuest:not([hidden]), .h-dmping:not([hidden])) #log { width: max(150px, calc(100vw - 196px)); } }
/* 아주 좁은 화면(폴드 접힘): 의뢰 칩이 로그를 덮지 않게 좁힌다 */
@media (max-width: 359px) { #jobQuest { max-width: calc(100vw - 176px - var(--sal) - var(--sar)); } }
#log .sys { color: var(--soft); }
#log:not(.open) p:not(:nth-last-child(-n+2)) { display: none; }

#acts { position: absolute; right: calc(var(--acts-r) + var(--sar)); bottom: calc(var(--dock-h) + var(--chat-h) + 18px + var(--sab)); display: flex; align-items: flex-end; gap: 8px; }
#action { width: 84px; height: 84px; border-radius: 50%; background: var(--pink); border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); font-weight: 900; font-size: 14px; line-height: 1.15; padding: 6px; word-break: keep-all; transition: transform .08s, box-shadow .08s; }
#action:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
#action.near { background: var(--yellow); }
.h-round { width: 46px; height: 46px; border-radius: 50%; background: var(--cream); border: 2.5px solid var(--line); box-shadow: 0 2px 0 var(--line); display: flex; align-items: center; justify-content: center; }
.h-round[aria-expanded="true"] { background: var(--pink); }
#emos { position: absolute; right: calc(var(--acts-r) + var(--sar)); bottom: calc(var(--dock-h) + var(--chat-h) + 112px + var(--sab)); background: var(--cream); border: 2.5px solid var(--line); border-radius: 18px; padding: 4px; display: flex; flex-direction: column; box-shadow: 0 2px 0 var(--line); }
#emos button { min-height: 44px; min-width: 76px; padding: 0 10px; border-radius: 12px; font-size: 14px; font-weight: 800; }
#emos button:active { background: var(--pink); }

#chatbar { position: absolute; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(var(--dock-h) + 10px + var(--sab)); display: flex; gap: 6px; height: var(--chat-h); pointer-events: none; }
#chatbar > * { pointer-events: auto; }
#chatbar input { flex: 1; min-width: 0; height: 100%; border-radius: 14px; border: 2.5px solid var(--line); background: var(--paper); padding: 0 12px; font-size: 16px; font-weight: 600; outline: 0; }
#chatbar input::placeholder { color: var(--soft); font-weight: 600; }
#chatbar button { width: 56px; border-radius: 14px; border: 2.5px solid var(--line); background: var(--grass); font-weight: 800; font-size: 14px; }

#dock { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--dock-h) + var(--sab)); padding: 0 var(--sar) var(--sab) var(--sal); background: var(--cream); border-top: 2.5px solid var(--line); display: flex; }
#dock button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12px; font-weight: 800; min-height: 44px; }
#dock button:active { background: var(--pink); }

#joy { position: absolute; width: 104px; height: 104px; margin: -52px 0 0 -52px; border-radius: 50%; background: #FFF8EC66; border: 2.5px solid var(--line); pointer-events: none !important; }
#joy i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: var(--pink); border: 2.5px solid var(--line); }

@media (min-width: 760px) {
  /* 가운데 독·채팅바는 오른쪽 행동 버튼(약 140px)과 닿지 않는 폭까지만 */
  :root { --acts-r: 20px; --lift: 30px; --bar-w: min(460px, 100vw - 340px - var(--sal) - var(--sar)); }
  #chatbar { left: 50%; right: auto; width: var(--bar-w); margin-left: calc(var(--bar-w) / -2); }
  #dock { left: 50%; right: auto; width: var(--bar-w); margin-left: calc(var(--bar-w) / -2); bottom: calc(8px + var(--sab)); height: var(--dock-h); padding: 0; border: 2.5px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 2px 0 var(--line); }
  #chatbar { bottom: calc(var(--dock-h) + 18px + var(--sab)); }
  #acts { bottom: calc(20px + var(--sab)); }
  #emos { bottom: calc(114px + var(--sab)); }
  #log { width: 300px; }
}
/* 낮은 세로 폰(SE1): 감정 메뉴를 행동 버튼 왼쪽에 세워 미니맵과 닿지 않게 한다 */
@media (max-width: 759px) and (min-height: 561px) and (max-height: 600px) {
  #emos { right: calc(var(--acts-r) + 146px + var(--sar)); bottom: calc(var(--dock-h) + var(--chat-h) + 18px + var(--sab)); }
}
/* 가로 폰: 위아래가 좁다. 감정 메뉴는 행동 버튼 왼쪽에 가로로 펼친다 */
@media (max-height: 560px) {
  #acts { bottom: calc(var(--dock-h) + var(--chat-h) + 12px + var(--lift, 0px) + var(--sab)); }
  #emos { flex-direction: row; white-space: nowrap; right: calc(var(--acts-r) + 130px + var(--sar)); bottom: calc(var(--dock-h) + var(--chat-h) + 12px + var(--lift, 0px) + var(--sab)); max-width: calc(100vw - 150px - var(--acts-r) - var(--sal) - var(--sar)); }
  #emos button { min-width: 56px; padding: 0 8px; }
  #action { width: 68px; height: 68px; font-size: 12.5px; }
  .h-map { width: 64px; height: 64px; }
  #log { max-height: 26px; }
}

/* 토스트 */
#toasts { position: absolute; left: 0; right: 0; top: 22%; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none !important; z-index: 70; padding: 0 16px; }
.toast { background: var(--line); color: var(--cream); font-weight: 800; font-size: 14px; padding: 8px 14px; border-radius: 14px; max-width: 100%; text-align: center; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.85) translateY(6px); opacity: 0; } }
/* 가로 폰: 토스트는 HUD 카드 아래. 기본 규칙보다 뒤에 둬야 이긴다 */
@media (max-height: 560px) { #toasts { top: calc(118px + var(--sat)); } }
#toasts.t-top { top: calc(8px + var(--sat)); }

/* 시트: 모바일은 아래에서, PC 는 가운데 */
.scrim { position: absolute; inset: 0; background: #4A362866; z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-height: 82dvh; background: var(--cream); border: 3px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; animation: up .2s cubic-bezier(.2, .9, .3, 1.05); touch-action: pan-y; }
@keyframes up { from { transform: translateY(40%); } }
.s-grip { padding: 8px 0 2px; flex: none; touch-action: none; cursor: grab; }
.s-grip::before { content: ""; display: block; width: 44px; height: 5px; margin: 0 auto; border-radius: 3px; background: var(--hair); }
.s-head { display: flex; align-items: center; padding: 2px 8px 6px 18px; flex: none; touch-action: none; }
.s-head h3 { margin: 0; flex: 1; font-size: 18px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-x { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.s-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(16px + var(--sab)); }
@media (min-width: 760px) {
  .scrim { align-items: center; }
  .sheet { width: 480px; max-height: 80dvh; border-bottom: 3px solid var(--line); border-radius: 24px; box-shadow: 0 5px 0 var(--line); animation: pop .16s; }
  .s-grip { display: none; }
  .s-head { padding-top: 10px; }
}
/* 가로 폰(폭 760 미만): 시트가 화면 폭을 다 쓰니 좌우 노치 자리를 비운다 */
@media (max-width: 759px) and (max-height: 560px) {
  .s-head { padding-left: calc(18px + var(--sal)); padding-right: calc(8px + var(--sar)); }
  .s-body { padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); }
}
.s-list { display: grid; gap: 8px; }
.s-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; font-weight: 700; font-size: 15px; }
.toggle { width: 58px; height: 34px; border-radius: 17px; background: var(--hair); border: 2.5px solid var(--line); position: relative; flex: none; transition: background .12s; }
.toggle::before { content: ""; position: absolute; inset: -7px -2px; }   /* 누르는 칸은 44px */
.toggle::after { content: ""; position: absolute; left: 2px; top: 2px; width: 25px; height: 25px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line); transition: transform .12s; }
.toggle[aria-checked="true"] { background: var(--grass); }
.toggle[aria-checked="true"]::after { transform: translateX(23px); }
.note { font-size: 13px; line-height: 1.55; color: var(--soft); font-weight: 600; margin: 10px 0 0; word-break: keep-all; }
.bigmap { width: 100%; aspect-ratio: 4 / 3; display: block; border-radius: 14px; border: 2.5px solid var(--line); margin-bottom: 10px; touch-action: none; }
.s-inrow { display: flex; gap: 8px; flex: 1; min-width: 0; justify-content: flex-end; }
.s-in { flex: 1; min-width: 0; max-width: 220px; height: 44px; border-radius: 12px; border: 2.5px solid var(--line); background: var(--paper); padding: 0 12px; font-size: 16px; font-weight: 700; outline: 0; }
.s-sub { margin: 18px 0 6px; font-size: 15px; font-weight: 800; }
.s-body > .btn.wide { margin-top: 8px; }
.s-code { display: block; width: 100%; box-sizing: border-box; margin-top: 8px; min-height: 64px; border-radius: 12px; border: 2.5px solid var(--line); background: var(--paper); padding: 8px 12px; font: 600 16px/1.4 ui-monospace, monospace; resize: vertical; user-select: text; -webkit-user-select: text; word-break: break-all; }
.s-chars { padding: 10px 0 0; grid-template-columns: repeat(4, 1fr); }
.t-imp { margin-top: 4px; }
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.places .btn { font-size: 14px; padding: 0 8px; min-height: 44px; }

/* 1:1 */
.dm { display: flex; flex-direction: column; gap: 8px; height: min(46dvh, 380px); }
.dm-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.dm-log p { margin: 0; max-width: 82%; padding: 6px 10px; border-radius: 12px; background: var(--paper); border: 2px solid var(--hair); font-size: 14px; font-weight: 600; align-self: flex-start; word-break: break-word; }
.dm-log p.me { align-self: flex-end; background: var(--pink); border-color: var(--pink-d); }
.dm-log p.sys { align-self: center; background: none; border: 0; color: var(--soft); font-size: 12.5px; text-align: center; }
.dm form { display: flex; gap: 6px; flex: none; }
.dm input { flex: 1; min-width: 0; height: 44px; border-radius: 14px; border: 2.5px solid var(--line); background: var(--paper); padding: 0 12px; font-size: 16px; outline: 0; }

/* 수락 팝업 */
#ask { position: absolute; left: 50%; top: calc(10px + var(--sat)); width: min(340px, calc(100% - 24px)); transform: translateX(-50%); background: var(--cream); border: 3px solid var(--line); border-radius: 20px; padding: 12px 14px; box-shadow: 0 4px 0 var(--line); z-index: 60; animation: askpop .18s; }
/* pop 은 transform 을 덮어써 가운데 맞춤이 풀린다. 확인창은 translateX 를 같이 넣은 전용 키프레임 */
@keyframes askpop { from { transform: translateX(-50%) scale(.85) translateY(6px); opacity: 0; } }
/* 시트 위에서 묻을 때는 시트 머리(제목·닫기·탭)를 가리지 않게 아래쪽에 띄운다 */
#ui:has(.scrim) #ask { top: auto; bottom: calc(12px + var(--sab)); }
#ask b { display: block; font-size: 15px; font-weight: 900; }
#ask p { margin: 4px 0 10px; font-size: 14px; font-weight: 600; color: var(--ink); word-break: break-word; }
#ask p:empty { display: none; }
#ask div { display: flex; gap: 8px; }
#ask div .btn { flex: 1; min-height: 44px; }

/* 미니게임 등 전체 화면 오버레이 */
.overlay { position: absolute; inset: 0; z-index: 50; background: var(--cream); }

/* wardrobe */
.s-body.w-body { padding-bottom: 0; display: flex; flex-direction: column; overflow: hidden; }   /* 미리보기는 고정, 그리드만 스크롤 */
.w-top { flex: none; display: flex; gap: 12px; padding-bottom: 6px; }
.w-stage { flex: 1 1 140px; min-width: 124px; background: var(--sky); border: 2.5px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.w-doll { flex: 1; padding-top: 4px; }
.w-cv { display: block; width: 100%; aspect-ratio: 10 / 9; touch-action: none; cursor: grab; }
.w-cv:active { cursor: grabbing; }
.w-turns { display: flex; justify-content: space-between; }
.w-turn { flex: none; width: 44px; height: 44px; font-size: 32px; line-height: 1; font-weight: 900; color: var(--line); }
.w-side { flex: 0 0 176px; display: grid; gap: 6px; align-content: start; }
.w-tones { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.w-tone { min-height: 44px; border-radius: 12px; border: 2.5px solid var(--hair); background: var(--paper); font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 5px; }
.w-tone.on { border-color: var(--line); background: var(--yellow); }
.w-tone i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); }
.w-chips { display: grid; grid-template-columns: repeat(4, 44px); }
.w-chip { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.w-chip::before { content: ""; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 2.5px solid var(--hair); }
.w-chip.on::before { border-color: var(--line); box-shadow: 0 0 0 2px var(--line); }
.w-chip:disabled, .w-tone:disabled { opacity: .35; cursor: default; }
.w-tip { margin: 0; font-size: 12px; line-height: 1.35; color: var(--soft); font-weight: 700; word-break: keep-all; }
.w-tabs { flex: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; padding: 4px 0 6px; }
.w-tab { min-height: 44px; min-width: 0; padding: 0; border-radius: 12px; border: 2.5px solid var(--line); background: var(--paper); font-weight: 800; font-size: 14px; word-break: keep-all; }
.w-tab.on { background: var(--pink); box-shadow: 0 2px 0 var(--line); }
.w-grid { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: repeat(3, 1fr); align-content: start; gap: 8px; padding-bottom: calc(14px + var(--sab)); }
.w-item { min-height: 112px; padding: 4px 4px 6px; border-radius: 14px; border: 2.5px solid var(--hair); background: var(--paper); display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.w-item.on { border-color: var(--line); background: var(--yellow); }
.w-item.none { justify-content: flex-start; }
.w-item.no { opacity: .55; border-style: dashed; }
.w-item.no small { color: var(--line); }
.w-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 2px; font-size: 13px; font-weight: 800; color: var(--soft); }
.w-zoom { min-width: 56px; height: 44px; font-size: 14px; font-weight: 800; color: var(--line); }
/* 미리보기 크게: 색 고르기 칸을 접고 미리보기를 가로 가득 */
.w-big .w-side { display: none; }
.w-big .w-stage { flex-basis: 100%; }
.w-big .w-cv { max-height: 46dvh; object-fit: contain; }
.w-th { width: 72px; height: 65px; }
.w-item b { font-size: 12.5px; font-weight: 800; line-height: 1.2; word-break: keep-all; }
.w-item small { font-size: 12px; font-weight: 700; color: var(--soft); }
.w-empty { grid-column: 1 / -1; margin: 0 0 4px; }
.w-foot { flex: none; display: flex; align-items: center; gap: 8px; min-height: 64px; margin: 0 -16px; padding: 8px 16px calc(8px + var(--sab)); border-top: 2px solid var(--hair); }
.w-foot .btn { flex: none; min-height: 44px; padding: 0 14px; font-size: 15px; }
.w-money, .w-ask { flex: 1; min-width: 0; font-size: 14px; font-weight: 800; word-break: keep-all; }
.w-hint { font-size: 13px; font-weight: 700; color: var(--soft); }
@media (min-width: 760px) { .w-grid { grid-template-columns: repeat(4, 1fr); } }
/* 작은 화면(가로 폰, 폴드 접힘): 미리보기를 줄이고 시트 전체가 스크롤된다. 사기·입기 줄은 늘 아래에 붙어 있다 */
/* 가로 폰: 시트를 키우고 왼쪽은 미리보기·색, 오른쪽은 탭·옷 목록. 각자 스크롤되고 사기·입기 줄은 아래에 붙는다 */
@media (max-height: 560px) {
  .sheet { max-height: calc(100dvh - 8px - var(--sat)); }
  .sheet:has(.w-body) { width: min(100%, 820px); }
  .s-body.w-body { display: grid; grid-template-columns: minmax(150px, 38%) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; column-gap: 12px; padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); }
  .w-top { grid-column: 1; grid-row: 1 / 3; flex-direction: column; overflow-y: auto; min-height: 0; padding-bottom: 10px; }
  .w-stage { flex: none; min-width: 0; }
  .w-cv { max-height: max(110px, 100dvh - 230px); object-fit: contain; }
  .w-side { flex: none; }
  .w-chips { grid-template-columns: repeat(auto-fill, 44px); }
  .w-tabs { grid-column: 2; grid-row: 1; }
  .w-grid { grid-column: 2; grid-row: 2; }
  .w-foot { grid-column: 1 / -1; grid-row: 3; margin: 0 calc(-16px - var(--sar)) 0 calc(-16px - var(--sal)); padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); }
  .w-big .w-cv { max-height: max(110px, 100dvh - 190px); }
}
/* 폴드 접힘 등 아주 좁은 세로 화면: 색 칸을 미리보기 아래로 내리고 시트 전체가 스크롤된다 */
@media (max-width: 359px) {
  .s-body.w-body { overflow-y: auto; scroll-padding-bottom: 76px; }
  .w-grid { flex: none; overflow: visible; }
  .w-foot { position: sticky; bottom: 0; z-index: 1; background: var(--cream); }
  .w-cv { max-height: 30dvh; object-fit: contain; }
  .w-top { flex-wrap: wrap; gap: 8px; }
  .w-stage { flex: 1 1 100%; }
  .w-side { flex: 1 1 100%; }
  .w-chips { grid-template-columns: repeat(auto-fill, 44px); }
  .w-tabs { grid-template-columns: repeat(3, 1fr); }
}

/* 가로 첫 화면: 캐릭터를 줄이고, 그래도 넘치면 스크롤 */
@media (max-height: 420px) {
  .t-hero { gap: 6px; padding-top: calc(12px + var(--sat)); padding-bottom: calc(12px + var(--sab)); }
  .t-trio img { width: 72px; height: 72px; }
  .t-trio img:nth-child(2) { width: 88px; height: 88px; }
  .t-card { padding: 16px 18px 14px; }
}
/* 넓은 가로 폰: 이름 칸과 들어가기 버튼은 늘 아래에 붙어 있다 */
@media (min-width: 760px) and (max-height: 560px) {
  .t-foot { position: sticky; background: var(--cream); border-top: 2px solid var(--hair); padding: 10px 12px calc(10px + var(--sab)); }
}
@media (max-width: 340px) { .t-grid { grid-template-columns: repeat(3, 1fr); } }
/* 키보드가 올라와 아주 낮아지면 채팅바만 남긴다 */
@media (max-height: 240px) {
  .h-me, .h-right, #acts, #emos, #log { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* 5차: 독 5버튼이 360px·가로폰에서 줄지 않게, 수첩 탭 */
#dock button { min-width: 0; white-space: nowrap; }
.book-tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 2px solid var(--hair); scrollbar-width: none; }
.book-tabs::-webkit-scrollbar { display: none; }
.book-tab { flex: 1 0 auto; min-height: 44px; padding: 0 14px; border-radius: 14px; border: 2.5px solid var(--line); background: var(--paper); font-weight: 800; font-size: 14px; }
@media (max-width: 400px) { .book-tab { padding: 0 9px; font-size: 13px; } }
.book-tab[aria-selected="true"] { background: var(--yellow); box-shadow: 0 2px 0 var(--line); }
.stk-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 2px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--cream); font-size: 12px; font-weight: 800; }

/* 5차: 친밀도(bond.js) */
.bd-card { background: var(--paper); border: 2.5px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }
.bd-sub { font-size: 12.5px; font-weight: 700; color: var(--soft); }
.bd-cells { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0 4px; }
.bd-cell { aspect-ratio: 1; max-height: 52px; border-radius: 50%; border: 2px dashed var(--hair); display: flex; align-items: center; justify-content: center; color: var(--hair); font-weight: 800; justify-self: center; width: 100%; max-width: 52px; }
.bd-cell.on { border: 2.5px solid var(--red); background: var(--pink); color: var(--red); }
.bd-cell.on .i { fill: currentColor; stroke: none; width: 24px; height: 24px; }
.bd-cell.new { animation: bd-stamp .45s cubic-bezier(.3, 1.6, .5, 1) var(--d, 0ms) both; }
@keyframes bd-stamp { 0% { transform: scale(2.2) rotate(-25deg); opacity: 0; } 60% { transform: scale(.9) rotate(4deg); opacity: 1; } 100% { transform: none; opacity: 1; } }
.bd-list { display: flex; flex-direction: column; gap: 8px; }
.bd-npc { display: flex; gap: 10px; align-items: center; background: var(--paper); border: 2px solid var(--hair); border-radius: 14px; padding: 8px 10px; min-width: 0; }
.bd-face { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 2.5px solid var(--line); background-color: var(--cream); background-repeat: no-repeat; background-position: center; }
.bd-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.bd-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bd-hearts { display: inline-flex; gap: 1px; color: var(--hair); }
.bd-hearts i { display: inline-flex; }
.bd-hearts .i { width: 16px; height: 16px; stroke-width: 2; }
.bd-hearts .on { color: var(--red); }
.bd-hearts .on .i { fill: var(--pink-d); }
.bd-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.bd-chip { font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; border: 2px solid var(--line); background: var(--yellow); }
.bd-chip.done { border-color: var(--hair); background: var(--cream); color: var(--soft); text-decoration: line-through; }
.bd-pop { position: fixed; z-index: 60; pointer-events: none; color: var(--red); transform: translate(-50%, -50%); animation: bd-pop 1.1s ease-out var(--dl, 0ms) both; }
.bd-pop .i { fill: var(--pink-d); width: 26px; height: 26px; }
@keyframes bd-pop { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 90px)) scale(1.1); opacity: 0; } }
.bd-rank { position: fixed; z-index: 70; left: 50%; top: 38%; transform: translate(-50%, -50%); pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 20px; max-width: calc(100% - 32px); text-align: center; background: var(--paper); border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 4px 0 var(--line); animation: bd-rank 2.4s ease both; }
.bd-rank b { font-size: 17px; }
.bd-rank span:not(.bd-hearts) { font-size: 13px; font-weight: 700; color: var(--soft); }
.bd-rank .bd-hearts .i { width: 22px; height: 22px; }
@keyframes bd-rank { 0% { transform: translate(-50%, -50%) scale(.6); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; } 20%, 85% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { opacity: 0; } }

/* 슬라이드 퍼즐 (puzzle.js) */
.pz-ov { display: flex; flex-direction: column; background: var(--grass); touch-action: none; user-select: none; -webkit-user-select: none; }
.pz-top { flex: none; display: flex; align-items: center; gap: 10px; padding: calc(6px + var(--sat)) calc(8px + var(--sar)) 6px calc(12px + var(--sal)); background: var(--cream); border-bottom: 3px solid var(--line); }
.pz-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-stat { flex: none; font-size: 12.5px; font-weight: 700; color: var(--soft); white-space: nowrap; }
.pz-stat b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.pz-x { flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.pz-field { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px calc(12px + var(--sar)) 12px calc(12px + var(--sal)); container-type: size; }
.pz-board { position: relative; width: min(92vw, 560px); width: min(100cqw, 100cqh, 560px); aspect-ratio: 1; background: var(--line); border: 4px solid var(--line); border-radius: 16px; box-shadow: 0 5px 0 #4A3628; overflow: hidden; }
.pz-tile { position: absolute; width: calc(100% / var(--n)); height: calc(100% / var(--n)); background-size: calc(var(--n) * 100%) calc(var(--n) * 100%); border-radius: 8px; box-shadow: inset 0 0 0 2px var(--line); cursor: pointer; touch-action: none; }
.pz-live .pz-tile { transition: left .11s ease-out, top .11s ease-out; }
.pz-peek { position: absolute; inset: 0; background-size: 100% 100%; z-index: 2; pointer-events: none; }
.pz-solved .pz-tile { box-shadow: none; border-radius: 0; }
.pz-solved::after { content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.pz-shine::after { background: linear-gradient(115deg, transparent 35%, #FFFFFFB0 50%, transparent 65%) no-repeat; background-size: 250% 100%; animation: pz-shine .9s ease-out both; }
@keyframes pz-shine { from { background-position: 130% 0; } to { background-position: -30% 0; } }
.pz-bot { flex: none; display: flex; justify-content: center; padding: 0 16px calc(12px + var(--sab)); }
.pz-peekbtn { min-width: 160px; -webkit-touch-callout: none; }
.pz-pick { justify-content: space-between; gap: 10px; }
.pz-pick b { font-size: 17px; }
.pz-pick span { font-weight: 800; }
.pz-pick small { font-size: 12.5px; font-weight: 700; color: var(--soft); min-width: 64px; text-align: right; }
.pz-res { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 16px; background: #4A362866; animation: fade .15s; }
.pz-card { width: min(340px, 100%); max-height: 100%; overflow-y: auto; background: var(--cream); border: 3px solid var(--line); border-radius: 26px; box-shadow: 0 5px 0 var(--line); padding: 14px 18px 18px; text-align: center; animation: pop .22s cubic-bezier(.3,1.6,.6,1); }
.pz-card h3 { margin: 0 0 6px; font-size: 20px; font-weight: 900; }
.pz-big { font-size: 32px; font-weight: 900; margin: 0 0 6px; }
.pz-stk { display: flex; justify-content: center; margin: 0 0 6px; }
.pz-stat-row { display: flex; justify-content: space-between; padding: 6px 2px; border-top: 2px solid var(--hair); font-weight: 700; font-size: 14px; }
.pz-card .btn { margin-top: 8px; }

/* 5차 친구·좋아요·방명록 (social.js) */
.sc-bar { position: absolute; left: calc(8px + var(--sal)); bottom: calc(var(--dock-h) + var(--chat-h) + 18px + var(--sab)); display: flex; gap: 6px; max-width: calc(100vw - 180px - var(--sal) - var(--sar)); }
.sc-bar .btn { min-height: 44px; padding: 0 10px; font-size: 13.5px; white-space: nowrap; }
.sc-bar .btn .i { width: 18px; height: 18px; }
.sc-face { flex: none; display: inline-block; border-radius: 50%; border: 2px solid var(--line); background-color: var(--sky); background-repeat: no-repeat; background-position: center; }
.sc-bonus { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 8px 12px; border-radius: 14px; background: var(--yellow); border: 2px solid var(--line); font-weight: 800; font-size: 14px; }
.sc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border: 2px solid var(--hair); border-radius: 14px; background: var(--paper); }
.sc-who { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; }
.sc-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--hair); border: 1.5px solid var(--line); }
.sc-dot.on { background: var(--grass-d); }
.sc-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.sc-acts .btn { min-height: 44px; padding: 0 10px; font-size: 13.5px; }
.sc-stamps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 10px 0; }
.sc-stamp { min-height: 44px; border-radius: 14px; border: 2.5px solid var(--line); background: var(--paper); font-weight: 800; font-size: 14px; }
.sc-stamp[aria-pressed="true"] { background: var(--pink); box-shadow: 0 2px 0 var(--line); }
.sc-input { width: 100%; box-sizing: border-box; height: 48px; border-radius: 14px; border: 2.5px solid var(--line); background: var(--paper); padding: 0 12px; font-size: 16px; font-weight: 600; outline: 0; margin-bottom: 10px; }
.sc-likes { display: inline-flex; align-items: center; gap: 6px; }
.sc-g { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border: 2px solid var(--hair); border-radius: 14px; background: var(--paper); }
.sc-gt { min-width: 0; flex: 1; }
.sc-gdel { flex: none; min-height: 44px; padding: 0 12px; font-size: 14px; }
.sc-gt > div { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.sc-gt small { color: var(--soft); font-weight: 600; font-size: 12px; flex: none; }
.sc-gt p { margin: 4px 0 0; font-size: 14px; font-weight: 600; word-break: break-all; }
.sc-chip { display: inline-block; margin-top: 3px; padding: 2px 10px; border-radius: 999px; background: var(--yellow); border: 2px solid var(--line); font-size: 12px; font-weight: 800; }
@media (min-width: 760px) { .sc-bar { bottom: calc(var(--dock-h) + var(--chat-h) + 30px + var(--sab)); max-width: calc(100vw - 200px); } }
@media (max-height: 560px) { .sc-bar { bottom: calc(var(--dock-h) + var(--chat-h) + 12px + var(--lift, 0px) + var(--sab)); max-width: calc(100vw - 170px - var(--sal) - var(--sar)); } }
@media (orientation: landscape) and (max-height: 500px) {
  .pz-ov { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto minmax(0, 1fr); }
  .pz-top { grid-column: 1 / -1; }
  .pz-bot { align-items: center; padding: 0 calc(12px + var(--sar)) var(--sab) 0; }
  .pz-peekbtn { min-width: 0; }
}

/* 5차: 스티커북·교환소(stickers.js) */
.st-art { position: relative; display: inline-block; flex: none; vertical-align: middle; }
.st-art canvas { display: block; width: 100%; height: 100%; }
.st-shine::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 38%, #FFFFFFB0 47%, #FFFFFF00 56%) 0 0 / 300% 100% no-repeat;
  -webkit-mask: var(--m) center / 100% 100% no-repeat; mask: var(--m) center / 100% 100% no-repeat; animation: st-shine 2.6s ease-in-out infinite; }
@keyframes st-shine { 0% { background-position: 100% 0; } 60%, 100% { background-position: 0 0; } }
.st-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.st-stat { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 2px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); font-size: 13px; font-weight: 800; }
.st-stat .i { width: 16px; height: 16px; }
.st-subs { display: flex; gap: 6px; margin-bottom: 10px; }
.st-sub { flex: 1; min-height: 44px; border-radius: 14px; border: 2.5px solid var(--hair); background: var(--paper); font-weight: 800; font-size: 14px; }
.st-sub[aria-pressed="true"] { border-color: var(--line); background: var(--pink); }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.st-cell { position: relative; min-height: 64px; min-width: 44px; padding: 4px; border-radius: 14px; border: 2px solid var(--hair); background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.st-cell:disabled { opacity: .45; }
.st-cell small { font-size: 11px; font-weight: 700; color: var(--soft); line-height: 1.15; word-break: keep-all; text-align: center; }
.st-none { background: var(--cream); }
.st-n { position: absolute; right: 3px; bottom: 2px; font-style: normal; font-size: 11px; font-weight: 900; background: var(--cream); border: 1.5px solid var(--line); border-radius: 8px; padding: 0 4px; line-height: 1.35; }
.st-detail { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.st-detail > .btn:first-child { align-self: flex-start; }
.st-detail h4 { margin: 0; font-size: 18px; }
.st-detail .s-list { width: 100%; }
.st-big { padding: 6px; }
.st-rar { margin: 0; display: inline-flex; align-items: center; gap: 2px; font-weight: 800; color: var(--soft); }
.st-rar .i { width: 16px; height: 16px; fill: var(--yellow); }
.st-page { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.st-page > .btn { align-self: stretch; }
.st-board { position: relative; width: min(100%, 300px, 46dvh); aspect-ratio: 3 / 4; border: 3px solid var(--line); border-radius: 18px; background: var(--paper) radial-gradient(var(--hair) 1.5px, transparent 1.6px) 0 0 / 18px 18px; overflow: hidden; box-shadow: 0 3px 0 var(--line); flex: none; }
.st-pf, .sheet .st-board + .st-head { margin-top: 10px; justify-content: center; }
.sheet:has(.st-pf) .s-body { display: flex; flex-direction: column; align-items: center; }
.st-item { position: absolute; width: 26%; aspect-ratio: 1; }
.st-item .st-art { width: 100% !important; height: 100% !important; }
.st-edit { touch-action: none; overflow: visible; }
.st-edit .st-item { cursor: grab; touch-action: none; }
.st-hold { z-index: 2; filter: drop-shadow(0 6px 4px #6B4F3A55); }
.st-out { opacity: .35; }
.st-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; width: 100%; }
.st-tray .st-cell { min-height: 56px; }
.st-ex { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; padding: 6px 8px; border: 2px solid var(--hair); border-radius: 16px; background: var(--paper); }
.st-ex b { display: block; font-size: 15px; }
.st-ex small { font-size: 12px; color: var(--soft); font-weight: 700; }
.st-ex .btn { min-height: 44px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
.st-ic { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--yellow); display: flex; align-items: center; justify-content: center; }
.st-pop { position: absolute; left: 50%; top: 40%; margin: -95px 0 0 -80px; width: 160px; z-index: 80; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; background: var(--cream); border: 3px solid var(--line); border-radius: 22px; box-shadow: 0 4px 0 var(--line); text-align: center; }
.st-pop b { font-size: 16px; }
.st-pop small { font-size: 12px; font-weight: 800; color: var(--soft); }

/* 6차: 기능 칩(api.hud.addChip). 왼쪽 아래 칩 줄은 채팅줄 위, 오른쪽 행동 버튼과 겹치지 않게 폭 제한 */
#chipsL { position: absolute; left: calc(8px + var(--sal)); bottom: calc(var(--dock-h) + var(--chat-h) + 18px + var(--sab)); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: calc(100% - 200px - var(--sal) - var(--sar)); pointer-events: none; }
#chipsL > * { pointer-events: auto; touch-action: none; }
#chipsL:empty { display: none; }
.h-chip[hidden] { display: none; }
.h-chip.tap { min-height: 44px; cursor: pointer; color: var(--ink); }
.h-chip.tap:active { background: var(--pink); }
.h-chipL { max-width: 100%; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 0 var(--line); }
@media (min-width: 760px) { #chipsL { bottom: calc(20px + var(--sab)); max-width: calc(50% - var(--bar-w) / 2 - 24px - var(--sal)); } }
@media (max-height: 560px) { #chipsL { bottom: calc(var(--dock-h) + var(--chat-h) + 12px + var(--sab)); flex-direction: row; flex-wrap: nowrap; align-items: flex-end; } }
/* 7차: 감정 메뉴가 펼쳐진 동안은 칩 줄을 잠깐 숨긴다(좁은 세로·가로 화면에서 메뉴가 칩 위로 온다) */
#ui:has(#emos:not([hidden])) #chipsL { visibility: hidden; }
/* 7차: 집 꾸미는 동안은 칩 줄이 방(가구 탭 자리) 위에 오지 않게 숨긴다 */
body:has(#hdDeco) #chipsL { display: none !important; }
/* 7차: 아주 낮은 가로 화면은 오른쪽 칸 기능 칩(사진·직장)을 상태 칩 왼쪽으로 빼서 행동 버튼과 안 겹치게 */
@media (max-height: 360px) { .h-right { flex-direction: row-reverse; flex-wrap: wrap; justify-content: flex-start; align-items: flex-start; width: 260px; } .h-right > .h-map { order: -1; } }
@media (max-height: 240px) { #chipsL { display: none !important; } }

/* ─── 6차 자격증·취업(license.js) ─── */
.lc-row b .i { width: 16px; height: 16px; vertical-align: -3px; margin-right: 3px; color: var(--grass-d); }
.lc-mine { background: var(--paper); border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.lc-exam { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.lc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.lc-head span { font-weight: 800; color: var(--soft); flex: none; }
.lc-dots { display: flex; gap: 6px; }
.lc-dots i { flex: 1; height: 8px; border-radius: 4px; background: var(--hair); }
.lc-dots i.now { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--line); }
.lc-dots i.ok { background: var(--grass-d); }
.lc-dots i.bad { background: var(--red); }
.lc-q { margin: 4px 0; font-size: 17px; font-weight: 800; line-height: 1.5; word-break: keep-all; }
.lc-opts { display: flex; flex-direction: column; gap: 8px; }
.lc-opt { min-height: 52px; padding: 10px 14px; border-radius: 16px; border: 2.5px solid var(--line); background: var(--paper); box-shadow: 0 3px 0 var(--line); font: inherit; font-size: 16px; font-weight: 800; color: var(--ink); text-align: left; word-break: keep-all; cursor: pointer; }
.lc-opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.lc-opt:disabled { cursor: default; opacity: .6; }
.lc-opt.ok { background: var(--grass); opacity: 1; }
.lc-opt.bad { background: var(--pink); opacity: 1; }
.lc-fb { min-height: 24px; margin: 0; font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 4px; word-break: keep-all; }
.lc-fb.ok { color: #4E8A36; }
.lc-fb.bad { color: var(--red); }
.lc-fb .i { width: 20px; height: 20px; }
.lc-win, .lc-lose { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 4px 0 8px; }
.lc-win > b, .lc-lose > b { font-size: 18px; }
.lc-line { margin: 0; font-size: 14px; font-weight: 700; }
.lc-btns { display: flex; gap: 8px; width: 100%; }
.lc-btns .btn { flex: 1; }
.lc-pop { animation: lc-pop .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes lc-pop { from { transform: scale(.4) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lc-pop { animation: none; } }
.lc-art { display: block; max-width: 100%; height: auto; }
.lc-cards { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 6px 0 4px; }
.lc-sec { border-top: 2px solid var(--hair); margin-top: 8px; }
.lc-chip { display: inline-flex; align-items: center; gap: 4px; }
.lc-chip .i { width: 16px; height: 16px; }
.h-chip.lc-done { background: var(--grass); }

/* raid: 보스 토벌(6차) */
.rd-ov { display: flex; flex-direction: column; background: var(--grass); touch-action: none; user-select: none; -webkit-user-select: none; }
.rd-top { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--sat)) calc(8px + var(--sar)) 6px calc(10px + var(--sal)); background: var(--cream); border-bottom: 3px solid var(--line); }
.rd-name { font-size: 14px; font-weight: 900; white-space: nowrap; }
.rd-hp { flex: 1; min-width: 60px; height: 20px; position: relative; border: 2.5px solid var(--line); border-radius: 10px; background: var(--paper); overflow: hidden; }
.rd-hp i { position: absolute; inset: 0; background: var(--red); transform-origin: left; transition: transform .15s; }
.rd-hpn { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 900; color: var(--ink); }
.rd-t { min-width: 30px; text-align: right; font-size: 18px; font-weight: 900; }
.rd-t.rd-hurry { color: var(--red); }
.rd-x { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; flex: none; }
.rd-field { flex: 1; min-height: 0; position: relative; padding-bottom: var(--sab); }
.rd-field > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.rd-res { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: #4A362866; animation: fade .15s; }
.rd-card { width: min(340px, 100%); max-height: 100%; overflow-y: auto; background: var(--cream); border: 3px solid var(--line); border-radius: 26px; box-shadow: 0 5px 0 var(--line); padding: 14px 18px 18px; text-align: center; animation: pop .22s cubic-bezier(.3,1.6,.6,1); }
.rd-card h3 { margin: 4px 0 8px; font-size: 20px; font-weight: 900; }
.rd-card .btn { margin-top: 8px; }
.rd-card .rd-thumb { display: block; margin: 0 auto; }
/* 결과 카드가 떠 있는 동안 토스트는 카드 안 맨 위에(가로 폰에서 카드와 겹치지 않게, ui.toast 의 data-toast-slot) */
.rd-toasts { display: flex; flex-direction: column; align-items: center; gap: 4px; grid-column: 1 / -1; margin-bottom: 4px; }
.rd-toasts:empty { display: none; }
.rd-toasts .toast { font-size: 13px; padding: 6px 12px; }
.rd-big { font-size: 34px; font-weight: 900; margin: 0 0 8px; }
.rd-stat { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 2px; border-top: 2px solid var(--hair); font-weight: 700; font-size: 14px; }
.rd-drop { display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px; margin: 6px 0; border: 2.5px solid var(--line); border-radius: 16px; background: var(--yellow); }
.rd-drop > div { flex: 1; min-width: 0; }
.rd-drop .note { margin: 2px 0 0; }
.rd-drop .btn { margin: 0; padding: 0 12px; }
/* 가로 화면: 보스 그림을 빼고 2열, '마을로'는 카드 아래에 붙여 늘 보이게 */
@media (max-height: 500px) {
  .rd-card { width: min(560px, 100%); display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; align-content: start; padding: 10px 14px 0; }
  .rd-card > .rd-thumb { display: none; }
  .rd-card > h3, .rd-card > .rd-big, .rd-card > .note, .rd-card > .rd-drop, .rd-card > #rdDone { grid-column: 1 / -1; }
  .rd-card h3 { margin: 2px 0 2px; font-size: 18px; }
  .rd-big { font-size: 26px; margin: 0 0 4px; }
  .rd-card > #rdDone { position: sticky; bottom: 0; margin: 6px 0 0; box-shadow: 0 10px 0 var(--cream); }
}
.rd-need { display: flex; align-items: center; gap: 8px; font-weight: 800; margin: 4px 0; }
.rd-left { margin: 0 0 8px; }
.rd-h { margin: 12px 0 6px; font-size: 15px; font-weight: 900; }
.rd-boss, .rd-party-box { border: 2.5px solid var(--line); border-radius: 18px; background: var(--paper); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.rd-boss-row { display: flex; align-items: center; gap: 10px; }
.rd-boss-row > div { min-width: 0; }
.rd-boss-row b { font-size: 16px; font-weight: 900; margin-right: 6px; }
.rd-boss-row .note { margin: 2px 0 0; }
.rd-thumb { flex: none; background: var(--sky); border: 2px solid var(--line); border-radius: 14px; }
.rd-lv { display: inline-block; font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 10px; border: 2px solid var(--line); background: var(--grass); }
.rd-lv-thorn { background: var(--yellow); }
.rd-lv-golem { background: var(--pink); }
.rd-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rd-btns .btn { flex: 1 1 130px; padding: 0 10px; min-height: 44px; }
.rd-party-box .btn, .rd-ad .btn, .rd-card .btn, .rd-need ~ .btn { min-height: 44px; }
.rd-ad { gap: 8px; }
.rd-ad span { min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.rd-ad .btn { flex: none; }
.rd-roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rd-roster li { display: flex; align-items: center; gap: 6px; font-weight: 700; overflow-wrap: anywhere; }
.rd-roster .i { width: 18px; height: 18px; }
.rd-krs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.rd-kr { border: 2.5px solid var(--line); border-radius: 16px; background: var(--paper); padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.rd-kr b { font-size: 14px; font-weight: 900; }
.rd-kr .note { margin: 0; font-size: 12px; }
.rd-kr .btn { width: 100%; min-height: 44px; margin-top: 2px; }
.rd-kr.rd-off canvas { filter: grayscale(1); opacity: .45; }
.rd-kr.rd-on { background: var(--yellow); }

/* 6차: 쉬운 집 길잡이·꾸미기(house.js) */
.hz-dots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; list-style: none; margin: 0 0 10px; padding: 0; }
.hz-dots li { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 800; color: var(--soft); }
.hz-dots i { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2.5px solid var(--hair); background: var(--paper); font-style: normal; font-size: 13px; }
.hz-dots .i { width: 16px; height: 16px; stroke-width: 3; }
.hz-dots li.on { color: var(--ink); }
.hz-dots li.on i { background: var(--pink); border-color: var(--line); }
.hz-dots li.done i { background: var(--grass); border-color: var(--line); }
.hz-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--paper); border: 2.5px solid var(--line); border-radius: 16px; }
.hz-card .note { margin: 0; }
.hz-title { font-size: 16px; font-weight: 900; color: var(--ink); }
.hz-big { min-height: 56px; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.hz-sub { min-height: 44px; font-size: 13.5px; align-self: center; padding: 0 16px; }
.hz-short { margin: 0; font-weight: 800; color: #B5463E; text-align: center; }
.hz-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hz-plot { min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px 2px; border-radius: 12px; border: 2.5px dashed var(--line); background: #EAF6DF; font-weight: 800; color: var(--ink); }
.hz-plot b { font-size: 15px; line-height: 1.1; }
.hz-plot small { font-size: 11.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hz-plot .i { width: 16px; height: 16px; }
.hz-plot:not(:disabled):active { background: var(--yellow); }
.hz-plot.mine { border-style: solid; background: var(--pink); }
.hz-plot.taken { border-style: solid; background: var(--cream); color: var(--soft); }
.hz-plot:disabled { cursor: default; opacity: 1; }
.hz-bot { position: absolute; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(var(--dock-h) + 8px + var(--sab)); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.hz-bot[hidden] { display: none; }
.hz-bot .btn { min-width: 0; min-height: 48px; padding: 2px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12.5px; line-height: 1.1; white-space: nowrap; }
.hz-bot .btn .i { width: 20px; height: 20px; }
/* 7차: 버튼이 6개라 좁은 세로 화면은 글자를 줄이고 두 줄까지 허용(잘림 방지) */
@media (max-width: 359px) { .hz-bot { gap: 4px; } .hz-bot .btn { font-size: 11px; letter-spacing: -.3px; white-space: normal; word-break: keep-all; text-align: center; padding: 2px 1px; } }
.hz-tip { position: absolute; left: 50%; top: calc(124px + var(--sat)); transform: translateX(-50%); max-width: calc(100% - 24px); padding: 7px 14px; background: var(--cream); border: 2.5px solid var(--line); border-radius: 14px; font-size: 13.5px; font-weight: 800; color: var(--ink); text-align: center; word-break: keep-all; pointer-events: none !important; }
.hz-tip:empty { display: none; }
.hz-pop { position: absolute; left: 0; top: 0; z-index: 21; display: flex; gap: 4px; padding: 4px; background: var(--cream); border: 2.5px solid var(--line); border-radius: 14px; box-shadow: 0 2px 0 var(--line); }
.hz-pop .btn { min-height: 44px; padding: 0 10px; font-size: 13.5px; }
.hz-buy { justify-content: center; background: var(--yellow) !important; }
.hz-buy i { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; font-style: normal; }
.hz-buy .i { width: 30px; height: 30px; }
.hz-tc { touch-action: pan-x; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hz-tc img { pointer-events: none; -webkit-user-drag: none; }
.hz-coach { position: absolute; z-index: 30; width: min(300px, calc(100% - 16px)); padding: 10px 12px; background: var(--paper); border: 3px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 var(--line); --ax: 50%; }
.hz-coach[hidden] { display: none; }
.hz-coach p { margin: 0 0 8px; font-size: 14px; font-weight: 800; line-height: 1.4; color: var(--ink); word-break: keep-all; }
.hz-coach p b { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; background: var(--pink); border: 2px solid var(--line); font-size: 12px; }
.hz-coach-row { display: flex; gap: 6px; justify-content: flex-end; }
.hz-coach-row .btn { min-height: 44px; padding: 0 12px; font-size: 13.5px; }
.hz-coach::after { content: ""; position: absolute; left: var(--ax); bottom: -12px; width: 16px; height: 16px; margin-left: -8px; background: var(--paper); border-right: 3px solid var(--line); border-bottom: 3px solid var(--line); transform: rotate(45deg); }
.hz-coach.below::after { bottom: auto; top: -12px; transform: rotate(225deg); }
@media (min-width: 760px) {
  .hz-bot { left: 50%; right: auto; width: var(--bar-w); margin-left: calc(var(--bar-w) / -2); bottom: calc(var(--dock-h) + 14px + var(--sab)); }
  .hz-tip { top: calc(16px + var(--sat)); }
}
@media (max-height: 560px) {
  .hz-tip { left: calc(196px + var(--sal)); transform: none; top: calc(8px + var(--sat)); max-width: calc(100% - 460px - var(--sal)); }
}

/* 6차: 초보 미션 칩·목록(quest.js) */
.qs-chip { display: flex; align-items: center; gap: 6px; min-width: 0; }
.qs-chip .i { width: 18px; height: 18px; }
.qs-chip b { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; word-break: keep-all; font-size: 12.5px; line-height: 1.25; }
.qs-chip small { flex: none; font-size: 11px; color: var(--soft); font-weight: 800; }
.h-chip.qs-ready { background: var(--yellow); }
.qs-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.qs-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 2px solid var(--hair); border-radius: 14px; background: var(--paper); }
.qs-row.cur { border-color: var(--line); }
.qs-row.done { background: #FFF6D6; border-color: var(--line); }
.qs-row.got { opacity: .6; }
.qs-no { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line); background: var(--cream); font-style: normal; font-size: 13px; font-weight: 900; }
.qs-no .i { width: 16px; height: 16px; stroke-width: 3; }
.qs-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qs-txt b { font-size: 14px; word-break: keep-all; }
.qs-txt small { font-size: 12px; color: var(--soft); font-weight: 700; }
.qs-btn { flex: none; min-height: 44px; padding: 0 10px; font-size: 13px; }
.qs-got { flex: none; display: flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 800; color: var(--soft); padding: 0 6px; }
.qs-got .i { width: 16px; height: 16px; }
.qs-badge { flex: none; font-style: normal; font-size: 11px; font-weight: 900; padding: 1px 7px; border-radius: 999px; background: var(--yellow); border: 2px solid var(--line); }
.hz-card .hd-prev { max-height: 34vh; }

/* 7차: 실내 상단 바 위젯 자리(api.house.addTopWidget) */
.hd-w { display: flex; align-items: center; min-width: 0; flex-wrap: wrap; gap: 6px; max-width: 100%; }

/* 7차: 사진 모드와 사진첩(photo.js, .ph- 접두) */
body.ph-on #ui > :not(.ph-mode):not(#toasts):not(#ask):not(.st-pop) { visibility: hidden !important; }
.ph-mode { position: absolute; inset: 0; z-index: 35; touch-action: none; }
.ph-fr, .ph-stks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ph-st { position: absolute; pointer-events: auto; touch-action: none; cursor: grab; display: flex; }
.ph-st > *, .ph-st canvas { width: 100% !important; height: 100% !important; pointer-events: none; }
.ph-top { position: absolute; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); top: calc(8px + var(--sat)); display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.ph-cam { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ph-top .btn, .ph-bot .btn { min-height: 44px; padding: 0 12px; font-size: 13.5px; box-shadow: 0 2px 0 var(--line); white-space: nowrap; }
.ph-x .i { width: 18px; height: 18px; }
.ph-bot { position: absolute; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(10px + var(--sab)); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 8px; }
.ph-poses { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-opts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ph-opt { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ph-shot { width: 68px; height: 68px; border-radius: 50%; background: var(--pink); border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.ph-shot:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.ph-shot .i { width: 32px; height: 32px; }
.ph-pick { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--sab)); width: min(420px, calc(100% - 16px)); max-height: min(52vh, calc(100% - 170px)); overflow-y: auto; padding: 10px 12px 12px; background: var(--cream); border: 2.5px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--line); }
.ph-pick[hidden] { display: none; }
.ph-pick-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.ph-pick-h .btn { min-height: 44px; min-width: 44px; padding: 0; }
.ph-pick-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; margin-top: 8px; }
.ph-pick-i { min-height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 12px; border: 2px solid var(--hair); background: var(--paper); }
.ph-pick-i:active { background: var(--pink); }
.ph-flash { position: absolute; inset: 0; background: #FFFFFF; pointer-events: none; animation: ph-flash .35s ease-out forwards; }
@keyframes ph-flash { from { opacity: .9; } to { opacity: 0; } }
@media (max-height: 460px) { .ph-shot { width: 58px; height: 58px; } .ph-pick { bottom: calc(76px + var(--sab)); max-height: calc(100% - 140px); } }
.ph-chip { display: inline-flex; align-items: center; gap: 4px; }
.ph-chip .i { width: 18px; height: 18px; }
.ph-head { gap: 8px; margin-bottom: 10px; }
.ph-head .btn { min-height: 44px; padding: 0 14px; font-size: 14px; width: auto; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ph-th { aspect-ratio: 1; min-height: 44px; border-radius: 12px; overflow: hidden; border: 2.5px solid var(--line); background: var(--paper); }
.ph-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-big { display: block; width: 100%; max-height: 52dvh; object-fit: contain; border-radius: 14px; border: 2.5px solid var(--line); background: var(--paper); }
.ph-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ph-acts .btn { flex: 1 1 90px; min-height: 48px; }
.ph-top, .ph-bot, .ph-cam, .ph-poses, .ph-opts { pointer-events: none; }
.ph-top button, .ph-bot button { pointer-events: auto; }

/* 7차 home: 집 편안함(care.js 위젯·시트, house.js 꾸미기 트레이 배지) */
.cf-tc { position: relative; }
.cf-tc.cf-set { border-color: var(--cf-set); box-shadow: inset 0 0 0 2px var(--cf-set); }
.cf-badge { position: absolute; top: 3px; right: 3px; display: flex; align-items: center; gap: 1px; padding: 0 5px 0 3px; min-height: 20px; border-radius: 999px; background: var(--paper); border: 2px solid var(--line); font-style: normal; font-size: 11.5px; font-weight: 900; color: var(--ink); line-height: 1; pointer-events: none; }
.cf-badge .i { width: 12px; height: 12px; fill: var(--pink-d); stroke-width: 2.4; }
.cf-line { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 800; color: var(--ink); flex-wrap: wrap; }
.cf-line .i { width: 16px; height: 16px; fill: var(--pink-d); }
.cf-line small { color: var(--soft); font-weight: 700; font-size: 12px; }
.cf-hearts { display: inline-flex; gap: 1px; }
.cf-hearts i { display: flex; }
.cf-hearts .i { width: 14px; height: 14px; stroke-width: 2.4; }
.cf-hearts i.on .i { fill: var(--pink-d); }
.cf-gauge { display: flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 10px; background: var(--cream); border: 2.5px solid var(--line); border-radius: 12px; color: var(--ink); font: inherit; font-size: 13px; font-weight: 800; white-space: nowrap; }
.cf-bonus { min-height: 44px; padding: 0 10px; display: flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; animation: cf-pulse 1.6s ease-in-out infinite; }
.cf-bonus .i { width: 18px; height: 18px; }
@keyframes cf-pulse { 50% { box-shadow: 0 0 0 4px var(--yellow); } }
@media (prefers-reduced-motion: reduce) { .cf-bonus { animation: none; } }
.cf-top { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.cf-top .cf-hearts .i { width: 22px; height: 22px; }
.cf-top span { margin-left: auto; font-weight: 900; color: var(--soft); }
.cf-sets { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-chip { padding: 3px 10px; border-radius: 999px; border: 2.5px solid var(--cf-set); background: var(--paper); font-size: 12.5px; font-weight: 800; }
.cf-chip.on { background: var(--cf-set); color: #fff; text-shadow: 0 1px 0 #0004; }
.cf-tiers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cf-tiers li { display: grid; grid-template-columns: 76px 44px 1fr; align-items: center; gap: 6px; padding: 6px 10px; border: 2px solid var(--hair); border-radius: 12px; background: var(--paper); font-size: 13px; }
.cf-tiers li.on { border-color: var(--line); background: var(--yellow); }
.cf-tiers li.done { opacity: .65; }
.cf-tiers small { color: var(--soft); font-weight: 700; }
.cf-tiers span { font-weight: 700; color: var(--ink); text-align: right; }

/* 7차 home: 놀이방 돌봄(care.js) */
.cr-face { display: inline-block; flex: none; border-radius: 50%; border: 2.5px solid var(--line); background: var(--sky) center / cover no-repeat; }
.cr-g { display: flex; align-items: center; gap: 3px; }
.cr-g .i { width: 14px; height: 14px; stroke-width: 2.6; }
.cr-track { flex: 1; height: 8px; min-width: 36px; border-radius: 99px; background: var(--hair); border: 1.5px solid var(--line); overflow: hidden; }
.cr-fill { display: block; height: 100%; background: var(--grass-d); transition: width .3s; }
.cr-g.low .cr-fill { background: var(--red); }
.cr-g-clean .cr-fill { background: #8FC0EA; }
.cr-g-mood .cr-fill { background: var(--pink-d); }
.cr-g.low .cr-fill { background: var(--red); }
.cr-gauges { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--paper); border: 2.5px solid var(--line); border-radius: 14px; }
.cr-row { display: grid; grid-template-columns: 52px 1fr 30px; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 800; }
.cr-row .cr-track { height: 12px; }
.cr-row .i { width: 18px; height: 18px; }
.cr-n { text-align: right; }
.cr-who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cr-who div { display: flex; flex-direction: column; }
.cr-who b { font-size: 17px; }
.cr-who small { color: var(--soft); font-weight: 700; font-size: 12.5px; }
.cr-mood { margin: 0 0 0 auto; font-size: 13px; font-weight: 800; color: var(--soft); }
.cr-acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.cr-act { min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; font-size: 15px; }
.cr-act .i { width: 26px; height: 26px; }
.cr-act small { font-size: 11.5px; color: var(--soft); font-weight: 700; }
.cr-act:disabled { opacity: .55; }
.cr-sub { margin-top: 8px; min-height: 44px; font-size: 14px; }
.cr-npcs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cr-npc { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 92px; padding: 8px 4px; background: var(--paper); border: 2.5px solid var(--line); border-radius: 14px; color: var(--ink); font: inherit; font-weight: 800; font-size: 14px; }
.cr-npc small { font-size: 12px; color: var(--soft); }
.cr-npc.on { background: var(--yellow); }
.cr-npc:disabled:not(.on) { opacity: .55; border-style: dashed; }
.cr-head { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; gap: 3px; width: 92px; min-height: 44px; padding: 5px 7px; justify-content: center; background: var(--cream); border: 2.5px solid var(--line); border-radius: 12px; box-shadow: 0 2px 0 var(--line); will-change: transform; }
.cr-head[hidden] { display: none; }
.cr-head.zz { opacity: .85; }
.cr-ov { display: flex; flex-direction: column; touch-action: none; user-select: none; -webkit-user-select: none; }
.cr-cv { position: absolute; inset: 0; width: 100%; height: 100%; }
.cr-top { position: relative; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) calc(10px + var(--sar)) 8px calc(12px + var(--sal)); background: var(--cream); border-bottom: 3px solid var(--line); }
.cr-top > b { font-size: 16px; white-space: nowrap; }
.cr-mini { flex: 1; display: flex; gap: 8px; min-width: 0; }
.cr-mini .cr-g { flex: 1; min-width: 0; }
.cr-mini .cr-track { min-width: 0; }
.cr-x { flex: none; width: 44px; height: 44px; min-height: 44px; padding: 0; display: flex; align-items: center; justify-content: center; }
.cr-tip { position: relative; margin: 8px auto 0; max-width: calc(100% - 24px); padding: 6px 12px; background: var(--paper); border: 2.5px solid var(--line); border-radius: 14px; font-size: 14px; font-weight: 800; text-align: center; word-break: keep-all; pointer-events: none; }
.cr-foot { position: relative; margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px calc(10px + var(--sar)) calc(10px + var(--sab)) calc(10px + var(--sal)); }
.cr-foot:empty { display: none; }
.cr-tray { display: flex; gap: 6px; align-items: stretch; overflow-x: auto; padding: 6px; background: var(--cream); border: 2.5px solid var(--line); border-radius: 16px; }
.cr-snack { flex: 1; min-width: 64px; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: var(--paper); border: 2.5px solid var(--line); border-radius: 12px; color: var(--ink); font: inherit; font-size: 11.5px; font-weight: 800; touch-action: none; }
.cr-mode { display: flex; gap: 6px; }
.cr-mode .btn { flex: 1; min-height: 44px; font-size: 14px; }
.cr-snack.none { opacity: .5; border-style: dashed; }
.cr-snack canvas { pointer-events: none; }
.cr-buy { flex: none; min-height: 64px; padding: 0 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12.5px; }
.cr-shop { display: flex; flex-direction: column; gap: 6px; padding: 10px; max-height: 60vh; overflow-y: auto; background: var(--cream); border: 2.5px solid var(--line); border-radius: 16px; }
.cr-shoprow { display: flex; align-items: center; gap: 8px; }
.cr-shoprow div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cr-shoprow small { font-size: 12px; color: var(--soft); font-weight: 700; }
.cr-shoprow .btn { min-height: 44px; padding: 0 12px; font-size: 14px; }
.cr-prog { height: 14px; border-radius: 99px; background: var(--paper); border: 2.5px solid var(--line); overflow: hidden; }
.cr-prog[hidden] { display: none; }
.cr-prog span { display: block; width: 0; height: 100%; background: #8FC0EA; transition: width .15s; }
.cr-foot .btn.wide { min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 16px; }
.cr-foot .btn[hidden] { display: none; }
.cr-count { align-self: center; padding: 4px 16px; border-radius: 999px; background: var(--yellow); border: 2.5px solid var(--line); font-size: 18px; }
.cr-ov:has(.cr-card) { align-items: center; justify-content: center; background: #00000055; }
.cr-card { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(320px, calc(100% - 32px)); padding: 16px; background: var(--paper); border: 3px solid var(--line); border-radius: 18px; box-shadow: 0 4px 0 var(--line); text-align: center; word-break: keep-all; }
.cr-card p { margin: 0; font-size: 14px; font-weight: 700; color: var(--soft); }
@media (max-height: 560px) {
  .cr-tray { padding: 4px; }
  .cr-snack, .cr-buy { min-height: 52px; }
  .cr-act { min-height: 60px; }
  .cr-shop { max-height: 52vh; }
}

/* 7차 계절 이벤트(season.js, .ss-) */
.ss-chip { display: inline-flex; align-items: center; gap: 5px; }
.ss-chip .i { width: 18px; height: 18px; color: var(--red); }
.ss-chip b { font-size: 13px; }
.ss-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); border: 1.5px solid var(--paper); flex: none; display: inline-block; }
.h-chip.ss-bump { animation: ss-bump .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ss-bump { 40% { transform: scale(1.12); } }
.ss-head { display: flex; align-items: center; gap: 12px; background: var(--yellow); border: 2.5px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.ss-coin { width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--red); }
.ss-coin .i { width: 28px; height: 28px; }
.ss-hinfo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ss-hinfo b { font-size: 17px; }
.ss-hinfo span { font-size: 12.5px; font-weight: 700; color: var(--soft); }
.ss-tabs { display: flex; gap: 6px; margin: 10px 0 8px; }
.ss-tab { flex: 1; min-height: 44px; border-radius: 14px; border: 2.5px solid var(--hair); background: var(--paper); font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--soft); }
.ss-tab.on { border-color: var(--line); background: var(--pink); color: var(--ink); }
.ss-list { display: flex; flex-direction: column; gap: 8px; }
.ss-item, .ss-quest { display: flex; align-items: center; gap: 10px; background: var(--paper); border: 2px solid var(--hair); border-radius: 14px; padding: 8px 10px; min-width: 0; }
.ss-quest.got { opacity: .7; }
.ss-art { display: inline-block; flex: none; border-radius: 12px; background: var(--cream); border: 2.5px solid var(--set, var(--hair)); box-sizing: content-box; }
.ss-art canvas, .ss-item .st-art canvas { display: block; width: 100%; height: 100%; }
.ss-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ss-info b { font-size: 14.5px; word-break: keep-all; }
.ss-info span { font-size: 12px; font-weight: 700; color: var(--soft); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ss-comfort { font-style: normal; display: inline-flex; align-items: center; gap: 2px; padding: 0 6px; border-radius: 999px; background: var(--pink); color: var(--ink); }
.ss-comfort .i { width: 13px; height: 13px; color: var(--red); }
.ss-buy, .ss-claim { min-height: 44px; min-width: 76px; padding: 0 12px; font-size: 15px; flex: none; }
.ss-buy .i { width: 18px; height: 18px; color: var(--red); }
.ss-buy:disabled, .ss-claim:disabled { opacity: .5; box-shadow: none; }
.ss-bar { height: 8px; border-radius: 99px; background: var(--hair); overflow: hidden; }
.ss-bar i { display: block; height: 100%; background: var(--grass-d); border-radius: 99px; }
.ss-rw { margin-left: 6px; }
.ss-rw .i { width: 14px; height: 14px; color: var(--red); }
.ss-past { margin-top: 12px; padding: 8px 10px; border-radius: 12px; border: 2px dashed var(--hair); display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--soft); font-weight: 700; }
.ss-past b { color: var(--ink); }
.ss-past span { display: inline-flex; align-items: center; gap: 4px; }
.ss-past .i { width: 15px; height: 15px; }
@media (prefers-reduced-motion: reduce) { .h-chip.ss-bump { animation: none; } }
.ph-wbtn { min-height: 44px; min-width: 44px; padding: 0 10px; box-shadow: 0 2px 0 var(--line); }
.ph-wbtn .i { width: 20px; height: 20px; }
body.ph-on .st-pop { pointer-events: none !important; }
/* 왼쪽 칩 칸이 좁은 화면(280 폭)에선 남은 날을 빼고 화폐만 */
@media (max-width: 300px) { .ss-days { display: none; } }
/* 놀이방이 열려 있으면 맨 위 토스트를 제목·닫기 줄 아래로 내린다 */
body:has(.cr-ov) #toasts.t-top { top: calc(68px + var(--sat)); }
.hd-sell { margin-top: 4px; min-height: 36px; padding: 0 8px; font-size: 12px; }
