/* ============================================================
   答題畫面：HUD、插圖、題目卡、七種作答介面
   ============================================================ */
.play-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 2px 0 10px;
}
.play-head__title { min-width: 0; }
.play-head__title h1 { font-size: clamp(1.35rem, 4.8vw, 1.9rem); line-height: 1.25; overflow-wrap: anywhere; }
.play-goal { font-size: .84rem; color: var(--ink-soft); max-width: 46ch; overflow-wrap: anywhere; }

.hud {
  display: grid;
  grid-template-columns: minmax(150px, 1.45fr) minmax(70px, auto) minmax(78px, auto) minmax(150px, 1fr);
  align-items: stretch;
  gap: 8px;
  padding: 9px;
  margin-bottom: 13px;
  background: #fffaf0;
  border: 2px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow-sm);
}
.hud__item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 4px 9px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid #efe4d1;
}
.hud__label {
  font-size: .68rem;
  color: var(--ink-soft);
  letter-spacing: .04em;
  white-space: nowrap;
  overflow-wrap: anywhere;
}
.hud__label b { font-variant-numeric: tabular-nums; color: var(--ink); }
.hud__score b, .hud__combo b {
  font-size: 1.18rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--coral-dark);
}
.hud__combo { background: #fff6dd; border-color: #f0d68a; }
.hud__combo[hidden] { display: none; }
.hud__progress { flex: 1 1 auto; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.dot {
  width: 17px; height: 9px;
  border-radius: 999px;
  background: #e9dfcc;
  transition: background .2s ease, transform .2s ease;
}
.dot.is-current { background: var(--yellow); transform: scaleY(1.25); }
.dot.dot--gold { background: var(--teal); }
.dot.dot--silver { background: #8ec9c3; }
.dot.dot--bronze { background: #d9b57a; }

.timer {
  position: relative;
  height: 25px;
  border-radius: 999px;
  background: #efe6d6;
  overflow: hidden;
  border: 1px solid #e0d3be;
}
.timer__fill {
  position: absolute; inset: 0;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--teal), #79cdc4);
  transition: transform .18s linear, background .2s ease;
}
.timer__text {
  position: relative;
  z-index: 1;
  display: block;
  line-height: 24px;
  text-align: center;
  font-size: .82rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.timer.is-low .timer__fill { background: linear-gradient(90deg, var(--coral-dark), var(--coral)); }
.timer.is-low .timer__text { color: var(--coral-dark); }
.timer.is-done .timer__fill { background: #b9ae9d; }
.timer.is-done .timer__text { color: #5b5248; }

.play-body {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  align-items: start;
  gap: 14px;
}

/* ---------- 插圖 ---------- */
.visual-panel {
  min-width: 0;
  padding: clamp(10px, 2vw, 18px);
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background:
    radial-gradient(circle at 20% 0, rgba(244, 207, 74, .2), transparent 40%),
    #fffaf0;
  box-shadow: var(--shadow-sm);
}
.visual { min-height: 180px; display: grid; place-items: center; }
.visual__inner { width: 100%; max-width: 480px; display: grid; place-items: center; }
.visual__inner--mascot { max-width: 420px; }
.mascot-svg { width: 100%; height: auto; max-height: 240px; }
.mascot-slot { width: 100%; display: grid; place-items: center; }

.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 11px; width: 100%; max-width: 380px; justify-items: center; }
.swatch { display: block; width: min(72px, 100%); aspect-ratio: 1; border-radius: 50%; background: var(--c); border: 4px solid #fff; box-shadow: 0 5px 12px rgba(61, 58, 56, .18), inset 0 -6px 0 rgba(0, 0, 0, .08); }

.shape-grid, .item-grid, .face-grid, .animal-grid, .instrument-grid, .story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(66px, 1fr));
  gap: 10px;
  width: 100%;
  justify-items: center;
}
.shape-cell { display: grid; place-items: center; width: 100%; min-height: 62px; }
.shape-svg { width: min(84px, 100%); height: auto; max-height: 92px; display: block; }
.shape-emoji { font-size: clamp(1.9rem, 7vw, 2.6rem); line-height: 1; }
.item-cell, .animal-cell, .instrument-cell, .story-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 100%; min-height: 76px; padding: 8px 5px;
  border-radius: 13px;
  background: #fff;
  border: 2px solid #efe4d1;
  text-align: center;
  min-width: 0;
}
.item-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.item-emoji, .animal-emoji, .instrument-emoji, .story-emoji { font-size: clamp(1.35rem, 5vw, 1.9rem); line-height: 1.15; }
.item-label, .animal-label, .instrument-label, .story-label { font-size: .78rem; line-height: 1.35; color: var(--ink-soft); overflow-wrap: anywhere; }
.face-grid { grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); }
.face-cell { display: grid; place-items: center; width: 100%; min-height: 70px; background: #fff; border-radius: 50%; border: 2px solid #efe4d1; }
.face-emoji { font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1; }

.beat-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.beat-cell {
  display: grid; place-items: center;
  width: clamp(42px, 11vw, 58px); aspect-ratio: 1;
  border-radius: 15px;
  background: #fff;
  border: 3px solid var(--line);
}
.beat-cell--clap { border-color: var(--teal); background: #eafaf5; }
.beat-cell--rest { border-color: #cfc4b2; background: #f2ebdd; }
.beat-cell--strong { border-color: var(--coral); background: #ffece7; transform: scale(1.06); }
.beat-icon { font-size: clamp(1.2rem, 4.4vw, 1.7rem); line-height: 1; }

.rainbow-svg, .house-svg, .butterfly-svg, .heart-svg, .paint-scene { width: 100%; height: auto; max-height: 270px; display: block; }
.rainbow-svg { max-width: 430px; }
.house-svg { max-width: 390px; }
.butterfly-svg { max-width: 340px; }
.heart-svg { max-width: 250px; }
.paint-scene { max-width: 420px; border-radius: 18px; }

.color-mix { display: flex; align-items: center; justify-content: center; gap: clamp(6px, 2vw, 14px); flex-wrap: wrap; }
.mix-blob {
  display: grid; place-items: center;
  width: clamp(62px, 17vw, 92px); aspect-ratio: 1;
  border-radius: 46% 54% 51% 49% / 52% 46% 54% 48%;
  background: var(--c);
  border: 4px solid #fff;
  box-shadow: 0 6px 14px rgba(61, 58, 56, .18);
  color: #fff;
  font-size: .9rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.mix-plus { font-size: 1.5rem; font-weight: 900; color: var(--ink-soft); }
.mix-unknown {
  display: grid; place-items: center;
  width: clamp(58px, 15vw, 82px); aspect-ratio: 1;
  border-radius: 50%;
  border: 4px dashed #bfae93;
  color: #a08e72;
  font-size: 1.9rem;
  font-weight: 900;
  background: #fffdf8;
}

.symmetry-wrap { display: grid; grid-template-columns: 1fr auto 1.35fr; gap: 8px; align-items: center; width: 100%; }
.symmetry-left { display: grid; place-items: center; }
.symmetry-axis { width: 0; height: 92%; border-left: 3px dashed #8a7d6d; min-height: 90px; }
.symmetry-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.sym-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.sym-opt b { font-size: .65rem; color: var(--ink-soft); white-space: nowrap; }
.wing-svg { width: 100%; height: auto; max-height: 74px; }

.body-svg { width: min(260px, 100%); height: auto; max-height: 280px; }
.body-markers text { font-size: 13px; font-weight: 800; fill: var(--ink); }
.body-markers circle { stroke: #fff; stroke-width: 2; }

.story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.story-cell { min-height: 70px; }
.story-label { word-break: break-word; }

/* ---------- 題目與作答 ---------- */
.qa-panel { min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.question-card {
  padding: 13px 15px 15px;
  background: var(--cream-2);
  border: 2px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.question-card.is-right,
.question-card.is-solved { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47, 156, 149, .18); }
.question-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.tag {
  display: inline-block; padding: 2px 9px;
  border-radius: 999px;
  background: #fff1cf;
  color: #8a6412;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
}
.q-index { font-size: .72rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.question-card__prompt {
  font-size: clamp(1.08rem, 3.6vw, 1.28rem);
  font-weight: 800;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.question-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.question-actions .btn { flex: 0 1 auto; }

.hint-box {
  padding: 10px 13px;
  border-radius: 13px;
  background: #fff6d9;
  border: 2px solid #ecd28a;
  font-size: .9rem;
  overflow-wrap: anywhere;
}
.hint-box[hidden] { display: none; }
.hint-box__line { display: flex; gap: 6px; align-items: flex-start; }

.answer-area { min-width: 0; }
.answer-area[data-ui="choice"] { margin-top: 1px; }
.answer-area[data-ui="paint"] { margin-top: 1px; }

.choices { display: grid; grid-template-columns: 1fr; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 9px 13px;
  text-align: left;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.choice:hover { border-color: var(--teal); transform: translateY(-1px); }
.choice__key {
  display: grid; place-items: center;
  width: 27px; height: 27px; flex: none;
  border-radius: 50%;
  background: #f3ead9;
  color: var(--ink-soft);
  font-size: .78rem;
  font-weight: 900;
}
.choice__text { min-width: 0; overflow-wrap: anywhere; font-size: 1.05rem; line-height: 1.4; }
.choice.is-wrong { background: #ffe8e2; border-color: #e8a18f; opacity: .8; }
.choice.is-right { background: #e9faf4; border-color: var(--teal); }
.choice.is-right .choice__key { background: var(--teal); color: #fff; }

.num-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 330px; }
.num-key {
  min-height: 54px;
  border-radius: 13px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 1.28rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.num-key:hover { border-color: var(--teal); transform: translateY(-1px); }
.num-key.is-wrong { background: #ffe8e2; border-color: #e8a18f; }
.num-key.is-right { background: #e9faf4; border-color: var(--teal); }
.answer-note { margin-top: 7px; font-size: .88rem; color: var(--ink-soft); overflow-wrap: anywhere; }

.tap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tap-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 86px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  overflow-wrap: anywhere;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.tap-card:hover { border-color: var(--teal); transform: translateY(-1px); }
.tap-card.is-selected { border-color: var(--coral); background: #fff0eb; box-shadow: 0 0 0 3px rgba(232, 80, 58, .13); }
.tap-card.is-right { border-color: var(--teal); background: #e9faf4; }
.tap-emoji { font-size: 1.9rem; line-height: 1.1; }
.tap-label { font-size: .95rem; font-weight: 700; line-height: 1.35; }
.tap-dot { display: block; width: 48px; height: 48px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .16); }
.tap-card .shape-svg { max-height: 62px; }

.answer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.answer-count { font-size: .76rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.answer-bar .btn { flex: 0 1 auto; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.match-col { display: flex; flex-direction: column; gap: 7px; }
.match-item {
  min-height: 50px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  overflow-wrap: anywhere;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.match-item--right { background: #fff8ec; }
.match-item:hover { border-color: var(--teal); }
.match-item.is-selected { border-color: var(--coral); background: #fff0eb; }
.match-item.is-matched { border-color: var(--teal); background: #e9faf4; color: var(--teal-dark); }
.match-item.is-wrong { border-color: #e8a18f; background: #ffe8e2; }
.match-item.is-right { border-color: var(--teal); background: #e9faf4; }

.order-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 9px; }
.order-slot {
  display: flex; align-items: center; gap: 7px;
  min-height: 46px;
  padding: 6px 9px;
  border-radius: 12px;
  border: 2px dashed #cdbfa8;
  background: #fbf5e9;
  text-align: left;
  overflow-wrap: anywhere;
}
.order-slot.is-filled { border-style: solid; border-color: var(--teal); background: #eefaf6; }
.order-slot.is-right { border-color: var(--teal); background: #e9faf4; }
.order-slot__num { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: #e7dcc8; font-size: .68rem; font-weight: 900; }
.order-slot__text { font-size: .95rem; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.order-pool { display: flex; flex-wrap: wrap; gap: 7px; }
.order-item {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: .95rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  transition: transform .12s ease, border-color .15s ease;
}
.order-item:hover { border-color: var(--teal); transform: translateY(-1px); }
.order-item.is-used { opacity: .42; }

.rhythm-slots { display: flex; gap: 5px; justify-content: center; margin-bottom: 9px; }
.rhythm-slot {
  display: grid; place-items: center;
  flex: 1 1 0; min-width: 34px; max-width: 62px;
  aspect-ratio: 1;
  border-radius: 11px;
  border: 2px dashed #cdbfa8;
  background: #fbf5e9;
  font-size: .72rem;
  color: var(--ink-soft);
  font-weight: 800;
}
.rhythm-slot.is-clap { border-style: solid; border-color: var(--teal); background: #e9faf4; font-size: 1.1rem; }
.rhythm-slot.is-rest { border-style: solid; border-color: #c6bba7; background: #f0e8d9; font-size: 1.1rem; }
.rhythm-slot.is-demo { outline: 3px solid var(--coral); outline-offset: 1px; }
.rhythm-slot.is-right { border-color: var(--teal); background: #dff7ee; }
.rhythm-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rhythm-key {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 62px;
  border-radius: 15px;
  border: 3px solid var(--line);
  background: #fff;
  font-size: 1rem;
}
.rhythm-key span { font-size: 1.5rem; }
.rhythm-key--clap { border-color: var(--teal); background: #eefaf6; }
.rhythm-key--rest { border-color: #c6bba7; background: #f5eee1; }
.rhythm-key:active { transform: scale(.98); }

.paint-wrap { display: flex; flex-direction: column; gap: 10px; }
.paint-palette { display: flex; flex-wrap: wrap; gap: 7px; }
.paint-swatch {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 44px;
  padding: 5px 11px 5px 6px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: .82rem;
  font-weight: 800;
}
.paint-swatch__dot { width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.paint-swatch.is-selected { border-color: var(--coral); background: #fff0eb; box-shadow: 0 0 0 3px rgba(232, 80, 58, .12); }
.paint-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 330px; }
.paint-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px dashed #c6bba7;
  background: #fffdf8;
  overflow: hidden;
}
.paint-cell::after {
  content: "＋";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #b9aa92;
  font-size: 1.1rem;
  pointer-events: none;
}
.paint-cell__fill { position: absolute; inset: 0; background: var(--c, transparent); border-radius: 50%; transform: scale(0); transition: transform .18s ease; }
.paint-cell.is-painted { border-style: solid; border-color: #b98a55; }
.paint-cell.is-painted .paint-cell__fill { transform: scale(1); }
.paint-cell.is-painted::after { content: none; }
.paint-counts { display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: .78rem; color: var(--ink-soft); }
.paint-count { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.paint-count i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); border: 1px solid #fff; box-shadow: 0 0 0 1px #d6c8b3; }
.paint-count b { color: var(--ink); font-variant-numeric: tabular-nums; }

.explain-box {
  padding: 13px 15px;
  border-radius: 15px;
  background: #eef8ff;
  border: 2px solid #b8d9ee;
  overflow-wrap: anywhere;
}
.explain-box[hidden] { display: none; }
.explain-box h2 { font-size: 1rem; color: var(--blue); margin-bottom: 4px; }
.explain-box p { font-size: .92rem; margin-bottom: 10px; }

.is-shake { animation: shake .35s ease; }
.question-card__prompt--long { line-height: 1.45; }

@media (min-width: 560px) {
  .choices { grid-template-columns: 1fr 1fr; }
  .tap-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .play-body { grid-template-columns: 1fr; }
  .visual { min-height: 150px; }
  .visual__inner { max-width: 440px; }
}
@media (max-width: 860px) {
  .hud { grid-template-columns: 1fr 1fr; }
  .hud__timer { grid-column: 1 / -1; }
}
@media (max-width: 430px) {
  .visual { min-height: 100px; }
  .visual-panel { padding: 8px; }
  .butterfly-svg { width: auto; height: 110px; max-width: 100%; }
  .heart-svg { width: auto; height: 110px; max-width: 100%; }
  .choice { min-height: 48px; }
  .hud { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, 1.2fr); gap: 5px; padding: 6px; }
  .hud__timer, .hud__progress { grid-column: auto; }
  .hud__combo { grid-column: 1 / -1; }
  .hud__item { padding: 3px 6px; }
  .hud__score b, .hud__combo b { font-size: 1.02rem; }
  .hud__label { font-size: .68rem; }
  .dot { width: 14px; height: 8px; }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice { padding: 6px 10px; }
  .play-goal { font-size: .8rem; }
  .order-slots { grid-template-columns: 1fr 1fr; }
  .tap-card { min-height: 78px; }
}
@media (max-width: 340px) {
  .hud { grid-template-columns: 1fr; }
  .hud__timer, .hud__progress { grid-column: auto; }
  .paint-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .symmetry-wrap { grid-template-columns: 1fr auto 1.2fr; }
}
