:root {
  color-scheme: light;
  --ink: #111;
  --muted: #666;
  --faint: #8a8a8a;
  --line: #bdbdbd;
  --soft-line: #dedede;
  --paper: #fff;
  --wash: #f6f6f6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.4;
}

button, input { font: inherit; }

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 32px auto;
}

.intro { margin: 0 0 22px; }
.eyebrow { margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .14em; }
.intro h1 { margin: 0 0 9px; font-size: clamp(30px, 5vw, 44px); line-height: 1.05; letter-spacing: -.035em; }
.intro p { max-width: 620px; margin: 0; color: #333; font-size: 14px; line-height: 1.65; }

.search-panel { margin-bottom: 24px; }
.searchbar { display: flex; align-items: center; gap: 10px; }
.searchbar input {
  width: 100%; min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); font-size: 17px; outline: none;
}
.searchbar input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.searchbar input::-webkit-search-cancel-button { filter: grayscale(1) brightness(0); opacity: 1; }
.searchbar button, .chip {
  border: 1px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); cursor: pointer;
}
.searchbar button { flex: 0 0 auto; padding: 11px 18px; font-size: 14px; }
.searchbar button:hover, .chip:hover { background: var(--ink); color: var(--paper); }
.search-meta { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px 0; color: var(--muted); font-size: 12px; }
.text-button { border: 0; padding: 0; background: none; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.recent { margin: 0 0 26px; }
.recent h2, .results-title { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 11px; font-size: 12px; }

.state { margin-top: 24px; color: var(--muted); font-size: 13px; }
.state .rule { border-top: 1px solid var(--line); }
.state p { margin: 14px 0; }
.state.error { color: #222; }
.state[hidden] { display: none; }

.results { display: grid; gap: 28px; }
.result-group { display: grid; gap: 10px; }
.result-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.result-group-head h2 { margin: 0; font-size: 15px; }
.result-group-head span { color: var(--muted); font-size: 11px; }
.source-cards { display: grid; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 15px; background: var(--paper); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.source-card { padding: 0; overflow: hidden; }
.source-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 11px 15px; border-bottom: 1px solid var(--line); background: var(--wash); }
.source-card-head h3 { margin: 0; font-size: 12px; letter-spacing: .035em; }
.source-card-head span { color: var(--muted); font-size: 10px; }
.source-entries { display: grid; }
.source-entry { padding: 15px; }
.source-entry + .source-entry { border-top: 1px solid var(--soft-line); }
.word { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.015em; overflow-wrap: anywhere; }
.pronunciation { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pos-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pos-tag { border: 1px solid var(--soft-line); border-radius: 999px; padding: 3px 7px; color: #444; background: var(--wash); font-size: 10px; }
.badge { flex: 0 0 auto; border: 1px solid var(--soft-line); border-radius: 999px; padding: 4px 7px; color: var(--muted); font-size: 9px; letter-spacing: .04em; }
.translations { margin: 12px 0 0; padding-left: 19px; }
.translations li { margin: 5px 0; color: #222; font-size: 14px; line-height: 1.55; }
.traditional { margin-left: 7px; color: var(--muted); font-size: 13px; font-weight: 400; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.example-list { display: grid; gap: 10px; }
.example { border-left: 2px solid var(--ink); padding: 2px 0 2px 13px; }
.example p { margin: 0; font-size: 14px; line-height: 1.6; }
.example .example-zh { margin-top: 3px; color: #333; }
.example-source { margin-top: 6px; color: var(--faint); font-size: 10px; }
.example-source a { color: var(--muted); }
.more-examples { margin-top: 2px; }
.more-examples summary { width: fit-content; border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; color: #333; font-size: 11px; cursor: pointer; list-style: none; }
.more-examples summary::-webkit-details-marker { display: none; }
.more-examples[open] summary { margin-bottom: 10px; }
.more-examples .example-list { padding-top: 2px; }

footer { margin-top: 60px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.65; }
footer p { margin: 0 0 5px; }
a, a:visited { color: var(--ink); text-decoration-color: #999; text-underline-offset: 3px; }
.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; }

@media (max-width: 560px) {
  .shell { margin-top: 22px; }
  .searchbar { align-items: stretch; }
  .searchbar button { padding-inline: 15px; }
  .card { padding: 13px; }
  .source-card { padding: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .card { animation: enter .18s ease-out both; }
  @keyframes enter { from { opacity: 0; transform: translateY(3px); } }
}
