/* ===== 站内搜索浮层样式（zmo 补，2026-11-10） =====
   JS 与模板早已上线，但缺少面板样式，导致搜索框裸奔、文字叠在页面上。
   这里用“命令面板”式浮层：全屏遮罩 + 居中卡片，深浅色都走主题变量。 */

#tp-search.zm-search {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: min(14vh, 140px) 16px 24px;
  background: rgba(31, 26, 23, 0.30);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  font-family: var(--font-main);
  color: var(--text-body);
}

#tp-search.zm-search[hidden] {
  display: none !important;
}

:root[data-theme="dark"] #tp-search.zm-search {
  background: rgba(0, 0, 0, 0.55);
}

/* ---- 输入条 ---- */
.zm-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(620px, 100%);
  padding: 12px 14px;
  background: var(--bg-float);
  border: 1px solid var(--line-primary);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(20, 16, 12, 0.24);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.zm-search-box:focus-within {
  border-color: var(--accent-gold);
  box-shadow: 0 18px 48px rgba(20, 16, 12, 0.24), 0 0 0 3px rgba(167, 140, 99, 0.18);
}

.zm-search-box > svg {
  flex: 0 0 auto;
  color: var(--text-secondary);
}

.zm-search-box input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 2px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px; /* ≥16px 防 iOS 聚焦缩放 */
  line-height: 1.4;
}

.zm-search-box input::placeholder {
  color: var(--text-muted);
}

.zm-search-box button {
  flex: 0 0 auto;
  padding: 8px 16px;
  border: 1px solid var(--control-active-border);
  border-radius: 10px;
  background: var(--control-active-bg);
  color: var(--control-active-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  transition: filter .2s ease, transform .2s ease;
}

.zm-search-box button:hover {
  filter: brightness(1.08);
}

.zm-search-box button:active {
  transform: translateY(1px);
}

/* ---- 结果面板 ---- */
.zm-search-panel {
  width: min(620px, 100%);
  max-height: min(52vh, 420px);
  margin-top: 10px;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-float);
  border: 1px solid var(--line-primary);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(20, 16, 12, 0.22);
}

.zm-search-panel[hidden] {
  display: none !important;
}

.zm-search-head {
  padding: 8px 10px 4px;
  font-size: 12px;
  letter-spacing: .03em;
  color: var(--text-muted);
}

.zm-search-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 9px;
  color: inherit;
  text-decoration: none;
}

.zm-search-row:hover,
.zm-search-row.is-active {
  background: var(--bg-soft);
}

.zm-search-row:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 1px;
}

.zm-search-row-title {
  display: block;
  overflow: hidden;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zm-search-row-sub {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.zm-search-more {
  display: block;
  margin-top: 4px;
  padding: 9px 10px;
  border-top: 1px dashed var(--line-soft);
  border-radius: 0 0 9px 9px;
  font-size: 13px;
  text-align: center;
  color: var(--accent-brown) !important;
  text-decoration: none;
}

.zm-search-more:hover {
  color: var(--accent-gold) !important;
}

.zm-search-clear {
  display: block;
  padding: 8px 10px;
  font-size: 12.5px;
  text-align: right;
  color: var(--text-muted) !important;
  text-decoration: none;
}

.zm-search-clear:hover {
  color: var(--accent-brown) !important;
}

.zm-search-hint {
  width: min(620px, 100%);
  margin: 10px 0 0;
  font-size: 12px;
  text-align: center;
  color: rgba(247, 244, 238, 0.72);
}

.zm-search-hint[hidden] {
  display: none !important;
}

/* ---- 窄屏 ---- */
@media (max-width: 640px) {
  #tp-search.zm-search {
    padding: 64px 12px 20px;
  }

  .zm-search-panel {
    max-height: min(58vh, 460px);
  }

  .zm-search-row-title {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

/* 触屏设备没有方向键，提示无意义 */
@media (pointer: coarse) {
  .zm-search-hint {
    display: none !important;
  }
}
