/* 首页样式（index.html）
   自成体系：带深色主题变量，与后台配色不共用。 */
:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --text: #1d2923;
  --muted: #748078;
  --line: #e5ebe6;
  --primary: #16865b;
  --primary-dark: #0e6c48;
  --primary-soft: #e9f5ee;
  --danger: #c4544f;
  --warning: #8a6522;
}
[data-theme="dark"] {
  --bg: #111714;
  --surface: #19211d;
  --surface-soft: #202a24;
  --text: #edf3ef;
  --muted: #99a69e;
  --line: #2c3831;
  --primary: #52c992;
  --primary-dark: #71d9a8;
  --primary-soft: #20392c;
  --shadow: 0 12px 35px rgba(0, 0, 0, .18);
  --shadow-hover: 0 12px 26px rgba(0, 0, 0, .26);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  /* font-family: "SimSun", "宋体", serif; */
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.topbar {
  height: 48px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
}
.topbar-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; background: var(--primary); box-shadow: 0 6px 16px rgba(22, 134, 91, .22);
}
[data-theme="dark"] .brand-mark { color: #10251a; }
.brand-mark svg { width: 23px; height: 23px; }
.brand-name { font-size: 21px; font-weight: 600; letter-spacing: -.5px; }
.brand-tag { color: var(--muted); font-size: 12px; margin-left: 4px; font-weight: 400; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.date { color: var(--muted); font-size: 13px; margin-right: 10px; white-space: nowrap; }
.text-button, .icon-button, .outline-button, .primary-button {
  border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: .2s ease;
}
.text-button { padding: 9px 12px; background: transparent; border-radius: 9px; font-size: 14px; }
.text-button:hover, .icon-button:hover { background: var(--primary-soft); color: var(--primary); }
.icon-button { width: 38px; height: 38px; border-radius: 10px; background: transparent; }
.outline-button { padding: 9px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; font-size: 13px; }
.outline-button:hover { color: var(--primary); border-color: var(--primary); }
.primary-button { background: var(--primary); color: white; border-radius: 10px; padding: 11px 20px; font-weight: 600; }
.primary-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
[data-theme="dark"] .primary-button { color: #10251a; }
.hero { padding: 6px 0; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; width: 560px; height: 330px; left: 50%; top: -90px; transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(63, 180, 123, .15), transparent 68%); pointer-events: none;
}
.hero-inner { text-align: center; position: relative; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 43px); line-height: 1.3; letter-spacing: -1.5px; }
.hero-subtitle { color: var(--muted); font-size: 14px; margin: 8px 0; }
.search-wrap { max-width: 750px; margin: 0 auto; }
.search-card { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); overflow: hidden; }
.search-tabs { display: flex; gap: 4px; padding: 10px 13px 0; }
.search-tab { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.search-tab.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.search-form { display: flex; padding: 10px 13px 13px; gap: 10px; }
.search-input-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--muted); }
.search-input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 15px; }
.search-input::placeholder { color: var(--muted); }
.search-submit { min-width: 92px; }
.hot-search { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; margin-top: 17px; font-size: 12px; color: var(--muted); }
.hot-search button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.hot-search button:hover { color: var(--primary); }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 17px; gap: 16px; }
.section-title { margin: 0; font-size: 20px; letter-spacing: -.4px; }
.section-note { color: var(--muted); font-size: 12px; margin-top: 5px; }
.quick-section { padding-bottom: 14px; }
.quick-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 13px; }
.quick-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  display: flex; align-items: center; gap: 12px; min-width: 0; transition: .2s ease;
}
.quick-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow-hover); }
.quick-info { min-width: 0; }
.quick-name { display: block; font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.quick-desc { display: block; color: var(--muted); font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.directory-layout { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 24px; align-items: start; padding-bottom: 60px; }
.sidebar { position: sticky; top: 96px; }
.side-card { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); padding: 10px; }
.side-title { padding: 9px 11px 8px; font-size: 12px; color: var(--muted); }
.category-button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 11px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; color: var(--muted); font-size: 13px; text-align: left; }
.category-button .icon { width: 17px; height: 17px; }
.category-button:hover, .category-button.active { background: var(--primary-soft); color: var(--primary); }
.side-tip { margin-top: 14px; padding: 16px; border-radius: 14px; background: var(--primary-soft); color: var(--muted); font-size: 12px; line-height: 1.8; }
.side-tip strong { display: block; color: var(--primary); margin-bottom: 4px; font-size: 13px; }
kbd { border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line)); background: var(--surface); border-radius: 5px; padding: 0 6px; font-family: inherit; }
.directory-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.directory-section { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 7px; min-width: 0; }
.directory-section.full { grid-column: 1 / -1; }
.directory-section[hidden] { display: none; }
.directory-title { display: flex; align-items: center; gap: 10px; padding-bottom: 15px; border-bottom: 1px solid var(--line); margin-bottom: 9px; }
.directory-title-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); }
.directory-title h2 { font-size: 16px; margin: 0; }
.directory-count { color: var(--muted); font-size: 11px; margin-left: auto; }
.site-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 4px; }
.site-item { display: flex; align-items: center; min-width: 0; position: relative; }
.site-item:hover { background: var(--surface-soft); }
.site-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0; padding: 6px 2px 6px 6px; }
.site-link:hover .site-name { color: var(--primary); }
.site-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s; }
.favorite-button { width: 24px; height: 24px; padding: 4px; border: 0; background: transparent; color: var(--muted); opacity: 0; cursor: pointer; flex: none; }
.favorite-button .icon { width: 15px; height: 15px; }
.site-item:hover .favorite-button, .favorite-button.active { opacity: 1; }
.favorite-button.active { color: #e5a622; }
.favorite-button.active svg { fill: currentColor; }
.favorite-button:hover { background: var(--primary-soft); }
.delete-site { color: #d26868; }
.empty-state { grid-column: 1 / -1; padding: 60px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); margin-bottom: 8px; }
.footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: 12px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.footer-brand { color: var(--text); font-weight: 700; margin-bottom: 5px; }
.back-top { position: fixed; right: 24px; bottom: 24px; width: 42px; height: 42px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 12px; display: grid; place-items: center; cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s; }
.back-top.show { opacity: 1; pointer-events: auto; transform: none; }
dialog { width: min(460px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 25px 80px rgba(0,0,0,.22); }
dialog::backdrop { background: rgba(10, 24, 17, .45); backdrop-filter: blur(3px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 21px 23px 14px; }
.modal-head h2 { font-size: 19px; margin: 0; }
.modal-body { padding: 4px 23px 23px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 13px; margin-bottom: 7px; }
.form-field input, .form-field select { width: 100%; border: 1px solid var(--line); background: var(--surface-soft); color: var(--text); outline: 0; border-radius: 10px; padding: 11px 12px; }
.form-field input:focus, .form-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px); background: #20372b; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 2px; }
@media (max-width: 900px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .directory-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; overflow-x: auto; }
  .side-card { display: flex; gap: 5px; padding: 7px; min-width: max-content; }
  .side-title, .side-tip { display: none; }
  .category-button { width: auto; white-space: nowrap; }
  .directory-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .container { width: min(100% - 24px, 1180px); }
  .topbar { height: 64px; }
  .brand-tag, .date, .favorite-top span { display: none; }
  .brand-name { font-size: 19px; }
  .hero { padding: 6px 0; }
  .hero-subtitle { font-size: 13px; }
  .search-form { gap: 5px; }
  .search-submit { min-width: 70px; padding: 10px 13px; }
  .search-tab { padding: 8px 11px; }
  .hot-search { gap: 12px; }
  .quick-section { padding-bottom: 32px; }
  .quick-grid { gap: 10px; }
  .quick-card { padding: 13px 11px; gap: 9px; }
  .site-logo { width: 35px; height: 35px; }
  .directory-content { grid-template-columns: 1fr; gap: 5px; }
  .directory-section { padding: 7px; }
  .favorite-button { opacity: .65; }
  .footer-inner { display: block; line-height: 1.8; }
  .footer-inner > span { display: block; margin-top: 8px; }
  .back-top { right: 15px; bottom: 15px; }
}
/* 紧凑、直角的版式 */
*, *::before, *::after { border-radius: 0 !important; }
.hero { padding: 6px 0; }
.hero-subtitle { margin: 9px 0; }
.hot-search { margin-top: 12px; }
.section-head { margin-bottom: 12px; }
.quick-section { padding-bottom: 14px; }
.quick-grid { gap: 10px; }
.directory-layout { gap: 18px; padding-bottom: 40px; }
.directory-content { gap: 5px; }
.directory-section { padding: 7px; }
.directory-title { padding-bottom: 9px; margin-bottom: 4px; }
.directory-title-icon { width: 28px; height: 28px; }
.directory-count { font-size: 11px; }
.site-link { padding-top: 5px; padding-bottom: 5px; }
.side-tip { margin-top: 10px; }
.sidebar { max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); }
.directory-section.full .site-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#qhot .site-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { #qhot .site-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { #qhot .site-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 放大字号，保持排版不挤 */
.site-name { font-size: 14px; }
.site-link { padding: 6px 4px 6px 8px; }
.directory-layout { grid-template-columns: 190px minmax(0, 1fr); }
.directory-title h2 { font-size: 17px; }
.directory-title-icon { width: 30px; height: 30px; }
.directory-count { font-size: 12px; }
.quick-name { font-size: 15px; }
.quick-desc { font-size: 12px; }
.section-note { font-size: 13px; }
.category-button { font-size: 16px; padding: 5px; }
.side-title { font-size: 16px; border-bottom: #a2a3a2 1px solid; }
.side-tip { font-size: 13px; }
.date, .outline-button, .search-tab { font-size: 14px; }
.hero-subtitle { font-size: 14px; }
.search-input { font-size: 16px; }
.hot-search, .footer { font-size: 13px; }
.form-field label { font-size: 14px; }
.toast { font-size: 14px; }
.search-input-wrap { border: 1px solid var(--line); background: var(--surface-soft); padding: 0 12px; }
.search-input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-field.add-quick-field { display: flex; align-items: center; gap: 10px; }
.form-field.add-quick-field input[type="checkbox"] { width: auto; margin: 0; flex: none; }
.form-field.add-quick-field label { display: inline; margin: 0; font-size: 14px; cursor: pointer; }
@media (max-width: 640px) { .site-name { font-size: 13px; } }
