/* China Handbook — Mobiverse VI: paper, ink, quiet old gold. Light only, system fonts. */
:root {
  --paper: #fbfaf7;
  --cloud: #f3efe7;
  --ink: #111316;
  --muted: #5f6672;
  --line: rgba(17, 19, 22, 0.12);
  --gold: #b9935a;
  --gold-soft: rgba(185, 147, 90, 0.14);
  --mobi: #4e5963;
  --toro: #b88a63;
  --alert: #b8795f;
  --alert-soft: rgba(184, 121, 95, 0.12);
  --radius: 14px;
  --serif: Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --zh: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --tabbar-h: 62px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 7vw, 40px); margin: 0 0 12px; }
h2 { font-size: 22px; margin: 32px 0 10px; }
h3 { font-size: 18px; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.center { text-align: center; }
.round { border-radius: 50%; margin: 0 auto 16px; }
.lead { font-size: 18px; color: #2a2e34; }
.eyebrow { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 8px; }
.ic { width: 22px; height: 22px; flex: none; }
.ic.sm { width: 18px; height: 18px; vertical-align: -3px; }
.ic.xs { width: 14px; height: 14px; vertical-align: -2px; opacity: 0.6; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

main, .foot { max-width: 720px; margin: 0 auto; padding: 0 16px; }
main { padding-top: 8px; min-height: 60vh; }

/* Header + tab bar */
.draft-bar { background: var(--gold); color: #fff; font-size: 13px; text-align: center; padding: 6px 16px; }
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 720px; margin: 0 auto; padding: 10px 16px;
  background: rgba(251, 250, 247, 0.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; }
.brand img { border-radius: 50%; border: 1.5px solid var(--gold); }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-family: var(--serif); font-size: 17px; }
.brand small { font-size: 12px; color: var(--muted); }
.top-search { padding: 8px; margin-right: -8px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: rgba(251, 250, 247, 0.97); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; max-width: 144px; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; text-decoration: none; color: var(--muted);
}
.tabbar a.on { color: var(--ink); }
.tabbar a.on .ic { color: var(--gold); }
.tabbar a.sos { color: var(--alert); font-weight: 600; }
.card-page .tabbar, .card-page .top { display: none; }
.card-page { padding-bottom: 0; }

/* Footer */
.foot { font-size: 13px; color: var(--muted); padding-top: 40px; padding-bottom: 24px; border-top: 1px solid var(--line); margin-top: 48px; }
.offline-status { color: var(--ink); }
.offline-status .ic { color: var(--gold); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  min-height: 46px; padding: 0 20px; border-radius: 999px;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  font: 600 16px var(--sans); text-decoration: none; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.link { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; padding: 8px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.icon-btn[disabled] { opacity: 0.35; cursor: default; }
.icon-btn.playing { border-color: var(--gold); color: var(--gold); }

/* Home */
.hero { display: grid; gap: 20px; padding: 16px 0 8px; }
.hero-guides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 300px; }
.hero-guides img { border-radius: var(--radius); width: 100%; aspect-ratio: 470 / 820; object-fit: cover; object-position: center bottom; background: var(--cloud); }
@media (min-width: 640px) {
  .hero { grid-template-columns: 300px 1fr; align-items: center; }
}
.stages { margin-top: 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stage-tabs { display: flex; gap: 6px; background: var(--cloud); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.stage-tabs button {
  flex: 1; border: 0; border-radius: 999px; padding: 9px 6px; background: transparent;
  font: 600 14px var(--sans); color: var(--muted); cursor: pointer; white-space: nowrap;
}
.stage-tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(17, 19, 22, 0.1); }
.stage-list { list-style: none; padding: 0; margin: 0; }
.stage-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); text-decoration: none; }
.stage-list li:first-child a { border-top: 0; }
.stage-list .ic { color: var(--gold); }
.install { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 16px; padding: 16px; border-radius: var(--radius); background: var(--gold-soft); }
.install > div { flex: 1 1 240px; }
.install p { margin: 4px 0 0; font-size: 15px; }
.section-title { font-size: 20px; margin-top: 36px; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.chapter-card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
}
.chapter-card .num { font-family: var(--serif); color: var(--gold); font-size: 15px; }
.chapter-card b { font-family: var(--serif); font-size: 19px; }
.chapter-card .muted { font-size: 14px; line-height: 1.45; }
.quick { display: grid; gap: 10px; margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.quick-card { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--cloud); text-decoration: none; }
.quick-card span { display: flex; flex-direction: column; }
.quick-card small { color: var(--muted); font-size: 14px; }
.quick-card.sos { background: var(--alert-soft); border-color: rgba(184, 121, 95, 0.35); }
.quick-card.sos .ic { color: var(--alert); }

/* Chapter + lists */
.crumbs { font-size: 14px; color: var(--muted); margin: 8px 0 16px; }
.crumbs a { color: var(--muted); }
.chapter-head { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 20px; }
.chapter-head > div { flex: 1; }
.chapter-guide { width: 96px; border-radius: 12px; background: var(--cloud); }
.section-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.section-list a { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-decoration: none; }
.section-list .idx { font-family: var(--serif); color: var(--gold); min-width: 18px; }
.section-list .body { display: flex; flex-direction: column; gap: 2px; }
.section-list .body .muted { font-size: 15px; line-height: 1.45; }
.section-list .when { font-size: 12px; color: var(--muted); margin-top: 4px; }
.section-list.compact a { padding: 12px 14px; }

/* Section */
.checked { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.checked .ic { color: var(--gold); }
.stale { background: var(--alert-soft); border-left: 3px solid var(--alert); padding: 10px 14px; border-radius: 8px; font-size: 15px; }
.walkthrough {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 20px 0; padding: 18px; border-radius: var(--radius);
  background: var(--ink); color: var(--paper); text-decoration: none;
}
.walkthrough span { display: flex; flex-direction: column; }
.walkthrough small { opacity: 0.75; font-size: 14px; }
.walkthrough .ic { color: var(--gold); }
.walkthrough.soon { display: block; background: var(--cloud); color: var(--ink); border: 1px dashed var(--gold); }
.walkthrough.soon b, .walkthrough.soon small { display: block; }
.walkthrough.soon small { color: var(--muted); margin-top: 4px; opacity: 1; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose li.task { list-style: none; margin-left: -22px; }
.prose li.task label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.prose li.task input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--gold); flex: none; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 12px 0 18px; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 600; background: var(--cloud); }
.prose blockquote { margin: 16px 0; padding: 10px 16px; border-left: 3px solid var(--gold); background: var(--gold-soft); border-radius: 0 8px 8px 0; }
.prose code { font-size: 0.92em; background: var(--cloud); padding: 1px 5px; border-radius: 4px; }
.tip { display: flex; gap: 12px; align-items: flex-start; margin: 18px 0; padding: 14px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.tip img { border-radius: 50%; border: 1.5px solid var(--gold); flex: none; }
.tip-who { font-size: 13px; font-weight: 700; margin: 0 0 2px; letter-spacing: 0.02em; }
.tip-mobi .tip-who { color: var(--mobi); }
.tip-toro .tip-who { color: var(--toro); }
.tip-text { font-size: 16px; }
.sources { margin-top: 32px; padding-top: 4px; border-top: 1px solid var(--line); }
.sources h2 { font-size: 17px; font-family: var(--sans); margin-top: 20px; }
.sources ul { padding-left: 18px; font-size: 15px; }
.sources li { margin-bottom: 6px; }
.feedback { margin-top: 20px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 32px; }
.pager a { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font-size: 15px; }
.pager a span { display: flex; flex-direction: column; }
.pager small { color: var(--muted); font-size: 12px; }
.pager .next { justify-content: flex-end; text-align: right; }

/* Steps */
.progress { height: 4px; background: var(--cloud); border-radius: 4px; overflow: hidden; margin-bottom: 16px; }
.progress span { display: block; height: 100%; background: var(--gold); }
.step figure { margin: 0 0 16px; }
.shot { width: 100%; max-width: 360px; margin: 0 auto; border-radius: 18px; border: 1px solid var(--line); background: #fff; }
.shot-missing { aspect-ratio: 9 / 16; max-height: 52vh; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; border: 1.5px dashed var(--gold); background: var(--cloud); }
.step-text { font-size: 18px; }
.draft-note { font-size: 13px; color: #fff; background: var(--gold); padding: 6px 10px; border-radius: 8px; }
.step-nav { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 24px; }

/* Phrases */
.page-head { margin-bottom: 8px; }
.phrase-group h2 { font-size: 20px; }
.phrases { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.phrase { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.phrase-text { display: flex; flex-direction: column; min-width: 0; }
.phrase .en { font-size: 14px; color: var(--muted); }
.phrase .zh { font-family: var(--zh); font-size: 22px; line-height: 1.35; }
.phrase .py { font-size: 15px; color: var(--mobi); }
.phrase-actions { display: flex; gap: 6px; flex: none; }

/* Show cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card-tile { display: flex; flex-direction: column; gap: 6px; padding: 14px; min-height: 96px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-decoration: none; }
.card-tile b { font-size: 15px; }
.card-tile span[lang] { font-family: var(--zh); font-size: 18px; }
.card-page main { padding-top: 0; }
.card-page .crumbs { margin-top: 16px; }
.show-card {
  min-height: 62vh; display: flex; flex-direction: column; justify-content: center; gap: 20px;
  padding: 28px 20px; border-radius: 20px; background: #fff; border: 2px solid var(--gold);
}
.show-zh { font-family: var(--zh); font-size: clamp(34px, 10vw, 64px); line-height: 1.3; font-weight: 600; margin: 0; }
.show-address { font-family: var(--zh); font-size: clamp(30px, 9vw, 52px); line-height: 1.4; margin: 0; white-space: pre-wrap; word-break: break-all; }
.show-address:empty::before { content: "No address saved yet — add it below."; font: 16px var(--sans); color: var(--muted); }
.show-lead { font-family: var(--zh); font-size: clamp(24px, 7vw, 36px); font-weight: 600; margin: 0; }
.show-en { color: var(--muted); font-size: 16px; margin: 0; }
.address-edit { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 12px; }
.address-edit summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.address-form { display: grid; gap: 8px; margin-top: 8px; font-size: 15px; }
.address-form textarea, .address-form input, .search-form input {
  width: 100%; font: 18px var(--sans); padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.address-form .row { display: flex; gap: 10px; }
.card-page .center { margin-top: 20px; }
:fullscreen .show-card, .show-card:fullscreen { border: 0; border-radius: 0; min-height: 100vh; }

/* Full-screen overlay for phrases */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--paper);
  display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 32px 24px;
}
.overlay .show-zh { font-size: clamp(40px, 13vw, 88px); }
.overlay .py { font-size: 20px; color: var(--mobi); }
.overlay .close { position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px; }

/* SOS */
.sos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sos-call { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius); background: var(--alert-soft); border: 1px solid rgba(184, 121, 95, 0.35); text-decoration: none; }
.sos-call .ic { color: var(--alert); margin-top: 6px; }
.sos-call > span { display: flex; flex-direction: column; }
.sos-call b { font-size: 30px; font-family: var(--serif); line-height: 1.1; }
.sos-call small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.sos-call.wide { margin-top: 10px; background: #fff; border-color: var(--line); }
.sos-call.wide b { font-size: 24px; }
.sos-call.wide .ic { color: var(--muted); }

/* Search */
.search-form input { font-size: 18px; }
.search-hint { font-size: 14px; }
.search-empty { padding: 16px; color: var(--muted); }
.section-list .chap { font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; }
