/* ---------------------------------------------------------------------------
 * 示範遊戲平台 — demo 宿主頁樣式
 *
 * 刻意「不做」的事（避免干擾我方 widget SDK 與客戶自家樣式）：
 *   - 沒有 `* { all: unset }` / `* { font-size: … !important }` 之類的全域重設
 *   - 沒有動 html 的 font-size（字級一律 rem，跟隨瀏覽器預設 16px）
 *   - 沒有在 body 或其祖先加 transform / filter / perspective / contain
 *     （SDK 規格 §2.1：這些屬性會破壞浮窗的 position: fixed 定位）
 * ------------------------------------------------------------------------- */

:root {
  --bg: #0b1020;
  --surface: #151a29;
  --surface-2: #0e1b3c;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8ecf5;
  --text-muted: #a9b4c9;
  --text-dim: #93a0b8;
  --accent: #4f46e5;
  --accent-from: #3f56eb;
  --accent-to: #6146ec;
  --grad-from: #68a2fa;
  --grad-to: #9c8ffa;
  --warn-bg: #2b2110;
  --warn-border: #7a5a12;
  --warn-text: #fbd38d;
  --page-px: 3.5rem;
  --radius-card: 1rem;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang TC',
    'Noto Sans TC', 'Microsoft JhengHei', 'Helvetica Neue', Arial, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* 背景光暈：獨立的 fixed 圖層，不參與版面計算，也不建立會影響
   position: fixed 的 containing block（沒有 transform/filter）。 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(56rem 30rem at 64% -10%, rgba(79, 70, 229, 0.16), transparent 70%),
    radial-gradient(40rem 26rem at 6% 20%, rgba(37, 99, 235, 0.09), transparent 72%);
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- 設定提示橫幅 ------------------------------------------------------- */

.config-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem var(--page-px);
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn-text);
  font-size: 0.875rem;
  line-height: 1.5;
}

.config-banner[hidden] {
  display: none;
}

.config-banner-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.5rem;
  border-radius: 50%;
  background: #f6ad55;
}

.config-banner strong {
  margin-right: 0.375rem;
}

.config-banner code {
  padding: 0.0625rem 0.3125rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.09);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

/* --- 頁首 --------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem var(--page-px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: #fff;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin: 0 auto;
}

.nav-link {
  font-size: 0.9375rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
}

.nav-link.is-active {
  color: #fff;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: none;
}

/* --- 按鈕 --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 3.125rem;
  padding: 0 1.75rem;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}

/* `.btn` 是 inline-flex，會蓋掉 [hidden] 的 UA display:none，所以要明寫一條。
   刻意不用全域 `[hidden] { display: none !important }`，避免影響到 SDK 注入的節點。 */
.btn[hidden] {
  display: none;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-sm {
  height: 2.375rem;
  padding: 0 1.125rem;
  border-radius: 999px;
  font-size: 0.9375rem;
}

.btn-gradient {
  background-image: linear-gradient(90deg, var(--accent-from), var(--accent-to));
  box-shadow: 0 0.5rem 1.5rem rgba(79, 70, 229, 0.35);
}

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

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

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

.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* 登入後的狀態晶片（由 app.js 切換）：外觀是靜態標籤，不再是可按的按鈕 */
.btn[data-state='logged-in'] {
  background-image: none;
  background-color: rgba(79, 70, 229, 0.18);
  border-color: rgba(129, 140, 248, 0.45);
  color: #c7d2fe;
  box-shadow: none;
  cursor: default;
  font-variant-numeric: tabular-nums;
}

.btn[data-state='logged-in']:hover {
  transform: none;
}

/* --- Hero --------------------------------------------------------------- */

main {
  flex: 1 0 auto;
}

.hero {
  padding: 4.5rem var(--page-px) 2.5rem;
  max-width: 61rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0.5rem 1.125rem;
  border: 1px solid rgba(147, 180, 255, 0.24);
  border-radius: 999px;
  background: var(--surface-2);
  color: #93b4ff;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

.badge-mark {
  font-size: 0.75rem;
}

.hero-title {
  margin: 0 0 1.25rem;
  font-size: clamp(2.25rem, 6.2vw, 3.75rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0.01em;
}

.hero-title-grad {
  background-image: linear-gradient(90deg, var(--grad-from), var(--grad-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  margin: 0 0 1.75rem;
  max-width: 36rem;
  font-size: 1.125rem;
  line-height: 1.85;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
}

/* --- 特色卡 ------------------------------------------------------------- */

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  padding: 0.5rem var(--page-px) 3.5rem;
}

.card {
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.25rem;
  border-radius: 0.75rem;
  background: rgba(79, 70, 229, 0.16);
  color: #c7d2fe;
}

.card-title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.card-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text-dim);
}

/* --- 頁尾 --------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 1.25rem var(--page-px) 5rem;
  border-top: 1px solid var(--border);
}

.footer-note,
.footer-diag {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.6;
  color: #55607a;
}

.footer-note {
  color: #6b7690;
  letter-spacing: 0.02em;
}

.footer-diag {
  color: #55607a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

/* --- 響應式 ------------------------------------------------------------- */

@media (max-width: 60rem) {
  :root {
    --page-px: 1.75rem;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
  }

  .site-nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .hero {
    padding: 3rem var(--page-px) 2.5rem;
  }

  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 40rem) {
  :root {
    --page-px: 1.25rem;
  }

  .brand-name {
    font-size: 1.0625rem;
  }

  .brand-mark {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 0.625rem;
  }

  .badge {
    margin-bottom: 1.5rem;
    font-size: 0.8125rem;
  }

  .hero-lead {
    font-size: 1rem;
    margin-bottom: 1.75rem;
  }

  .hero-actions .btn {
    flex: 1 1 10rem;
    height: 3rem;
    padding: 0 1.25rem;
  }

  .features {
    grid-template-columns: minmax(0, 1fr);
  }

  .card {
    padding: 1.5rem;
  }

  .site-footer {
    padding-bottom: 7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}
