/* 사물함 보기: 왼쪽(약 60%)에 사물함 · 양옆 ‹ › · 아래 [추모하기][공유하기], 오른쪽에 상시 패널
   (아이 사진 · 이름 · 자리, 보호자 추모글, 함께 남기는 마음 입력칸 + 목록). PC 패널 440px, 휴대폰 가로 약 40%. */
.sf-view { --pw: min(440px, 40vw); display: block; padding: 0; }
.sf-left { position: absolute; left: 0; top: 0; bottom: 0; right: var(--pw); display: grid; grid-template-rows: minmax(0, 1fr) auto auto; justify-items: center; align-items: center; row-gap: 10px;
  padding: calc(56px + var(--safe-t)) 64px calc(16px + var(--safe-b)) calc(64px + env(safe-area-inset-left, 0px)); transition: right .25s ease; }
.sf-left .sf-stage { grid-column: 1; grid-row: 1; width: min(100%, calc((100dvh - 150px) * 1.42)); height: auto; max-height: 100%; aspect-ratio: 1.42; margin: 0; }
.sf-view.sf-traying .sf-left .sf-stage { width: min(100%, calc((100dvh - 250px) * 1.42)); max-height: 100%; }
.sf-left .sf-basket { grid-column: 1; grid-row: 2; align-self: center; margin: 0; width: min(440px, 100%); }
.sf-left .sf-controls { grid-column: 1; grid-row: 3; flex-direction: row; gap: 10px; align-items: stretch; }
.sf-left .sf-controls .sf-btn { min-width: 150px; min-height: 50px; padding: 0 22px; font-size: 16px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.sf-sharebtn { background: #fff; color: #c0645c; border: 2px solid #f08f86; font-weight: 700; box-shadow: 0 4px 14px rgba(200, 90, 70, .14); }
.sf-sharebtn:hover { background: #fff4f2; }
.sf-sharebtn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sf-arrow { position: absolute; top: calc(50% - 30px); width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 250, 241, .94); box-shadow: 0 3px 12px rgba(80, 50, 40, .18); color: #6b4b31; font: 700 30px/1 inherit; padding: 0 0 3px; cursor: pointer; display: grid; place-items: center; }
.sf-arrow.prev { left: calc(8px + env(safe-area-inset-left, 0px)); }
.sf-arrow.next { right: 8px; }
.sf-arrow:hover { background: #fff6ea; }
.sf-arrow:disabled { opacity: .35; cursor: default; }
.sf-view.empty .sf-controls, .sf-view.empty .sf-arrow { display: none; }

/* 오른쪽 패널 */
.sf-panel { position: absolute; top: 0; right: 0; bottom: 0; width: var(--pw); display: flex; flex-direction: column; background: var(--sf-paper, #fffaf2); border-radius: 24px 0 0 24px; box-shadow: -8px 0 30px rgba(60, 40, 30, .16); transition: transform .25s ease; z-index: 3; }
.sf-panel-head { display: flex; align-items: center; gap: 12px; padding: calc(14px + var(--safe-t)) calc(14px + env(safe-area-inset-right, 0px)) 12px 18px; border-bottom: 1px solid #f0e2cc; }
.sf-pics { display: flex; flex: none; }
.sf-pics:empty { display: none; }
.sf-pics img { width: 60px; height: 60px; border-radius: 16px; object-fit: cover; background: #f4e3cc; box-shadow: 0 0 0 2.5px #fff, 0 2px 8px rgba(60, 40, 30, .16); }
.sf-pics img + img { margin-left: -18px; transform: translateY(6px); }
.sf-panel-id { min-width: 0; flex: 1; }
.sf-panel-id b { display: block; font-size: 19px; line-height: 1.25; word-break: keep-all; }
.sf-panel .sf-plate { margin: 3px 0 0; padding: 0; border: 0; background: none; box-shadow: none; font-size: 13px; font-weight: 600; color: #8a6a52; text-align: left; }
.sf-panel .iv-with { margin: 4px 0 0; text-align: left; background: none; padding: 0; }
.sf-fold { display: none; }
/* 사물함 비우기 (11/5) */
.sf-clear { flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin-left: auto; border: 0; border-radius: 50%; background: #f6ead8; color: #8a5a44; cursor: pointer; }
.sf-clear svg { width: 20px; height: 20px; }
.sf-view.empty .sf-clear { display: none; }
/* 사물함 신고 (11/6): 비우기 옆, 남의 사물함에서만 */
.sf-report { margin-left: 6px; color: #a0705a; }
.sf-report[hidden] { display: none; }
.sf-report-count { margin: 4px 0 0; text-align: right; }
.sf-panel > .sf-bridge-go, .sf-panel > .sf-empty { margin: 14px 18px 0; }
.sf-panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px calc(16px + env(safe-area-inset-right, 0px)) calc(16px + var(--safe-b)) 16px; }
.sf-panel-body .sf-mind-input { position: sticky; top: -12px; z-index: 2; background: #fff6e9; padding-top: 6px; padding-bottom: 6px; }
.sf-panel-sub { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sf-panel-sub h3 { margin: 0; font-size: 17px; }
.sf-panel-back { border: 0; border-radius: 999px; padding: 8px 12px; min-height: 40px; background: #f6ead8; font: inherit; font-size: 14px; font-weight: 700; color: #6b4b31; cursor: pointer; }
.sf-unfold { display: none; }

/* 휴대폰 가로 */
@media (orientation: landscape) and (max-height: 500px) {
  .sf-view { --pw: 40vw; }
  .sf-left { padding: calc(8px + var(--safe-t)) 56px calc(8px + var(--safe-b)) calc(56px + env(safe-area-inset-left, 0px)); row-gap: 6px; }
  .sf-left .sf-stage { width: min(100%, calc((100dvh - 76px) * 1.42)); }
  .sf-view.sf-traying .sf-left .sf-stage { width: min(100%, calc((100dvh - 150px) * 1.42)); }
  .sf-left .sf-basket { min-height: 60px; padding: 6px 10px; margin: 0; max-width: none; width: min(400px, 100%); }
  /* 바구니는 한 줄: 물건이 많으면 조금씩 작아진다 (사물함이 가려지지 않게) */
  .sf-left .sf-tray-items { flex-wrap: nowrap; min-height: 44px; }
  .sf-left .sf-bi { flex: 0 1 auto; min-width: 0; min-height: 44px; }
  .sf-left .sf-bi img { max-width: 100%; max-height: 46px; object-fit: contain; }
  .sf-left .sf-controls .sf-btn { min-width: 112px; min-height: 44px; padding: 0 14px; font-size: 14.5px; }
  .sf-arrow { width: 44px; height: 44px; font-size: 26px; top: calc(50% - 24px); }
  .sf-arrow.prev { left: calc(6px + env(safe-area-inset-left, 0px)); }
  .sf-arrow.next { right: 6px; }
  .sf-panel-head { padding: calc(8px + var(--safe-t)) calc(8px + env(safe-area-inset-right, 0px)) 8px 12px; gap: 10px; }
  .sf-pics img { width: 50px; height: 50px; border-radius: 13px; }
  .sf-panel-id b { font-size: 16px; }
  .sf-panel-body { padding: 8px calc(10px + env(safe-area-inset-right, 0px)) calc(10px + var(--safe-b)) 10px; }
  .sf-panel-body .sf-mind-input { top: -8px; }
  .sf-fold { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #f6ead8; color: #6b4b31; font: 700 24px/1 inherit; cursor: pointer; }
  /* 접으면 사물함이 전체 폭, 오른쪽 가장자리 탭으로 펼친다 */
  .sf-view.panel-off .sf-left { right: 0; }
  .sf-view.panel-off .sf-panel { transform: translateX(105%); }
  .sf-view.panel-off .sf-unfold { display: grid; place-items: center; position: absolute; right: 0; top: calc(50% - 32px); width: 34px; height: 64px; border: 0; border-radius: 16px 0 0 16px; background: rgba(255, 250, 241, .96); box-shadow: -3px 0 12px rgba(60, 40, 30, .18); color: #6b4b31; font: 700 24px/1 inherit; z-index: 4; cursor: pointer; }
  .sf-view.panel-off .sf-arrow.next { right: 40px; }
  /* 선물을 끌고 있는 동안은 패널만 잠깐 비켜선다 (사물함 크기는 그대로) */
  .sf-view.sf-dragging .sf-panel { transform: translateX(105%); }
  /* 글을 쓸 때: 위쪽 전체 폭 입력 화면 */
  .sf-panel.typing, .sf-sheet.typing { position: fixed; left: 0; right: 0; top: 0; bottom: auto; width: auto; max-height: 100dvh; transform: none; border-radius: 0 0 20px 20px; z-index: 60; animation: none; }
  .sf-panel.typing .sf-panel-head, .sf-panel.typing > .sf-bridge-go, .sf-panel.typing > .sf-empty { display: none; }
  .sf-panel.typing .sf-panel-body > :not(.sf-typing-host), .sf-sheet.typing #sfBody > :not(.sf-typing-host) { display: none; }
  .sf-panel.typing .sf-mind-list, .sf-sheet.typing .sf-mind-list { display: none; }
  .sf-panel.typing .sf-mind-input { position: static; }
}

/* 아래 버튼 [추모하기][선물하기][공유하기] (사용자 11/3): 너무 바닥에 붙지 않게 조금 위로 */
.sf-left { padding-bottom: calc(44px + var(--safe-b)); }
.sf-left .sf-stage { width: min(100%, calc((100dvh - 180px) * 1.42)); }
.sf-left .sf-controls .sf-btn { min-width: 132px; }
.sf-giftbtn { background: #fff8ec; color: #9a6224; border: 2px solid #e8b56a; font-weight: 700; box-shadow: 0 4px 14px rgba(170, 110, 40, .14); }
.sf-giftbtn:hover:not(:disabled) { background: #fff1db; }
.sf-giftbtn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sf-giftbtn:disabled { opacity: .42; cursor: default; box-shadow: none; }
/* 선물하기를 누르면: 오른쪽 패널 · 화살표 · 아래 버튼 · 초원으로를 숨기고 사물함 + 바구니만 */
.sf-view.sf-gifting .sf-panel, .sf-view.sf-gifting .sf-arrow, .sf-view.sf-gifting .sf-controls, .sf-view.sf-gifting .sf-homebtn, .sf-view.sf-gifting .sf-unfold { display: none !important; }
.sf-view.sf-gifting .sf-left { right: 0; }
.sf-gift-done { display: none; }
.sf-view.sf-gifting .sf-gift-done { display: block; position: absolute; right: -8px; top: -44px; border: 0; border-radius: 999px; padding: 9px 16px; min-height: 40px; background: #fffaf1; color: #6b4b31; font: inherit; font-size: 14px; font-weight: 700; box-shadow: 0 3px 12px rgba(80, 50, 40, .2); cursor: pointer; }
.sf-view.sf-gifting .sf-gift-done:hover { background: #fff1db; }
@media (orientation: landscape) and (max-height: 500px) {
  .sf-left { padding-bottom: calc(16px + var(--safe-b)); }
  .sf-left .sf-stage { width: min(100%, calc((100dvh - 92px) * 1.42)); }
  .sf-left .sf-controls .sf-btn { min-width: 96px; }
  .sf-view.sf-gifting .sf-gift-done { top: -38px; right: 0; padding: 7px 12px; min-height: 34px; font-size: 13px; }
}

/* 봉안 양식의 사진 (사용자 11/3) */
.sf-cp-photo { display: flex; gap: 12px; align-items: center; margin: 4px 0 10px; }
.sf-cp-photo img { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex: none; box-shadow: 0 2px 8px rgba(60, 40, 30, .15); }
.sf-cp-photo > div { display: grid; gap: 3px; justify-items: start; min-width: 0; }
.sf-cp-photo b { font-size: 14px; } .sf-cp-photo small { font-size: 12px; color: var(--ink-soft, #8a7462); }

/* 봉안 직후 추모글 쓰기: 오른쪽 패널을 숨긴다 (사용자 11/3) */
.sf-view.panel-hide .sf-panel, .sf-view.panel-hide .sf-unfold { display: none !important; }
.sf-view.panel-hide .sf-left { right: 0 !important; }

/* 넓은 화면(PC · 가로)에서는 아래에서 올라오는 창 대신 화면 가운데 창 (사용자 11/3) */
@media (min-width: 700px) {
  .sf-sheet:not(.side):not(.typing) { top: 50%; bottom: auto; transform: translate(-50%, -50%); max-height: min(86vh, 760px); border-radius: 24px; box-shadow: 0 18px 60px rgba(60, 40, 30, .28); padding-bottom: 18px; animation: sfPop .22s ease-out; }
  @keyframes sfPop { from { transform: translate(-50%, -46%) scale(.97); opacity: 0; } }
}

/* 모바일 화면 정리 (사용자 11/4) */
/* 세로 화면: 사물함 보기 오른쪽 패널(추모글 · 빈 칸 '여기에 봉안하기')은 아래쪽 시트로. 사물함은 위쪽에 */
@media (orientation: portrait) {
  .sf-view { --ph: 58dvh; }
  .sf-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--ph); border-radius: 24px 24px 0 0; box-shadow: 0 -8px 30px rgba(60, 40, 30, .16); }
  .sf-panel-head { padding-top: 12px; }
  .sf-left { right: 0; bottom: var(--ph); padding: calc(56px + var(--safe-t)) 56px 10px; }
  .sf-left .sf-stage { width: min(100%, calc((100dvh - var(--ph) - 140px) * 1.42)); }
  .sf-left .sf-controls .sf-btn { min-width: 0; min-height: 44px; padding: 0 16px; font-size: 14.5px; }
  .sf-arrow { top: calc((100dvh - var(--ph)) / 2 - 10px); width: 44px; height: 44px; font-size: 26px; }
}
/* 터치 기기: 봉안 양식의 '사진 넣기'를 손가락으로 누르기 쉽게 */
body.touch .sf-cp-photo .sf-btn { min-height: 40px; padding-left: 14px; padding-right: 14px; }
/* 가로 휴대폰(높이 낮음): 봉안 양식의 마지막 단추 줄과 후원 창의 '후원했어요 · 입금 확인 요청'을 아래에 붙여 늘 보이게 */
@media (orientation: landscape) and (max-height: 480px) {
  #sfSheet #sfBody > .sf-two:last-child:has(.sf-btn.primary) { position: sticky; bottom: -18px; z-index: 2; margin-bottom: -18px; padding: 8px 0 18px; background: var(--sf-paper, #fffaf2); box-shadow: 0 -8px 12px -8px rgba(60, 40, 30, .18); }
  #spPanel [data-report] { position: sticky; bottom: 8px; z-index: 2; box-shadow: 0 6px 18px rgba(200, 90, 70, .28), 0 0 0 6px var(--paper-solid, #fffbf6); }
}
/* 세로 화면: 조이스틱을 아래 독(봉안하기 · 아이 찾기 · 함께하기) 위로 올려 겹치지 않게 (사용자 11/4) */
@media (orientation: portrait) { body.touch .joy { bottom: calc(100px + var(--safe-b)); } }
/* 세로 화면: 함께하기 펼침 단추가 오른쪽 끝을 조금 넘어서 안쪽으로 (사용자 11/4) */
@media (orientation: portrait) { .sf-fan { left: auto; right: 0; transform: none; } }
/* 가로 휴대폰(높이 낮음): 사물함 보기 오른쪽 패널을 화면 끝에서 조금 띄운 둥근 틀로 — 긴 글은 틀 안에서 잘리고 안쪽에서 스크롤 (사용자 11/4) */
@media (orientation: landscape) and (max-height: 500px) { .sf-panel { top: calc(6px + var(--safe-t)); bottom: calc(6px + var(--safe-b)); border-radius: 20px 0 0 20px; overflow: hidden; } }
/* 사물함 보기: 사물함 그림의 네 가장자리를 배경으로 부드럽게 녹여, 따로 떼어 낸 화면처럼 보이지 않게 (사용자 11/4) */
.sf-stage canvas.sf-v1canvas { -webkit-mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent); mask-composite: intersect; }
