/* search.css — 药丸搜索栏 + 下拉结果；名词弹窗 */
.searchbar {
  position: relative; display: flex; align-items: center; gap: 0.5rem;
  flex: 0 1 300px; min-width: 200px; max-width: 320px;
  background: var(--surface); border-radius: 999px;
  padding: 0.3rem 0.85rem;
  transition: background 0.16s, box-shadow 0.18s;
}
.searchbar:focus-within {
  background: var(--bg);
  /* taste-skill-ignore */ box-shadow: 0 0 0 2px var(--accent);
}
.searchbar svg { flex: none; width: 15px; height: 15px; stroke: var(--muted); transition: stroke 0.16s; }
.searchbar:focus-within svg { stroke: var(--accent); }
.searchbar input {
  flex: 1; min-width: 0; border: 0; background: none; font: inherit;
  font-size: 0.875rem; color: var(--ink); padding: 0.3rem 0; outline: none;
}
.searchbar input::placeholder { color: var(--muted); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.sclear {
  display: none; border: 0; background: var(--sunken); color: var(--ink);
  width: 18px; height: 18px; border-radius: 99px; cursor: pointer;
  font-size: 0.75rem; line-height: 1; flex: none; padding: 0;
}
.searchbar.has-value .sclear { display: block; }
.sclear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sdrop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  min-width: 330px; max-height: min(58vh, 460px); overflow-y: auto;
  background: var(--bg); border-radius: var(--r-md); padding: 0.35rem;
  /* taste-skill-ignore */ box-shadow: 0 14px 34px rgba(16, 20, 14, 0.18);
  display: none; z-index: 60;
}
.sdrop.show { display: block; }
.sitem {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 0.55rem 0.65rem; border-radius: var(--r-sm); cursor: pointer;
}
.sitem:hover, .sitem:focus-visible { background: var(--surface); outline: none; }
.sitem b { display: block; font-size: 0.9375rem; font-weight: 600; color: var(--ink); }
.sitem span { display: block; font-size: 0.8125rem; color: var(--muted); margin-top: 0.15rem; line-height: 1.5; }
.sitem mark { background: var(--accent); color: var(--accent-ink); border-radius: 2px; padding: 0 0.1em; }
.sdrop-empty { padding: 0.7rem 0.65rem; font-size: 0.8125rem; color: var(--muted); }

@media (max-width: 1099px) {
  .searchbar { order: 3; flex: 1 0 100%; max-width: none; margin-top: 0.35rem; }
  .sdrop { min-width: 0; left: 0; right: 0; }
}

/* ---------- 名词弹窗 ---------- */
.gd { position: fixed; inset: 0; z-index: 72; display: none; background: var(--scrim); padding: min(10vh, 80px) var(--gutter); }
.gd.show { display: block; }
.gd-panel {
  max-width: 560px; margin: 0 auto; background: var(--bg);
  border-radius: var(--r-md); padding: clamp(1.1rem, 3vw, 1.6rem);
  /* taste-skill-ignore */ box-shadow: 0 18px 46px rgba(16, 20, 14, 0.24);
  display: grid; gap: 0.7rem;
}
.gd-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.gd-term { font-family: var(--serif); font-size: clamp(1.25rem, 3.4vw, 1.6rem); letter-spacing: -0.02em; font-weight: 600; }
.gd-close { background: var(--surface); border: 0; border-radius: var(--r-sm); width: 32px; height: 32px; cursor: pointer; color: var(--ink); flex: none; }
.gd-close:hover { background: var(--sunken); }
.gd-one { font-size: var(--body); line-height: 1.65; }
.gd-more { font-size: 0.9375rem; line-height: 1.75; color: var(--muted); }
.gd-link { justify-self: start; font-size: 0.875rem; color: var(--accent); text-decoration: underline; text-underline-offset: 0.28em; padding-block: 0.2rem; }
.gd-row { cursor: pointer; }
.gd-row:hover td { background: var(--sunken); }
.gd-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 640px) { .gd { padding: 0; } .gd-panel { border-radius: 0; min-height: 100%; } }


/* 顶栏：标记在左，搜索与导航靠右 */
.top .nav { margin-left: auto; }
@media (max-width: 1099px) { .top .nav { margin-left: 0; } }
