/* ============================================================
   元件：按鈕、卡片、地圖、介紹、比賽、鍵盤、步驟、結算、對話框
   ============================================================ */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 20px; border-radius: 14px;
  border: 2px solid transparent; font-size: 1.05rem; font-weight: 800; line-height: 1.2;
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform 0.1s ease, filter 0.2s ease, background 0.2s ease;
}
.btn:active { transform: translateY(2px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: linear-gradient(180deg, #ffe066, #ffb703); color: #2a1a00; box-shadow: 0 4px 0 #b97d00; }
.btn--primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn--soft { background: rgba(255, 255, 255, 0.14); border-color: var(--line); color: var(--text); }
.btn--soft:hover:not(:disabled) { background: rgba(255, 255, 255, 0.22); }
.btn--ghost { background: rgba(13, 20, 48, 0.55); border-color: var(--line); color: var(--text); }
.btn--ghost:hover:not(:disabled) { background: rgba(40, 56, 120, 0.8); }
.btn--danger { background: #c62f3a; color: #fff; box-shadow: 0 4px 0 #7f1a22; }
.btn--sm { min-height: 44px; padding: 8px 14px; font-size: 0.95rem; }
.btn--xl { min-height: 60px; padding: 14px 40px; font-size: 1.4rem; border-radius: 18px; }
.btn--block { width: 100%; }

.badge { display: inline-block; padding: 2px 12px; border-radius: 999px; font-weight: 800; font-size: 0.9rem; background: var(--accent); color: #1a1200; }
.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; background: rgba(255, 210, 63, 0.18); border: 1px solid rgba(255, 210, 63, 0.5); font-weight: 700; font-size: 0.9rem; }
.chip--blue { background: rgba(56, 189, 248, 0.2); border-color: rgba(56, 189, 248, 0.6); }

/* 分數顯示 */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 0.14em; line-height: 1.18; font-size: 0.92em; }
.frac__n { border-bottom: 2px solid currentColor; padding: 0 0.22em 1px; }
.frac__d { padding: 1px 0.22em 0; }
.whole { vertical-align: middle; margin-left: 0.1em; }
.var { font-family: "Times New Roman", serif; font-style: italic; font-weight: 700; }

/* ── 賽道地圖 ── */
.zone-list { max-width: 1040px; margin: 0 auto; display: grid; gap: 16px; }
.zone {
  position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line);
  background: var(--panel); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.zone__bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.45; }
.zone__bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 16, 40, 0.9), rgba(10, 16, 40, 0.55)); }
.zone__inner { position: relative; padding: 16px 16px 18px; }
.zone__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.zone__head h3 { margin: 0; font-size: 1.25rem; color: var(--zc, var(--yellow)); }
.zone__head p { margin: 0; color: var(--muted); font-size: 0.92rem; flex: 1 1 260px; }
.zone__nodes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.node {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px 10px; border-radius: 16px; border: 2px solid var(--line);
  background: rgba(10, 16, 40, 0.72); cursor: pointer; text-align: center; min-height: 128px;
  transition: transform 0.12s ease, border-color 0.2s ease;
}
.node:hover:not(.is-locked) { transform: translateY(-3px); border-color: var(--zc, var(--yellow)); }
.node__num { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 1.25rem; background: var(--zc, var(--yellow)); color: #1a1200; }
.node__name { font-weight: 800; font-size: 0.92rem; line-height: 1.25; }
.node__topic { color: var(--muted); font-size: 0.78rem; line-height: 1.25; }
.node__stars { font-size: 1rem; letter-spacing: 2px; color: #5b6697; }
.node__stars .on { color: var(--yellow); }
.node.is-current { border-color: var(--yellow); animation: nodePulse 1.8s ease-in-out infinite; }
.node.is-done { border-color: rgba(52, 211, 153, 0.7); }
.node.is-locked { opacity: 0.6; cursor: not-allowed; }
.node.is-locked .node__num { background: #46507f; color: #cbd4f5; }
.node--boss .node__num { background: linear-gradient(135deg, #ff5a5f, #ffd23f); }
.node__lock { position: absolute; top: 6px; right: 8px; font-size: 1rem; }
@media (max-width: 760px) { .zone__nodes { grid-template-columns: repeat(2, 1fr); } }

/* ── 賽前介紹 ── */
.intro { max-width: 640px; margin: 0 auto; }
.intro__card { background: rgba(16, 24, 62, 0.92); border: 1px solid var(--line); border-radius: 22px; padding: 22px 20px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); }
.intro__title { margin: 8px 0 0; font-size: 1.8rem; line-height: 1.25; color: var(--accent); }
.intro__topic { margin: 0 0 8px; font-weight: 800; color: var(--muted); }
.intro__story { margin: 10px 0; font-size: 1.05rem; }
.intro__concept { margin: 10px 0; padding: 10px 14px; border-left: 5px solid var(--accent); background: rgba(255, 255, 255, 0.07); border-radius: 0 12px 12px 0; font-weight: 700; }
.intro__meta { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.intro__meta li { padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); font-weight: 700; font-size: 0.92rem; }
.intro__rival { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 10px 12px; border-radius: 14px; background: rgba(255, 138, 61, 0.14); border: 1px solid rgba(255, 138, 61, 0.45); }
.intro__rival p { margin: 0; font-weight: 700; }
.intro__rival img { border-radius: 50%; background: rgba(255, 255, 255, 0.12); object-fit: contain; }
.intro__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-top: 16px; }

/* ── 比賽畫面 ── */
.screen--play { max-width: 1100px; margin: 0 auto; padding-top: calc(env(safe-area-inset-top, 0px) + 54px); }
.playbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding-right: 0; }
.playbar__info { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.playbar__info strong { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playbar__progress { color: var(--muted); font-size: 0.85rem; }
.playbar__score { display: flex; align-items: baseline; gap: 6px; padding: 4px 14px; border-radius: 14px; background: rgba(13, 20, 48, 0.8); border: 1px solid var(--line); }
.score__label { color: var(--muted); font-size: 0.8rem; }
.playbar__score strong { font-size: 1.4rem; color: var(--yellow); font-variant-numeric: tabular-nums; }
.combo { font-weight: 900; color: #1a1200; background: var(--yellow); border-radius: 999px; padding: 0 8px; font-size: 0.85rem; }

.race { position: relative; height: 78px; margin-bottom: 8px; border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, #2c3354, #1e2440); border: 1px solid var(--line); }
.race::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 0; border-top: 3px dashed rgba(255, 255, 255, 0.35); }
.race__lane { position: absolute; left: 8px; right: 34px; height: 38px; }
.race__lane--rival { top: 0; }
.race__lane--player { top: 38px; }
.race__car { position: absolute; top: 0; height: 38px; width: auto; max-width: none; left: calc(var(--p, 0) * (100% - 62px)); transition: left 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5)); }
.race__finish { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; }

.timer { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.timer__bar { flex: 1; height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.timer__fill { display: block; height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, #34d399, #a3e635); transform-origin: left; transition: background 0.3s ease; }
.timer.is-warn .timer__fill { background: linear-gradient(90deg, #fbbf24, #fb923c); }
.timer.is-danger .timer__fill { background: linear-gradient(90deg, #ff5a5f, #ff8a3d); }
.timer.is-danger .timer__bar { animation: pulseRed 0.9s ease-in-out infinite; }
.timer.is-over .timer__fill { background: #ff5a5f; }
.timer__text { min-width: 3.2em; text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; font-size: 1.2rem; }

.play-stage { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 880px) { .play-stage { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.question-card { background: rgba(16, 24, 62, 0.92); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; }
.question-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.question-card__tools { display: flex; flex-wrap: wrap; gap: 6px; }
.question-card__tag { padding: 2px 12px; border-radius: 999px; background: var(--accent); color: #1a1200; font-weight: 900; font-size: 0.85rem; }
.question-card__prompt { margin: 0; font-size: 1.28rem; line-height: 2; font-weight: 700; overflow-wrap: anywhere; }
@media (max-width: 480px) { .question-card__prompt { font-size: 1.15rem; line-height: 1.95; } }

.play-visual { margin-top: 12px; }
.play-visual.has-visual { padding: 10px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.94); color: #1d2b53; border: 1px solid var(--line); }
.vis { width: 100%; }
.vis__svg { display: block; width: 100%; height: auto; max-height: 230px; }
.vis__label { fill: #1d2b53; font: 800 13px var(--font); }
.vis__tick { fill: #3a4a7e; font: 700 12px var(--font); }
.vis__pt { fill: #c2410c; font: 900 13px var(--font); }
.vis__grid { stroke: #d5dcf2; stroke-width: 1; }
.vis__axis { stroke: #1d2b53; stroke-width: 2; }
.vis__line { stroke: #ef4444; stroke-width: 3.5; stroke-linecap: round; }
.vis__dot { fill: #ef4444; stroke: #fff; stroke-width: 2; }
.vis__chip { fill: #fff3c4; stroke: #e0a100; stroke-width: 2; }
.vis__rect { fill: #bfe3ff; stroke: #1d2b53; stroke-width: 2.5; }
.vis__rect.is-first { fill: #ffe0b8; }
.vis__eq { fill: #1d2b53; font: 900 17px var(--font); }
.vis__beam { fill: #8a5a2b; }
.vis__base { fill: #6b7280; }
.vis__pan { fill: #fcd34d; stroke: #92400e; stroke-width: 2.5; }
.vis__scroll { overflow-x: auto; }
.vis__table { border-collapse: collapse; width: 100%; font-weight: 800; text-align: center; }
.vis__table th, .vis__table td { border: 2px solid #1d2b53; padding: 6px 10px; min-width: 52px; }
.vis__table th { background: #dbe6ff; text-align: left; white-space: nowrap; }
.vis__table td.is-unknown { background: #ffe066; color: #b91c1c; font-size: 1.2rem; }
.vis__track { display: flex; flex-direction: column; gap: 8px; }
.vis__road { position: relative; height: 54px; border-radius: 12px; background: #4b5563; border-bottom: 4px solid #1f2937; }
.vis__road::before { content: ""; position: absolute; left: 8px; right: 36px; top: 50%; border-top: 3px dashed #e5e7eb; }
.vis__car { position: absolute; left: 6px; top: 6px; height: 40px; width: auto; }
.vis__flag { position: absolute; right: 8px; top: 10px; font-size: 1.6rem; }
.vis__road--meet .vis__car { left: 8%; }
.vis__road--meet .vis__car--rev { left: auto; right: 8%; transform: scaleX(-1); }
.vis__end { position: absolute; top: 4px; font-weight: 900; color: #fff; }
.vis__end:first-child { left: 8px; }
.vis__end:last-child { right: 8px; }
.vis__chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.vis .chip { color: #1d2b53; background: #fff3c4; }
.vis .chip--blue { background: #d7efff; border-color: #38bdf8; }

.coach { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 10px 14px; border-radius: var(--radius); background: rgba(52, 211, 153, 0.16); border: 1px solid rgba(52, 211, 153, 0.6); animation: slideUp 0.3s ease both; }
.coach img { flex: none; border-radius: 50%; background: rgba(255, 255, 255, 0.15); object-fit: contain; }
.coach p { margin: 0; font-weight: 700; line-height: 1.9; }

.play-side { display: flex; flex-direction: column; gap: 10px; }
.answer-area { background: rgba(16, 24, 62, 0.92); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }

/* 選擇題 */
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 380px) { .choices { grid-template-columns: 1fr; } }
.choice {
  position: relative; min-height: 60px; padding: 10px 12px 10px 38px; border-radius: 14px;
  border: 2px solid var(--line); background: rgba(255, 255, 255, 0.1); color: var(--text);
  font-size: 1.15rem; font-weight: 800; line-height: 1.5; text-align: left; cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease, border-color 0.2s ease; overflow-wrap: anywhere;
}
.choice:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); border-color: var(--yellow); }
.choice:active:not(:disabled) { transform: scale(0.97); }
.choice__key { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 0.8rem; background: rgba(255, 255, 255, 0.18); }
.choice.is-wrong { background: rgba(255, 90, 95, 0.28); border-color: var(--red); opacity: 0.75; text-decoration: line-through; }
.choice.is-right { background: rgba(52, 211, 153, 0.35); border-color: var(--green); }
.choice:disabled { cursor: default; }

/* 數字鍵盤 */
.np { display: flex; flex-direction: column; gap: 10px; }
.np__display { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 84px; padding: 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); }
.np__field { position: relative; min-width: 72px; min-height: 56px; padding: 6px 12px; display: grid; place-items: center; border-radius: 12px; border: 2px solid var(--line); background: rgba(255, 255, 255, 0.1); font-size: 1.8rem; font-weight: 900; font-variant-numeric: tabular-nums; cursor: pointer; }
.np__field.is-active { border-color: var(--yellow); background: rgba(255, 210, 63, 0.16); box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.25); }
.np__ph { position: absolute; font-size: 0.8rem; font-weight: 700; color: var(--muted); pointer-events: none; }
.np__field--optional { min-width: 62px; }
.np__stack { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.np__stack .np__field { min-height: 48px; min-width: 76px; }
.np__bar { width: 100%; height: 4px; border-radius: 2px; background: var(--text); }
.np__colon { font-size: 2rem; font-weight: 900; }
.np__unit { font-weight: 800; color: var(--muted); align-self: flex-end; padding-bottom: 12px; }
.np__tip { margin: 0; font-size: 0.85rem; color: var(--muted); text-align: center; }
.np__keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.np__key { min-height: 52px; border-radius: 12px; border: 2px solid var(--line); background: rgba(255, 255, 255, 0.12); font-size: 1.5rem; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.np__key:hover:not(:disabled) { background: rgba(255, 255, 255, 0.22); }
.np__key:active:not(:disabled) { transform: scale(0.94); }
.np__key--fn { background: rgba(255, 138, 61, 0.25); }
.np__key:disabled { opacity: 0.3; }
.np__actions { display: flex; gap: 8px; }
.np__act { flex: 1; min-height: 52px; }
.np__submit { flex: 1.6; }
.np.is-shake { animation: shake 0.45s ease both; }
.np.is-disabled { opacity: 0.6; }

/* 回饋 */
.feedback { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 110px); transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 10px; max-width: min(92vw, 460px); padding: 10px 20px; border-radius: 999px; font-weight: 900; font-size: 1.15rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: pop 0.35s ease both; pointer-events: none; }
.feedback--ok { background: #16a34a; color: #fff; }
.feedback--bad { background: #be123c; color: #fff; }
.feedback--warn { background: #d97706; color: #fff; }
.feedback--combo { background: linear-gradient(90deg, #ff5a5f, #ffd23f); color: #2a1a00; }
.feedback .pts { background: rgba(0, 0, 0, 0.25); border-radius: 999px; padding: 0 10px; font-variant-numeric: tabular-nums; }

.resolve { position: fixed; left: 0; right: 0; bottom: 0; z-index: 65; padding: 16px 16px calc(var(--footer-h) + 16px); background: linear-gradient(180deg, rgba(8, 12, 30, 0), rgba(8, 12, 30, 0.96) 22%); animation: slideUp 0.3s ease both; }
.resolve__card { max-width: 640px; margin: 0 auto; padding: 14px 16px; border-radius: var(--radius); background: #16204a; border: 2px solid var(--green); }
.resolve__card h3 { margin: 0 0 4px; color: var(--green); font-size: 1.15rem; }
.resolve__card p { margin: 0 0 10px; line-height: 2; }
.resolve__card .btn { width: 100%; }

/* 進站維修 */
.steps { position: fixed; inset: 0; z-index: 75; display: flex; align-items: flex-start; justify-content: center; padding: calc(env(safe-area-inset-top, 0px) + 56px) 12px calc(var(--footer-h) + 12px); background: rgba(5, 8, 22, 0.78); overflow-y: auto; }
.steps__card { width: min(100%, 540px); padding: 16px; border-radius: 22px; background: #16204a; border: 2px solid var(--accent); animation: pop 0.3s ease both; }
.steps__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.steps__head img { border-radius: 50%; background: rgba(255, 255, 255, 0.15); object-fit: contain; }
.steps__head h3 { margin: 0; font-size: 1.15rem; }
.steps__head span { color: var(--muted); font-size: 0.9rem; }
.steps__q { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); font-size: 1.15rem; font-weight: 700; line-height: 2; }
.steps__msg { min-height: 1.6em; margin: 6px 0; color: #ffe9a8; font-weight: 700; }
.steps__final h4 { margin: 0 0 6px; color: var(--green); }
.steps__final p { line-height: 2; margin: 0 0 10px; }

.countdown { position: fixed; inset: 0; z-index: 78; display: grid; place-items: center; background: rgba(5, 8, 22, 0.62); pointer-events: none; }
.countdown span { font-size: clamp(5rem, 26vw, 11rem); font-weight: 900; color: var(--yellow); text-shadow: 0 6px 0 #b3261e, 0 12px 40px rgba(0, 0, 0, 0.7); animation: countPop 0.85s ease both; }
.countdown span.is-go { color: #86efac; text-shadow: 0 6px 0 #166534, 0 12px 40px rgba(0, 0, 0, 0.7); }

/* 結算 */
.result { max-width: 560px; margin: 0 auto; }
.result__card { text-align: center; padding: 22px 18px; border-radius: 24px; background: rgba(16, 24, 62, 0.94); border: 1px solid var(--line); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5); }
.result__trophy { object-fit: contain; animation: trophyShine 2.4s ease-in-out infinite; }
.result__rank { margin: 0; font-size: 2.2rem; font-weight: 900; color: var(--yellow); letter-spacing: 0.1em; text-shadow: 0 3px 0 #b3261e; }
.stars { display: flex; justify-content: center; gap: 8px; margin: 8px 0; font-size: 3rem; line-height: 1; }
.stars span { color: #3b4676; }
.stars span.on { color: var(--yellow); filter: drop-shadow(0 0 10px rgba(255, 210, 63, 0.7)); animation: starPop 0.6s ease both; }
.result__title { margin: 0; font-size: 1.5rem; }
.result__score { margin: 4px 0 8px; font-size: 1.1rem; font-weight: 800; }
.result__score b { font-size: 2.2rem; color: var(--yellow); font-variant-numeric: tabular-nums; }
.result__stats { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.result__stats li { padding: 8px 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); font-size: 0.85rem; color: var(--muted); }
.result__stats b { display: block; font-size: 1.3rem; color: var(--text); }
.result__note { min-height: 1.6em; font-weight: 800; color: #ffe9a8; }
.result__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.result__actions .btn { flex: 1 1 140px; }

/* 計算紙 */
.scratch { position: fixed; inset: 0; z-index: 82; background: rgba(5, 8, 22, 0.7); display: flex; align-items: stretch; justify-content: center; padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px calc(var(--footer-h) + 8px); }
.scratch__panel { width: min(100%, 900px); display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: #fffdf4; color: #1d2b53; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.scratch__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; background: #ffe9a8; }
.scratch__tip { flex: 1; font-size: 0.85rem; color: #5b4a1a; }
.scratch__tools { display: flex; gap: 6px; }
.scratch__bar .btn--soft { background: rgba(0, 0, 0, 0.08); color: #1d2b53; border-color: rgba(0, 0, 0, 0.18); }
.scratch__canvas { flex: 1; width: 100%; min-height: 220px; touch-action: none; cursor: crosshair; background: repeating-linear-gradient(#fffdf4 0 31px, #e5dfc5 31px 32px); }

/* 對話框與設定 */
.dialog { width: min(92vw, 520px); max-height: min(88dvh, calc(100dvh - 2 * var(--footer-real, var(--footer-h)) - 16px)); padding: 0; border: 1px solid var(--line); border-radius: 22px; background: #16204a; color: var(--text); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); overflow: hidden; }
.dialog--small { width: min(92vw, 400px); }
/* 對話框是 top layer，會蓋過一般元素；遮罩底部留出頁尾的高度，讓版權頁尾保持清楚可讀、不被遮暗 */
.dialog::backdrop { background: rgba(4, 7, 20, 0.72); backdrop-filter: blur(3px); bottom: var(--footer-real, 34px); }
@media (max-width: 600px) { .dialog::backdrop { bottom: var(--footer-real, 48px); } }
.dialog[open] { animation: pop 0.25s ease both; }
.dialog__form { display: flex; flex-direction: column; max-height: inherit; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 6px; }
.dialog__head h2 { margin: 0; font-size: 1.3rem; }
.dialog__body { padding: 8px 16px; overflow-y: auto; }
.dialog__body p { margin: 8px 0; }
.dialog__body ol, .dialog__body ul { padding-left: 1.3em; line-height: 1.9; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 16px 16px; }
.dialog__hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.dialog__note { color: var(--muted); font-size: 0.85rem; }
.setting { display: flex; align-items: center; gap: 12px; margin: 8px 0; flex-wrap: wrap; }
.switch { position: relative; flex: 1 1 200px; min-height: 48px; padding: 8px 64px 8px 14px; border-radius: 14px; border: 2px solid var(--line); background: rgba(255, 255, 255, 0.08); font-weight: 800; font-size: 1rem; text-align: left; cursor: pointer; }
.switch__knob { position: absolute; right: 12px; top: 50%; width: 44px; height: 26px; transform: translateY(-50%); border-radius: 999px; background: #5a648f; transition: background 0.2s ease; }
.switch__knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s ease; }
.switch[aria-checked="true"] .switch__knob { background: var(--green); }
.switch[aria-checked="true"] .switch__knob::after { transform: translateX(18px); }
.slider { flex: 1 1 140px; min-height: 44px; accent-color: var(--yellow); }

@media (max-height: 780px) {
  .np__key { min-height: 46px; font-size: 1.35rem; }
  .np__display { min-height: 70px; }
  .np__act { min-height: 46px; }
  .np__field { min-height: 50px; }
}
@media (max-width: 480px) { .question-card__tools .btn { padding: 6px 10px; font-size: 0.88rem; } }

.setting--col { flex-direction: column; align-items: stretch; gap: 4px; }
.icon-btn { position: relative; overflow: hidden; }
