:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eef4ff;
    --ink: #152036;
    --muted: #68758b;
    --line: #e4eaf3;
    --surface: #ffffff;
    --soft: #f6f8fc;
    --success: #107c41;
    --danger: #c62828;
    --radius: 16px;
    --shadow-sm: 0 4px 16px rgba(31, 55, 91, .06);
    --shadow-md: 0 14px 38px rgba(31, 55, 91, .10);
    --shadow-lg: 0 24px 70px rgba(23, 48, 94, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 0%, rgba(37, 99, 235, .08), transparent 30rem),
        radial-gradient(circle at 92% 12%, rgba(124, 58, 237, .06), transparent 28rem),
        #f6f8fc;
    font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
button, input, select, textarea { font: inherit; }
.container { width: min(1220px, calc(100% - 40px)); margin: 0 auto; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 3000; background: #fff; padding: 9px 14px; border-radius: 8px; box-shadow: var(--shadow-md); }

/* 顶部导航 */
.site-header {
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid rgba(218, 226, 239, .86);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 6px 24px rgba(31, 55, 91, .05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.site-header-main { min-height: 76px; display: flex; align-items: center; gap: 18px; }
.site-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; white-space: nowrap; letter-spacing: -.02em; }
.site-brand img { max-height: 40px; width: auto; }
.site-brand span {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    color: var(--brand);
    background: linear-gradient(135deg, #eaf1ff, #f4efff);
    border: 1px solid #dbe6ff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.site-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 12px;
    color: #3c495f;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}
.nav-link:hover, .nav-link[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand); transform: translateY(-1px); }
.caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .7; transition: transform .18s ease; }
[aria-expanded="true"] > .caret { transform: rotate(180deg); }
.site-search { display: flex; margin-left: auto; min-width: 250px; position: relative; }
.site-search::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 50%;
    width: 14px;
    height: 14px;
    border: 2px solid #8a98af;
    border-radius: 50%;
    transform: translateY(-58%);
    pointer-events: none;
}
.site-search::after {
    content: "";
    position: absolute;
    left: 25px;
    top: 58%;
    width: 6px;
    height: 2px;
    background: #8a98af;
    transform: rotate(45deg);
    pointer-events: none;
}
.site-search input {
    width: 100%;
    min-width: 0;
    border: 1px solid #dce4f0;
    border-right: 0;
    border-radius: 11px 0 0 11px;
    padding: 10px 12px 10px 36px;
    outline: none;
    background: #f9fbfe;
    color: var(--ink);
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.site-search input:focus { border-color: #93b4ff; background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }
.site-search button {
    border: 0;
    border-radius: 0 11px 11px 0;
    background: linear-gradient(135deg, var(--brand), #4f7df3);
    color: #fff;
    padding: 0 18px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(37, 99, 235, .20);
}
.nav-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 13px; color: #344054; cursor: pointer; }
.nav-mega { position: relative; }
.nav-mega summary { list-style: none; }
.nav-mega summary::-webkit-details-marker { display: none; }


/* 首页首屏 */
.modern-main { padding: 34px 0 58px; }
.hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 54px 56px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 28px;
    color: #fff;
    background:
        radial-gradient(circle at 88% 18%, rgba(147, 197, 253, .40), transparent 20rem),
        radial-gradient(circle at 12% 100%, rgba(124, 58, 237, .34), transparent 24rem),
        linear-gradient(125deg, #12346f 0%, #1e56c9 48%, #3f74ea 100%);
    margin-bottom: 34px;
    box-shadow: 0 26px 60px rgba(30, 79, 180, .22);
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, .65), transparent 80%);
    -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, .65), transparent 80%);
}
.hero::after {
    content: "{ }";
    position: absolute;
    right: 42px;
    top: 42px;
    z-index: -1;
    color: rgba(255, 255, 255, .10);
    font: 800 128px/1 Consolas, monospace;
    letter-spacing: -14px;
    transform: rotate(-7deg);
    user-select: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { max-width: 760px; font-size: clamp(32px, 4vw, 44px); line-height: 1.2; letter-spacing: -.035em; margin: 0 0 16px; font-weight: 850; }
.hero p { max-width: 760px; font-size: 17px; line-height: 1.85; margin: 0 0 26px; color: rgba(255, 255, 255, .90); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; padding: 10px 20px; font-weight: 750; box-shadow: 0 8px 20px rgba(8, 28, 70, .14); transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.hero .btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(8, 28, 70, .20); }
.hero .btn-primary { background: #fff; border-color: #fff; color: #1e56c9; }
.hero .btn-primary:hover { background: #f4f7ff; }
.hero .btn-secondary { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .30); color: #fff; backdrop-filter: blur(6px); }
.hero .btn-secondary:hover { background: rgba(255, 255, 255, .20); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(120px, 170px)); gap: 12px; margin-top: 30px; }
.stats > div { padding: 13px 16px; background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .17); border-radius: 13px; backdrop-filter: blur(8px); }
.stats strong { display: block; font-size: 27px; line-height: 1.25; letter-spacing: -.03em; }
.stats span { font-size: 12px; color: rgba(255, 255, 255, .78); }

/* 通用按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    border: 1px solid #cfe0ff;
    border-radius: 10px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    background: #fff;
    color: var(--brand);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.btn:hover { background: #f3f7ff; border-color: #a9c5ff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 99, 235, .10); }
.btn-primary { background: linear-gradient(135deg, var(--brand), #4b7ef0); border-color: transparent; color: #fff; box-shadow: 0 7px 18px rgba(37, 99, 235, .18); }
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-dark), #386de0); color: #fff; }
.btn-secondary { background: #f1f5fb; border-color: #e2e8f2; color: #40506a; box-shadow: none; }
.btn-secondary:hover { background: #e9eff8; border-color: #d5deeb; }

/* 区块与卡片 */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 38px 0 18px; }
.section-head h2 { margin: 0; font-size: 24px; line-height: 1.35; letter-spacing: -.02em; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.section-head > a { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-size: 13px; font-weight: 700; white-space: nowrap; }
.section-head > a:hover { background: #e0eaff; }
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.category-card, .tool-card {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    transition: transform .20s ease, box-shadow .20s ease, border-color .20s ease;
}
.category-card::before, .tool-card::before {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--brand), #8b5cf6);
    opacity: 0;
    transform: scaleX(.55);
    transition: opacity .20s ease, transform .20s ease;
}
.category-card:hover, .tool-card:hover { border-color: #c4d6fa; box-shadow: var(--shadow-md); transform: translateY(-4px); }
.category-card:hover::before, .tool-card:hover::before { opacity: 1; transform: scaleX(1); }
.category-card { display: flex; flex-direction: column; min-height: 202px; padding: 23px; }
.category-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    background: linear-gradient(145deg, #eaf2ff, #f3efff);
    color: var(--brand);
    border: 1px solid #dfe9ff;
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
    font-size: 16px;
    font-weight: 850;
}
.category-card h3 { margin: 16px 0 6px; font-size: 18px; line-height: 1.4; color: var(--ink); letter-spacing: -.01em; }
.category-card p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--muted); margin: 0; line-height: 1.7; }
.category-card small { display: inline-flex; align-items: center; align-self: flex-start; margin-top: auto; padding-top: 14px; color: var(--brand); font-size: 12px; font-weight: 750; }
.tool-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.tool-toolbar input, .tool-toolbar select { border: 1px solid #dce4f0; border-radius: 10px; padding: 10px 13px; background: #f9fbfe; color: var(--ink); outline: none; }
.tool-toolbar input { flex: 1; min-width: 240px; }
.tool-toolbar input:focus, .tool-toolbar select:focus { border-color: #9bbaff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .09); background: #fff; }
#toolCount { color: var(--muted); font-size: 13px; white-space: nowrap; padding-right: 6px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool-card { display: flex; flex-direction: column; min-height: 174px; padding: 21px; }
.tool-card h3 { padding-right: 22px; font-size: 16.5px; line-height: 1.45; margin: 0 0 8px; color: var(--ink); letter-spacing: -.01em; }
.tool-card h3::after { content: "→"; position: absolute; right: 20px; top: 21px; color: #9aabc5; font-size: 17px; transition: color .18s ease, transform .18s ease; }
.tool-card:hover h3::after { color: var(--brand); transform: translateX(3px); }
.tool-card p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--muted); margin: 0; line-height: 1.75; }
.tool-card .tool-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 16px; font-size: 11px; color: #7b899f; }
.tool-card .tool-meta span:first-child { display: grid; place-items: center; min-width: 29px; height: 29px; padding: 0 7px; color: var(--brand); background: var(--brand-soft); border-radius: 9px; font-size: 11px; font-weight: 800; }
.tool-card .tool-meta span:last-child { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; background: #f5f8fc; border-radius: 999px; white-space: nowrap; }
.tool-card .tool-meta span:last-child::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 3px rgba(34, 160, 107, .10); }

/* 列表页与详情页 */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; list-style: none; padding: 11px 15px; margin: 0 0 20px; background: rgba(255, 255, 255, .78); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; }
.breadcrumb a { color: #52627b; }
.breadcrumb a:hover { color: var(--brand); }
.page-title { font-size: clamp(27px, 3.5vw, 34px); line-height: 1.3; letter-spacing: -.025em; margin: 0 0 10px; color: var(--ink); }
.page-intro { max-width: 860px; color: var(--muted); margin: 0 0 12px; font-size: 15px; line-height: 1.8; }
.group-title { display: flex; align-items: center; gap: 9px; font-size: 18px; margin: 30px 0 14px; color: #253653; }
.group-title::before { content: ""; width: 5px; height: 20px; border-radius: 4px; background: linear-gradient(180deg, var(--brand), #8b5cf6); box-shadow: 0 3px 9px rgba(37, 99, 235, .20); }
.tool-shell { max-width: 1040px; margin: 0 auto; }
.tool-page .page-title { font-size: clamp(29px, 4vw, 38px); }
.tool-page .page-intro { margin-bottom: 8px; }
.tool-workbench {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, .98);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 28px;
    margin-top: 22px;
    box-shadow: var(--shadow-md);
}
.tool-workbench::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--brand), #7c3aed, #06b6d4); }
.tool-grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tool-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.tool-field.full { grid-column: 1 / -1; }
.tool-field label { color: #33415a; font-weight: 700; font-size: 13px; }
.tool-field small { color: #8793a7; font-size: 12px; }
.tool-field input, .tool-field select, .tool-field textarea {
    width: 100%;
    border: 1px solid #d9e2ef;
    border-radius: 11px;
    padding: 11px 12px;
    font: inherit;
    background: #fbfcff;
    color: var(--ink);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.tool-field input, .tool-field select { min-height: 43px; }
.tool-field textarea { min-height: 236px; resize: vertical; font-family: Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.7; }
.tool-field input:hover, .tool-field select:hover, .tool-field textarea:hover { border-color: #c2d1e8; }
.tool-field input:focus, .tool-field select:focus, .tool-field textarea:focus { outline: none; border-color: #84aaff; background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .09); }
.tool-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 20px; padding-bottom: 18px; border-bottom: 1px solid #edf1f7; }
.tool-result {
    white-space: pre-wrap;
    word-break: break-word;
    background: #101a2d;
    border: 1px solid #1d2b44;
    border-radius: 13px;
    padding: 17px 18px;
    min-height: 58px;
    margin-top: 20px;
    color: #dce7f8;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.75;
}
.tool-result.error { color: #fecaca; background: #2a1620; border-color: #6b293c; }
.tool-result.success { color: #bbf7d0; }
.tool-note { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; color: #75839a; margin: 16px 0 0; padding: 12px 14px; background: #f4f7fc; border: 1px solid #e6ecf5; border-radius: 11px; line-height: 1.7; }
.tool-note::before { content: "i"; display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; border-radius: 50%; color: var(--brand); background: #dfeaff; font: 800 12px/1 Georgia, serif; }
.preview-frame { width: 100%; min-height: 320px; margin-top: 18px; border: 1px solid #dce4f0; border-radius: 13px; background: #fff; box-shadow: var(--shadow-sm); }
.tool-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tool-table th, .tool-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.tool-table th { background: #eef4ff; color: #24406d; }

/* 教程与页脚 */
.learning-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.learning-links a { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 17px; color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.learning-links a:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #c4d6fa; }
.site-footer { background: linear-gradient(135deg, #101a2d, #162641); color: #aab7cb; padding: 36px 0; margin-top: 44px; font-size: 13px; }
.site-footer a { color: #d8e6ff; }
.site-footer a:hover { color: #fff; }
.footer.navbar-bottom { background: linear-gradient(135deg, #101a2d, #162641); color: #aab7cb; padding: 30px 0; margin-top: 44px; border: 0; border-radius: 0; text-align: center; font-size: 12px; line-height: 1.9; }
.footer.navbar-bottom a { color: #d8e6ff; margin: 0 4px; }
.footer.navbar-bottom a:hover { color: #fff; }
.footer.navbar-bottom em { color: #7f91ad; font-style: normal; }
.modern-bottom { padding: 26px 0; }
.empty-state { padding: 42px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed #cfd9e8; border-radius: 16px; }
.tool-page .container > .row, .tool-page .sidebar-offcanvas { display: none; }

@media (max-width: 1100px) {
    .site-header-main { flex-wrap: wrap; padding: 11px 0; }
    .site-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
    .site-search { min-width: 220px; }
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .tool-grid { grid-template-columns: repeat(2, 1fr); }
    .hero { padding: 46px 42px; }
}

@media (max-width: 820px) {
    .container { width: calc(100% - 28px); }
    .site-brand span { display: none; }
    .site-search { min-width: 200px; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .hero::after { right: 18px; top: 24px; font-size: 94px; }
    .hero h1 { max-width: 620px; }
    .tool-grid-form { grid-template-columns: 1fr; }
    .tool-field.full { grid-column: auto; }
}

@media (max-width: 700px) {
    .modern-main { padding: 22px 0 42px; }
    .nav-toggle { display: block; margin-left: auto; }
    .site-nav { display: none; }
    .site-nav.open { display: flex; }
    .site-search { order: 4; width: 100%; margin: 0; }
    .hero { padding: 32px 25px; border-radius: 22px; margin-bottom: 28px; }
    .hero h1 { font-size: 30px; }
    .hero p { font-size: 15px; line-height: 1.8; }
    .hero::after { display: none; }
    .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 24px; }
    .stats > div { padding: 11px 10px; }
    .stats strong { font-size: 22px; }
    .stats span { font-size: 10px; }
    .category-grid, .tool-grid, .learning-links { grid-template-columns: 1fr; }
    .category-card { min-height: 0; }
    .tool-card { min-height: 0; }
    .section-head { align-items: flex-start; flex-direction: column; margin-top: 30px; }
    .section-head h2 { font-size: 21px; }
    .tool-toolbar { padding: 10px; }
    .tool-toolbar input { min-width: 100%; }
    #toolCount { padding-left: 4px; }
    .tool-workbench { padding: 19px 16px; border-radius: 18px; }
    .tool-actions .btn { flex: 1 1 calc(50% - 6px); }
    .tool-result { padding: 14px; font-size: 12px; }
    .tool-note { font-size: 11px; }
    .page-title { font-size: 27px; }
    .nav-menu-layer { padding: 12px; }
    .nav-menu-dialog { max-height: 82vh; border-radius: 16px; }
    .nav-menu-header { padding: 16px; gap: 10px; }
    .nav-menu-header h2 { font-size: 18px; }
    .nav-menu-header p { font-size: 12px; }
    .nav-menu-header .mega-more { display: none; }
    .nav-menu-body { padding: 14px 16px 17px; }
    .mega-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mega-tool-grid, .learning-menu-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .hero { padding: 28px 20px; }
    .hero h1 { font-size: 27px; }
    .hero-actions { display: grid; grid-template-columns: 1fr; }
    .hero-actions .btn { width: 100%; }
    .stats > div { padding: 10px 8px; }
    .stats strong { font-size: 20px; }
    .category-card, .tool-card { padding: 19px; }
    .tool-actions .btn { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
