/* ==========================================================
   MEGA H5 — 共用樣式（配色取自 logo：藍青漸層 + 橘金漸層）
   ========================================================== */
:root {
  /* logo 藍 */
  --blue-1: #1747ff;
  --blue-2: #1f8bff;
  --cyan: #3fd7ff;
  --cyan-2: #9ff0ff;
  /* logo 橘金 */
  --red-orange: #ff3a1a;
  --orange: #ff7a00;
  --gold: #ffc21a;
  --gold-2: #ffe680;
  --gold-3: #fff6cc;
  /* 舞台底色（延伸自 app 畫面的深藍紫） */
  --bg-0: #05042a;
  --bg-1: #0f0b52;
  --bg-2: #231089;
  --purple: #7b2cff;
  --purple-2: #a65bff;
  --pink: #ff2e8a;
  --green: #2bd96b;

  --text: #ffffff;
  --muted: #b8b6ff;
  --line: rgba(160, 170, 255, 0.28);

  --grad-blue: linear-gradient(90deg, var(--blue-1), var(--blue-2) 45%, var(--cyan));
  --grad-gold: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 35%, var(--orange) 75%, var(--red-orange) 100%);
  --grad-frame: linear-gradient(135deg, #fff3b0, #ffb300 25%, #ff6a00 50%, #ffd34d 75%, #fff3b0);

  --font: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-num: "Rubik", "Noto Sans TC", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg-0);
  background:
    radial-gradient(ellipse 80% 45% at 50% 110%, rgba(123, 44, 255, 0.55), transparent 70%),
    radial-gradient(ellipse 70% 40% at 50% -5%, rgba(31, 139, 255, 0.35), transparent 70%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 85%, #12095a 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- 舞台背景：布幕條紋 + 探照燈 + 地台 ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.stage::before { /* 布幕直紋 */
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 3px, transparent 3px 46px),
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(80, 90, 255, 0.18), transparent 70%);
}
.stage::after { /* 地台光環 */
  content: "";
  position: absolute;
  left: 50%;
  bottom: -18vh;
  width: 130vw;
  height: 34vh;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, rgba(140, 90, 255, 0.55), rgba(40, 20, 140, 0.4) 50%, transparent 72%);
  box-shadow: 0 -2px 40px rgba(110, 170, 255, 0.35);
  border-top: 2px solid rgba(120, 190, 255, 0.45);
}

/* 探照燈：用錐形漸層做出柔邊光束，取代 clip-path + blur（blur 每幀都要在 GPU 重算） */
.beam {
  position: absolute;
  bottom: -5vh;
  width: 34vw;
  height: 115vh;
  transform-origin: 50% 100%;
  background: conic-gradient(from -17deg at 50% 100%,
    transparent 0deg, rgba(170, 210, 255, 0.42) 4deg, rgba(170, 210, 255, 0.42) 30deg, transparent 34deg, transparent 360deg);
  -webkit-mask: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.2) 65%, transparent 90%);
          mask: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.2) 65%, transparent 90%);
  mix-blend-mode: screen;
  will-change: transform;
  animation: beam-sway 7s ease-in-out infinite alternate;
}
.beam.b1 { left: -8vw;  --r0: 22deg;  --r1: 8deg;  animation-duration: 8s; }
.beam.b2 { left: 18vw;  --r0: 10deg;  --r1: -6deg; animation-duration: 6.5s; animation-delay: -2s; opacity: .7; }
.beam.b3 { right: 18vw; --r0: -10deg; --r1: 6deg;  animation-duration: 7.2s; animation-delay: -4s; opacity: .7; }
.beam.b4 { right: -8vw; --r0: -22deg; --r1: -8deg; animation-duration: 9s; }
@keyframes beam-sway {
  from { transform: rotate(var(--r0)); }
  to   { transform: rotate(var(--r1)); }
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
#fx-front {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  pointer-events: none;
}

/* ---------- Logo（含掃光） ---------- */
.logo-shine {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.logo-shine img { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 14px rgba(31, 139, 255, 0.45)); }
/* 掃光：遮罩固定在 .shine 上，裡面的光帶只做 transform 位移（GPU 合成，不重繪） */
.logo-shine .shine {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-mask: url("logo.png") center / 100% 100% no-repeat;
          mask: url("logo.png") center / 100% 100% no-repeat;
  mix-blend-mode: screen;
  pointer-events: none;
}
.logo-shine .shine::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 60%;
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,0.95) 50%, transparent 100%);
  transform: translateX(-110%);
  animation: logo-sweep 3.6s ease-in-out infinite;
}
@keyframes logo-sweep {
  0%, 55% { transform: translateX(-110%); }
  100%    { transform: translateX(180%); }
}

/* ---------- 按鈕 ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 0 28px;
  height: 52px;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.12em;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.18s var(--ease-back), filter 0.2s;
}
.btn::before { /* 上半亮面 */
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 3px;
  height: 45%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.65), rgba(255,255,255,0.05));
  z-index: -1;
}
.btn::after { /* 掃光：用 transform 位移（原本動 left 會每幀重排版） */
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  left: 0;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.75), transparent);
  transform: translateX(-150%) skewX(-20deg);
  animation: btn-sweep 3s ease-in-out infinite;
}
.btn:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(0.97); }
.btn:focus-visible { outline: 3px solid var(--cyan-2); outline-offset: 3px; }
@keyframes btn-sweep {
  0%, 60% { transform: translateX(-150%) skewX(-20deg); }
  100%    { transform: translateX(325%) skewX(-20deg); }
}

/* 流動金框：把漸層放在一條寬帶上做 translate，取代逐幀改 background-position */
.flow-frame {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.flow-frame::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 300%;
  background: var(--flow, linear-gradient(90deg, #fff3b0, #ffb300 12.5%, #ff6a00 25%, #ffd34d 37.5%, #fff3b0 50%, #ffb300 62.5%, #ff6a00 75%, #ffd34d 87.5%, #fff3b0));
  animation: flow-move var(--flow-dur, 6s) linear infinite;
}
@keyframes flow-move {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.btn-gold {
  color: #5a1800;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
  background: var(--grad-gold);
  box-shadow:
    0 0 0 2px #fff2b0 inset,
    0 -4px 0 rgba(170, 40, 0, 0.55) inset,
    0 6px 0 #a83300,
    0 10px 24px rgba(255, 122, 0, 0.55);
}
.btn-blue {
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 30, 120, 0.6);
  background: linear-gradient(180deg, var(--cyan-2), var(--cyan) 30%, var(--blue-2) 65%, var(--blue-1));
  box-shadow:
    0 0 0 2px #c9f6ff inset,
    0 -4px 0 rgba(0, 30, 140, 0.5) inset,
    0 6px 0 #0b2aa8,
    0 10px 24px rgba(31, 139, 255, 0.5);
}
.btn-green {
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 80, 20, 0.6);
  background: linear-gradient(180deg, #b6ffb0, #4fe36a 35%, #12a63c);
  box-shadow: 0 0 0 2px #dfffd8 inset, 0 5px 0 #0b6b26, 0 8px 20px rgba(43, 217, 107, 0.4);
}
.btn-pink {
  color: #fff;
  text-shadow: 0 2px 0 rgba(120, 0, 60, 0.6);
  background: linear-gradient(180deg, #ffc2e2, #ff5aa8 35%, #d6127a);
  box-shadow: 0 0 0 2px #ffe0f0 inset, 0 5px 0 #8c0a50, 0 8px 20px rgba(255, 46, 138, 0.4);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 22%;
  z-index: 80;
  transform: translate(-50%, -10px) scale(0.9);
  opacity: 0;
  padding: 14px 26px;
  border-radius: 14px;
  background: rgba(14, 8, 70, 0.92);
  border: 2px solid var(--gold);
  box-shadow: 0 0 30px rgba(255, 194, 26, 0.35);
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.35s var(--ease-back);
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
