/* =========================================================
   幸運 7 老虎機 — 全域樣式
   設計目標：零外部依賴、RWD、可訪問、低填充率
   ========================================================= */

:root {
  --bg: #0b1021;
  --bg-alt: #101731;
  --surface: #161f3d;
  --surface-2: #1d2850;
  --border: #2c3a68;
  --text: #eef2ff;
  --text-muted: #aab6dc;
  --gold: #fbbf24;
  --gold-soft: #fde68a;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --win: #34d399;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --maxw: 1200px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

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

h1, h2, h3 {
  line-height: 1.3;
  letter-spacing: 0.01em;
  margin: 0 0 0.75em;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }

a {
  color: var(--primary-light);
  text-decoration-color: rgba(129, 140, 248, 0.5);
  text-underline-offset: 3px;
}

a:hover { color: var(--gold-soft); }

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

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

code {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  font-size: 0.9em;
  color: var(--gold-soft);
}

.wrap {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  background: var(--gold);
  color: #1a1200;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* ================= 頁首 ================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 16, 33, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #f59e0b);
  color: #241a00;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.35);
}

.brand-name b { color: var(--gold); }

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

.nav-list a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0;
}

.nav-list a:hover {
  color: var(--gold-soft);
}

/* ================= 首屏 ================= */

.hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 3rem;
  background:
    radial-gradient(900px 420px at 78% -10%, rgba(99, 102, 241, 0.28), transparent 65%),
    radial-gradient(700px 380px at 8% 110%, rgba(251, 191, 36, 0.12), transparent 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.eyebrow {
  color: var(--gold);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.08rem;
  color: var(--text-muted);
  max-width: 62ch;
}

.lead strong { color: var(--text); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #f59e0b);
  color: #241a00;
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #fde68a, var(--gold));
  color: #241a00;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--primary-light);
  color: var(--text);
}

.quick-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  max-width: 34rem;
}

.quick-facts div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
}

.quick-facts dt {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.quick-facts dd {
  margin: 0.15rem 0 0;
  font-weight: 700;
  color: var(--gold-soft);
}

/* ================= 遊戲卡片 ================= */

.game-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-alt));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(1.1rem, 3vw, 1.7rem);
  box-shadow: var(--shadow);
  scroll-margin-top: 90px;
}

.game-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
}

.game-card-head h2 { margin: 0; font-size: 1.35rem; }

.game-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--gold-soft);
  letter-spacing: 0.08em;
}

.wallet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.wallet-item {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  text-align: center;
}

.wallet-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wallet output {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold-soft);
}

#reels {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 3;
  background: #0a0f22;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  touch-action: manipulation;
}

.status {
  min-height: 1.8em;
  margin: 0.85rem 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  text-align: center;
}

.status.is-win {
  color: var(--win);
  font-weight: 800;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.bet-group {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.85rem 0.4rem;
  margin: 0;
}

.bet-group legend {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 0.35rem;
}

.bet-group label {
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

.bet-group input {
  accent-color: var(--gold);
  margin-right: 0.25rem;
}

.btn-spin {
  background: linear-gradient(135deg, var(--primary), #4338ca);
  color: #fff;
  min-width: 170px;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.3);
}

.btn-spin:hover { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }

.btn-spin:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-spin kbd {
  font: inherit;
  font-size: 0.68rem;
  opacity: 0.75;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  padding: 0 0.3rem;
}

.controls-secondary {
  justify-content: flex-start;
  margin-top: 0.75rem;
}

.btn-mini {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
}

.btn-mini:hover { color: var(--text); border-color: var(--primary-light); }

.game-note {
  margin: 0.9rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ================= 通用章節 ================= */

.section {
  padding: clamp(2.8rem, 6vw, 4.5rem) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.section-alt {
  background: var(--bg-alt);
}

.section-lead {
  color: var(--text-muted);
  max-width: 78ch;
  margin-bottom: 1.8rem;
}

/* ================= 表格 ================= */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.94rem;
}

caption {
  text-align: left;
  padding: 0.85rem 1rem;
  color: var(--gold-soft);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

th, td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-top: 1px solid var(--border);
}

thead th {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.025); }

tbody th { color: var(--text); font-weight: 700; }

/* ================= 定義清單 ================= */

.def-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.8rem 0 0;
}

.def-list > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
}

.def-list dt {
  font-weight: 800;
  color: var(--gold-soft);
  margin-bottom: 0.4rem;
}

.def-list dd {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* ================= 特性卡片 ================= */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}

.feature h3 {
  color: var(--gold-soft);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}

.feature ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.feature li + li { margin-top: 0.4rem; }

.source-note {
  margin-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ================= FAQ ================= */

.faq-list {
  display: grid;
  gap: 0.75rem;
  max-width: 900px;
}

.faq-list details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 1.1rem;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.75rem 0;
  list-style-position: outside;
}

.faq-list details[open] summary { color: var(--gold-soft); }

.faq-list p {
  color: var(--text-muted);
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
}

/* ================= 免責 ================= */

.disclaimer {
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.disclaimer p { color: var(--text-muted); }

/* ================= 頁尾 ================= */

.site-footer {
  border-top: 1px solid var(--border);
  background: #080c18;
  padding: 1.8rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.footer-inner p { margin: 0; }

.site-footer nav {
  display: flex;
  gap: 1rem;
}

/* ================= RWD ================= */

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .game-card { max-width: 620px; width: 100%; }
}

@media (max-width: 560px) {
  .wrap { width: min(100% - 1.5rem, var(--maxw)); }
  .header-inner { flex-wrap: wrap; padding-block: 0.6rem; }
  .nav-list { gap: 0.2rem 0.9rem; font-size: 0.85rem; }
  .quick-facts { grid-template-columns: 1fr 1fr; }
  .wallet output { font-size: 1rem; }
  .btn-spin { width: 100%; }
  .bet-group { width: 100%; }
  .bet-group label { display: inline-block; }
}

/* ================= 減少動態效果 ================= */

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

/* ================= 列印 ================= */

@media print {
  .site-header, .hero-actions, .controls, .controls-secondary, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .game-card, .feature, .def-list > div, .faq-list details { border-color: #999; background: #fff; }
}
