/* Base tokens: colors, fonts, sizing. Inherits palette from xinxuewiki.top brand. */
:root {
  --font-serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, monospace;

  /* 白天配色：旧纸千山绿——米皮底透一丝绿意，配金色点缀 */
  --bg: #eef0e6;
  --bg-elev: #f6f8ee;
  --bg-soft: #dfe3d1;
  --ink: #2a2f26;
  --ink-soft: #4a4f45;
  --muted: #737866;
  --border: #d5d9c7;
  --accent: #a86a08;
  --accent-soft: #c8850e;
  --link: #7a5605;
  --link-hover: #a86a08;
  --translation-tint: #52564a;

  --radius: 6px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.06);
  --shadow-2: 0 8px 24px rgba(0,0,0,.10);

  --size-base: 17px;
  --size-orig: 1.05rem;
  --size-trans: 0.98rem;
  --lh-orig: 1.9;
  --lh-trans: 1.75;
  --measure: 40rem;
}
html[data-size="s"] { --size-base: 15px; }
html[data-size="m"] { --size-base: 17px; }
html[data-size="l"] { --size-base: 19.5px; }

html[data-theme="dark"] {
  --bg: #17161a;
  --bg-elev: #22222a;
  --bg-soft: #1e1d24;
  --ink: #ece7de;
  --ink-soft: #c7c1b6;
  --muted: #948d81;
  --border: #34313a;
  --accent: #d4a017;
  --accent-soft: #e2b83a;
  --link: #d4a017;
  --link-hover: #e2b83a;
  --translation-tint: #b0aa9e;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  font-size: var(--size-base);
  -webkit-text-size-adjust: 100%; /* prevent iOS orientation font boosting */
}
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(168, 106, 8, 0.12); /* subtle gold tap flash */
  overflow-wrap: break-word;
  word-break: normal;
  line-break: strict; /* CJK-aware line breaking */
  overflow-x: clip; /* safety net: never allow horizontal scroll */
}
img { max-width: 100%; height: auto; }
::selection { background: rgba(168, 106, 8, 0.22); color: var(--ink); }

/* Inputs: force ≥16px on mobile to prevent iOS Safari zoom on focus */
input, select, textarea { font-family: inherit; color: inherit; }
@media (max-width: 640px) {
  input[type="search"], input[type="text"] { font-size: 16px !important; }
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-sans); color: var(--ink); font-weight: 600; }
h1 { font-size: 1.8rem; margin: 0 0 .5rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 .8rem; letter-spacing: 0.02em; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.crumbs { color: var(--muted); font-size: 0.88rem; margin-bottom: .5rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

.sub { color: var(--muted); font-size: 0.92rem; }

.badge {
  display: inline-block;
  margin-left: .5rem;
  padding: 1px 8px;
  font-size: 0.72rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
}
.badge-done { background: #e5f0e0; color: #3a6b2f; border-color: #cbe1c1; }
.badge-in_progress { background: #fff3d6; color: #8a6a10; border-color: #f0dea2; }
.badge-pending { background: var(--bg-soft); color: var(--muted); }

html[data-theme="dark"] .badge-done { background: #223027; color: #a5c99a; border-color: #34483a; }
html[data-theme="dark"] .badge-in_progress { background: #3a3020; color: #e2c268; border-color: #524129; }
