/* 中外对照 · 年份大事记
   Mobile-first design system. The current dynasty's colour drives --dyn, which tints the app bar,
   the card spines and the accents, so the whole page shifts era as you scrub through 2200 years. */

:root {
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --cn: #c2452f;
  --wd: #3f86c4;
  --gold: #c9a227;
  --dyn: var(--cn);

  --r-lg: 16px;
  --r: 12px;
  --r-sm: 8px;
  --bar-h: 0px;

  --dur: .18s;
}

html[data-theme="dark"] {
  --bg: #0d0f13;
  --surface: #16191f;
  --surface-2: #1c2027;
  --line: #262b33;
  --line-soft: #1f242b;
  --text: #eceae5;
  --dim: #a3aab4;
  --faint: #757d88;
  --glass: rgba(13,15,19,.86);
}
html[data-theme="light"] {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --line: #e4dfd5;
  --line-soft: #efebe3;
  --text: #191b1f;
  --dim: #5a636e;
  --faint: #8a929c;
  --glass: rgba(246,244,239,.88);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; margin: 0; }
a { color: var(--wd); }
button { font: inherit; color: inherit; }
.tabular { font-variant-numeric: tabular-nums; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: .5rem; top: .5rem; z-index: 200; background: var(--surface); padding: .5rem .8rem; border-radius: var(--r-sm); }

/* ============ app bar ============ */
.app-bar {
  position: sticky; top: 0; z-index: 60;
  background: var(--glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.bar-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .9rem .4rem; }
.bar-brand { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.seal {
  font-family: var(--serif); font-size: .74rem; letter-spacing: .22em; padding: .16rem .4rem .16rem .5rem;
  border: 1px solid var(--dyn); color: var(--dyn); border-radius: var(--r-sm); transition: color var(--dur), border-color var(--dur);
}
.bar-title { font-family: var(--serif); font-size: 1.06rem; }
.bar-sub { font-size: .74rem; color: var(--faint); }
.bar-actions { display: flex; gap: .3rem; }

.icon-btn {
  width: 2.4rem; height: 2.4rem; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 50%;
  cursor: pointer; font-size: .82rem; color: var(--dim);
  transition: border-color var(--dur), color var(--dur), transform var(--dur);
}
.icon-btn:hover { border-color: var(--dyn); color: var(--dyn); }
.icon-btn:active { transform: scale(.94); }

/* ---- search ---- */
.search-row { padding: 0 .9rem .5rem; }
.searchbox { position: relative; }
.search-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.searchbox input {
  width: 100%; padding: .62rem .9rem .62rem 2rem; font-size: .95rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--text);
}
.searchbox input:focus { outline: none; border-color: var(--dyn); }
.search-results {
  position: absolute; z-index: 80; top: calc(100% + .35rem); left: 0; right: 0;
  max-height: 60vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 40px rgba(0,0,0,.3);
}
.search-hit {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--line-soft); padding: .6rem .8rem; cursor: pointer;
}
.search-hit:hover { background: var(--surface-2); }
.search-hit .hit-top { display: flex; gap: .5rem; align-items: baseline; font-size: .74rem; color: var(--faint); margin-bottom: .15rem; }
.search-hit .hit-year { font-family: var(--serif); color: var(--dyn); font-size: .95rem; }
.search-hit .hit-text { font-size: .9rem; line-height: 1.6; }
.search-hit mark { background: color-mix(in srgb, var(--gold) 30%, transparent); color: inherit; border-radius: 3px; }
.search-empty { padding: .8rem; color: var(--faint); font-size: .85rem; }

/* ---- the master navigator: 2249 years, always on screen ---- */
.nav-strip { padding: 0 .6rem .5rem; }
.overview {
  display: block; width: 100%; height: 62px; border: 1px solid var(--line);
  border-radius: var(--r); cursor: pointer; touch-action: none;
}
.crumbs-row { display: flex; align-items: center; gap: .25rem; margin-top: .4rem; }
.crumb-arrow {
  flex: 0 0 auto; width: 1.9rem; height: 1.9rem; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 50%;
  cursor: pointer; color: var(--dim); font-size: 1rem; line-height: 1;
}
.crumb-arrow:hover { border-color: var(--dyn); color: var(--dyn); }
.crumbs {
  flex: 1 1 auto; display: flex; align-items: center; gap: .1rem; overflow-x: auto;
  scrollbar-width: none; font-size: .82rem; white-space: nowrap;
}
.crumbs::-webkit-scrollbar { display: none; }
.crumb {
  background: none; border: 0; padding: .12rem .35rem; border-radius: var(--r-sm);
  cursor: pointer; color: var(--faint);
}
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.on { color: var(--dyn); font-family: var(--serif); font-size: .95rem; }
.crumb-sep { color: var(--line); user-select: none; }
.crumb-hint { color: var(--faint); font-size: .74rem; margin-left: auto; padding-right: .3rem; }

.year-strip-wrap { display: flex; align-items: center; gap: .3rem; padding: 0 .5rem .55rem; }
.strip-arrow {
  flex: 0 0 auto; width: 2rem; height: 2rem; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; color: var(--dim);
}
.strip-arrow:hover { border-color: var(--dyn); color: var(--dyn); }
.year-strip { flex: 1 1 auto; display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.year-strip::-webkit-scrollbar { display: none; }
.y-chip {
  flex: 0 0 auto; min-width: 3.6rem; padding: .34rem .6rem; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--serif); font-size: .9rem; color: var(--dim); cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.y-chip:hover { color: var(--text); }
.y-chip.on { background: var(--dyn); border-color: var(--dyn); color: #fff; font-size: .98rem; }
.y-chip.dense::after { content: ""; display: block; height: 2px; margin: .18rem auto 0; width: 60%; background: currentColor; opacity: .45; border-radius: 2px; }

/* ============ stage ============ */
.stage { padding: 0 0 6.4rem; min-height: 60vh; }
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 1100px) { .wrap { max-width: 60rem; padding: 0 1.5rem; } }

/* hero */
.hero { position: relative; margin: .9rem 0 0; }
.hero-img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  background: var(--surface-2); border-radius: var(--r-lg);
}
.hero-cap {
  position: absolute; left: .7rem; right: .7rem; bottom: .7rem;
  padding: .5rem .7rem; border-radius: var(--r);
  background: rgba(10,12,16,.62); backdrop-filter: blur(6px);
  color: #fff; font-size: .74rem; line-height: 1.5;
}
.hero-cap b { display: block; font-weight: 500; font-size: .8rem; }
.hero-cap span { opacity: .78; }

/* year head */
.year-head { margin: 1.1rem 0 .2rem; }
.year-num {
  font-family: var(--serif); font-size: 3.4rem; line-height: 1; color: var(--dyn);
  display: flex; align-items: baseline; gap: .3rem;
}
.year-num em { font-style: normal; font-size: 1.1rem; color: var(--dim); font-family: var(--sans); }
.year-meta-line { display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: center; margin-top: .5rem; font-size: .8rem; color: var(--dim); }
.dy-chip {
  font-family: var(--serif); font-size: .92rem; letter-spacing: .06em;
  border: 1px solid var(--dyn); color: var(--dyn); border-radius: var(--r-sm); padding: .08rem .5rem;
}
.ganzhi { font-family: var(--serif); color: var(--text); font-size: .95rem; }
.era-text { font-size: .82rem; color: var(--dim); line-height: 1.6; }
.band-note { font-size: .84rem; color: var(--faint); margin: .45rem 0 0; line-height: 1.65; }
.sparse { color: var(--gold); }

/* sections */
.sect { margin-top: 1.5rem; }
.sect-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.sect-head h3 { font-size: 1.05rem; letter-spacing: .04em; }
.sect-head .bar { flex: 1 1 auto; height: 1px; background: var(--line); }
.sect-head .n { font-size: .78rem; color: var(--faint); font-family: var(--mono); }
.sect.cn .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cn); }
.sect.wd .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--wd); }

.cardlist { display: flex; flex-direction: column; gap: .6rem; }
@media (min-width: 1100px) { .cardlist.two { display: grid; grid-template-columns: 1fr 1fr; align-items: start; } }

/* event card */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: .75rem .85rem .8rem; border-left: 3px solid var(--line);
  cursor: pointer; transition: transform var(--dur), border-color var(--dur), box-shadow var(--dur);
}
.card:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.16); }
.card.cn { border-left-color: var(--cn); }
.card.wd { border-left-color: var(--wd); }
.card-top { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .3rem; }
.date-chip {
  font-family: var(--mono); font-size: .72rem; padding: .1rem .42rem;
  border: 1px solid var(--line); border-radius: 999px; color: var(--dim); background: var(--surface-2);
}
.date-chip.unknown { font-style: italic; color: var(--faint); }
.badge {
  font-size: .68rem; padding: .08rem .45rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--faint); white-space: nowrap;
}
.badge.en { border-color: var(--wd); color: var(--wd); }
.badge.why { border-color: var(--dyn); color: var(--dyn); }
.badge.watch { border-color: var(--gold); color: var(--gold); }
.badge.weak { border-style: dashed; }
/* 左图右史: an event's topic illustration sits beside its text */
.card-row { display: grid; grid-template-columns: 5.6rem minmax(0,1fr); gap: .65rem; align-items: start; }
.card-thumb { margin: 0; }
.card-thumb img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2);
}
.card-thumb figcaption { font-size: .6rem; color: var(--faint); line-height: 1.35; margin-top: .25rem; }
.card-text { margin: 0; font-size: .96rem; line-height: 1.75; }

/* gallery filter (数字文物库 style: filter the wall of images) */
.gal-filter {
  width: 100%; margin: .6rem 0 .2rem; padding: .5rem .8rem; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--text);
}
.gal-filter:focus { outline: none; border-color: var(--dyn); }
.gitem:hover { border-color: var(--dyn); }
.card-text .lnk { border-bottom: 1px dotted var(--faint); cursor: pointer; }
.card-text .lnk:hover { color: var(--dyn); border-bottom-color: var(--dyn); }
.card-actions { display: flex; gap: .35rem; margin-top: .5rem; flex-wrap: wrap; }
.mini {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  font-size: .72rem; padding: .1rem .5rem; cursor: pointer; color: var(--faint);
}
.mini:hover { border-color: var(--dyn); color: var(--dyn); }

.more-btn {
  align-self: center; margin: .2rem auto .4rem; padding: .4rem 1rem;
  background: none; border: 1px dashed var(--line); border-radius: 999px;
  font-size: .8rem; color: var(--dim); cursor: pointer;
}
.more-btn:hover { border-color: var(--dyn); color: var(--dyn); }

/* notes */
.policy-banner, .col-note {
  border: 1px solid var(--dyn); border-left-width: 4px; border-radius: var(--r);
  background: color-mix(in srgb, var(--dyn) 9%, transparent);
  padding: .7rem .85rem; font-size: .87rem; color: var(--dim); line-height: 1.7;
}
.policy-banner h4 { font-size: .95rem; color: var(--text); margin-bottom: .25rem; }
.policy-banner .muted { color: var(--faint); font-size: .82rem; margin-top: .3rem; }
.empty-year {
  text-align: center; color: var(--faint); padding: 2.5rem 1rem;
  border: 1px dashed var(--line); border-radius: var(--r-lg);
}

/* people + prizes */
.people-block, .prize-block { margin-top: 1.6rem; }
.people-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; margin-bottom: .7rem; }
.people-head h3 { font-size: 1.05rem; }
.people-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .45rem; }
.people-label { font-size: .76rem; color: var(--faint); align-self: center; min-width: 2.6rem; }
.people-label.b { color: var(--wd); }
.people-label.d { color: var(--cn); }
.people-label.p { color: var(--gold); }
.people-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.person-chip {
  display: inline-flex; align-items: baseline; gap: .3rem; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: .26rem .7rem; font-size: .86rem; cursor: pointer; color: var(--dim);
}
.person-chip:hover { border-color: var(--dyn); color: var(--text); }
.person-chip b { color: var(--text); font-weight: 500; }
.person-desc { font-size: .76rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem; }

/* ============ 长卷 view ============ */
.ribbon-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .8rem; margin-top: 1rem; }
.ribbon { display: block; width: 100%; height: 150px; cursor: ew-resize; touch-action: none; }
.ribbon-legend { display: flex; flex-wrap: wrap; gap: .4rem .8rem; margin-top: .6rem; font-size: .76rem; color: var(--faint); }
.ribbon-legend b { color: var(--text); font-weight: 500; }
.ribbon-tip { margin-top: .5rem; font-size: .8rem; color: var(--dim); }
.jump-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.jump {
  padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); font-size: .8rem; color: var(--dim); cursor: pointer;
}
.jump:hover { border-color: var(--dyn); color: var(--dyn); }

/* ============ 事件流 view ============ */
.feed { display: flex; flex-direction: column; }
.fcard {
  position: relative; min-height: 92vh; display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden; border-bottom: 1px solid var(--line);
}
.fcard-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fcard::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(6,8,12,.15) 0%, rgba(6,8,12,.45) 45%, rgba(6,8,12,.9) 100%);
}
.fcard.cn { border-left: 4px solid var(--cn); }
.fcard.wd { border-left: 4px solid var(--wd); }
.fcard-body { position: relative; z-index: 2; padding: 1.2rem 1.1rem 2rem; color: #fff; max-width: 46rem; }
.fcard-kicker { display: flex; flex-wrap: wrap; gap: .4rem .55rem; align-items: center; font-size: .78rem; margin-bottom: .5rem; opacity: .92; }
.fcard-year { font-family: var(--serif); font-size: 1.5rem; line-height: 1; }
.fcard-side { padding: .06rem .45rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.4); font-size: .7rem; }
.fcard-side.cn { border-color: var(--cn); color: #ffd9cf; }
.fcard-side.wd { border-color: var(--wd); color: #cfe6ff; }
.fcard-text { margin: 0 0 .8rem; font-size: 1.06rem; line-height: 1.85; text-shadow: 0 1px 12px rgba(0,0,0,.5); }
.fcard-text .lnk { border-bottom: 1px dotted rgba(255,255,255,.55); }
.fcard-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.fcard-actions .mini { border-color: rgba(255,255,255,.45); color: #fff; }
.fcard-credit { font-size: .68rem; opacity: .7; }
.feed-end { padding: 3rem 1rem; text-align: center; color: var(--faint); }

/* ============ 长卷 view ============ */
.scroll-doc { padding: 0 0 4rem; }
.chapter { max-width: 62rem; margin: 0 auto; padding: 1.2rem 1rem 2.4rem; border-bottom: 1px solid var(--line); }
.chapter-hero { position: relative; margin: 0 0 1rem; }
.chapter-hero img { display: block; width: 100%; aspect-ratio: 21 / 9; object-fit: cover; border-radius: var(--r-lg); background: var(--surface-2); }
.chapter-dual { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
@media (min-width: 1100px) { .chapter-dual { grid-template-columns: 1fr 1fr; align-items: start; } }
@media (max-width: 700px) { .chapter-hero img { aspect-ratio: 16 / 10; } }
.doc-anchor { height: 1px; }

/* ============ 时间场 view ============ */
.field-wrap { padding-top: .6rem; }
.field-head { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; margin-bottom: .5rem; }
.field-year { font-family: var(--serif); font-size: 2.6rem; line-height: 1; color: var(--dyn); }
.field-sub { font-size: .82rem; color: var(--dim); }
.field-frame { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.field-canvas { display: block; width: 100%; height: 52vh; min-height: 300px; touch-action: none; cursor: grab; }
.field-canvas:active { cursor: grabbing; }
.field-tip {
  position: absolute; z-index: 3; pointer-events: none; max-width: 18rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .35rem .55rem; font-size: .78rem; line-height: 1.5; color: var(--dim);
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
.field-tip b { color: var(--text); }
.field-controls { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.field-legend { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .6rem; font-size: .78rem; color: var(--faint); align-items: center; }
.field-legend .sw { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .3rem; }
.field-legend .sw.cn { background: var(--cn); }
.field-legend .sw.wd { background: var(--wd); }
@media (max-width: 480px) { .field-canvas { height: 46vh; } .field-year { font-size: 2.1rem; } }

/* the brush: drag the window to travel, drag its ends to change how much time you see */
.brush {
  position: relative; height: 46px; margin-top: .55rem; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); touch-action: none;
}
.brush-win {
  position: absolute; top: 4px; bottom: 4px; min-width: 2.4rem;
  background: color-mix(in srgb, var(--dyn) 22%, transparent);
  border: 1px solid var(--dyn); border-radius: var(--r-sm);
  cursor: grab; display: flex; align-items: center; justify-content: space-between;
}
.brush-win:active { cursor: grabbing; }
.brush-win .bh {
  width: 24px; height: 100%; background: var(--dyn); border-radius: 4px; cursor: ew-resize;
  display: grid; place-items: center; flex: 0 0 auto;
}
.brush-win .bh::after { content: ""; width: 2px; height: 16px; background: rgba(255,255,255,.75); border-radius: 1px; }
.brush-win .bw-label {
  font-family: var(--mono); font-size: .7rem; color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; padding: 0 .2rem;
}

/* ============ 图说 view ============ */
.gallery { display: grid; grid-template-columns: 1fr; gap: .9rem; margin-top: 1rem; }
@media (min-width: 640px) { .gallery { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .gallery { grid-template-columns: 1fr 1fr 1fr; } }
.gitem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; cursor: pointer; }
.gitem img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.gitem-body { padding: .6rem .75rem .7rem; }
.gitem-body h4 { font-size: .95rem; margin-bottom: .15rem; }
.gitem-body .range { font-family: var(--mono); font-size: .74rem; color: var(--faint); }
.gitem-body p { margin: .35rem 0 0; font-size: .82rem; color: var(--dim); line-height: 1.65; }
.gitem-body .credit { font-size: .7rem; color: var(--faint); margin-top: .4rem; }

/* ============ stats view ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .6rem; margin-top: .8rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .7rem; }
.stat b { display: block; font-family: var(--mono); font-size: 1.25rem; color: var(--dyn); }
.stat span { font-size: .74rem; color: var(--faint); }
.disc h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; }
.disc ul { padding-left: 1.1rem; }
.disc li, .disc p { font-size: .86rem; color: var(--dim); line-height: 1.75; }
.disc code { font-family: var(--mono); font-size: .8rem; background: var(--surface-2); padding: 0 .25rem; border-radius: 4px; }
.note-warn, .note-info {
  border-left: 3px solid var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: .55rem .7rem; font-size: .86rem; line-height: 1.7; color: var(--dim);
}
.note-info { border-left-color: var(--wd); background: color-mix(in srgb, var(--wd) 10%, transparent); }
.raw-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .5rem .6rem; font-size: .82rem; }

/* ============ tab bar ============ */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--glass); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .5rem .2rem .55rem; background: none; border: 0; cursor: pointer;
  color: var(--faint); transition: color var(--dur);
}
.tab b { font-size: .84rem; font-weight: 500; }
.tab i { font-style: normal; font-size: .62rem; opacity: .8; }
.tab.on { color: var(--dyn); }
.tab.on b { font-weight: 600; }

/* ============ drawer / modal ============ */
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(34rem, 100vw); z-index: 90;
  background: var(--surface); border-left: 1px solid var(--line);
  overflow: auto; animation: slideIn .2s ease both;
}
@keyframes slideIn { from { transform: translateX(3%); opacity: .7; } to { transform: none; opacity: 1; } }
.drawer-inner { padding: 1rem 1.1rem calc(6rem + env(safe-area-inset-bottom)); }
.drawer-close, .modal-close {
  position: sticky; top: 0; float: right; width: 2rem; height: 2rem; z-index: 2;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
}
.detail-year { font-family: var(--serif); font-size: 1.7rem; color: var(--dyn); }
.detail-title { font-size: 1.02rem; line-height: 1.8; margin: .6rem 0 .8rem; }
.detail-block { border-top: 1px solid var(--line-soft); padding: .8rem 0; }
.detail-block h4 { font-size: .78rem; letter-spacing: .1em; color: var(--faint); margin-bottom: .4rem; }
.kv { display: grid; grid-template-columns: 5.5rem minmax(0,1fr); gap: .3rem .6rem; font-size: .86rem; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; word-break: break-word; }
.lnk-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.lnk-chip {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px;
  padding: .22rem .6rem; font-size: .82rem; background: var(--surface-2);
  color: var(--dim); cursor: pointer; text-decoration: none;
}
.lnk-chip:hover { border-color: var(--dyn); color: var(--dyn); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: .28rem .7rem; font-size: .8rem; cursor: pointer; color: var(--dim); }
.seg button.is-active { background: color-mix(in srgb, var(--dyn) 16%, transparent); color: var(--dyn); }

.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-panel { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); width: min(64rem, 100%); max-height: 88vh; overflow: auto; }
.modal-body { padding: 1.1rem 1.2rem 2rem; }
.modal-body h2 { font-size: 1.2rem; margin-bottom: .6rem; }
.cmp-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 800px) { .cmp-grid { grid-template-columns: 1fr 1fr; } }
.cmp-col h3 { font-family: var(--serif); font-size: 1.5rem; color: var(--dyn); }
.cmp-mini { font-size: .86rem; border-left: 2px solid var(--line); padding: .2rem .5rem; margin-bottom: .4rem; line-height: 1.6; }
.cmp-mini.cn { border-left-color: var(--cn); }
.cmp-mini.wd { border-left-color: var(--wd); }
.otd-item { display: grid; grid-template-columns: 4.5rem minmax(0,1fr); gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--line-soft); font-size: .9rem; line-height: 1.65; }
.otd-year { font-family: var(--serif); color: var(--dyn); cursor: pointer; }
.cmp-picker { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.cmp-picker input { width: 6.5rem; padding: .4rem .5rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text); }
.btn {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: .42rem .8rem; border-radius: 999px; cursor: pointer;
}
.btn:hover { border-color: var(--dyn); color: var(--dyn); }
.btn.small { padding: .28rem .65rem; font-size: .82rem; }

/* ============ boot / toast ============ */
.boot { position: fixed; inset: 0; z-index: 120; background: var(--bg); display: grid; place-items: center; }
.boot-card { text-align: center; max-width: 24rem; padding: 2rem; }
.boot-spinner {
  width: 2.4rem; height: 2.4rem; margin: 0 auto 1rem; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--dyn); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-msg { color: var(--faint); font-size: .85rem; }
.boot-actions { margin-top: 1rem; }
.boot-hint { margin-top: .8rem; font-size: .8rem; }
.boot-bar { height: 3px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 1rem; }
.boot-bar-fill { height: 100%; width: 0; background: var(--dyn); transition: width .2s; }
.toast {
  position: fixed; left: 50%; bottom: calc(5rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 110; background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: .5rem 1rem; font-size: .85rem; box-shadow: 0 12px 30px rgba(0,0,0,.3); max-width: 90vw; text-align: center;
}

/* first-run hint */
.firstrun {
  display: flex; align-items: center; gap: .6rem; justify-content: center; flex-wrap: wrap;
  margin: .8rem 1rem 0; padding: .5rem .8rem;
  border: 1px dashed var(--dyn); border-radius: var(--r); background: color-mix(in srgb, var(--dyn) 8%, transparent);
  font-size: .8rem; color: var(--dim);
}
.firstrun b { color: var(--text); }
.firstrun button { background: none; border: 0; color: var(--dyn); cursor: pointer; font-size: .8rem; }

.local-notice { max-width: 44rem; margin: .8rem auto 0; padding: 0 1rem; }
.local-notice .inner {
  border: 1px dashed var(--line); border-radius: var(--r); padding: .5rem .7rem;
  font-size: .78rem; color: var(--dim); line-height: 1.6;
}

/* ---- motion: the picture arrives with the year instead of blinking into place ---- */
@keyframes artIn { from { opacity: 0; transform: scale(1.015); } to { opacity: 1; transform: none; } }
.chapter-hero img, .gitem img, .card-thumb img, .hero-img, .fcard-img { animation: artIn .34s ease both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.chapter .card, .people-block, .prize-block { animation: riseIn .26s ease both; }
.gitem { transition: transform var(--dur), border-color var(--dur); }
.gitem:hover img { transform: scale(1.03); }
.gitem img { transition: transform .3s ease; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
