/* 고양이 간식 합치기 — site.css·assets/hall.css 위에 이 페이지에 필요한 것만
   색: 흰 바탕·검정 글자·회색 1개 + 강조색(#8f2f2a, 주 버튼). 그림 외곽선 갈색(--ol)·발바닥 도장색(--stamp)은 간식 그림에 맞춘 색 */
.sn { --ol: #3a2420; --stamp: #b8633a; }
@media (prefers-color-scheme: dark) { .sn { --stamp: #d98a5f; } }

/* 위 글자 링크 (간식 순서는 게임 중에만) */
.sn-top { display: inline-flex; align-items: center; gap: 16px; }
.sn-top button { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--sub); min-height: 48px; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ===== 시작 화면 ===== */
.sn-head { display: flex; align-items: flex-end; gap: 10px; margin-top: 4px; }
.sn-head h1 { flex: 1; font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1.25; }
.sn-head img { width: 84px; height: auto; flex: none; }
.sn-lead { color: var(--body); font-size: 14.5px; margin-top: 6px; line-height: 1.55; }
.sn-h2 { font-size: 15px; font-weight: 700; margin-top: 16px; }
.sn-h2 span { color: var(--sub); font-weight: 400; font-size: 12.5px; margin-left: 4px; }
.sn-h2 em { font-style: normal; }
.sn-order { list-style: none; margin: 6px 0 0; padding: 0; }
.sn-order li { display: flex; align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid var(--line); }
.sn-order .n { width: 16px; flex: none; color: var(--sub); font-weight: 700; font-size: 13px; }
.sn-order .p { position: relative; width: 56px; height: 34px; flex: none; display: flex; justify-content: center; align-items: center; }
.sn-order .p img { display: block; }
.sn-order .p i { position: absolute; right: 0; bottom: -3px; width: 15px; height: 15px; transform: rotate(-14deg); }
.sn-order .p i .paw { width: 15px; height: 15px; fill: var(--stamp); }
.sn-order b { font-size: 15px; font-weight: 600; flex: none; }
.sn-order small { margin-left: auto; color: var(--sub); font-size: 12px; line-height: 1.35; text-align: right; }
.sn-rules { margin: 12px 0 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--body); line-height: 1.6; }
.sn-start .btn { margin-top: 14px; }

/* ===== 게임 판 (고양이 줄 + 통). 설계 화면 390×442를 폭에 맞춰 늘이고 줄임 (app.js가 --s = 배율) =====
   판은 페이지 좌우 여백까지 써서 넓게 (390폭 화면에서 판 390) */
.sn-stage {
  position: relative; width: calc(100% + 48px); margin-left: -24px; aspect-ratio: 390 / 442;
  touch-action: none; overscroll-behavior: contain; outline: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
/* 시작 전·끝난 뒤는 판 위에서도 화면 스크롤 */
.sn-stage.idle { touch-action: pan-y; overscroll-behavior: auto; }
.sn-stage * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sn-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--line); border-radius: 12px; }
.sn-box { position: absolute; left: 1.0256%; top: 38.914%; width: 97.949%; height: auto; pointer-events: none; }
.sn-cat { position: absolute; left: 0; top: .4525%; width: 25.641%; pointer-events: none; will-change: transform; }
.sn-cat img { display: block; width: 100%; height: auto; }
.sn-cv { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sn-bubble {
  position: absolute; top: calc(18px * var(--s, 1)); z-index: 2; pointer-events: none;
  background: #fffdf8; border: 2px solid var(--ol); border-radius: 16px; padding: 6px 12px 8px; text-align: center; min-width: 88px;
}
.sn-bubble::before { content: ""; position: absolute; left: -11px; top: 26px; border: 9px solid transparent; border-right: 11px solid var(--ol); border-left: 0; }
.sn-bubble::after { content: ""; position: absolute; left: -7px; top: 28px; border: 7px solid transparent; border-right: 9px solid #fffdf8; border-left: 0; }
.sn-bubble.lf::before { left: auto; right: -11px; border-right: 0; border-left: 11px solid var(--ol); }
.sn-bubble.lf::after { left: auto; right: -7px; border-right: 0; border-left: 9px solid #fffdf8; }
.sn-bubble small { display: block; font-size: 12px; color: #8b8b8b; line-height: 1.3; }
.sn-bubble span { display: flex; justify-content: center; align-items: center; height: 44px; }
.sn-bubble img { display: block; }

/* 점수 줄 */
.sn-score { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 10px; }
.sn-score small, .sn-end-sc small { display: flex; align-items: center; gap: 4px; color: var(--sub); font-size: 13px; line-height: 1.3; }
.sn .paw { width: 18px; height: 18px; fill: var(--ol); display: block; }
@media (prefers-color-scheme: dark) { .sn-score small .paw, .sn-end-sc small .paw { fill: var(--text); } }
.sn-score b { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.8px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sn-score .best { text-align: right; }
.sn-score .best small { justify-content: flex-end; }
.sn-score .best b { font-size: 20px; color: var(--body); }
.sn-hint { color: var(--sub); font-size: 13px; margin-top: 6px; }

/* 간식 도감 한 줄 (발바닥 도장 = 만들어 본 간식) */
.sn-dex { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.sn-dex p { font-size: 14px; }
.sn-dex p span { color: var(--sub); font-size: 12.5px; margin-left: 4px; }
.sn-dex ol { list-style: none; margin: 8px 0 0; padding: 0; display: flex; align-items: center; justify-content: space-between; }
.sn-dex .c { position: relative; width: 32px; height: 36px; display: flex; align-items: center; justify-content: center; }
.sn-dex .c img { display: block; filter: brightness(0); opacity: .13; }
.sn-dex .c.on img { filter: none; opacity: 1; }
@media (prefers-color-scheme: dark) { .sn-dex .c img { filter: brightness(0) invert(1); opacity: .2; } }
.sn-dex .ar { color: #c8c8c8; font-size: 14px; width: 6px; text-align: center; }
.sn-dex i { position: absolute; right: -6px; bottom: -6px; width: 16px; height: 16px; transform: rotate(-14deg); }
.sn-dex i .paw { width: 16px; height: 16px; fill: var(--stamp); opacity: .9; }
.sn-dex .c.new i { animation: sn-stamp .5s ease-out; }
@keyframes sn-stamp { 0% { transform: rotate(-14deg) scale(2.2); opacity: 0; } 60% { transform: rotate(-14deg) scale(.9); opacity: 1; } 100% { transform: rotate(-14deg) scale(1); } }
@media (prefers-reduced-motion: reduce) { .sn-dex .c.new i { animation: none; } }

/* ===== 끝 화면 ===== */
.sn-end { margin-top: 6px; }
.sn-end-top { display: flex; gap: 14px; align-items: center; }
.sn-end-top img { width: 120px; height: auto; flex: none; }
.sn-end-top h2 { font-size: 24px; font-weight: 700; letter-spacing: -.8px; line-height: 1.35; }
.sn-end-top p { color: var(--sub); font-size: 14px; }
.sn-end-sc { margin-top: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.sn-end-sc > div:first-child > b { display: block; font-size: 34px; font-weight: 700; letter-spacing: -1px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sn-end-sc .r { text-align: right; font-size: 14px; color: var(--body); }
.sn-end-sc .r b { font-weight: 600; color: var(--text); }
.sn-end-sc .r span { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-weight: 600; min-height: 34px; }
.sn-end-sc .r img { display: block; }
.sn-end-note { color: var(--sub); font-size: 13px; margin-top: 4px; }
.sn-end .gr-save { margin-top: 16px; }
.sn-end .sn-links { justify-content: center; }
.sn-end .sn-links button { color: var(--body); text-decoration: underline; text-underline-offset: 3px; font-size: 14.5px; }
/* 저장을 묻는 동안엔 아래 '다시 하기' 큰 버튼 대신 저장 칸 안의 글자 링크 */
.sn-end .gr-save:not([hidden]) ~ .sn-again { display: none; }
.sn-end > .sn-again { margin-top: 18px; }
.sn-end .sn-dex { margin-top: 18px; }

/* ===== 게임 중 '간식 순서' 시트 ===== */
.sn-sheet[hidden] { display: none; }
.sn-sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; justify-content: center; }
.sn-sheet-box { --ol: #3a2420; --stamp: #b8633a; background: var(--bg); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 6px 24px calc(18px + env(safe-area-inset-bottom)); }
@media (prefers-color-scheme: dark) { .sn-sheet-box { --stamp: #d98a5f; } }
.sn-sheet-box .btn { margin-top: 14px; }

@media (max-width: 359px) {
  .wrap.sn { padding-left: 20px; padding-right: 20px; }
  .sn-stage { width: calc(100% + 40px); margin-left: -20px; }
  .sn-bubble { padding: 4px 8px 6px; min-width: 76px; }
  .sn-bubble span { height: 38px; }
  .sn-score b { font-size: 26px; }
  .sn-dex .c { width: 26px; }
  .sn-dex .c img { max-width: 26px; height: auto; }
  .sn-order small { font-size: 11px; }
}

/* 다크모드: 말풍선 테두리가 어두운 바탕에 묻히지 않게 밝게 */
@media (prefers-color-scheme: dark) { .sn-bubble { border-color: #c9a88a; } .sn-bubble::before { border-right-color: #c9a88a; } }
