/* wk-buzz 遊戲畫面
   Design read：100 人實體課的現場答題遊戲，台灣成人學員用手機（多半在 LINE 裡）＋投影大螢幕，
   遊戲節目感、貼紙風（粗黑邊＋實心位移陰影），WeKen 黃 #F5C518 當主角色，粉圓體 Huninn 撐起趣味感。
   Dials：VARIANCE 5／MOTION 7／DENSITY 3（大字、一個畫面一件事，動態都是回饋：倒數、答對、名次上升）
   放掉 taste：6.C／8 深色模式（他規定一律淺色）、3.A React／Tailwind／Motion（不用建置工具）、
   3.C 圖示套件（他的規則是 inline SVG、lucide 風格）、3.D emoji 也不用（全部 SVG）
   四個選項的顏色是功能不是裝飾（大螢幕跟手機靠顏色＋字母對應），所以不受「只有一個強調色」限制 */
:root {
  --y: #F5C518; --y-soft: #FFF4C2;
  --ink: #4A3326; --ink-2: #6B5244; --ink-3: #85695A;
  --bg: #FFFBF0; --paper: #FFFFFF; --line: #4A3326;
  --a: #FFA8BA; --b: #9FD6FF; --c: #FFD966; --d: #A6E8C9;
  --ok: #17915F; --ok-soft: #DDF7EA; --no: #C2412D; --no-soft: #FFE3DD;
  --r: 24px; --r-sm: 14px; --pill: 999px;
  --bw: 3px; --sh: 4px 4px 0 var(--ink); --sh-lg: 6px 6px 0 var(--ink);
  --font: "Huninn", "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  color-scheme: light;
}
html { color-scheme: light; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.6;
  line-break: strict; text-wrap: pretty; overflow-x: clip; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
/* 背景：飄著的小星星小愛心（很慢地斜飄，減少動態效果時不動） */
body::before { content: ""; position: fixed; inset: -170px; z-index: -1; pointer-events: none; opacity: .3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M22 14l2.4 5 5.4.8-3.9 3.8.9 5.4-4.8-2.6-4.8 2.6.9-5.4-3.9-3.8 5.4-.8z' fill='%23FFD966'/%3E%3Cpath d='M86 70c2-3.4 7.6-2.6 7.6 1.6 0 3-3.8 5.6-7.6 8.4-3.8-2.8-7.6-5.4-7.6-8.4 0-4.2 5.6-5 7.6-1.6z' fill='%23FFB3C4'/%3E%3Ccircle cx='96' cy='22' r='3' fill='%23A6E8C9'/%3E%3Ccircle cx='30' cy='92' r='2.4' fill='%239FD6FF'/%3E%3C/svg%3E");
  background-size: 170px 170px; animation: drift 60s linear infinite; }
@keyframes drift { to { transform: translate(170px, -170px); } }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.3; text-wrap: balance; font-weight: 400; }
button, input, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 貼紙卡 */
.card { background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }

/* 按鈕：粗邊、實心陰影，按下去往下沉 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 10px 24px; border: var(--bw) solid var(--line);
  border-radius: var(--pill); background: var(--y); color: var(--ink); font-family: var(--font); font-weight: 400; font-size: 19px; text-decoration: none; cursor: pointer; box-shadow: var(--sh);
  transition: transform .28s cubic-bezier(.34, 1.8, .64, 1), box-shadow .1s; white-space: nowrap; }
.btn:active { transform: translate(3px, 3px) scale(.95); box-shadow: 1px 1px 0 var(--ink); transition-duration: .06s; }
.btn.ghost { background: var(--paper); }
.btn.line { background: #06C755; color: #fff; }
.btn.small { min-height: 42px; padding: 6px 16px; font-size: 16px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .opt:focus-visible, .field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--b); outline-offset: 3px; }
/* 等待中：轉圈（他規定任何等待都要有會動的東西） */
[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"]::before, .spin { content: ""; width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 組別徽章：馬卡龍底色圓＋吉祥物；吉祥物每隔幾秒眨一次眼（每組錯開），答對會跳，答錯會抖 */
.tbadge { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; background: var(--tc); border: var(--bw) solid var(--line); color: var(--ink); overflow: visible; }
.mascot { display: block; overflow: visible; }
.tbadge > .mascot { margin: -10% -6% -2%; }
.mascot .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.6s infinite; animation-delay: var(--bd, 0s); }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.12); } }
.mascot.happy, .mascot.crown { animation: hop .9s cubic-bezier(.3, 1.8, .5, 1) 3; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14%) rotate(-4deg); } }
.mascot.sad { animation: sob .5s ease-in-out 3; }
@keyframes sob { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }

/* 欄位 */
.field { display: grid; gap: 6px; }
.field label { font-size: 15px; color: var(--ink-2); }
.field input, .field textarea { width: 100%; padding: 12px 14px; border: var(--bw) solid var(--line); border-radius: var(--r-sm); background: var(--paper); font-size: 18px; }
.field textarea { min-height: 220px; font-size: 16px; line-height: 1.6; resize: vertical; font-family: "Noto Sans TC", system-ui, sans-serif; }
.err { color: var(--no); font-size: 15px; white-space: pre-line; }

/* 四個選項 */
.opt { --oc: var(--a); position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 12px 14px; text-align: left;
  border: var(--bw) solid var(--line); border-radius: var(--r); background: var(--oc); color: var(--ink); font-size: 19px; line-height: 1.35;
  box-shadow: var(--sh); cursor: pointer; transition: transform .28s cubic-bezier(.34, 1.8, .64, 1), box-shadow .1s, opacity .2s; }
.opt:nth-child(2) { --oc: var(--b); } .opt:nth-child(3) { --oc: var(--c); } .opt:nth-child(4) { --oc: var(--d); }
.opt:active { transform: translate(3px, 3px) scale(.96); box-shadow: 1px 1px 0 var(--ink); transition-duration: .06s; }
.opt .L { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--paper); border: var(--bw) solid var(--line); font-size: 20px; }
.opt.dim { opacity: .35; }
.opt.picked { transform: scale(1.02); box-shadow: var(--sh-lg); }
.opt.right::after, .opt.wrong::after { content: ""; position: absolute; right: 12px; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; border: var(--bw) solid var(--line);
  background: var(--paper) center / 18px no-repeat; }
.opt.right::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2317915F' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.opt.wrong::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C2412D' stroke-width='4' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E"); }
.opt.right, .opt.wrong { padding-right: 52px; }

/* 倒數圈 */
.ring { --p: 1; position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: conic-gradient(var(--y) calc(var(--p) * 360deg), var(--paper) 0); border: var(--bw) solid var(--line); flex: none; }
.ring b { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--paper); border: var(--bw) solid var(--line); font-weight: 400; font-size: 20px; }
.ring.hurry { background: conic-gradient(var(--a) calc(var(--p) * 360deg), var(--paper) 0); }

/* 開題前的 3 2 1 */
.cd { display: grid; place-items: center; font-size: 120px; line-height: 1; }
.cd span { display: inline-block; animation: pop .9s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { 0% { transform: scale(.2); opacity: 0; } 40% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.bounce { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.wiggle { animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.rise { animation: rise .5s cubic-bezier(.16, 1, .3, 1) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

/* 排行列 */
.rank { display: grid; grid-template-columns: 44px auto 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; }
.rank .no { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: var(--bw) solid var(--line); background: var(--paper); font-size: 18px; }
.rank:nth-child(1) .no { background: var(--y); } .rank:nth-child(2) .no { background: #E5E7EB; } .rank:nth-child(3) .no { background: #F3C9A0; }
.rank .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
.rank .sc { font-size: 20px; }
.rank .av { width: 36px; height: 36px; border-radius: 50%; border: var(--bw) solid var(--line); object-fit: cover; background: var(--y-soft); display: grid; place-items: center; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .cd span, .bounce, .wiggle, .rise, body::before, .mascot, .mascot .eyes { animation: none !important; }
  .btn, .opt { transition: none; }
}
/* 範本元件對齊這裡的圓角系統（14／24／全圓），不另外長出 10px */
.brand img { border-radius: 0; }
.dr-panel a { border-radius: var(--r-sm); }
