/* ===== 韋能能源 Vena Energy 品牌識別 ===== */
:root {
  --navy: #1d2d57;       /* 主色：深海軍藍 */
  --navy-2: #263e66;     /* 背景層次 */
  --blue: #00558b;       /* 葉片：深藍 */
  --cyan: #05bcd6;       /* 葉片：青藍 */
  --lime: #b5c82a;       /* 葉片：萊姆綠 */
  --green: #009b48;      /* 葉片：綠 */
  --slate: #5e6a88;      /* 輔助：灰藍 */

  --bg: var(--navy);
  --card: #ffffff;
  --ink: var(--navy);
  --muted: #5e6a88;
  --accent: var(--lime);
  --accent-ink: var(--navy);
  --ok: var(--green);
  --bad: var(--slate);
  --o0: var(--blue);  /* A */
  --o1: var(--cyan);  /* B */
  --o2: var(--lime);  /* C */
  --o3: var(--green); /* D */
  --radius: 14px;
  --tri: linear-gradient(90deg, var(--lime) 0 33.33%, var(--cyan) 33.33% 66.66%, var(--blue) 66.66% 100%);
  font-family: "Avenir Next", "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: #fff;
  background: url(/brand/petals.svg) left bottom / cover no-repeat fixed, var(--navy);
}
/* 首頁、登入、報到區：海上光電空拍照 + 海軍藍遮罩 */
body.hero {
  background:
    url(/brand/petals.svg) left bottom / cover no-repeat fixed,
    linear-gradient(180deg, rgba(29,45,87,.80), rgba(29,45,87,.94)) fixed,
    url(/brand/hero.jpg) center / cover no-repeat fixed,
    var(--navy);
}
a { color: inherit; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, textarea, select { font: inherit; }

.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 18px; text-align: center; }

/* 品牌標頭：白底 Logo 牌 + 產品名稱 */
.brand { display: inline-flex; align-items: center; gap: 16px; }
.brand .plate { background: #fff; border-radius: 12px; padding: 8px 14px; display: flex; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.brand .plate img { height: 48px; display: block; }
.brand .product { font-size: 1.9rem; font-weight: 800; letter-spacing: .5px; }
.brand .product span { color: var(--lime); }
.brand.small .plate { padding: 5px 10px; border-radius: 8px; }
.brand.small .plate img { height: 30px; }
.brand.small .product { font-size: 1.3rem; }
.brand.big .plate img { height: 64px; }
.tri { height: 5px; width: 100%; background: var(--tri); border-radius: 3px; }

.card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.field { width: 100%; padding: 14px 16px; border: 2px solid #d5dae6; border-radius: 10px; font-size: 1.2rem; text-align: center; color: var(--ink); }
.field:focus { outline: none; border-color: var(--cyan); }
.btn { padding: 12px 20px; font-weight: 700; font-size: 1.05rem; background: var(--navy); color: #fff; text-decoration: none; display: inline-block; border-radius: 10px; text-align: center; }
.btn.primary { background: var(--lime); color: var(--navy); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: inherit; border: 2px solid currentColor; }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.danger { background: #b3404a; }
.btn.big { padding: 16px 28px; font-size: 1.3rem; }
.error { color: #c0392b; min-height: 1.2em; font-weight: 600; }
select { color: var(--navy); border-radius: 6px; border: 0; padding: 2px 4px; }

/* 選項顏色：取自 Logo 四片葉子 */
.opt0 { background: var(--o0); } .opt1 { background: var(--o1); }
.opt2 { background: var(--o2); } .opt3 { background: var(--o3); }
.opt1, .opt2 { color: var(--navy) !important; }
.letter { display: inline-grid; place-items: center; width: 1.8em; height: 1.8em; border-radius: 50%; background: rgba(255,255,255,.28); font-weight: 900; flex: none; }
.opt1 .letter, .opt2 .letter { background: rgba(29,45,87,.14); }

/* 主持人大螢幕 */
.topbar { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: rgba(0,0,0,.18); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--tri); }
.pinbox { background: #fff; color: var(--navy); border-radius: 12px; padding: 8px 22px; font-weight: 900; font-size: 2.4rem; letter-spacing: 6px; border-bottom: 6px solid var(--lime); }
.host-main { padding: 24px; max-width: 1200px; margin: 0 auto; }
.qtext { font-size: clamp(1.6rem, 3.5vw, 2.8rem); font-weight: 800; text-align: center; background: #fff; color: var(--navy); border-radius: var(--radius); padding: 22px; border-bottom: 6px solid var(--cyan); }
.qimg { max-height: 32vh; max-width: 100%; border-radius: 12px; display: block; margin: 16px auto; }
.timer { width: 96px; height: 96px; border-radius: 50%; background: var(--lime); color: var(--navy); display: grid; place-items: center; font-size: 2.4rem; font-weight: 900; box-shadow: 0 0 0 6px rgba(181,200,42,.25); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.opt { display: flex; align-items: center; gap: 14px; padding: 22px; border-radius: var(--radius); font-size: clamp(1.1rem, 2.2vw, 1.7rem); font-weight: 700; color: #fff; min-height: 90px; transition: opacity .3s, transform .3s; }
.opt.dim { opacity: .28; }
.opt.right { transform: scale(1.02); box-shadow: 0 0 0 5px #fff; }
.bars { display: flex; gap: 18px; justify-content: center; align-items: flex-end; height: 220px; margin: 20px 0; }
.bar { width: 90px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.bar .fill { width: 100%; border-radius: 10px 10px 0 0; min-height: 6px; transition: height .8s ease; }
.bar b { font-size: 1.5rem; }
.players { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.chip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 1.1rem; }
.chip button { background: none; color: #fff; opacity: .5; margin-left: 6px; padding: 0 4px; }
.chip button:hover { opacity: 1; }
.chip.off { opacity: .45; }
.board { max-width: 720px; margin: 20px auto; display: flex; flex-direction: column; gap: 10px; }
.board .line { display: flex; justify-content: space-between; background: #fff; color: var(--navy); border-radius: 12px; padding: 16px 22px; font-size: 1.4rem; font-weight: 800; border-left: 8px solid var(--cyan); animation: slide .4s ease both; }
.board .line:nth-child(1) { background: var(--lime); border-left-color: var(--green); }
.board .line:nth-child(2) { border-left-color: var(--blue); }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }
.join-hint { display: flex; gap: 24px; align-items: center; justify-content: center; flex-wrap: wrap; }
.qr { background: #fff; padding: 10px; border-radius: 12px; width: 180px; height: 180px; }
.qr img { width: 100%; height: 100%; }

/* 玩家手機畫面 */
.pad { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 640px; flex: 1; max-height: 70vh; }
.pad button { color: #fff; font-size: 1.15rem; font-weight: 700; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius); min-height: 110px; }
.pad button:active { transform: scale(.97); }
.status-icon { font-size: 4rem; }
.big-num { font-size: 2.6rem; font-weight: 900; }
.pbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 12px 18px; background: rgba(0,0,0,.3); font-weight: 700; }
.pbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--tri); }
.ok-bg { background: var(--ok) !important; }
.bad-bg { background: var(--bad) !important; }

/* 題庫列表 / 編輯 */
.wrap { max-width: 960px; margin: 0 auto; padding: 24px; }
.qlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.qitem { border-top: 6px solid var(--cyan); }
.qitem:nth-child(3n+2) { border-top-color: var(--lime); }
.qitem:nth-child(3n) { border-top-color: var(--blue); }
.qitem h3 { margin: 0 0 6px; }
.qitem .btn.ghost { color: var(--navy); }
.edit-q { position: relative; border-left: 6px solid var(--cyan); }
.edit-q .btn.ghost { color: var(--navy); }
.edit-q textarea, .edit-q input[type=text], .edit-q input[type=url] { width: 100%; padding: 10px 12px; border: 2px solid #d5dae6; border-radius: 8px; color: var(--ink); }
.edit-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.edit-opt { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; color: #fff; }
.edit-opt input[type=text] { border: 0; }
.edit-opt label { display: flex; align-items: center; gap: 4px; font-size: .85rem; white-space: nowrap; }
.edit-opt input[type=checkbox] { width: 20px; height: 20px; }

@media (max-width: 640px) {
  .opts, .edit-opts { grid-template-columns: 1fr; }
  .podium .step { width: 30vw; }
  .brand { flex-direction: column; gap: 10px; }
  .brand .plate img { height: 40px; }
}

/* ===== 頒獎台 ===== */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; margin-top: 40px; }
.podium .step { width: 200px; text-align: center; }
.podium .name { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; word-break: break-all; letter-spacing: .5px; }
.podium .score { font-size: .95rem; opacity: .75; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.podium .block {
  position: relative; display: grid; place-items: start center; padding-top: 14px; margin-top: 10px;
  border-radius: 14px 14px 0 0; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.22); border-bottom: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 -8px 30px rgba(0,0,0,.18);
  backdrop-filter: blur(6px);
}
/* 長條頂端的品牌色光條 */
.podium .block::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; }
.podium .step.p1 .block::before { background: var(--lime); }
.podium .step.p2 .block::before { background: var(--cyan); }
.podium .step.p3 .block::before { background: var(--blue); }
.podium .step.p1 .block { background: linear-gradient(180deg, rgba(181,200,42,.38), rgba(181,200,42,.08)); }
.podium .step.p2 .block { background: linear-gradient(180deg, rgba(5,188,214,.32), rgba(5,188,214,.06)); }
.podium .step.p3 .block { background: linear-gradient(180deg, rgba(0,85,139,.45), rgba(0,85,139,.10)); }

/* ===== VENA Logo 獎牌 ===== */
.medal {
  --size: 64px;
  --hi: #fff6d0; --m1: #f1d27a; --m2: #c99a2e; --m3: #8a6416; /* 金 */
  position: relative; display: inline-block; flex: none;
  width: var(--size); height: calc(var(--size) * 1.42);
}
.medal.silver { --hi: #ffffff; --m1: #e3e7ee; --m2: #a9b2c3; --m3: #6b7489; }
.medal.bronze { --hi: #ffe2c8; --m1: #e2a477; --m2: #b06a38; --m3: #6f3d17; }

/* 綬帶：兩條斜帶，品牌三色細條紋＋布料陰影 */
.medal .ribbon { position: absolute; top: 0; left: 50%; width: calc(var(--size) * .56); height: calc(var(--size) * .62); transform: translateX(-50%); }
.medal .ribbon::before, .medal .ribbon::after {
  content: ""; position: absolute; top: 0; width: 50%; height: 100%;
  background:
    linear-gradient(90deg, rgba(0,0,0,.18), transparent 30%, transparent 70%, rgba(0,0,0,.25)),
    linear-gradient(90deg, var(--lime) 0 33.3%, var(--cyan) 33.3% 66.6%, var(--blue) 66.6% 100%);
}
.medal .ribbon::before { left: 0; transform: skewX(20deg); transform-origin: bottom right; }
.medal .ribbon::after { right: 0; transform: skewX(-20deg) scaleX(-1); transform-origin: bottom left; filter: brightness(.88); }

/* 獎牌本體：斜面金屬外圈 */
.medal .disc {
  position: absolute; left: 0; bottom: 0; width: var(--size); aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, var(--hi) 0 8%, transparent 35%),
    conic-gradient(from 200deg, var(--m1), var(--hi), var(--m1), var(--m2), var(--m3), var(--m2), var(--m1));
  box-shadow:
    0 calc(var(--size) * .06) calc(var(--size) * .16) rgba(0,0,0,.38),
    inset 0 1px 1px rgba(255,255,255,.7),
    inset 0 -2px 3px rgba(0,0,0,.25);
}
/* 內圈：細刻線 + 柔和白瓷面 */
.medal .disc::before {
  content: ""; position: absolute; inset: 11%; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #ffffff 0%, #f4f6fa 55%, #e2e7ef 100%);
  box-shadow:
    0 0 0 1.5px var(--m3),
    0 0 0 3px var(--m1),
    inset 0 2px 5px rgba(0,0,0,.18);
}
/* 一道緩慢掠過的光澤 */
.medal .disc::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.55) 48%, transparent 60%);
  background-size: 250% 100%; background-position: 120% 0;
  animation: medal-shine 3.6s ease-in-out 1.2s infinite;
}
@keyframes medal-shine { 0%, 60% { background-position: 120% 0; } 100% { background-position: -60% 0; } }
.medal .disc img { position: absolute; inset: 0; margin: auto; height: 52%; width: auto; z-index: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); }

/* 名次徽章：正圓、海軍藍＋金屬邊 */
.medal .num {
  position: absolute; z-index: 2;
  width: calc(var(--size) * .36); height: calc(var(--size) * .36); aspect-ratio: 1;
  right: calc(var(--size) * -.06); bottom: calc(var(--size) * -.02);
  border-radius: 50%; display: grid; place-items: center;
  font-size: calc(var(--size) * .19); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  color: #fff; background: radial-gradient(circle at 35% 30%, #34467a, var(--navy) 70%);
  border: calc(var(--size) * .035) solid var(--m1);
  box-shadow: 0 2px 6px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.25);
}

.medal.pop { animation: medal-pop .8s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes medal-pop { from { transform: translateY(-12px) scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .medal.pop, .medal .disc::after { animation: none; } }
@media (max-width: 640px) { .podium { gap: 10px; } .podium .step { width: 30vw; } .podium .name { font-size: 1.1rem; } }

/* ===== 圖片選項 ===== */
.edit-opt { flex-direction: column; align-items: stretch; }
.edit-opt .opt-row { display: flex; align-items: center; gap: 8px; }
.edit-opt .img-btn { cursor: pointer; font-size: 1.2rem; padding: 2px 4px; border-radius: 6px; background: rgba(255,255,255,.25); }
.edit-opt .img-btn:hover { background: rgba(255,255,255,.45); }
.edit-opt.drop, .q-image.drop { outline: 3px dashed #fff; outline-offset: 2px; }
.thumb { position: relative; align-self: flex-start; background: #fff; border-radius: 8px; padding: 4px; }
.thumb img { display: block; max-height: 110px; max-width: 220px; border-radius: 6px; }
.thumb button { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .8rem; line-height: 1; }
.thumb.loading { opacity: .5; }
.thumb.loading::after { content: attr(data-loading); position: absolute; inset: 0; display: grid; place-items: center; color: var(--navy); font-weight: 700; }

/* ===== 圖卡選項（有圖片的題目）===== */
.opt0 { --oc: var(--o0); --oc-ink: #fff; }
.opt1 { --oc: var(--o1); --oc-ink: var(--navy); }
.opt2 { --oc: var(--o2); --oc-ink: var(--navy); }
.opt3 { --oc: var(--o3); --oc-ink: #fff; }

.img-grid { gap: 18px; }
.card-opt {
  position: relative; display: flex !important; flex-direction: column; align-items: stretch !important; gap: 0 !important;
  padding: 0 !important; min-height: 0 !important; overflow: hidden; text-align: center;
  background: #fff !important; color: var(--navy) !important;
  border-radius: 18px; border: 0;
  box-shadow: 0 0 0 4px var(--oc), 0 14px 30px rgba(6, 16, 40, .35);
  transition: transform .25s ease, box-shadow .25s ease, opacity .3s, filter .3s;
}
/* 頂端品牌色帶 */
.card-opt::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--oc); z-index: 1; }

/* 圖片區：統一比例，柔和的展示台底色 */
.card-opt .media {
  position: relative; flex: 1 0 auto; height: 19vh; min-height: 110px; display: grid; place-items: center; padding: 18px 18px 12px;
  background:
    radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #f3f6fb 60%, #e7ecf4 100%);
}
.card-opt .opt-img { position: absolute; inset: 18px 18px 12px; width: calc(100% - 36px); height: calc(100% - 30px);
  object-fit: contain; background: none; padding: 0; border-radius: 6px;
  filter: drop-shadow(0 6px 10px rgba(29,45,87,.18)); }
.pad .card-opt .opt-img { inset: 14px 10px 8px; width: calc(100% - 20px); height: calc(100% - 22px); }
#s-reveal .card-opt .opt-img { inset: 12px 12px 8px; width: calc(100% - 24px); height: calc(100% - 20px); }
.card-opt .media-text { font-size: clamp(1.2rem, 2.4vw, 1.9rem); font-weight: 800; color: var(--navy); line-height: 1.3; padding: 0 8px; }

/* 圖說：選項顏色底 */
.card-opt .caption {
  background: var(--oc); color: var(--oc-ink); font-weight: 800; letter-spacing: .5px;
  padding: 10px 14px; font-size: clamp(.95rem, 1.6vw, 1.3rem); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 字母徽章：左上角圓形 */
.card-opt .letter {
  position: absolute; top: 14px; left: 14px; z-index: 2; width: 2.1em; height: 2.1em; font-size: 1rem;
  background: var(--oc) !important; color: var(--oc-ink); box-shadow: 0 3px 8px rgba(0,0,0,.25), 0 0 0 3px #fff;
}

/* 公布答案：正確的卡片發光＋打勾，其他變灰 */
.card-opt.right { transform: translateY(-4px) scale(1.02); box-shadow: 0 0 0 5px var(--lime), 0 0 0 10px rgba(181,200,42,.3), 0 18px 36px rgba(6,16,40,.45); }
.card-opt.dim { opacity: .4; filter: grayscale(.85); transform: scale(.97); }
.card-opt .tick {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 2.2em; height: 2.2em; border-radius: 50%;
  display: grid; place-items: center; font-weight: 900; color: var(--navy);
  background: var(--lime); box-shadow: 0 3px 8px rgba(0,0,0,.25), 0 0 0 3px #fff;
  animation: medal-pop .6s cubic-bezier(.2,1.6,.4,1) both;
}

/* 玩家手機：圖卡 */
.pad.img-grid { gap: 12px; align-content: center; }
.pad .card-opt { border-radius: 16px; box-shadow: 0 0 0 3px var(--oc), 0 8px 18px rgba(6,16,40,.35); }
.pad .card-opt .media { height: auto; aspect-ratio: 1; min-height: 0; padding: 14px 10px 8px; }
.pad .card-opt .letter { top: 10px; left: 10px; font-size: .85rem; }
.pad .card-opt .caption { font-size: 1rem; padding: 8px 10px; }
.pad .card-opt:active { transform: scale(.96); }
.pad.has-pick .card-opt:not(.picked) { opacity: .35; filter: grayscale(.8); }
.pad .card-opt.picked { box-shadow: 0 0 0 4px var(--lime), 0 0 0 9px rgba(181,200,42,.35); opacity: 1 !important; }

/* 主持人大螢幕：卡片懸停微浮 */
#q-opts .card-opt { animation: card-in .45s ease both; }
#q-opts .card-opt:nth-child(2) { animation-delay: .06s; }
#q-opts .card-opt:nth-child(3) { animation-delay: .12s; }
#q-opts .card-opt:nth-child(4) { animation-delay: .18s; }
@keyframes card-in { from { transform: translateY(14px); opacity: 0; } }

/* 公布答案畫面：長條圖＋圖卡要放得進一個畫面 */
#s-reveal .bars { height: min(220px, 24vh); }
#s-reveal .card-opt .media { height: 11vh; min-height: 70px; padding: 12px 12px 8px; }
#s-reveal .card-opt .caption { padding: 6px 10px; }
@media (prefers-reduced-motion: reduce) { #q-opts .card-opt, .card-opt .tick { animation: none; } }

/* ===== 玩家圓形小圖示 ===== */
.avatar {
  display: inline-grid; place-items: center; flex: none; vertical-align: middle;
  width: 1.9em; height: 1.9em; border-radius: 50%; font-size: 1em; line-height: 1; margin-right: .45em;
  background: radial-gradient(circle at 35% 30%, #ffffff, #e9eef6 75%);
  box-shadow: 0 0 0 2px var(--cyan), 0 2px 6px rgba(0,0,0,.25);
}
.avatar.big { font-size: 2.4rem; margin: 0 auto 6px; display: grid; }
.chip { display: inline-flex; align-items: center; animation: chip-in .35s ease both; }
@keyframes chip-in { from { transform: scale(.6); opacity: 0; } }
.board .line > span:first-child { display: inline-flex; align-items: center; }
.podium .name { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.podium .name .avatar { margin: 0; font-size: 1.3rem; }
.theme-only { display: none; }

/* ===== 活動風格：辦桌 ===== */
body[data-theme="banquet"] {
  --navy: #5c1014;      /* 深酒紅：主要文字與深色底 */
  --navy-2: #7a1a1f;
  --red: #d7262f;       /* 大紅 */
  --gold: #f2b233;      /* 金 */
  --gold-2: #f8d77c;
  --lime: var(--gold);
  --cyan: var(--gold-2);
  --blue: #1f5fa8;      /* 帆布藍 */
  --green: #23935a;
  --slate: #8a5a4a;

  --bg: var(--navy); --ink: var(--navy); --muted: #8a5a4a;
  --accent: var(--gold); --accent-ink: var(--navy);
  --ok: var(--green); --bad: var(--slate);
  --o0: var(--red); --o1: var(--gold); --o2: var(--green); --o3: var(--blue);
  /* 辦桌棚：紅白藍帆布條紋 */
  --tri: repeating-linear-gradient(90deg, #d7262f 0 26px, #ffffff 26px 52px, #1f5fa8 52px 78px, #ffffff 78px 104px);
  background: url(/brand/banquet.svg) center / cover fixed,
    radial-gradient(120% 90% at 50% 0%, #b3242b 0%, #86161c 45%, #5c1014 100%) fixed;
  padding-top: 22px;
}
body[data-theme="banquet"].hero { background: url(/brand/banquet.svg) center / cover fixed,
    radial-gradient(120% 90% at 50% 0%, #b3242b 0%, #86161c 45%, #5c1014 100%) fixed; }
/* 頂端帆布棚，下緣做成波浪 */
body[data-theme="banquet"]::before {
  content: ""; position: fixed; left: 0; right: 0; top: 0; height: 30px; z-index: 50; pointer-events: none;
  background: var(--tri);
  -webkit-mask: radial-gradient(14px 10px at 14px 100%, transparent 98%, #000) 0 0 / 28px 100% repeat-x;
          mask: radial-gradient(14px 10px at 14px 100%, transparent 98%, #000) 0 0 / 28px 100% repeat-x;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.3));
}
body[data-theme="banquet"] .opt0 { --oc-ink: #fff; }
body[data-theme="banquet"] .opt1 { --oc-ink: var(--navy); }
body[data-theme="banquet"] .opt2, body[data-theme="banquet"] .opt3 { --oc-ink: #fff; }
body[data-theme="banquet"] .opt2:not(.card-opt) { color: #fff !important; }
body[data-theme="banquet"] .opt2 .letter { background: rgba(255,255,255,.28); }
body[data-theme="banquet"] .avatar { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0,0,0,.3); background: radial-gradient(circle at 35% 30%, #fffaf0, #f6e7c6 75%); }
body[data-theme="banquet"] .pinbox { border-bottom-color: var(--red); }
body[data-theme="banquet"] .timer { background: var(--gold); box-shadow: 0 0 0 6px rgba(242,178,51,.3); }
body[data-theme="banquet"] .board .line:nth-child(1) { background: linear-gradient(90deg, #f8d77c, #f2b233); border-left-color: var(--red); }
body[data-theme="banquet"] .board .line { border-left-color: var(--red); }
body[data-theme="banquet"] .qtext { border-bottom-color: var(--red); }
body[data-theme="banquet"] .chip { background: rgba(255,240,210,.12); border-color: rgba(248,215,124,.35); }
body[data-theme="banquet"] .theme-only.banquet { display: block; }
.theme-banner { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 900; letter-spacing: 3px; color: var(--gold-2);
  text-shadow: 0 2px 0 rgba(0,0,0,.25); margin-bottom: 6px; }
.theme-banner small { display: block; font-size: .45em; letter-spacing: 1px; font-weight: 600; color: #fff; opacity: .8; margin-top: 4px; }
body[data-theme="banquet"] .podium .step.p1 .block { background: linear-gradient(180deg, rgba(242,178,51,.45), rgba(242,178,51,.10)); }
body[data-theme="banquet"] .podium .step.p2 .block { background: linear-gradient(180deg, rgba(255,240,210,.30), rgba(255,240,210,.06)); }
body[data-theme="banquet"] .podium .step.p3 .block { background: linear-gradient(180deg, rgba(215,38,47,.45), rgba(215,38,47,.10)); }
body[data-theme="banquet"] .podium .step.p3 .block::before { background: var(--red); }

/* ===== 排行榜：可愛精緻版 ===== */
#s-board { text-align: center; }
.board-title {
  display: inline-flex; align-items: center; gap: 14px; margin: 6px auto 2px;
  padding: 10px 30px; border-radius: 999px; font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 900; letter-spacing: 6px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 24px rgba(0,0,0,.18);
}
.board-title .spark { color: var(--lime); font-size: .7em; letter-spacing: 0; animation: twinkle 1.8s ease-in-out infinite; }
.board-title .spark:last-child { animation-delay: .9s; }
@keyframes twinkle { 50% { transform: scale(.6) rotate(45deg); opacity: .5; } }
.board-sub { font-size: .95rem; opacity: .7; margin-bottom: 4px; letter-spacing: 1px; }

#b-list { max-width: 820px; gap: 12px; margin: 14px auto 16px; }
#b-list .line {
  display: grid; grid-template-columns: 50px 54px 1fr auto auto; align-items: center; gap: 14px;
  padding: 10px 22px 10px 12px; border: 0; border-radius: 999px;
  background: #fff; color: var(--navy); font-size: 1.25rem; font-weight: 800; text-align: left;
  box-shadow: 0 5px 0 rgba(17, 28, 60, .14), 0 14px 28px rgba(0, 0, 0, .18);
  animation: row-pop .6s cubic-bezier(.2, 1.5, .4, 1) both;
}
@keyframes row-pop { from { transform: translateY(18px) scale(.92); opacity: 0; } }

/* 名次章 */
#b-list .rank {
  position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 1.15rem; color: var(--navy); background: #eef1f7;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.08);
}
#b-list .r1 .rank { background: linear-gradient(145deg, #fff3c4, #f1c94a 55%, #c99a2e); color: #5b3d00; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15), 0 0 0 3px #fff, 0 0 0 5px #f1c94a; }
#b-list .r2 .rank { background: linear-gradient(145deg, #ffffff, #d5dbe6 55%, #9aa4b8); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12), 0 0 0 3px #fff, 0 0 0 5px #c4cbd8; }
#b-list .r3 .rank { background: linear-gradient(145deg, #ffe4cc, #e0a477 55%, #a9653a); color: #4a230b; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12), 0 0 0 3px #fff, 0 0 0 5px #e0a477; }
#b-list .crown { position: absolute; top: -26px; left: 50%; z-index: 2; transform: translateX(-50%) rotate(-12deg); font-style: normal; font-size: 1.8rem; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-3px) rotate(8deg); } }

/* 頭像 */
#b-list .avatar.lg { width: 50px; height: 50px; margin: 0; font-size: 1.6rem; }

/* 名字＋分數條 */
#b-list .who { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
#b-list .nm { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#b-list .streak { font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #fff1e6; color: #d9480f; letter-spacing: .5px; }
#b-list .meter { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
#b-list .meter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--cyan), var(--blue)); animation: grow 1s .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes grow { from { width: 0; } }

/* 本題得分、總分 */
#b-list .gain { font-size: .85rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #e7f7ee; color: #0d8a4a; font-variant-numeric: tabular-nums; }
#b-list .gain.zero { background: #f1f3f7; color: #9aa3b5; }
#b-list .pts { min-width: 3.6em; text-align: right; font-size: 1.45rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .5px; }

/* 第一名：放大、微光 */
#b-list .r1 { transform-origin: center; padding-top: 14px; padding-bottom: 14px;
  background: linear-gradient(90deg, #fbfde8 0%, #ffffff 60%);
  box-shadow: 0 0 0 3px var(--lime), 0 5px 0 rgba(17, 28, 60, .14), 0 18px 36px rgba(0, 0, 0, .25); }
#b-list .r1 .pts { font-size: 1.7rem; }
#b-list .r1 .meter i { background: linear-gradient(90deg, var(--lime), var(--green)); }

/* 辦桌風格 */
body[data-theme="banquet"] #b-list .r1 { background: linear-gradient(90deg, #fff6df 0%, #ffffff 60%); box-shadow: 0 0 0 3px var(--gold), 0 5px 0 rgba(60, 10, 10, .2), 0 18px 36px rgba(0, 0, 0, .3); }
body[data-theme="banquet"] #b-list .meter i { background: linear-gradient(90deg, #f8d77c, #d7262f); }
body[data-theme="banquet"] #b-list .r1 .meter i { background: linear-gradient(90deg, #f2b233, #d7262f); }
body[data-theme="banquet"] .board-title { background: rgba(255, 230, 180, .12); border-color: rgba(248, 215, 124, .4); }
body[data-theme="banquet"] .board-title .spark { color: var(--gold-2); }

@media (max-width: 640px) {
  #b-list .line { grid-template-columns: 38px 40px 1fr auto; gap: 8px; font-size: 1rem; }
  #b-list .gain { display: none; }
  #b-list .rank { width: 34px; height: 34px; font-size: .95rem; }
  #b-list .avatar.lg { width: 38px; height: 38px; font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) { #b-list .line, #b-list .meter i, #b-list .crown, .board-title .spark { animation: none; } }

/* ===== 頒獎台：可愛精緻版 ===== */
#s-end { position: relative; }
#podium { display: flex; justify-content: center; align-items: flex-end; gap: 22px; margin: 18px auto 0; }
#podium .step { position: relative; width: 210px; display: flex; flex-direction: column; align-items: center; }

/* 得獎者頭像：彈跳登場 */
#podium .winner { position: relative; display: grid; place-items: center; width: 96px; height: 96px; margin-bottom: 8px;
  animation: winner-pop .7s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: calc(var(--d) + .35s); }
#podium .p1 .winner { width: 118px; height: 118px; }
#podium .avatar.xl { width: 100%; height: 100%; margin: 0; font-size: 3rem; position: relative; z-index: 1;
  box-shadow: 0 0 0 5px #fff, 0 0 0 9px var(--ring, #c4cbd8), 0 12px 24px rgba(0,0,0,.3); }
#podium .p1 .avatar.xl { font-size: 3.7rem; --ring: #f1c94a; }
#podium .p2 .avatar.xl { --ring: #c4cbd8; }
#podium .p3 .avatar.xl { --ring: #e0a477; }
@keyframes winner-pop { from { transform: translateY(30px) scale(.3); opacity: 0; } }

/* 第一名：皇冠＋旋轉光芒 */
#podium .crown { position: absolute; top: -40px; left: 50%; z-index: 2; font-style: normal; font-size: 2.6rem; line-height: 1;
  transform: translateX(-50%) rotate(-10deg); filter: drop-shadow(0 3px 3px rgba(0,0,0,.3));
  animation: crown-bob 2.2s ease-in-out infinite; animation-delay: calc(var(--d) + 1s); }
@keyframes crown-bob { 50% { transform: translateX(-50%) translateY(-5px) rotate(8deg); } }
#podium .halo { position: absolute; inset: -46px; border-radius: 50%; z-index: 0; opacity: .85;
  background: repeating-conic-gradient(from 0deg, rgba(255, 236, 160, .55) 0 10deg, transparent 10deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%);
  animation: spin 14s linear infinite, fade-in .8s both; animation-delay: 0s, calc(var(--d) + .5s); }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes fade-in { from { opacity: 0; } }

/* 名牌 */
#podium .tag { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 10px;
  padding: 6px 18px; border-radius: 999px; background: #fff; color: var(--navy);
  box-shadow: 0 4px 0 rgba(17, 28, 60, .14), 0 10px 20px rgba(0,0,0,.2);
  animation: winner-pop .6s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--d) + .5s); max-width: 100%; }
#podium .tag b { font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
#podium .tag span { font-size: .85rem; font-weight: 700; opacity: .65; font-variant-numeric: tabular-nums; }
#podium .p1 .tag b { font-size: 1.4rem; }

/* 台座：圓角蛋糕感，頂端一圈亮邊，由下往上長出 */
#podium .block { position: relative; width: 100%; margin: 0; padding-top: 16px; display: grid; place-items: start center;
  border: 0; border-radius: 22px 22px 6px 6px; overflow: visible; backdrop-filter: none;
  background: linear-gradient(180deg, var(--top) 0%, var(--bot) 100%);
  box-shadow: inset 0 6px 0 rgba(255,255,255,.55), inset 0 -10px 18px rgba(0,0,0,.12), 0 14px 30px rgba(0,0,0,.28);
  transform-origin: bottom; animation: rise .7s cubic-bezier(.2, 1.2, .3, 1) both; animation-delay: var(--d); }
#podium .block::before { display: none; }
/* 台座上的點點裝飾 */
#podium .block::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(rgba(255,255,255,.22) 2px, transparent 2.5px) 0 0 / 18px 18px; opacity: .6;
  -webkit-mask: linear-gradient(180deg, transparent 45%, #000); mask: linear-gradient(180deg, transparent 45%, #000); }
@keyframes rise { from { transform: scaleY(0); } }
#podium .p1 .block { --top: #fff3c4; --bot: #f1c94a; }
#podium .p2 .block { --top: #ffffff; --bot: #c9d1de; }
#podium .p3 .block { --top: #ffe4cc; --bot: #e0a477; }

/* 第 4 名之後 */
.runners { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 900px; margin: 22px auto 0; }
.runner { display: inline-flex; align-items: center; gap: 4px; padding: 5px 14px 5px 6px; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); font-weight: 700; font-size: .95rem;
  animation: row-pop .5s cubic-bezier(.2, 1.5, .4, 1) both; }
.runner b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.9); color: var(--navy); font-size: .8rem; margin-right: 4px; }
.runner .avatar { width: 1.7em; height: 1.7em; margin-right: 4px; }
.runner em { font-style: normal; opacity: .7; margin-left: 8px; font-variant-numeric: tabular-nums; }
.end-actions { margin-top: 26px; animation: fade-in .6s 2.4s both; }

/* 彩帶 */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.confetti i { position: absolute; top: -20px; border-radius: 2px; opacity: 0;
  animation-name: confetti-fall; animation-timing-function: cubic-bezier(.3, .1, .6, 1); animation-iteration-count: 2; animation-fill-mode: both; }
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--drift), 105vh) rotate(var(--rot)); opacity: .9; }
}

/* 辦桌風格 */
body[data-theme="banquet"] #podium .p1 .block { --top: #ffe7a6; --bot: #f2b233; }
body[data-theme="banquet"] #podium .p2 .block { --top: #fffaf0; --bot: #f1dfc0; }
body[data-theme="banquet"] #podium .p3 .block { --top: #ff8a8f; --bot: #d7262f; }
body[data-theme="banquet"] #podium .halo { background: repeating-conic-gradient(from 0deg, rgba(255, 215, 130, .6) 0 10deg, transparent 10deg 24deg); }
body[data-theme="banquet"] .runner { background: rgba(255, 235, 200, .12); border-color: rgba(248, 215, 124, .35); }

@media (max-width: 640px) {
  #podium { gap: 8px; }
  #podium .step { width: 31vw; }
  #podium .winner { width: 64px; height: 64px; }
  #podium .p1 .winner { width: 78px; height: 78px; }
  #podium .avatar.xl { font-size: 2rem; }
  #podium .p1 .avatar.xl { font-size: 2.4rem; }
  #podium .tag { padding: 4px 10px; }
  #podium .tag b { font-size: .95rem; max-width: 26vw; }
}
@media (prefers-reduced-motion: reduce) {
  #podium .winner, #podium .tag, #podium .block, #podium .crown, #podium .halo, .runner, .end-actions { animation: none; }
  .confetti { display: none; }
}
/* 頒獎台：壓縮高度，1280×720 投影也能放下全部 */
#s-end .board-title { margin-top: 0; padding: 6px 26px; }
#s-end .board-sub { margin-bottom: 0; }
#podium { margin-top: 52px; }
#podium .winner { width: 84px; height: 84px; margin-bottom: 6px; }
#podium .p1 .winner { width: 100px; height: 100px; }
#podium .avatar.xl { font-size: 2.6rem; }
#podium .p1 .avatar.xl { font-size: 3.1rem; }
#podium .crown { top: -36px; font-size: 2.3rem; }
#podium .halo { inset: -36px; }
#podium .tag { padding: 4px 16px; margin-bottom: 8px; }
.runners { margin-top: 16px; gap: 8px; }
.end-actions { margin-top: 16px; }
body[data-theme="banquet"] #podium { margin-top: 44px; }
body[data-theme="banquet"] #s-end .board-title { padding: 4px 24px; }

/* 玩家手機：內容超過一個畫面時從上方開始排，避免題目被擠出畫面上緣 */
#app { justify-content: flex-start; padding-bottom: 72px; }
#app > section:not(.hidden) { margin-block: auto; }
#v-question { gap: 10px; }
/* 圖卡選項：高度依螢幕限制，手機與電腦都能一次看到題目和四個選項 */
.pad.img-grid { flex: none; max-height: none; width: 100%; max-width: min(640px, 80vh); }
.pad .card-opt .media { aspect-ratio: auto; height: min(24vh, 38vw); }

/* ===== 中／EN 語言切換 ===== */
.lang-toggle { position: fixed; top: 10px; right: 12px; z-index: 70; display: flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: rgba(10, 20, 45, .55); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.lang-toggle button { min-width: 40px; padding: 5px 10px; border-radius: 999px; background: transparent; color: #fff;
  font-size: .85rem; font-weight: 800; letter-spacing: .5px; opacity: .75; transition: background .2s, color .2s, opacity .2s; }
.lang-toggle button:hover { opacity: 1; }
.lang-toggle button.on { background: var(--lime); color: var(--navy); opacity: 1; }
body[data-theme="banquet"] .lang-toggle { top: 34px; background: rgba(60, 10, 14, .6); }
/* 讓出右上角給切換鈕 */
.topbar, #v-list > .row:first-child, .wrap > .row:first-child { padding-right: 112px; }
@media (max-width: 640px) { .lang-toggle button { min-width: 34px; padding: 4px 8px; } }

/* 英文題目與英文選項欄 */
.edit-q textarea.text-en { width: 100%; padding: 8px 12px; border: 2px dashed #d5dae6; border-radius: 8px; color: var(--ink); font-size: .95rem; }
.edit-opt .opt-en { width: 100%; padding: 5px 10px; border: 0; border-radius: 6px; font-size: .85rem; color: var(--ink); background: rgba(255,255,255,.85); }
.edit-opt .opt-en::placeholder { color: #8b93a7; }

/* ===== 報到區：會抖動、擠來擠去的名牌 ===== */
.checkin-title { margin-top: 14px; font-size: .95rem; font-weight: 800; letter-spacing: 3px; opacity: .75; }
#players { gap: 8px 6px; max-width: 1100px; margin: 8px auto 0; padding: 6px; }
#players .chip {
  /* 用獨立的 translate / rotate / scale 屬性，抖動和彈跳可以同時進行 */
  animation:
    chip-jiggle var(--dur, 2s) ease-in-out var(--d, 0s) infinite;
  will-change: translate, rotate, scale;
  transform-origin: 50% 80%;
}
#players .chip.new-in {
  animation:
    chip-pop .55s cubic-bezier(.2, 1.6, .4, 1) both,
    chip-jiggle var(--dur, 2s) ease-in-out var(--d, 0s) infinite;
}
#players .chip.bump {
  animation:
    chip-bump .5s ease-out var(--bd, 0s) both,
    chip-jiggle var(--dur, 2s) ease-in-out var(--d, 0s) infinite;
}
#players .chip.leaving { animation: chip-out .35s ease-in both; pointer-events: none; }
#players .chip:hover { animation-play-state: paused; scale: 1.06; }

/* 原地輕輕晃：左右擠一下、歪一下頭 */
@keyframes chip-jiggle {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  20% { translate: var(--tx, 1.5px) -1px; rotate: var(--r, 2deg); }
  45% { translate: calc(var(--tx, 1.5px) * -1) 1px; rotate: calc(var(--r, 2deg) * -0.6); }
  70% { translate: calc(var(--tx, 1.5px) * .6) .5px; rotate: calc(var(--r, 2deg) * -1); }
  85% { translate: -.5px -.5px; rotate: calc(var(--r, 2deg) * .4); }
}
/* 新人報到：從小彈出來 */
@keyframes chip-pop {
  0% { scale: 0; opacity: 0; }
  60% { scale: 1.18; opacity: 1; }
  80% { scale: .94; }
  100% { scale: 1; }
}
/* 被擠到：先被壓扁再彈回 */
@keyframes chip-bump {
  0% { scale: 1; }
  30% { scale: .88 1.08; }
  60% { scale: 1.06 .96; }
  100% { scale: 1; }
}
/* 離開：縮小淡出 */
@keyframes chip-out { to { scale: 0; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  #players .chip, #players .chip.new-in, #players .chip.bump { animation: none; }
}

/* ===== 音效開關 ===== */
.sound-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 1.1rem; display: grid; place-items: center; padding: 0; transition: background .2s, opacity .2s; }
.sound-btn:hover { background: rgba(255,255,255,.26); }
.sound-btn.off { opacity: .45; text-decoration: line-through; }
.timer.hurry { animation: hurry .5s ease-in-out infinite alternate; background: #ffcf4a; }
@keyframes hurry { to { scale: 1.08; box-shadow: 0 0 0 10px rgba(255,207,74,.3); } }
@media (prefers-reduced-motion: reduce) { .timer.hurry { animation: none; } }

/* ===== 英文題庫名稱 ===== */
.field.title-en { font-size: 1rem; padding: 10px 16px; border-style: dashed; }

/* ===== 分桌對抗 ===== */
.table-hint { font-size: .95rem; font-weight: 700; color: #ffe08a; margin-top: 6px; }
.chip .tbl { font-style: normal; font-size: .72rem; font-weight: 800; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.9); color: var(--navy); }
body[data-theme="banquet"] .chip .tbl { background: var(--gold); color: #5b1010; }

/* 排行榜下方：各桌排名 */
.teams { max-width: 820px; margin: 4px auto 18px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.teams-title { width: 100%; text-align: center; font-weight: 800; font-size: 1rem; opacity: .85; letter-spacing: .5px; }
.team { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: rgba(255,255,255,.95); color: var(--navy); font-weight: 800;
  box-shadow: 0 4px 0 rgba(0,0,0,.12), 0 10px 20px rgba(0,0,0,.18); animation: slide .4s ease both; }
.team .tr { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e9edf4; font-size: .9rem; }
.team.r1 .tr { background: linear-gradient(145deg, #fff3c4, #f1c94a 55%, #c99a2e); color: #5b3d00; }
.team.r2 .tr { background: linear-gradient(145deg, #ffffff, #d5dbe6 55%, #9aa4b8); }
.team.r3 .tr { background: linear-gradient(145deg, #ffe4cc, #e0a477 55%, #a9653a); color: #4a230b; }
.team.r1 { box-shadow: 0 0 0 3px #f1c94a, 0 4px 0 rgba(0,0,0,.12), 0 10px 20px rgba(0,0,0,.18); }
.team .tn { font-size: 1.05rem; }
.team .tv { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.team .tv small { font-size: .7rem; font-weight: 700; opacity: .55; margin-left: 5px; }

/* 頒獎台下方：冠軍桌 */
.team-win { max-width: 560px; margin: 22px auto 0; padding: 16px 22px 14px; border-radius: 18px; background: linear-gradient(180deg, #ffffff, #f3f6fb); color: var(--navy);
  box-shadow: 0 0 0 4px #f1c94a, 0 6px 0 rgba(0,0,0,.15), 0 20px 40px rgba(0,0,0,.3); animation: chip-in .6s 2.6s cubic-bezier(.2,1.5,.4,1) both; }
body[data-theme="banquet"] .team-win { background: linear-gradient(180deg, #fffaf0, #fff0d0); box-shadow: 0 0 0 4px var(--gold), 0 6px 0 rgba(60,10,10,.2), 0 20px 40px rgba(0,0,0,.3); }
.team-win .tw-head { font-weight: 800; font-size: 1rem; opacity: .75; }
.team-win .tw-name { font-size: 2.2rem; font-weight: 900; line-height: 1.2; }
.team-win .tw-sub { font-weight: 700; opacity: .7; font-variant-numeric: tabular-nums; }
.team-win .tw-rest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.team-win .tw-rest span { font-size: .85rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #e9edf4; font-variant-numeric: tabular-nums; }
.team-win .tw-rest b { margin-right: 6px; }

/* 玩家：選桌號 */
.table-pick { width: min(420px, 92vw); margin-top: 8px; padding: 16px; border-radius: 18px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); }
.table-pick.need { border-color: #ffe08a; box-shadow: 0 0 0 3px rgba(255,224,138,.3); animation: need 1.4s ease-in-out infinite; }
@keyframes need { 50% { box-shadow: 0 0 0 7px rgba(255,224,138,.12); } }
.table-pick b { display: block; margin-bottom: 12px; font-size: 1.05rem; }
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; max-height: 42vh; overflow: auto; padding: 2px; }
.tp-grid button { height: 48px; border-radius: 12px; background: #fff; color: var(--navy); font-weight: 900; font-size: 1.15rem; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.tp-grid button:active { translate: 0 2px; box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.tp-grid button.on { background: var(--lime); box-shadow: 0 0 0 3px #fff, 0 3px 0 rgba(0,0,0,.18); }
body[data-theme="banquet"] .tp-grid button.on { background: var(--gold); color: #5b1010; }
.table-rank { margin-top: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.14); font-weight: 700; }
.pb-table { margin-left: 8px; font-size: .78rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.9); color: var(--navy); }

/* 分桌時還沒選桌：名牌變灰、徽章顯示「未入座」 */
.chip.unseated { background: rgba(255,255,255,.05); border-style: dashed; border-color: rgba(255,255,255,.35); }
.chip.unseated > .avatar { filter: grayscale(1); opacity: .6; }
.chip .tbl.none, body[data-theme="banquet"] .chip .tbl.none { background: rgba(255,255,255,.18); color: rgba(255,255,255,.8); border: 1px dashed rgba(255,255,255,.5); }

/* 選好桌號後收合：一行「已入座：第 3 桌｜換桌」 */
.table-pick.done { width: auto; padding: 8px 8px 8px 18px; border-radius: 999px; }
.tp-done { display: flex; align-items: center; gap: 14px; }
.tp-seat { font-weight: 800; font-size: 1.05rem; }
.tp-change { padding: 6px 16px; border-radius: 999px; background: rgba(255,255,255,.9); color: var(--navy); font-weight: 800; font-size: .9rem; }
body[data-theme="banquet"] .tp-change { background: var(--gold); color: #5b1010; }

/* ===== 報到區人多時：名牌擠成一團、互相重疊 ===== */
#players.crowd { gap: 0; padding: 16px 28px 24px; }
#players.crowd .chip { position: relative; z-index: var(--z, 1); margin: -2px -6px; padding: 6px 20px 6px 7px; font-size: 1rem;
  background: #30487a; border: 2px solid rgba(255,255,255,.35); box-shadow: 0 4px 10px rgba(0,0,0,.3); }
#players.crowd-2 .chip { margin: -3px -9px; padding-right: 24px; font-size: .92rem; }
#players.crowd-3 .chip { margin: -4px -11px; font-size: .85rem; padding: 5px 26px 5px 6px; }
#players.crowd .chip .avatar { width: 30px; height: 30px; font-size: 1rem; margin-right: 6px; }
#players.crowd .chip.unseated { background: #3b4560; }
body[data-theme="banquet"] #players.crowd .chip { background: #b3262e; border-color: rgba(248,215,124,.6); }
body[data-theme="banquet"] #players.crowd .chip.unseated { background: #7d2a2f; }
/* 擠的時候 ✕ 平常藏起來，滑過去才出現；滑過的名牌浮到最上層 */
#players.crowd .chip button { display: none; }
#players.crowd .chip:hover { z-index: 9999; }
#players.crowd .chip:hover button { display: inline; }
#players .chip.awaiting { opacity: 0; animation: none; }

/* ===== 新人報到特寫：中央大大跳出，再飛進人群 ===== */
.spot { position: fixed; left: 50%; top: 42%; z-index: 60; pointer-events: none; translate: -50% -50%;
  display: inline-flex; align-items: center; gap: 16px; padding: 14px 34px 14px 14px; border-radius: 999px;
  background: #fff; color: var(--navy); box-shadow: 0 0 0 6px var(--lime), 0 0 0 14px rgba(181,200,42,.3), 0 30px 60px rgba(0,0,0,.45);
  animation: spot-in 1.15s cubic-bezier(.3, .9, .3, 1) both; }
body[data-theme="banquet"] .spot { background: linear-gradient(180deg, #fffaf0, #ffeccc); color: #7a1418; box-shadow: 0 0 0 6px var(--gold), 0 0 0 14px rgba(242,178,51,.3), 0 30px 60px rgba(0,0,0,.45); }
.spot .avatar { width: 84px; height: 84px; font-size: 2.9rem; margin: 0; }
.spot .who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.spot b { font-size: 2.6rem; font-weight: 900; white-space: nowrap; }
.spot small { font-size: 1.1rem; font-weight: 800; opacity: .6; letter-spacing: 2px; margin-top: 4px; }
/* 背後的放射光芒 */
.spot .rays { position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; margin: -260px 0 0 -260px; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.28) 0 8deg, transparent 8deg 22deg);
  mask: radial-gradient(circle, #000 18%, transparent 68%); -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%);
  animation: spot-rays 1.15s linear both; }
body[data-theme="banquet"] .spot .rays { background: repeating-conic-gradient(from 0deg, rgba(255,215,130,.45) 0 8deg, transparent 8deg 22deg); }
@keyframes spot-in {
  0%   { scale: .2; opacity: 0; rotate: -10deg; }
  16%  { scale: 1.12; opacity: 1; rotate: 4deg; }
  26%  { scale: .97; rotate: -2deg; }
  34%  { scale: 1; rotate: 0deg; }
  58%  { scale: 1; translate: -50% -50%; opacity: 1; }
  100% { scale: .3; translate: var(--fx) var(--fy); opacity: .2; }
}
@keyframes spot-rays { 0% { rotate: 0deg; opacity: 0; } 15% { opacity: 1; } 60% { opacity: 1; } 100% { rotate: 120deg; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .spot, .spot .rays { animation-duration: .01s; } }

/* ===== 人潮模式：計數泡泡＋新名牌閃光 ===== */
.rush { display: inline-block; padding: 6px 14px; border-radius: 999px; background: #fff; color: var(--navy); font-weight: 900; font-size: 1.05rem;
  box-shadow: 0 0 0 3px var(--lime), 0 6px 16px rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
body[data-theme="banquet"] .rush { color: #7a1418; box-shadow: 0 0 0 3px var(--gold), 0 6px 16px rgba(0,0,0,.25); }
.rush { transform-origin: left center; white-space: nowrap; }
.rush.tick { animation: rush-tick .3s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes rush-tick { from { scale: 1.1; } }
#players .chip.fresh { box-shadow: 0 0 0 3px #fff, 0 0 18px 6px rgba(255,255,255,.55); z-index: 9000; }
body[data-theme="banquet"] #players .chip.fresh { box-shadow: 0 0 0 3px var(--gold), 0 0 18px 6px rgba(255,215,130,.7); }

/* ===== 設計者署名 ===== */
.credit { position: fixed; right: 14px; bottom: 10px; z-index: 5; margin: 0; font-size: .78rem; letter-spacing: .8px; opacity: .45; font-weight: 600; pointer-events: none; }
