/*
 * Wrong Button 網站共用樣式：照遊戲本身的介面做（Material 3 色票、圓角卡片、任務卡、對話泡泡、The Button）。
 * 三個網站（簡介、服務條款、隱私權政策）用同一份樣式。
 */
:root {
  --primary: #B3402F;
  --on-primary: #FFFFFF;
  --primary-container: #FFDAD4;
  --on-primary-container: #410001;
  --secondary-container: #FFDAD4;
  --on-secondary-container: #2C1512;
  --tertiary-container: #FBDFA6;
  --on-tertiary-container: #251A00;
  --bg: #FFFBF8;
  --on-bg: #231918;
  --surface-variant: #F5DDDA;
  --on-surface-variant: #534341;
  --surface-container: #FCEAE7;
  --surface-container-high: #F7E4E1;
  --outline: #857371;
  --outline-variant: #D8C2BE;
  --btn-body: #FF6B5B;
  --btn-shade: #C9473A;
  --ink: #2B1B18;
  --radius-card: 20px;
  --radius-big: 28px;
  color-scheme: light dark;
}

/* 深色：跟著系統，或用頁面上的切換鈕（data-theme）指定。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #FFB4A8;
    --on-primary: #690002;
    --primary-container: #8F2A1C;
    --on-primary-container: #FFDAD4;
    --secondary-container: #5D3F3B;
    --on-secondary-container: #FFDAD4;
    --tertiary-container: #574500;
    --on-tertiary-container: #FBDFA6;
    --bg: #1A1110;
    --on-bg: #F1DFDC;
    --surface-variant: #534341;
    --on-surface-variant: #D8C2BE;
    --surface-container: #271D1C;
    --surface-container-high: #322827;
    --outline: #A08C89;
    --outline-variant: #534341;
  }
}
:root[data-theme="dark"] {
  --primary: #FFB4A8;
  --on-primary: #690002;
  --primary-container: #8F2A1C;
  --on-primary-container: #FFDAD4;
  --secondary-container: #5D3F3B;
  --on-secondary-container: #FFDAD4;
  --tertiary-container: #574500;
  --on-tertiary-container: #FBDFA6;
  --bg: #1A1110;
  --on-bg: #F1DFDC;
  --surface-variant: #534341;
  --on-surface-variant: #D8C2BE;
  --surface-container: #271D1C;
  --surface-container-high: #322827;
  --outline: #A08C89;
  --outline-variant: #534341;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--on-bg);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 8px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---- 頂端列：和遊戲裡的關卡頂端列一樣（暫停｜標題｜提示） ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.topbar .wrap { display: flex; align-items: center; min-height: 56px; gap: 4px; }
.topbar .title { flex: 1; text-align: center; font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%; color: var(--on-bg); text-decoration: none;
}
.icon-btn:hover { background: var(--surface-container); }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }

/* ---- 任務卡 ---- */
.task {
  background: var(--surface-container);
  border-radius: var(--radius-card);
  padding: 14px 20px;
  margin: 8px 0 12px;
}
.task .label { font-size: .8rem; color: var(--on-surface-variant); }
.task .text { font-size: 1.25rem; font-weight: 700; line-height: 1.5; }

/* ---- 對話泡泡（左邊是小小的 The Button） ---- */
.speech { display: flex; align-items: center; gap: 10px; margin: 12px 0 20px; }
.speech .face { width: 44px; height: 44px; flex: none; }
.bubble {
  flex: 1;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  border-radius: 4px 20px 20px 20px;
  padding: 12px 16px;
  min-height: 48px;
}

/* ---- 卡片與段落 ---- */
.card {
  background: var(--surface-container);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  margin: 14px 0;
}
.card.high { background: var(--surface-container-high); }
.card.tonal { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.card h2, .card h3 { margin-top: 0; }
h1 { font-size: 2.2rem; line-height: 1.25; margin: 8px 0; font-weight: 900; }
h2 { font-size: 1.4rem; line-height: 1.4; margin: 32px 0 8px; }
h3 { font-size: 1.1rem; margin: 18px 0 6px; }
.muted { color: var(--on-surface-variant); }
.small { font-size: .9rem; }

/* ---- Chip（像選關畫面的章節捷徑） ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px;
  border: 1px solid var(--outline-variant); border-radius: 10px;
  color: var(--on-bg); text-decoration: none; font-size: .95rem; background: transparent;
}
a.chip:hover { background: var(--surface-container-high); }
.chip.on { background: var(--secondary-container); border-color: transparent; color: var(--on-secondary-container); }

/* ---- 按鈕 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 24px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.outlined { background: transparent; color: var(--primary); border: 1px solid var(--outline); }

/* ---- The Button 本人（SVG） ---- */
.the-button { display: block; }
.the-button .pupil { transition: transform .18s ease; }
.the-button .mouth-lie { display: none; }
.the-button.lie .pupil { transform: translateX(4.6px); }
.the-button.lie .mouth-honest { display: none; }
.the-button.lie .mouth-lie { display: inline; }
@media (prefers-reduced-motion: reduce) { .the-button .pupil { transition: none; } }

/* ---- 頁尾 ---- */
footer { margin: 0; padding: 0; }

/* ---- 表格（隱私權政策用） ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--outline-variant); }
th { color: var(--on-surface-variant); font-weight: 600; }

/* ---- 摘要清單（打勾） ---- */
.checks { list-style: none; padding: 0; margin: 8px 0; }
.checks li { position: relative; padding-left: 32px; margin: 8px 0; }
.checks li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 6px; margin-top: 3px;
  background: var(--primary); color: var(--on-primary); font-size: 14px; line-height: 22px; text-align: center;
}

/* ---- 深淺色切換鈕（不能用 inline style，Cloudflare 的 CSP 只允許外部樣式） ---- */
.theme-btn { background: none; border: 0; font: inherit; font-size: 1.25rem; cursor: pointer; }

/* ---- 寄信 ---- */
.mail-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.steps { padding-left: 22px; }
.steps li { margin: 6px 0; }

/* ---- 各網站的強調色：官網珊瑚、服務條款琥珀、隱私權政策青綠 ---- */
.site-intro { --accent: var(--primary); --stage: var(--surface-container); }
.site-terms { --accent: #8A6A00; --stage: #FBE7B5; }
.site-privacy { --accent: #1F6F62; --stage: #CDEBE4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-terms { --accent: #E9C46A; --stage: #3D3010; }
  :root:not([data-theme="light"]) .site-privacy { --accent: #7FD3C3; --stage: #12352F; }
}
:root[data-theme="dark"] .site-terms { --accent: #E9C46A; --stage: #3D3010; }
:root[data-theme="dark"] .site-privacy { --accent: #7FD3C3; --stage: #12352F; }
.checks li::before { background: var(--accent, var(--primary)); }

/* ---- 頂端列右邊的閱讀進度（像關卡裡的計數） ---- */
.progress { font-size: .8rem; font-weight: 700; color: var(--accent); white-space: nowrap; min-width: 3.5em; text-align: right; }

/* ---- 舞台：主視覺放在中間，像關卡畫面 ---- */
.stage {
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 55%, var(--stage) 0 58%, transparent 59%);
  padding: 10px 0 4px; margin: 4px 0;
}
.stage .art { width: min(240px, 62vw); height: auto; display: block; }
.lead { font-size: 1.05rem; }
.level-info { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 10px 0 18px; }
.level-info li { padding: 4px 12px; border-radius: 8px; background: var(--surface-variant); color: var(--on-surface-variant); font-size: .88rem; }

/* ---- 每一節是一張「關卡卡片」 ---- */
.level {
  position: relative;
  background: var(--surface-container);
  border-radius: var(--radius-card);
  padding: 16px 20px 18px;
  margin: 14px 0;
  scroll-margin-top: 72px;
}
.level-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.level-badge { font-size: .85rem; font-weight: 800; color: var(--accent); white-space: nowrap; }
.level h2 { margin: 0; font-size: 1.3rem; }
.level .mission {
  margin: 10px 0 6px; padding: 8px 12px; border-radius: 12px;
  background: var(--surface-container-high); font-weight: 700;
}
.level .mission::before { content: "任務　"; font-size: .8rem; font-weight: 600; color: var(--on-surface-variant); }
.level.read::after {
  content: "✓"; position: absolute; top: 14px; right: 16px;
  width: 26px; height: 26px; border-radius: 50%; line-height: 26px; text-align: center;
  background: var(--accent); color: var(--bg); font-weight: 900; font-size: .9rem;
}

/* ---- 暫停選單與提示框（遊戲裡的覆蓋層） ---- */
dialog.overlay {
  border: 0; padding: 0; background: transparent; color: var(--on-bg);
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
}
dialog.overlay::backdrop { background: rgba(0, 0, 0, .45); }
.overlay-card {
  background: var(--surface-container-high); border-radius: var(--radius-big);
  padding: 22px; max-height: calc(100vh - 48px); overflow-y: auto;
}
.overlay-card h2 { margin: 0 0 12px; font-size: 1.4rem; }
.overlay-card .btn { width: 100%; margin: 6px 0; }
.menu-list { list-style: none; padding: 0; margin: 8px 0 12px; }
.menu-list a {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: 14px;
  color: var(--on-bg); text-decoration: none; background: var(--surface-container); margin: 6px 0;
}
.menu-list a:hover { background: var(--surface-variant); }
.menu-list .n { color: var(--accent); font-weight: 800; min-width: 3.6em; font-size: .85rem; }
.menu-list .t { flex: 1; }
.menu-list .done { color: var(--accent); font-weight: 900; visibility: hidden; }
.menu-list a.read .done { visibility: visible; }
.hint-tier { background: var(--surface-container); border-radius: 16px; padding: 12px 14px; margin: 8px 0; }
.hint-tier .label { font-size: .8rem; font-weight: 700; color: var(--accent); }
.hint-tier[hidden] { display: none; }

/* ---- 結算畫面（頁尾） ---- */
.result {
  text-align: center; background: var(--surface-container); border-radius: var(--radius-big);
  padding: 24px 20px; margin: 28px 0 12px;
}
.result h2 { font-size: 2rem; margin: 6px 0; font-weight: 900; }
.result .face { width: 96px; height: 96px; margin: 0 auto; }
.result .stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.result .stat { background: var(--surface-container-high); border-radius: 16px; padding: 10px 18px; min-width: 110px; }
.result .stat .k { font-size: .8rem; color: var(--on-surface-variant); }
.result .stat .v { font-size: 1.3rem; font-weight: 800; }
.result .actions { display: grid; gap: 8px; max-width: 360px; margin: 0 auto; }
.result .mails { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.copy { text-align: center; font-size: .85rem; color: var(--on-surface-variant); margin: 12px 0 40px; }

/* 關卡卡片裡面的小卡（簡介的三個支柱、季、價格）要跟外框分得出來 */
.level .card { background: var(--bg); box-shadow: none; }
.level .card.high { background: var(--surface-container-high); }
.copy { padding: 0 16px; }
