@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;550;600;650;700&family=Noto+Sans+SC:wght@400&family=Noto+Serif+SC:wght@400;500&display=swap');

:root {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #292a32;
  background: #f8f7f4;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --accent: #65538b;
  --muted: #73737c;
  --border: #e4e2df;
}
* { box-sizing: border-box; }
body { margin: 0; }
html { scrollbar-gutter: stable; }
body.modal-open { overflow: hidden; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #9b83ca; outline-offset: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 5; padding: 12px 18px; background: white; }
.skip-link:focus { top: 12px; }
.site-header, main, footer { width: min(1120px, calc(100% - 80px)); margin-inline: auto; }
.site-header { height: 104px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 22px; font-weight: 650; letter-spacing: -.9px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; background: #ebe6f2; color: var(--accent); border-radius: 10px; font-family: 'Noto Serif SC', 'Songti SC', serif; font-size: 23px; font-weight: 500; }
.brand-mark { width: 62px; white-space: nowrap; letter-spacing: 1px; }
.brand-dot { color: var(--accent); }
.home-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.home-link span { margin-left: 8px; }
.home-link:hover { color: var(--accent); }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--accent); font-size: 10px; letter-spacing: 1.8px; font-weight: 700; margin: 0 0 20px; }
.eyebrow > span { width: 6px; height: 6px; border-radius: 50%; background: #8871aa; }
.collection { padding-top: 24px; }
.search-panel { position: sticky; top: 0; z-index: 2; padding: 12px 0 19px; background: #f8f7f4f5; backdrop-filter: blur(12px); }
.font-picker { border: 0; padding: 0; margin: 0 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.font-picker legend { float: left; padding: 0; color: var(--muted); font-size: 12px; }
.reference-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.reference-controls .font-picker { margin: 0; flex-wrap: wrap; justify-content: flex-start; gap: 7px 12px; }
.reference-controls .sort-picker { order: -1; }
.reference-controls .font-picker:not(.sort-picker) { margin-left: auto; justify-content: flex-end; }
.font-options { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: #efede9; }
.font-options label { position: relative; cursor: pointer; }
.font-options input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; }
.font-options span { display: block; padding: 7px 12px; border-radius: 6px; color: #696770; font-size: 12px; }
.font-options input:checked + span { background: white; color: var(--accent); box-shadow: 0 1px 3px #292a3210; }
.font-options input:focus-visible + span { outline: 3px solid #9b83ca; outline-offset: 2px; }
.search-box { display: flex; align-items: center; gap: 13px; border: 1px solid #ddd9e3; border-radius: 12px; background: white; padding: 0 18px; box-shadow: 0 2px 5px #292a3203; }
.search-box:focus-within { border-color: #8b72b2; box-shadow: 0 0 0 3px #8b72b215; }
.search-box > svg { width: 20px; height: 20px; stroke: #928a9f; stroke-width: 1.6; fill: none; flex-shrink: 0; }
input { border: 0; outline: none; padding: 19px 0; min-width: 0; flex: 1; width: 100%; color: #292a32; background: transparent; font-size: 15px; }
input:focus-visible { outline: none; }
input::placeholder { color: #77727f; }
input::-webkit-search-cancel-button { display: none; }
.clear-button { background: #f0edf5; color: var(--accent); border: 0; border-radius: 6px; width: 30px; height: 30px; font-size: 24px; line-height: 1; }
.search-meta { display: flex; justify-content: space-between; gap: 12px; padding-top: 13px; color: var(--muted); font-size: 12px; }
.search-meta p { margin: 0; }
.suggestion { padding: 0; background: none; border: 0; border-bottom: 1px solid #c7c0d3; color: var(--accent); }
.suggestion:hover { border-color: var(--accent); }
#result-count { font-variant-numeric: tabular-nums; }
.radical-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.radical-grid > li { display: flex; min-width: 0; }
.radical-card { min-height: 157px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; padding: 20px 8px 17px; border: 1px solid var(--border); background: #fffefa; border-radius: 12px; transition: background .15s, border-color .15s; }
.radical-card { width: 100%; color: inherit; }
.radical-card:hover { border-color: #c9bfd9; background: #f3eff8; }
.radical-card:focus-visible { border-color: var(--accent); }
.radical-glyph, .position-label [lang] { font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
html[data-radical-font="calligraphic"] .radical-glyph,
html[data-radical-font="calligraphic"] .position-label [lang] { font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif; }
.radical-glyph { font-weight: 400; font-size: 55px; line-height: 1.2; }
.radical-meaning { color: #696770; font-size: 12px; text-align: center; line-height: 1.4; }
.position-label { font-size: 10px; color: var(--accent); background: #eee8f5; border-radius: 4px; padding: 3px 5px; margin: -5px 0 -5px; }
.empty-state { text-align: center; padding: 55px 10px 65px; border: 1px dashed #d9d3e2; border-radius: 12px; }
.empty-symbol { font-family: 'Noto Serif SC', serif; color: #a697ba; font-size: 45px; }
.empty-state h2 { font-size: 20px; font-weight: 500; margin: 15px 0 8px; }
.empty-state p { font-size: 14px; color: var(--muted); }
.text-button { border: 0; background: none; color: var(--accent); font-size: 14px; padding: 8px 0; text-decoration: underline; text-underline-offset: 4px; }
.load-error { text-align: center; padding: 35px 15px; }
.reference-note { display: flex; gap: 12px; justify-content: center; align-items: baseline; color: var(--muted); font-size: 12px; margin: 33px 0 42px; }
.reference-note p { margin: 0; line-height: 1.8; }
.reference-note p span { color: #57515f; white-space: nowrap; }
.note-mark { color: #a598b7; font-size: 18px; }
footer { border-top: 1px solid var(--border); padding: 24px 0 35px; display: flex; align-items: baseline; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 11px; }
.about-collection { max-width: 440px; }
.about-collection summary { cursor: pointer; text-align: right; }
.about-collection p { line-height: 1.8; font-size: 12px; }
.about-collection a { text-underline-offset: 3px; }
.radical-dialog { width: min(720px, calc(100% - 36px)); max-height: calc(100dvh - 48px); padding: 0; color: #292a32; background: #f8f7f4; border: 1px solid #ded8e5; border-radius: 20px; box-shadow: 0 24px 100px #19112330; overscroll-behavior: contain; }
.radical-dialog::backdrop { background: #25203070; backdrop-filter: blur(4px); }
.dialog-content { padding: 34px; position: relative; }
.dialog-close-form { position: absolute; top: 20px; right: 20px; margin: 0; }
.dialog-close { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: #fffefa; color: #655b72; font-size: 25px; line-height: 1; }
.dialog-close:hover { background: #eee8f5; }
.detail-header { display: flex; align-items: center; gap: 23px; padding: 8px 40px 24px 0; border-bottom: 1px solid var(--border); }
.detail-header .eyebrow { margin-bottom: 9px; font-size: 9px; }
.detail-header h2 { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -.7px; }
.detail-glyph { font-size: 76px; min-width: 87px; text-align: center; color: var(--accent); }
.detail-position { font-size: 12px; color: var(--muted); margin: 7px 0 0; }
.detail-notes { font-size: 13px; line-height: 1.75; color: #696770; margin: 20px 0 0; }
.detail-notes p { margin: 0 0 12px; }
.description-citation { font-size: 10px; color: var(--accent); text-decoration: none; vertical-align: super; white-space: nowrap; }
.description-citation:hover { text-decoration: underline; }
.description-sources { font-size: 11px; color: var(--muted); line-height: 1.8; margin-top: 14px; }
.description-sources summary { cursor: pointer; }
.description-sources ol { padding-left: 20px; }
.description-sources a { text-underline-offset: 3px; }
.examples-heading { display: flex; gap: 15px; align-items: baseline; justify-content: space-between; margin: 26px 0 14px; }
.examples-heading h3 { margin: 0; font-size: 14px; font-weight: 550; }
.examples-heading > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.example-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; }
.example-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 21px 12px 17px; gap: 13px; min-height: 162px; min-width: 0; background: #fffefa; border: 1px solid var(--border); border-radius: 12px; }
.example-glyph { font-size: 53px; }
.example-meaning { font-size: 12px; color: #696770; line-height: 1.5; text-align: center; overflow-wrap: anywhere; }
.example-badge { color: #786585; background: #f0ebf4; border-radius: 4px; padding: 3px 5px; font-size: 9px; text-align: center; }
.examples-footnote { margin: 22px 0 0; font-size: 11px; color: var(--muted); line-height: 1.8; }
.example-sources { margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.example-sources summary { cursor: pointer; }
.example-sources p { line-height: 1.8; }
.example-sources a { text-underline-offset: 3px; }
@media (min-width: 1400px) { .site-header, main, footer { width: min(1200px, calc(100% - 112px)); } }
@media (max-width: 640px) {
  .reference-controls { gap: 8px; align-items: flex-end; }
  .reference-controls .font-picker { display: block; }
  .reference-controls .font-picker legend { float: none; margin-bottom: 6px; font-size: 10px; }
  .reference-controls .font-picker:not(.sort-picker) legend { text-align: right; width: 100%; }
  .reference-controls .font-options span { font-size: 10px; padding: 7px 6px; }
  .site-header, main, footer { width: calc(100% - 36px); }
  .site-header { height: 80px; }
  .brand { font-size: 20px; gap: 9px; }
  .brand-mark { height: 32px; width: 56px; font-size: 21px; }
  .home-link { font-size: 11px; }
  .eyebrow { font-size: 9px; margin-bottom: 15px; }
  input { font-size: 16px; padding: 17px 0; }
  .search-box { padding-inline: 13px; gap: 9px; }
  .search-meta { font-size: 10px; }
  .radical-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .radical-card { min-height: 134px; padding: 17px 5px 14px; gap: 11px; border-radius: 10px; }
  .radical-glyph { font-size: 46px; }
  .radical-meaning { font-size: 11px; }
  .position-label { font-size: 9px; }
  .reference-note { justify-content: start; margin: 25px 0 30px; font-size: 11px; gap: 8px; }
  footer { flex-direction: column; gap: 14px; }
  .about-collection summary { text-align: left; }
  .radical-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 16px; }
  .dialog-content { padding: 23px 18px; }
  .dialog-close-form { top: 15px; right: 15px; }
  .detail-header { gap: 15px; padding-right: 30px; }
  .detail-header h2 { font-size: 24px; }
  .detail-header .eyebrow { font-size: 8px; letter-spacing: 1.2px; }
  .detail-glyph { font-size: 64px; min-width: 70px; }
  .detail-notes { font-size: 12px; }
  .example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .example-card { min-height: 145px; padding: 17px 10px; }
  .example-glyph { font-size: 46px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
