* { margin: 0; padding: 0; box-sizing: border-box; font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif; }
a { text-decoration: none; }
html, body { height: 100%; }
body { width: 100%; overflow: hidden; background: #f4f6fa; }

.detail-header { background: #fff; position: sticky; top: 0; z-index: 100; }
.detail-header-inner { margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.detail-header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.detail-logo img { height: 34px; display: block; }
.detail-search { position: relative; max-width: var(--search-w, 600px); flex: 1; --search-radius: 10px; }
.detail-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 14px; }
.detail-search input { width: 100%; padding: 12px 96px 12px 38px; border: 1px solid #e5e7eb; border-radius: var(--search-radius, 10px); font-size: 14px; outline: none; background: #f9fafb; transition: all 0.2s; }
body.search-alwaysdel .detail-search .del { display: flex !important; }
.detail-search input:focus { border-color: #1f6fff; background: #fff; box-shadow: 0 0 0 3px rgba(31, 111, 255, 0.1); }
.detail-search .del { position: absolute; right: 84px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; display: none; align-items: center; justify-content: center; font-size: 16px; line-height: 1; color: #9ca3af; cursor: pointer; background: #e9ebef; transition: all 0.2s; }
.detail-search .del.show { display: flex; }
.detail-search .del:hover { color: #fff; background: #1f6fff; }
.detail-search .del:hover { color: #1f6fff; background: #f3f4f6; }
.detail-search .search-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); height: calc(100% - 8px); padding: 0 16px; border: none; border-radius: 8px; background: #1f6fff; color: #fff; font-size: 14px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background 0.2s; }
.detail-search .search-btn:hover { background: #1557d0; }
.detail-search .search-btn i { font-size: 13px; }
.search-suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12); overflow: hidden; display: none; z-index: 200; }
.search-suggest.show { display: block; }
.search-suggest-item { padding: 10px 16px; font-size: 14px; color: #374151; cursor: pointer; transition: background 0.15s; }
.search-suggest-item:hover, .search-suggest-item.active { background: #f0f7ff; color: #1f6fff; }
.search-suggest-item:last-child { border-radius: 0 0 10px 10px; }
.search-suggest-empty { padding: 14px 16px; font-size: 13px; color: #9ca3af; text-align: center; }
.detail-nav { display: flex; align-items: center; gap: 6px; }
.detail-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; font-size: 14px; color: #4b5563; text-decoration: none; transition: all 0.2s; }
.detail-nav a:hover { background: #f3f4f6; color: #1f6fff; }
.detail-nav a:hover i { animation: fa-shake 1s ease-in-out infinite; }
.detail-nav a.active { color: #1f6fff; font-weight: 600; }

.engines { width: 100%; z-index: 12; }

.engines .sitelist { position: fixed; top: 61px; left: 0; right: 0; height: 52px; z-index: 20; background: #fff; border-bottom: 1px solid #e5e7eb; overflow: hidden; display: flex; align-items: center; }
.engines .sitelist ul { flex: 1 1 auto; padding: 0 8px; overflow-x: auto; white-space: nowrap; display: flex; align-items: center; gap: 4px; scroll-behavior: smooth; scrollbar-width: none; -ms-overflow-style: none; }
.engines .sitelist ul::-webkit-scrollbar { display: none; }
.engines .sitelist ul a { display: inline-flex; align-items: center; text-decoration: none; }
.engines .sitelist-arrow { flex: 0 0 auto; width: 30px; height: 36px; border: none; background: #fff; color: #9ca3af; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: color .2s, background .2s; z-index: 2; }
.engines .sitelist-arrow:hover { color: #1e87eb; background: #f0f7ff; }
.engines .sitelist-arrow.hidden { display: none; }
.engines .sitelist ul li { position: relative; display: inline-flex; align-items: center; justify-content: flex-start; gap: 7px; width: 112px; height: 36px; line-height: 36px; font-size: 13.5px; font-weight: 500; cursor: pointer; margin: 0 2px; white-space: nowrap; padding: 0 10px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: #6b7280; transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; }
.engines .sitelist ul li .ImgLoad { flex: 0 0 auto; max-width: 20px; }
.engines .sitelist ul li .site-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.engines .sitelist ul li .open-badge { flex: 0 0 auto; font-size: 11px; line-height: 1; color: #1e87eb; margin-left: 1px; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 4px; background: #e8f2ff; }
.engines .sitelist ul li:hover { color: #1e87eb; background: #f0f7ff; }
.engines .sitelist ul li.active { background: linear-gradient(135deg, #1e87eb, #6366f1); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(30, 135, 235, 0.35); }
.engines .sitelist ul li.active .open-badge { background: rgba(255, 255, 255, 0.22); color: #fff; }

.engines .vtab {
  position: fixed; top: 126px; left: 14px; z-index: 20;
  /* 可配置变量（由设置面板实时写入） */
  --vtab-w: 110px;
  --vtab-h: 36px;
  --vtab-font: 15px;
  --vtab-gap: 14px;
  --vtab-spacing: 6px;
  --vtab-bg: rgba(238, 240, 244, 0.92);
  --vtab-color: #4b5563;
  --vtab-accent: #1f6fff;
  --vtab-radius: 8px;
  --vtab-opacity: 1;
  width: var(--vtab-w);
  left: var(--vtab-gap);
  opacity: var(--vtab-opacity);
  transition: left .25s ease, right .25s ease, top .25s ease, width .2s ease, transform .25s ease, opacity .25s ease;
}
/* vtab 位置：右侧 */
body.vtab-right .engines .vtab { left: auto; right: var(--vtab-gap); }
/* vtab 位置：底部 */
body.vtab-bottom .engines .vtab {
  top: auto; bottom: var(--vtab-gap); left: 50%; transform: translateX(-50%);
  width: auto; display: flex; align-items: center;
}
body.vtab-bottom .engines .vtab ul { display: flex; gap: var(--vtab-spacing); }
body.vtab-bottom .engines .vtab ul li { margin: 0; width: var(--vtab-w); padding: 0; }
body.vtab-bottom .engines .vtab ul a { display: inline-block; }
.engines .vtab ul li {
  list-style: none; width: calc(var(--vtab-w) - 38px); height: var(--vtab-h);
  background: var(--vtab-bg);
  font-size: var(--vtab-font); cursor: pointer; margin: var(--vtab-spacing) auto; line-height: var(--vtab-h);
  border-radius: var(--vtab-radius); text-align: center; transition: all 0.2s; color: var(--vtab-color);
}
.engines .vtab ul a { color: var(--vtab-color); display: block; }
.engines .vtab ul a li:hover { background: var(--vtab-accent); color: #fff; }
.engines .vtab ul a li.active { background: var(--vtab-accent); box-shadow: 0 3px 10px rgba(31, 111, 255, 0.3); color: #fff; }

/* 分类栏自动隐藏：默认收起，仅留 14px 触发条，悬停展开 */
body.vtab-autohide.vtab-left .engines .vtab { transform: translateX(calc(-100% + 14px)); }
body.vtab-autohide.vtab-right .engines .vtab { transform: translateX(calc(100% - 14px)); }
body.vtab-autohide.vtab-bottom .engines .vtab { transform: translateX(-50%) translateY(calc(100% - 14px)); }
body.vtab-autohide.vtab-left .engines .vtab:hover,
body.vtab-autohide.vtab-right .engines .vtab:hover,
body.vtab-autohide.vtab-bottom .engines .vtab:hover { transform: translate(0, 0); }
body.vtab-autohide.vtab-bottom .engines .vtab:hover { transform: translateX(-50%) translateY(0); }

.site-icon { position: relative; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.site-icon .site-loading { position: absolute; left: 0; top: 0; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; color: #9aa0a8; }
.site-icon .site-fallback { font-size: 15px; color: #9aa0a8; display: none; }
.ImgLoad { width: 20px; height: 20px; border-radius: 4px; vertical-align: middle; object-fit: contain; display: none; }
.ImgLoad.loaded { display: inline-block; }
/* 隐藏站点图标（纯文字导航） */
body.hide-favicon .engines .sitelist ul li .ImgLoad,
body.hide-favicon .engines .sitelist ul li .site-icon { display: none !important; }

/* 设置面板（z-index 高于 header，确保弹层不被顶部导航遮挡） */
.settings-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 9998; opacity: 0; visibility: hidden; transition: opacity .2s; }
.settings-mask.show { opacity: 1; visibility: visible; }
.settings-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%) scale(.97);
  width: 420px; max-width: calc(100vw - 32px); max-height: calc(100vh - 100px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 18px; border: 1px solid #f0f2f5;
  box-shadow: 0 24px 60px rgba(15,23,42,.28); z-index: 9999;
  opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s;
}
.settings-panel.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; font-size: 16px; font-weight: 700; color: #1f2937; border-bottom: 1px solid #f1f3f6; flex: 0 0 auto; }
.settings-head i { color: #1f6fff; margin-right: 6px; }
.settings-close { border: none; background: transparent; color: #9ca3af; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; justify-content: center; }
.settings-close i { font-size: 15px; }
.settings-close:hover { background: rgba(31, 111, 255, .08); color: #1f6fff; }
.settings-close:active { transform: scale(.92); }
.settings-body { padding: 6px 20px 20px; overflow-y: auto; flex: 1 1 auto; }
.settings-tip { margin: 14px 0 4px; font-size: 12px; color: #9ca3af; line-height: 1.6; }
.settings-group { padding: 16px 0; border-top: 1px solid #f1f3f6; }
.settings-group:first-child { border-top: none; padding-top: 6px; }
.settings-group-title { font-size: 12px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px; }
.settings-row { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.settings-row:last-child { margin-bottom: 0; }
.settings-label { font-size: 13px; color: #4b5563; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-opts { display: flex; gap: 8px; }
.vtab-pos-btn {
  flex: 1; padding: 9px 0; border: 1px solid #e5e7eb; background: #fff; color: #4b5563;
  border-radius: 10px; font-size: 13px; cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.vtab-pos-btn i { font-size: 12px; }
.vtab-pos-btn:hover { border-color: #c7d2fe; color: #1f6fff; background: #f0f7ff; }
.vtab-pos-btn.active { background: linear-gradient(135deg, #1f6fff, #6366f1); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(31,111,255,.3); }
.settings-range { width: 100%; height: 5px; border-radius: 3px; background: #e5e7eb; outline: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.settings-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%; background: #fff; border: 3px solid #1f6fff; cursor: pointer; box-shadow: 0 1px 4px rgba(31,111,255,.4); transition: transform .15s; }
.settings-range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.settings-range::-moz-range-thumb { width: 17px; height: 17px; border: 3px solid #1f6fff; border-radius: 50%; background: #fff; cursor: pointer; }
.settings-val { color: #1f6fff; font-weight: 600; font-size: 12.5px; flex: 0 0 auto; }
.color-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.color-swatches .swatch {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 1px #e2e6ec, inset 0 0 0 1px rgba(0,0,0,.04); padding: 0;
  transition: transform .15s, box-shadow .15s; flex: 0 0 auto;
}
.color-swatches .swatch:hover { transform: scale(1.12); box-shadow: 0 0 0 2px #1f6fff; }
.color-swatches .swatch.active { box-shadow: 0 0 0 2px #1f6fff; position: relative; }
.color-swatches .swatch.active::after { content: '\2713'; position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); border-radius: 5px; background: rgba(0,0,0,.15); }
.color-field {
  position: relative; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  background: linear-gradient(135deg, #fff, #f0f2f5); border: 1px solid #e2e6ec;
  display: inline-flex; align-items: center; justify-content: center; color: #6b7280; font-size: 14px;
  transition: all .2s; overflow: hidden; flex: 0 0 auto;
}
.color-field:hover { color: #1f6fff; border-color: #c7d2fe; }
.color-field input[type="color"] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.settings-actions { padding-top: 16px; border-top: 1px solid #f1f3f6; }
.vtab-reset-btn {
  width: 100%; padding: 11px 0; border: none; border-radius: 10px; cursor: pointer;
  background: #f3f4f6; color: #4b5563; font-size: 14px; font-weight: 500; transition: all .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.vtab-reset-btn:hover { background: #e5e7eb; color: #1f2937; }

/* 开关组件 */
.settings-row.row { flex-direction: row; align-items: center; justify-content: space-between; }
.settings-row.row .settings-label { margin: 0; }
.settings-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: 0 0 auto; }
.settings-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.settings-switch .track { position: absolute; inset: 0; background: #d1d5db; border-radius: 999px; cursor: pointer; transition: background .2s; }
.settings-switch .track::before { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.settings-switch input:checked + .track { background: #1f6fff; }
.settings-switch input:checked + .track::before { transform: translateX(18px); }

/* 下拉选择 */
.settings-select {
  width: 100%; padding: 9px 12px; border: 1px solid #e5e7eb; border-radius: 10px;
  font-size: 13px; color: #4b5563; background: #fff; outline: none; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.settings-select:focus { border-color: #1f6fff; box-shadow: 0 0 0 3px rgba(31,111,255,.1); }

#iframe { position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: 0; z-index: 1; background: #f4f6fa; }

/* 骨架屏：站点条占位 */
.skeleton-bar { display: flex; gap: 10px; align-items: center; padding: 8px 16px; }
.skeleton-bar .sk { height: 36px; border-radius: 10px; background: linear-gradient(90deg, #eef1f5 25%, #f6f8fb 37%, #eef1f5 63%); background-size: 400% 100%; animation: skShine 1.3s ease-in-out infinite; }
.skeleton-bar .sk.w1 { width: 96px; } .skeleton-bar .sk.w2 { width: 120px; } .skeleton-bar .sk.w3 { width: 84px; } .skeleton-bar .sk.w4 { width: 110px; } .skeleton-bar .sk.w5 { width: 92px; }
@keyframes skShine { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
/* 骨架：iframe 区域占位（在 iframe 未加载时显示） */
.skeleton-iframe { position: fixed; inset: 0; z-index: 2; background: #f4f6fa; padding-top: 126px; display: none; }
.skeleton-iframe.show { display: block; }
.skeleton-iframe .sk-block {
  max-width: 760px;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  padding: 28px 28px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
/* 骨架头部：旋转图标 + 加载文本 */
.skeleton-iframe .sk-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f2f5;
}
.skeleton-iframe .sk-head .sk-spin {
  width: 22px; height: 22px;
  border: 3px solid #e5e7eb;
  border-top-color: #1e87eb;
  border-radius: 50%;
  animation: iframeSpin .8s linear infinite;
}
.skeleton-iframe .sk-head .sk-text {
  font-size: 15px;
  color: #6b7280;
  font-weight: 500;
  letter-spacing: .5px;
}
.skeleton-iframe .sk-line { height: 14px; border-radius: 7px; margin: 13px 0; background: linear-gradient(90deg, #eef1f5 25%, #f6f8fb 37%, #eef1f5 63%); background-size: 400% 100%; animation: skShine 1.3s ease-in-out infinite; }
.skeleton-iframe .sk-line.lg { width: 55%; height: 18px; }
.skeleton-iframe .sk-line.sm { width: 82%; }
.skeleton-iframe .sk-line.xs { width: 64%; }

#iframeLoader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 3; display: none; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.92); }
#iframeLoader.show { display: flex; }
#iframeLoader .loader-box { text-align: center; padding: 34px 44px; border-radius: 16px; background: #fff; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.12); border: 1px solid #eef0f4; }
#iframeLoader .spinner { width: 40px; height: 40px; margin: 0 auto; border: 4px solid #e5e7eb; border-top-color: #1e87eb; border-radius: 50%; animation: iframeSpin 0.8s linear infinite; }
#iframeLoader .loader-text { margin-top: 16px; font-size: 15px; color: #4b5563; font-weight: 500; letter-spacing: 0.5px; }
#iframeLoader .loader-open { display: inline-block; margin-top: 14px; font-size: 13px; color: #1e87eb; text-decoration: none; padding: 8px 16px; border-radius: 8px; border: 1px solid #cfe3ff; background: #e8f2ff; transition: all 0.2s; }
#iframeLoader .loader-open:hover { background: #1e87eb; color: #fff; border-color: #1e87eb; }
@keyframes iframeSpin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background-color: #eef0f4; border-radius: 10px; }
::-webkit-scrollbar-thumb { border-radius: 10px; background-color: #c0c8d4; }
::-webkit-scrollbar-thumb:hover { background-color: #1e87eb; }