/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --radius: 16px;
  --blur: 18px;
  --ease: cubic-bezier(.4,0,.2,1);
  --panel: rgba(22,28,48,.72);
  --border: rgba(255,255,255,.14);
  --chip: rgba(255,255,255,.10);
  --chip-hover: rgba(255,255,255,.16);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--text, #f5f6fa);
  min-height: 100vh;
  overflow-x: hidden;
  transition: color .3s var(--ease);
  -webkit-font-smoothing: antialiased;
}

/* ============ 壁纸 ============ */
.wallpaper {
  position: fixed; inset: 0; z-index: -2;
  background-color: #0b1020;
  background-size: cover; background-position: center;
  transition: background-image .6s var(--ease);
}
.scrim {
  position: fixed; inset: 0; z-index: -1;
  background: var(--scrim, rgba(8,12,26,.28));
  transition: background .3s var(--ease);
}
body.theme-light {
  --text: #1c2333;
  --text-dim: rgba(28,35,51,.62);
  --scrim: rgba(255,255,255,.05);
  --panel: rgba(255,255,255,.84);
  --border: rgba(28,35,51,.10);
  --chip: rgba(255,255,255,.62);
  --chip-hover: rgba(255,255,255,.88);
  color-scheme: light;
}
body.theme-dark {
  --text: #f5f6fa;
  --text-dim: rgba(245,246,250,.6);
  --scrim: rgba(8,12,26,.08);
  color-scheme: dark;
}
body.theme-auto { color-scheme: light dark; }
@media (prefers-color-scheme: light) {
  body.theme-auto { --text: #1c2333; --text-dim: rgba(28,35,51,.62); --scrim: rgba(255,255,255,.05); --panel: rgba(255,255,255,.84); --border: rgba(28,35,51,.10); --chip: rgba(255,255,255,.62); --chip-hover: rgba(255,255,255,.88); }
}
@media (prefers-color-scheme: dark) {
  body.theme-auto { --text: #f5f6fa; --text-dim: rgba(245,246,250,.6); --scrim: rgba(8,12,26,.08); }
}

/* 面板通用 */
.panel, .modal-box {
  background: var(--panel, rgba(22,28,48,.72));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border, rgba(255,255,255,.14));
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  border-radius: var(--radius);
}
body.theme-light .panel, body.theme-light .modal-box {
  --panel: rgba(255,255,255,.82);
  --border: rgba(28,35,51,.10);
  box-shadow: 0 12px 40px rgba(28,35,51,.18);
}

/* ============ 顶部栏 ============ */
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 28px 0;
  gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.datetime { line-height: 1.25; }
.date-main { font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.date-sub { font-size: 12.5px; opacity: .72; margin-top: 3px; white-space: pre-line; }
.weather { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 8px 14px; border-radius: 999px; background: var(--chip, rgba(255,255,255,.10)); border: 1px solid var(--border, rgba(255,255,255,.12)); transition: transform .2s var(--ease), background .2s; }
.weather:active { transform: scale(.96); }
body.theme-light .weather { --chip: rgba(255,255,255,.6); }
.weather-icon { font-size: 22px; }
.weather-temp { font-size: 17px; font-weight: 700; }
.weather-desc { font-size: 11.5px; opacity: .75; }

.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.clock { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; margin-right: 6px; opacity: .92; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border, rgba(255,255,255,.14));
  background: var(--chip, rgba(255,255,255,.10));
  color: inherit; font-size: 16px; cursor: pointer;
  display: grid; place-items: center;
  transition: transform .18s var(--ease), background .2s;
}
.icon-btn:hover { background: var(--chip-hover, rgba(255,255,255,.2)); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.active { outline: 2px solid var(--accent, #4f8cff); outline-offset: 1px; }

/* 顶栏带文字说明的图标按钮：胶囊样式 */
.icon-btn.has-label {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  width: auto; height: 30px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .1px; white-space: nowrap;
}
.icon-btn.has-label .ib-ico { font-size: 14px; line-height: 1; }
.icon-btn.has-label .ib-txt { line-height: 1; }

/* ============ 搜索区 ============ */
.search-area { padding: 6vh 28px 0; display: flex; flex-direction: column; align-items: center; }
.search-box {
  position: relative; width: min(660px, 94vw);
  display: flex; align-items: center; gap: 4px;
  background: var(--panel, rgba(22,28,48,.72));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1.5px solid var(--border, rgba(255,255,255,.16));
  border-radius: 999px;
  padding: 6px 6px 6px 12px;
  transition: border-color .25s, box-shadow .25s;
}
.search-box:focus-within { border-color: var(--accent, #4f8cff); box-shadow: 0 0 0 4px rgba(79,140,255,.18); }
.engine-switch { font-size: 19px; cursor: pointer; padding: 8px; border-radius: 50%; transition: background .2s, transform .2s; user-select: none; }
.engine-switch:hover { background: var(--chip-hover, rgba(255,255,255,.16)); }
.engine-switch:active { transform: rotate(-18deg) scale(.94); }
.search-box input {
  flex: 1; border: none; outline: none; background: transparent; color: inherit;
  font-size: 16.5px; padding: 11px 6px; min-width: 0;
}
.search-box input::placeholder { color: var(--text-dim, rgba(245,246,250,.5)); }
.search-go {
  border: none; cursor: pointer; border-radius: 999px; padding: 11px 22px;
  background: var(--accent, #4f8cff); color: #fff; font-size: 14.5px; font-weight: 600;
  transition: filter .2s, transform .18s;
}
.search-go:hover { filter: brightness(1.1); }
.search-go:active { transform: scale(.95); }

/* 引擎列表 */
.engine-list {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: center;
  max-width: 90vw;
}
.engine-item {
  padding: 6px 14px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  background: var(--chip, rgba(255,255,255,.09)); border: 1px solid var(--border, rgba(255,255,255,.12));
  transition: background .2s, transform .15s, border-color .2s;
  user-select: none;
}
.engine-item:hover { background: var(--chip-hover, rgba(255,255,255,.18)); transform: translateY(-1px); }
.engine-item.on { background: var(--accent, #4f8cff); border-color: transparent; color: #fff; font-weight: 600; }

/* 搜索建议 */
.suggest {
  position: absolute; top: calc(100% + 10px); left: 0; right: 0;
  background: var(--panel, rgba(22,28,48,.9));
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 14px; overflow: hidden; display: none;
  z-index: 50; max-height: 320px; overflow-y: auto;
}
.suggest.show { display: block; }
.suggest-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer;
  font-size: 14px; transition: background .15s;
}
.suggest-item:hover, .suggest-item.sel { background: var(--chip-hover, rgba(255,255,255,.14)); }
.suggest-item img { width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0; }
.suggest-item .s-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .s-url { font-size: 11.5px; opacity: .5; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .s-tag { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: rgba(79,140,255,.22); color: var(--accent-soft, #8ab4ff); flex-shrink: 0; }

/* ============ 分组导航 ============ */
.nav-main { padding: 28px 28px 20px; max-width: 1280px; margin: 0 auto; }
.group-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.group-tab {
  padding: 8px 18px; border-radius: 999px; font-size: 14px; cursor: pointer;
  background: var(--chip, rgba(255,255,255,.09)); border: 1px solid var(--border, rgba(255,255,255,.12));
  transition: all .2s var(--ease); user-select: none;
  display: flex; align-items: center; gap: 6px;
}
.group-tab:hover { background: var(--chip-hover, rgba(255,255,255,.18)); }
.group-tab.on { background: var(--accent, #4f8cff); border-color: transparent; color: #fff; font-weight: 600; }
/* 编辑模式的分组 ✕删除 / ✎编辑 按钮：醒目小按钮，编辑模式下常显 */
.group-tab .del-g,
.group-tab .ed-g {
  opacity: 0;
  font-size: 14px; line-height: 1;
  margin-left: 5px;
  padding: 3px 7px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .2s, transform .15s, background .15s;
}
.group-tab .del-g { color: #ff5f6d; background: rgba(255, 95, 109, .14); }
.group-tab .ed-g { color: var(--accent, #4f8cff); background: rgba(79, 140, 255, .14); }
.group-tab:hover .del-g, .group-tab:hover .ed-g { opacity: 1; }
body.edit-on .group-tab .del-g, body.edit-on .group-tab .ed-g { opacity: .85; }
.group-tab .del-g:hover, .group-tab .ed-g:hover { opacity: 1 !important; transform: scale(1.18); }
.group-tab .del-g:hover { background: rgba(255, 95, 109, .28); }
.group-tab .ed-g:hover { background: rgba(79, 140, 255, .28); }
body.edit-on .group-tab { cursor: grab; }
body.edit-on .group-tab:active { cursor: grabbing; }
body.edit-on .group-tab.dragging { opacity: .4; }
body.edit-on .group-tab.drag-over { outline: 2px dashed var(--accent, #4f8cff); outline-offset: -3px; }

.group-title {
  font-size: 15px; font-weight: 700; margin: 4px 2px 14px; display: flex; align-items: center; gap: 8px;
  letter-spacing: .4px;
}
.group-title .g-count { font-size: 12px; font-weight: 400; opacity: .5; }
.group-panel { display: none; animation: fadeIn .3s var(--ease); margin-bottom: 24px; scroll-margin-top: 70px; }
.group-panel.show { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.site-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px;
  position: relative;   /* 插入指示条 .ins-bar 的定位基准 */
}
/* 拖拽排序插入指示条：悬停时出现在将插入的位置（卡片左缘/右缘），明确落点 */
.ins-bar {
  position: absolute; top: 0; width: 3px; height: 40px; border-radius: 2px; z-index: 6;
  transform: translateX(-50%); pointer-events: none;
  background: #ffb347; box-shadow: 0 0 10px rgba(255, 179, 71, .8), 0 0 2px rgba(255, 150, 40, .6);
  opacity: 0; transition: opacity .12s;
}
.ins-bar.show { opacity: 1; }
.site-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px 12px; border-radius: var(--radius); cursor: pointer;
  background: var(--card, rgba(255,255,255,.12));
  border: 1px solid var(--border, rgba(255,255,255,.12));
  transition: transform .22s var(--ease), background .22s, border-color .22s, box-shadow .22s;
  text-decoration: none; color: inherit; overflow: hidden;
}
body.theme-light .site-card { --card: rgba(255,255,255,.66); }
.site-card:hover {
  transform: translateY(-4px);
  background: var(--card-hover, rgba(255,255,255,.22));
  border-color: var(--accent, #4f8cff);
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
}
.site-card .site-icon {
  position: relative;
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 23px; font-weight: 700; color: #fff;
  background: transparent;   /* 透明底：盒子尺寸/圆角不变，仅去掉蓝色渐变 */
  overflow: hidden; flex-shrink: 0;
  transition: transform .25s var(--ease);
}
.site-card:hover .site-icon { transform: scale(1.08) rotate(-4deg); }
/* 透明底：浅色主题下无背景色的文字/首字母改深色保证可读（卡片 + 搜索建议条） */
body.theme-light .site-card .site-icon, body.theme-light .suggest-item .site-icon { color: #313a52; }
.site-card .site-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 图标图片禁止自身被拖拽：否则按住图标拖动时拖拽源是 <img> 而不是整张卡片，排序拖不动 */
.site-card .site-icon img, .suggest-item .site-icon img, .g-icon-img img { -webkit-user-drag: none; user-drag: none; }
/* 首字母占位：favicon 加载前 / 彻底失败时显示；img 一旦有真实地址则自动隐藏 */
.site-icon .fav-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; color: #fff; }
/* 透明底可读性：浅色主题/浅色壁纸下首字母用深色（深色主题仍是白字） */
body.theme-light .site-icon .fav-fallback { color: #313a52; }
.site-icon img[src]:not([src=""]) + .fav-fallback { display: none; }
/* 搜索建议条里的图标：同款透明小盒 */
.suggest-item .site-icon { position: relative; width: 26px; height: 26px; border-radius: 7px; background: transparent; overflow: hidden; flex-shrink: 0; font-size: 14px; }
.suggest-item .site-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.suggest-item .site-icon .fav-fallback { font-size: 12px; }
.site-card .site-name {
  font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; opacity: .92;
}
.site-card .del-site {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  border-radius: 50%; border: none; cursor: pointer; font-size: 11px;
  background: rgba(255,80,90,.85); color: #fff; display: none; place-items: center;
  z-index: 2; transition: transform .15s;
}
.site-card .del-site:hover { transform: scale(1.2); }
/* ✎ 编辑按钮：编辑模式常显（左上角，与右上角 ✕ 删除对称） */
.site-card .ed-site {
  position: absolute; top: 6px; left: 6px; width: 22px; height: 22px;
  border-radius: 50%; border: none; cursor: pointer; font-size: 12px; line-height: 1; padding: 0;
  background: rgba(79,140,255,.9); color: #fff; display: none; place-items: center;
  z-index: 2; transition: transform .15s, background .15s;
}
.site-card .ed-site:hover { transform: scale(1.2); background: rgba(79,140,255,1); }
/* ←→ 排序按钮：编辑模式 hover 卡片时出现；不依赖拖拽，扩展劫持 drop 时仍可排序（位于卡片底部） */
.site-card .op-btn {
  position: absolute; bottom: 6px; top: auto; width: 22px; height: 22px;
  border-radius: 50%; border: none; cursor: pointer; font-size: 13px; line-height: 1; padding: 0;
  background: rgba(70,95,140,.82); color: #fff; display: none; place-items: center;
  z-index: 2; transition: transform .15s, background .15s;
}
.site-card .op-btn:hover { transform: scale(1.15); background: rgba(79,140,255,.95); }
.site-card .op-right { right: 30px; }
.site-card .op-left { right: 54px; }
body.edit-on .site-card:hover .op-btn { display: grid; }
body.edit-on .site-card { cursor: grab; }
body.edit-on .site-card .del-site { display: grid; }
body.edit-on .site-card .ed-site { display: grid; }
body.edit-on .site-card.dragging { opacity: .4; }

.add-tile {
  border: 2px dashed var(--border, rgba(255,255,255,.22));
  background: transparent; color: var(--text-dim);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; cursor: pointer; transition: all .2s;
}
.add-tile:hover { border-color: var(--accent, #4f8cff); color: var(--text); }

/* 空分组 */
.empty-hint { text-align: center; opacity: .6; padding: 30px 0; font-size: 13.5px; }

/* ============ 底部 ============ */
.footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 28px 20px; font-size: 12px; opacity: .55; flex-wrap: wrap; gap: 6px;
}
.footer-links a { color: inherit; margin-left: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ============ 弹窗 / 面板 ============ */
.modal-mask { position: fixed; inset: 0; z-index: 90; background: rgba(5,8,18,.45); }
.panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(1040px, 94vw); max-height: 88vh; overflow-y: auto;
  z-index: 100; padding: 22px 26px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { font-size: 17px; }
.panel-body { display: flex; flex-direction: column; gap: 20px; }
/* "管理主题"点击后的高亮闪烁反馈 */
@keyframes grpFlash { 0%,100% { outline: 2px solid transparent; } 25%,65% { outline: 2px solid var(--accent, #4f8cff); outline-offset: 5px; } }
.set-group.flash { animation: grpFlash 1.4s ease; border-radius: 12px; }
.set-group h4 { font-size: 13px; margin-bottom: 10px; opacity: .75; letter-spacing: .5px; }
.wall-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wall-item {
  position: relative; aspect-ratio: 16 / 10; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; overflow: hidden;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  transition: transform .18s var(--ease), border-color .18s;
}
.wall-item:hover { transform: scale(1.05); }
.wall-item.on { border-color: var(--accent, #4f8cff); box-shadow: 0 0 0 2px var(--accent, #4f8cff); }
.wall-head { display: flex; align-items: center; justify-content: space-between; }
.wall-head h4 { margin: 0; }
.wall-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); user-select: none; }
.wall-toggle input { display: none; }
.wall-toggle-track { width: 36px; height: 20px; background: rgba(120,120,120,.45); border-radius: 99px; position: relative; transition: background .2s; }
.wall-toggle-track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.wall-toggle input:checked + .wall-toggle-track { background: var(--accent, #4f8cff); }
.wall-toggle input:checked + .wall-toggle-track::after { transform: translateX(16px); }
/* 显示开关行（复用 .wall-toggle 风格，标签左 / 开关右） */
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px; border-bottom: 1px solid var(--border, rgba(128,128,128,.14)); }
.set-row:last-child { border-bottom: 0; }
.set-row-label { display: flex; flex-direction: column; line-height: 1.3; font-size: 14px; color: var(--text); }
.hint-inline { font-size: 11px; opacity: .6; font-weight: 400; }
.wall-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.wall-pager { display: flex; align-items: center; gap: 6px; margin: 0 auto; }
.wall-page-btn { width: 24px; height: 24px; border: none; background: transparent; color: var(--text); cursor: pointer; border-radius: 6px; font-size: 16px; line-height: 1; transition: background .15s; }
.wall-page-btn:hover { background: rgba(127,127,127,.18); }
.wall-page-btn:disabled { opacity: .3; cursor: default; }
.wall-page-info { font-size: 13px; color: var(--text); min-width: 36px; text-align: center; }
.wall-links { display: flex; gap: 16px; }
.wall-links a { color: var(--accent, #4f8cff); text-decoration: none; font-size: 13px; cursor: pointer; }
.wall-links a:hover { text-decoration: underline; }
.wall-preview-mask { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 9999; cursor: zoom-out; }
.wall-preview-mask img, .wall-preview-mask .wall-preview-bg { max-width: 92vw; max-height: 92vh; box-shadow: 0 8px 40px rgba(0,0,0,.6); border-radius: 8px; }
.wall-preview-mask .wall-preview-bg { width: 92vw; height: 92vh; }
.wall-item.on::after { content: "✓"; position: absolute; right: 50%; top: 50%; transform: translate(50%, -50%); font-size: 15px; font-weight: 700; color: #fff; background: var(--accent, #4f8cff); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.wall-up { border-color: var(--accent, #4f8cff); }
.wall-del {
  position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,.5); color: #fff; font-size: 10px; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s; z-index: 2;
}
.wall-up:hover .wall-del { opacity: 1; }
.wall-add {
  border: 1.5px dashed var(--border, rgba(255,255,255,.3)); background: transparent;
  display: grid; place-items: center; color: var(--text-dim, rgba(255,255,255,.55));
}
.wall-add:hover { border-color: var(--accent, #4f8cff); color: var(--accent, #4f8cff); background: rgba(79,140,255,.06); }
.wall-add-icon { font-size: 20px; font-weight: 300; }
.wall-custom { display: flex; gap: 8px; margin-top: 10px; }
.wall-custom input { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 12px; opacity: .6; line-height: 1.6; }
/* 图标上传：输入框 + 上传按钮一行，下方预览 */
.icon-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.icon-row input[type="text"] { flex: 1; min-width: 0; }
.icon-up-btn {
  flex: none; padding: 9px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--accent, #4f8cff); background: transparent;
  color: var(--accent, #4f8cff); font-size: 13px; transition: background .15s;
}
.icon-up-btn:hover { background: rgba(79,140,255,.1); }
.icon-preview { display: none; margin-bottom: 8px; }
.icon-preview.show { display: block; }
.icon-preview img {
  width: 48px; height: 48px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--border, rgba(255,255,255,.18));
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
/* 分组图标（tab / 标题）：dataURL 图片用 <img> 占位 */
.g-icon, .g-icon-img { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; }
.g-icon-img img { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; }

input[type="text"], input[type="url"], select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,.16));
  background: var(--input, rgba(255,255,255,.07));
  color: inherit; font-size: 14px; outline: none;
  transition: border-color .2s, background .2s;
}
/* 下拉框：明暗两套实色配色，避免白底看不清 */
body.theme-dark select {
  --input: rgba(24,30,52,.96);
  color: #eef0f8;
}
body.theme-light select {
  --input: rgba(255,255,255,.95);
  color: #1c2333;
}
select option {
  background: #1a2038; color: #eef0f8;
}
body.theme-light select option {
  background: #ffffff; color: #1c2333;
}
body.theme-light input[type="text"], body.theme-light input[type="url"] { --input: rgba(28,35,51,.05); }
input:focus, select:focus { border-color: var(--accent, #4f8cff); }
label { display: block; font-size: 12.5px; margin: 12px 0 6px; opacity: .8; }

/* 自选图标选择器（下拉） */
.icon-picker { display: none; margin-top: 10px; }
.icon-picker.show { display: block; }
.icon-select {
  width: 100%; padding: 9px 10px; border-radius: 10px; font-size: 14px;
  border: 1px solid var(--border, rgba(255,255,255,.18));
  background: var(--input, rgba(255,255,255,.07)); color: var(--text, #e8ecf8);
  cursor: pointer; transition: border-color .2s;
}
.icon-select:hover, .icon-select:focus { border-color: var(--accent, #4f8cff); }
.icon-select optgroup { font-size: 13px; }
.icon-select option { font-size: 14px; }

/* 自选图标选择器（分类标签 + 卡片网格） */
.ip-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ip-tab {
  height: 30px; padding: 0 14px; border: 1px solid var(--border); border-radius: 15px;
  background: var(--chip); color: var(--text, #f5f6fa); font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.ip-tab:hover { background: var(--chip-hover); }
.ip-tab.on { background: var(--accent, #4f8cff); border-color: var(--accent, #4f8cff); color: #fff; }
.ip-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px;
  max-height: 230px; overflow-y: auto; padding: 2px;
}
.ip-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px 8px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--chip); color: var(--text, #f5f6fa); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ip-item:hover { background: var(--chip-hover); }
.ip-item.on { border-color: var(--accent, #4f8cff); background: rgba(79, 140, 255, .18); }
.ip-ico { font-size: 24px; line-height: 1.2; }
.ip-name {
  font-size: 11px; color: var(--text-dim, #9aa3bf);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.mini-btn {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border, rgba(255,255,255,.16));
  background: var(--chip, rgba(255,255,255,.1)); color: inherit; font-size: 13px; cursor: pointer;
  transition: background .2s, transform .15s;
}
.mini-btn:hover { background: var(--chip-hover, rgba(255,255,255,.2)); }
.mini-btn:active { transform: scale(.96); }
.mini-btn.primary { background: var(--accent, #4f8cff); border-color: transparent; color: #fff; }
.mini-btn.danger { background: rgba(255,80,90,.15); border-color: rgba(255,80,90,.4); color: #ff9aa2; }
.mini-btn.on { background: var(--accent, #4f8cff); color: #fff; border-color: transparent; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; }
.modal-box { width: min(420px, 92vw); padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-foot .mini-btn { min-width: 84px; }

/* 恢复默认确认（二次确认 + 算术题） */
.reset-warn { font-size: 15px; font-weight: 600; color: #ff9aa2; line-height: 1.5; }
body.theme-light .reset-warn { color: #d33; }
.quiz-line { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.quiz-q { font-size: 22px; font-weight: 700; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.quiz-eq { font-size: 20px; opacity: .8; }
.quiz-input { width: 110px !important; text-align: center; font-size: 18px !important; font-weight: 600; }
.quiz-err { min-height: 18px; margin-top: 8px; font-size: 12.5px; color: #ff9aa2; }
body.theme-light .quiz-err { color: #d33; }

/* Toast */
.toast {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%);
  padding: 11px 24px; border-radius: 999px; z-index: 200;
  background: rgba(20,26,44,.9); color: #fff; font-size: 13.5px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 工具类 */
.hidden { display: none !important; }

/* ============ 响应式 ============ */
@media (max-width: 640px) {
  .topbar { padding: 14px 14px 0; }
  .clock { font-size: 20px; }
  .icon-btn.has-label { width: 38px; padding: 0; border-radius: 12px; }
  .icon-btn.has-label .ib-txt { display: none; }
  .search-area { padding-top: 4vh; }
  .site-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
  .nav-main { padding: 20px 14px 14px; }
  .footer { padding: 6px 14px 16px; }
  .date-sub { font-size: 11.5px; }
}
