/* 天命機神：三國 — site styles (P1: legal and support pages; P2 promo pages reuse the same tokens and shell). */

:root {
  color-scheme: light dark;
  --bg: #f6f2ea;
  --bg-2: #efe8db;
  --card: #fffdf8;
  --line: #ddd2bf;
  --text: #1d1a16;
  --dim: #5c544a;
  --accent: #9b1c2c;
  --accent-fill: #9b1c2c;
  --accent-ink: #ffffff;
  --gold: #8a5a00;
  --link: #8f1a29;
  --ok: #1d6b35;
  --err: #a1261a;
  --head-bg: rgba(246, 242, 234, 0.92);
  --r-ur: #b0306a;
  --r-ssr: #965700;
  --r-sr: #2f63b3;
  --r-r: #5b6b7c;
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.06), 0 8px 24px rgba(40, 30, 10, 0.06);
  --sans: system-ui, -apple-system, 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --serif: 'Noto Serif TC', 'Noto Serif CJK TC', 'Source Han Serif TC', 'PMingLiU', serif;
}
:root:lang(ja) {
  --sans: system-ui, -apple-system, 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic UI', 'Meiryo', sans-serif;
  --serif: 'Noto Serif JP', 'Noto Serif CJK JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f16;
    --bg-2: #141824;
    --card: #161a26;
    --line: #2b3244;
    --text: #ecedf1;
    --dim: #a9b0bf;
    --accent: #ff8d99;
    --accent-fill: #b3303f;
    --accent-ink: #ffffff;
    --gold: #e7b44c;
    --link: #f0a3ad;
    --ok: #8fe0a0;
    --err: #ffb2a6;
    --head-bg: rgba(13, 15, 22, 0.9);
    --r-ur: #ff7ab8;
    --r-ssr: #ffbf4d;
    --r-sr: #7fb0ff;
    --r-r: #a8b4c2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.75 var(--sans);
  overflow-wrap: anywhere;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
/* Japanese headings break between phrases (Chrome 119+), not inside a word. */
:is(h1, h2, h3, summary, .tagline, .big, .lead):lang(ja) { word-break: auto-phrase; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* Language: both are in the page; the <html data-lang> picks one. */
[data-l] { display: none !important; }
html[data-lang='zh'] [data-l='zh'], html[data-lang='ja'] [data-l='ja'] { display: revert !important; }

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

.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; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--head-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 900 17px/1.2 var(--serif); letter-spacing: 0.04em; margin-right: auto; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav { display: flex; gap: 2px; order: 3; width: 100%; margin: 0 -10px; }
.nav a { color: var(--dim); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--bg-2); }
.nav a[aria-current='page'] { color: var(--accent); font-weight: 700; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--card); }
.lang button { appearance: none; border: 0; background: transparent; color: var(--dim); font: 600 13px/1 var(--sans); padding: 7px 11px; border-radius: 999px; cursor: pointer; min-height: 30px; }
.lang button[aria-pressed='true'] { background: var(--accent-fill); color: var(--accent-ink); }
@media (min-width: 760px) {
  .nav { order: 0; width: auto; margin: 0; }
}

/* Main */
main { display: block; padding: 28px 0 56px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 900; line-height: 1.35; letter-spacing: 0.02em; }
h1 { font-size: clamp(24px, 5.4vw, 34px); margin: 0 0 6px; }
h2 { font-size: 20px; margin: 36px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
h3 { font-size: 17px; margin: 22px 0 6px; }
p { margin: 0 0 12px; }
ul, ol { padding-left: 1.4em; margin: 0 0 12px; }
li { margin: 3px 0; }
.lead { color: var(--dim); margin-bottom: 20px; }
.meta { color: var(--dim); font-size: 14px; }
.note { color: var(--dim); font-size: 14px; }
.draft { margin: 16px 0 20px; padding: 10px 14px; border: 1px solid var(--accent); border-left-width: 4px; border-radius: 8px; color: var(--accent); font-size: 14px; font-weight: 700; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.doc { max-width: 760px; }
.doc h2 { counter-increment: sec; }
.doc.numbered { counter-reset: sec; }
.doc.numbered h2::before { content: counter(sec) '. '; color: var(--accent); }
code, kbd { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 0.92em; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }

/* Definition tables (特商法, 資金決済法) */
.dl { display: grid; grid-template-columns: 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.dl > div { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); }
.dl > div:first-child { border-top: 0; }
.dl dt { font-weight: 700; padding: 10px 14px 0; color: var(--gold); }
.dl dd { margin: 0; padding: 2px 14px 12px; min-width: 0; }
.dl dd p:last-child, .dl dd ul:last-child { margin-bottom: 0; }
@media (min-width: 640px) {
  .dl > div { grid-template-columns: 220px minmax(0, 1fr); }
  .dl dt { padding: 12px 14px; background: var(--bg-2); color: var(--text); }
  .dl dd { padding: 12px 14px; }
}

/* Tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; background: var(--bg-2); font-size: 13px; color: var(--dim); font-weight: 700; white-space: nowrap; }
@media (max-width: 480px) { table { font-size: 14px; } th, td { padding: 7px 7px; } thead th { font-size: 12px; } }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Rarity chips */
.rar { display: inline-block; min-width: 3.1em; text-align: center; font: 800 12px/1.6 var(--sans); border-radius: 6px; padding: 0 6px; color: #fff; letter-spacing: 0.03em; }
.rar-UR { background: var(--r-ur); }
.rar-SSR { background: var(--r-ssr); }
.rar-SR { background: var(--r-sr); }
.rar-R { background: var(--r-r); }
@media (prefers-color-scheme: dark) { .rar { color: #111; } }
.tag { display: inline-block; font-size: 12px; line-height: 1.6; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); margin-left: 4px; white-space: nowrap; vertical-align: 1px; }
.tag.up { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.tag.paid { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); font-weight: 700; }
.tag.soon { border-color: var(--gold); color: var(--gold); }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: 700 15px/1.2 var(--sans); text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); }
.btn:disabled { opacity: 0.45; cursor: default; }
form label { display: block; font-weight: 700; margin: 14px 0 4px; }
form label .opt { font-weight: 400; color: var(--dim); font-size: 13px; }
input[type='text'], input[type='email'], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.check input { width: 20px; height: 20px; margin-top: 4px; flex: none; }
.form-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.result { margin-top: 12px; font-weight: 700; }
.result.ok { color: var(--ok); }
.result.err { color: var(--err); }
.hint { color: var(--dim); font-size: 13px; margin-top: 4px; }

/* FAQ */
details { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 8px 0; }
summary { cursor: pointer; padding: 12px 14px; font-weight: 700; list-style: none; position: relative; padding-right: 36px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; position: absolute; right: 14px; top: 10px; font-size: 20px; color: var(--dim); }
details[open] summary::after { content: '−'; }
details > div { padding: 0 14px 12px; }

/* Home: the hero is an ink band in both schemes (the gold logo and the key art are made for a dark ground). */
.home main { padding-top: 0; }
.hero {
  position: relative;
  background: radial-gradient(70% 90% at 50% 0%, #2a1d33 0%, #0d0f16 72%) #0d0f16;
  color: #ecedf1;
  padding: 18px 0 30px;
  margin-bottom: 8px;
}
.hero .logo { width: min(560px, 92%); margin: 6px auto 2px; filter: drop-shadow(0 8px 26px rgba(0, 0, 0, 0.6)); }
.hero .tagline { text-align: center; font: 900 clamp(18px, 4.4vw, 26px)/1.55 var(--serif); letter-spacing: 0.06em; margin: 4px 0 2px; color: #f6e7c4; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
.hero .sub { text-align: center; color: #c3c8d4; margin: 0 0 18px; font-size: 15px; }
.keyart { margin: 0 -16px 8px; overflow: hidden; background: #1a1420; }
.keyart img { width: 100%; height: auto; }
@media (min-width: 760px) { .keyart { margin: 0 0 8px; border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55); } }
.soon-box { text-align: center; margin: 22px auto 0; padding: 18px 16px; border-radius: 16px; border: 1px solid rgba(231, 180, 76, 0.45); background: linear-gradient(180deg, rgba(231, 180, 76, 0.14), rgba(231, 180, 76, 0.04)); max-width: 640px; }
.soon-box .big { font: 900 clamp(20px, 5vw, 28px)/1.4 var(--serif); color: #f3c76a; letter-spacing: 0.1em; margin: 0 0 2px; }
.soon-box .note { color: #c3c8d4; margin: 0; }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 18px; padding: 0; list-style: none; }
.links a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); text-decoration: none; font-weight: 700; height: 100%; }
.links a small { display: block; color: var(--dim); font-weight: 400; font-size: 13px; }
.links a:hover { border-color: var(--accent); }
.nw { white-space: nowrap; }

/* Odds */
.pool-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; padding: 0; list-style: none; }
.pool-nav a { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); text-decoration: none; color: var(--text); font-size: 14px; }
.pool { margin-top: 30px; }
.pool h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pool h2 small { font: 600 13px/1.4 var(--sans); color: var(--dim); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-variant-numeric: tabular-nums; font-weight: 700; }
.rules { margin: 6px 0 14px; }
.rules li { margin: 4px 0; }
.tw { font-size: 14px; border-left: 3px solid var(--accent); padding: 6px 10px; background: var(--bg-2); border-radius: 0 8px 8px 0; }
.items { list-style: none; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 12px; }
.items li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); margin: 0; }
.it-rate { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.bundle { display: block; font-size: 12px; color: var(--dim); }

/* Footer */
footer { border-top: 1px solid var(--line); background: var(--bg-2); padding: 26px 0 34px; font-size: 14px; color: var(--dim); }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
footer nav a { color: var(--text); text-decoration: none; }
footer nav a:hover { text-decoration: underline; }
footer p { margin: 2px 0; }
