/* 孤島求生 · 服務條款／隱私權政策：顏色和 App 的琥珀色主題一樣。 */
:root {
  --primary: #b45309;
  --on-primary: #ffffff;
  --primary-container: #fde7c2;
  --on-primary-container: #451a03;
  --tertiary-container: #ffedd5;
  --bg: #fff8ec;
  --on-bg: #1c1917;
  --muted: #57534e;
  --surface: #ffffff;
  --surface-high: #fdf3e1;
  --surface-highest: #f8ead0;
  --outline: #b8a27c;
  --outline-variant: #eadfc8;
  --hero-ink: #fff8ec;
  --shadow: 0 1px 2px rgba(69, 26, 3, .06), 0 6px 20px rgba(69, 26, 3, .07);
  --radius: 24px;
  --radius-s: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #fbbf24;
    --on-primary: #1c1917;
    --primary-container: #5c3a0a;
    --on-primary-container: #fde7c2;
    --tertiary-container: #4a2a12;
    --bg: #1a140e;
    --on-bg: #f7ebdc;
    --muted: #d8c6af;
    --surface: #281f16;
    --surface-high: #31261b;
    --surface-highest: #3b2e21;
    --outline: #9c8569;
    --outline-variant: #4a3b2c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #fbbf24;
  --on-primary: #1c1917;
  --primary-container: #5c3a0a;
  --on-primary-container: #fde7c2;
  --tertiary-container: #4a2a12;
  --bg: #1a140e;
  --on-bg: #f7ebdc;
  --muted: #d8c6af;
  --surface: #281f16;
  --surface-high: #31261b;
  --surface-highest: #3b2e21;
  --outline: #9c8569;
  --outline-variant: #4a3b2c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--on-bg);
  font: 16px/1.8 "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
img.px { image-rendering: pixelated; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 700; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---- 封面 ---- */
.hero {
  position: relative;
  overflow: hidden;
  color: var(--hero-ink);
  background: #2b1d10 url("assets/island-banner.jpg") center 38% / cover no-repeat;
  image-rendering: pixelated;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(34, 22, 10, .92) 0%, rgba(34, 22, 10, .78) 45%, rgba(34, 22, 10, .25) 100%);
}
.hero .wrap { position: relative; padding-top: 22px; padding-bottom: 56px; }
.topbar { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: .5px; }
.brand img { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.brand small { display: block; font-weight: 600; font-size: 12px; opacity: .8; letter-spacing: 1px; }
.grow { flex: 1; }
.switch-doc { display: inline-flex; background: rgba(255, 248, 236, .14); border: 1px solid rgba(255, 248, 236, .25); border-radius: 999px; padding: 4px; }
.switch-doc a { color: var(--hero-ink); text-decoration: none; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.switch-doc a[aria-current="page"] { background: #fde7c2; color: #451a03; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 248, 236, .25);
  background: rgba(255, 248, 236, .14); color: var(--hero-ink); cursor: pointer; font-size: 18px; line-height: 1;
}
.icon-btn:focus-visible, .switch-doc a:focus-visible, .toc a:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }
.hero-body { display: flex; align-items: flex-end; gap: 24px; margin-top: 56px; }
.hero-text { flex: 1; max-width: 680px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; letter-spacing: 3px; color: #fbbf24; }
.eyebrow img { width: 22px; height: 22px; }
.hero h1 { margin: 8px 0 10px; font-size: clamp(36px, 6vw, 56px); line-height: 1.15; font-weight: 900; letter-spacing: 2px; }
.lead { margin: 0; font-size: 18px; line-height: 1.7; color: #f3e3cc; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.meta span { background: rgba(255, 248, 236, .14); border: 1px solid rgba(255, 248, 236, .22); border-radius: 999px; padding: 4px 14px; font-size: 14px; font-weight: 600; }
.islander { width: 120px; height: auto; flex: none; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .45)); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .islander { animation: none; } html { scroll-behavior: auto; } }

/* ---- 重點 ---- */
.summary { position: relative; margin-top: -32px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--outline-variant); border-radius: 20px; padding: 18px 18px 16px; box-shadow: var(--shadow); }
.tile img { width: 36px; height: 36px; }
.tile h3 { margin: 8px 0 2px; font-size: 16px; line-height: 1.4; }
.tile p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }

/* ---- 內文 ---- */
.layout { display: grid; grid-template-columns: 250px 1fr; gap: 28px; margin: 36px auto 56px; align-items: start; }
.toc { position: sticky; top: 20px; background: var(--surface); border: 1px solid var(--outline-variant); border-radius: 20px; padding: 14px 10px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); overflow: auto; }
.toc summary { list-style: none; font-weight: 800; font-size: 15px; padding: 2px 10px 8px; cursor: default; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 10px; color: var(--on-bg); text-decoration: none; font-size: 14px; line-height: 1.5; }
.toc a .n { font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; min-width: 20px; }
.toc a:hover { background: var(--surface-high); }
.toc a.on { background: var(--primary-container); color: var(--on-primary-container); font-weight: 700; }
.toc a.on .n { color: inherit; }

.doc { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.sec { background: var(--surface); border: 1px solid var(--outline-variant); border-radius: var(--radius); padding: 26px 30px 24px; box-shadow: var(--shadow); }
.sec h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; font-size: 22px; line-height: 1.4; }
.sec h2 .num { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface-highest); }
.sec h2 .num img { width: 30px; height: 30px; }
.sec h2 small { display: block; font-size: 12px; font-weight: 800; color: var(--primary); letter-spacing: 2px; }
.sec h3 { margin: 20px 0 6px; font-size: 17px; }
.sec p { margin: 8px 0; }
.sec ul, .sec ol { margin: 8px 0; padding-left: 1.4em; }
.sec li { margin: 4px 0; }
.sec li::marker { color: var(--primary); }
.path { display: inline-block; background: var(--surface-high); border: 1px solid var(--outline-variant); border-radius: 8px; padding: 0 8px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.note { display: flex; gap: 12px; align-items: flex-start; background: var(--tertiary-container); border-radius: var(--radius-s); padding: 12px 16px; margin: 14px 0 6px; }
.note img { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.note p { margin: 0; }
.table-wrap { overflow-x: auto; margin: 12px 0 4px; border: 1px solid var(--outline-variant); border-radius: var(--radius-s); }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.6; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--outline-variant); }
th { background: var(--surface-high); font-size: 14px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 700; min-width: 150px; }
.steps { counter-reset: s; list-style: none; padding-left: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-left: 40px; margin: 10px 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.box { background: var(--surface-high); border-radius: var(--radius-s); padding: 14px 18px; }
.box h3 { margin-top: 0; }
.mail { font-weight: 800; }

/* ---- 頁尾 ---- */
footer { border-top: 1px solid var(--outline-variant); background: var(--surface-high); }
footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 22px; padding-bottom: 30px; font-size: 14px; color: var(--muted); }
footer .brand { color: var(--on-bg); font-size: 15px; }
footer .brand img { width: 32px; height: 32px; border-radius: 9px; box-shadow: none; }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.to-top { position: fixed; right: 18px; bottom: 18px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); font-size: 20px; cursor: pointer; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: 1; pointer-events: auto; }

/* ---- 手機 ---- */
@media (max-width: 920px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .layout { grid-template-columns: 1fr; gap: 18px; margin-top: 24px; }
  .toc { position: static; max-height: none; }
  .toc summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding-bottom: 2px; }
  .toc summary::after { content: "▾"; color: var(--primary); }
  .toc[open] summary { padding-bottom: 8px; }
  .toc[open] summary::after { content: "▴"; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .hero .wrap { padding-bottom: 48px; }
  .brand span { display: none; }
  .switch-doc a { padding: 6px 10px; font-size: 13px; }
  .hero-body { margin-top: 36px; }
  .islander { width: 76px; position: absolute; right: 12px; bottom: 44px; opacity: .9; }
  .lead { font-size: 16px; padding-right: 64px; }
  .summary { grid-template-columns: 1fr; gap: 10px; }
  .tile { display: grid; grid-template-columns: 36px 1fr; gap: 0 12px; align-items: center; padding: 14px 16px; }
  .tile img { grid-row: span 2; }
  .tile h3 { margin: 0; }
  .sec { padding: 20px 18px; border-radius: 20px; }
  .sec h2 { font-size: 19px; }
  .cols { grid-template-columns: 1fr; }
  .table-wrap { border: 0; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { border: 1px solid var(--outline-variant); border-radius: var(--radius-s); margin-bottom: 10px; overflow: hidden; }
  td { border-bottom: 0; padding: 4px 14px; }
  td:first-child { min-width: 0; background: var(--surface-high); padding: 10px 14px; }
  td:not(:first-child)::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--primary); margin-top: 6px; }
  td:last-child { padding-bottom: 12px; }
}

/* ---- 列印 ---- */
@media print {
  .hero { background: none; color: #000; }
  .hero::before, .islander, .topbar .icon-btn, .switch-doc, .toc, .to-top, .summary { display: none !important; }
  .hero .wrap { padding: 0; }
  .lead, .meta span { color: #000; border-color: #999; }
  .layout { display: block; margin: 12px 0; }
  .sec { box-shadow: none; border: 0; padding: 8px 0; break-inside: auto; }
  body { background: #fff; color: #000; font-size: 12pt; }
}
