/* 闖關與記憶遊戲　第二版：黑暗裡的光
   跟 app.css 同一套：深夜藍的底、暖金色的光、宋體標題、黑體操作字。
   面板是微微發亮的玻璃；選到、答對就亮金光；答錯輕輕晃一下。
   只用 app.css 的新變數（--night-*、--light、--text*、--line*、--serif、--sans、--num）。 */

/* 共用：玻璃面板、小膠囊、星星 */
.q-panel, .g-panel, .q-intro, .q-opt, .q-card, .q-after:not(:empty), .q-result, .g-setup, .g-review ol, .mt-chip, .mt-solo, .p4-after:not(:empty) {
  border-radius: var(--r-l);
  background: linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  box-shadow: inset 0 0 0 1px var(--line);
}
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 2px 12px; border-radius: 999px; font-size: .85rem; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.pill.is-on { color: var(--light-hi); background: color-mix(in oklab, var(--light), transparent 90%); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 50%); }
.star-row { display: inline-flex; align-items: center; gap: .12em; color: var(--light); vertical-align: -.15em; }
.star-row svg { display: block; width: 1em; height: 1em; }
.star-row .is-off { color: rgba(255, 255, 255, .16); }
.nw { white-space: nowrap; }

/* ───────── 場景圖（遊戲和闖關共用）：沒有圖時放看圖線索 ───────── */
.g-art { position: relative; display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; container-type: size; background: #0E1728; color: var(--text); }
.g-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.g-art.is-text {
  align-content: center; padding: 6% 8%; text-align: center;
  background:
    radial-gradient(90% 130% at 50% -20%, color-mix(in oklab, var(--light), transparent 72%), transparent 62%),
    linear-gradient(180deg, #17243C, #0D1627);
}
.g-clue { font-family: var(--serif); font-weight: 500; font-size: clamp(10.5px, 5.4cqi, 19px); line-height: 1.5; letter-spacing: .02em; color: var(--text); }

/* ───────── 闖關（章頁裡） ───────── */
.chapter:has(.quest) .filmstrip { display: none; } /* 連環畫寫著節數和場景名，闖關時先收起來 */
.quest { display: grid; gap: 16px; max-width: 46rem; margin-inline: auto; padding: 26px var(--gutter) 72px; scroll-margin-top: 8px; }
.quest > * { min-width: 0; }

/* 進度列：四段光條，走過的亮金色；右邊是聲音鈕 */
.q-railrow { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; }
.q-railrow .snd-pill { flex: none; }
.q-rail { flex: 1; min-width: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 0; padding: 0; list-style: none; }
.q-rail li { display: grid; justify-items: center; gap: 8px; font-size: .85rem; text-align: center; color: var(--text-3); }
.q-rail li::before { content: ""; justify-self: stretch; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); }
.q-rail li.is-done { color: var(--text-2); }
.q-rail li.is-done::before { background: color-mix(in oklab, var(--light), transparent 35%); }
.q-rail li.is-now { color: var(--light-hi); font-weight: 700; }
.q-rail li.is-now::before { background: var(--light); box-shadow: 0 0 14px var(--light); }
.q-rail li > span:last-child { line-height: 1.3; }
.q-step {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-family: var(--num); font-weight: 600; font-variant-numeric: lining-nums; font-size: 1.15rem; line-height: 1;
  box-shadow: inset 0 0 0 1px currentColor;
}
.q-rail .q-step { display: none; }

.q-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px .6em; font-family: var(--serif); font-weight: 700; font-size: clamp(1.6rem, 6.4vw, 2.2rem); line-height: 1.3; letter-spacing: .1em; }
.q-title:focus { outline: none; }
.q-no { font-family: var(--sans); font-weight: 500; font-size: .9rem; letter-spacing: .14em; color: var(--light-hi); flex-basis: 100%; }
.q-count { margin-left: auto; font-family: var(--sans); font-size: .9rem; font-weight: 400; letter-spacing: 0; color: var(--text-3); font-variant-numeric: tabular-nums; }
.q-lede { font-size: var(--s1); color: var(--text-2); }

/* 開始前：這一章的代表圖，章名疊在圖上（11/12 使用者說闖關「只有文字」，所以每一關都配圖） */
.q-cover {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; isolation: isolate; border-radius: var(--r-l); background: #0E1728;
  box-shadow: 0 0 0 1px var(--line), 0 30px 70px -40px #000, 0 0 120px -50px color-mix(in oklab, var(--light), transparent 50%);
}
@media (min-width: 640px) { .q-cover { aspect-ratio: 2.2 / 1; } }
.q-cover img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.q-cover::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(6, 10, 19, .94) 0%, rgba(6, 10, 19, .55) 32%, rgba(6, 10, 19, 0) 62%); pointer-events: none; }
.q-cover-body { position: absolute; inset: auto 0 0 0; display: grid; gap: 2px; padding: 0 clamp(16px, 4vw, 28px) clamp(12px, 3.4vw, 22px); }
.q-cover-kicker { font-size: .9rem; letter-spacing: .18em; color: var(--light-hi); text-shadow: 0 1px 10px rgba(0, 0, 0, .7); }
.q-cover .q-title { text-shadow: 0 2px 18px rgba(0, 0, 0, .65); }
.q-cover .snd-pill { position: absolute; top: 12px; right: 12px; background: rgba(6, 10, 19, .5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.q-intro-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* 開始前：四關的清單，每一關一張小圖，關數疊在圖的角落 */
.q-intro { margin: 4px 0 0; padding: 6px 20px; list-style: none; }
.q-intro li { display: grid; grid-template-columns: auto 5.2em 1fr; align-items: center; gap: 4px 14px; padding: 14px 0; }
.q-intro li.has-art { grid-template-columns: 84px 5.2em 1fr; }
.q-intro li + li { border-top: 1px solid var(--line); }
.q-intro .q-step { color: var(--light); }
.q-intro b { font-family: var(--serif); font-weight: 700; font-size: var(--s2); letter-spacing: .08em; }
.q-intro li > span:last-child { color: var(--text-2); line-height: 1.6; }
.q-intro-art { position: relative; width: 84px; aspect-ratio: 1; overflow: hidden; border-radius: 14px; background: #0E1728; box-shadow: 0 0 0 1px var(--line), 0 10px 24px -14px #000; }
.q-intro-art img { width: 100%; height: 100%; object-fit: cover; }
.q-intro-art .q-step { position: absolute; top: 6px; left: 6px; width: 28px; height: 28px; font-size: 1.05rem; background: rgba(6, 10, 19, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@media (max-width: 520px) {
  .q-intro { padding: 4px 16px; }
  .q-intro li { grid-template-columns: auto 1fr; gap: 2px 12px; }
  .q-intro li.has-art { grid-template-columns: 76px 1fr; gap: 2px 14px; }
  .q-intro li.has-art .q-intro-art { grid-row: span 2; width: 76px; }
  .q-intro li > span:last-child { grid-column: 2; font-size: .95rem; }
}
.q-best { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text-2); }
.q-best .star-row { font-size: 1.2rem; }
.q-go { justify-self: start; }

/* 排順序：每一幕一張大卡（圖＋場景名），手機兩欄、寬螢幕三欄。
   點對了圖的角落亮出金色的順序數字、圖暗下來；全部排好以後照正確的先後重新排、圖再亮回來，下面標節數 */
.q-say { min-height: 1.75em; font-size: var(--s1); color: var(--light-hi); }
.q-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 620px) { .q-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
.q-card {
  position: relative; display: grid; grid-template-rows: auto 1fr; align-content: start; padding: 0; border: 0; overflow: hidden;
  border-radius: var(--r-m); text-align: left; color: var(--text); -webkit-tap-highlight-color: transparent;
  transition: box-shadow .2s, transform .15s var(--ease);
}
.q-card-art { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #0E1728; }
.q-card-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transition: filter .35s; }
.q-card-t { padding: 9px 12px 11px; font-family: var(--serif); font-weight: 700; font-size: clamp(1rem, 4.2vw, 1.15rem); line-height: 1.4; letter-spacing: .04em; transition: color .3s; }
.q-card-ref { margin-top: -6px; padding: 0 12px 11px; font-size: .85rem; color: var(--light-hi); }
.q-card.is-text .q-card-t { display: grid; place-items: center; min-height: 112px; padding: 18px 14px; text-align: center; font-size: var(--s1); }
.q-card-no {
  position: absolute; top: 8px; left: 8px; z-index: 1; display: none; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--light); color: var(--on-light); font-family: var(--num); font-weight: 700; font-size: 1.35rem; line-height: 1; font-variant-numeric: lining-nums;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, .7), 0 0 0 3px rgba(6, 10, 19, .4), 0 0 24px -4px var(--light);
}
.q-card:hover:not(.is-placed) { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 45%); }
.q-card:active:not(.is-placed) { transform: scale(.97); }
.q-card.is-placed { cursor: default; box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--light), transparent 25%); }
.q-card.is-placed .q-card-no { display: grid; animation: pop-in .38s var(--ease); }
.q-card.is-placed .q-card-art img { filter: brightness(.5) saturate(.65); }
.q-card.is-placed .q-card-t { color: var(--text-3); }
.q-card.is-hint { box-shadow: inset 0 0 0 3px var(--light), 0 0 34px -8px var(--light); }
.q-card.is-hint::after { content: "提示"; position: absolute; top: 8px; right: 8px; z-index: 1; padding: 1px 10px; border-radius: 999px; background: var(--light); color: var(--on-light); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.q-cards.is-done .q-card.is-placed { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 50%); }
.q-cards.is-done .q-card.is-placed .q-card-art img { filter: none; }
.q-cards.is-done .q-card.is-placed .q-card-t { color: var(--text); }
@keyframes pop-in {
  0% { transform: scale(.3); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: none; }
}

/* 答錯：輕輕晃一下 */
.is-shake { animation: shake .42s ease; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}
/* 答對：亮一下 */
@keyframes glow-once {
  0% { box-shadow: inset 0 0 0 2px var(--light), 0 0 0 0 color-mix(in oklab, var(--light), transparent 40%); }
  100% { box-shadow: inset 0 0 0 2px var(--light), 0 0 0 14px transparent; }
}

/* 選擇題 */
.q-art { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r-l); box-shadow: 0 0 0 1px var(--line), 0 30px 70px -40px #000, 0 0 120px -50px color-mix(in oklab, var(--light), transparent 50%); }
.q-art .g-clue { font-size: clamp(14px, 4.6cqi, 22px); line-height: 1.7; max-width: 26em; }
.q-art.is-wide { aspect-ratio: 2 / 1; } /* 填金句、考考你：圖矮一點，題目和選項才不會被擠到下面 */
.q-ref { font-family: var(--serif); font-weight: 700; font-size: var(--s2); letter-spacing: .04em; color: var(--light); }
.q-verse { font-family: var(--serif); font-weight: 500; font-size: clamp(1.25rem, 4.8vw, 1.5rem); line-height: 2; }
.q-verse.is-small { padding-left: 16px; border-left: 2px solid var(--light); font-size: clamp(1.08rem, 4.2vw, 1.28rem); line-height: 1.9; color: var(--text); }
.q-verse small { font-size: .68em; color: var(--text-3); }
.q-verse mark { padding: 0 .12em; border-radius: 4px; background: color-mix(in oklab, var(--light), transparent 72%); color: var(--light-hi); }
.q-blank { display: inline-block; min-width: 2.5em; margin: 0 .15em; border-bottom: 2px solid var(--light); line-height: 1.3; box-shadow: 0 8px 14px -10px var(--light); }
.q-ask { margin-top: 2px; font-size: var(--s1); font-weight: 700; color: var(--text); }
.q-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 10px; }
.q-opt {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 14px;
  min-height: 60px; padding: 12px 18px 12px 12px; border: 0; border-radius: var(--r-m);
  font-family: var(--serif); font-size: var(--s1); line-height: 1.5; text-align: left; color: var(--text);
  transition: box-shadow .2s, background .2s, transform .15s var(--ease), opacity .3s;
}
.q-opt:hover:not(:disabled) { background: linear-gradient(135deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03)); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 45%); }
.q-opt:active:not(:disabled) { transform: scale(.985); }
.q-opt:disabled { cursor: default; opacity: .5; }
.q-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  font-family: var(--serif); font-weight: 700; font-size: 1rem; color: var(--light-hi);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 50%);
}
.q-opt.is-right, .q-opt.is-wrong { opacity: 1; }
.q-opt.is-right {
  background: color-mix(in oklab, var(--light), transparent 84%); color: var(--light-hi);
  box-shadow: inset 0 0 0 2px var(--light), 0 0 40px -12px var(--light);
  animation: glow-once .7s ease-out;
}
.q-opt.is-right .q-mark { background: var(--light); color: var(--on-light); box-shadow: none; }
.q-opt.is-wrong { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad), transparent 30%); animation: shake .42s ease; }
.q-opt.is-wrong .q-mark { color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad), transparent 40%); }
.q-tag { grid-column: 2; justify-self: start; padding: 1px 10px; border-radius: 999px; background: var(--light); color: var(--on-light); font-family: var(--sans); font-size: .8rem; font-weight: 700; }
.q-opt.is-wrong .q-tag { background: color-mix(in oklab, var(--bad), transparent 82%); color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad), transparent 50%); }

.q-after { display: grid; gap: 12px; justify-items: start; }
.q-after:not(:empty) { padding: 18px 20px 20px; }
.q-after:empty { display: none; }
.q-verdict { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: var(--s2); letter-spacing: .04em; }
.q-verdict.is-right { color: var(--light-hi); }
.q-verdict.is-wrong { font-size: var(--s1); line-height: 1.6; color: var(--text); }
.q-source { color: var(--text-2); }
.q-source b { font-family: var(--serif); font-size: var(--s1); color: var(--light-hi); }
.q-after .btn, .p4-after .btn { margin-top: 4px; }
@media (max-width: 520px) {
  .q-after .btn, .p4-after .btn, .q-go { width: 100%; }
}

/* 結算 */
.q-result { position: relative; display: grid; justify-items: center; gap: 12px; padding: clamp(26px, 6vw, 44px) clamp(18px, 5vw, 40px); overflow: hidden; text-align: center; isolation: isolate; }
.q-result::before { content: ""; position: absolute; inset: -30% -10% auto; z-index: -1; height: 80%; background: radial-gradient(50% 60% at 50% 50%, color-mix(in oklab, var(--light), transparent 78%), transparent 70%); pointer-events: none; }
.q-result .q-title { justify-content: center; text-align: center; }
.q-result .q-lede { max-width: 26em; }
.q-big-stars { display: flex; justify-content: center; align-items: flex-end; gap: clamp(6px, 2vw, 14px); margin: 4px 0 2px; color: var(--light); }
.q-big-stars svg { display: block; width: clamp(54px, 17vw, 84px); height: auto; filter: drop-shadow(0 0 18px color-mix(in oklab, var(--light), transparent 40%)); }
.q-big-stars svg:nth-child(2) { width: clamp(66px, 21vw, 102px); }
.q-big-stars .is-off { color: rgba(255, 255, 255, .12); filter: none; }
.q-big-stars.is-full { animation: halo 1.6s ease-out 1; border-radius: 50%; }
@keyframes halo {
  0% { filter: drop-shadow(0 0 0 transparent); }
  35% { filter: drop-shadow(0 0 36px var(--light-hi)); }
  100% { filter: drop-shadow(0 0 0 transparent); }
}
.q-lamp { display: inline-flex; align-items: center; gap: 12px; max-width: 26em; padding: 10px 18px; border-radius: var(--r-m); line-height: 1.6; background: color-mix(in oklab, var(--light), transparent 90%); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 55%); color: var(--light-hi); text-align: left; }
.q-lamp i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--light); box-shadow: 0 0 14px var(--light); }
.q-lamp.is-lit { background: var(--light); color: var(--on-light); font-weight: 700; box-shadow: 0 10px 30px -10px var(--light); }
.q-lamp.is-lit i { background: var(--on-light); box-shadow: none; }
.q-result .q-best { justify-content: center; }
.q-table { width: min(100%, 24rem); margin-top: 6px; border-collapse: collapse; }
.q-table th, .q-table td { padding: 11px 4px; border-bottom: 1px solid var(--line); font-weight: 400; text-align: left; }
.q-table th { font-family: var(--serif); font-size: var(--s1); letter-spacing: .06em; }
.q-table td { text-align: right; color: var(--text-2); }
.q-table td.is-clean { color: var(--light-hi); }
.q-table .is-sum th, .q-table .is-sum td { border-bottom: 0; font-weight: 700; color: var(--text); }
.q-rule { font-size: .85rem; color: var(--text-3); }
.q-end { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
@media (max-width: 520px) { .q-end, .q-end .btn { width: 100%; } }

/* ───────── 遊戲共用 ───────── */
.game { max-width: 64rem; margin-inline: auto; padding: 0 var(--gutter) 72px; }
.game .topbar { padding-inline: 0; }
.g-top-side { display: flex; align-items: center; gap: 8px; }
.g-head { padding-top: clamp(22px, 5vw, 48px); }
.g-head h1 { font-family: var(--serif); font-weight: 900; font-size: clamp(2.4rem, 10vw, 4rem); line-height: 1.15; letter-spacing: .12em; }
.g-head h1:focus, .game h1:focus { outline: none; }
.g-kicker { margin-bottom: 4px; font-size: .9rem; letter-spacing: .2em; color: var(--light-hi); }
.g-lede { margin-top: .6em; max-width: 30em; font-size: var(--s1); color: var(--text-2); }

/* 開始畫面：左邊說明、右邊設定 */
.g-intro { display: grid; gap: 28px; }
.g-intro-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 16px; }
.g-intro-head .viz { padding-bottom: 6px; }
.g-rules { max-width: 36rem; margin: 22px 0 0; padding: 0; list-style: none; counter-reset: rule; }
.g-rules li { position: relative; padding: 12px 0 12px 2.6em; border-top: 1px solid var(--line); color: var(--text-2); }
.g-rules li:last-child { border-bottom: 1px solid var(--line); }
.g-rules li::before {
  counter-increment: rule; content: counter(rule); position: absolute; left: 0; top: 12px;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font-family: var(--num); font-weight: 600; font-variant-numeric: lining-nums; font-size: 1.05rem; line-height: 1; color: var(--light);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 50%);
}
@media (max-width: 560px) {
  .g-intro-head { grid-template-columns: 1fr; }
  .g-intro-head .viz { display: none; }
}
@media (min-width: 900px) {
  .g-intro { grid-template-columns: minmax(0, 1fr) minmax(20rem, 26rem); align-items: start; gap: 56px; }
  .g-intro .g-setup { margin-top: clamp(22px, 5vw, 48px); }
}

.g-setup { display: grid; gap: 22px; max-width: 36rem; padding: clamp(18px, 4vw, 28px); }
.g-field { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.g-label { padding: 0; font-size: .95rem; font-weight: 700; letter-spacing: .04em; color: var(--text); }
.g-field select, .g-name input {
  width: 100%; min-height: 52px; padding: 0 16px; border: 0; border-radius: var(--r-m);
  background: rgba(6, 10, 19, .55); color: var(--text); font: inherit; font-size: var(--s0);
  box-shadow: inset 0 0 0 1px var(--line-strong); transition: box-shadow .2s;
}
.g-field select { appearance: none; padding-right: 44px; background-image: linear-gradient(45deg, transparent 50%, var(--light) 50%), linear-gradient(-45deg, transparent 50%, var(--light) 50%); background-size: 6px 6px; background-position: calc(100% - 24px) 50%, calc(100% - 18px) 50%; background-repeat: no-repeat; }
.g-field select:hover, .g-name input:hover { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 45%); }
.g-field select:focus-visible, .g-name input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--light); }
.g-field option, .g-field optgroup { background: var(--night-2); color: var(--text); }
.g-seg-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; width: fit-content; max-width: 100%; border-radius: 999px; background: rgba(6, 10, 19, .45); box-shadow: inset 0 0 0 1px var(--line); }
.g-seg label { position: relative; }
.g-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.g-seg span { display: grid; place-items: center; min-width: 3.4em; min-height: 46px; padding: 0 16px; border-radius: 999px; font-size: var(--s0); color: var(--text-2); transition: background .2s, color .2s; white-space: nowrap; }
.g-seg label:hover span { color: var(--text); }
.g-seg input:checked + span { background: var(--light); color: var(--on-light); font-weight: 700; box-shadow: 0 6px 20px -6px var(--light); }
.g-seg input:focus-visible + span { outline: 2px solid var(--light-hi); outline-offset: 2px; }
.g-names { display: grid; gap: 8px; }
.g-names:empty { display: none; }
.g-name { display: grid; grid-template-columns: 4.5em 1fr; align-items: center; gap: 10px; color: var(--text-2); }
.g-note, .g-best { color: var(--text-2); font-size: .95rem; }
.g-best.is-new { color: var(--light-hi); font-weight: 700; }
.g-setup .btn { width: 100%; }

.g-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
@media (max-width: 520px) {
  .g-actions .btn { flex: 1 1 100%; padding-inline: 16px; }
  .g-actions .btn.is-ghost { flex-basis: 30%; }
}

/* 結算的大數字 */
.g-score { display: grid; justify-items: start; gap: 6px; margin-top: 18px; }
.g-total { display: flex; align-items: baseline; gap: 10px; font-size: var(--s2); color: var(--text-2); }
.g-total b { font-family: var(--num); font-weight: 600; font-variant-numeric: lining-nums; font-size: clamp(4.4rem, 22vw, 7rem); line-height: .95; letter-spacing: .02em; color: var(--light); text-shadow: 0 0 60px color-mix(in oklab, var(--light), transparent 45%); }

.g-review { max-width: 44rem; margin-top: 44px; }
.g-review h2 { font-family: var(--serif); font-weight: 700; font-size: clamp(1.25rem, 3.8vw, 1.5rem); letter-spacing: .1em; }
.g-review ol { margin: 14px 0 0; padding: 4px 18px; list-style: none; }
.g-review li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 0; }
.g-review li + li { border-top: 1px solid var(--line); }
.g-review b { font-family: var(--serif); font-weight: 700; font-size: var(--s1); color: var(--light-hi); }
.g-review li > span:not([class]) { font-family: var(--serif); color: var(--text-2); }
.g-ok { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: .85rem; font-weight: 700; line-height: 1; background: var(--light); color: var(--on-light); }
.g-review .is-wrong .g-ok { background: none; color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad), transparent 40%); }
.g-pts { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ───────── 四圖選一 ───────── */
.p4-bar { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.p4-score { color: var(--light-hi); font-weight: 700; }
.p4-play {
  --grid-w: min(100%, 50rem, max(280px, calc((100dvh - 17rem) * 1.72)));
  display: grid; justify-items: center; gap: 8px; padding: clamp(10px, 3vw, 26px) 0 24px;
}
.p4-ask { font-size: .95rem; color: var(--text-2); }
.p4-ref {
  font-family: var(--serif); font-weight: 900; font-size: clamp(2.5rem, 12.5vw, 4.6rem); line-height: 1.1; letter-spacing: .04em; text-align: center; white-space: nowrap;
  color: var(--light-hi); text-shadow: 0 0 50px color-mix(in oklab, var(--light), transparent 40%);
}
.p4-time { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; width: var(--grid-w); margin-top: 4px; }
.p4-time.is-calm { grid-template-columns: 1fr; text-align: center; } /* 不計時：沒有倒數的線，只留一句話 */
.p4-timer { height: 6px; overflow: hidden; border-radius: 6px; background: rgba(255, 255, 255, .1); }
.p4-fill { display: block; height: 100%; border-radius: inherit; background: var(--light); box-shadow: 0 0 12px var(--light); transform-origin: left center; transition: transform .1s linear, background .3s; }
.p4-fill.is-low { background: var(--bad); box-shadow: 0 0 12px var(--bad); }
.p4-secs { min-width: 4.8em; font-size: .85rem; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
.p4-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1.8vw, 16px); width: var(--grid-w); margin-top: 6px; }
.p4-tile {
  position: relative; aspect-ratio: 16 / 9; padding: 0; border: 0; overflow: hidden; border-radius: var(--r-m); background: none; color: inherit;
  box-shadow: 0 0 0 1px var(--line), 0 20px 40px -26px #000;
  transition: transform .2s var(--ease), box-shadow .2s, opacity .3s;
}
.p4-tile .g-art { border-radius: inherit; }
.p4-tile .g-art.is-text { padding: 34px 7% 6%; }
.p4-tile:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 0 0 2px color-mix(in oklab, var(--light), transparent 30%), 0 20px 50px -24px color-mix(in oklab, var(--light), transparent 40%); }
.p4-tile:active:not(:disabled) { transform: scale(.98); }
.p4-tile:disabled { cursor: default; }
.p4-no {
  position: absolute; top: 6px; left: 6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(6, 10, 19, .72); color: var(--light-hi); font-weight: 700; font-size: .8rem; line-height: 1;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 50%); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.p4-tile.is-right { box-shadow: 0 0 0 3px var(--light), 0 0 40px -6px var(--light); animation: tile-glow .8s ease-out; }
.p4-tile.is-right .p4-no { background: var(--light); color: var(--on-light); }
.p4-tile.is-wrong { box-shadow: 0 0 0 2px var(--bad); animation: shake .42s ease; }
.p4-tile.is-dim { opacity: .32; }
@keyframes tile-glow {
  0% { box-shadow: 0 0 0 3px var(--light), 0 0 0 0 color-mix(in oklab, var(--light), transparent 30%); }
  100% { box-shadow: 0 0 0 3px var(--light), 0 0 40px -6px var(--light); }
}
.p4-tag { position: absolute; top: 5px; right: 5px; padding: 1px 10px; border-radius: 999px; background: var(--light); color: var(--on-light); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.p4-tile.is-wrong .p4-tag { background: rgba(6, 10, 19, .8); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.p4-after { display: grid; justify-items: start; gap: 10px; width: var(--grid-w); margin-top: 14px; padding: 18px 20px 20px; }
.p4-after:empty { display: none; }
.p4-verdict { font-family: var(--serif); font-weight: 700; font-size: var(--s2); letter-spacing: .04em; color: var(--light-hi); }
.p4-verdict.is-wrong { font-size: var(--s1); line-height: 1.6; color: var(--text); }
.p4-cap, .mt-cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; font-family: var(--serif); }
.p4-cap b, .mt-cap b { font-size: var(--s2); color: var(--light); }
.p4-cap span, .mt-cap span { font-size: var(--s1); color: var(--text-2); letter-spacing: .04em; }
.p4-verse, .mt-verse { padding-left: 16px; border-left: 2px solid var(--light); font-family: var(--serif); font-weight: 500; font-size: clamp(1.1rem, 4.3vw, 1.32rem); line-height: 1.9; }
.p4-verse small, .mt-verse small { font-size: .7em; color: var(--text-3); }
/* 直式手機夠高時，四張圖改成一直排：每張圖的面積比 2×2 大一倍，看得清楚才好認 */
@media (max-width: 640px) and (min-height: 700px) {
  .p4-play { --tile-h: clamp(100px, calc((100dvh - 16.5rem) / 4 - 10px), 200px); }
  .p4-grid { grid-template-columns: 1fr; justify-items: center; gap: 10px; width: 100%; }
  .p4-tile { height: var(--tile-h); width: auto; max-width: 100%; }
  .p4-time { width: min(100%, calc(var(--tile-h) * 16 / 9)); }
  .p4-grid:has(.is-right) .p4-tile.is-dim { display: none; } /* 答完只留答案和你選的那張，下面的經文才不用捲 */
  .p4-after { width: 100%; }
}
@media (max-width: 420px) {
  .p4-tile { border-radius: var(--r-s); }
  .p4-no { top: 4px; left: 4px; width: 20px; height: 20px; font-size: .72rem; }
  .p4-tile .g-art.is-text { padding: 24px 5% 4px; }
  .p4-tile .g-clue { font-size: 10.5px; line-height: 1.42; }
}

/* ───────── 看圖搶答：一張圖配四個經文代號（其餘沿用四圖選一的版面） ───────── */
.p4-play.is-ref { --grid-w: min(100%, 44rem, max(280px, calc((100dvh - 23rem) * 1.78))); }
.p4-play.is-ref .p4-time { width: var(--grid-w); }
.rq-art { width: var(--grid-w); aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r-m); box-shadow: 0 0 0 1px var(--line), 0 24px 50px -30px #000; }
.rq-art:focus { outline: none; }
.rq-art .g-art { border-radius: inherit; }
.rq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1.8vw, 14px); width: var(--grid-w); margin-top: 6px; }
.rq-opt {
  position: relative; display: grid; place-items: center; min-height: clamp(58px, 9vh, 84px); padding: 8px 10px 8px 38px; border: 0; border-radius: var(--r-m);
  background: linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .025)); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong); transition: transform .2s var(--ease), box-shadow .2s, opacity .3s, background .2s;
}
.rq-ref { font-family: var(--serif); font-weight: 700; font-size: clamp(1.15rem, 5vw, 1.9rem); line-height: 1.2; letter-spacing: .02em; white-space: nowrap; }
.rq-opt .p4-no { top: 50%; left: 9px; transform: translateY(-50%); }
.rq-opt:hover:not(:disabled) { transform: translateY(-2px); box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--light), transparent 30%); }
.rq-opt:active:not(:disabled) { transform: scale(.98); }
.rq-opt:disabled { cursor: default; }
.rq-opt.is-right { background: color-mix(in oklab, var(--light), transparent 84%); color: var(--light-hi); box-shadow: inset 0 0 0 3px var(--light), 0 0 40px -10px var(--light); }
.rq-opt.is-right .p4-no { background: var(--light); color: var(--on-light); }
.rq-opt.is-wrong { box-shadow: inset 0 0 0 2px var(--bad); animation: shake .42s ease; }
.rq-opt.is-dim { opacity: .38; }
.rq-opt .p4-tag { top: -9px; right: 10px; }
.rq-opt.is-wrong .p4-tag { background: #0A1120; }
@media (max-width: 420px) {
  .rq-opt { padding-left: 30px; border-radius: var(--r-s); }
  .rq-opt .p4-no { left: 6px; }
}

/* ───────── 搶拍牌陣：八張牌的桌面。手機兩欄四列，電腦四欄兩列；牌的位置從頭到尾不動 ─────────
   11/12 從十二張改成八張：使用者說圖太小、不好看。八張的時候每張圖的面積是原來的兩倍多。 */
.p4-play.gb-play { --grid-w: min(100%, 62rem); gap: 6px; }
.p4-play.gb-play .p4-time { width: var(--grid-w); }
.p4-ref.gb-ref { font-size: clamp(2.1rem, 10.5vw, 3.6rem); }
.gb-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(8px, 1.6vw, 16px); width: var(--grid-w); margin-top: 6px; }
.gb-card {
  position: relative; aspect-ratio: 4 / 3; padding: 0; border: 0; overflow: hidden; border-radius: var(--r-m); background: none; color: inherit;
  box-shadow: 0 0 0 1px var(--line), 0 18px 36px -22px #000; transition: transform .18s var(--ease), box-shadow .2s, opacity .35s;
}
.gb-card .g-art { border-radius: inherit; transition: opacity .4s; }
/* 每張牌一圈很細的亮邊、底下一點暗角，看起來像一張有厚度的牌 */
.gb-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), inset 0 -34px 40px -30px rgba(0, 0, 0, .55); }
.gb-card:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 0 0 2px color-mix(in oklab, var(--light), transparent 30%), 0 20px 46px -22px color-mix(in oklab, var(--light), transparent 40%); }
.gb-card:active:not(:disabled) { transform: scale(.96); }
.gb-card:disabled { cursor: default; }
.gb-card.is-mine { box-shadow: 0 0 0 3px var(--light-hi), 0 0 30px -8px var(--light); }
.gb-card.is-right { z-index: 1; box-shadow: 0 0 0 3px var(--light), 0 0 46px -6px var(--light); animation: tile-glow .8s ease-out; }
.gb-card.is-wrong { box-shadow: 0 0 0 3px var(--bad); animation: shake .42s ease; }
.gb-card.is-wrong .g-art { opacity: .5; }
/* 公布的時候其他的牌暗下來，眼睛才會落在答案上 */
.gb-board:has(.is-right) .gb-card:not(.is-right, .is-wrong, .is-gone) .g-art { opacity: .45; }
.gb-card.is-gone { background: rgba(255, 255, 255, .02); box-shadow: inset 0 0 0 1px var(--line); }
.gb-card.is-gone::after { display: none; }
.gb-card.is-gone .g-art { opacity: 0; }
.gb-mark { position: absolute; left: 6px; bottom: 6px; z-index: 1; display: flex; gap: 3px; }
.gb-mark .pk-dot { width: 28px; height: 28px; font-size: .85rem; }
.gb-mark .p4-tag { position: static; }
.gb-taken { position: absolute; inset: 0; display: grid; place-items: center; }
.gb-taken .pk-dot { width: 40px; height: 40px; font-size: 1.15rem; opacity: .9; }
.gb-check { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--light); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 55%); }
.gb-say { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 14px; min-height: 2.4em; margin-top: 10px; font-family: var(--serif); color: var(--text-2); text-align: center; }
.gb-say b { font-size: var(--s2); letter-spacing: .04em; color: var(--light-hi); }
.gb-say span { font-size: var(--s1); }
@media (min-width: 700px) {
  /* 兩列牌的高度大約是寬度的三成，所以寬度可以用到螢幕高度的三倍 */
  .p4-play.gb-play { --grid-w: min(100%, 62rem, max(460px, calc((100dvh - 19rem) * 3))); }
  .gb-board { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .gb-card { aspect-ratio: 16 / 10; border-radius: var(--r-l); }
}
/* 手機比較矮的時候，牌壓扁一點，八張才能一眼看完不用捲 */
@media (max-width: 699px) and (max-height: 780px) { .gb-card { aspect-ratio: 3 / 2; } }
@media (max-width: 699px) and (max-height: 680px) { .gb-card { aspect-ratio: 16 / 9; } }
@media (prefers-reduced-motion: reduce) { .gb-card, .gb-card .g-art, .rq-opt { transition: none; animation: none; } }

/* ───────── 翻牌配對 ───────── */
.mt-scope { font-size: .85rem; }
.mt-play { display: grid; gap: 14px; padding: 14px 0 34dvh; }
.mt-players { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-chip { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 4px 8px 4px 16px; border-radius: 999px; color: var(--text-2); transition: background .25s, color .25s, box-shadow .25s; }
.mt-chip b { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px; font-family: var(--num); font-weight: 600; font-variant-numeric: lining-nums; font-size: 1.3rem; line-height: 1; color: var(--text); background: rgba(255, 255, 255, .07); }
.mt-chip.is-turn { background: color-mix(in oklab, var(--light), transparent 86%); color: var(--light-hi); font-weight: 700; box-shadow: inset 0 0 0 1px var(--light), 0 0 30px -12px var(--light); }
.mt-chip.is-turn b { background: var(--light); color: var(--on-light); }
.mt-solo { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.mt-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(6px, 1.6vw, 14px); justify-self: center; width: 100%; perspective: 1200px; }
.mt-card { position: relative; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: var(--r-s); background: none; color: inherit; container-type: size; }
.mt-card:not(.is-up):hover .mt-in { transform: translateY(-3px); }
.mt-card:not(.is-up):active .mt-in { transform: scale(.97); }
.mt-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .7, .2, 1); }
.mt-card.is-up .mt-in { transform: rotateY(180deg); }
.mt-back, .mt-face { position: absolute; inset: 0; overflow: hidden; border-radius: var(--r-s); -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.mt-face { transform: rotateY(180deg); background: #0E1728; box-shadow: 0 0 0 1px var(--line); }

/* 牌背：深夜藍、金色細框、中間是書卷簡稱的大字 */
.mt-back {
  display: grid; place-items: center;
  background:
    radial-gradient(90% 80% at 50% 0%, color-mix(in oklab, var(--light), transparent 80%), transparent 70%),
    linear-gradient(160deg, #1D2C4A, var(--night-1) 75%);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 70%), 0 14px 30px -18px #000;
}
.mt-back::before { content: ""; position: absolute; inset: 6%; border-radius: max(4px, calc(var(--r-s) - 4px)); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 45%); }
.mt-mono {
  font-family: var(--serif); font-weight: 900; font-size: min(52cqh, 34cqi); line-height: 1; letter-spacing: .02em; white-space: nowrap;
  color: transparent; background: linear-gradient(180deg, color-mix(in oklab, var(--light), white 35%), color-mix(in oklab, var(--light), transparent 55%));
  -webkit-background-clip: text; background-clip: text;
}

/* 代號牌：暖白底深色字 */
.mt-ref {
  display: grid; place-items: center; align-content: center; gap: 2cqh; height: 100%;
  background: linear-gradient(170deg, #FBF7EE, #EDE4D2); color: var(--on-light); font-family: var(--serif); font-weight: 700; line-height: 1.1;
}
.mt-ref-b { font-weight: 900; font-size: min(38cqh, 24cqi); }
.mt-ref-cv { font-family: var(--num); font-weight: 700; font-variant-numeric: lining-nums; font-size: min(34cqh, 23cqi); letter-spacing: .01em; white-space: nowrap; }
.mt-face .g-art.is-text { padding: 6%; }
.mt-face .g-clue { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-size: clamp(9px, 10.5cqh, 15px); line-height: 1.4; }
@media (min-width: 700px) { .mt-face .g-clue { -webkit-line-clamp: 5; } }
/* 翻開的那一刻，整張牌放大到看得清楚，停一下再縮回去（--tx、--ty 是放大時往哪邊挪，程式照牌的位置填，才不會超出畫面） */
.mt-card.is-pop { z-index: 6; }
.mt-card.is-pop .mt-in { animation: mt-pop 1.15s cubic-bezier(.3, .7, .2, 1) both; }
@keyframes mt-pop {
  0% { transform: translate(0, 0) rotateY(0deg) scale(1); }
  28% { transform: translate(var(--tx, 0), var(--ty, 0)) rotateY(180deg) scale(var(--pop, 1.9)); }
  78% { transform: translate(var(--tx, 0), var(--ty, 0)) rotateY(180deg) scale(var(--pop, 1.9)); }
  100% { transform: translate(0, 0) rotateY(180deg) scale(1); }
}
.mt-card.is-pop .mt-face { box-shadow: 0 0 0 2px var(--light), 0 30px 70px -20px #000; }
.mt-face::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.mt-card.is-done { cursor: default; }
.mt-card.is-done .mt-face { box-shadow: 0 0 0 2px color-mix(in oklab, var(--light), transparent 15%), 0 0 18px -8px var(--light); }
.mt-card.is-done .mt-in { animation: none; }
.mt-seal { position: absolute; right: 5px; bottom: 5px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--light); color: var(--on-light); font-weight: 700; font-size: .75rem; line-height: 1; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }

/* 說明欄：手機上固定在下面，電腦上在牌桌右邊 */
.mt-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; gap: 8px; align-content: start;
  max-height: 30dvh; overflow-y: auto;
  padding: 14px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  background: rgba(13, 21, 38, .86); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: inset 0 1px 0 var(--line-strong), 0 -20px 50px -20px #000;
}
.mt-msg { font-size: var(--s1); color: var(--text); }
/* 翻開的圖在說明欄放大再看一次 */
.mt-peeks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.mt-peek-art { display: block; width: min(100%, 15rem, calc((30dvh - 110px) * 16 / 9)); aspect-ratio: 16 / 9; margin-top: 4px; overflow: hidden; border-radius: var(--r-s); box-shadow: 0 0 0 1px var(--line-strong), 0 14px 30px -18px #000; }
.mt-peeks .mt-peek-ref { display: block; margin-top: 4px; }
.mt-peek-ref { font-family: var(--serif); font-size: var(--s2); color: var(--light-hi); }
.mt-peek { font-family: var(--serif); color: var(--text); }
.mt-hint { color: var(--text-2); }
.mt-hint.is-miss { color: var(--bad); font-weight: 700; }
.mt-hint.is-hit { font-family: var(--serif); font-size: var(--s2); font-weight: 700; color: var(--light-hi); }
.mt-panel .btn { margin-top: 6px; }
.mt-panel .mt-verse { font-size: clamp(1.05rem, 4.2vw, 1.28rem); line-height: 1.8; }
/* 手機：牌盡量放大。12 張排三欄四列，16 張排四欄四列；牌的高度看螢幕剩多少（下面三成留給說明欄） */
@media (max-width: 640px) {
  /* 下面的說明欄縮成兩成高，省下來的高度都給牌 */
  .mt-play { --card-h: clamp(64px, calc((78dvh - 170px) / 4 - 8px), 150px); padding-bottom: 24dvh; }
  .mt-panel { max-height: 22dvh; }
  .mt-board { gap: 8px; }
  .mt-board.is-12 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mt-board.is-8 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mt-card { aspect-ratio: auto; height: var(--card-h); }
  .mt-peek-art { display: none; } /* 翻開的牌會自己放大，說明欄不用再放一張小圖 */
}
@media (min-width: 900px) {
  .mt-peek-art { width: 100%; }
}
@media (max-width: 420px) {
  .mt-players { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
  .mt-chip { justify-content: space-between; gap: 6px; padding: 4px 4px 4px 10px; }
  .mt-chip-n { overflow: hidden; font-size: .85rem; white-space: nowrap; text-overflow: ellipsis; }
  .mt-chip b { min-width: 28px; height: 28px; font-size: 1.1rem; }
  .mt-card, .mt-back, .mt-face { border-radius: 8px; }
  .mt-seal { right: 2px; bottom: 2px; min-width: 16px; height: 16px; padding: 0 3px; font-size: .62rem; }
}

.mt-rank { max-width: 30rem; margin: 22px 0 0; padding: 4px 18px; list-style: none; border-radius: var(--r-l); background: linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); box-shadow: inset 0 0 0 1px var(--line); }
.mt-rank li { display: grid; grid-template-columns: 4.5em 1fr auto; align-items: center; gap: 12px; padding: 14px 0; font-size: var(--s1); }
.mt-rank li + li { border-top: 1px solid var(--line); }
.mt-rank b { font-family: var(--num); font-weight: 600; font-variant-numeric: lining-nums; font-size: 1.6rem; line-height: 1; }
.mt-rank .mt-place { color: var(--text-3); font-size: .95rem; }
.mt-rank li.is-first { color: var(--light-hi); }
.mt-rank li.is-first .mt-place { color: var(--light); font-weight: 700; }
.mt-rank li.is-first b { color: var(--light); text-shadow: 0 0 24px color-mix(in oklab, var(--light), transparent 40%); }

@media (min-width: 900px) {
  .game.match { max-width: 78rem; }
  .mt-play { grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem); align-items: start; gap: 16px 36px; padding: 18px 0 0; }
  .mt-players, .mt-solo { grid-column: 1 / -1; }
  .mt-board.is-16 { max-width: calc((100dvh - 190px) * 1.3); }
  .mt-board.is-12 { max-width: calc((100dvh - 190px) * 1.74); }
  .mt-board.is-8 { max-width: calc((100dvh - 190px) * 2.5); }
  .mt-board.is-8 .mt-card { aspect-ratio: 16 / 11; }
  .mt-panel {
    position: sticky; top: 20px; max-height: none; padding: 20px 22px 22px;
    border-radius: var(--r-l); background: linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); box-shadow: inset 0 0 0 1px var(--line);
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mt-in { transition: none; }
  .mt-card.is-pop .mt-in { animation: none; }
  .q-big-stars.is-full, .q-opt.is-right, .q-opt.is-wrong, .p4-tile.is-right, .p4-tile.is-wrong, .is-shake, .q-card.is-placed .q-card-no { animation: none; }
}

/* ───────── 線上對戰（2–4 人） ─────────
   每個座位一個顏色（--seat），用四卷福音書的顏色。題目的版面沿用四圖選一（.p4-*）。 */
.pk-link {
  position: sticky; top: 8px; z-index: 5; width: fit-content; margin: 8px auto 0; padding: 6px 16px; border-radius: 999px;
  background: color-mix(in oklab, var(--bad), #0A1120 72%); color: var(--text); font-size: .9rem;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad), transparent 40%);
}
.pk-field input, .pk-join input {
  width: 100%; min-height: 52px; padding: 0 16px; border: 0; border-radius: var(--r-m);
  background: rgba(6, 10, 19, .55); color: var(--text); font: inherit; font-size: var(--s1);
  box-shadow: inset 0 0 0 1px var(--line-strong); transition: box-shadow .2s;
}
.pk-field input:hover, .pk-join input:hover { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--light), transparent 45%); }
.pk-field input:focus-visible, .pk-join input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--light); }
.pk-field input::placeholder, .pk-join input::placeholder { color: var(--text-3); font-family: var(--sans); font-weight: 400; letter-spacing: 0; }
.pk-join { display: grid; gap: 10px; padding-top: 22px; border-top: 1px solid var(--line); }
.pk-join-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.pk-join-row input { font-family: var(--serif); font-weight: 700; letter-spacing: .3em; text-align: center; text-transform: uppercase; }
.g-setup .pk-join-row .btn { width: auto; min-width: 6em; padding-inline: 22px; }
.pk-say { color: var(--light-hi); font-size: .95rem; }
.pk-say:empty { display: none; }

.g-head h1.pk-code { letter-spacing: .26em; color: var(--light-hi); text-shadow: 0 0 50px color-mix(in oklab, var(--light), transparent 45%); -webkit-user-select: all; user-select: all; }
.g-actions.pk-share { margin-top: 18px; }
.pk-dot {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--seat, rgba(255, 255, 255, .08)); color: #14100A;
  font-family: var(--serif); font-style: normal; font-weight: 700; font-size: .95rem; line-height: 1;
  box-shadow: 0 0 0 2px rgba(6, 10, 19, .55);
}
.pk-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 等人：四個座位 */
.pk-seats { display: grid; gap: 8px; max-width: 30rem; margin: 26px 0 0; padding: 0; list-style: none; }
.pk-seat {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 16px; border-radius: var(--r-m);
  background: linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--serif); font-size: var(--s1); transition: opacity .3s;
}
.pk-seat .pk-name { flex: 1; letter-spacing: .04em; }
.pk-seat.is-empty { background: none; color: var(--text-3); font-family: var(--sans); font-size: var(--s0); }
.pk-seat.is-empty .pk-dot { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.pk-seat.is-away { opacity: .55; }
.pk-seat .pill { font-family: var(--sans); }
.pk-host { align-content: start; }
.pk-wait { font-family: var(--serif); font-weight: 700; font-size: var(--s2); letter-spacing: .04em; color: var(--light-hi); }

/* 分數列 */
.pk-board { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 12px; }
.pk-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; max-width: 100%; padding: 4px 14px 4px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2);
  transition: box-shadow .25s, background .25s, opacity .25s;
}
.pk-chip .pk-name { max-width: 6.5em; font-size: .95rem; }
.pk-chip b { font-family: var(--num); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; font-size: 1.4rem; line-height: 1; color: var(--text); }
.pk-chip.is-me { color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--seat), transparent 35%); }
.pk-chip.is-in { background: color-mix(in oklab, var(--seat), transparent 82%); box-shadow: inset 0 0 0 2px var(--seat); }
.pk-chip.is-away { opacity: .45; }

/* 題目：多了一列分數，圖要讓出一點高度 */
.p4-play.pk-play { --grid-w: min(100%, 50rem, max(280px, calc((100dvh - 21rem) * 1.72))); padding-top: clamp(6px, 2vw, 16px); }
.pk-play .p4-tile.is-mine { box-shadow: 0 0 0 3px var(--light-hi), 0 0 34px -8px var(--light); }
.pk-who { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 4px; }
.pk-who .pk-dot { width: 26px; height: 26px; font-size: .8rem; }
.pk-state { margin-top: 8px; color: var(--light-hi); font-size: .95rem; text-align: center; }
.pk-state:empty { display: none; }
.pk-round { width: 100%; margin: 6px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.pk-round li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--text-2); }
.pk-round .pk-name { flex: 1; font-family: var(--serif); color: var(--text); }
.pk-got { min-width: 3.6em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-3); }
.pk-round li.is-right .pk-got { color: var(--light-hi); }
.pk-ms { min-width: 4.2em; text-align: right; font-size: .85rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pk-next { color: var(--text-3); font-size: .9rem; }
@media (max-width: 640px) and (min-height: 700px) {
  .p4-play.pk-play { --tile-h: clamp(88px, calc((100dvh - 20.5rem) / 4 - 10px), 190px); }
}
@media (max-width: 420px) {
  .pk-chip { min-height: 36px; padding: 3px 10px 3px 4px; gap: 6px; }
  .pk-chip .pk-dot { width: 26px; height: 26px; font-size: .8rem; }
  .pk-chip .pk-name { max-width: 4.2em; font-size: .85rem; }
  .pk-chip b { font-size: 1.2rem; }
  .pk-who .pk-dot { width: 20px; height: 20px; font-size: .68rem; }
}

/* 名次 */
.pk-rank { display: grid; gap: 10px; max-width: 36rem; margin: 26px 0 0; padding: 0; list-style: none; }
.pk-rank-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 66px; padding: 10px 18px 10px 14px;
  border-radius: var(--r-l); background: linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); box-shadow: inset 0 0 0 1px var(--line);
}
.pk-rank-row.is-top { background: color-mix(in oklab, var(--seat), transparent 86%); box-shadow: inset 0 0 0 2px var(--seat), 0 0 50px -18px var(--seat); }
.pk-rank-row.is-me .pk-name::after { content: "（你）"; margin-left: .2em; color: var(--text-3); font-family: var(--sans); font-size: .85rem; font-weight: 400; letter-spacing: 0; }
.pk-place { width: 1.2em; font-family: var(--num); font-weight: 600; font-variant-numeric: lining-nums; font-size: 2rem; line-height: 1; text-align: center; color: var(--text-2); }
.pk-rank-row.is-top .pk-place { color: var(--light-hi); }
.pk-rank-row .pk-dot { width: 36px; height: 36px; font-size: 1.05rem; }
.pk-rank-row .pk-name { font-family: var(--serif); font-weight: 700; font-size: var(--s2); letter-spacing: .04em; }
.pk-right { color: var(--text-3); font-size: .9rem; white-space: nowrap; }
.pk-score { font-family: var(--num); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; font-size: 2.1rem; line-height: 1; color: var(--text); white-space: nowrap; }
.pk-score small { font-family: var(--sans); font-size: .85rem; font-weight: 400; color: var(--text-3); }
@media (max-width: 480px) {
  .pk-rank-row { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .pk-right { display: none; }
}

/* 大廳遊戲卡上的小示意圖：四個座位 */
.viz.viz-pk { grid-template-columns: repeat(2, 42px); justify-content: center; align-content: center; gap: 10px; }
.viz-pk i { width: 42px; height: 42px; border-radius: 50%; background: var(--seat); box-shadow: 0 0 22px -6px var(--seat); }

/* 線上對戰裡的看圖搶答、搶拍牌陣：多了一列分數，題目要讓出一點高度 */
.p4-play.pk-play.is-ref { --grid-w: min(100%, 44rem, max(260px, calc((100dvh - 27rem) * 1.78))); }
.pk-play .rq-opt.is-mine { box-shadow: inset 0 0 0 3px var(--light-hi), 0 0 34px -10px var(--light); }
.rq-opt .pk-who { left: auto; right: 8px; bottom: 5px; }
@media (min-width: 700px) { .p4-play.pk-play.gb-play { --grid-w: min(100%, 62rem, max(460px, calc((100dvh - 23rem) * 3))); } }
@media (max-width: 699px) and (max-height: 860px) { .pk-play .gb-card { aspect-ratio: 3 / 2; } }
@media (max-width: 699px) and (max-height: 740px) { .pk-play .gb-card { aspect-ratio: 16 / 9; } }
.pk-taker { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; color: var(--text-3); font-family: var(--sans); font-size: .9rem; }
.pk-taker .pk-dot { width: 24px; height: 24px; font-size: .75rem; }

/* ───────── 競技歌牌：牌是金句的下半句（暖白的紙牌），上面是唸出來的上半句。牌桌沿用搶拍牌陣 ─────────
   手機兩欄四列，電腦四欄兩列。這一段要放在牌桌的設定後面，才蓋得過上面的比例設定。 */
.gb-card.is-text, .pk-play .gb-card.is-text { aspect-ratio: auto; height: clamp(74px, calc((100dvh - 19rem) / 4 - 10px), 104px); }
.gb-card.is-text::after { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.kt-face { padding: 4px 12px; background: linear-gradient(170deg, #FBF7EE, #EDE4D2); color: var(--on-light); font-family: var(--serif); font-weight: 700; font-size: clamp(.9rem, 3.9vw, 1.02rem); line-height: 1.42; letter-spacing: .02em; text-align: center; }
.kt-face span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.kt-call {
  display: grid; place-items: center; width: var(--grid-w); max-width: 40rem; min-height: 3.4em; padding: 2px 6px;
  font-family: var(--serif); font-weight: 700; font-size: clamp(1.15rem, 4.9vw, 1.6rem); line-height: 1.6; letter-spacing: .03em; text-align: center;
  color: var(--light-hi); text-shadow: 0 0 40px color-mix(in oklab, var(--light), transparent 55%);
}
.kt-call:focus { outline: none; }
.kt-voice { border: 0; font: inherit; font-size: .85rem; cursor: pointer; }
.kt-voice[aria-pressed="false"] { opacity: .6; }
.pk-play .gb-card.is-text { height: clamp(68px, calc((100dvh - 23rem) / 4 - 10px), 104px); }
@media (min-width: 700px) {
  .gb-card.is-text { height: clamp(84px, calc((100dvh - 21rem) / 2 - 14px), 132px); }
  .pk-play .gb-card.is-text { height: clamp(78px, calc((100dvh - 25rem) / 2 - 14px), 132px); }
  .kt-face { padding: 6px 16px; font-size: clamp(.95rem, 1.5vw, 1.15rem); line-height: 1.5; }
  .p4-play.gb-play.is-karuta, .p4-play.pk-play.gb-play.is-karuta { --grid-w: min(100%, 62rem); }
}

/* ───────── 聲音按鈕（右上角） ───────── */
.snd-pill { gap: 4px; border: 0; padding: 2px 11px 2px 8px; background: none; font: inherit; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.snd-pill .icon { display: inline-grid; }
.snd-pill.is-off { opacity: .55; }
.game .topbar a { flex: none; white-space: nowrap; }
.game .topbar .p4-bar { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; min-width: 0; }
@media (max-width: 480px) { .p4-bar { gap: 6px; } .p4-bar .pill { padding-inline: 9px; font-size: .8rem; } .snd-pill { padding-left: 6px; } }

/* 選範圍：書卷下面一排「從 第幾章 到 第幾章」（11/17） */
.g-range { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 8px; }
.g-range[hidden] { display: none; }
.g-range span { color: var(--text-2); font-size: .92rem; }
.g-range select:disabled { opacity: .45; }
.g-range [hidden] { display: none; }
.g-range:has(> [hidden]) { grid-template-columns: auto 1fr; }
.g-range.is-end { grid-template-columns: auto 1.3fr 1fr; }

/* 11/18：跨卷、每題幾秒、題目附經文、翻牌不寫書卷 */
.g-cross { display: inline-flex; align-items: center; gap: 10px; width: fit-content; min-height: 44px; font-size: .95rem; color: var(--text-2); cursor: pointer; }
.g-cross[hidden] { display: none; }
.g-cross input { width: 22px; height: 22px; accent-color: var(--light); }
.g-range + .g-cross + .g-range { margin-top: 0; }
.g-secs-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: .95rem; color: var(--text-2); }
.g-secs-row[hidden] { display: none; }
.g-secs-row select { width: auto; min-width: 9em; }
.g-seg.is-wrap .g-seg-row { border-radius: 22px; }
.g-seg.is-wrap .g-seg span { min-height: 42px; padding: 0 12px; }
@media (max-width: 480px) { .g-seg.is-wrap .g-seg-row { display: grid; grid-template-columns: 1fr 1fr; width: 100%; } }
.p4-top { display: grid; gap: 8px; justify-items: center; }
.g-cue { display: grid; gap: 6px; max-width: 46rem; margin: 0 auto; padding: 10px 16px; border-radius: 14px; background: rgba(255, 255, 255, .05); text-align: left; }
.g-cue p { margin: 0; line-height: 1.7; }
.g-cue-zh { font-family: var(--serif); font-size: clamp(1rem, 3.8vw, 1.15rem); color: var(--text); }
.g-cue-en { font-size: clamp(.92rem, 3.4vw, 1.02rem); color: var(--text-2); }
.mt-card.is-plain { --light: #8a94a8; }
