:root {
  --global-search-red: #d33a3a;
  --global-search-border: rgba(255, 255, 255, 0.11);
  --global-search-panel: rgba(14, 14, 17, 0.96);
}

body.global-search-open { overflow: hidden !important; }

/* 首页入口：三枚克制的线条按钮，贴齐导航网格右下角。 */
.home-utility-tools {
  position: absolute;
  right: 16px;
  bottom: -58px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.home-line-tool {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,10,12,.22);
  color: #65656b;
  text-decoration: none;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}
.home-line-tool svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.home-line-tool img { width: 17px; height: 17px; opacity: .68; transition: opacity .2s ease; }
.home-line-tool::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 5;
  right: -1px;
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: 160px;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(12,12,15,.94);
  color: #a7a7ac;
  font: 400 10px/1 "Noto Sans SC", sans-serif;
  letter-spacing: .5px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity .16s ease, transform .16s ease;
}
.home-line-tool:hover,
.home-line-tool:focus-visible {
  border-color: rgba(166,56,62,.66);
  background: rgba(80,18,23,.09);
  color: #c7c7cb;
  outline: none;
  transform: translateY(-1px);
}
.home-line-tool:hover::after,
.home-line-tool:focus-visible::after { opacity: 1; transform: translateY(0); }
.home-line-tool:hover img,
.home-line-tool:focus-visible img { opacity: 1; }
.home-line-tool.is-loading { opacity: .45; cursor: wait; }

.global-search-overlay {
  position: fixed;
  z-index: 12000;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(8vh, 70px) 22px 24px;
  box-sizing: border-box;
  background: rgba(2, 2, 4, 0.82);
  backdrop-filter: blur(13px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.global-search-overlay.is-open { opacity: 1; visibility: visible; }
.global-search-dialog {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  max-height: min(84vh, 820px);
  border: 1px solid rgba(204, 41, 41, 0.26);
  background: linear-gradient(150deg, rgba(20,20,24,.98), rgba(7,7,9,.985));
  box-shadow: 0 28px 90px rgba(0,0,0,.72), 0 0 45px rgba(130,20,20,.08);
  color: #ddd;
  font-family: "Noto Sans SC", sans-serif;
  transform: translateY(10px);
  transition: transform .25s ease;
  overflow: hidden;
}
.global-search-overlay.is-open .global-search-dialog { transform: translateY(0); }
.global-search-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 27px 17px;
  border-bottom: 1px solid rgba(255,255,255,.055);
}
.global-search-header > div { min-width: 0; }
.global-search-file-id { color: #8d2e2e; font: 600 9px/1 "Space Grotesk", sans-serif; letter-spacing: 2px; }
.global-search-header h2 { overflow: hidden; margin: 7px 0 0; color: #e8e8e9; font: 600 24px/1.2 "Cinzel", "Noto Sans SC", serif; letter-spacing: 2px; text-overflow: ellipsis; white-space: nowrap; }
.global-search-close { flex: 0 0 auto; margin-left: 18px; padding: 0; border: 0; background: none; color: #626267; font: 300 30px/1 sans-serif; cursor: pointer; }
.global-search-close:hover, .global-search-close:focus-visible { color: #d64a4a; outline: none; }
.global-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 27px 13px;
  padding: 0 14px;
  min-height: 48px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.018);
}
.global-search-input-wrap:focus-within { border-color: rgba(211,58,58,.66); box-shadow: 0 0 0 2px rgba(211,58,58,.07); }
.global-search-input-wrap > span { color: #a73838; font-size: 20px; }
.global-search-input-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: #eee; font: 400 15px/1.4 "Noto Sans SC", sans-serif; }
.global-search-input-wrap input::placeholder { color: #54545a; }
.global-search-input-wrap kbd { color: #555; font: 9px "Space Grotesk", sans-serif; }
.global-search-controls { display: flex; align-items: center; gap: 15px; padding: 0 27px; }
.global-search-tabs { display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.global-search-tabs::-webkit-scrollbar { display: none; }
.global-search-tab { flex: 0 0 auto; padding: 7px 9px; border: 0; border-bottom: 1px solid transparent; background: none; color: #666; font: 11px "Noto Sans SC", sans-serif; cursor: pointer; }
.global-search-tab:hover { color: #aaa; }
.global-search-tab.is-active { border-bottom-color: #b83232; color: #e0e0e0; }
.global-search-count { margin-left: auto; flex: 0 0 auto; color: #555; font: 9px "Space Grotesk", sans-serif; letter-spacing: 1px; }
.global-search-status { margin: 10px 27px 12px; color: #555; font: 9px/1.4 "Noto Sans SC", sans-serif; letter-spacing: .5px; }
.global-search-results { overflow-y: auto; padding: 0 27px 25px; scrollbar-width: thin; scrollbar-color: #762626 transparent; }
.global-search-result {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 22px;
  gap: 15px;
  align-items: center;
  min-height: 77px;
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.055);
  color: inherit;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease;
}
.global-search-result:hover, .global-search-result:focus-visible { border-color: rgba(211,58,58,.28); background: rgba(211,58,58,.04); outline: none; }
.global-search-result-visual { position: relative; display: grid; width: 72px; height: 54px; place-items: center; overflow: hidden; background: #101014; color: #3f3f45; font: 600 10px "Space Grotesk", sans-serif; letter-spacing: 1px; }
.global-search-result-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.65) brightness(.72); }
.global-search-result-visual:not(.is-empty) > span { display: none; }
.global-search-result-content { min-width: 0; display: flex; flex-direction: column; }
.global-search-result-meta { display: flex; gap: 10px; align-items: center; color: #555; font: 8px "Space Grotesk", sans-serif; letter-spacing: 1.3px; }
.global-search-result-meta b { color: #a73a3a; font-weight: 600; }
.global-search-result-content > strong { overflow: hidden; margin-top: 6px; color: #dcdcdf; font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result-snippet { overflow: hidden; margin-top: 5px; color: #707076; font-size: 10px; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result-arrow { color: #642626; font-size: 14px; }
.global-search-result:hover .global-search-result-arrow { color: #d34b4b; }
.global-search-empty { display: grid; min-height: 250px; place-items: center; align-content: center; text-align: center; }
.global-search-empty span { color: #642626; font: 9px "Space Grotesk", sans-serif; letter-spacing: 2px; }
.global-search-empty strong { margin-top: 12px; color: #aaa; font-size: 15px; font-weight: 500; }
.global-search-empty p { margin: 8px 0 0; color: #555; font-size: 11px; }

@media (max-width: 720px) {
  .global-search-overlay { padding: 0; }
  .global-search-dialog { width: 100%; height: 100%; max-height: none; border: 0; }
  .global-search-header { padding: 22px 20px 15px; }
  .global-search-header h2 { font-size: 20px; }
  .global-search-input-wrap { margin: 15px 20px 11px; }
  .global-search-controls { align-items: flex-start; flex-direction: column; gap: 7px; padding: 0 20px; }
  .global-search-tabs { width: 100%; }
  .global-search-count { margin-left: 0; }
  .global-search-status { margin: 8px 20px 10px; }
  .global-search-results { padding: 0 12px 20px; }
  .global-search-result { grid-template-columns: 58px minmax(0, 1fr) 16px; gap: 11px; }
  .global-search-result-visual { width: 58px; height: 48px; }
  .home-utility-tools { right: 18px; bottom: -54px; }
}

@media (max-width: 420px) {
  .global-search-result-content > strong { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .global-search-overlay, .global-search-dialog { transition: none; }
}
