/* =============================================================================
 *  互動教材版面 + 語言切換 + 共用無障礙樣式（延續 style.css 的配色）
 *  桌機／投影：3D 為主視覺，右側 2D＋資訊卡，下方能量圖，最下方固定操作列。
 *  平板：上下排列；手機：單欄。
 * ========================================================================== */

[hidden] { display: none !important; }
button { touch-action: manipulation; font-family: inherit; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid #c9d6d6; border-bottom-width: 2px;
  border-radius: 5px; background: #f7fafa; font: 600 .78rem/1.4 "Segoe UI", system-ui, sans-serif; text-align: center; color: #2b3a3a;
}

/* ----------------------------- 語言切換 ----------------------------- */
.lang-switch {
  display: inline-flex; border: 1px solid rgba(255, 255, 255, .45); border-radius: 8px; overflow: hidden;
}
.lang-switch button {
  border: none; background: transparent; color: #fff; padding: 7px 11px; font-size: .82rem; cursor: pointer; min-width: 44px;
}
.lang-switch button.active { background: #fff; color: var(--accent); font-weight: 700; }
.lang-switch button:not(.active):hover { background: rgba(255, 255, 255, .18); }

/* ----------------------------- 側欄：教材入口 ----------------------------- */
.nav-lessons .nav-group-title { color: #9a5b00; border-bottom-color: #f6e3c4; }
.lesson-btn { background: #fff8ec; border: 1px solid #f1dfbd; }
.lesson-btn:hover { background: #fdeed2; }
.lesson-btn.active { background: #fdeed2; border-color: #d48a1a; box-shadow: inset 3px 0 0 #d48a1a; }

/* ----------------------------- 教材主框 ----------------------------- */
.lesson-main {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px 0; overflow: hidden; background: var(--bg);
}
.lesson-main.is-fullscreen { padding-top: 14px; }
.lesson-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lesson-title { display: flex; flex-direction: column; min-width: 0; }
.lesson-title .eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .6px; color: #9a5b00; text-transform: uppercase; }
.lesson-title h2 { margin: 0; font-size: 1.38rem; line-height: 1.25; }
.lesson-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lesson-main .ghost-btn {
  background: #fff; color: var(--accent); border-color: var(--border);
}
.lesson-main .ghost-btn:hover { border-color: var(--accent-light); background: var(--accent-soft); }
.ghost-btn.small { padding: 6px 11px; font-size: .82rem; }
.q-toggle.active { background: #b5531d; border-color: #b5531d; }
.ls-objectives {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 16px; box-shadow: var(--shadow);
}
.ls-objectives h3 { margin: 0 0 6px; font-size: .9rem; color: var(--accent); }
.ls-objectives ul { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; }
.ls-objectives li { font-size: .88rem; line-height: 1.55; margin-bottom: 4px; break-inside: avoid; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 0; min-height: 0;
}
.panel-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px 14px; }
.panel-head h3 { margin: 0; font-size: .9rem; color: var(--accent); }
.panel-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.mini-btn {
  border: 1px solid var(--border); background: #fff; color: var(--muted); border-radius: 7px;
  min-width: 32px; height: 30px; padding: 0 8px; cursor: pointer; font-size: .82rem;
}
.mini-btn:hover { border-color: var(--accent-light); color: var(--accent); }
.mini-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tool-seg.small .seg-btn { padding: 4px 9px; font-size: .78rem; }

/* ----------------------------- 主要網格 ----------------------------- */
.lesson-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr) 350px;
  grid-template-rows: minmax(0, 1fr) clamp(170px, 26vh, 250px);
  grid-template-areas: "stage side" "energy side";
}
.lesson-main.no-energy .lesson-grid { grid-template-rows: minmax(0, 1fr); grid-template-areas: "stage side"; }
@media (min-width: 1600px) { .lesson-grid { grid-template-columns: minmax(0, 1fr) 390px; } }

.ls-stage { grid-area: stage; display: flex; flex-direction: column; padding: 10px; }
.ls-side { grid-area: side; display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-bottom: 2px; }
.ls-energy-panel { grid-area: energy; display: flex; flex-direction: column; }

.ls-stage-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ls-stage-body { position: relative; flex: 1 1 auto; min-height: 280px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #f7fbfc; }
.ls-3d { position: absolute; inset: 0; }
.ls-3d.ls-fade { animation: lsFade .38s ease; }
@keyframes lsFade { from { opacity: .25; } to { opacity: 1; } }

.ls-badge {
  position: absolute; top: 10px; left: 10px; z-index: 5; pointer-events: none;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px;
  box-shadow: var(--shadow);
}
.ls-badge-name { font-size: 1.12rem; font-weight: 700; }
.ls-anim-banner {
  position: absolute; top: 10px; right: 10px; z-index: 6; pointer-events: none;
  background: #4a3a8c; color: #fff; padding: 6px 14px; border-radius: 20px; font-size: .86rem;
  box-shadow: 0 4px 14px rgba(40, 30, 90, .25); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
.ls-legend {
  position: absolute; right: 10px; top: 10px; z-index: 5; max-width: min(340px, 45%);
  background: rgba(255, 255, 255, .94); border: 1px solid var(--border); border-radius: 10px; padding: 7px 11px;
  font-size: .8rem; line-height: 1.5; box-shadow: var(--shadow); pointer-events: none;
}
.ls-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.ls-track {
  position: absolute; left: 10px; bottom: 34px; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: #fff7dc; border: 1px solid #ecd28a; color: #5a4300; border-radius: 20px; padding: 5px 6px 5px 12px; font-size: .86rem;
  box-shadow: var(--shadow);
}
.ls-track .dot { width: 10px; height: 10px; border-radius: 50%; background: #f2b705; box-shadow: 0 0 0 3px rgba(242, 183, 5, .3); }
.chip-x { border: none; background: rgba(0, 0, 0, .06); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; color: #5a4300; }
.ls-stage-hint {
  position: absolute; left: 0; right: 0; bottom: 6px; margin: 0; text-align: center;
  font-size: .76rem; color: var(--muted); pointer-events: none; z-index: 4;
}

/* 角色標籤 */
.role-chip { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.role-minimum { background: #e1f3ea; color: #1d6b45; }
.role-intermediate { background: #e2ecfb; color: #27508f; }
.role-transition-state { background: #fde8e1; color: #a2391c; }

/* ----------------------------- 2D 構象圖 ----------------------------- */
.ls-2d-panel { flex: 0 0 auto; }
.ls-2d { height: 180px; padding: 0 8px 8px; }
.ls-2d svg { width: 100%; height: 100%; display: block; }
.d2-atom { cursor: pointer; }
.d2-atom:focus { outline: none; }
.d2-atom:focus-visible circle:first-child { stroke: #f2b705; stroke-width: 3; }

/* ----------------------------- 資訊卡 ----------------------------- */
.ls-info { padding: 12px 16px 12px; flex: 1 0 auto; }
.ls-info-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.ls-step { font-size: .78rem; color: var(--muted); font-weight: 600; }
.ls-state-name { margin: 6px 0 4px; font-size: 1.42rem; line-height: 1.25; }
.ls-energy-val { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 8px; flex-wrap: wrap; }
.ls-energy-val .lbl { font-size: .8rem; color: var(--muted); }
.ls-energy-val .num { font-size: 2rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.ls-energy-val .unit { font-size: .95rem; color: var(--muted); font-weight: 600; }
.ls-energy-val.muted, .ls-energy-val.concealed { font-size: .9rem; color: var(--muted); font-style: italic; }
.ls-energy-val.concealed { color: #a2391c; font-style: normal; font-weight: 600; }
.ls-summary { margin: 0 0 10px; font-size: .92rem; line-height: 1.65; color: #34464a; }
.ls-source { margin: 8px 0 0; font-size: .74rem; color: var(--muted); }
.linklike { border: none; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0 2px; font-size: inherit; }
.ls-track-hint { font-size: .82rem; color: var(--muted); margin: 6px 0 0; padding: 7px 10px; background: #f6f9f9; border-radius: 8px; }
.ls-track-card { margin-top: 6px; background: #fffaea; border: 1px solid #f0dc9f; border-radius: 10px; padding: 9px 11px; }
.ls-track-head { display: flex; align-items: baseline; gap: 8px; font-size: .84rem; color: #6b5200; }
.ls-track-head strong { font-size: 1.05rem; color: #3d2f00; }
.ls-track-head .linklike { margin-left: auto; color: #8a6a00; }
.ls-track-now { font-size: .88rem; margin-top: 5px; color: #4a3d10; }
.ls-track-now strong { margin-left: 4px; }
.ls-compare { display: flex; align-items: stretch; gap: 6px; margin-top: 7px; }
.ls-compare > div:not(.arrow) { flex: 1; background: #fff; border: 1px solid #f0dc9f; border-radius: 8px; padding: 5px 8px; font-size: .78rem; line-height: 1.35; }
.ls-compare span { display: block; color: var(--muted); font-size: .72rem; }
.ls-compare .arrow { align-self: center; color: #b08a1c; font-weight: 700; }
.ls-track-note { font-size: .74rem; color: #7a6a3a; margin: 7px 0 0; line-height: 1.5; }

/* ----------------------------- 提問模式 ----------------------------- */
.q-mode .ls-quiz { order: -1; }
.q-mode .ls-info .ls-summary { display: none; }
.ls-quiz { padding: 12px 16px; border-color: #e7b08c; background: #fffaf6; flex: 0 0 auto; }
.q-head { display: flex; align-items: center; gap: 8px; }
.q-head h3 { margin: 0; font-size: .95rem; color: #a2391c; }
.q-head .ghost-btn { margin-left: auto; }
.q-chips { display: flex; gap: 6px; margin: 10px 0 8px; flex-wrap: wrap; }
.q-chip {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid #e7b08c; background: #fff; color: #a2391c;
  font-weight: 700; cursor: pointer;
}
.q-chip.active { background: #b5531d; border-color: #b5531d; color: #fff; }
.q-title { margin: 4px 0 2px; font-size: .78rem; color: #a2391c; font-weight: 700; }
.q-text { margin: 0 0 10px; font-size: 1.12rem; line-height: 1.5; font-weight: 600; color: #2b2320; }
.q-hint, .q-answer { border-radius: 9px; padding: 9px 11px; font-size: .9rem; line-height: 1.6; margin-bottom: 10px; }
.q-hint { background: #eef6f5; border-left: 3px solid var(--accent-light); }
.q-answer { background: #fff; border: 1px solid #e7b08c; border-left: 4px solid #b5531d; }
.q-hint span, .q-answer span { display: block; font-size: .74rem; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.q-reveal { width: 100%; margin-bottom: 10px; padding: 10px; font-size: .95rem; }
.q-quiz-actions { display: flex; gap: 8px; }
.q-nav { display: flex; gap: 8px; justify-content: space-between; margin-top: 4px; }
.q-nav .ghost-btn[disabled] { opacity: .4; cursor: default; }
.lesson-main .ghost-btn.small + .q-reveal { margin-top: 8px; }
.ls-quiz > .ghost-btn.small { margin-bottom: 10px; }

/* ----------------------------- 能量圖 ----------------------------- */
.ls-energy { flex: 1 1 auto; min-height: 0; padding: 0 6px; }
.ls-energy svg { display: block; }
.ls-energy .grid { stroke: #e6eeee; stroke-width: 1; }
.ls-energy .tick { font-size: 11px; fill: var(--muted); }
.ls-energy .axis-title { font-size: 11px; fill: var(--muted); }
.ls-energy .curve { fill: none; stroke: #a6b8b8; stroke-width: 2; stroke-dasharray: 6 5; }
.ls-energy .curve-active { fill: none; stroke: #4a3a8c; stroke-width: 3; stroke-dasharray: 6 5; opacity: .75; }
.ls-energy .level { stroke: #2d3d40; stroke-width: 4; stroke-linecap: round; }
.ls-energy .node .hit { fill: transparent; cursor: pointer; }
.ls-energy .node:hover .level { stroke: var(--accent-light); }
.ls-energy .node.current .level { stroke: var(--accent); stroke-width: 7; }
.ls-energy .node:focus { outline: none; }
.ls-energy .node:focus-visible .level { stroke: #f2b705; stroke-width: 7; }
.ls-energy .eval { font-size: 13px; font-weight: 700; fill: #2d3d40; font-variant-numeric: tabular-nums; }
.ls-energy .node.current .eval { fill: var(--accent); font-size: 15px; }
.ls-energy .nlabel { font-size: 12px; fill: #45585a; }
.ls-energy .node.current .nlabel { fill: var(--accent); font-weight: 700; }
.ls-energy .ts-mark { font-size: 15px; fill: #a2391c; font-weight: 700; }
.ls-energy .cur-guide { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 4; opacity: .55; }
.ls-energy .axis-marker { fill: #4a3a8c; }
.ls-energy-note { margin: 0; padding: 2px 14px 8px; font-size: .72rem; color: var(--muted); line-height: 1.4; }
.ls-energy-concealed {
  height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px 20px;
  color: #a2391c; font-weight: 600; font-size: .95rem; background: repeating-linear-gradient(135deg, #fffaf6 0 12px, #fdf1e8 12px 24px); border-radius: 8px;
}

/* ----------------------------- 固定操作列 ----------------------------- */
.ls-controls {
  flex: 0 0 auto; position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 -16px; padding: 8px 16px 8px;
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--border); box-shadow: 0 -4px 14px rgba(20, 60, 56, .06);
}
.ls-transport { display: flex; gap: 6px; }
.ctl-btn {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--ink);
  font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.ctl-btn:hover:not([disabled]) { border-color: var(--accent-light); color: var(--accent); }
.ctl-btn[disabled] { opacity: .35; cursor: default; }
.ctl-btn.play { background: var(--accent); color: #fff; border-color: var(--accent); width: 52px; font-size: 1.1rem; }
.ctl-btn.play:hover { background: var(--accent-light); color: #fff; }
.ls-steps { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; padding: 2px 0; }
.ls-pill {
  flex: 1 0 auto; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--border); background: #f7fafa; color: var(--muted); border-radius: 22px;
  padding: 5px 10px 5px 5px; font-size: .8rem; cursor: pointer; white-space: nowrap; min-height: 36px;
}
.ls-pill .n { width: 24px; height: 24px; border-radius: 50%; background: #e3ebeb; color: #3d5050; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .76rem; }
.ls-pill:hover { border-color: var(--accent-light); }
.ls-pill.current { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.ls-pill.current .n { background: var(--accent); color: #fff; }
.ls-switches { display: flex; gap: 6px; flex-wrap: wrap; }
.ls-keys { margin: 0; flex-basis: 100%; font-size: .72rem; color: var(--muted); text-align: center; margin-top: -4px; }

/* ----------------------------- 科學備註 Modal ----------------------------- */
.modal-card.wide { max-width: 880px; }
.notes-body h3 { color: var(--accent); margin: 18px 0 6px; font-size: 1rem; }
.notes-body p { line-height: 1.7; font-size: .9rem; margin: 0 0 8px; color: #2f3f3f; }
.table-wrap { overflow-x: auto; }
.notes-table { border-collapse: collapse; width: 100%; font-size: .82rem; }
.notes-table th, .notes-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: left; white-space: nowrap; }
.notes-table th { background: #f1f7f6; color: #2c4744; }
.notes-table td.num { font-variant-numeric: tabular-nums; }
.notes-small { font-size: .78rem; color: var(--muted); }
.refs { padding-left: 20px; font-size: .84rem; line-height: 1.55; }
.refs li { margin-bottom: 8px; }
.ref-meta { color: var(--muted); font-size: .78rem; }

/* ----------------------------- 投影模式（1920×1080 最佳化） ----------------------------- */
.projection .lesson-title h2 { font-size: 1.7rem; }
.projection .ls-badge-name { font-size: 1.35rem; }
.projection .ls-state-name { font-size: 1.75rem; }
.projection .ls-energy-val .num { font-size: 2.6rem; }
.projection .ls-summary { font-size: 1.02rem; }
.projection .q-text { font-size: 1.3rem; }
.projection .ls-energy .eval { font-size: 15px; }
.projection .ls-energy .node.current .eval { font-size: 18px; }
.projection .ls-energy .nlabel { font-size: 14px; }
.projection .ls-energy .tick, .projection .ls-energy .axis-title { font-size: 13px; }
.projection .lesson-grid { grid-template-columns: minmax(0, 1fr) 400px; }
.projection .ls-2d { height: 250px; }

/* ----------------------------- 低高度桌機：改成可捲動 ----------------------------- */
@media (max-height: 700px) and (min-width: 1101px) {
  .lesson-main { overflow-y: auto; }
  .lesson-grid { flex: 0 0 auto; grid-template-rows: 460px 220px; }
  .lesson-main.no-energy .lesson-grid { grid-template-rows: 460px; }
}

/* ----------------------------- 平板 ----------------------------- */
@media (max-width: 1100px) {
  .lesson-main { overflow-y: auto; }
  .lesson-grid {
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "stage stage" "energy energy" "side side";
  }
  .lesson-main.no-energy .lesson-grid { grid-template-areas: "stage stage" "side side"; grid-template-rows: auto; }
  .ls-stage-body { height: 52vh; min-height: 320px; flex: 0 0 auto; }
  .ls-energy-panel { height: 240px; }
  .ls-side { overflow: visible; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .lesson-main.no-2d .ls-side { grid-template-columns: 1fr; }
  .ls-objectives ul { columns: 1; }
}

/* ----------------------------- 手機 ----------------------------- */
@media (max-width: 820px) {
  .lesson-main { padding: 10px 12px 0; }
  .lesson-title h2 { font-size: 1.15rem; }
  .lesson-head-actions { margin-left: 0; width: 100%; }
  .ls-stage { padding: 8px; }
  .ls-stage-body { height: 46vh; min-height: 280px; }
  .ls-side { grid-template-columns: 1fr; }
  .ls-energy-panel { height: 220px; }
  .ls-badge-name { font-size: .98rem; }
  .ls-legend { max-width: calc(100% - 20px); left: 10px; right: 10px; top: auto; bottom: 52px; font-size: .74rem; }
  .ls-stage-hint { display: none; }
  .ls-track { bottom: 10px; }
  .ls-stage-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .ls-stage-toolbar::-webkit-scrollbar { display: none; }
  .ls-stage-toolbar .tool-spacer { display: none; }
  .ls-stage-toolbar .seg-btn, .ls-stage-toolbar .tool-btn { padding: 7px 10px; font-size: .8rem; flex: 0 0 auto; }
  #ls-btn-full { display: none; }
  .ls-controls { margin: 0 -12px; padding: 6px 8px; gap: 6px; }
  .ls-transport { gap: 4px; }
  #ls-first, #ls-last { display: none; }
  .ctl-btn { width: 40px; height: 40px; }
  .ctl-btn.play { width: 46px; }
  .ls-switches { margin-left: auto; gap: 4px; flex-wrap: nowrap; }
  .ls-switches .tool-btn { padding: 7px 8px; font-size: .74rem; }
  .ls-steps { order: 3; flex-basis: 100%; }
  .ls-pill { flex: 0 0 auto; min-height: 32px; padding: 3px 9px 3px 3px; }
  .ls-keys { display: none; }
  .lang-switch button { padding: 7px 8px; min-width: 40px; }
}
@media (max-width: 420px) {
  .header-actions #btn-projection { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ls-3d.ls-fade { animation: none; }
}

/* ----------------------------- QR Code（投影給學生掃） ----------------------------- */
.qr-btn { display: inline-flex; align-items: center; gap: 6px; }
.qr-icon { width: 16px; height: 16px; flex: 0 0 auto; }
.modal-card.qr-card {
  max-width: none; width: auto; text-align: center;
  padding: 20px 28px 18px; display: flex; flex-direction: column; align-items: center;
}
.qr-card h2 { margin: 0 40px 12px; font-size: 1.35rem; line-height: 1.3; }
.qr-target {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 14px;
  background: #eef3f3; border: 1px solid var(--border); border-radius: 999px;
}
.qr-target button {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  padding: 7px 16px; border-radius: 999px; font-size: .9rem;
}
.qr-target button.active { background: var(--accent); color: #fff; font-weight: 600; }
.qr-box { display: flex; justify-content: center; }
/* 邊長取「寬度」與「卡片高度扣掉文字」較小者，整張卡片不用捲動；投影 1920×1080 約 690 px */
.qr-box svg {
  display: block; height: auto;
  width: min(calc(100vw - 110px), calc(88vh - 270px), 760px); min-width: 180px;
}
.qr-error { color: #b42318; margin: 40px 0; }
.qr-url {
  margin: 12px 0 2px; max-width: 760px; color: var(--accent); word-break: break-all;
  font: 600 1.15rem/1.35 ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.qr-hint { margin: 0 0 12px; max-width: 760px; font-size: .9rem; line-height: 1.5; color: var(--muted); white-space: pre-line; }
.qr-copy {
  border: 1px solid var(--accent-light); background: var(--accent-soft); color: var(--accent);
  padding: 7px 18px; border-radius: 8px; cursor: pointer; font-size: .88rem;
}
.qr-copy:hover { background: #d3ebe7; }
@media (max-width: 820px) {
  .modal-card.qr-card { padding: 16px 16px 14px; }
  .qr-card h2 { font-size: 1.1rem; margin: 0 36px 10px; }
  .qr-url { font-size: .95rem; }
  .qr-box svg { width: min(calc(100vw - 72px), calc(88vh - 270px), 760px); }
}
/* 窄螢幕頁首：依序把 QR 按鈕改成只剩圖示、藏投影模式（小螢幕用不到）、藏使用說明，
   讓標題與按鈕各自維持一行、不會橫向捲動 */
.lang-switch button, .header-actions .ghost-btn { white-space: nowrap; }
@media (max-width: 640px) {
  .header-actions .qr-btn span { display: none; }
  .header-actions .qr-btn { padding: 7px 9px; }
}
@media (max-width: 600px) { .header-actions #btn-projection { display: none; } }
@media (max-width: 480px) { .header-actions #btn-help { display: none; } }
/* 手機：再收緊間距，讓標題與「繁中」維持一行（360 px 起） */
@media (max-width: 420px) {
  .app-header { padding: 0 10px; gap: 8px; }
  .header-actions { gap: 5px; }
  .title-block { min-width: 0; }
  .title-block h1 { font-size: clamp(.84rem, 4.1vw, 1rem); line-height: 1.2; }
  .lang-switch button { padding: 6px 6px; min-width: 34px; }
  .header-actions .qr-btn { padding: 6px 8px; }
}
