/* 숨은그림찾기 놀이 (/play/hidden/): the scene cards, the full-screen board with its tray, the "다 찾았어요" card. site/play_hidden.js */
.ph-head .date { max-width: 46em; }
.ph-tip { margin: 0 0 18px; font-size: 15px; color: #6b5a44; }
.ph-how { margin-top: 10px; }
.ph-how ol { list-style: decimal; padding-left: 1.4em; }
.ph-how ol li + li { margin-top: 8px; }
.ph-how ol li::marker { font-family: var(--display); color: var(--orange, #ff7a1a); }
.ph-online::before { content: "🔎 "; }

/* the picker */
.ph-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 10px 14px; background: #fff; border: 3px solid #f1e3c8; border-radius: 22px; }
.ph-bar img { width: 56px; height: 56px; border-radius: 50%; flex: none; }
.ph-total { margin: 0 auto 0 0; font-family: var(--display); font-size: clamp(17px, 2.4vw, 22px); color: #4a3a28; }
.ph-total::before { content: "★ "; color: #ffb400; }
.ph-lucky { flex: none; min-height: 64px; border: 0; border-radius: 99px; padding: 10px 20px; font: inherit; font-family: var(--display); font-size: 18px;
  background: #ff7a1a; color: #fff; cursor: pointer; box-shadow: 0 3px 0 #d95f0a; }
.ph-lucky:active { transform: translateY(2px); box-shadow: 0 1px 0 #d95f0a; }
.ph-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 10px; }
.ph-chip { flex: 1 1 150px; max-width: 280px; min-height: 64px; border: 3px solid #f1e3c8; border-radius: 20px; padding: 8px 14px; font: inherit; background: #fff; color: #4a3a28;
  cursor: pointer; text-align: left; line-height: 1.25; }
.ph-chip b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; }
.ph-chip small { font-size: 13px; color: #8a7458; }
.ph-chip[aria-checked="true"] { background: #fff3e6; border-color: #ff7a1a; box-shadow: 0 0 0 2px #ff7a1a; }
.ph-chip[data-mode][aria-checked="true"] { background: #f1ebff; border-color: #8e5bd1; box-shadow: 0 0 0 2px #8e5bd1; }
.ph-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 18px 0 28px; }
.ph-card { position: relative; display: block; background: #fff; border: 3px solid #f1e3c8; border-radius: 18px; padding: 8px 8px 10px; text-decoration: none; color: #4a3a28;
  text-align: center; transition: transform .15s, border-color .15s; }
.ph-card:hover, .ph-card:focus-visible { transform: translateY(-3px); border-color: #ff9b4a; }
.ph-thumb { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 10px; background: #fff var(--ph-thumbs) no-repeat;
  background-size: calc(var(--ph-tc) * 100%) calc(var(--ph-tr) * 100%); }
.ph-card b { display: block; margin-top: 6px; font-family: var(--display); font-weight: 400; font-size: 18px; }
.ph-stars { display: block; min-height: 20px; color: #ffb400; font-size: 18px; letter-spacing: 2px; line-height: 20px; }
.ph-card.done { border-color: #cfe8c0; }
.ph-card.done::after { content: attr(data-stamp); position: absolute; top: 22%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg); padding: 6px 14px;
  border: 3px solid #e8453c; border-radius: 12px; color: #e8453c; background: rgba(255, 255, 255, .88); font-family: var(--display); font-size: 17px; white-space: nowrap; }

/* the board: full screen over the page */
html.ph-lock, html.ph-lock body { overflow: hidden; overscroll-behavior: none; }
.ph-ed { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; background: #fff7e6; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; font-family: var(--display); }
.ph-ed[hidden], .ph-win[hidden], .ph-busy[hidden], .ph-pan[hidden], .ph-btn[hidden] { display: none; }
.ph-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border-bottom: 2px solid #f1e3c8; }
.ph-top b { font-weight: 400; font-size: 19px; color: #4a3a28; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ph-btn { flex: none; display: inline-block; border: 0; border-radius: 99px; min-height: 44px; padding: 9px 14px; font: inherit; font-size: 16px; line-height: 1.2; background: #f3ead8; color: #4a3a28;
  cursor: pointer; text-decoration: none; text-align: center; }
.ph-btn:active { transform: scale(.96); }
.ph-ico { min-width: 44px; padding: 6px; font-size: 20px; }
@media (min-width: 701px) and (min-height: 561px) {   /* a tablet: room for bigger buttons at the top */
  .ph-top { padding: 6px 12px; gap: 10px; }
  .ph-btn { min-height: 56px; padding: 10px 18px; font-size: 18px; }
  .ph-ico { min-width: 56px; font-size: 24px; }
  .ph-count { font-size: 22px; padding: 9px 16px; }
}
.ph-count { flex: none; padding: 7px 14px; border-radius: 99px; background: #ff7a1a; color: #fff; font-size: 19px; }
.ph-count::before { content: "🔎 "; }
.ph-main { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 8px; }
.ph-view { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; cursor: pointer; border-radius: 14px; }
.ph-view.pan { cursor: grab; background: #f3ead8; }
.ph-pic { position: absolute; left: 0; top: 0; background: #fff; border-radius: 14px; box-shadow: 0 3px 14px rgba(120, 80, 30, .15); overflow: hidden; will-change: transform; }
.ph-pic.glide { transition: transform .5s ease; }
.ph-pic canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ph-fx { position: absolute; inset: 0; pointer-events: none; }
.ph-fx i { position: absolute; display: block; pointer-events: none; }
.ph-busy { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; font-size: 18px; color: #8a7458; }
.ph-pan { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 99px; background: rgba(74, 58, 40, .82); color: #fff;
  font-size: 14px; pointer-events: none; white-space: nowrap; animation: ph-sway 1.6s ease-in-out infinite; }
@keyframes ph-sway { 50% { transform: translateX(calc(-50% + 10px)); } }

/* on the picture: a wrong tap, a found thing, the hint */
.ph-ripple { width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 4px solid #c9b89c; animation: ph-ripple .6s ease-out forwards; }
@keyframes ph-ripple { from { transform: scale(.3); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }
.ph-ring { width: calc(var(--pw) * var(--d)); height: calc(var(--pw) * var(--d)); min-width: 40px; min-height: 40px; transform: translate(-50%, -50%); border-radius: 50%;
  border: max(4px, calc(var(--pw) * .006)) solid #3fae58; box-shadow: 0 0 0 3px rgba(255, 255, 255, .7), inset 0 0 0 3px rgba(255, 255, 255, .7); animation: ph-pop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes ph-pop { from { transform: translate(-50%, -50%) scale(2); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.ph-spark { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 3px; animation: ph-spark .7s ease-out forwards; }
@keyframes ph-spark { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(200deg) scale(.4); opacity: 0; } }
.ph-hintring { width: calc(var(--pw) * var(--d)); height: calc(var(--pw) * var(--d)); transform: translate(-50%, -50%); border-radius: 50%;
  border: 6px solid #ff7a1a; background: rgba(255, 210, 63, .22); box-shadow: 0 0 0 6px rgba(255, 210, 63, .55), 0 0 26px 10px rgba(255, 170, 40, .5);
  animation: ph-sniff 1.5s cubic-bezier(.3, .7, .3, 1) both, ph-glow .7s ease-in-out 1.5s 4 alternate, ph-fade .5s linear 4.6s forwards; }
.ph-hintring::after { content: ""; position: absolute; left: 50%; top: 0; width: 46px; height: 46px; margin: -30px 0 0 -23px; border-radius: 50%; border: 3px solid #fff;
  background: #fff url(assets/churro_face.webp) center / cover; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
@keyframes ph-sniff { from { transform: translate(-50%, -50%) scale(7); opacity: .2; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes ph-glow { to { box-shadow: 0 0 0 10px rgba(255, 210, 63, .7), 0 0 34px 16px rgba(255, 170, 40, .65); } }
@keyframes ph-fade { to { opacity: 0; } }

/* the tray: what to find, and Churro */
.ph-tray { flex: none; display: flex; flex-direction: column; gap: 8px; width: 204px; min-height: 0; --tile: 90px; }
.ph-ask { flex: none; display: flex; align-items: center; gap: 8px; }
.ph-ask img { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(120, 80, 30, .2); }
.ph-ask p { position: relative; flex: 1; min-width: 0; margin: 0; padding: 8px 10px; border-radius: 16px; background: #fff; color: #4a3a28; font-size: 16px; line-height: 1.25;
  box-shadow: 0 2px 6px rgba(120, 80, 30, .12); display: flex; align-items: center; gap: 8px; }
.ph-ask p::before { content: ""; position: absolute; left: -7px; top: 50%; margin-top: -7px; border: 7px solid transparent; border-left: 0; border-right-color: #fff; }
.ph-ask small { display: block; font-size: 13px; color: #8a7458; }
.ph-obj { display: block; flex: none; width: 100%; aspect-ratio: 1; background: var(--ph-atlas) no-repeat; background-size: 600% 600%; }
.ph-want { width: 64px; height: 64px; animation: ph-bob 1s ease-in-out infinite; }
@keyframes ph-bob { 50% { transform: translateY(-4px) rotate(-4deg); } }
.ph-items { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; }
.ph-item { position: relative; flex: none; width: var(--tile); padding: 4px 4px 3px; border: 3px solid #f1e3c8; border-radius: 18px; background: #fff; font: inherit; color: #4a3a28; cursor: pointer; }
.ph-item .ph-obj { width: calc(var(--tile) - 26px); margin: 0 auto; }
.ph-item small { display: block; font-size: 13px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-item.found { border-color: #9fd68a; background: #eef9e6; cursor: default; }
.ph-item.found .ph-obj { opacity: .45; }
.ph-item.found::after { content: "✓"; position: absolute; right: -6px; top: -6px; width: 30px; height: 30px; border-radius: 50%; background: #3fae58; color: #fff;
  font-size: 20px; line-height: 30px; text-align: center; box-shadow: 0 0 0 3px #fff; animation: ph-tick .4s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes ph-tick { from { transform: scale(0); } to { transform: scale(1); } }
.ph-ed.one .ph-item:not(.found):not(.ask) { opacity: .4; }
.ph-ed.one .ph-item.ask { border-color: #8e5bd1; box-shadow: 0 0 0 3px #cdb8ff; animation: ph-bob 1s ease-in-out infinite; }
.ph-item.wob { animation: ph-wob .5s ease-in-out !important; }
@keyframes ph-wob { 20% { transform: rotate(-7deg); } 50% { transform: rotate(6deg); } 80% { transform: rotate(-3deg); } }
.ph-hint { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 68px; border: 0; border-radius: 99px; padding: 6px 14px 6px 8px; font: inherit; font-size: 18px;
  background: #ffd23f; color: #4a3a28; cursor: pointer; box-shadow: 0 3px 0 #dba800; }
.ph-hint img { width: 54px; height: 54px; border-radius: 50%; border: 3px solid #fff; }
.ph-hint:active { transform: translateY(2px); box-shadow: 0 1px 0 #dba800; }
.ph-hint.nudge { animation: ph-wob .6s ease-in-out 3; }

@media (orientation: landscape) and (max-height: 560px) {   /* a phone on its side */
  .ph-top { padding: 3px 8px; }
  .ph-top b { font-size: 16px; }
  .ph-btn { min-height: 44px; padding: 6px 12px; font-size: 14px; }
  .ph-tray { width: 232px; --tile: 68px; gap: 6px; }
  .ph-ask img { display: none; }
  .ph-ask p { padding: 4px 8px; font-size: 14px; }
  .ph-ask p::before { display: none; }
  .ph-want { width: 40px; height: 40px; }
  .ph-item small { display: none; }
  .ph-item .ph-obj { width: calc(var(--tile) - 18px); }
  .ph-items { gap: 6px; }
  .ph-hint { min-height: 56px; font-size: 16px; }
  .ph-hint img { width: 44px; height: 44px; }
}
@media (orientation: portrait) {
  .ph-main { flex-direction: column; }
  .ph-tray { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; --tile: 84px; }
  .ph-ask { flex: 1 1 200px; order: 1; }
  .ph-hint { order: 2; }
  .ph-items { flex: 1 1 100%; order: 3; }
}
@media (orientation: portrait) and (max-width: 700px) {
  .ph-tray { --tile: 68px; gap: 6px; }
  .ph-items { gap: 6px; }
  .ph-item small { font-size: 12px; }
  .ph-item .ph-obj { width: calc(var(--tile) - 28px); }
  .ph-top b { font-size: 16px; }
  .ph-btn { padding: 8px 11px; font-size: 14px; }
  .ph-hint { min-height: 64px; font-size: 16px; }
  .ph-hint img { width: 48px; height: 48px; }
  .ph-ask p { font-size: 15px; }
  .ph-want { width: 52px; height: 52px; }
}
@media (orientation: portrait) and (min-width: 701px) {
  .ph-tray { --tile: 86px; gap: 10px; padding: 4px 0 8px; }
  .ph-ask p { font-size: 20px; padding: 12px 16px; }
  .ph-ask img { width: 64px; height: 64px; }
  .ph-hint { min-height: 76px; font-size: 21px; padding-right: 22px; }
  .ph-hint img { width: 60px; height: 60px; }
}

/* all found */
.ph-win { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 12px; background: rgba(255, 244, 220, .93); overflow: auto; touch-action: pan-y; }
.ph-win canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ph-win-in { position: relative; width: min(560px, 100%); padding: 16px 18px 20px; border-radius: 28px; background: #fff; text-align: center; box-shadow: 0 8px 30px rgba(120, 80, 30, .22);
  animation: ph-rise .45s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes ph-rise { from { transform: translateY(30px) scale(.9); opacity: 0; } }
.ph-win-in img { display: block; margin: 0 auto; width: min(230px, 46%); height: auto; animation: ph-hop .7s ease-in-out 3; }
@keyframes ph-hop { 50% { transform: translateY(-12px) rotate(-3deg); } }
.ph-win-stars { margin: 2px 0 0; display: flex; justify-content: center; gap: 8px; }
.ph-win-stars i { font-style: normal; font-size: clamp(44px, 9vmin, 64px); line-height: 1; color: #e9dcc3; }
.ph-win-stars i::before { content: "★"; }
.ph-win-stars i.on { color: #ffb400; text-shadow: 0 3px 0 #dba800; animation: ph-star .5s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes ph-star { from { transform: scale(0) rotate(-60deg); } to { transform: scale(1) rotate(0); } }
.ph-win-in h2 { margin: 6px 0 2px; font-weight: 400; font-size: clamp(24px, 5vmin, 34px); color: #4a3a28; }
.ph-win-total { margin: 0 0 14px; font-size: 18px; color: #8a7458; }
.ph-win-total::before { content: "★ "; color: #ffb400; }
.ph-win-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ph-win-bar .ph-btn { min-height: 64px; padding: 12px 20px; font-size: 19px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ph-win-bar .ph-btn.main { flex: 1 1 100%; background: #ff7a1a; color: #fff; font-size: 24px; box-shadow: 0 4px 0 #d95f0a; }
.ph-print::before { content: "🖨 "; }
@media (max-height: 520px) {
  .ph-win-in { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; width: min(720px, 100%); padding: 10px 14px; }
  .ph-win-in img { grid-row: 1 / span 3; width: 150px; }
  .ph-win-bar { grid-column: 1 / -1; margin-top: 8px; }
  .ph-win-bar .ph-btn { min-height: 52px; font-size: 17px; }
  .ph-win-bar .ph-btn.main { flex: 1 1 auto; font-size: 20px; }
  .ph-win-total { margin-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ph-want, .ph-ed.one .ph-item.ask, .ph-pan, .ph-win-in img { animation: none; }
}
