/* ==================================================================
   老大生日 · 逞罰決鬥 — 遊戲王 (Yu-Gi-Oh!) 風格
   ================================================================== */

:root {
  --gold:        #e8c45a;
  --gold-bright: #ffe89a;
  --gold-deep:   #b8862b;
  --void:        #0a0612;
  --void-2:      #160d2e;
  --purple:      #7b2ff7;
  --purple-glow: #a64dff;
  --cyan:        #4dd9ff;
  --magenta:     #ff3ea5;
  --card-tan:    #d9b779;
  --card-tan-2:  #c79f57;
  --danger:      #ff2e4d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto; /* 內容超過一頁時可捲動，避免下方按鈕被切掉按不到 */
  background: var(--void);
  color: #fff;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ==================================================================
   背景層：暗紫虛空 + 旋轉光暈 + 六角網格
   ================================================================== */
.duel-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 35%, #2a1a52 0%, #160d2e 45%, #0a0612 100%);
}
.bg-conic {
  position: absolute;
  top: 50%; left: 50%;
  width: 200vmax; height: 200vmax;
  transform: translate(-50%, -50%);
  background: conic-gradient(from 0deg,
    transparent 0deg,
    rgba(123,47,247,.18) 40deg,
    transparent 80deg,
    rgba(77,217,255,.14) 140deg,
    transparent 180deg,
    rgba(255,62,165,.16) 240deg,
    transparent 300deg,
    rgba(123,47,247,.18) 360deg);
  animation: spinConic 26s linear infinite;
  opacity: .8;
}
@keyframes spinConic { to { transform: translate(-50%, -50%) rotate(360deg); } }

.bg-hex {
  position: absolute; inset: -40px;
  background-image:
    linear-gradient(60deg, rgba(232,196,90,.05) 1px, transparent 1px),
    linear-gradient(-60deg, rgba(232,196,90,.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(232,196,90,.04) 1px, transparent 1px);
  background-size: 46px 80px, 46px 80px, 46px 80px;
  animation: hexDrift 18s linear infinite;
  opacity: .55;
}
@keyframes hexDrift { to { background-position: 46px 80px, -46px 80px, 0 80px; } }

.bg-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.75) 100%);
}

/* ==================================================================
   背景火焰 (決鬥開始 → body.dueling 時點燃)
   ================================================================== */
.duel-bg { transition: background 1.2s ease; }
body.dueling .duel-bg {
  background: radial-gradient(ellipse at 50% 118%, #6a1c0c 0%, #3a1020 42%, #0a0612 100%);
}

.fire {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 48vh; z-index: 1; pointer-events: none;
  opacity: 0; transition: opacity 1.2s ease;
}
body.dueling .fire { opacity: 1; }

.fire .flames {
  position: absolute; bottom: -4%; left: -6%; width: 112%; height: 100%;
  transform-origin: bottom center;
  background:
    radial-gradient(40px 120px at 6% 100%,  rgba(255,190,50,.95), rgba(255,90,0,.4) 55%, transparent 72%),
    radial-gradient(56px 165px at 17% 100%, rgba(255,120,0,.92), rgba(220,40,0,.4) 55%, transparent 72%),
    radial-gradient(44px 130px at 29% 100%, rgba(255,205,70,.92), rgba(255,90,0,.4) 55%, transparent 72%),
    radial-gradient(64px 185px at 41% 100%, rgba(255,95,0,.95),  rgba(190,25,0,.4) 55%, transparent 72%),
    radial-gradient(46px 140px at 53% 100%, rgba(255,175,40,.92), rgba(255,80,0,.4) 55%, transparent 72%),
    radial-gradient(60px 175px at 66% 100%, rgba(255,110,0,.92), rgba(210,35,0,.4) 55%, transparent 72%),
    radial-gradient(44px 135px at 78% 100%, rgba(255,200,60,.92), rgba(255,90,0,.4) 55%, transparent 72%),
    radial-gradient(56px 160px at 92% 100%, rgba(255,120,0,.92), rgba(220,40,0,.4) 55%, transparent 72%);
  filter: blur(8px);
  animation: flameFlick .45s ease-in-out infinite alternate;
}
.fire .flames2 {
  filter: blur(14px); opacity: .75; mix-blend-mode: screen;
  animation-duration: .63s; animation-delay: .12s;
}
@keyframes flameFlick {
  0%   { transform: scaleY(.92) scaleX(1.03) translateY(2%); opacity: .88; }
  100% { transform: scaleY(1.14) scaleX(.97) translateY(-3%); opacity: 1; }
}
.fire .fire-haze {
  position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  background: linear-gradient(to top, rgba(255,70,0,.55) 0%, rgba(255,130,0,.22) 32%, transparent 70%);
  animation: hazePulse 2.1s ease-in-out infinite;
}
@keyframes hazePulse { 0%,100% { opacity: .7; } 50% { opacity: 1; } }

/* ==================================================================
   粒子 Canvas + 閃光層
   ================================================================== */
#fxCanvas { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

.flash-layer {
  position: fixed; inset: 0; z-index: 55; pointer-events: none;
  opacity: 0;
}
.flash-layer.gold  { background: radial-gradient(circle at center, rgba(255,232,154,.85), transparent 65%); animation: flashOut .8s ease-out; }
.flash-layer.red   { background: radial-gradient(circle at center, rgba(255,46,77,.7), transparent 70%); animation: flashOut .7s ease-out; }
@keyframes flashOut { 0% { opacity: 1; } 100% { opacity: 0; } }

/* ==================================================================
   通用：金色決鬥按鈕
   ================================================================== */
.duel-btn {
  cursor: pointer;
  position: relative;
  border: none;
  border-radius: 14px;
  padding: 18px 50px;
  background: linear-gradient(180deg, #fff3c4 0%, var(--gold) 35%, var(--gold-deep) 100%);
  color: #2a1a05;
  font-family: "Cinzel", "Noto Sans TC", serif;
  font-weight: 900;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.7),
    inset 0 -5px 0 rgba(120,80,0,.5),
    0 0 0 3px #6b4a10,
    0 10px 30px rgba(0,0,0,.6),
    0 0 40px rgba(255,200,80,.5);
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
  transition: transform .1s;
  animation: btnPulse 1.6s ease-in-out infinite;
}
.duel-btn:hover  { transform: translateY(-3px) scale(1.03); }
.duel-btn:active { transform: translateY(2px) scale(.99); }
.duel-btn-main { font-size: clamp(26px, 3.4vw, 40px); letter-spacing: 3px; }
.duel-btn-sub  { font-size: 13px; font-weight: 700; letter-spacing: 2px; opacity: .8; font-family: "Noto Sans TC", sans-serif; }
@keyframes btnPulse {
  0%,100% { box-shadow: inset 0 2px 0 rgba(255,255,255,.7), inset 0 -5px 0 rgba(120,80,0,.5), 0 0 0 3px #6b4a10, 0 10px 30px rgba(0,0,0,.6), 0 0 40px rgba(255,200,80,.45); }
  50%     { box-shadow: inset 0 2px 0 rgba(255,255,255,.7), inset 0 -5px 0 rgba(120,80,0,.5), 0 0 0 3px #6b4a10, 0 10px 30px rgba(0,0,0,.6), 0 0 64px rgba(255,220,120,.9); }
}

/* ==================================================================
   開場 Intro
   ================================================================== */
.intro {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(22,13,46,.6) 0%, rgba(10,6,18,.96) 100%);
  backdrop-filter: blur(2px);
  transition: opacity .6s ease, transform .6s ease;
}
.intro.hide { opacity: 0; transform: scale(1.1); pointer-events: none; }
.intro-inner { text-align: center; padding: 20px; max-width: 680px; }
.intro-sub {
  font-size: clamp(14px, 2vw, 20px); letter-spacing: 8px; color: var(--gold-bright);
  text-shadow: 0 0 12px var(--purple-glow); margin-bottom: 10px;
}
.intro-logo {
  font-family: "Cinzel", "Noto Sans TC", serif;
  font-weight: 900;
  font-size: clamp(44px, 9vw, 104px);
  letter-spacing: 10px;
  background: linear-gradient(180deg, #fff7d6 0%, var(--gold-bright) 30%, var(--gold) 55%, var(--gold-deep) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 #5a3c08) drop-shadow(0 0 30px rgba(255,200,80,.6));
  animation: logoFloat 3.4s ease-in-out infinite;
}
@keyframes logoFloat { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1deg); } }
.intro-eye {
  width: clamp(90px, 14vw, 150px); margin: 14px auto 8px;
  filter: drop-shadow(0 0 18px var(--gold));
  animation: eyePulse 2.6s ease-in-out infinite;
}
@keyframes eyePulse { 0%,100% { transform: scale(1); filter: drop-shadow(0 0 16px var(--gold)); } 50% { transform: scale(1.07); filter: drop-shadow(0 0 34px var(--gold-bright)); } }
.intro-rule {
  font-size: clamp(14px, 1.8vw, 18px); line-height: 1.9; color: #f3e7c8;
  margin: 6px auto 26px; max-width: 560px; text-shadow: 0 2px 6px rgba(0,0,0,.7);
}
.intro-rule b { color: var(--gold-bright); }

/* ==================================================================
   決鬥場
   ================================================================== */
.duel {
  position: relative; z-index: 10;
  min-height: 100vh; width: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 16px 24px;
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.duel.show { opacity: 1; transform: none; }

/* HUD */
.hud {
  width: 100%; max-width: 1000px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 8px 14px;
  border: 2px solid var(--gold-deep);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(40,26,80,.7), rgba(16,9,34,.7));
  box-shadow: inset 0 0 18px rgba(123,47,247,.3), 0 0 18px rgba(0,0,0,.5);
}
.hud-title {
  font-family: "Cinzel", "Noto Sans TC", serif; font-weight: 800;
  font-size: clamp(16px, 2.2vw, 24px); letter-spacing: 2px; color: var(--gold-bright);
  text-shadow: 0 0 10px var(--purple-glow);
}
.hud-right { display: flex; align-items: center; gap: 16px; }
.hud-progress { font-weight: 700; letter-spacing: 1px; color: #e8dcc0; font-size: clamp(13px,1.6vw,17px); }
.hud-progress span { color: var(--gold-bright); font-size: 1.2em; }

.fund {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 30px;
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, #2e7d4f, #14532d);
  box-shadow: inset 0 0 10px rgba(0,0,0,.4), 0 0 14px rgba(50,200,120,.4);
  font-weight: 700;
}
.fund-icon  { font-size: 18px; }
.fund-label { font-size: 12px; letter-spacing: 1px; color: #d7ffe6; }
.fund-count { font-size: 22px; font-weight: 900; color: #fff; min-width: 22px; text-align: center;
  text-shadow: 0 0 8px #8fffb5; }
.fund-unit  { font-size: 12px; color: #d7ffe6; }
.fund.bump  { animation: fundBump .5s ease; }
@keyframes fundBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); box-shadow: inset 0 0 10px rgba(0,0,0,.4), 0 0 30px rgba(255,80,80,.9); }
  100% { transform: scale(1); }
}

/* ==================================================================
   遊戲王卡片
   ================================================================== */
.card-stage {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 18px 0 8px;
  perspective: 1400px;
  width: 100%;
}

/* 加寬卡 (程式碼題：讓 code 更大更清楚) */
.yg-card.wide { width: min(96vw, 820px); }

/* ============ 三張獨立卡片 (三巨頭) ============ */
.triple-deck {
  position: relative;
  width: min(97vw, 1100px);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: cardSummon .8s cubic-bezier(.2,.9,.25,1.2) both;
}
#ygCard.triple-deck.correct { animation: cardWin 1s ease both; }
#ygCard.triple-deck.wrong { animation: cardLose .5s ease both; }
.deck-title {
  font-family: "Cinzel", "Noto Sans TC", serif; font-weight: 900;
  font-size: clamp(20px, 2.6vw, 30px); color: var(--gold-bright);
  text-shadow: 0 0 14px var(--purple-glow), 0 2px 4px #000; letter-spacing: 1px;
}
.deck-row {
  display: flex; justify-content: center; align-items: stretch;
  gap: clamp(10px, 2vw, 26px); width: 100%;
}
.belly-card {
  flex: 1 1 0; max-width: 350px;
  position: relative;
  border-radius: 14px; padding: 10px;
  background: linear-gradient(135deg, #fff3c4 0%, var(--gold) 18%, var(--gold-deep) 50%, var(--gold) 82%, #fff3c4 100%);
  box-shadow: 0 0 0 2px #6b4a10, 0 14px 36px rgba(0,0,0,.65), 0 0 36px rgba(255,200,80,.3);
  animation: cardSummon .8s cubic-bezier(.2,.9,.25,1.2) both;
}
.belly-card:nth-child(1) { animation-delay: .05s; }
.belly-card:nth-child(2) { animation-delay: .18s; }
.belly-card:nth-child(3) { animation-delay: .31s; }
.belly-frame {
  aspect-ratio: 1.3; /* 897/3 ÷ 230 ≈ 1.3，不變形 */
  background-size: 300% 100%; background-repeat: no-repeat;
  filter: brightness(1.16) contrast(1.08);
  border: 3px solid #6b4a10; border-radius: 8px;
  box-shadow: inset 0 0 0 2px #cda85a;
}
.belly-no {
  position: absolute; top: 4px; left: 4px; z-index: 3;
  width: clamp(28px, 3vw, 38px); height: clamp(28px, 3vw, 38px); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #fff, var(--gold) 55%, var(--gold-deep));
  color: #2a1a05; font-weight: 900; font-size: clamp(15px, 1.8vw, 21px);
  box-shadow: 0 0 10px rgba(255,200,80,.7), inset 0 -2px 4px rgba(120,80,0,.4);
}
.deck-q {
  max-width: 760px; text-align: center;
  font-size: clamp(19px, 2.4vw, 27px); font-weight: 800; line-height: 1.5;
  color: #fff; text-shadow: 0 0 14px var(--purple-glow), 0 2px 6px #000;
  padding: 10px 18px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(40,26,80,.72), rgba(16,9,34,.72));
  border: 2px solid var(--gold-deep);
}

.yg-card {
  position: relative;
  width: min(94vw, 620px);
  border-radius: 18px;
  padding: 14px;
  background:
    linear-gradient(135deg, #fff3c4 0%, var(--gold) 18%, var(--gold-deep) 50%, var(--gold) 82%, #fff3c4 100%);
  box-shadow:
    0 0 0 2px #6b4a10,
    0 18px 50px rgba(0,0,0,.7),
    0 0 50px rgba(255,200,80,.35);
  transform-style: preserve-3d;
  animation: cardSummon .9s cubic-bezier(.2,.9,.25,1.2) both, cardFloat 5s ease-in-out 1s infinite;
}
@keyframes cardSummon {
  0%   { opacity: 0; transform: rotateY(180deg) scale(.2) translateY(60px); filter: blur(8px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: rotateY(0) scale(1) translateY(0); }
}
@keyframes cardFloat {
  0%,100% { transform: translateY(0) rotateZ(-.6deg); }
  50%     { transform: translateY(-12px) rotateZ(.6deg); }
}
.yg-card.correct { animation: cardWin 1s ease both; }
@keyframes cardWin {
  0% { transform: scale(1); box-shadow: 0 0 0 2px #6b4a10, 0 18px 50px rgba(0,0,0,.7), 0 0 50px rgba(255,200,80,.35); }
  40% { transform: scale(1.06); box-shadow: 0 0 0 2px #6b4a10, 0 18px 50px rgba(0,0,0,.7), 0 0 90px rgba(255,232,154,1); }
  100% { transform: scale(1); box-shadow: 0 0 0 2px #6b4a10, 0 18px 50px rgba(0,0,0,.7), 0 0 60px rgba(255,232,154,.6); }
}
.yg-card.wrong { animation: cardLose .5s ease both; }
@keyframes cardLose {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-12px) rotateZ(-2deg); }
  40% { transform: translateX(12px) rotateZ(2deg); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}

/* 全像光澤掃過 */
.yg-card::after {
  content: ""; position: absolute; inset: 0; border-radius: 16px; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.55) 45%, rgba(180,230,255,.4) 50%, transparent 62%);
  background-size: 250% 250%;
  mix-blend-mode: overlay;
  animation: foilSweep 4.5s ease-in-out infinite;
}
@keyframes foilSweep { 0% { background-position: 130% 0; } 100% { background-position: -30% 0; } }

.yg-inner {
  position: relative;
  border-radius: 8px;
  padding: 10px 12px 14px;
  background: linear-gradient(180deg, var(--card-tan) 0%, var(--card-tan-2) 100%);
  box-shadow: inset 0 0 0 2px rgba(120,80,20,.4);
}

.yg-name {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: "Cinzel", "Noto Sans TC", serif; font-weight: 800;
  font-size: clamp(19px, 2.6vw, 28px); color: #2a1605;
  letter-spacing: 1px; text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.yg-attr {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; font-size: 19px;
  background: radial-gradient(circle at 35% 30%, #fff, var(--purple-glow) 55%, #3a1d6e);
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 0 8px var(--purple-glow), inset 0 -2px 4px rgba(0,0,0,.4);
}
.yg-level { margin: 6px 0 8px; font-size: clamp(14px, 1.7vw, 18px); letter-spacing: 1px; color: #8a5a12; text-align: right; }

.yg-image {
  position: relative;
  border: 3px solid #6b4a10;
  border-radius: 4px;
  background: #000;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px #cda85a;
}
.yg-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 超寬照片 (三巨頭肚子)：完整顯示不裁切 */
.yg-image.contain { aspect-ratio: 16 / 8; background: #0c0c14; }
.yg-image.contain img { object-fit: contain; }
.yg-image.dual { display: flex; gap: 4px; background: #2a2a2a; }
.yg-image.dual figure { position: relative; flex: 1; height: 100%; overflow: hidden; }
.yg-image.dual img { height: 100%; }
.yg-image.dual figcaption {
  position: absolute; bottom: 0; left: 0; right: 0; text-align: center;
  font-size: 12px; font-weight: 700; color: #fff; background: rgba(0,0,0,.55); padding: 2px;
}
/* 三巨頭：把超寬照片切成三張卡片放大 */
.yg-image.triple {
  display: flex; gap: 8px; aspect-ratio: auto; height: auto;
  background: transparent; border: 0; box-shadow: none; overflow: visible;
}
.yg-image.triple::before { display: none; }
.yg-image.triple figure {
  flex: 1; position: relative; aspect-ratio: 1.3; /* 897/230÷3 ≈ 1.3，不變形 */
  background-size: 300% 100%; background-repeat: no-repeat;
  filter: brightness(1.12) contrast(1.06);
  border: 3px solid #6b4a10; border-radius: 6px; overflow: hidden;
  box-shadow: inset 0 0 0 2px #cda85a, 0 5px 14px rgba(0,0,0,.55);
}
.yg-image.triple figcaption {
  position: absolute; top: 5px; left: 5px;
  background: rgba(0,0,0,.6); color: var(--gold-bright); font-weight: 900;
  padding: 1px 10px; border-radius: 12px; font-size: clamp(14px, 1.8vw, 20px);
  box-shadow: 0 0 8px rgba(0,0,0,.6);
}

/* 程式碼題：用文字盒當「圖」 */
.yg-image.codebox {
  display: block; aspect-ratio: auto; background: #0d1626; border-color: #6b4a10;
  padding: 20px 22px; color: #c6f6d5; font-family: Consolas, "Courier New", monospace;
  font-size: clamp(16px, 1.9vw, 23px); font-weight: 700;
  line-height: 1.8; white-space: pre-wrap; word-break: break-word;
  overflow: visible; text-align: left; min-height: 0;
}
.yg-image.codebox .kw { color: #ff9ed2; }
.yg-image.codebox .ty { color: #79d2ff; }

/* 全像掃過也覆蓋圖片 */
.yg-image::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.35) 48%, transparent 56%);
  background-size: 250% 250%;
  animation: foilSweep 4.5s ease-in-out .4s infinite;
}

.yg-type {
  margin: 10px 0 8px; font-weight: 700; font-size: clamp(14px,1.7vw,17px); color: #3a2305;
  border-bottom: 2px solid rgba(120,80,20,.45); padding-bottom: 5px;
}
.yg-text {
  min-height: 64px;
  font-size: clamp(18px, 2.3vw, 25px); font-weight: 700; line-height: 1.55; color: #1e1004;
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
}
.yg-foot {
  margin-top: 10px; padding-top: 7px; border-top: 2px solid rgba(120,80,20,.45);
  text-align: right; font-family: "Cinzel", serif; font-weight: 800; color: #3a2305;
  font-size: clamp(13px, 1.6vw, 16px);
}

/* 答對 / 答錯 印章 */
.stamp {
  position: absolute; top: 50%; left: 50%; z-index: 30;
  transform: translate(-50%,-50%) rotate(-14deg) scale(0);
  font-family: "Cinzel","Noto Sans TC",serif; font-weight: 900;
  font-size: clamp(40px, 7vw, 78px); letter-spacing: 4px; padding: 8px 26px;
  border: 6px solid; border-radius: 12px; pointer-events: none;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.stamp.show { animation: stampIn .5s cubic-bezier(.2,1.4,.4,1) forwards; }
.stamp.ok   { color: var(--gold-bright); border-color: var(--gold-bright); background: rgba(60,40,0,.35); text-shadow: 0 0 20px var(--gold); }
.stamp.no   { color: #ff708a; border-color: #ff2e4d; background: rgba(60,0,10,.4); text-shadow: 0 0 20px #ff2e4d; }
@keyframes stampIn {
  0% { transform: translate(-50%,-50%) rotate(-14deg) scale(2.4); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: translate(-50%,-50%) rotate(-14deg) scale(1); opacity: 1; }
}

/* ==================================================================
   選項 (魔法/陷阱卡風格)
   ================================================================== */
.options {
  width: 100%; max-width: 640px;
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 14px; margin-top: 10px;
}

/* 主持人判定鈕：答對 / 答錯 */
.judge {
  cursor: pointer;
  border: 3px solid; border-radius: 14px;
  padding: 20px 14px;
  font-family: inherit; font-weight: 900; font-size: clamp(17px, 2.3vw, 23px);
  letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .1s, filter .15s;
  animation: optIn .5s ease both;
}
.judge-icon { font-size: 1.35em; line-height: 1; }
.judge.ok {
  color: #2a1a05; border-color: var(--gold-bright);
  background: linear-gradient(180deg, #fff3c4 0%, var(--gold) 45%, var(--gold-deep) 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), inset 0 -5px 0 rgba(120,80,0,.4),
    0 6px 0 #6b4a10, 0 8px 18px rgba(0,0,0,.5), 0 0 26px rgba(255,200,80,.5);
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.judge.no {
  color: #fff; border-color: #ff5c75;
  background: linear-gradient(180deg, #c0263e 0%, #7a0f20 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), inset 0 -5px 0 rgba(0,0,0,.35),
    0 6px 0 #4a0810, 0 8px 18px rgba(0,0,0,.5), 0 0 26px rgba(255,46,77,.5);
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
}
.judge:hover:not(:disabled)  { transform: translateY(-3px); filter: brightness(1.08); }
.judge:active:not(:disabled) { transform: translateY(2px); }
.judge:disabled { cursor: default; opacity: .5; filter: grayscale(.35); }

.opt {
  cursor: pointer;
  position: relative; overflow: hidden;
  text-align: left;
  border: 2px solid #2f8f6f;
  border-radius: 10px;
  padding: 14px 16px 14px 46px;
  background: linear-gradient(180deg, #1f6e54, #0e3d2e);
  color: #eafff4; font-family: inherit; font-weight: 700; font-size: clamp(15px,1.9vw,19px);
  letter-spacing: .5px;
  box-shadow: inset 0 0 12px rgba(0,0,0,.4), 0 4px 0 #0a2c20, 0 6px 14px rgba(0,0,0,.4);
  transition: transform .1s, box-shadow .15s, filter .15s;
  animation: optIn .5s ease both;
}
@keyframes optIn { 0% { opacity: 0; transform: translateY(14px); } 100% { opacity: 1; transform: none; } }
.opt::before {
  content: attr(data-key);
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 6px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  color: #3a2305; font-family: "Cinzel",serif; font-weight: 900; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 8px rgba(255,200,80,.6);
}
.opt:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.12); box-shadow: inset 0 0 12px rgba(0,0,0,.4), 0 7px 0 #0a2c20, 0 10px 20px rgba(0,0,0,.5), 0 0 22px rgba(80,255,170,.5); }
.opt:active:not(:disabled) { transform: translateY(1px); }
.opt:disabled { cursor: default; }
.opt.correct { border-color: var(--gold-bright); background: linear-gradient(180deg, #b8902f, #7a5a12); color: #fff;
  box-shadow: 0 0 26px var(--gold), inset 0 0 14px rgba(255,255,255,.3); animation: optWin .6s ease; }
.opt.wrongpick { border-color: var(--danger); background: linear-gradient(180deg, #8a1226, #4a0810); color: #ffd0d8;
  filter: saturate(1.2); }
.opt.dim { opacity: .4; filter: grayscale(.5); }
@keyframes optWin { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ==================================================================
   揭曉列 + 下一題
   ================================================================== */
.reveal-bar {
  width: 100%; max-width: 760px; margin-top: 14px;
  min-height: 54px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  flex-wrap: wrap;
}
.reveal-text {
  font-size: clamp(15px, 2vw, 20px); font-weight: 700; color: var(--gold-bright);
  text-shadow: 0 0 10px var(--purple-glow); text-align: center;
  opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s;
}
.reveal-text.show { opacity: 1; transform: none; }
.ans-label {
  display: inline-block; vertical-align: middle; margin-right: 10px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  color: #2a1a05; font-weight: 900; font-size: 13px; letter-spacing: 1px;
  padding: 3px 12px; border-radius: 20px; box-shadow: 0 0 10px rgba(255,200,80,.6);
}
.ans-value {
  vertical-align: middle;
  font-family: "Cinzel", "Noto Sans TC", serif; font-weight: 900;
  font-size: clamp(22px, 3vw, 34px); color: #fff;
  text-shadow: 0 0 16px var(--gold), 0 0 8px var(--magenta);
}
.ans-note {
  display: block; margin-top: 6px;
  font-size: clamp(14px, 1.7vw, 17px); font-weight: 700; color: var(--gold-bright);
}
.next-btn {
  cursor: pointer; display: none;
  border: 2px solid var(--gold); border-radius: 10px;
  padding: 12px 28px;
  background: linear-gradient(180deg, var(--purple-glow), #4a1d8e);
  color: #fff; font-family: inherit; font-weight: 800; font-size: clamp(15px,1.8vw,18px);
  letter-spacing: 1px;
  box-shadow: 0 4px 0 #2a0f55, 0 8px 18px rgba(0,0,0,.5), 0 0 22px rgba(166,77,255,.6);
  transition: transform .1s;
}
.next-btn.show { display: inline-block; animation: optIn .4s ease both; }
.next-btn:hover  { transform: translateY(-2px); }
.next-btn:active { transform: translateY(2px); }

/* ==================================================================
   結算
   ================================================================== */
.result {
  position: fixed; inset: 0; z-index: 85;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(22,13,46,.85) 0%, rgba(10,6,18,.97) 100%);
  opacity: 0; pointer-events: none; transition: opacity .6s ease;
}
.result.show { opacity: 1; pointer-events: auto; }
.result-inner { text-align: center; padding: 24px; max-width: 620px; }
.result-sub { letter-spacing: 8px; color: var(--gold-bright); text-shadow: 0 0 12px var(--purple-glow); font-size: clamp(13px,1.8vw,18px); }
.result-title {
  font-family: "Cinzel","Noto Sans TC",serif; font-weight: 900;
  font-size: clamp(40px, 8vw, 88px); letter-spacing: 8px;
  background: linear-gradient(180deg,#fff7d6,var(--gold-bright) 40%,var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #5a3c08) drop-shadow(0 0 26px rgba(255,200,80,.6));
  margin: 6px 0 18px; animation: logoFloat 3.4s ease-in-out infinite;
}
.result-tally { font-size: clamp(18px, 2.6vw, 26px); font-weight: 700; color: #f3e7c8; line-height: 1.6; }
.result-num {
  font-family: "Cinzel",serif; font-weight: 900; font-size: clamp(46px,9vw,90px);
  color: #fff; text-shadow: 0 0 24px var(--magenta), 0 0 12px #fff; margin: 0 6px;
  display: inline-block; animation: numPop .8s cubic-bezier(.2,1.5,.4,1) both;
}
@keyframes numPop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.result-msg { margin: 16px auto 6px; font-size: clamp(15px,2vw,19px); line-height: 1.8; color: var(--gold-bright); max-width: 520px; }
.result-wish {
  margin: 14px 0 26px; font-size: clamp(16px,2.2vw,22px); font-weight: 800; color: #fff;
  text-shadow: 0 0 14px var(--magenta); letter-spacing: 1px;
}

/* ==================================================================
   背景音樂
   ================================================================== */
.bgm-hidden { position: fixed; width: 1px; height: 1px; bottom: 0; right: 0; opacity: 0; pointer-events: none; z-index: -1; }
.music-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 90;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  border: 2px solid var(--gold); border-radius: 30px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #2e1a52, #160d2e);
  color: var(--gold-bright); font-family: inherit; font-weight: 700; font-size: 13px; letter-spacing: 1px;
  box-shadow: 0 0 16px rgba(123,47,247,.5), inset 0 0 10px rgba(0,0,0,.4);
  transition: transform .1s;
}
.music-toggle:hover  { transform: translateY(-2px); }
.music-toggle:active { transform: translateY(1px); }
.music-toggle.paused { color: #b9a9d9; }
.music-icon { font-size: 16px; }
.music-toggle.playing .music-icon { animation: musicSpin 2s linear infinite; }
@keyframes musicSpin { to { transform: rotate(360deg); } }

/* ==================================================================
   響應式
   ================================================================== */
/* ---- 依寬度 RWD ---- */
@media (max-width: 900px) {
  .duel { padding: 12px 12px 18px; }
}
@media (max-width: 700px) {
  .hud { justify-content: center; gap: 8px; padding: 6px 10px; }
  .hud-title { width: 100%; text-align: center; }
  .hud-right { width: 100%; justify-content: space-between; }
  .options { grid-template-columns: 1fr 1fr; max-width: 480px; gap: 10px; }
  .judge { padding: 14px 8px; font-size: clamp(14px, 4vw, 18px); flex-direction: column; gap: 4px; }
  .music-toggle .music-state { display: none; }
  .yg-card { width: 94vw; }
  .yg-image.triple figcaption { font-size: 13px; padding: 1px 7px; }
  .fire { height: 38vh; }
}
@media (max-width: 420px) {
  .yg-text { font-size: 17px; }
  .yg-name { font-size: 19px; }
}

/* ---- 依高度 RWD（避免直向溢出，矮螢幕縮小卡片）---- */
@media (max-height: 860px) {
  .yg-card { width: min(92vw, 540px); }
  .card-stage { padding: 12px 0 6px; }
}
@media (max-height: 760px) {
  .yg-card { width: min(90vw, 460px); }
  .yg-text { min-height: 44px; }
  .judge { padding: 12px 10px; }
}
@media (max-height: 640px) {
  .yg-card { width: min(86vw, 380px); }
  .intro-logo { font-size: clamp(40px, 8vw, 70px); }
}
