/* 노리도장 놀이터 전용 (js/play-stamp.js). 공용 style.css는 건드리지 않아요. */
.ps { padding-top: 40px; }
.ps-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.ps-tabs button { border: 2px solid #f1d9d9; background: #fff; border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.ps-tabs button[aria-pressed="true"] { background: #e8616b; border-color: #e8616b; color: #fff; }
.ps-panel { background: #fff; border-radius: 20px; padding: 16px; box-shadow: 0 4px 18px rgba(0,0,0,.06); }
.ps-panel[hidden] { display: none; }
.ps-help { margin: 0 0 12px; color: #555; font-size: 15px; }

/* 1. 도장 놀이판 */
.ps-board { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.ps-board > * { min-width: 0; } /* 통합(홈페이지팀): 그림판 캔버스가 휴대폰 화면 밖으로 넓어지지 않게 */
@media (min-width: 860px) { .ps-board { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.ps-paper { position: relative; border-radius: 14px; overflow: hidden; background: #fffdf8; border: 2px dashed #ead9c6; touch-action: none; }
.ps-paper canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.ps-ctrl h3 { font-size: 15px; margin: 10px 0 6px; }
.ps-sets { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-sets button { border: 1px solid #ddd; background: #f7f7f7; border-radius: 10px; padding: 7px 11px; font: inherit; font-size: 14px; cursor: pointer; }
.ps-sets button[aria-pressed="true"] { background: #333; color: #fff; border-color: #333; }
.ps-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 214px; overflow-y: auto; padding: 2px; }
.ps-key { aspect-ratio: 1; border: 2px solid #e5e5e5; border-radius: 10px; background: linear-gradient(#fafafa, #eee); font: inherit; font-size: 20px; font-weight: 700; cursor: pointer; display: grid; place-items: center; padding: 0; }
.ps-key[aria-pressed="true"] { border-color: #e8616b; background: #fff0f1; transform: translateY(-2px); }
.ps-inks { display: flex; gap: 8px; flex-wrap: wrap; }
.ps-ink { width: 36px; height: 36px; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 0 0 1px #ccc; cursor: pointer; }
.ps-ink[aria-pressed="true"] { box-shadow: 0 0 0 3px #333; }
.ps-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ps-acts button, .ps-btn { border: 0; border-radius: 12px; padding: 11px 15px; font: inherit; font-weight: 700; background: #f3eee8; cursor: pointer; }
.ps-acts .ps-main, .ps-btn.ps-main { background: #e8616b; color: #fff; }
.ps-size { width: 100%; }

/* 2. 첫소리 도장 찾기 */
.ps-quiz { text-align: center; }
/* 카드: 휴대폰(375px)에서도 한 줄로, 가로로 넘치지 않게 */
.ps-q-card { display: inline-flex; align-items: center; justify-content: center; gap: clamp(10px, 3vw, 18px); max-width: 100%; box-sizing: border-box;
  background: #fff7ef; border-radius: 18px; padding: 14px clamp(14px, 4vw, 24px); margin: 4px 0 14px; }
.ps-q-pic { font-size: clamp(44px, 13vw, 64px); line-height: 1; flex: 0 0 auto; }
/* 낱말: 사파리가 한글을 글자마다 줄바꿈하지 않게 nowrap + keep-all */
.ps-q-word { font-size: clamp(34px, 10.5vw, 46px); font-weight: 800; line-height: 1; display: inline-flex; align-items: center; flex: 0 0 auto;
  white-space: nowrap; word-break: keep-all; color: #2a2a2a; }
.ps-q-rest { white-space: nowrap; letter-spacing: .02em; }
/* 첫 글자 한 칸(1em 정사각형) = 빈칸 + 모음 획 */
.ps-q-syl { position: relative; display: inline-block; flex: 0 0 auto; width: 1.04em; height: 1em; margin-right: .02em; }
.ps-q-blank { position: absolute; box-sizing: border-box; border: max(3px, .075em) dashed #e8616b; border-radius: .1em; background: #fff; }
.ps-q-bar, .ps-q-tick { position: absolute; background: currentColor; border-radius: .02em; }
/* ㅏ: 빈칸 왼쪽 + 세로획 + 오른쪽 짧은 획 */
.ps-v-a .ps-q-blank { left: .02em; top: .06em; width: .6em; height: .88em; }
.ps-v-a .ps-q-bar { left: .7em; top: .04em; width: .1em; height: .92em; }
.ps-v-a .ps-q-tick { left: .8em; top: .45em; width: .2em; height: .1em; }
/* ㅣ: 빈칸 왼쪽 + 세로획 */
.ps-v-i .ps-q-blank { left: .04em; top: .06em; width: .66em; height: .88em; }
.ps-v-i .ps-q-bar { left: .82em; top: .04em; width: .1em; height: .92em; }
.ps-v-i .ps-q-tick { display: none; }
/* ㅗ: 빈칸 위 + 아래 가로획 + 가운데 짧은 세로획 */
.ps-v-o .ps-q-blank { left: .12em; top: 0; width: .8em; height: .54em; }
.ps-v-o .ps-q-tick { left: .47em; top: .58em; width: .1em; height: .2em; }
.ps-v-o .ps-q-bar { left: .06em; top: .78em; width: .92em; height: .1em; }
/* 맞히면: 완성 글자를 도장처럼 */
.ps-q-syl.is-done { width: auto; height: auto; }
.ps-q-ink { display: inline-block; padding: 0 .06em; border: max(2px, .06em) solid currentColor; border-radius: .14em; line-height: 1.1; transform: rotate(-4deg); opacity: .92; }
.ps-q-choices { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ps-q-choices .ps-key { width: 72px; height: auto; flex-basis: auto; aspect-ratio: 1; font-size: 34px; }
.ps-q-choices .ps-key.is-wrong { animation: ps-shake .35s; border-color: #bbb; opacity: .5; }
.ps-q-msg { min-height: 28px; font-weight: 700; margin: 12px 0 4px; }
.ps-q-stars { font-size: 22px; letter-spacing: 2px; min-height: 30px; }
@keyframes ps-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.ps-stamped { animation: ps-pop .28s ease-out; }
@keyframes ps-pop { 0% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* 진짜 노리도장 모양: 분홍 투명 사각 도장 (윗뚜껑 + 몸통 + 흰 글자) */
.ps-key { position: relative; border: 0; padding-top: 8%; line-height: 1; border-radius: 9px; color: #fff; text-shadow: 0 1px 2px rgba(150, 40, 60, .45);
  background: linear-gradient(180deg, #f7b9c3 0 22%, #e98a9a 22% 26%, #f0a2af 26% 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55), inset 0 -6px 0 rgba(200, 70, 90, .22), 0 3px 0 #d47586, 0 5px 10px rgba(200, 80, 100, .18); }
.ps-key[aria-pressed="true"] { background: linear-gradient(180deg, #f39aa8 0 22%, #d9667a 22% 26%, #e07a8c 26% 100%); transform: translateY(2px); box-shadow: inset 0 0 0 2px #fff, 0 1px 0 #c55c70, 0 0 0 3px #e8616b; }
.ps-key:disabled { cursor: default; }
.ps-q-choices .ps-key.is-wrong { filter: grayscale(1); }

/* 3. 오늘 내 마음 도장 */
.ps-feels { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px 8px; }
.ps-feel { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 13px; font-weight: 700; color: #444; cursor: pointer; display: grid; justify-items: center; gap: 8px; }
.ps-feel-stamp { position: relative; width: 66px; height: 66px; border-radius: 12px; display: grid; place-items: center; padding-top: 10px;
  background: linear-gradient(180deg, #f7b9c3 0 20%, #e98a9a 20% 24%, #f3b0bb 24% 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6), inset 0 -7px 0 rgba(200, 70, 90, .2), 0 4px 0 #d47586, 0 7px 12px rgba(200, 80, 100, .18); transition: transform .15s; }
.ps-feel-stamp i { font-style: normal; font-size: 32px; line-height: 1; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .6)); }
.ps-feel:hover .ps-feel-stamp { transform: translateY(-2px); }
.ps-feel[aria-pressed="true"] .ps-feel-stamp { transform: translateY(3px); box-shadow: inset 0 0 0 2px #fff, 0 1px 0 #c55c70, 0 0 0 3px #e8616b; }
.ps-feel[aria-pressed="true"] { color: #d24b57; }
.ps-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 16px 0 8px; }
.ps-day { border: 2px solid #f0e6dc; border-radius: 12px; min-height: 92px; padding: 6px 2px; text-align: center; background: #fffdf8; font-size: 12px; cursor: pointer; font-family: inherit; }
.ps-day b { display: block; color: #888; }
.ps-day .ps-day-mark { display: block; font-size: 30px; margin: 4px 0 2px; }
.ps-day .ps-day-mark:not(:empty) { width: 1.45em; height: 1.45em; margin: 4px auto 2px; display: grid; place-items: center; border: 2px solid rgba(226, 59, 59, .75); border-radius: 50%; transform: rotate(-6deg); }
.ps-day.is-today { border-color: #e8616b; }
.ps-talk { background: #f6f9ff; border-radius: 12px; padding: 12px 14px; font-size: 15px; margin-top: 10px; }
.ps-note { font-size: 13px; color: #888; margin-top: 10px; }

@media (max-width: 859px) {
  /* 휴대폰: 도장 고르기를 종이 위로, 도장 줄은 옆으로 넘겨요 */
  .ps-ctrl { order: -1; }
  .ps-keys { display: flex; overflow-x: auto; overflow-y: hidden; max-height: none; padding-bottom: 6px; }
  .ps-key { flex: 0 0 46px; height: 46px; }
  .ps-ctrl h3 { margin: 8px 0 4px; }
}
@media (max-width: 420px) {
  .ps-panel { padding: 12px; }
  .ps-q-choices .ps-key { width: 62px; height: auto; flex-basis: auto; font-size: 28px; }
  .ps-day { min-height: 76px; font-size: 11px; }
  .ps-day .ps-day-mark { font-size: 22px; }
  .ps-feel-stamp { width: 58px; height: 58px; }
  .ps-feel-stamp i { font-size: 28px; }
}

@media print {
  body * { visibility: hidden; }
  .ps-print, .ps-print * { visibility: visible; }
  .ps-print { position: absolute; left: 0; top: 0; width: 100%; }
  .ps-print .ps-acts, .ps-print .ps-feels, .ps-print .ps-help { display: none; }
}

/* 실제 마음 도장 그림 (images/stamp-feel) */
.ps-face { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.ps-key .ps-face { width: 78%; height: 78%; }
.ps-feel span { width: 46px; height: 46px; margin: 0 auto 6px; }
.ps-day .ps-day-mark { width: 34px; height: 34px; margin: 6px auto 4px; }
@media (max-width: 420px) { .ps-day .ps-day-mark { width: 26px; height: 26px; } }

/* 놀이터 위쪽 사진: 노리도장 4가지 (로고가 잘리지 않게 사진 전체를 보여 줘요) */
.pg-photo.ps-hero { aspect-ratio: auto; background: #fff; display: flex; flex-direction: column; }
.ps-hero-pics { aspect-ratio: 1 / 1; max-height: 420px; }
.ps-hero-pics img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ps-hero-pics img[hidden] { display: none; }
.ps-hero-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 10px; background: #fff; }
.ps-hero-chips button { border: 2px solid #eee; background: #fff; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.ps-hero-chips button[aria-pressed="true"] { background: #333; border-color: #333; color: #fff; }

/* 마음 도장: 분홍 도장 틀(홈페이지팀) 안에 실제 도장 그림(노리도장 PM)을 함께 */
.ps-feel .ps-feel-stamp { width: 66px; height: 66px; margin: 0; }
.ps-feel-stamp i { display: block; width: 42px; height: 42px; }
.ps-day .ps-day-mark:not(:empty) { padding: 4px; box-sizing: border-box; }
@media (max-width: 420px) {
  .ps-feel .ps-feel-stamp { width: 58px; height: 58px; }
  .ps-feel-stamp i { width: 36px; height: 36px; }
}

/* 도장 칸 안 글자·그림을 몸통(윗뚜껑 아래) 가운데에 (1125 수정: 사파리에서 그림이 아래로 잘리던 문제) */
/* 윗뚜껑(26%) 줄 + 몸통 줄로 나눠, 글자는 몸통 줄 가운데에 와요. (퍼센트 padding은 부모 폭 기준이라 쓰지 않아요) */
.ps-key { box-sizing: border-box; padding: 0; overflow: hidden; line-height: 1; grid-template-rows: 26% minmax(0, 1fr); place-items: center; }
.ps-key::before { content: ""; }
.ps-key .ps-face { position: absolute; left: 50%; top: 63%; width: 56%; height: 56%; transform: translate(-50%, -50%); }
