/* ============================================================
   第二教育网 · 首页视觉层（重新设计 2026-08-22）
   现代清爽 · 资源枢纽风格
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

:root {
    --primary: #4F46E5;
    --primary-2: #6366F1;
    --primary-3: #818CF8;
    --violet: #7C3AED;
    --bg: #F6F7FB;
    --surface: #FFFFFF;
    --surface-2: #F1F3F9;
    --border: #E6E9F2;
    --text: #0F172A;
    --text-2: #475569;
    --muted: #64748B;
    --faint: #94A3B8;
    --primary-soft: #EEF2FF;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow: 0 2px 8px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .05);
    --shadow-hover: 0 10px 30px rgba(79, 70, 229, .14);
    --shadow-lg: 0 14px 44px rgba(79, 70, 229, .18);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --transition: .22s ease;
}
body.dark {
    --bg: #0B1020;
    --surface: #151B2E;
    --surface-2: #1B2236;
    --border: #2A3450;
    --text: #E8ECF5;
    --text-2: #A8B2C8;
    --muted: #8A95AD;
    --faint: #5B6680;
    --primary-soft: #1E2545;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 2px 10px rgba(0, 0, 0, .45);
    --shadow-hover: 0 10px 30px rgba(79, 70, 229, .3);
    --shadow-lg: 0 14px 44px rgba(79, 70, 229, .35);
}
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .3s, color .3s;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}
a { text-decoration: none; color: inherit; }
input {
    font-family: inherit; font-size: inherit; outline: none;
    border: none; background: transparent; color: var(--text);
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------------- Top bar (slim nav) ---------------- */
.header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    transition: background .3s, border-color .3s;
}
body.dark .header { background: rgba(11, 16, 32, .8); }
.header-inner {
    display: flex; align-items: center; justify-content: flex-start;
    gap: 16px; min-height: 62px; padding: 8px 0; flex-wrap: wrap;
}
.brand { font-size: 18px; font-weight: 800; flex-shrink: 0; }
.header-search { margin-left: auto; margin-right: auto; }
.nav { margin-left: auto; }
.brand a { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand .logo {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--violet));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 900; letter-spacing: .5px; flex-shrink: 0;
}
.brand .dom { font-size: 12px; color: var(--faint); font-weight: 500; letter-spacing: .5px; }

.nav { display: flex; align-items: center; gap: 4px; flex-shrink: 0; flex-wrap: wrap; }
.nav a {
    padding: 7px 14px; border-radius: var(--radius-pill);
    font-size: 14px; color: var(--text-2); transition: var(--transition);
    font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--primary-soft); }
.theme-toggle {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--border); background: #EAEFF6;
    color: var(--text-2); font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); flex-shrink: 0; margin-left: 4px;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--text); }
body.dark .theme-toggle { background: #334155; border-color: #475569; }

/* ---------------- Top latest-articles ticker ---------------- */
.news-ticker {
    display: flex; align-items: center; gap: 8px;
    width: 220px; flex-shrink: 0;
}
.news-ticker .label {
    font-size: 12px; font-weight: 800; color: var(--primary);
    white-space: nowrap; letter-spacing: .3px;
    background: var(--primary-soft); padding: 3px 7px; border-radius: 6px;
}
.news-ticker .roll {
    height: 38px; overflow: hidden; position: relative; flex: 1;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.news-ticker .items {
    position: absolute; top: 0; left: 0; width: 100%;
    transition: transform .45s ease;
}
.news-ticker .items a {
    display: block; height: 38px; line-height: 38px; padding: 0 10px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 13px; color: var(--text-2); transition: color .2s;
}
.news-ticker .items a:hover { color: var(--primary); }

/* ---------------- Hero ---------------- */
.hero {
    position: relative; overflow: hidden;
    background:
        radial-gradient(900px 420px at 50% -30%, rgba(99, 102, 241, .14), transparent 60%),
        linear-gradient(180deg, #EEF2FF 0%, #F6F7FB 100%);
    border-bottom: 1px solid var(--border);
    padding: 60px 0 46px;
}
body.dark .hero {
    background:
        radial-gradient(900px 420px at 50% -30%, rgba(124, 58, 237, .22), transparent 60%),
        linear-gradient(180deg, #161B33 0%, #0B1020 100%);
}
.hero-inner { text-align: center; max-width: 820px; margin: 0 auto; }
.hero-eyebrow {
    font-size: 13px; font-weight: 700; letter-spacing: 2px;
    color: var(--primary); text-transform: none; margin-bottom: 12px;
}
.hero-title {
    font-size: 40px; font-weight: 900; line-height: 1.18;
    letter-spacing: -.5px; color: var(--text);
}
.hero-sub { font-size: 16px; color: var(--muted); margin: 14px 0 28px; }
.hero-search-slot { width: 100%; max-width: 620px; margin: 0 auto; display: flex; justify-content: center; }
/* 搜索框基础样式：无论位于顶栏还是 Hero 都能正常显示（JS 会把顶栏搜索框移入 Hero）*/
.header-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius-pill); padding: 6px 6px 6px 16px; max-width: 420px;
}
.header-search input { flex: 1; min-width: 0; }
.header-search button {
    padding: 9px 20px; border-radius: var(--radius-pill); flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--violet));
    color: #fff; font-weight: 700; cursor: pointer;
}
.hero .header-search {
    width: 100%; background: var(--surface);
    box-shadow: var(--shadow); border: 1.5px solid var(--border);
    padding: 6px 6px 6px 20px;
}
.hero .header-search:focus-within { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.hero .header-search input { font-size: 15px; padding: 12px 0; flex: 1; min-width: 0; }
/* 搜索引擎切换（必应/百度）分段控件 */
.hero .header-search .engines {
    display: flex; align-items: center; gap: 2px; flex-shrink: 0;
    background: var(--surface-2); border-radius: var(--radius-pill); padding: 3px;
}
.hero .header-search .engines span {
    padding: 6px 12px; border-radius: var(--radius-pill); font-size: 13px;
    font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap;
    transition: var(--transition);
}
.hero .header-search .engines span:hover { color: var(--text); }
.hero .header-search .engines span.on {
    background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm);
}
.hero .header-search button { padding: 11px 28px; font-size: 15px; min-height: 48px; }
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.hero-chip {
    padding: 8px 16px; border-radius: var(--radius-pill);
    background: var(--surface); border: 1px solid var(--border);
    font-size: 13px; color: var(--text-2); transition: var(--transition);
    white-space: nowrap;
}
.hero-chip:hover {
    border-color: var(--primary); color: var(--primary);
    transform: translateY(-2px); box-shadow: var(--shadow-sm);
}

/* ---------------- Category pillbar (sticky horizontal scroll) ---------------- */
.pillbar {
    position: sticky; top: 62px; z-index: 40;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 10px 0; overflow-x: auto;
    transition: background .3s, border-color .3s;
    /* 显示细滚动条，提示可横向滑动 */
    scrollbar-width: thin;
    scrollbar-color: var(--faint) transparent;
}
body.dark .pillbar { background: rgba(11, 16, 32, .88); }
.pillbar::-webkit-scrollbar { height: 6px; }
.pillbar::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 99px; }
.pillbar::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.pillbar .inner {
    display: flex; gap: 6px; padding: 0 24px;
    max-width: 1200px; margin: 0 auto;
}
.pillbar a {
    flex-shrink: 0; padding: 6px 14px; border-radius: var(--radius-pill);
    font-size: 13px; font-weight: 600; color: var(--text-2);
    background: var(--surface-2); transition: var(--transition); white-space: nowrap;
    min-height: 32px; display: flex; align-items: center;
}
.pillbar a:hover { color: var(--text); background: var(--border); }
.pillbar a.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, .3); }
/* 左右渐变提示：告诉用户还有更多分类可滑动 */
.pillbar { position: sticky; }
.pillbar::before,
.pillbar::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 24px; pointer-events: none; z-index: 2;
}
.pillbar::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.pillbar::after { right: 0; background: linear-gradient(-90deg, var(--bg), transparent); }
body.dark .pillbar::before { background: linear-gradient(90deg, var(--bg), transparent); }
body.dark .pillbar::after { background: linear-gradient(-90deg, var(--bg), transparent); }

/* ---------------- Content / sections ---------------- */
.content { padding: 18px 0 48px; }
section { margin-bottom: 8px; scroll-margin-top: 130px; }
.section-header {
    display: flex; align-items: center; gap: 12px;
    margin: 38px 0 16px;
}
.section-header h2 {
    font-size: 21px; font-weight: 800; display: flex; align-items: center; gap: 9px;
    letter-spacing: -.2px;
}
.section-header h2 .icon { font-size: 23px; }
.section-header .desc { font-size: 13px; color: var(--faint); font-weight: 400; margin-left: 10px; }
.section-header .count {
    font-size: 12px; font-weight: 700; color: var(--primary);
    background: var(--primary-soft); padding: 4px 12px; border-radius: var(--radius-pill);
    flex-shrink: 0; margin-left: auto;
}

.cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(264px, 1fr)); gap: 14px;
}
.card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: var(--transition); cursor: pointer; box-shadow: var(--shadow-sm);
    min-height: 74px; will-change: transform;
}
.card:hover {
    border-color: var(--primary); transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}
.card .favicon {
    flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 17px; color: #fff; overflow: hidden;
}
.card .favicon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .info { flex: 1; min-width: 0; }
.card .info h4 { font-size: 15px; font-weight: 700; color: var(--text); }
.card .info p {
    font-size: 13px; color: var(--muted); margin-top: 3px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
/* 隐藏所有卡片右箭头（站点卡片已在 JS 模板中移除，新闻块仍保留，统一隐藏） */
.card .arrow { display: none; }

.no-result { display: none; text-align: center; padding: 60px 0; color: var(--muted); font-size: 14px; }

/* ---------------- News block ---------------- */
.news-block { padding: 4px 0 36px; }
.news-block .section-header { margin-top: 44px; }
.news-block .card .favicon { font-size: 19px; }

/* ---------------- Footer ---------------- */
.footer {
    border-top: 1px solid var(--border); padding: 26px 0 34px;
    text-align: center; font-size: 13px; color: var(--text-2);
}
.footer .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; margin-bottom: 10px; }
.footer .links a { color: var(--text-2); transition: var(--transition); }
.footer .links a:hover { color: var(--text); }
.footer .links a.primary-link { color: var(--primary); font-weight: 600; }
.footer .copy { font-size: 12px; color: var(--faint); line-height: 1.8; }
.footer .copy .icp { color: var(--faint); }

/* ---------------- Back to top / feedback ---------------- */
.backtop {
    position: fixed; right: 20px; bottom: 24px; z-index: 45;
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-2); font-size: 18px; cursor: pointer;
    display: none; align-items: center; justify-content: center;
    box-shadow: var(--shadow); transition: var(--transition);
}
.backtop:hover { border-color: var(--primary); color: var(--text); transform: translateY(-2px); }
.fb-btn {
    position: fixed; right: 20px; bottom: 82px; z-index: 45;
    padding: 9px 18px; border-radius: var(--radius-pill);
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-2); font-size: 13px; cursor: pointer;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 6px;
    transition: var(--transition); min-height: 40px;
}
.fb-btn:hover { border-color: var(--primary); color: var(--text); }

/* ---------------- Responsive ---------------- */
@media (max-width: 820px) {
    .brand { font-size: 16px; }
    .brand .dom { display: none; }
    .header { position: static; }
    .header-inner { min-height: auto; padding: 10px 0 6px; gap: 10px; }
    .header-search { margin-left: 0; margin-right: 0; }
    .nav { margin-left: 0; }
    .nav a { font-size: 12px; padding: 5px 10px; }
    .news-ticker { width: 100%; order: 3; padding-top: 6px; margin-top: 2px; border-top: 1px solid var(--border); }
    .news-ticker .roll { height: 30px; flex: 1; background: transparent; border: none; border-radius: 0; }
    .news-ticker .items a { height: 30px; line-height: 30px; font-size: 13px; padding: 0; }
    .pillbar { top: 0; padding: 8px 0; }
    .pillbar .inner { padding: 0 16px; gap: 5px; }
    .pillbar a { font-size: 12px; padding: 5px 12px; min-height: 28px; }
    .pillbar::before, .pillbar::after { width: 16px; }
    .hero { padding: 40px 0 32px; }
    .hero-title { font-size: 27px; }
    .hero-sub { font-size: 14px; margin: 12px 0 22px; }
    .hero .header-search { padding: 4px 4px 4px 14px; }
    .hero .header-search input { font-size: 14px; padding: 10px 0; }
    .hero .header-search button { padding: 9px 20px; font-size: 14px; min-height: 42px; }
    .hero .header-search .engines span { padding: 5px 10px; font-size: 12px; }
    section { scroll-margin-top: 64px; }
    .section-header { margin: 28px 0 12px; flex-wrap: wrap; }
    .section-header h2 { font-size: 18px; }
    .section-header .desc { display: none; }
    .cards { grid-template-columns: 1fr; }
    .card { padding: 13px 14px; min-height: 64px; }
    .news-block .card .favicon { font-size: 17px; }
    .fb-btn { right: 16px; bottom: 76px; font-size: 12px; padding: 7px 14px; min-height: 36px; }
    .backtop { right: 16px; bottom: 16px; width: 42px; height: 42px; font-size: 16px; }
}
@media (max-width: 480px) {
    .container { padding: 0 14px; }
    .brand { font-size: 15px; }
    .brand .logo { width: 30px; height: 30px; font-size: 11px; }
    .nav a { font-size: 11px; padding: 4px 8px; }
    .theme-toggle { width: 32px; height: 32px; font-size: 14px; }
    .hero-title { font-size: 23px; }
    .hero-chips { gap: 8px; }
    .hero-chip { font-size: 12px; padding: 7px 13px; }
    .hero .header-search .engines span { padding: 4px 8px; font-size: 11px; }
}
@media (pointer: coarse) {
    .card, .pillbar a, .nav a, .fb-btn, .backtop, .header-search button, .hero-chip { cursor: default; }
}
