/* ==========================================================================
   幸運 777 老虎機 — 全域樣式
   設計目標：零外部資源、低 CLS、支援 reduced-motion、對比度符合 WCAG AA
   ========================================================================== */

:root {
  --bg: #0b1020;
  --bg-alt: #111830;
  --surface: #161f3d;
  --surface-2: #1e2a50;
  --gold: #ffcc4d;
  --gold-deep: #e0a518;
  --red: #ff4d6d;
  --text: #f5f7ff;
  --muted: #a9b4d0;
  --line: rgba(255, 255, 255, 0.12);
  --focus: #7dd3fc;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --wrap: 1080px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 背景光暈：純 CSS，不產生額外請求 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 15% -5%, rgba(255, 204, 77, 0.13), transparent 65%),
    radial-gradient(700px 500px at 90% 10%, rgba(94, 129, 255, 0.12), transparent 60%);
  pointer-events: none;
}

img, canvas { max-width: 100%; }

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #ffe08a; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap { width: min(var(--wrap), calc(100% - 2rem)); margin-inline: auto; }
.wrap.narrow { max-width: 760px; }

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

.skip-link {
  position: absolute;
  top: -100px; left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--gold);
  color: #1a1300;
  font-weight: 700;
  border-radius: 0 0 8px 8px;
}
.skip-link:focus { top: 0; color: #1a1300; }

/* ------------------------------ 導覽列 ------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 16, 32, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--gold), var(--gold-deep));
  color: #1a1300;
  font-weight: 900;
  letter-spacing: -1px;
  font-size: 0.95rem;
}
.brand-name { font-weight: 800; letter-spacing: 0.04em; }
.site-nav { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); }

/* ------------------------------ 首屏 ------------------------------ */
.hero { padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(3rem, 7vw, 5rem); }
.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #fff 25%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lead { font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--text); max-width: 36em; }
.hero-sub { color: var(--muted); font-size: 0.95rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 1.8rem 0 0; }
.hero-badges li {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.hero-art { display: flex; gap: 0.6rem; justify-content: center; }
.art-reel {
  flex: 1 1 0;
  max-width: 110px;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 900;
  color: var(--red);
  background: linear-gradient(160deg, #fffdf6, #e8e3d5);
  box-shadow: inset 0 0 0 4px rgba(255, 204, 77, 0.55), var(--shadow);
  transform: rotate(-3deg);
}
.art-reel:nth-child(2) { transform: translateY(-14px) rotate(2deg); }
.art-reel:nth-child(3) { transform: rotate(4deg); }

/* ------------------------------ 通用區段 ------------------------------ */
.section { padding: clamp(3rem, 7vw, 5rem) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section-head { margin-bottom: 2rem; }
.section-head h2 { margin: 0 0 0.6rem; font-size: clamp(1.6rem, 4vw, 2.3rem); }
.section-head p { margin: 0; color: var(--muted); max-width: 60ch; }

/* ------------------------------ 遊戲機台 ------------------------------ */
.machine {
  margin: 0;
  background: linear-gradient(180deg, var(--surface), var(--bg-alt));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.machine-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.machine-brand { font-weight: 900; letter-spacing: 0.18em; color: var(--gold); }
.machine-status { font-size: 0.85rem; color: var(--muted); }

.reel-window {
  margin: 1.2rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  background: #070b16;
  box-shadow: inset 0 0 0 2px rgba(255, 204, 77, 0.22), inset 0 12px 30px rgba(0, 0, 0, 0.6);
}
#slot-canvas { display: block; width: 100%; height: auto; border-radius: 10px; }

.result-line {
  margin: 0 1.2rem 1rem;
  min-height: 1.6em;
  text-align: center;
  font-weight: 700;
  color: var(--gold);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  padding: 0 1.2rem 1.2rem;
}
.hud-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.5rem;
  text-align: center;
}
.hud-label { display: block; font-size: 0.75rem; color: var(--muted); }
.hud-item strong { font-size: clamp(1rem, 3vw, 1.4rem); font-variant-numeric: tabular-nums; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.bet-group { border: 0; padding: 0; margin: 0; }
.bet-group legend { font-size: 0.8rem; color: var(--muted); padding: 0 0 0.4rem; }
.bet-options { display: flex; gap: 0.4rem; }
.bet-options label { cursor: pointer; }
.bet-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bet-options span {
  display: block;
  min-width: 44px;
  text-align: center;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s, border-color 0.15s;
}
.bet-options input:checked + span { background: var(--gold); border-color: var(--gold); color: #1a1300; }
.bet-options input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.action-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(145deg, var(--gold), var(--gold-deep)); color: #1a1300; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.3); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); }
.btn-ghost[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.btn-spin { min-width: 130px; font-size: 1.05rem; }
.machine-hint { margin: 0; padding: 0 1.2rem 1.2rem; font-size: 0.8rem; color: var(--muted); }
kbd {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  font-size: 0.85em;
}

/* ------------------------------ 步驟／表格／FAQ ------------------------------ */
.steps { padding-left: 1.4rem; }
.steps li { margin-bottom: 0.8rem; color: var(--muted); }
.steps strong { color: var(--text); }
.note {
  margin-top: 1.8rem;
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--gold);
  background: rgba(255, 204, 77, 0.08);
  border-radius: 0 10px 10px 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.note strong { color: var(--gold); }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.paytable { width: 100%; border-collapse: collapse; min-width: 420px; }
.paytable th, .paytable td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid var(--line); }
.paytable thead th { background: var(--surface-2); color: var(--gold); font-size: 0.85rem; }
.paytable tbody tr:last-child th, .paytable tbody tr:last-child td { border-bottom: 0; }
.paytable td:last-child { font-weight: 800; font-variant-numeric: tabular-nums; }

.prose h3 { margin: 1.8rem 0 0.5rem; font-size: 1.15rem; }
.prose p { color: var(--muted); margin: 0; }

.faq-list { display: grid; gap: 0.8rem; }
.faq-item { border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.3rem; background: var(--surface); }
.faq-item h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.faq-item p { margin: 0; color: var(--muted); }

/* ------------------------------ 頁尾 ------------------------------ */
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0; background: #070b16; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: space-between; }
.footer-inner p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; }
.footer-inner nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-inner nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.footer-inner nav a:hover { color: var(--text); }
.copyright { width: 100%; }

/* ------------------------------ 響應式 ------------------------------ */
@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { order: -1; max-width: 320px; margin-inline: auto; }
  .hud { grid-template-columns: repeat(2, 1fr); }
  .controls { flex-direction: column; align-items: stretch; }
  .action-group .btn { flex: 1 1 45%; }
  .site-nav { gap: 0.9rem; font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (prefers-contrast: more) {
  :root { --muted: #e6ecff; --line: rgba(255, 255, 255, 0.4); }
}
