/* ============================================================
 * 数学工具箱 · 门户首页
 * 一套变量、两种工具卡片；不引入任何外部字体或框架。
 * ============================================================ */

:root {
    --ink: #0f172a;
    --ink-2: #48526d;
    --ink-3: #8d95a8;
    --line: #e4e7f0;
    --line-soft: #eef0f6;
    --bg: #f7f8fc;
    --card: #ffffff;
    --accent: #4f46e5;
    --accent-soft: #eef0ff;
    --rose: #e11d48;
    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(16, 23, 40, 0.04);
    --shadow-md: 0 12px 28px -18px rgba(16, 23, 40, 0.35);
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
            "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    /* 数字字体：不用带斜杠零的等宽字体，避免 0 显示成 Ø */
    --num: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
           "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
code { font-family: var(--num); font-size: 0.92em; }

.wrap {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 36px 40px;
}

.grow { flex: 1; }
.ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- 顶栏 ---------------- */
.nav {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 66px;
    border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 9px; }

.brand-mark {
    width: 27px; height: 27px;
    display: grid; place-items: center;
    background: var(--ink);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
}

.brand-name { font-weight: 650; font-size: 14.5px; letter-spacing: 0.2px; }

.nav-sep { color: #ccd2e0; margin: 0 2px; }
.nav-here { color: var(--ink-3); font-size: 13px; }
.nav-link {
    font-size: 13px;
    color: var(--ink-2);
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: #fff; color: var(--ink); }

/* ---------------- 首屏 ---------------- */
.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 56px;
    align-items: center;
    padding: 62px 0 58px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--ink-3);
    letter-spacing: 0.3px;
    margin-bottom: 20px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

h1 {
    font-size: clamp(34px, 4.4vw, 52px);
    line-height: 1.16;
    letter-spacing: -1.4px;
    font-weight: 700;
    color: var(--ink);
}
h1 em {
    font-style: normal;
    display: inline-block;
    margin-top: 4px;
    background: linear-gradient(96deg, #4f46e5 0%, #7c3aed 46%, #db2777 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lede {
    margin-top: 20px;
    max-width: 440px;
    font-size: 14.5px;
    line-height: 1.8;
    color: var(--ink-2);
}

.hero-facts {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 0;
    margin-top: 34px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    justify-content: start;
}
.fact { padding-right: 30px; }
.fact + .fact { padding-left: 30px; border-left: 1px solid var(--line); }
.fact-k { display: block; font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.3px; }
.fact-v { display: block; margin-top: 3px; font-size: 15px; font-weight: 600; font-family: var(--num); }

/* 右侧工具清单 */
.hero-side {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px 20px 16px;
    box-shadow: var(--shadow-sm);
}
.side-title {
    font-size: 11.5px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 10px;
}
.side-list { list-style: none; }
.side-list li + li { border-top: 1px solid var(--line-soft); }
.side-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 8px;
    margin: 0 -8px;
    border-radius: 10px;
    transition: background 0.15s;
}
.side-list a:hover { background: #fafbff; }
.side-no {
    font-family: var(--num);
    font-size: 11.5px;
    color: #b6bdcf;
    width: 20px;
    flex: none;
}
.side-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.side-name { font-size: 13.5px; font-weight: 600; }
.side-meta { font-size: 11.5px; color: var(--ink-3); font-family: var(--num); margin-top: 1px; }
.side-list .ico { color: #c2c9d9; flex: none; }
.side-list a:hover .ico { color: var(--accent); }
.side-note {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
    font-size: 11.5px;
    color: var(--ink-3);
}

/* ---------------- 工具卡片 ---------------- */
.tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    padding-bottom: 8px;
}

.tool {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.tool:hover {
    transform: translateY(-2px);
    border-color: #d8dcec;
    box-shadow: var(--shadow-md);
}

.tool-visual {
    height: 172px;
    background:
        radial-gradient(120% 120% at 50% 0%, #fbfcff 0%, #f4f6fc 100%);
    border-bottom: 1px solid var(--line-soft);
    display: grid;
    place-items: center;
    padding: 14px 18px;
    overflow: hidden;
}

.thumb { width: 100%; height: 100%; display: block; }

/* 计算器缩略图 */
.thumb-pad {
    width: 178px;
    background: #fff;
    border: 1px solid #e6e9f3;
    border-radius: 12px;
    padding: 9px;
    box-shadow: 0 10px 24px -18px rgba(16, 23, 40, 0.5);
    transform: rotate(-2deg);
}
.pad-screen {
    background: #f8f9fd;
    border: 1px solid #eef0f7;
    border-radius: 8px;
    padding: 6px 8px 7px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 8px;
}
.pad-screen span { font-family: var(--num); font-size: 9px; color: #b3bacb; }
.pad-screen strong { font-family: var(--num); font-size: 15px; color: var(--ink); letter-spacing: -0.4px; }

.pad-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}
.pad-key {
    height: 17px;
    display: grid;
    place-items: center;
    background: #f5f6fb;
    border-radius: 4px;
    font-family: var(--num);
    font-size: 8.5px;
    color: #6b748c;
}
.pad-key.is-op { background: var(--accent-soft); color: var(--accent); }
.pad-key.is-eq { background: var(--accent); color: #fff; }

.tool-body {
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.tool-head { display: flex; align-items: baseline; gap: 10px; }
.tool-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.2px; }
.ver {
    font-family: var(--num);
    font-size: 11px;
    color: var(--ink-3);
    background: #f4f5fa;
    border-radius: 5px;
    padding: 1px 6px;
}

.tool-desc {
    margin-top: 9px;
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--ink-2);
}

.tool-feats {
    list-style: none;
    margin-top: 14px;
    display: grid;
    gap: 7px;
}
.tool-feats li {
    position: relative;
    padding-left: 15px;
    font-size: 12.5px;
    color: var(--ink-3);
    line-height: 1.6;
}
.tool-feats li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #cfd5e4;
}
.tool-feats b { color: var(--ink-2); font-weight: 600; margin-right: 5px; }

.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
}
.tag {
    font-size: 11.5px;
    color: #5b6480;
    background: #f5f6fb;
    border: 1px solid #eceef6;
    border-radius: 999px;
    padding: 2px 9px;
}

.tool-cta {
    margin-top: auto;
    padding-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}
.tool-cta .ico { transition: transform 0.18s ease; }
.tool:hover .tool-cta .ico { transform: translateX(3px); }

.tool--calculator .tool-cta { color: #b5173f; }
.tool--calculator .ver { color: #a33; background: #fdf2f5; }

.tool--geometry .tool-cta { color: #0f766e; }
.tool--geometry .ver { color: #0f766e; background: #eff9f7; }

/* ---------------- 说明 ---------------- */
.notes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-top: 42px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}
.note h3 { font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.note p { font-size: 12.5px; line-height: 1.8; color: var(--ink-3); }

/* ---------------- 反馈 / 建议 ---------------- */
.fbwrap { margin-top: 42px; padding-top: 26px; border-top: 1px solid var(--line); }
.fbwrap h2 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.fb {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 18px 18px;
}
.fb-hint { margin: 0 0 12px; font-size: 12.5px; line-height: 1.8; color: var(--ink-3); }
.fb textarea {
    display: block;
    width: 100%;
    min-height: 92px;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafbfe;
    color: var(--ink);
    font: 13.5px/1.7 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.fb textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.fb-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.fb-count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fb-bar button {
    margin-left: auto;
    padding: 7px 22px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.fb-bar button:hover { filter: brightness(1.06); }
.fb-bar button:disabled { opacity: .55; cursor: not-allowed; }
.fb-msg { margin: 10px 0 0; min-height: 18px; font-size: 12.5px; color: var(--ink-2); }
.fb-msg:empty { display: none; }
.fb-msg.ok { color: #0b5c33; }
.fb-msg.err { color: #c2313f; }

/* 表单下方的两个外部联系方式：药丸状按钮，虚线与输入区分隔 */
.fb-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}
.fb-links .fb-sep { font-size: 12px; color: var(--ink-3); margin-right: 2px; }
.fb-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 5px 13px 5px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7f8fd;
    color: var(--accent);
    font-size: 12.5px;
    text-decoration: none;
    transition: border-color .15s, background .15s;
}
.fb-link::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .55;
    flex: none;
}
.fb-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.fb-link:hover::before { opacity: 1; }
.fb-link.mail::before { background: #b8770a; }
.fb-link.bili::before { background: #e5484d; }

/* ---------------- 页脚 ---------------- */
.foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-3);
}
.foot a { color: var(--ink-2); }
.foot a:hover { color: var(--accent); }
.foot a + a { margin-left: 16px; }
.foot-dot { color: #ccd2e0; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1040px) {
    .tools { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; gap: 34px; padding: 44px 0 40px; }
    .lede { max-width: 560px; }
    .hero-side { max-width: 560px; }
    .notes { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 780px) {
    .wrap { padding: 0 20px 32px; }
    .tools { grid-template-columns: 1fr; }
    .notes { grid-template-columns: 1fr; gap: 18px; }
    .nav-link { display: none; }
    .hero-facts { grid-template-columns: repeat(2, auto); row-gap: 14px; }
    .fact:nth-child(3) { padding-left: 0; border-left: 0; }
    .fact { padding-right: 22px; }
    .fact + .fact { padding-left: 22px; }
    h1 { letter-spacing: -0.8px; }
    .foot { flex-wrap: wrap; }
}

/* ---------- 顶栏里的登录状态 ---------- */
.sso-who {
    display: inline-flex; align-items: baseline; gap: 7px;
    font-size: 12px; color: #8d95a8; white-space: nowrap;
}
.sso-who b { font-weight: 600; color: #5b6480; }
.sso-who a { color: #a4abbe; text-decoration: none; }
.sso-who a:hover { color: #4f46e5; }

.sso-login {
    display: inline-flex; align-items: center; height: 28px; padding: 0 13px;
    border: 1px solid #d8dcf5; border-radius: 8px; background: #fff;
    font-size: 12px; color: #4f46e5; text-decoration: none; white-space: nowrap;
    transition: border-color .15s, background .15s;
}
.sso-login:hover { border-color: #b6b9f0; background: #f4f4ff; }

@media (max-width: 760px) {
    .sso-who b { display: none; }
}
