/* 字源 · 字形演變 —— 承 chinese.org 的墨底暖字，另加紀元色階 */
:root {
  --ink: #0b0b0a;
  --ink-soft: #161714;
  --ink-card: #1b1c19;
  --paper: #f1eee6;
  --coral: #e36a4c;
  --gold: #c39a54;
  --jade: #7fd8b8;
  --blue: #7ab8ff;
  --muted: rgba(241, 238, 230, .52);
  --faint: rgba(241, 238, 230, .32);
  --line: rgba(241, 238, 230, .14);
  --line-soft: rgba(241, 238, 230, .07);

  /* 紀元色階，取自本站既有配色，不另起一套：
     甲骨用金（骨與卜辭）、金文用玉（青銅綠鏽）、小篆用朱、六書通用藍、楷書用紙白。 */
  --e-oracle: #c39a54;
  --e-bronze: #7fd8b8;
  --e-seal:   #e36a4c;
  --e-lst:    #7ab8ff;
  --e-kai:    #f1eee6;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(195,154,84,.10), transparent 28rem),
    radial-gradient(circle at 90% 18%, rgba(127,216,184,.07), transparent 25rem),
    radial-gradient(circle at 48% 88%, rgba(227,106,76,.055), transparent 32rem),
    var(--ink);
  background-attachment: fixed;
  color: var(--paper);
  /* HanRare 是生僻部件字子集（花園明朝所裁），帶 unicode-range，
     只對擴展 A/B/C 那些碼位生效，常用字照舊走本站正文字體。 */
  font-family: "HanRare", "Songti TC", "Songti SC", "Noto Serif TC", STSong, serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }

html.jic-gated body { overflow: hidden; }
#jicGate { position: fixed; inset: 0; z-index: 999; background: var(--ink); display: flex; align-items: center; justify-content: center; padding: 20px; }
#jicGate[hidden] { display: none; }
.jic-gate-card { max-width: 410px; text-align: center; background: var(--ink-card); border: 1px solid var(--line); border-radius: 18px; padding: 38px 30px; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.jic-gate-card img { width: 52px; height: 52px; filter: invert(1); margin-bottom: 14px; }
.jic-gate-card h2 { margin: 0 0 10px; color: var(--paper); font-size: 21px; }
.jic-gate-card p { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.jic-gate-btn { border: 0; border-radius: 12px; padding: 13px 30px; background: var(--gold); color: var(--ink); font-weight: 800; cursor: pointer; }
.jic-gate-card .jic-gate-note { margin: 16px 0 0; font-size: 12px; color: var(--faint); }

/* ── 頂欄（與全站一致） ── */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(11, 11, 10, .92);
  backdrop-filter: saturate(1.3) blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.bar-brand { display: flex; align-items: center; gap: 8px; color: var(--paper); text-decoration: none; }
.bar-brand:hover { text-decoration: none; }
.bar-brand img { width: 24px; height: 24px; filter: invert(1); }
.bar-brand strong { font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.bar-title {
  flex: 1; margin: 0; font-size: 15px; font-weight: 700;
  color: var(--gold); letter-spacing: .08em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.bar-tools { display: flex; align-items: center; gap: 7px; }
#q {
  width: 168px; padding: 6px 13px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--ink-soft); color: var(--paper); font-size: 13.5px;
  transition: border-color .16s, box-shadow .16s;
}
#q::placeholder { color: var(--faint); }
#q:focus {
  outline: none; border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(227, 106, 76, .16);
}
.tbtn {
  border: 1px solid var(--line); background: transparent;
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer;
  color: var(--muted); white-space: nowrap; transition: all .16s;
}
.tbtn:hover { border-color: var(--coral); color: var(--coral); }

/* 來源與授權聲明：站方保留版權，頁面上必須一直說清楚 */
.notice {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline;
  padding: 9px 16px; font-size: 12px; line-height: 1.65;
  color: var(--muted);
  background: rgba(195, 154, 84, .07);
  border-bottom: 1px solid var(--line-soft);
}
.notice b { color: var(--gold); font-weight: 700; letter-spacing: .05em; }

main { max-width: 1120px; margin: 0 auto; padding: 22px 16px 90px; }

/* ── 字表 ── */
.hero { text-align: center; padding: 24px 0 25px; position: relative; }
.hero::after {
  content: ""; display: block; width: min(360px, 62vw); height: 1px;
  margin: 21px auto 0;
  background: linear-gradient(90deg, transparent, var(--e-oracle), var(--e-bronze), var(--e-seal), var(--e-lst), transparent);
  opacity: .72;
}
.hero h1 { margin: 0 0 10px; font-size: 27px; font-weight: 700; letter-spacing: .12em; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }
.hero .nums { color: var(--gold); font-weight: 700; }
.hero .nums-forms { color: var(--coral); }
.hero .search-summary { margin-top: 7px; color: var(--paper); }

.controls {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 12px 0 15px; border-bottom: 1px solid var(--line-soft); margin-bottom: 18px;
}
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer;
  transition: all .16s;
}
.chip:hover { border-color: var(--faint); color: var(--paper); }
.chip[aria-pressed="true"] { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.chip .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; margin-right: 6px; vertical-align: 1px;
}
.chip.e-oracle .dot { color: var(--e-oracle); }
.chip.e-bronze .dot { color: var(--e-bronze); }
.chip.e-seal .dot { color: var(--e-seal); }
.chip.e-lst .dot { color: var(--e-lst); }
.chip.e-kai .dot { color: var(--e-kai); opacity: .55; }
.chip[aria-pressed="true"] .dot { box-shadow: 0 0 0 3px rgba(11,11,10,.12); }
.ctl-gap { flex: 1 1 auto; }
.ctl-lab { font-size: 12px; color: var(--faint); letter-spacing: .08em; }

.grid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px 11px;
  background: var(--ink-card); border: 1px solid var(--line-soft); border-radius: 12px;
  color: var(--paper); cursor: pointer; text-align: center;
  position: relative; overflow: hidden; --card-accent: var(--paper);
  transition: transform .18s cubic-bezier(.2,.7,.3,1), border-color .18s, background .18s, box-shadow .18s;
}
.cell::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 2px;
  background: var(--card-accent); opacity: .78;
}
.cell::after {
  content: ""; position: absolute; width: 94px; height: 94px; left: 50%; top: -60px;
  transform: translateX(-50%); border-radius: 50%; background: var(--card-accent);
  opacity: .055; filter: blur(20px); pointer-events: none;
}
.cell.e-oracle { --card-accent: var(--e-oracle); }
.cell.e-bronze { --card-accent: var(--e-bronze); }
.cell.e-seal { --card-accent: var(--e-seal); }
.cell.e-lst { --card-accent: var(--e-lst); }
.cell:hover {
  text-decoration: none; transform: translateY(-3px);
  border-color: var(--card-accent); background: #202120;
  box-shadow: 0 12px 28px rgba(0,0,0,.28), 0 0 24px color-mix(in srgb, var(--card-accent) 10%, transparent);
}
.cell .ink { height: 50px; display: flex; align-items: center; justify-content: center; color: var(--card-accent); }
.cell .ink svg { height: 100%; width: auto; max-width: 82px; display: block; }
.cell .kai { font-size: 20px; letter-spacing: .04em; }
.cell .kai .alt { font-size: 13px; color: var(--faint); }
.cell .py { font-size: 11px; color: var(--faint); font-family: Georgia, serif; }
.cell.none { border-style: dashed; }
.cell.none .ink { color: var(--faint); font-size: 11px; letter-spacing: .1em; }
.cell.none .ink::before {
  content: "無古形"; display: flex; align-items: center; justify-content: center;
  width: 50px; height: 42px; border: 1px dashed var(--line); border-radius: 6px;
}

/* 墨跡牆：只留字形。看的就是三千年裡一個字被寫過多少種樣子。 */
.wall { display: flex; flex-wrap: wrap; gap: 21px; justify-content: center; padding: 6px 0; }
.wall a {
  display: block; height: 58px; color: var(--paper);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), color .2s;
}
.wall a.e-oracle { color: var(--e-oracle); }
.wall a.e-bronze { color: var(--e-bronze); }
.wall a.e-seal { color: var(--e-seal); }
.wall a.e-lst { color: var(--e-lst); }
.wall a:hover { transform: scale(1.35) translateY(-3px); color: var(--gold); }
.wall svg { height: 100%; width: auto; display: block; }

.empty { text-align: center; color: var(--faint); padding: 56px 0; font-size: 14.5px; }

/* ── 單字 ── */
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.back:hover { color: var(--coral); text-decoration: none; }

.zhead { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.zhead .glyph-kai { font-size: 72px; line-height: 1; }
.zhead .zmeta { padding-bottom: 6px; }
.zhead .py-main { font-size: 22px; font-family: Georgia, serif; color: var(--gold); }
.zhead .orig { font-size: 14.5px; color: var(--muted); margin-top: 2px; }
.zhead .tags { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }

.sec-t { display: flex; align-items: baseline; gap: 10px; margin: 32px 0 14px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
.sec-t h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .16em; color: var(--gold); }
.sec-t .sub { font-size: 12px; color: var(--faint); font-family: Georgia, serif; }

/* 演變軸 */
.spine { overflow-x: auto; padding: 4px 0; }
.spine-row { display: flex; min-width: 620px; }
.node { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; position: relative; padding: 0 6px; }
/* 連接線穿過菱形節點那一行，不從字形中間橫穿——
   一條貫通的線才讀得出時間軸，壓在字形上只會像劃掉。 */
.node::before {
  content: ""; position: absolute; top: 108px; left: -50%; width: 100%;
  border-top: 1px solid var(--line); z-index: 0;
}
.node:first-child::before { display: none; }
.node .ink-box { height: 96px; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; padding: 0 10px; }
.node .ink-box svg { height: 82px; width: auto; max-width: 108px; display: block; }
.node .kai-box { font-size: 64px; line-height: 82px; }
.node .ink-box.void { color: var(--faint); font-size: 12.5px; letter-spacing: .1em; }
.node .pip {
  width: 9px; height: 9px; border-radius: 2px; transform: rotate(45deg);
  background: currentColor; margin: 8px 0 9px; position: relative; z-index: 1;
  box-shadow: 0 0 0 4px var(--ink);
}
.node .nm { font-size: 13.5px; font-weight: 700; letter-spacing: .1em; }
.node .dy { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.node .wh { font-size: 10.5px; color: var(--faint); font-family: Georgia, serif; }
.node .ct { font-size: 11px; color: var(--faint); margin-top: 4px; }
.node.on .ct { color: currentColor; }
.node.off { opacity: .38; }
.node.e-oracle { color: var(--e-oracle); }
.node.e-bronze { color: var(--e-bronze); }
.node.e-seal   { color: var(--e-seal); }
.node.e-lst    { color: var(--e-lst); }
.node.e-kai    { color: var(--e-kai); }
.node .dy, .node .wh { color: var(--faint); }

/* 釋文 */
.gloss {
  display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px;
  padding: 18px 20px; background: var(--ink-card);
  border: 1px solid var(--line-soft); border-radius: 14px;
}
.gloss dt { font-size: 12.5px; color: var(--faint); letter-spacing: .14em; white-space: nowrap; padding-top: 3px; }
.gloss dd { margin: 0; font-size: 14.5px; }
.gloss dd.sw {
  font-size: 17px; letter-spacing: .05em; line-height: 2;
  border-left: 2px solid var(--coral); padding-left: 14px;
}
.gloss dd.mono { white-space: pre-wrap; font-size: 13px; color: var(--muted); line-height: 1.8; }

/* 各紀元全部字形 */
.era-block { margin-top: 28px; }
.era-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.era-h .barline { width: 26px; height: 3px; border-radius: 2px; background: currentColor; }
.era-h h3 { margin: 0; font-size: 14.5px; font-weight: 700; letter-spacing: .12em; }
.era-h .n { font-size: 12px; color: var(--faint); font-family: Georgia, serif; }
.era-h.e-oracle { color: var(--e-oracle); }
.era-h.e-bronze { color: var(--e-bronze); }
.era-h.e-seal   { color: var(--e-seal); }
.era-h.e-lst    { color: var(--e-lst); }

.forms { display: flex; flex-wrap: wrap; gap: 9px; }
.form {
  width: 72px; height: 72px; display: flex; align-items: center; justify-content: center;
  background: var(--ink-card); border: 1px solid var(--line-soft); border-radius: 9px;
  color: var(--paper); position: relative;
  transition: transform .16s cubic-bezier(.2,.7,.3,1), border-color .16s, color .16s;
}
.form:hover { transform: translateY(-2px) scale(1.07); border-color: currentColor; z-index: 2; }
.form svg { max-height: 52px; max-width: 52px; height: auto; width: auto; display: block; }
.form .gid {
  position: absolute; bottom: 2px; left: 0; right: 0; text-align: center;
  font-size: 8.5px; font-family: Georgia, serif; color: var(--faint);
  opacity: 0; transition: opacity .16s; pointer-events: none;
}
.form:hover .gid { opacity: 1; }
.era-block.e-oracle .form:hover { color: var(--e-oracle); }
.era-block.e-bronze .form:hover { color: var(--e-bronze); }
.era-block.e-seal   .form:hover { color: var(--e-seal); }
.era-block.e-lst    .form:hover { color: var(--e-lst); }

.more {
  margin-top: 12px; border: 1px dashed var(--line); background: transparent;
  color: var(--muted); border-radius: 9px; padding: 8px 18px; font-size: 12.5px; cursor: pointer;
}
.more:hover { border-color: var(--coral); color: var(--coral); border-style: solid; }
.index-more { display: block; margin: 24px auto 0; min-width: 210px; }

.srcline { margin-top: 40px; padding-top: 15px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--faint); line-height: 1.85; }

/* 本機字體畫不出的生僻部件字。不靜默吞掉，也不留空豆腐塊。 */
.miss {
  display: inline-block; vertical-align: 1px;
  font-family: "SF Mono", Menlo, monospace; font-size: .62em;
  color: var(--coral); background: rgba(227, 106, 76, .1);
  border: 1px solid rgba(227, 106, 76, .3);
  border-radius: 3px; padding: 0 3px; margin: 0 1px; line-height: 1.5;
}
.miss:hover { text-decoration: none; background: rgba(227, 106, 76, .2); }
/* 私用區碼位：無從查起，故不做鏈接 */
.miss.pua { color: var(--faint); background: transparent; border-color: var(--line); border-style: dashed; cursor: help; }

@media (max-width: 640px) {
  .bar { flex-wrap: wrap; row-gap: 8px; }
  .bar-title { flex: 1 1 auto; font-size: 14px; }
  .bar-tools { display: contents; }
  #q { order: 9; flex: 1 1 100%; width: auto; }
  main { padding: 16px 13px 70px; }
  .hero h1 { font-size: 21px; letter-spacing: .08em; }
  .zhead .glyph-kai { font-size: 56px; }
  .gloss { grid-template-columns: 1fr; gap: 3px 0; padding: 15px 15px; }
  .gloss dt { margin-top: 11px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
}
