﻿/* Ripple（原 Deep Sea Trivia）— 依 Google Stitch 設計稿（專案 5722966402256523926）實作 */
@font-face { font-family: "Inter"; font-weight: 400 700; font-display: swap; src: url(/assets/fonts/inter.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+2191, U+2193, U+2212; }
@font-face { font-family: "Jakarta"; font-weight: 600 800; font-display: swap; src: url(/assets/fonts/jakarta.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+2191, U+2193, U+2212; }

:root {
  --bg-0: #000b1a; --bg-1: #00132c; --bg-2: #0a2e55;
  --ink: #e8f4ff; --ink-2: #bcc8cf; --ink-3: #8fa9c7; --ink-4: #5d7594;
  --cyan: #4fd1ff; --cyan-soft: rgba(79, 209, 255, .14);
  --amber: #ffb547; --amber-2: #f59e0b; --amber-ink: #2a1a00; --amber-soft: rgba(255, 181, 71, .14);
  --green: #4ade80;
  --danger: #ff8a80;
  --glass: rgba(13, 32, 57, .62); --glass-2: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .12); --line-2: rgba(79, 209, 255, .28);
  --r: 12px; --r-lg: 18px;
  --sans: "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  --head: "Jakarta", "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
html { background: var(--bg-0); }
body {
  font-family: var(--sans); color: var(--ink); font-size: 15px; line-height: 1.5;
  background: radial-gradient(120% 70% at 50% -10%, #0f3a66 0%, var(--bg-1) 45%, var(--bg-0) 100%) fixed;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--head); letter-spacing: -.01em; margin: 0; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- 共用元件 ---------- */
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--glass-2); color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap;
  cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, transform .1s; text-decoration: none !important;
}
.btn:hover { background: rgba(255, 255, 255, .11); border-color: rgba(255, 255, 255, .22); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ffc56a, var(--amber-2)); color: var(--amber-ink); border-color: transparent; box-shadow: 0 8px 24px rgba(245, 158, 11, .25); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 10px 30px rgba(245, 158, 11, .35); }
.btn.cyan { background: var(--cyan); color: #00222e; border-color: transparent; box-shadow: 0 8px 24px rgba(79, 209, 255, .25); }
.btn.lg { height: 52px; font-size: 16px; border-radius: 14px; }
.btn.icon { width: 40px; padding: 0; }
.btn.danger:hover { color: var(--danger); border-color: rgba(255, 138, 128, .45); background: rgba(255, 138, 128, .08); }
.btn.on { background: var(--amber-soft); border-color: rgba(255, 181, 71, .6); color: #ffd99a; }
.field { display: grid; gap: 8px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--ink-4); }
.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: rgba(0, 10, 26, .55); transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.input::placeholder { color: var(--ink-4); }
textarea.input { height: auto; min-height: 220px; padding: 12px 14px; resize: vertical; font-family: var(--mono); font-size: 14px; line-height: 1.75; }
.input-wrap { position: relative; }
.input-wrap > svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-wrap .input { padding-left: 42px; padding-right: 44px; }
.input-wrap .peek { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--ink-3); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.input-wrap .peek:hover { color: var(--ink); background: var(--glass-2); }
.err { color: var(--danger); min-height: 1.3em; font-size: 13px; margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--ink-2); background: var(--glass-2); white-space: nowrap; }
.pill.cyan { color: var(--cyan); border-color: var(--line-2); background: var(--cyan-soft); }
.pill.amber { color: var(--amber); border-color: rgba(255, 181, 71, .4); background: var(--amber-soft); }
.code-chip { font-family: var(--mono); font-weight: 700; letter-spacing: .08em; color: var(--amber); border: 1px solid rgba(255, 181, 71, .4); background: var(--amber-soft); border-radius: 7px; padding: 1px 8px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; box-shadow: 0 0 0 3px rgba(255, 138, 128, .18); }
.dot.live { background: var(--green); box-shadow: 0 0 0 3px rgba(74, 222, 128, .18); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, .05); } }
.kbd { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(79, 209, 255, .12); color: var(--cyan); border: 1px solid var(--line-2); }
.brand { display: inline-flex; align-items: center; gap: 12px; font-family: var(--head); font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none !important; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }

/* ---------- 海洋背景（登入 / 輸入代碼頁） ---------- */
.ocean-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ocean-bg::before { content: ""; position: absolute; left: 0; right: 0; top: 54%; bottom: 0; background: linear-gradient(180deg, rgba(10, 74, 122, .55), rgba(0, 11, 26, .2) 60%, transparent); }
.ocean-bg .line { position: absolute; left: 0; right: 0; top: 54%; height: 2px; background: linear-gradient(90deg, transparent, var(--cyan) 30%, var(--cyan) 70%, transparent); box-shadow: 0 0 30px 6px rgba(79, 209, 255, .35); opacity: .6; }
.ocean-bg .glow { position: absolute; left: 50%; top: 54%; width: 90vw; height: 40vh; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(79, 209, 255, .22), transparent); }
.ocean-bg span { position: absolute; font-family: var(--head); font-weight: 700; color: rgba(79, 209, 255, .22); filter: blur(1.5px); animation: drift 9s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateY(-8px); } to { transform: translateY(8px); } }

/* ---------- 登入 / 加入 ---------- */
.center-page { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); padding: 36px 32px 28px; text-align: center; }
.auth-card .pill { margin-bottom: 18px; }
.auth-card .logo { width: 64px; height: 64px; margin: 0 auto 14px; display: block; filter: drop-shadow(0 8px 24px rgba(255, 181, 71, .35)); }
.auth-card h1 { font-size: 26px; }
.auth-card .sub { color: var(--ink-3); font-size: 14px; margin: 6px 0 0; }
.auth-card form { display: grid; gap: 14px; margin-top: 26px; text-align: left; }
.auth-card .alt { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; }
.code-input { text-align: center; font-family: var(--mono); font-size: 32px; height: 64px; letter-spacing: .4em; text-transform: uppercase; font-weight: 800; color: var(--amber); padding-left: .4em; }
.page-foot { position: fixed; left: 24px; right: 24px; bottom: 16px; display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-4); pointer-events: none; }

/* ---------- Dashboard ---------- */
.topnav { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 14px 32px; background: rgba(0, 14, 36, .72); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topnav .spacer { flex: 1; }
.dash { max-width: 1240px; margin: 0 auto; padding: 40px 32px 64px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.dash-head h1 { font-size: 40px; line-height: 1.15; margin-top: 12px; }
.dash-head p { color: var(--ink-3); margin: 8px 0 0; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } .dash, .topnav { padding-left: 18px; padding-right: 18px; } }
.card { padding: 26px; }
.card-head { display: flex; align-items: center; gap: 14px; padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.card-head .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--cyan-soft); color: var(--cyan); border: 1px solid var(--line-2); flex: none; }
.card-head h2 { font-size: 20px; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.card-head .grow { flex: 1; min-width: 0; }
.create { display: grid; gap: 20px; }
.linkish { background: none; border: 0; padding: 0; color: var(--amber); font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.linkish:hover { text-decoration: underline; }
.room-list { display: grid; gap: 14px; }
.ppt-card { grid-column: 1 / -1; }
.ppt-steps { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 12px; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.ppt-steps b { color: var(--ink); }
.cmd { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; padding: 6px 6px 6px 14px; border-radius: 12px; background: rgba(0, 10, 26, .6); border: 1px solid var(--line-2); }
.cmd code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--cyan); overflow-x: auto; white-space: nowrap; }
.ppt-links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ppt-card code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.set-details { border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 10, 26, .3); padding: 0 16px; }
.set-details summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 48px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.set-details summary::-webkit-details-marker { display: none; }
.set-details summary .hint { margin-left: auto; text-align: right; }
.set-details[open] summary { border-bottom: 1px solid var(--line); }
.room { display: flex; align-items: center; gap: 16px; padding: 18px 18px 18px 20px; border-radius: 16px; background: rgba(0, 10, 26, .35); border: 1px solid var(--line); transition: border-color .2s, background .2s, transform .2s; }
.room:hover { border-color: var(--line-2); background: rgba(79, 209, 255, .05); }
.room.latest { border-color: var(--line-2); box-shadow: inset 0 0 0 1px rgba(79, 209, 255, .08), 0 0 40px rgba(79, 209, 255, .06); }
.room .meta { flex: 1; min-width: 0; display: grid; gap: 8px; }
.room .title { font-family: var(--head); font-weight: 800; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 10px; align-items: center; }
.room .title span:last-child { overflow: hidden; text-overflow: ellipsis; }
.room .sub { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--ink-3); }
.room .sub > span { display: inline-flex; align-items: center; gap: 5px; }
.room .sub svg.i { width: 14px; height: 14px; }
.room .actions { display: flex; gap: 8px; flex: none; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line); border-radius: 16px; }
.tip { margin-top: 18px; padding: 16px 18px; border-radius: 14px; background: rgba(0, 10, 26, .35); border: 1px solid var(--line); font-size: 13px; color: var(--ink-3); display: flex; gap: 12px; }
.tip b { color: var(--ink); }
@media (max-width: 560px) { .room { flex-direction: column; align-items: stretch; } .room .actions .btn.primary { flex: 1; } }

/* =====================================================
   講者舞台：一律 100vh、不捲動
   ===================================================== */
html.stage-html, html.stage-html body { overflow: hidden; overscroll-behavior: none; }
.stage { position: fixed; inset: 0; overflow: hidden; overflow: clip; user-select: none; }
.stage.idle { cursor: none; }

.sea-bg { position: absolute; inset: 0; background: radial-gradient(80% 60% at 50% 0%, #0b2a4d 0%, #020d20 55%, #010714 100%); }
.stars { position: absolute; inset: 0 0 auto 0; height: var(--wl, 52%); background-image: radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.5), transparent), radial-gradient(1px 1px at 33% 64%, rgba(255,255,255,.35), transparent), radial-gradient(1px 1px at 58% 18%, rgba(255,255,255,.4), transparent), radial-gradient(1.5px 1.5px at 76% 42%, rgba(255,255,255,.45), transparent), radial-gradient(1px 1px at 88% 12%, rgba(255,255,255,.3), transparent), radial-gradient(1px 1px at 22% 82%, rgba(255,255,255,.25), transparent), radial-gradient(1px 1px at 66% 76%, rgba(255,255,255,.3), transparent); transition: height 1.6s cubic-bezier(.22,.8,.25,1); }
.water {
  position: absolute; left: 0; right: 0; bottom: 0; top: var(--wl, 52%);
  background: radial-gradient(70% 45% at 50% 0%, rgba(79, 209, 255, .2), transparent 70%), linear-gradient(180deg, #0b4775 0%, #073560 18%, #04234a 50%, #021230 80%, #010a1c 100%);
  transition: top 1.6s cubic-bezier(.22, .8, .25, 1);
  overflow-x: clip;
}
.water .wave { position: absolute; left: 0; width: 200%; height: 46px; top: -32px; animation: wave 16s linear infinite; }
.water .wave.w2 { top: -24px; animation-duration: 26s; animation-direction: reverse; }
.water .shine { position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: linear-gradient(90deg, transparent, rgba(160, 235, 255, .9) 25%, rgba(160, 235, 255, .9) 75%, transparent); box-shadow: 0 0 24px 4px rgba(79, 209, 255, .45); opacity: .7; }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.water .rays { position: absolute; inset: 0; background: repeating-linear-gradient(100deg, rgba(180, 235, 255, .045) 0 34px, transparent 34px 110px); -webkit-mask-image: linear-gradient(180deg, #000, transparent 75%); mask-image: linear-gradient(180deg, #000, transparent 75%); animation: rays 20s ease-in-out infinite alternate; }
@keyframes rays { from { transform: translateX(-3%); } to { transform: translateX(3%); } }
.water .wl-label { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); z-index: 3; }
.wl-label { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; color: rgba(190, 235, 255, .75); padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(2, 18, 40, .8); white-space: nowrap; }
.bubble { position: absolute; bottom: -20px; border-radius: 50%; border: 1px solid rgba(180, 230, 255, .35); background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .35), rgba(255, 255, 255, .03)); animation: bubble linear infinite; }
@keyframes bubble { from { transform: translateY(0); opacity: 0; } 10% { opacity: .9; } to { transform: translateY(calc(-1 * var(--h, 400px))); opacity: 0; } }
#bubbles { position: absolute; inset: 0; overflow: hidden; }

/* 頂列：永遠單行 */
.topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 40; height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 22px; background: linear-gradient(180deg, rgba(1, 8, 22, .85), rgba(1, 8, 22, 0)); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(74, 222, 128, .1); border: 1px solid rgba(74, 222, 128, .3); color: #9ff0bf; font-weight: 700; font-size: 12px; letter-spacing: .14em; flex: none; }
.live-pill.off { background: rgba(255, 138, 128, .1); border-color: rgba(255, 138, 128, .3); color: #ffc2bb; }
.topbar .title { font-family: var(--head); font-weight: 800; font-size: clamp(18px, 1.7vw, 26px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.stat { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 10px; background: var(--glass-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-3); white-space: nowrap; flex: none; }
.stat b { font-family: var(--head); font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat.amber b { color: var(--amber); }
.stat svg.i { width: 16px; height: 16px; color: var(--cyan); }
.topbar .spacer { flex: 1 1 0; min-width: 0; }
.tools { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(13, 32, 57, .55); border: 1px solid var(--line); backdrop-filter: blur(12px); flex: none; transition: opacity .4s; }
.tool { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 11px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.tool:hover { background: rgba(255, 255, 255, .09); color: var(--ink); }
.tool.on { background: var(--amber-soft); color: #ffd99a; }
.tool .lbl { display: none; }
@media (min-width: 1500px) { .tool .lbl { display: inline; } }
.tools .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.stage.idle .tools, .stage.idle .help { opacity: 0; }
@media (max-width: 900px) { .stat .t { display: none; } }

/* 名詞 */
#termLayer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.term { position: absolute; left: 0; top: 0; transform-origin: 0 0; border: 0; background: none; padding: 0; color: inherit; cursor: default; pointer-events: auto; transition: transform 1.9s cubic-bezier(.2, .75, .25, 1), opacity .8s; will-change: transform; font-family: var(--head); }
.term .bob { display: inline-flex; align-items: center; gap: 10px; animation: bob var(--d, 6s) ease-in-out var(--dl, 0s) infinite alternate; transition: background .5s, box-shadow .5s, color .5s, padding .5s, opacity .8s, filter .8s; }
@keyframes bob { from { transform: translateY(-5px) rotate(-.5deg); } to { transform: translateY(5px) rotate(.5deg); } }
.term .txt { white-space: nowrap; }
.term .badge { display: none; }
.term .ck { display: none; }
/* 水下：純文字、依深度不同大小與透明度 */
.term.sea .bob { padding: 4px 8px; opacity: var(--op, .6); filter: blur(var(--bl, 0px)); }
.term.sea .txt { font-size: 20px; font-weight: 600; color: #a9dcff; text-shadow: 0 0 14px rgba(79, 209, 255, .35); }
.term.sea.explained .bob { opacity: .75; filter: none; padding: 5px 12px 5px 10px; border-radius: 999px; border: 1px solid rgba(74, 222, 128, .25); background: rgba(74, 222, 128, .06); }
.term.sea.explained .txt { color: #b9d6ea; text-shadow: none; }
.term.sea.explained .ck { display: inline-flex; color: var(--green); }
.term.sea.explained .ck svg { width: 18px; height: 18px; }
/* 水面上：毛玻璃白膠囊 + 琥珀票數 */
.term.risen { z-index: 10; cursor: pointer; }
.term.risen .bob { padding: 12px 14px 12px 26px; border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(222, 238, 252, .92)); color: #06213d; box-shadow: 0 14px 40px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .7) inset, 0 0 34px rgba(79, 209, 255, .18); animation-duration: 4.6s; }
.term.risen .txt { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.term.risen .badge { display: inline-flex; align-items: center; gap: 3px; font-family: var(--head); font-size: 20px; font-weight: 800; padding: 3px 14px; border-radius: 999px; background: linear-gradient(180deg, #ffc66b, var(--amber)); color: var(--amber-ink); font-variant-numeric: tabular-nums; }
.term.risen.top .bob { background: linear-gradient(180deg, #fffaf0, #ffe9c4); box-shadow: 0 14px 44px rgba(0, 0, 0, .4), 0 0 0 3px var(--amber) inset, 0 0 60px rgba(255, 181, 71, .45); }
.term.risen:hover .bob, .term.risen:focus-visible .bob { box-shadow: 0 14px 40px rgba(0, 0, 0, .4), 0 0 0 3px var(--cyan) inset, 0 0 40px rgba(79, 209, 255, .4); }
.term.risen:focus-visible { outline: none; }
.badge.bump { animation: bump .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bump { 40% { transform: scale(1.45); } }
.term.leaving { opacity: 0; }
.term .rank { display: none; }

/* 題目：舞台上方大字，投影 15 公尺外也看得清楚 */
.prompt-h { position: absolute; top: 72px; z-index: 6; margin: 0; text-align: center; font-family: var(--head); font-weight: 800; font-size: clamp(26px, 3.2vw, 56px); line-height: 1.2; letter-spacing: -.01em; color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, .55); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; pointer-events: none; }
.prompt-h[hidden] { display: none !important; }
.con-prompt { margin: 4px 0 0; font-size: 13px; color: var(--cyan); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.surface-cap { position: absolute; left: 50%; transform: translateX(-50%); top: 78px; z-index: 6; display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); background: rgba(2, 14, 34, .55); font-size: 13px; color: var(--ink-2); letter-spacing: .08em; white-space: nowrap; transition: opacity .6s; }
.surface-cap i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.empty-hint { position: absolute; left: 0; right: 0; text-align: center; z-index: 6; pointer-events: none; transition: opacity .6s; }
.empty-hint .big { font-family: var(--head); font-weight: 700; font-size: clamp(22px, 2.4vw, 34px); color: var(--ink); }
.empty-hint .small { margin-top: 8px; color: var(--ink-3); font-size: clamp(14px, 1.2vw, 18px); }

/* QR 卡 */
.qr-card { position: absolute; right: 22px; top: 82px; z-index: 30; width: var(--qrw, 260px); padding: 18px; cursor: zoom-in; text-align: center; transition: opacity .4s, transform .4s; }
.qr-card.hidden { opacity: 0; transform: translateX(30px); pointer-events: none; }
.qr-card .qh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 13px; font-weight: 700; color: var(--amber); }
.qr-card .qh span { display: inline-flex; align-items: center; gap: 8px; }
.qr-card .qh i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.qr-card img { width: 100%; aspect-ratio: 1; display: block; background: #fff; border-radius: 14px; padding: 10px; }
.qr-card .cl { margin-top: 14px; font-size: 12px; color: var(--ink-3); }
.qr-card .code { margin-top: 6px; display: flex; justify-content: space-around; padding: 8px 6px; border-radius: 12px; border: 1px solid rgba(255, 181, 71, .45); background: var(--amber-soft); font-family: var(--head); font-weight: 800; font-size: 28px; color: var(--amber); }
.qr-card .url { margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-card .cap { margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.qr-card .lock { margin-top: 12px; padding: 8px; border-radius: 10px; background: var(--amber-soft); color: #ffd99a; font-size: 13px; font-weight: 600; }

.help { position: absolute; left: 22px; bottom: 18px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: rgba(2, 14, 34, .6); border: 1px solid var(--line); font-size: 12px; color: var(--ink-3); transition: opacity .4s; white-space: nowrap; }
.help .s { opacity: .4; }

/* 大 QR */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(1, 8, 22, .9); backdrop-filter: blur(10px); cursor: zoom-out; }
.qr-big { display: flex; align-items: center; gap: 6vw; padding: 4vh 5vw; }
.qr-big img { height: min(70vh, 46vw); aspect-ratio: 1; background: #fff; border-radius: 26px; padding: 18px; box-shadow: 0 0 80px rgba(79, 209, 255, .25); }
.qr-big .side { display: grid; gap: 2.4vh; text-align: left; }
.qr-big .k { font-size: clamp(16px, 1.6vw, 24px); color: var(--ink-3); }
.qr-big .t { font-family: var(--head); font-weight: 800; font-size: clamp(30px, 3.6vw, 60px); line-height: 1.15; }
.qr-big .u { font-family: var(--mono); font-size: clamp(16px, 1.8vw, 28px); color: var(--cyan); }
.qr-big .code { font-family: var(--head); font-weight: 800; font-size: clamp(44px, 6vw, 100px); letter-spacing: .25em; color: var(--amber); text-shadow: 0 0 40px rgba(255, 181, 71, .35); }

/* 編輯抽屜 */
.drawer { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(460px, calc(100% - 24px)); z-index: 90; padding: 24px; display: flex; flex-direction: column; gap: 16px; transform: translateX(110%); transition: transform .35s cubic-bezier(.2, .8, .2, 1); user-select: text; }
.drawer.open { transform: none; }
.drawer .field.grow { flex: 1; min-height: 0; grid-template-rows: auto 1fr; }
.drawer textarea.input { min-height: 0; height: 100%; resize: none; }
.drawer .row { display: flex; gap: 10px; justify-content: flex-end; }
.drawer h2 { font-size: 20px; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 120; transform: translate(-50%, 30px); opacity: 0; display: flex; gap: 14px; align-items: center; padding: 10px 10px 10px 18px; transition: transform .3s, opacity .3s; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.banner { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(1, 8, 22, .92); }

/* ---------- 舞台：呈現方式 ---------- */
.kbd.dark { background: rgba(0, 0, 0, .15); color: inherit; border-color: transparent; }
.reveal-btn { height: 40px; flex: none; animation: glowPulse 2.2s ease-in-out infinite; }
@keyframes glowPulse { 50% { box-shadow: 0 0 0 6px rgba(255, 181, 71, .18), 0 8px 30px rgba(245, 158, 11, .45); } }
.next-btn, .pend-btn { flex: none; }
.pend-btn { border-color: rgba(255, 181, 71, .5); color: #ffd99a; background: var(--amber-soft); }
.pend-btn b { font-variant-numeric: tabular-nums; }
.stage:not(.view-sea) .wl-label { opacity: 0; }
.wl-label { transition: opacity .5s; }
.stage:not(.view-sea):not(.view-cloud) #termLayer { pointer-events: none; }
.stage:not(.view-sea):not(.view-cloud) .term { opacity: 0; }

/* 文字雲：純文字，票越多越大 */
.term.cloud .bob { padding: 2px 8px; animation-duration: 7s; }
.term.cloud .txt { font-size: 26px; font-weight: 800; color: var(--cc, #8fb6d9); letter-spacing: -.01em; transition: color .6s, text-shadow .6s; }
.term.cloud:not(.hot) .bob { opacity: .35; }
.term.cloud.hot { cursor: pointer; z-index: 10; }
.term.cloud.hot .txt, .term.cloud.top .txt { text-shadow: none; }
.term.cloud.hot:hover .txt { color: #fff; }
.term.cloud .badge, .term.cloud .ck { display: none !important; }
.term.by-aud .txt::before { content: ""; display: inline-block; width: .32em; height: .32em; margin-right: .35em; border-radius: 50%; background: var(--cyan); vertical-align: .2em; box-shadow: 0 0 8px var(--cyan); }
.term.sea.by-aud .txt::before { opacity: .7; }

/* 長條圖 */
.bars { position: absolute; z-index: 8; display: none; }
.view-bars .bars { display: block; }
.bar-row {
  position: absolute; left: 0; right: 0; top: 0; height: calc(var(--rh) - 10px);
  display: grid; grid-template-columns: calc(var(--rh) * .9) minmax(0, 26%) 1fr calc(var(--rh) * 1.6); align-items: center; gap: 14px;
  padding: 0 14px 0 6px; border: 0; border-radius: 14px; background: rgba(13, 32, 57, .45); color: var(--ink);
  font-family: var(--head); font-size: clamp(14px, calc(var(--rh) * .4), 30px); cursor: pointer; text-align: left;
  transition: transform .9s cubic-bezier(.2, .8, .2, 1), opacity .6s, background .3s, box-shadow .3s;
}
.bar-row.new, .bar-row.out { opacity: 0; }
.bar-row:hover { background: rgba(79, 209, 255, .1); box-shadow: inset 0 0 0 2px var(--cyan); }
.bar-row .rank { font-weight: 800; color: var(--ink-3); text-align: center; font-size: .85em; }
.bar-row .bname { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { height: 62%; border-radius: 999px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.bar-row .fill { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #1b8fd1, var(--cyan)); box-shadow: 0 0 20px rgba(79, 209, 255, .35); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.bar-row .bval { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.bar-row.top { background: linear-gradient(90deg, rgba(255, 181, 71, .16), rgba(13, 32, 57, .45)); }
.bar-row.top .rank, .bar-row.top .bval { color: var(--amber); }
.bar-row.top .fill { background: linear-gradient(90deg, #f59e0b, #ffc56a); box-shadow: 0 0 26px rgba(255, 181, 71, .5); }
.bar-row.by-aud .bname::before { content: ""; display: inline-block; width: .35em; height: .35em; margin-right: .4em; border-radius: 50%; background: var(--cyan); vertical-align: .18em; }
.bar-more { position: absolute; left: 0; right: 0; top: 0; padding: 10px 20px; color: var(--ink-3); font-size: 15px; transition: transform .9s cubic-bezier(.2, .8, .2, 1); }

/* 甜甜圈 */
.donut { position: absolute; z-index: 8; display: none; align-items: center; justify-content: center; gap: 5vw; }
.view-donut .donut { display: flex; }
.d-chart { position: relative; width: var(--ds); height: var(--ds); flex: none; }
.d-chart svg { width: 100%; height: 100%; overflow: visible; }
.d-track { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: 30; }
.d-seg { fill: none; stroke-width: 30; cursor: pointer; transition: stroke-dasharray 1s cubic-bezier(.2, .8, .2, 1), stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1), stroke-width .2s; filter: drop-shadow(0 0 8px rgba(0, 0, 0, .3)); }
.d-seg:hover { stroke-width: 36; }
.d-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.d-center b { font-family: var(--head); font-weight: 800; font-size: calc(var(--ds) * .2); line-height: 1; font-variant-numeric: tabular-nums; }
.d-center span { color: var(--ink-3); font-size: calc(var(--ds) * .06); margin-top: 6px; }
.d-legend { display: grid; gap: 10px; min-width: 0; flex: 0 1 46%; font-size: clamp(16px, calc(var(--ds) / (var(--n) + 3) * .55), 30px); }
.lrow { display: grid; grid-template-columns: .8em minmax(0, 1fr) auto 3.2em; align-items: center; gap: 14px; padding: .35em .6em; border: 0; border-radius: 12px; background: none; color: var(--ink); font-family: var(--head); font-size: 1em; text-align: left; cursor: pointer; transition: background .2s; }
div.lrow { cursor: default; color: var(--ink-3); }
button.lrow:hover { background: rgba(79, 209, 255, .1); }
.lrow .ld { width: .8em; height: .8em; border-radius: 50%; }
.lrow .ln { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .lv { font-variant-numeric: tabular-nums; }
.lrow .lp { color: var(--ink-3); font-size: .8em; text-align: right; font-variant-numeric: tabular-nums; }
.lrow.top .ln { color: var(--amber); }

/* 揭曉前的等待面板 */
.waiting { position: absolute; z-index: 25; transform: translate(-50%, -50%); padding: 34px 54px; text-align: center; min-width: min(560px, 80vw); }
.w-k { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; letter-spacing: .14em; color: var(--cyan); font-weight: 700; }
.w-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); animation: pulse 1.6s infinite; }
.w-nums { display: flex; justify-content: center; gap: 70px; margin: 22px 0 18px; }
.w-nums div { display: grid; gap: 4px; }
.w-nums b { font-family: var(--head); font-weight: 800; font-size: clamp(56px, 7vw, 110px); line-height: 1; font-variant-numeric: tabular-nums; background: linear-gradient(180deg, #fff, #9fdcff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.w-nums span { color: var(--ink-3); font-size: 16px; }
.w-hint { color: var(--ink-3); font-size: 15px; }
.stage.flash::after { content: ""; position: absolute; inset: 0; z-index: 50; pointer-events: none; background: radial-gradient(60% 50% at 50% 45%, rgba(255, 210, 140, .35), transparent 70%); animation: flash 1.2s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* 設定抽屜與設定元件 */
.settings-drawer { gap: 0; padding: 0; }
.sd-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.sd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 22px 22px; overscroll-behavior: contain; }
.set-group { border: 0; margin: 0; padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; gap: 10px; min-width: 0; }
.set-group:last-child { border-bottom: 0; }
.set-group legend { padding: 0; margin-bottom: 10px; }
.set-hint { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(0, 10, 26, .55); border: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 8px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--ink-3); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.seg label svg.i { width: 15px; height: 15px; }
.seg label:hover { color: var(--ink); }
.seg input:checked + label { background: var(--cyan); color: #00222e; box-shadow: 0 4px 14px rgba(79, 209, 255, .3); }
.seg input:focus-visible + label { outline: 2px solid var(--cyan); outline-offset: 2px; }
.input.mini { height: 36px; width: auto; padding: 0 10px; font-size: 13px; }
.btn.mini { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.ok:hover { color: var(--green); border-color: rgba(74, 222, 128, .45); background: rgba(74, 222, 128, .08); }
.pend-head { display: flex; justify-content: space-between; align-items: center; }
.pend-list { display: grid; gap: 8px; }
.pend-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; background: rgba(0, 10, 26, .45); border: 1px dashed var(--line-2); }
.pend-row .pt { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.pend-row .btn.icon { width: 36px; height: 36px; }
.cl-row { display: flex; gap: 14px; align-items: center; }
.cl-row img { width: 96px; height: 96px; border-radius: 10px; background: #fff; padding: 4px; flex: none; }
.cl-row .url { font-family: var(--mono); font-size: 12px; color: var(--cyan); margin-bottom: 8px; word-break: break-all; }

/* =====================================================
   聽眾手機頁：App shell，整頁不捲動，名詞自動縮放塞滿一屏
   ===================================================== */
html.aud-html, html.aud-html body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.aud { height: 100vh; height: 100dvh; max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; padding: max(14px, env(safe-area-inset-top)) 16px 0; }
.aud-top { display: flex; justify-content: space-between; align-items: center; }
.aud-top .conn { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.aud-head { margin: 14px 0 12px; }
.aud-head .over { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--cyan); letter-spacing: .04em; }
.aud-head h1 { font-size: clamp(22px, 6.4vw, 30px); line-height: 1.2; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.aud-head p { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.lock-banner { margin-bottom: 10px; padding: 8px 12px; border-radius: 12px; border: 1px solid rgba(255, 181, 71, .5); background: var(--amber-soft); color: #ffd99a; font-size: 13px; }
.cloud { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior: contain; scrollbar-width: none; font-size: var(--fs, 17px); margin: 0 -16px; }
.cloud::-webkit-scrollbar { display: none; }
.pg { flex: 0 0 100%; min-width: 0; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; display: flex; flex-wrap: wrap; align-content: flex-start; gap: calc(var(--fs, 17px) * .55); padding: 2px 16px 12px; }
.pager { flex: none; display: flex; justify-content: center; align-items: center; gap: 8px; height: 26px; font-size: 12px; color: var(--ink-3); }
.pager button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .25); cursor: pointer; transition: width .25s, background .25s; }
.pager button.on { width: 22px; background: var(--cyan); }
.pager .sw { margin-left: 6px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: .45em; max-width: 100%;
  min-height: 2.6em; padding: .45em .55em .45em .95em; border-radius: 999px; cursor: pointer; touch-action: manipulation;
  background: rgba(13, 32, 57, .7); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--head); font-weight: 700; font-size: 1em; line-height: 1.2; text-align: left;
  transition: background .2s, border-color .2s, transform .12s, box-shadow .2s, opacity .2s;
}
.chip:active { transform: scale(.96); }
.chip .name { overflow-wrap: anywhere; }
.chip .n { font-family: var(--sans); font-size: .68em; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip .st { width: 1.55em; height: 1.55em; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1px solid var(--line-2); color: var(--cyan); background: var(--cyan-soft); }
.chip .st svg { width: .9em; height: .9em; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chip .st .ok { display: none; }
.chip[aria-pressed="true"] { background: linear-gradient(180deg, rgba(255, 181, 71, .28), rgba(255, 181, 71, .14)); border-color: var(--amber); box-shadow: 0 0 22px rgba(255, 181, 71, .22); color: #fff3df; }
.chip[aria-pressed="true"] .n { color: #ffd99a; }
.chip[aria-pressed="true"] .st { background: var(--amber); border-color: transparent; color: var(--amber-ink); }
.chip[aria-pressed="true"] .st .ok { display: block; }
.chip[aria-pressed="true"] .st .plus { display: none; }
.chip.explained:not([aria-pressed="true"]) { opacity: .6; border-color: rgba(74, 222, 128, .3); }
.chip.explained:not([aria-pressed="true"]) .st { border-color: rgba(74, 222, 128, .4); background: rgba(74, 222, 128, .1); color: var(--green); }
.chip.explained:not([aria-pressed="true"]) .st .ok { display: block; }
.chip.explained:not([aria-pressed="true"]) .st .plus { display: none; }
.chip[disabled] { opacity: .4; cursor: not-allowed; }
.chip.pop { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 50% { transform: scale(1.08); } }
.aud-foot { flex: none; margin: 0 -16px; padding: 12px 18px max(12px, env(safe-area-inset-bottom)); background: rgba(0, 10, 26, .85); border-top: 1px solid var(--line); backdrop-filter: blur(14px); display: flex; align-items: center; gap: 12px; }
.aud-foot .cnt { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center; font-family: var(--head); font-weight: 800; font-size: 18px; color: var(--amber); border: 1px solid rgba(255, 181, 71, .45); background: var(--amber-soft); }
.aud-foot .tx { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; }
.aud-foot .tx small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.aud-foot .legend { display: flex; gap: 10px; font-size: 11px; color: var(--ink-4); white-space: nowrap; }
.aud-foot .legend span { display: inline-flex; align-items: center; gap: 4px; }
.aud-foot .legend i { width: 8px; height: 8px; border-radius: 50%; }
.empty-cloud { margin: auto; text-align: center; color: var(--ink-3); }
.hidden-banner { margin-bottom: 10px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--cyan-soft); color: #bfeeff; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.hidden-banner svg.i { width: 16px; height: 16px; }
.add-btn { flex: none; height: 40px; border-color: var(--line-2); color: var(--cyan); background: var(--cyan-soft); }
.chip.pend { cursor: default; border-style: dashed; border-color: var(--line-2); background: transparent; color: var(--ink-2); padding-right: .95em; }
.chip.pend .n { color: var(--cyan); }
.sheet-bg { position: fixed; inset: 0; z-index: 140; background: rgba(1, 8, 22, .6); backdrop-filter: blur(3px); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; margin: 0 auto; max-width: 680px; padding: 20px 18px max(18px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; display: grid; gap: 12px; animation: sheetIn .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheetIn { from { transform: translateY(100%); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-size: 20px; }
.sheet-sub { margin: 0; font-size: 13px; color: var(--ink-3); }
.snack { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); z-index: 160; transform: translate(-50%, -140%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; background: rgba(13, 32, 57, .96); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: transform .3s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.snack.show { transform: translate(-50%, 0); }
.snack:not(.show) { visibility: hidden; transition: transform .3s, visibility 0s .3s; }
.snack.err { border-color: rgba(255, 138, 128, .5); color: #ffd1cc; }
.snack.ok { border-color: rgba(74, 222, 128, .45); color: #c8f7d8; }
@media (max-height: 700px) {
  .aud-head { margin: 10px 0 8px; }
  .aud-head p, .aud-head .over { display: none; }
  .aud-head h1 { font-size: 21px; -webkit-line-clamp: 1; }
  .aud-foot { padding-top: 9px; padding-bottom: max(9px, env(safe-area-inset-bottom)); }
}

/* 講者手機控制台 */
.con .aud-head h1 { font-size: 22px; -webkit-line-clamp: 1; }
.con-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.con-stats div { display: grid; padding: 10px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); text-align: center; }
.con-stats b { font-family: var(--head); font-size: 24px; font-variant-numeric: tabular-nums; }
.con-stats span { font-size: 12px; color: var(--ink-3); }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0, 10, 26, .55); border: 1px solid var(--line); margin-bottom: 12px; }
.tab { flex: 1; height: 38px; border: 0; border-radius: 9px; background: none; color: var(--ink-3); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab.on { background: var(--cyan); color: #00222e; }
.tab-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber); color: var(--amber-ink); font-size: 12px; display: inline-grid; place-items: center; }
.tab-panel { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.tab-panel[hidden] { display: none; }
.con-row { display: flex; gap: 8px; }
.con-row .btn:first-child { flex: 1; }
.con-row .btn.icon { width: 52px; }
.con-list { display: grid; gap: 8px; }
.con-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 22px; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); text-align: left; cursor: pointer; font-family: var(--head); font-size: 16px; }
.con-item:active { transform: scale(.98); }
.con-item .ci-r { color: var(--ink-3); font-weight: 800; }
.con-item .ci-n { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.con-item .ci-v { color: var(--amber); font-variant-numeric: tabular-nums; }
.con-item svg.i { color: var(--green); }
.con-item.top { border-color: rgba(255, 181, 71, .55); background: var(--amber-soft); }

/* ---------- 嵌入模式（PowerPoint 投影片內） ---------- */
html.embed .tools, html.embed .help, html.embed #bPending, html.embed #bNext, html.embed .w-hint { display: none !important; }
html.embed .reveal-btn .kbd { display: none; }

/* ---------- 增益集測試模式：背景全透明，只畫半透明色帶與資訊卡 ---------- */
html.addin.probe, html.addin.probe body { background: transparent !important; }
.ad-probe { position: absolute; inset: 0; color: #fff; font-family: var(--sans); }
.pb-stripe { position: absolute; left: 0; right: 0; top: 18%; height: 22%; display: grid; place-items: center; text-align: center; padding: 0 20px; background: rgba(255, 64, 160, .35); font-weight: 700; font-size: 18px; color: #fff; text-shadow: 0 1px 4px #000; }
.pb-card { position: absolute; left: 4%; right: 4%; bottom: 5%; padding: 14px 18px; border-radius: 14px; background: rgba(2, 14, 34, .88); border: 1px solid var(--line-2); display: grid; gap: 8px; }
.pb-big { font-family: var(--head); font-weight: 800; font-size: 28px; }
.pb-big b { color: var(--amber); }
.pb-meta { font-size: 12px; color: var(--ink-2); }
.pb-meta code { color: var(--cyan); }
.pb-log { margin: 0; max-height: 120px; overflow: hidden; font: 11px/1.45 var(--mono); color: #bfe; white-space: pre-wrap; }

/* ---------- PowerPoint 增益集外框 ---------- */
html.addin, html.addin body { height: 100%; overflow: hidden; background: #000b1a; }
.ad-frame { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: #000b1a; }
.ad-panel { position: absolute; inset: 0; overflow-y: auto; display: grid; place-items: center; padding: 20px; background: radial-gradient(120% 70% at 50% -10%, #0f3a66 0%, var(--bg-1) 45%, var(--bg-0) 100%); }
.ad-card { width: min(560px, 100%); padding: 24px; display: grid; gap: 14px; }
.ad-card h1 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.ad-card h1 img { width: 32px; height: 32px; }
.ad-rooms { display: grid; gap: 8px; max-height: 46vh; overflow-y: auto; }
.ad-room { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 10, 26, .4); color: var(--ink); text-align: left; cursor: pointer; }
.ad-room:hover, .ad-room.sel { border-color: var(--cyan); background: var(--cyan-soft); }
.ad-room .t { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ad-row .input { flex: 1; min-width: 140px; }
.ad-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.ad-check input { width: 18px; height: 18px; accent-color: var(--cyan); }
.ad-bar { position: absolute; left: 10px; bottom: 10px; z-index: 10; display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 12px; background: rgba(2, 14, 34, .88); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); backdrop-filter: blur(8px); }
.ad-bar .btn { height: 30px; padding: 0 10px; font-size: 12.5px; }
.ad-bar b { color: var(--amber); font-family: var(--mono); letter-spacing: .08em; }

@media (prefers-reduced-motion: reduce) {
  .term .bob, .wave, .rays, .bubble, .ocean-bg span, .dot.live { animation: none !important; }
  .term { transition-duration: .4s; }
}


/* =====================================================
   Ripple P1：多活動、問題清單、聆聽中
   ===================================================== */
/* 頂列的活動切換器 */
.act-box { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 4px; border-radius: 10px; background: var(--glass-2); border: 1px solid var(--line); flex: 0 1 auto; min-width: 0; max-width: 34vw; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.act-box:hover { border-color: var(--line-2); }
.act-step { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--ink-2); cursor: pointer; flex: none; padding: 0; }
.act-step:hover:not(:disabled) { background: rgba(255, 255, 255, .1); color: var(--ink); }
.act-step:disabled { opacity: .3; cursor: default; }
.act-step svg.i { width: 16px; height: 16px; }
.act-pos { font-family: var(--head); font-weight: 800; color: var(--cyan); white-space: nowrap; font-variant-numeric: tabular-nums; flex: none; }
.act-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.act-name:empty { display: none; }
html.embed .act-box { display: none; }

/* 活動清單抽屜 */
.acts-drawer { left: 12px; right: auto; transform: translateX(calc(-100% - 24px)); }
.acts-drawer.open { transform: none; }
.act-list { display: grid; gap: 8px; }
.act-row { display: flex; align-items: stretch; gap: 6px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 10, 26, .4); padding: 4px; }
.act-row.on { border-color: var(--cyan); background: var(--cyan-soft); }
.act-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: inherit; text-align: left; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.act-main:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
.act-main:disabled { cursor: default; }
.act-n { width: 22px; text-align: center; font-family: var(--head); font-weight: 800; color: var(--ink-3); flex: none; }
.act-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--glass-2); color: var(--cyan); flex: none; }
.act-t { display: grid; min-width: 0; }
.act-t b { font-family: var(--head); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-t small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-live { height: 22px; font-size: 11px; flex: none; }
.act-tools { display: grid; grid-template-columns: repeat(2, 30px); gap: 2px; align-content: center; }
.act-tools .btn.icon.mini { width: 30px; height: 26px; padding: 0; border-radius: 8px; }
.act-tools svg.i { width: 15px; height: 15px; }
.act-new { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.act-new-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.act-new-row .btn { padding: 0 8px; }

/* 問題清單 */
.qlist { position: absolute; z-index: 6; display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); grid-auto-rows: min-content; align-content: start; gap: 12px 18px; overflow: hidden; font-size: var(--qfs, 22px); }
.qcard { position: relative; display: flex; align-items: center; gap: .7em; padding: .6em .9em .6em .6em; border-radius: 16px; border: 1px solid var(--line); background: rgba(13, 32, 57, .72); color: var(--ink); text-align: left; cursor: pointer; font-family: var(--head); font-size: 1em; line-height: 1.3; overflow: hidden; transition: background .4s, border-color .4s, opacity .5s; animation: qin .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes qin { from { opacity: 0; transform: translateY(14px); } }
.qcard:hover { border-color: var(--cyan); }
.qcard .qtx { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.qcard .qup { flex: none; display: grid; justify-items: center; min-width: 2.6em; padding: .25em .3em; border-radius: 12px; background: var(--amber-soft); color: var(--amber); }
.qcard .qup svg.i { width: .8em; height: .8em; transform: rotate(-90deg); }
.qcard .qv { font-size: 1.05em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.qcard .qm { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--amber-2), var(--amber)); transition: width .8s; }
.qcard.top { border-color: rgba(255, 181, 71, .65); background: linear-gradient(90deg, rgba(255, 181, 71, .18), rgba(13, 32, 57, .72)); }
.qcard.by-aud .qtx::before { content: ""; display: inline-block; width: .32em; height: .32em; margin: 0 .4em .12em 0; border-radius: 50%; background: var(--cyan); vertical-align: middle; }
.qcard.answered { opacity: .45; background: rgba(13, 32, 57, .4); }
.qcard.answered .qup { background: rgba(74, 222, 128, .12); color: var(--green); }
.qcard.answered .qtx { text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, .25); }
.qmore { position: absolute; z-index: 6; text-align: center; font-size: 14px; color: var(--ink-3); }
.stage.view-list .wl-label { opacity: 0; }

/* 名詞海：長文字換行（最多 3 行），水下最多 2 行 */
.term .txt { white-space: normal; max-width: 15em; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; line-height: 1.2; }
.term.sea .txt { -webkit-line-clamp: 2; max-width: 13em; }

/* 聆聽中 */
.listen { position: absolute; left: 0; right: 0; top: 34%; z-index: 7; text-align: center; padding: 0 340px 0 40px; pointer-events: none; }
.idle-k { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(2, 18, 40, .7); color: #bfeeff; font-weight: 700; letter-spacing: .12em; font-size: clamp(13px, 1vw, 16px); }
.idle-t { margin-top: 18px; font-family: var(--head); font-weight: 800; font-size: clamp(30px, 4vw, 68px); line-height: 1.15; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); }
.idle-s { margin-top: 12px; color: var(--ink-3); font-size: clamp(15px, 1.3vw, 20px); }
.stage.is-idle #termLayer, .stage.is-idle .bars, .stage.is-idle .donut, .stage.is-idle .qlist, .stage.is-idle .qmore, .stage.is-idle .wl-label { opacity: 0; pointer-events: none; }
.stage.is-idle .stat.amber, .stage.is-idle #bView, .stage.is-idle #bUndo, .stage.is-idle #bLock, .stage.is-idle #bEdit, .stage.is-idle #bSet, .stage.is-idle #bReset { display: none; }
.stage.scene-in #termLayer, .stage.scene-in .bars, .stage.scene-in .donut, .stage.scene-in .qlist, .stage.scene-in .prompt-h, .stage.scene-in .listen { animation: sceneIn .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes sceneIn { from { opacity: 0; transform: translateY(24px); } }

/* 聽眾手機：長文字（問答）改成一列一則 */
.cloud.long .pg { flex-direction: column; flex-wrap: nowrap; gap: calc(var(--fs, 17px) * .45); }
.cloud.long .chip { width: 100%; border-radius: 16px; justify-content: space-between; min-height: 2.8em; }
.cloud.long .chip .name { flex: 1; min-width: 0; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cloud.long .chip .st { width: auto; height: 1.8em; padding: 0 .55em; border-radius: 999px; gap: .2em; display: inline-flex; align-items: center; font-family: var(--sans); font-size: .78em; font-weight: 800; }
.cloud.long .chip .st::after { content: "+1"; }
.cloud.long .chip[aria-pressed="true"] .st::after { content: "已 +1"; }
.cloud.long .chip .st svg { display: none !important; }
.aud-idle { flex: 1; display: grid; place-content: center; text-align: center; gap: 12px; padding-bottom: 12vh; }
.aud-idle .ring { width: 92px; height: 92px; margin: 0 auto; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; position: relative; }
.aud-idle .ring::before, .aud-idle .ring::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--cyan); opacity: 0; animation: ripple 2.8s ease-out infinite; }
.aud-idle .ring::after { animation-delay: 1.4s; }
@keyframes ripple { from { transform: scale(.6); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }
.aud-idle .ring i { width: 18px; height: 18px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 18px var(--amber); }
.aud-idle h2 { font-size: 22px; }
.aud-idle p { margin: 0; color: var(--ink-3); font-size: 14px; }
.aud.switching .cloud, .aud.switching .aud-head { animation: sceneIn .45s cubic-bezier(.2, .8, .2, 1); }
.act-dots { display: inline-flex; gap: 4px; align-items: center; }
.act-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .22); }
.act-dots i.on { width: 16px; border-radius: 999px; background: var(--cyan); }

/* 手機控制台：活動切換 */
.con-act { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--cyan-soft); margin-bottom: 12px; }
.con-act .btn.icon { width: 44px; height: 44px; flex: none; }
.con-act .ca-t { flex: 1; min-width: 0; display: grid; text-align: center; }
.con-act .ca-t small { font-size: 12px; color: var(--cyan); font-weight: 700; }
.con-act .ca-t b { font-family: var(--head); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.con-acts .act-row { padding: 2px; }
.con-acts .act-tools { display: none; }

.gone { display: none !important; }
.sheet textarea.input { resize: none; min-height: 64px; line-height: 1.4; padding-top: 10px; }

/* 建立場次：第一個活動的範本 */
.tpl-pick { border: 0; padding: 0; margin: 0; min-width: 0; }
.tpl-pick legend { padding: 0; margin-bottom: 8px; }
.tpl-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl input { position: absolute; opacity: 0; pointer-events: none; }
.tpl span { display: grid; gap: 2px; justify-items: start; height: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 10, 26, .4); cursor: pointer; transition: border-color .2s, background .2s; }
.tpl span svg.i { color: var(--cyan); margin-bottom: 2px; }
.tpl b { font-family: var(--head); font-size: 15px; }
.tpl small { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.tpl input:checked + span { border-color: var(--cyan); background: var(--cyan-soft); }
.tpl input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.acts-drawer > .set-hint, .acts-drawer > .act-new { padding-left: 22px; padding-right: 22px; }
.acts-drawer > .act-new { padding-bottom: 20px; }
.acts-drawer > .set-hint { margin: 12px 0 4px; }
.topbar .title { flex: 0 0 auto; max-width: 26vw; }
