/* 화면 위의 글·버튼 — 말투는 마트 가격표 스티커와 영수증
 * 누르는 곳은 전부 44px 이상, 사이는 8px 이상. 빨강만 진한 색.
 */
.top {
  position: relative; z-index: 3; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) 4px max(16px, env(safe-area-inset-left, 0px));
  background: var(--wall);
}
.top__right { display: flex; align-items: center; gap: 8px; }

.tag {
  display: inline-flex; align-items: stretch; margin: 0; padding: 0; border: 0;
  font: 700 13px/1 var(--f-ui); color: var(--ink); background: var(--paper);
  border-radius: 4px; box-shadow: 2px 2px 0 rgba(150, 70, 84, .3); transform: rotate(-1.5deg);
}
.tag--title b { padding: 8px 8px; color: var(--paper); background: var(--red); border-radius: 4px 0 0 4px; letter-spacing: .12em; }
.tag--title span { padding: 8px 9px; letter-spacing: .02em; }
.tag--demo {
  min-height: 44px; align-items: center; padding: 0 12px; cursor: pointer;
  background: #FFE14D; transform: rotate(1.5deg); -webkit-appearance: none; appearance: none;
}
.tag--demo .wide { display: none; }
@media (min-width: 560px) { .tag--demo .wide { display: inline; } }

.btn, .iconbtn, .chip {
  -webkit-appearance: none; appearance: none; margin: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: 6px;
  font: 700 14px/1.2 var(--f-ui); color: var(--ink); background: var(--paper);
  box-shadow: 3px 3px 0 rgba(120, 40, 56, .34);
  transition: transform .08s ease-out, box-shadow .08s ease-out, background-color .12s;
}
.btn:active, .iconbtn:active, .chip:active, .tag--demo:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(120, 40, 56, .34); }
.btn:focus-visible, .iconbtn:focus-visible, .chip:focus-visible, .tag--demo:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.btn--main { color: var(--paper); background: var(--red); border-color: var(--red-deep); }
.btn--wide { width: 100%; min-height: 48px; font-size: 15px; }
.btn[aria-disabled="true"] {
  color: var(--ink-soft); border-style: dashed; box-shadow: none;
  background: repeating-linear-gradient(135deg, #F6E3DF 0 6px, #EED3CF 6px 12px);
}
.btn.is-busy { opacity: .7; pointer-events: none; }
.iconbtn { width: 44px; padding: 0; font-size: 18px; }
.chip { padding: 0 12px; font-size: 13px; }
.chip[aria-pressed="true"] { color: var(--paper); background: var(--ink); }

/* 아래 막대 */
.dock, .placebar {
  position: relative; z-index: 3; flex: none; background: #F2C2C4;
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
.dock__status, .placebar__hint { margin: 0 0 8px; min-height: 20px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--ink); }
.placebar__hint.is-bad { color: var(--red-deep); font-weight: 700; }
.dock__row, .placebar__row { display: flex; justify-content: center; gap: 8px; }
.dock__row .btn--main, .placebar__row .btn--main { flex: 0 1 auto; }
.app[data-mode="shot"] .top, .app[data-mode="shot"] .dock, .app[data-mode="shot"] .side { display: none; }
.app[data-mode="place"] .stage { touch-action: none; }

/* 시트(쓰기·쓰는 법·시안 조작) */
.sheet {
  position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(42, 27, 29, .56);
}
.sheet__panel {
  width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px));
  background: var(--paper); border-radius: 14px 14px 0 0; border-top: 4px solid var(--red);
  animation: sheetUp .22s cubic-bezier(.2, .8, .3, 1) 1 both;
}
@keyframes sheetUp { 0% { transform: translate3d(0, 24px, 0); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (min-width: 720px) and (min-height: 620px) {
  .sheet { align-items: center; }
  .sheet__panel { border-radius: 14px; }
}
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.sheet__head h2 { margin: 0; font: 700 16px/1.3 var(--f-ui); }
.pad { display: flex; justify-content: center; padding: 10px 0 12px; }
.count { margin: 0; text-align: right; font-size: 12px; color: var(--ink-soft); }
.count.is-over { color: var(--red-deep); font-weight: 700; }
.err { margin: 6px 0 0; padding: 8px 10px; font-size: 13px; line-height: 1.5; color: var(--red-deep); background: #FDE7E9; border-left: 4px solid var(--red); }
.pick { margin: 8px 0 0; padding: 0; border: 0; min-width: 0; }
.pick legend { padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--ink-soft); }
.pick__row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  -webkit-appearance: none; appearance: none; position: relative; width: 44px; height: 44px; padding: 0; cursor: pointer;
  border: 0; border-radius: 2px; background: var(--paper-c, #FBEB93);
  clip-path: polygon(0 0, 100% 0, 100% 76%, 76% 100%, 0 100%);
}
.swatch::after { content: ""; position: absolute; right: 0; bottom: 0; width: 24%; height: 24%; background: linear-gradient(135deg, var(--edge-c, #E9D36A) 50%, rgba(0, 0, 0, 0) 50%); }
.swatch[aria-pressed="true"]::before { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 20px/1 var(--f-ui); color: var(--red-deep); }
.swatch:focus-visible { outline: 3px solid var(--red); outline-offset: -3px; }
.swatchwrap { padding: 2px; border-radius: 4px; border: 2px solid rgba(0, 0, 0, 0); }
.swatchwrap.is-on { border-color: var(--red); }
.penbtn { min-width: 92px; padding: 0 10px; font-size: 20px; line-height: 1; border-color: #CDBDBA; box-shadow: none; }
.penbtn[aria-pressed="true"] { border-color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }
.field { display: block; margin-top: 10px; }
.field span { display: block; margin-bottom: 4px; font-size: 12px; color: var(--ink-soft); }
.field input {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1.5px solid #CDBDBA; border-radius: 6px;
  font: 400 16px/1.2 var(--f-ui); color: var(--ink); background: #fff;
  -webkit-user-select: text; user-select: text; -webkit-appearance: none; appearance: none;
}
.field input:focus { outline: 3px solid var(--red); outline-offset: 1px; border-color: var(--red); }
.fine { margin: 10px 0 12px; font-size: 12px; line-height: 1.6; color: var(--ink-soft); }
.steps { margin: 8px 0 12px; padding: 0; list-style: none; counter-reset: s; font-size: 14px; line-height: 1.6; }
.steps li { counter-increment: s; padding: 8px 0 8px 40px; position: relative; border-bottom: 1px dashed #D9C8C5; }
.steps li::before { content: "0" counter(s); position: absolute; left: 0; top: 8px; font-weight: 700; color: var(--red); }
.steps b { margin-right: 6px; }
.more { font-size: 13px; line-height: 1.7; color: var(--ink-soft); }
.more summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; color: var(--ink); }
.more ul { margin: 0 0 8px; padding-left: 18px; }
.demo__now { margin: 0 0 10px; padding: 8px 10px; font-size: 13px; line-height: 1.6; background: #FFF3C2; border-radius: 4px; white-space: pre-line; }   /* 첫 줄 = 시각, 둘째 줄 = 지금 쓸 수 있는지 */
.demo__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* 크게 보기 */
.viewer {
  position: absolute; inset: 0; z-index: 22; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 16px; background: rgba(42, 27, 29, .78);
}
.viewer__note { animation: viewIn .22s cubic-bezier(.2, .8, .3, 1) 1 both; }
@keyframes viewIn { 0% { transform: scale(.82); opacity: 0; } 100% { transform: none; opacity: 1; } }
.viewer__meta { margin: 0; font-size: 13px; color: #FFE9E6; text-align: center; }

/* 캡처 화면 — 틀 밖은 가리고, 버튼은 잠깐 뒤 숨음 */
.shot { position: absolute; inset: 0; z-index: 15; overflow: hidden; }
.shot__frame { position: absolute; pointer-events: none; box-shadow: 0 0 0 200vmax #221417; } /* 틀 밖은 비치지 않게 꽉 막는다(1:1에서 확대된 냉장고가 비쳐 지저분했다) */
.app[data-mode="shot"] .handle::after { display: none; } /* 캡처 화면에선 손잡이로 문을 못 여니(아래 「문 열기」 버튼) 「열기」 딱지도 뗀다 */
.crop { position: absolute; width: 14px; height: 14px; border: 0 solid #FFE9E6; }
.crop--tl { left: -8px; top: -8px; border-width: 2px 0 0 2px; }
.crop--tr { right: -8px; top: -8px; border-width: 2px 2px 0 0; }
.crop--bl { left: -8px; bottom: -8px; border-width: 0 0 2px 2px; }
.crop--br { right: -8px; bottom: -8px; border-width: 0 2px 2px 0; }
/* 틀에 찍히는 글 — 분홍 바닥·노란 포스트잇·흰 문짝 어디 위에 와도 읽히게: 가수·곡·발매일은 빨간 딱지, 날짜 도장은 어두운 테두리 */
.shot__mark { position: absolute; left: 4%; bottom: 3%; padding: .5em .7em .45em; font: 700 clamp(10px, 2.9vmin, 15px)/1 var(--f-ui); color: var(--paper); background: var(--red); border-radius: 2px; letter-spacing: .02em; box-shadow: 1px 2px 0 rgba(120, 30, 46, .35); transform: rotate(-1deg); }
.shot__stamp { position: absolute; right: 4%; bottom: 3%; font: 700 clamp(12px, 3.6vmin, 20px)/1 "Courier New", var(--f-ui); color: var(--amber); letter-spacing: .12em; text-shadow: 0 0 2px #221417, 0 0 3px #221417, 0 0 7px rgba(34, 20, 23, .8); }
.shot[data-ratio="full"] .shot__mark, .shot[data-ratio="full"] .shot__stamp { bottom: calc(3% + env(safe-area-inset-bottom, 0px)); } /* 화면 그대로일 땐 폰 아래 홈 막대를 피해서 */
.shot__frame.is-narrow .shot__stamp { display: none; }
.shot[data-ratio="full"] .shot__mark, .shot[data-ratio="full"] .shot__demo { left: max(4%, env(safe-area-inset-left, 0px)); }
.shot[data-ratio="full"] .shot__stamp { right: max(4%, env(safe-area-inset-right, 0px)); }
.shot__demo { position: absolute; left: 4%; top: 3%; padding: 4px 8px; font: 700 12px/1 var(--f-ui); color: var(--ink); background: #FFE14D; border-radius: 3px; transform: rotate(-2deg); }
.shot__ctl {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 28px 16px max(14px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(rgba(34, 20, 23, 0), rgba(34, 20, 23, .86) 34%);
  transition: opacity .25s;
}
.shot__ctl.is-idle { opacity: 0; pointer-events: none; }
.shot__guide { margin: 0; font-size: 13px; line-height: 1.5; color: #FFF4F2; text-align: center; }
.shot__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* 알림 */
.toast {
  position: absolute; left: 50%; bottom: 112px; z-index: 30; transform: translateX(-50%);
  width: max-content; max-width: min(88%, 360px); padding: 10px 14px;
  font: 700 13px/1.5 var(--f-ui); color: var(--paper); background: var(--ink); border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(120, 40, 56, .4); text-align: center; text-wrap: balance;   /* 두 줄이면 길이를 비슷하게(한 낱말만 혼자 떨어지지 않게) */
  animation: toastIn .2s ease-out 1 both;
}
.toast.is-bad { background: var(--red-deep); }
.toast.is-top { bottom: auto; top: 74px; }
@keyframes toastIn { 0% { opacity: 0; transform: translate(-50%, 8px); } 100% { opacity: 1; transform: translate(-50%, 0); } }

/* 넓은 화면에서만 — 냉장고 옆 벽에 적힌 글 */
.side { display: none; }
@media (min-width: 900px) and (min-height: 560px) {
  .side { display: block; position: absolute; top: 22%; z-index: 0; color: var(--ink); font-family: var(--f-ui); }
  .side--l { right: calc(50% + var(--u, 3) * 52px + 56px); text-align: right; }
  .side--r { left: calc(50% + var(--u, 3) * 52px + 56px); max-width: 240px; }
  .side b { display: block; font-size: clamp(40px, 5.2vw, 76px); line-height: 1; color: var(--red); letter-spacing: -.04em; }
  .side em { display: block; margin-top: 10px; font-style: normal; font-weight: 700; font-size: 18px; letter-spacing: .04em; }
  .side small { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-soft); }
  .side ol { margin: 0; padding: 14px 16px 16px; list-style: none; background: var(--paper); box-shadow: 4px 5px 0 rgba(150, 70, 84, .3); transform: rotate(1.5deg); font-size: 13px; line-height: 2; }
  .side ol li b { display: inline; font-size: 13px; letter-spacing: 0; margin-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .iconbtn, .chip { transition: none; }
  .sheet__panel, .viewer__note, .toast { animation: none; }
  .shot__ctl { transition: none; }
}
