/* One search component; Chinese has its own type scale and regional faces. */
:root, html body.home-page {
  --cjk-sc: 'Noto Sans SC', 'Noto Sans TC', 'Zimai Rare Han', 'Zimai IDS', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --cjk-tc: 'Noto Sans TC', 'Noto Sans SC', 'Zimai Rare Han', 'Zimai IDS', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --han-display-sc: 'Noto Serif SC', 'Noto Serif TC', 'Noto Sans SC', 'Noto Sans TC', 'Zimai Rare Han', 'Zimai IDS', 'Songti SC', serif;
  --han-display-tc: 'Noto Serif TC', 'Noto Serif SC', 'Noto Sans TC', 'Noto Sans SC', 'Zimai Rare Han', 'Zimai IDS', 'Songti TC', serif;
  --sans: 'IBM Plex Sans', 'Zimai Tone Fallback', 'Noto Sans SC', 'Noto Sans TC', 'Zimai Rare Han', 'Zimai IDS', sans-serif;
  --definition-size: 1.125rem;
  --reading-size: 1.125rem;
  --han-text-size: 1.375rem;
}
:root[data-reading-size='large'], html[data-reading-size='large'] body.home-page {
  --definition-size: 1.25rem;
  --reading-size: 1.25rem;
  --han-text-size: 1.5rem;
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-kerning: normal; -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; }
/* Do not force grayscale smoothing, squeeze strokes, or synthesize CJK italics. */
[lang|='zh'], .han, .ids-leaf, .dictionary-headword {
  font-synthesis: none; font-kerning: normal; letter-spacing: 0;
  line-break: strict; word-break: normal; font-variant-ligatures: normal;
}
[lang='zh'], [lang='zh-Hant'], [lang='zh-TW'], [lang='zh-Hant-TW'] { font-family: var(--cjk-tc); }
[lang='zh-Hans'], [lang='zh-CN'], [lang='zh-Hans-CN'] { font-family: var(--cjk-sc); }
.han, .word-identity h1, .word-opening h1, .portrait-glyph, .search-intro-mark,
.catalog-identity > div:first-child, .home-glyph-stage > .han,.word-identity h2,.word-opening h2 { font-family: var(--han-display-tc); font-weight: 400; letter-spacing: 0; }
.han[lang='zh-Hans'], .word-identity h1[lang='zh-Hans'], .portrait-glyph[lang='zh-Hans'],
.catalog-identity > div[lang='zh-Hans'], .home-glyph-stage > .han[lang='zh-Hans'],.word-identity h2[lang='zh-Hans'] { font-family: var(--han-display-sc); }
.dictionary-headword [lang], .collection-word > [lang], .home-word-list > a > [lang],
.connection-row-glyph, .component-search-hit > [lang], .ids-leaf > [lang],
.comparison-pair [lang], .connection-path a[lang] { font-weight: 400; letter-spacing: 0; line-height: 1.5; }
.dictionary-headword mark { font-family: inherit; }
.word-identity h1, .collection-inspector .word-identity h1,.word-identity h2,.collection-inspector .word-identity h2 { line-height: 1.45; overflow-wrap: anywhere; }
.example-chinese, .examples blockquote p[lang], .examples .simplified-example {
  font-size: var(--han-text-size); line-height: 1.85; letter-spacing: .015em;
}
.source-line { font-family: var(--sans); font-size: 1rem; line-height: 1.75; }
.ids-leaf > [lang] { font-family: var(--cjk-tc); font-size: 2rem; }
.connection-row .connection-row-glyph { font-size: 1.75rem; }
.connection-row .connection-row-glyph[lang='zh-Hans'] { font-family: var(--cjk-sc); }
.connection-row .connection-row-glyph[lang='zh-Hant'] { font-family: var(--cjk-tc); }
.comparison-pair [lang] { font-size: 2.25rem; }
.connection-row-body > span, .component-search-hit p { font-size: var(--related-size); line-height: 1.6; }
.lexical-characters dt [lang] { font-size: 2rem; line-height: 1.5; }
.detail-note p, .detail-note li, .catalog-definitions li { line-height: 1.65; }

/* Children own their width. Search cannot push clear/submit outside the bar. */
.global-search-inner { display: flex; align-items: center; gap: 12px; min-width: 0; }
.global-search-bar .search-form, .search-form {
  display: flex; align-items: center; gap: 8px; flex: 1 1 0%;
  width: 100%; min-width: 0; max-width: none; height: auto; min-height: 66px;
  margin: 0; padding: 6px; box-sizing: border-box;
  border: 1px solid var(--rule); border-radius: 12px;
  background: var(--white); box-shadow: 0 2px 8px #20232206;
  overflow: visible;
}
.search-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
.search-form .search-icon {
  display: block; flex: 0 0 22px; width: 22px; min-width: 22px; height: 22px;
  margin: 0 2px 0 10px; color: var(--accent); stroke: currentColor; stroke-width: 1.75; fill: none;
}
.search-form input {
  appearance: none; -webkit-appearance: none; flex: 1 1 0%;
  width: 0; min-width: 0; max-width: 100%; height: auto; min-height: 50px;
  margin: 0; padding: 6px 0; border: 0; border-radius: 0;
  font: 400 1.5rem/1.5 var(--sans); letter-spacing: 0;
  background: transparent; color: var(--ink); caret-color: var(--accent);
  outline: none; box-shadow: none;
}
.search-form input::placeholder { color: var(--muted); opacity: 1; font-size: 1.125rem; }
.search-form input::-webkit-search-cancel-button { display: none; }
.search-form input::-webkit-search-decoration { -webkit-appearance: none; }
.search-form > button {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  min-height: 46px; height: auto; margin: 0; border: 0; cursor: pointer;
  letter-spacing: 0; white-space: nowrap;
}
.search-form > button[type='submit'] {
  min-width: 92px; padding: 12px 18px; border-radius: 8px;
  background: var(--signal); color: var(--signal-ink); font: 500 1rem/1.35 var(--sans);
}
.search-form > button[type='submit']:hover { filter: brightness(.94); }
.search-form .search-clear {
  width: 44px; min-width: 44px; padding: 0; border-radius: 8px;
  font: 400 1.625rem/1 var(--sans); background: transparent; color: var(--muted);
}
.search-form .search-clear:hover { background: var(--surface); color: var(--ink); }
.search-form [hidden] { display: none !important; }
.search-form > button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-search-below, .home-page .home-search-below {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 6px 18px; min-width: 0; margin-top: 8px; color: var(--muted); font-size: .8125rem;
}
.home-search-below > div, .home-page .home-search-below > div {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0;
}
.home-search-below a, .home-page .home-search-below a {
  display: inline-flex; align-items: center; min-height: 32px; max-width: 100%;
  padding: 2px 0; border: 0; background: none; color: var(--ink);
  font-size: .875rem; text-decoration: underline; text-decoration-color: var(--rule);
  text-underline-offset: 4px; overflow-wrap: anywhere;
}
.home-search-below a[lang|='zh'] { font-size: 1.0625rem; }
.search-key-hint { margin: 0; font-size: .75rem; white-space: nowrap; }
.search-recents { min-width: 0; }
.search-recents > button { max-width: 100%; overflow-wrap: anywhere; }
.global-search-results { max-height: min(70dvh, 720px); overflow-y: auto; overscroll-behavior: contain; }
.unified-word-hit > [lang] { font-size: 1.625rem; line-height: 1.5; }
.unified-word-hit > span:last-child { font-size: 1rem; line-height: 1.5; }
@media (max-width: 600px) {
  .global-search-bar .search-form, .search-form { gap: 4px; min-height: 60px; padding: 5px; border-radius: 10px; }
  .search-form input { min-height: 48px; font-size: 1.25rem; }
  .search-form input::placeholder { font-size: 1rem; }
  .search-form > button[type='submit'] { min-width: 72px; padding: 10px 12px; font-size: .9375rem; }
  .home-search-below > span { display: none; }
  .search-key-hint { display: none; }
}
@media (max-width: 420px) {
  .search-form .search-icon { display: none; }
  .search-form input { padding-left: 7px; }
}
@media (forced-colors: active) {
  .search-form { border-color: CanvasText; }
  .search-form:focus-within { outline: 2px solid Highlight; }
  .search-form > button[type='submit'] { border: 1px solid ButtonText; }
}
