/* เล่นคู่กับพ่อแม่ · แถบพ่อแม่ (ตัวหนังสือ) ด้านบน + ภาพใหญ่ของลูกด้านล่าง · ขนาดอิงตัวแปรใน stage.css */

[hidden] { display: none !important; }

/* ---- หน้าเริ่ม: พ่อแม่เลือกแบบเล่น ---- */
.duo-modes {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  width: min(100%, 520px);
}
.duo-mode {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 88px;
  padding: var(--s2) var(--s3);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.duo-mode img { flex: 0 0 auto; width: clamp(56px, 11vmin, 88px); height: auto; border-radius: var(--radius-sm); }
.duo-mode-text { display: flex; flex-direction: column; gap: var(--s1); line-height: 1.3; }
.duo-mode-text strong { font-size: clamp(16px, 2.8vmin, 21px); }
.duo-mode-text small { font-size: clamp(13px, 2.2vmin, 16px); color: var(--ink-soft); }
.duo-mode[aria-checked="true"] { border-color: #ffd166; background: #fff8e1; box-shadow: 0 4px 0 rgba(31, 61, 52, .08); }
.duo-mode:active { transform: scale(.98); }

/* ---- แถบพ่อแม่: เล็ก อ่านง่าย แยกสีจากโซนลูก ---- */
.parent-zone {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label label" "clue actions" "tip tip";
  align-items: center;
  gap: var(--s1) var(--s2);
  width: min(100%, 720px);
  padding: var(--s2) var(--s3);
  background: #eef6f2;
  border: 2px dashed #b9d6c8;
  border-radius: var(--radius-sm);
  text-align: left;
}
.parent-zone p { margin: 0; }
.pz-label { grid-area: label; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink-soft); }
.pz-clue { grid-area: clue; font-size: clamp(16px, 2.8vmin, 22px); font-weight: 600; line-height: 1.35; color: var(--ink); }
.pz-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: var(--s1); justify-content: flex-end; }
.pz-tip { grid-area: tip; font-size: clamp(12px, 2vmin, 15px); line-height: 1.4; color: var(--ink-soft); }
.pz-btn {
  min-height: 48px;
  padding: 0 var(--s3);
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: clamp(14px, 2.4vmin, 17px);
  font-weight: 600;
  cursor: pointer;
}
.pz-btn:active { transform: scale(.96); }
.pz-found { min-height: 56px; background: var(--accent); color: #fff; font-size: clamp(17px, 3vmin, 22px); }
.pz-skip { border-color: var(--line); color: var(--ink-soft); font-weight: 400; }
.pz-found.idle-pulse { outline: 4px solid var(--ok); outline-offset: 3px; }

/* ---- โซนลูก ---- */
.duo-pic img { border-radius: var(--radius-sm); }
/* แบบ 2: ภาพที่ลูกเลือกคว่ำลง (ด้านหลังการ์ดลายจุด + เครื่องหมายคำถาม) · ภาพอื่นจางลง */
.duo-pic.flipped { border-color: #ffd166; background: #fff8e1; animation: duo-flip .45s ease both; }
.duo-pic.flipped img { visibility: hidden; }
.duo-pic.flipped::before {
  content: '?';
  position: absolute;
  inset: var(--pick-pad);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: radial-gradient(circle, #ffd166 18%, transparent 19%) 0 0 / 28px 28px, #ffe8a3;
  color: var(--ink);
  font-size: calc(var(--pick-3) * .5);
  font-weight: 600;
  line-height: 1;
}
.duo-pic.away { display: none; }   /* ภาพที่ไม่ได้เลือกหายไป พ่อแม่ต้องทายจากปุ่มคำเท่านั้น */
@keyframes duo-flip {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(0); }
}
.guess-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s2);
  width: min(100%, 640px);
}
.guess-btn {
  flex: 1 1 0;
  min-width: 96px;
  min-height: 64px;
  padding: 0 var(--s2);
  border: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: clamp(18px, 3.2vmin, 26px);
  font-weight: 600;
  cursor: pointer;
}
.guess-btn:active { transform: scale(.96); }
.guess-btn.wrong { opacity: .4; animation: wobble .4s ease; }
.guess-btn.correct { background: #79c36a; border-color: #79c36a; color: #fff; }

/* แบบ 3: ภาพของที่ต้องหาใบใหญ่ใบเดียว */
.hunt-card { cursor: pointer; }
.hunt-card img { width: calc(var(--prompt) * 1.35); border-radius: var(--radius-sm); }
.hunt-card.hello img { animation: duo-hello .6s cubic-bezier(.3, 1.4, .5, 1) both; }
.hunt-card.found { border-color: #79c36a; animation: pop .45s ease; }
@keyframes duo-hello {
  0% { transform: scale(.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* หน้าจบรอบ: ภาพที่เล่นด้วยกันรอบนี้ */
.duo-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: min(92vw, 560px);
}
.duo-tile { padding: var(--s1); background: var(--card); border: 2px solid var(--line); border-radius: var(--radius-sm); }
.duo-tile img { display: block; width: clamp(52px, 11vmin, 88px); height: auto; border-radius: var(--radius-sm); }
#done-screen.active .duo-tile { animation: pop .45s ease; }

@media (prefers-reduced-motion: reduce) {
  .duo-pic.flipped, .hunt-card.hello img, .hunt-card.found, .guess-btn.wrong, #done-screen.active .duo-tile { animation: none; }
}

/* จอแคบแนวตั้ง: ปุ่มพ่อแม่ลงบรรทัดใหม่ใต้คำใบ้ */
@media (max-width: 520px) {
  .parent-zone { grid-template-columns: 1fr; grid-template-areas: "label" "clue" "actions" "tip"; }
  .pz-actions { justify-content: flex-start; }
}
/* แนวตั้ง: ภาพโจทย์ 3 ภาพต้องพอกับแถบพ่อแม่ด้านบน */
@media (orientation: portrait) {
  #play-screen { gap: var(--s3); justify-content: flex-start; }
  #play-screen .choices[data-n="3"] .choice img { width: clamp(88px, min(26vw, 19dvh), 220px); }
}
/* มือถือแนวนอน: แถบพ่อแม่บรรทัดเดียว · ภาพคุมด้วยความสูงจอ */
@media (orientation: landscape) and (max-height: 520px) {
  .duo-modes { flex-direction: row; width: 100%; max-width: 820px; }
  .duo-mode { flex: 1 1 0; flex-direction: column; text-align: center; padding: var(--s1) var(--s2); }
  .duo-mode img { width: clamp(44px, 14dvh, 72px); }
  .duo-mode-text small { display: none; }
  .parent-zone { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "label clue actions"; padding: var(--s1) var(--s2); }
  .pz-tip { display: none; }
  .pz-btn { min-height: 44px; }
  .pz-found { min-height: 48px; }
  #play-screen .choices[data-n="3"] .choice img { width: clamp(80px, 30dvh, 170px); }
  .hunt-card img { width: calc(var(--prompt) * .95); }
  .guess-row { width: auto; flex-direction: column; }
  .guess-btn { min-height: 52px; flex: 0 0 auto; }
  .duo-tile img { width: clamp(44px, 14dvh, 72px); }
}
