
/* ===== Hanzi Tool Header v3 ===== */
.hz-topbar-wrap { position: sticky; top: 0; z-index: 900; background: var(--bg-secondary); }
.hz-topbar { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 52px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
/* Left: Logo + tool name + nav links */
.hz-topbar-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hz-topbar-logo { text-decoration: none; flex-shrink: 0; }
.hz-topbar-logo-text { font-size: 20px; font-weight: 700; color: var(--text-secondary); letter-spacing: -0.5px; }
.hz-topbar-logo-num { font-variant-numeric: tabular-nums; }
.hz-topbar-tool-name { font-size: 14px; color: var(--text-secondary); text-decoration: none; white-space: nowrap; transition: color .2s; }
.hz-topbar-tool-name:hover { color: var(--accent); }
.hz-topbar-nav-link { font-size: 14px; color: var(--text-secondary); text-decoration: none; white-space: nowrap; transition: color .15s; }
.hz-topbar-nav-link:hover { color: var(--accent); }
.hz-topbar-sep { color: var(--text-dim); font-size: 12px; user-select: none; }
.hz-topbar-sep-nav { color: var(--text-dim); font-size: 14px; user-select: none; margin: 0 2px; }
/* Center: Search */
.hz-topbar-search { flex: 1; max-width: 480px; margin: 0 8px; }
.hz-topbar-search form { margin: 0; display: flex; align-items: center; }
.hz-search-input-wrap { display: flex; align-items: center; background: var(--bg-tertiary); border-radius: var(--radius); transition: background .2s; flex: 1; min-width: 0; }
.hz-search-input-wrap:focus-within { background: var(--bg-hover, var(--bg-tertiary)); }
.hz-search-icon { font-size: 13px; color: var(--text-muted); flex-shrink: 0; padding-left: 12px; }
.hz-search-input { flex: 1; min-width: 0; border: none; background: transparent; padding: 8px 10px; font-size: 14px; color: var(--text-primary); outline: none; }
.hz-search-input::placeholder { color: var(--text-dim); }
.hz-search-clear-btn { background: none; border: none; color: var(--text-muted); padding: 4px 8px; cursor: pointer; font-size: 12px; flex-shrink: 0; display: none; }
.hz-search-input:not(:placeholder-shown) ~ .hz-search-clear-btn { display: block; }
.hz-search-submit { background: none; border: none; color: var(--text-muted); padding: 8px 12px; font-size: 14px; cursor: pointer; transition: color .15s; flex-shrink: 0; }
.hz-search-submit:hover { color: var(--accent); }
/*浅色模式：搜索框背景略深于导航栏(--bg-secondary)，突出可输入/可点击的层级区分*/
html.light .hz-search-input-wrap { background: #d9d3c8; border: 1px solid rgba(0,0,0,.08); }
html.light .hz-search-input-wrap:focus-within { background: #ffffff; border-color: var(--accent, #1b6b3a); box-shadow: 0 0 0 2px rgba(27,107,58,.22); }
/* 输入框本体被全局 input 规则注入 --input-bg 不透明背景而遮挡上面的加深色，需强制透明以露出容器背景 */
html.light .hz-search-input { background: transparent !important; }
/* Right: tool buttons */
.hz-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* Icon+text buttons */
.hz-topbar-btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; height: 38px; padding: 0 14px; border-radius: var(--radius-full); border: none; background: transparent; color: var(--text-secondary); font-size: 14px; cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap; }
.hz-topbar-btn:hover { background: var(--bg-tertiary); color: var(--accent); }
.hz-topbar-btn i { font-size: 14px; }
/* Dropdown panel */
.hz-dropdown-wrap { position: relative; }
.hz-dropdown-panel { display: none; position: absolute; top: calc(100% + 8px); right: 0; width: 300px; max-height: 400px; overflow-y: auto; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 8px 0; z-index: 100; }
.hz-dropdown-wrap.open .hz-dropdown-panel { display: block; }
.hz-dropdown-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.hz-dropdown-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 4px; transition: all .15s; }
.hz-dropdown-header button:hover { color: #ef4444; background: rgba(239,68,68,.08); }
.hz-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 16px; text-decoration: none; transition: background .1s; }
.hz-dropdown-item:hover { background: var(--bg-surface); }
.hz-dropdown-item .hz-di-type { font-size: 12px; color: var(--text-muted); min-width: 28px; flex-shrink: 0; }
.hz-dropdown-item .hz-di-content { font-size: 14px; color: var(--text-primary); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hz-dropdown-item .hz-di-sub { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.hz-dropdown-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--text-muted); }
.hz-dropdown-footer { padding: 8px 16px; text-align: center; }
.hz-dropdown-footer a { font-size: 13px; color: var(--accent); text-decoration: none; }
.hz-dropdown-footer a:hover { text-decoration: underline; }
/* Dropdown item delete button */
.hz-di-delete { background: none; border: none; color: var(--text-dim); font-size: 11px; cursor: pointer; padding: 2px 6px; border-radius: 4px; opacity: 0; transition: all .15s; flex-shrink: 0; }
.hz-dropdown-item:hover .hz-di-delete { opacity: 1; }
.hz-di-delete:hover { color: #ef4444; background: rgba(239,68,68,.08); }
/* Mobile search trigger */
.hz-search-mobile-trigger { display: none; }
/* Mobile search overlay */
.hz-mobile-search-overlay { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.5); }
.hz-mobile-search-overlay.active { display: flex; align-items: flex-start; justify-content: center; padding-top: 80px; }
.hz-mobile-search-bar { width: 90%; max-width: 480px; background: var(--bg-secondary); border-radius: var(--radius-lg); padding: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.hz-mobile-search-inner { display: flex; align-items: center; gap: 6px; }
.hz-mobile-search-inner input { flex: 1; border: none; background: var(--bg-card); border-radius: var(--radius); padding: 10px 14px; font-size: 15px; color: var(--text-primary); outline: none; }
.hz-mobile-search-submit { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 8px; flex-shrink: 0; }
.hz-mobile-search-submit:hover { color: var(--accent); }
.hz-mobile-search-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 8px; }
/* Responsive */
/* ===== 英文版中窄屏（2026-09-17）：顶栏教学链接让位移动二级条，消除横向溢出 =====
   en 顶栏完整内容（5 个导航链接 + 长英文按钮标签）固定需求宽约 1139px，769–1180px 视口
   会横向溢出（整页横滚、右端按钮被裁）；此处隐藏顶栏导航链接（由二级条 5 chips 承接入口），
   更窄（≤920px）时右区按钮图标化。zh 顶栏左区仅 ~250px 无此问题，用 html[lang="en"] 精确隔离。 */
@media (min-width: 769px) and (max-width: 1180px) {
  html[lang="en"] .hz-topbar-nav-link { display: none; }
  html[lang="en"] .hz-topbar-left .hz-topbar-sep { display: none; }
  html[lang="en"] .hz-subnav-wrap { display: block; }
}
@media (min-width: 769px) and (max-width: 920px) {
  html[lang="en"] .hz-topbar-btn span { display: none; }
  html[lang="en"] .hz-topbar-btn { padding: 0 10px; min-width: 40px; }
  html[lang="en"] .hz-topbar-btn i { font-size: 17px; color: var(--text-primary); }
}
@media (max-width: 768px) {
  .hz-topbar-search { display: none; }
  .hz-topbar-sep { display: none; }
  /* 移动端：隐藏左区低频导航链接（字帖已在右区按钮），避免与右区按钮挤压溢出 */
  .hz-topbar-nav-link { display: none; }
  .hz-search-mobile-trigger { display: inline-flex; }
  .hz-topbar-btn span { display: none; }
  /* ⚠️ 工具名（中文“字词通典”比英文长）在窄屏允许收缩省略，防挤压右区按钮 */
  .hz-topbar-left { flex-wrap: nowrap; }
  .hz-topbar-tool-name { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 38vw; }
  /* 品牌区（logo·工具名）在移动端紧凑成一体：去分隔符额外 margin，gap 交由断点控制 */
  .hz-topbar-sep-nav { margin: 0; }
  .hz-dropdown-panel { width: calc(100vw - 24px); max-width: 300px; max-height: calc(100vh - 70px); top: 44px; right: -8px; }
  /* ⚠️ 移动端导航重构：增大图标+合理间距+呼吸感 */
  .hz-topbar { padding: 0 12px; gap: 8px; height: 50px; }
  .hz-topbar-left { gap: 5px; }
  .hz-topbar-logo-text { font-size: 19px; }
  .hz-topbar-right { margin-left: auto; gap: 6px; }
  .hz-topbar-btn { 
    padding: 0 10px; 
    min-width: 40px; 
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .hz-topbar-btn i { 
    font-size: 18px; 
    /* ⚠️ 移动端图标 label 隐藏、纯图标导航：图标色抬高到主文字色提高可点控件的可发现性，hover 仍转强调绿 */
    color: var(--text-primary); 
  }
  .hz-topbar-btn:active i { color: var(--accent); }
}
@media (max-width: 480px) {
  .hz-topbar { padding: 0 8px; gap: 6px; }
  .hz-topbar-left { gap: 3px; }
  .hz-topbar-right { gap: 3px; }
  .hz-topbar-btn { padding: 0 6px; min-width: 32px; height: 34px; }
  .hz-topbar-btn i { font-size: 17px; }
}
@media (max-width: 360px) {
  .hz-topbar { padding: 0 6px; gap: 4px; height: 48px; }
  .hz-topbar-logo-text { font-size: 16px; }
  .hz-topbar-left { gap: 2px; }
  .hz-topbar-right { gap: 2px; }
  .hz-topbar-btn { padding: 0 4px; min-width: 28px; height: 32px; }
  .hz-topbar-btn i { font-size: 15px; }
}
/* ===== 搜索历史下拉面板 ===== */
.hz-search-history-panel {
  position: fixed; top: 0; left: 0; z-index: 1100;
  min-width: 300px; max-width: 420px;
  pointer-events: none; opacity: 0; transform: scale(0.95);
  transition: opacity .15s ease, transform .15s ease;
}
.hz-search-history-panel.show {
  pointer-events: auto; opacity: 1; transform: scale(1);
}
.hz-search-history-inner {
  background: var(--bg-card);
  border-radius: 14px; padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
  border: 1px solid var(--border);
}
.hz-search-history-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px 10px; font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.hz-search-history-clear {
  background: none; border: none; color: var(--text-muted); font-size: 12px;
  cursor: pointer; padding: 2px 6px; border-radius: 4px; opacity: .65; font-weight: 400;
}
.hz-search-history-clear:hover { color: #ef4444; background: rgba(239,68,68,.1); opacity: 1; }
.hz-search-history-list { padding: 2px; }
.hz-search-history-tags { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.hz-search-history-tag {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(var(--accent-rgb, 34, 197, 94), .08);
  border: 1px solid transparent; color: var(--accent); font-size: 13px; cursor: pointer;
  transition: all .18s ease;
}
.hz-search-history-tag:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.hz-search-history-tag-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hz-search-history-tag-del {
  background: none; border: none; color: inherit; cursor: pointer; font-size: 11px;
  padding: 2px 4px; border-radius: 50%; opacity: 0; transition: opacity .2s;
}
.hz-search-history-tag:hover .hz-search-history-tag-del { opacity: .8; }
.hz-search-history-empty { color: var(--text-muted); font-size: 13px; width: 100%; text-align: center; padding: 10px 8px; }
@media (max-width: 767px) {
  .hz-search-history-panel { left: 50% !important; transform: translateX(-50%) scale(0.95) !important; width: calc(100vw - 32px) !important; max-width: 420px; }
  .hz-search-history-panel.show { transform: translateX(-50%) scale(1) !important; }
  .hz-search-history-tag-del { display: none; }
}
/* ===== 导航当前位置高亮（2026-09-12） ===== */
.hz-topbar-nav-link.active { color: var(--accent); font-weight: 600; }
/* ===== 移动端二级教学导航条（桌面隐藏；补齐移动端被隐藏的导航链接入口，2026-09-12） ===== */
.hz-subnav-wrap { display: none; background: var(--bg-secondary); }
.hz-subnav { max-width: 1200px; margin: 0 auto; display: flex; gap: 8px; padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.hz-subnav::-webkit-scrollbar { display: none; }
.hz-subnav-chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; background: var(--bg-tertiary); color: var(--text-secondary); font-size: 13px; font-weight: 500; text-decoration: none; transition: all .15s; }
.hz-subnav-chip i { font-size: 12px; }
.hz-subnav-chip.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.hz-subnav-chip:active { background: var(--accent); color: #fff; }
@media (max-width: 768px) {
  .hz-subnav-wrap { display: block; }
  /* zh 移动端隐藏顶部字帖按钮（字帖已入二级条，防重复入口；en 不隐藏，2026-09-21） */
  .hz-zitie-mob-hide { display: none; }
}
/* ===== 页面操作条（打印 / 复制链接；资源页通用，复用 WgUtils.copyText 与 window.print，2026-09-12） ===== */
.hz-page-actions { display: flex; justify-content: flex-end; gap: 8px; margin: -8px 0 20px; }
.hz-page-action { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border: none; border-radius: 999px; background: var(--bg-card); color: var(--text-secondary); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; font-family: inherit; }
.hz-page-action i { font-size: 13px; }
.hz-page-action:hover { background: var(--accent-bg); color: var(--accent); }
@media (max-width: 640px) { .hz-page-actions { justify-content: flex-start; margin: 0 0 16px; } }
/* ===== 英文版零基础钩子（Google 落地字/词页的新访客引导条，2026-09-12） ===== */
.hz-newbie-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; background: var(--accent-bg); border-radius: var(--radius); padding: 10px 16px; margin-top: 14px; font-size: 14px; }
.hz-newbie-label { display: inline-flex; align-items: center; gap: 7px; color: var(--text-primary); font-weight: 600; }
.hz-newbie-label i { color: var(--accent); font-size: 13px; }
.hz-newbie-hint a { color: var(--accent); font-weight: 600; text-decoration: none; }
.hz-newbie-hint a:hover { text-decoration: underline; }
.hz-newbie-sep { color: var(--text-dim); }
/* ===== 打印：隐藏移动导航与操作按钮（仅覆盖本文件引入的新元素，不干扰字页既有 print 规则） ===== */
@media print {
  .hz-subnav-wrap, .hz-page-actions, .hz-newbie-hint { display: none !important; }
}
