/* 每日甲骨 · 样式：沿用 unit-converter 的米色 / 棕色配色 */
:root {
	--paper: transparent;
	--surface: #fffaf0;
	--surface-2: #f3e9d2;
	--ink: #6f5f4a;
	--ink-2: #806f59;
	--ink-3: #9a8870;
	--line: #dcc9a3;
	--line-2: #c9b48c;
	--gold: #8a624a;
	--gold-soft: #efe3cb;
	--cinnabar: #8a624a;
	--radius: 16px;
	--shadow: 0 1px 2px rgba(42, 37, 34, .04), 0 10px 30px rgba(42, 37, 34, .07);
	--serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", "Georgia", serif;
	/* 隶书：LiSu（Windows 自带，21983 字，繁体亦全）优先，华文隶书兜底 */
	--lishu: "LiSu", "隶书", "STLiti", "华文隶书", "STLiti", var(--serif);
	/* 方正甲骨文：自托管 woff2 子集（SIL OFL 1.1），按 unicode-range 懒加载 */
	--oracle: "FZJiaGuWen", var(--serif);
	/* 敬峰中山王篆 v3.5（SIL OFL 1.1）：战国中山王器铭文的修长篆体，收简体码位 */
	--zhongshan: "JingfengZSKSS";
	/* 峄山碑篆体 v1.00（作者声明免费商用）：秦李斯玉箸篆一路，收简体码位 */
	--yishan: "YishanbeiSeal";
	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
	--paper: #14120f;
	--surface: #1d1a16;
	--surface-2: #241f1a;
	--ink: #ece5d6;
	--ink-2: #b8ae9d;
	--ink-3: #857b6d;
	--line: #322c25;
	--line-2: #40382f;
	--gold: #d9b54a;
	--gold-soft: #3a3218;
	--cinnabar: #dd7a5c;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
	margin: 0;
	background: transparent;
	color: var(--ink);
	font: 16px/1.75 var(--sans);
	-webkit-font-smoothing: antialiased;
	transition: background-color .25s, color .25s;
}

.wrap {
	position: relative;
	z-index: 1;
	max-width: 980px;
	margin: 0 auto;
	padding: 18px 20px 28px;
}

.font-search {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
}
.font-search input {
	flex: 1 1 280px;
	min-width: 0;
	font: inherit;
	font-size: 14px;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 8px 14px;
	outline: none;
}
.font-search input::placeholder { color: var(--ink-3); }
.font-search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search-status {
	flex: 0 0 auto;
	font-size: 12px;
	color: var(--ink-3);
}
.search-status.is-error {
	color: #b23a32;
	font-weight: 700;
}
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- 页眉 ---------- */
.head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--line);
}
.brand {
	font-family: var(--serif);
	font-size: 22px;
	font-weight: 700;
	letter-spacing: .12em;
	line-height: 1.3;
}
.brand small {
	display: block;
	font-family: var(--sans);
	font-size: 12px;
	font-weight: 400;
	letter-spacing: .28em;
	color: var(--ink-3);
	margin-top: 4px;
}
.head-right {
	display: flex;
	align-items: center;
	gap: 12px;
}
.date {
	font-size: 13px;
	color: var(--ink-3);
	letter-spacing: .04em;
	text-align: right;
}

/* ---------- 按钮 ---------- */
.btn {
	font: inherit;
	font-size: 14px;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line-2);
	border-radius: 999px;
	padding: 7px 15px;
	cursor: pointer;
	transition: background-color .18s, color .18s, border-color .18s, transform .12s;
	white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
	outline: 2px solid var(--gold);
	outline-offset: 2px;
	color: var(--ink);
}
.btn.is-on {
	background: var(--gold);
	border-color: var(--gold);
	color: #fff;
}
.btn-icon {
	width: 36px;
	height: 36px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	border-radius: 50%;
}
.btn-primary {
	background: var(--ink);
	border-color: var(--ink);
	color: #fffaf0;
	font-weight: 500;
}
.btn-primary:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-primary:focus-visible { color: #fffaf0; }

/* ---------- 主卡 ---------- */
.hero {
	display: grid;
	grid-template-columns: minmax(140px, 200px) 1fr;
	gap: 28px;
	align-items: center;
	margin: 26px 0 22px;
	padding: 26px 28px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}
.hero-left {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}
.hero-script-pair {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
}
.hero-simple {
	font-family: var(--serif);
	font-size: clamp(64px, 12vw, 94px);
	line-height: 1;
	font-weight: 700;
	color: var(--ink);
}
/* 主字用真实甲骨字形。不加粗：刀刻线条极细，合成粗体会糊成一团 */
.hero-char {
	font-family: var(--oracle);
	font-size: clamp(76px, 15vw, 116px);
	line-height: 1;
	font-weight: 400;
	color: var(--cinnabar);
}
.hero-char.is-missing,
.s-box .txt.oracle.is-missing {
	font-family: var(--serif);
	color: var(--ink-3);
}
.hero-pinyin {
	font-family: Georgia, "Times New Roman", serif;
	font-size: 18px;
	letter-spacing: .1em;
	color: var(--cinnabar);
}
.hero-gloss {
	font-family: var(--serif);
	font-size: clamp(20px, 3.4vw, 26px);
	font-weight: 700;
	letter-spacing: .04em;
	margin: 0 0 6px;
}
.gloss-tag {
	font-family: var(--sans);
	font-size: 11.5px;
	font-weight: 400;
	letter-spacing: .16em;
	color: var(--gold);
	border: 1px solid var(--line-2);
	border-radius: 999px;
	padding: 2px 8px;
	margin-right: 10px;
	vertical-align: 3px;
}
.hero-trad {
	margin: 0 0 14px;
	font-size: 14px;
	color: var(--ink-3);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
	font-size: 12.5px;
	letter-spacing: .08em;
	color: var(--ink-2);
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 4px 11px;
}
.chip.type {
	color: var(--cinnabar);
	border-color: color-mix(in srgb, var(--cinnabar) 35%, var(--line));
	background: color-mix(in srgb, var(--cinnabar) 8%, var(--surface));
}
.chip.tier {
	color: var(--ink-2);
}
.chip.tier.is-core {
	color: var(--gold);
	border-color: color-mix(in srgb, var(--gold) 45%, var(--line));
	background: color-mix(in srgb, var(--gold) 12%, var(--surface));
}

/* ---------- 字形对照 ---------- */
.section-title {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin: 30px 0 12px;
}
.section-title h2 {
	margin: 0;
	font-family: var(--serif);
	font-size: 17px;
	font-weight: 700;
	letter-spacing: .16em;
}
.section-title span {
	font-size: 12.5px;
	color: var(--ink-3);
	letter-spacing: .06em;
}

.script-row {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 12px;
}
.s-card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px 12px 12px;
	text-align: center;
	box-shadow: var(--shadow);
}
.s-name {
	font-family: var(--serif);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .1em;
}
.s-era {
	font-size: 11.5px;
	color: var(--ink-3);
	letter-spacing: .08em;
	margin-top: 2px;
}
.s-box {
	position: relative;
	margin: 10px auto 0;
	width: 100%;
	max-width: 132px;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	border: 1px dashed var(--line-2);
	background: var(--surface-2);
	overflow: visible;
}
.s-box svg {
	width: 78%;
	height: 78%;
	overflow: visible;
	color: var(--ink);
}
.s-box.text {
	border-style: solid;
	border-color: var(--line);
}
.s-box .txt {
	font-family: var(--serif);
	font-size: clamp(38px, 7vw, 54px);
	font-weight: 700;
	line-height: 1;
	color: var(--ink);
}
/* 繁体用隶书。隶书笔画扁阔、自带重量，不再套 700，否则是合成的假粗 */
.s-box .txt.lishu {
	font-family: var(--lishu);
	font-weight: 400;
	letter-spacing: .02em;
}
/* 甲骨文用真实字形字体 */
.s-box .txt.oracle {
	font-family: var(--oracle);
	font-weight: 400;
	font-size: clamp(44px, 8vw, 62px);
	color: color-mix(in srgb, var(--cinnabar) 82%, var(--ink));
}
/* 中山篆、峄山碑篆：都是纵长取势的篆体，字身瘦高，字号比楷体略收一档；
   笔画细如箸，一律 400，套粗体会糊掉线条 */
.s-box .txt.zhongshan {
	font-family: var(--zhongshan);
	font-weight: 400;
	font-size: clamp(40px, 7vw, 58px);
	color: color-mix(in srgb, #4a6b58 68%, var(--ink));
	-webkit-font-smoothing: antialiased;
	text-rendering: geometricPrecision;
	-webkit-text-stroke: .28px currentColor;
	text-shadow: 0 0 .35px currentColor;
}
.s-box .txt.yishan {
	font-family: var(--yishan);
	font-weight: 400;
	font-size: clamp(40px, 7vw, 58px);
	color: color-mix(in srgb, var(--gold) 34%, var(--ink));
}
/* 没有数据就老实留空，不拿别的字体冒充 */
.s-empty {
	font-size: 12px;
	letter-spacing: .18em;
	color: var(--ink-3);
	opacity: .75;
}
.s-card.is-empty { opacity: .62; }
.s-card.is-empty .s-box { border-style: dashed; }
.s-note {
	font-size: 11.5px;
	color: var(--ink-3);
	margin-top: 8px;
	letter-spacing: .04em;
}

/* 各时代的底色略有分别 */
.s-card[data-script="oracle"] .s-box { background: color-mix(in srgb, #f3ead8 82%, var(--surface-2)); }
.s-card[data-script="bronze"] .s-box { background: color-mix(in srgb, #e9efe2 82%, var(--surface-2)); }
.s-card[data-script="zhongshan"] .s-box { background: color-mix(in srgb, #e6eee4 84%, var(--surface-2)); }
.s-card[data-script="yishan"] .s-box { background: color-mix(in srgb, #f1e7e0 82%, var(--surface-2)); }
.s-card[data-script="oracle"] .s-box svg { color: color-mix(in srgb, var(--cinnabar) 78%, var(--ink)); }
.s-card[data-script="bronze"] .s-box svg { color: color-mix(in srgb, #4a6b58 72%, var(--ink)); }
[data-theme="dark"] .s-card[data-script="oracle"] .s-box { background: #251d16; }
[data-theme="dark"] .s-card[data-script="bronze"] .s-box { background: #1b231d; }
[data-theme="dark"] .s-card[data-script="zhongshan"] .s-box { background: #18211c; }
[data-theme="dark"] .s-card[data-script="yishan"] .s-box { background: #241d1a; }

/* 六栏在 980 的中栏里会挤成一行细条，先降到三栏，再降到两栏 */
@media (max-width: 860px) {
	.script-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 解说 ---------- */
.notes {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 14px;
}
.note {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 16px 18px;
	box-shadow: var(--shadow);
}
.note h3 {
	margin: 0 0 8px;
	font-family: var(--serif);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .14em;
	color: var(--gold);
}
.note p {
	margin: 0;
	font-size: 14.5px;
	line-height: 1.85;
	color: var(--ink-2);
	text-align: justify;
}
.note.wide { grid-column: 1 / -1; }
.tip {
	margin: 12px 0 0;
	font-size: 12.5px;
	line-height: 1.8;
	color: var(--ink-3);
	letter-spacing: .03em;
}
.tip:empty { margin: 0; }

/* ---------- 工具条 ---------- */
.toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 26px;
	padding: 14px 16px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}
.toolbar .spacer { flex: 1 1 auto; }
/* 范围切换做成一组，避免看着像两个独立动作 */
.seg {
	display: inline-flex;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	overflow: hidden;
}
.btn-seg {
	border: 0;
	border-radius: 0;
	background: transparent;
	padding: 7px 13px;
	font-size: 13px;
}
.btn-seg + .btn-seg { border-left: 1px solid var(--line-2); }
.btn-seg:hover { background: var(--surface-2); }
.btn-seg.is-on { background: var(--ink); color: #fffaf0; }
.btn-seg.is-on:hover { background: var(--ink); color: #fffaf0; }
.btn-seg.is-on:focus-visible { color: #fffaf0; }
.counter {
	font-family: var(--serif);
	font-size: 14px;
	letter-spacing: .1em;
	color: var(--ink-3);
}

.progress {
	margin-top: 14px;
}
.progress-text {
	font-size: 12.5px;
	color: var(--ink-3);
	letter-spacing: .06em;
	margin-bottom: 6px;
}
.progress-track {
	height: 4px;
	border-radius: 999px;
	background: var(--line);
	overflow: hidden;
}
.progress-bar {
	height: 100%;
	width: 0;
	border-radius: 999px;
	background: var(--gold);
	transition: width .35s ease;
}

.hint {
	margin-top: 16px;
	font-size: 12.5px;
	color: var(--ink-3);
	letter-spacing: .04em;
	text-align: center;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
	.wrap { padding: 20px 14px 44px; }
	.font-search { flex-wrap: wrap; }
	.font-search input { flex-basis: calc(100% - 76px); }
	.search-status { flex-basis: 100%; }
	.hero {
		grid-template-columns: 1fr;
		gap: 16px;
		padding: 20px;
		text-align: center;
	}
	.hero-left { gap: 10px; }
	.hero-char { font-size: 68px; }
	.chips { justify-content: center; }
	.script-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.toolbar { justify-content: center; }
	.toolbar .spacer { display: none; }
}
