:root {
	color-scheme: light;
	--page: #f7f4ed;
	--surface: #fffdf8;
	--text: #25231f;
	--muted: #736e64;
	--faint: #a49c8f;
	--border: #ded8cc;
	--accent: #8c4936;
	--accent-hover: #6f3728;
	--on-accent: #fffaf3;
	--input-bg: rgba(255, 253, 248, .72);
	--th-bg: #f0ece4;
	--code-bg: #eee9df;
	--pre-bg: #292723;
	--pre-fg: #f7f4ed;
	--danger: #a43c35;
	--warning: #98651f;
	--flash-bg: #fbf2df;
	--flash-border: #d8bd89;
	--flash-error-bg: #f9e9e6;
	--flash-error-border: #d7aaa4;
	--serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", Georgia, serif;
	--sans: system-ui, -apple-system, "Segoe UI", "Noto Sans SC", sans-serif;
	font-family: var(--sans);
	line-height: 1.7;
}

html[data-theme="dark"] {
	color-scheme: dark;
	--page: #191816; --surface: #211f1c; --text: #eee9df; --muted: #aaa296;
	--faint: #7f786e; --border: #3b3731; --accent: #d18a70; --accent-hover: #e3aa94;
	--on-accent: #211b18; --input-bg: #24221f; --th-bg: #2b2925; --code-bg: #302d28;
	--pre-bg: #11100f; --pre-fg: #eee9df; --danger: #e7978f; --warning: #d8a45b;
	--flash-bg: #382d1b; --flash-border: #705a32; --flash-error-bg: #3c2220; --flash-error-border: #73433f;
}

@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) {
		color-scheme: dark;
		--page: #191816; --surface: #211f1c; --text: #eee9df; --muted: #aaa296;
		--faint: #7f786e; --border: #3b3731; --accent: #d18a70; --accent-hover: #e3aa94;
		--on-accent: #211b18; --input-bg: #24221f; --th-bg: #2b2925; --code-bg: #302d28;
		--pre-bg: #11100f; --pre-fg: #eee9df; --danger: #e7978f; --warning: #d8a45b;
		--flash-bg: #382d1b; --flash-border: #705a32; --flash-error-bg: #3c2220; --flash-error-border: #73433f;
	}
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; color: var(--text); background: var(--page); }
.home-page { min-height: 100dvh; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.site-header-inner, .site-footer-inner, .site-main { width: min(960px, calc(100% - 3rem)); margin: 0 auto; }
.site-header { background: color-mix(in srgb, var(--page) 92%, transparent); }
.site-header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; min-height: 5rem; border-bottom: 1px solid var(--border); }
.site-header-end { flex-wrap: wrap; justify-content: flex-end; }
.site-header-end, .site-nav { display: flex; align-items: center; }
.site-header-end { gap: .75rem; }
.site-nav { gap: 1.35rem; }
.site-brand { max-width: min(24rem, 45vw); overflow-wrap: anywhere; color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 1.12rem; font-weight: 700; letter-spacing: .14em; }
.site-brand:hover { color: var(--text); }
.site-nav a { color: var(--muted); text-decoration: none; font-size: .88rem; letter-spacing: .04em; }
.site-nav a:hover, .site-nav a.is-active { color: var(--text); }
.site-nav a.is-active { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .5rem; }

.site-main { flex: 1; padding: clamp(3rem, 7vw, 6rem) 0; }
.home-main { display: flex; padding-top: clamp(1.5rem, 4vh, 3rem); padding-bottom: clamp(1.5rem, 4vh, 3rem); }
.site-footer { color: var(--muted); font-size: .78rem; }
.site-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.3rem 0 1.8rem; border-top: 1px solid var(--border); }
.site-copy, .site-beian { margin: 0; }
.site-copy { display: inline-flex; align-items: center; gap: .65rem; }
.site-github { display: inline-flex; color: inherit; }
.site-github svg { width: 1rem; height: 1rem; }
.site-beian a { color: inherit; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.35; }
h1 { margin: 0 0 .65rem; font-size: clamp(2rem, 5vw, 3rem); font-weight: 600; letter-spacing: .04em; }
h2 { margin: 2.8rem 0 .8rem; font-size: 1.3rem; }
h3 { margin: 1.8rem 0 .5rem; font-size: 1.05rem; }
.lead { max-width: 45rem; margin: 0 0 2.5rem; color: var(--muted); }
.hint, .meta, .empty, .note { color: var(--muted); font-size: .875rem; }

.home { flex: 1; display: grid; place-items: center; }
.reading { width: min(800px, 100%); text-align: center; }
.reading-kicker { margin: 0 0 clamp(2.4rem, 7vh, 5rem); color: var(--faint); font-family: var(--serif); font-size: .78rem; letter-spacing: .35em; }
.reading-quote { margin: 0; }
.reading-quote p { overflow-wrap: anywhere; margin: 0 auto; font-family: var(--serif); font-size: clamp(1.75rem, 4.3vw, 3.15rem); font-weight: 500; line-height: 1.65; letter-spacing: .04em; text-wrap: balance; }
.reading-quote p[data-length="medium"] { font-size: clamp(1.45rem, 3.5vw, 2.45rem); }
.reading-quote p[data-length="long"] { font-size: clamp(1.15rem, 2.7vw, 1.9rem); }
.reading-quote p[data-length="xlong"] { max-height: clamp(12rem, 45vh, 32rem); overflow-y: auto; padding: .15rem .5rem; font-size: clamp(1rem, 2.1vw, 1.45rem); line-height: 1.75; text-wrap: pretty; scrollbar-gutter: stable; }
.reading-quote footer { max-width: 100%; min-height: 1.7rem; margin-top: 2rem; overflow-wrap: anywhere; color: var(--muted); font-size: .88rem; letter-spacing: .04em; }
.reading-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .7rem; margin-top: 3rem; }
.reading-controls button { width: 6rem; height: 2.55rem; padding: .55rem .75rem; line-height: 1; }
.reading-controls .copy-action { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); background: color-mix(in srgb, var(--warning) 14%, var(--surface)); color: var(--text); }
.reading-controls .copy-action:hover { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 22%, var(--surface)); color: var(--text); }
.reading-status { min-height: 1.5rem; margin: .7rem 0 0; color: var(--muted); font-size: .8rem; }

button, .button { display: inline-block; width: fit-content; padding: .55rem 1.15rem; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: var(--on-accent); }
button:disabled { cursor: wait; opacity: .55; }
.button-secondary { border-color: var(--border); background: transparent; color: var(--text); }
.button-secondary:hover { border-color: var(--text); background: transparent; color: var(--text); }
button.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: 0; background: transparent; color: var(--muted); }
button.theme-toggle:hover { background: transparent; color: var(--text); }
.theme-icon { width: 1rem; height: 1rem; fill: currentColor; }
.theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) .theme-icon-sun { display: none; }
	html:not([data-theme="light"]) .theme-icon-moon { display: block; }
}

form { display: grid; gap: 1rem; max-width: 42rem; }
.submit-form { max-width: 46rem; gap: 1rem; margin-top: 2rem; padding: clamp(1.25rem, 4vw, 2.25rem); border: 1px solid var(--border); background: var(--surface); }
.submit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.submit-wide { grid-column: 1 / -1; }
label { display: grid; gap: .35rem; font-weight: 600; }
input[type="text"], input:not([type]), input[type="email"], input[type="password"], input[type="search"], input[type="url"], textarea, select { width: 100%; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: .25rem; background: var(--input-bg); color: var(--text); font: inherit; }
textarea { min-height: 7rem; resize: vertical; }
fieldset { min-width: 0; }
.terms { margin: .25rem 0; padding: 1rem 1.1rem; border: 1px solid var(--border); background: var(--page); }
.terms ul { margin: .5rem 0 .8rem; padding-left: 1.2rem; color: var(--muted); font-size: .84rem; }
.agree { display: flex; align-items: center; gap: .55rem; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent); }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 400; }
.flash { max-width: 46rem; padding: .7rem 1rem; border: 1px solid var(--flash-border); background: var(--flash-bg); }
.flash.error { border-color: var(--flash-error-border); background: var(--flash-error-bg); color: var(--danger); }
.recent { max-width: 46rem; margin-top: 3.5rem; }
.recent-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.recent-list li { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.recent-content, .recent-list .meta { margin: 0; }
.recent-list .meta { margin-top: .25rem; }

.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 38rem; margin: 2rem 0; }
.stat { padding: 1.25rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stat-label { display: block; color: var(--muted); font-size: .78rem; }
.stat strong { font-family: var(--serif); font-size: 1.8rem; }
.download-list { display: grid; gap: .8rem; margin: 2rem 0; }
.download-list p { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin: 0; }
.done-card { max-width: 38rem; padding: 2rem; border: 1px solid var(--border); background: var(--surface); }

table, .data-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .88rem; }
th, td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--th-bg); font-weight: 600; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
code { padding: .1em .32em; border-radius: .2rem; background: var(--code-bg); }
pre { overflow-x: auto; padding: 1rem; border: 1px solid var(--border); border-radius: .25rem; background: var(--pre-bg); color: var(--pre-fg); }
.error-page .request-id { color: var(--muted); font-size: .85rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 640px) {
	.site-header-inner, .site-footer-inner, .site-main { width: min(100% - 2rem, 960px); }
	.site-header-inner { min-height: auto; padding: 1rem 0; align-items: flex-start; gap: .8rem; }
	.site-header-end { flex-direction: row-reverse; align-items: flex-start; gap: .35rem; }
	.site-nav { max-width: 13.5rem; justify-content: flex-end; flex-wrap: wrap; gap: .4rem 1rem; }
	.site-nav a { font-size: .82rem; }
	.site-main { padding: 3rem 0; }
	.home-main { padding-top: 2rem; padding-bottom: 2rem; }
	.reading-kicker { margin-bottom: 2.5rem; }
	.reading-quote p { font-size: clamp(1.55rem, 8vw, 2.2rem); line-height: 1.6; }
	.reading-quote p[data-length="medium"] { font-size: clamp(1.35rem, 6vw, 1.85rem); }
	.reading-quote p[data-length="long"] { font-size: clamp(1.1rem, 4.8vw, 1.5rem); }
	.reading-quote p[data-length="xlong"] { max-height: clamp(12rem, 40vh, 24rem); font-size: clamp(1rem, 4.2vw, 1.2rem); line-height: 1.7; }
	.reading-controls { margin-top: 2.3rem; }
	.site-footer-inner { align-items: flex-start; flex-direction: column; }
	.submit-grid, .stat-row { grid-template-columns: 1fr; }
	table, .data-table { display: block; overflow-x: auto; }
}

@media (max-height: 700px) {
	.home-main { padding-top: 1rem; padding-bottom: 1rem; }
	.reading-kicker { margin-bottom: 1.5rem; }
	.reading-quote footer { margin-top: 1rem; }
	.reading-controls { margin-top: 1.5rem; }
	.reading-quote p[data-length="medium"] { font-size: clamp(1.3rem, 3.2vw, 2rem); }
	.reading-quote p[data-length="long"] { font-size: clamp(1.08rem, 2.5vw, 1.55rem); }
	.reading-quote p[data-length="xlong"] { font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.65; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Public information pages */
.page-intro { max-width: 46rem; margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.page-eyebrow { margin: 0 0 .65rem; color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.page-intro .lead { margin-bottom: 0; font-size: 1rem; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1.5rem; margin-bottom: 1rem; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading p { color: var(--muted); font-size: .82rem; }
.table-wrap { max-width: 100%; overflow-x: auto; border-top: 1px solid var(--border); }
.table-wrap:focus { outline-offset: 2px; }
.table-wrap table { min-width: 38rem; }
pre code { padding: 0; background: transparent; color: inherit; }

.docs-page { max-width: 960px; }
.docs-page .page-intro { margin-bottom: 3rem; }
.docs-layout { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5.5rem); align-items: start; }
.docs-toc { position: sticky; top: 1.5rem; display: grid; gap: .45rem; padding-top: .4rem; border-top: 1px solid var(--border); }
.docs-toc p { margin: .65rem 0 .3rem; color: var(--faint); font-size: .7rem; font-weight: 700; letter-spacing: .12em; }
.docs-toc a { color: var(--muted); font-size: .83rem; text-decoration: none; }
.docs-toc a:hover { color: var(--accent); }
.docs-content { min-width: 0; }
.docs-section { padding: 0 0 3.5rem; scroll-margin-top: 1rem; }
.docs-section + .docs-section { padding-top: 3.5rem; border-top: 1px solid var(--border); }
.docs-section > h2, .docs-section .section-heading h2 { margin-top: 0; font-size: clamp(1.4rem, 3vw, 1.75rem); }
.docs-section > h3 { margin-top: 2.25rem; }
.docs-section > p { max-width: 44rem; }
.example-list { margin-top: 1.75rem; border-top: 1px solid var(--border); }
.example-list > section { padding: 1.35rem 0 1.5rem; border-bottom: 1px solid var(--border); }
.example-list h3, .example-list p { margin-top: 0; }
.example-list h3 { margin-bottom: .3rem; }
.example-list p { margin-bottom: .85rem; color: var(--muted); font-size: .9rem; }
.example-list pre { margin: 0; }
.docs-notes { margin-top: 1.4rem; padding-left: 1rem; border-left: 2px solid var(--border); }
.docs-notes p { margin: .45rem 0; color: var(--muted); font-size: .88rem; }
.docs-notes strong { color: var(--text); }
.plain-list { padding-left: 1.25rem; }
.plain-list li + li { margin-top: .45rem; }

.submit-page { max-width: 760px; margin: 0 auto; }
.submit-page .submit-intro { margin-bottom: 2rem; }
.submit-page .flash { margin-bottom: 1rem; }
.submit-page .submit-form { max-width: none; margin: 0; padding: 0; border: 0; background: transparent; gap: 0; }
.submit-page .form-section { display: grid; gap: 1.1rem; padding: 2rem 0; border-top: 1px solid var(--border); }
.submit-page .form-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; }
.submit-page .form-section-heading h2, .submit-page .form-section-heading p { margin: 0; }
.submit-page .form-section-heading h2 { font-size: 1.18rem; }
.submit-page .form-section-heading p, .submit-page .label-note { color: var(--muted); font-size: .78rem; font-weight: 400; }
.submit-page label { align-content: start; }
.submit-page .submit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.submit-page .submit-grid > *, .submit-page input, .submit-page select, .submit-page textarea { min-width: 0; }
.submit-page textarea { min-height: 9.5rem; font-family: var(--serif); font-size: 1.08rem; line-height: 1.75; }
.submit-page .terms { margin: 0; padding: 1.5rem 0; border-width: 1px 0 0; background: transparent; }
.submit-page .terms legend { padding: 0 1rem 0 0; font-family: var(--serif); font-weight: 700; }
.submit-page .terms ul { margin: .25rem 0 1rem; padding-left: 1.2rem; }
.submit-page .terms li + li { margin-top: .25rem; }
.submit-page .form-action { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.submit-page .form-action span { color: var(--muted); font-size: .8rem; }
.submit-page .recent { max-width: none; margin-top: clamp(4rem, 9vw, 6.5rem); }
.submit-page .recent-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: baseline; }
.submit-page .recent-content { overflow-wrap: anywhere; font-family: var(--serif); font-size: 1.02rem; }
.submit-page .recent-list .meta { max-width: 14rem; overflow-wrap: anywhere; }

.done-page { min-height: min(520px, calc(100vh - 15rem)); display: grid; place-items: center; }
.done-page .done-card { width: min(34rem, 100%); padding: clamp(2rem, 7vw, 4rem); text-align: center; }
.done-page .done-mark { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; margin: 0 auto 1.5rem; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 1.15rem; }
.done-page .page-eyebrow { margin-bottom: .45rem; }
.done-page h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.done-page .lead { margin: 0 auto 1rem; }
.done-note { margin: 0; color: var(--muted); font-size: .86rem; }
.done-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem 1.3rem; margin-top: 2rem; }

.dataset-page { max-width: 820px; margin: 0 auto; }
.dataset-overview { display: grid; grid-template-columns: minmax(0, .9fr) minmax(16rem, 1.1fr); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.dataset-version { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; padding: 1.5rem 2rem 1.5rem 0; }
.dataset-version p { margin: 0; }
.dataset-version span, .dataset-version strong { display: block; }
.dataset-version span { color: var(--muted); font-size: .75rem; }
.dataset-version strong { overflow-wrap: anywhere; font-family: var(--serif); font-size: clamp(1.55rem, 4vw, 2.1rem); font-weight: 500; }
.dataset-download { padding: 1.8rem 0 1.8rem clamp(1.5rem, 5vw, 3rem); border-left: 1px solid var(--border); }
.dataset-download h2 { margin: 0 0 .25rem; }
.dataset-download p { margin: 0 0 1rem; color: var(--muted); font-size: .85rem; }
.dataset-details { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(14rem, .8fr); gap: clamp(2.5rem, 8vw, 6rem); margin-top: clamp(3.5rem, 8vw, 5.5rem); }
.dataset-details h2 { margin-top: 0; }
.dataset-details p { color: var(--muted); }
.dataset-details a, .dataset-details .contact-value { color: var(--text); }
.contact-value { overflow-wrap: anywhere; }

@media (max-width: 700px) {
	.docs-layout { grid-template-columns: 1fr; gap: 2.5rem; }
	.docs-toc { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 1rem 0; }
	.docs-toc p { grid-column: 1 / -1; margin-top: 0; }
	.docs-section { padding-bottom: 2.8rem; }
	.docs-section + .docs-section { padding-top: 2.8rem; }
	.dataset-overview, .dataset-details { grid-template-columns: 1fr; }
	.dataset-download { padding: 1.5rem 0; border-top: 1px solid var(--border); border-left: 0; }
	.dataset-version { padding-right: 0; }
	.dataset-details { gap: 2rem; }
}

@media (max-width: 640px) {
	.submit-page .submit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
	.submit-page .form-section-heading { display: block; }
	.submit-page .form-section-heading p { margin-top: .3rem; }
	.submit-page .recent-list li { grid-template-columns: 1fr; gap: .2rem; }
	.dataset-version { gap: 1rem; }
	.done-page .done-card { padding-inline: 1.35rem; }
}
