/* ============================================================
   遊戲進行畫面：HUD、計時器、題目、五種互動、回饋與解說
   ============================================================ */
.screen-play { width: min(940px, 100%); margin: 0 auto; }
.play-hud {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 253, 244, .94);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.hud-back { width: 44px; height: 44px; }
.hud-level { min-width: 0; line-height: 1.25; }
.hud-kicker { display: block; color: var(--leaf-dark); font-size: .7rem; font-weight: 900; letter-spacing: .1em; }
.hud-level strong { display: block; font-family: var(--font-round); font-size: clamp(.92rem, 2.3vw, 1.05rem); overflow-wrap: anywhere; }
.hud-stats { display: flex; align-items: stretch; gap: 4px; }
.hud-stat { display: grid; justify-items: center; min-width: 60px; padding: 3px 6px; background: var(--paper-2); border-radius: 9px; }
.hud-stat span { font-size: .62rem; color: var(--ink-soft); font-weight: 700; line-height: 1.3; }
.hud-stat strong { font-family: var(--font-round); font-size: .96rem; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-stat.is-hot { background: var(--sun-light); }
.hud-stat.is-hot strong { color: #8a5a0d; }

.timer-wrap { display: flex; align-items: center; gap: 9px; margin: 9px 2px 11px; }
.timer-track { position: relative; flex: 1 1 auto; height: 13px; background: #ded9c4; border: 1px solid rgba(34, 55, 47, .18); border-radius: 999px; overflow: hidden; }
.timer-fill { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #5cb37f, #8fca8a); border-radius: inherit; transition: width .15s linear, background .25s; }
.timer-fill.is-low { background: linear-gradient(90deg, #d47a50, #f0b94d); }
.timer-fill.is-critical { background: linear-gradient(90deg, #b65c6b, #d97a7a); }
.timer-text { flex: 0 0 auto; min-width: 52px; text-align: right; font-size: .78rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.timer-text.is-low { color: #a54a35; }

.question-card {
  padding: clamp(14px, 2.5vw, 24px);
  background: rgba(255, 253, 244, .97);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.q-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.q-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  background: var(--moss);
  color: var(--leaf-dark);
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .04em;
}
.question-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.q-prompt {
  margin: 10px 0 12px;
  font-size: clamp(1.12rem, 2.7vw, 1.55rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.q-visual {
  width: 100%;
  min-height: 120px;
  background: linear-gradient(160deg, #f7f4e4, #eef5e4);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.q-visual .vz { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.visual-caption { margin: 4px 0 0; text-align: center; font-size: .76rem; line-height: 1.45; color: var(--ink-soft); }
.q-visual.is-highlight { animation: visual-glow .6s ease-out; }

/* SVG 插圖共用文字 */
.vz-label { font-family: var(--font); font-size: 19px; font-weight: 800; fill: #243b32; }
.vz-sub { font-family: var(--font); font-size: 15px; font-weight: 600; fill: #566b60; }
.tap-label { font-family: var(--font); font-size: 16px; font-weight: 800; fill: #243b32; pointer-events: none; }
.tap-target { cursor: pointer; }
.tap-hit { fill: rgba(255, 255, 255, .02); stroke: transparent; stroke-width: 3; transition: fill .15s, stroke .15s; }
.tap-target:hover .tap-hit, .tap-target:focus-visible .tap-hit { fill: rgba(240, 185, 77, .16); stroke: #b98317; }
.tap-target:focus { outline: none; }
.tap-target:focus-visible { outline: none; }
.tap-target:focus-visible .tap-hit { stroke: #176d9b; stroke-dasharray: 7 5; }
.tap-target.is-picked .tap-hit { fill: rgba(47, 125, 91, .2); stroke: var(--leaf); }
.tap-target.is-wrong .tap-hit { fill: rgba(182, 92, 107, .22); stroke: var(--rose); }
.tap-target.is-correct .tap-hit { fill: rgba(47, 125, 91, .26); stroke: var(--leaf); }

.q-hint {
  margin-top: 10px;
  padding: 10px 13px;
  background: #fff4cf;
  border: 1.5px dashed #c79a32;
  border-radius: 11px;
  font-size: .9rem;
  line-height: 1.6;
}
.q-answer { margin-top: 12px; }
.q-submit-row { display: flex; justify-content: flex-end; margin-top: 12px; }

/* 選擇題 */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 9px 12px;
  background: #fff;
  border: 1.5px solid rgba(34, 55, 47, .22);
  border-radius: 13px;
  text-align: left;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: 0 2px 0 rgba(34, 55, 47, .1);
  transition: transform .12s, background .12s, border-color .12s;
}
.choice:hover { background: #f6f9e9; border-color: var(--leaf); transform: translateY(-1px); }
.choice-key {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  background: var(--paper-2);
  border-radius: 8px;
  color: var(--ink-soft);
  font-family: var(--font-round);
  font-size: .9rem;
  font-weight: 900;
}
.choice-text { min-width: 0; overflow-wrap: anywhere; }
.choice.is-correct { background: #dff0cb; border-color: var(--leaf); box-shadow: 0 0 0 2px rgba(47, 125, 91, .2); }
.choice.is-correct .choice-key { background: var(--leaf); color: #fff; }
.choice.is-wrong { background: #fbe1dd; border-color: var(--rose); }
.choice.is-wrong .choice-key { background: var(--rose); color: #fff; }
.choice.is-dim { opacity: .55; }
.choice:disabled { opacity: .75; }

/* 數一數 */
.count-panel { display: grid; justify-items: center; gap: 10px; padding: 12px; background: #f5f1df; border: 1.5px solid var(--line); border-radius: 16px; }
.count-label { font-size: .82rem; color: var(--ink-soft); font-weight: 700; }
.count-control { display: flex; align-items: center; gap: clamp(10px, 4vw, 24px); }
.count-btn {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  font-size: 1.7rem;
  font-weight: 900;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(34, 55, 47, .14);
}
.count-btn:hover { background: var(--moss); }
.count-btn:active { transform: translateY(2px); box-shadow: none; }
.count-value {
  min-width: 128px;
  padding: 5px 16px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 13px;
  text-align: center;
  font-family: var(--font-round);
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 900;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.count-value small { font-size: .48em; margin-left: 3px; color: var(--ink-soft); }
.count-range { font-size: .74rem; color: var(--ink-soft); }

/* 連連看 */
.match-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.match-col { display: grid; gap: 7px; align-content: start; }
.match-col-title { margin: 0; font-size: .74rem; font-weight: 900; color: var(--ink-soft); letter-spacing: .06em; }
.match-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 48px;
  padding: 7px 10px;
  text-align: left;
  background: #fff;
  border: 1.5px solid rgba(34, 55, 47, .2);
  border-radius: 11px;
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.3;
}
.match-btn:hover { border-color: var(--leaf); background: #f7faee; }
.match-btn.is-active { border-color: var(--leaf); background: #e6f3d4; box-shadow: 0 0 0 2px rgba(47, 125, 91, .18); }
.match-btn.is-linked { background: #eef6f8; border-color: var(--sky); }
.match-btn.is-used { background: #e7e3d4; color: #7e7764; border-style: dashed; }
.match-pair { display: block; font-size: .72rem; color: var(--leaf-dark); font-weight: 800; overflow-wrap: anywhere; }
.match-arrow { flex: 0 0 auto; color: var(--ink-soft); font-weight: 900; }
.match-help { margin: 8px 0 0; font-size: .75rem; color: var(--ink-soft); }

/* 排序 */
.order-help { margin: 0 0 8px; font-size: .78rem; color: var(--ink-soft); }
.order-list { display: grid; gap: 6px; min-height: 58px; padding: 7px; background: #f5f1df; border: 1.5px dashed rgba(34, 55, 47, .3); border-radius: 12px; }
.order-empty { margin: 0; padding: 8px; text-align: center; font-size: .8rem; color: #8c8470; }
.order-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 9px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  text-align: left;
  font-weight: 700;
  font-size: .9rem;
}
.order-item:hover { border-color: var(--rose); background: #fff6f4; }
.order-index { display: grid; place-items: center; flex: 0 0 auto; width: 25px; height: 25px; background: var(--moss); border-radius: 7px; font-size: .76rem; font-weight: 900; }
.order-pool { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.order-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 11px;
  background: #fff;
  border: 1.5px solid rgba(34, 55, 47, .22);
  border-radius: 999px;
  font-weight: 700;
  font-size: .88rem;
}
.order-chip:hover { background: #eef6df; border-color: var(--leaf); }
.order-chip .plus { color: var(--leaf); font-weight: 900; }

/* 回饋與解說 */
.feedback {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  animation: feedback-in .2s ease-out;
}
.feedback.is-good { background: #e3f4d4; border-color: rgba(47, 125, 91, .42); }
.feedback.is-bad { background: #fbe3df; border-color: rgba(182, 92, 107, .4); }
.feedback.is-time { background: #fff1ca; border-color: rgba(190, 135, 32, .45); }
.feedback-icon { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: #fff; font-size: 1.05rem; font-weight: 900; }
.feedback.is-good .feedback-icon { color: var(--leaf); }
.feedback.is-bad .feedback-icon { color: var(--rose); }
.feedback.is-time .feedback-icon { color: #9a6c13; }
.feedback strong { display: block; font-size: .95rem; }
.feedback p { margin: 1px 0 0; font-size: .86rem; line-height: 1.55; }
.explain {
  margin-top: 12px;
  padding: 13px 15px;
  background: #edf6f8;
  border: 1.5px solid rgba(61, 143, 174, .4);
  border-radius: 13px;
  animation: feedback-in .22s ease-out;
}
.explain h2 { margin: 0 0 5px; font-size: .85rem; letter-spacing: .08em; color: #26657a; }
.explain p { margin: 0 0 6px; font-size: .92rem; line-height: 1.7; }
.explain-answer { color: var(--leaf-dark); font-weight: 800; }
.explain .btn { margin-top: 4px; }
.play-note { margin: 10px 2px 0; text-align: center; font-size: .74rem; color: var(--ink-soft); }

@media (max-width: 620px) {
  .play-hud { grid-template-columns: auto minmax(0, 1fr); }
  .hud-stats { grid-column: 1 / -1; justify-content: stretch; }
  .hud-stat { flex: 1 1 0; }
  .q-prompt { margin-top: 8px; }
  .choice-grid { grid-template-columns: 1fr; }
  .choice { min-height: 50px; }
  .question-card { padding: 12px; }
  .q-tools .btn { padding: 6px 9px; font-size: .8rem; }
}
@media (max-width: 380px) {
  .hud-stat { min-width: 0; padding: 3px 3px; }
  .hud-stat strong { font-size: .88rem; }
  .match-btn { font-size: .82rem; padding: 6px 7px; }
  .count-value { min-width: 104px; }
  .count-btn { width: 48px; height: 48px; }
  .vz-label { font-size: 17px; }
  .tap-label { font-size: 15px; }
}
