* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    background: #f5f7fb;
    color: #222;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}


/* =========================
   顶部导航
========================= */

header {
    background: #ffffff;
    border-bottom: 1px solid #e7eaf0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    max-width: 1300px;
    height: 54px;
    margin: 0 auto;
    padding: 0 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}

.logo {
    font-size: 21px;
    font-weight: bold;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-links a {
    font-size: 13px;
    color: #555;
}

.nav-links a:hover {
    color: #1677ff;
}


/* =========================
   首页
========================= */

.hero {
    max-width: 1300px;
    margin: 0 auto;
    padding: 18px 18px 12px;
    text-align: center;
}

.hero h1 {
    font-size: 27px;
    line-height: 1.3;
    margin-bottom: 4px;
}

.hero p {
    font-size: 13px;
    color: #777;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 8px 18px 24px;
}


/* 首页工具总标题 */

.dashboard-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 10px;
}

.dashboard-title h2 {
    font-size: 20px;
}

.dashboard-title p {
    color: #888;
    font-size: 12px;
}


/* =========================
   首页：一行6个工具
========================= */

.all-tools-grid {
    display: grid;

    grid-template-columns:
        repeat(6, minmax(0, 1fr));

    gap: 11px;
}

.tool-link {
    display: block;
    min-width: 0;
}

.tool-card {
    height: 148px;

    background: #ffffff;

    border: 1px solid #e8ebf1;

    border-radius: 12px;

    padding: 12px;

    display: flex;
    flex-direction: column;

    box-shadow:
        0 3px 12px
        rgba(0, 0, 0, 0.035);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease;
}

.tool-card:hover {
    transform: translateY(-2px);

    border-color: #b8ccff;

    box-shadow:
        0 7px 18px
        rgba(0, 0, 0, 0.07);
}


/* 卡片顶部 */

.tool-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 5px;
}

.tool-icon {
    font-size: 25px;
    line-height: 1;
}

.tool-category {
    padding: 2px 7px;

    border-radius: 20px;

    background: #eef3ff;

    color: #4c7dff;

    font-size: 10px;
}


/* 卡片文字 */

.tool-card h3 {
    font-size: 15px;

    line-height: 1.35;

    margin-bottom: 3px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.tool-card p {
    color: #777;

    font-size: 11px;

    line-height: 1.45;

    height: 31px;

    overflow: hidden;

    margin-bottom: 7px;
}


/* 小按钮 */

.tool-button {
    display: inline-block;

    align-self: flex-start;

    margin-top: auto;

    background: #1677ff;

    color: white;

    border-radius: 6px;

    padding: 5px 10px;

    font-size: 11px;
}


/* =========================
   首页底部简介
========================= */

.about-section {
    margin-top: 14px;

    padding: 14px 18px;

    background: #ffffff;

    border: 1px solid #e8ebf1;

    border-radius: 12px;
}

.about-section h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.about-section p {
    font-size: 12px;
    color: #666;
}


/* =========================
   工具独立页面
========================= */

.page-title {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 18px 8px;
}

.back-link {
    display: inline-block;

    margin-bottom: 10px;

    color: #4c7dff;

    font-size: 14px;
}

.page-title h1 {
    font-size: 30px;
    margin-bottom: 5px;
}

.page-title p {
    color: #777;
    font-size: 14px;
}

.tool-page {
    max-width: 1000px;

    margin: 0 auto;

    padding: 12px 18px 35px;
}

.tool-box {
    background: #ffffff;

    border: 1px solid #e8ebf1;

    border-radius: 14px;

    padding: 22px;

    box-shadow:
        0 4px 18px
        rgba(0, 0, 0, 0.04);
}


/* =========================
   表单
========================= */

textarea,
input[type="text"],
input[type="number"],
select {
    width: 100%;

    padding: 12px;

    border: 1px solid #d9dee8;

    border-radius: 9px;

    outline: none;

    background: white;

    font-size: 15px;

    font-family:
        "Microsoft YaHei",
        Arial,
        sans-serif;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

textarea:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: #4c7dff;

    box-shadow:
        0 0 0 3px
        rgba(76, 125, 255, 0.08);
}


/* =========================
   按钮
========================= */

.buttons {
    display: flex;
    flex-wrap: wrap;

    gap: 9px;

    margin-top: 15px;
}

button {
    border: none;

    border-radius: 8px;

    padding: 9px 16px;

    font-size: 14px;

    cursor: pointer;
}

.primary-btn {
    background: #1677ff;
    color: white;
}

.dark-btn {
    background: #222;
    color: white;
}

.light-btn {
    background: #edf0f5;
    color: #222;
}

.success-btn {
    background: #16a34a;
    color: white;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* =========================
   字数统计
========================= */

.result-box {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 12px;

    margin-top: 16px;
}

.result {
    background: #f5f7fb;

    border-radius: 9px;

    padding: 15px;

    text-align: center;
}

.result-number {
    font-size: 25px;
    font-weight: bold;
}

.result-name {
    margin-top: 3px;

    color: #777;

    font-size: 13px;
}


/* =========================
   密码工具
========================= */

.length-row {
    display: flex;

    align-items: center;

    gap: 15px;
}

.length-row input {
    max-width: 130px;
}

.password-options {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 12px;

    margin-top: 16px;
}

.option-box {
    padding: 13px;

    background: #f7f8fb;

    border-radius: 9px;
}

.option-box label {
    display: flex;

    align-items: center;

    gap: 8px;

    cursor: pointer;
}

.password-output {
    margin-top: 16px;
}

.password-output input {
    font-size: 17px;
    font-weight: bold;
}


/* =========================
   通用结果区域
========================= */

.converter-result {
    margin-top: 18px;
}

.converter-result textarea {
    background: #f8f9fb;
}

.status-text {
    min-height: 21px;

    margin-top: 10px;

    color: #4c7dff;

    font-size: 13px;
}

.tips {
    margin-top: 17px;

    padding: 14px;

    background: #f7f9ff;

    border-radius: 9px;

    color: #666;

    font-size: 13px;

    line-height: 1.8;
}


/* =========================
   Footer
========================= */

footer {
    padding: 15px 15px 22px;

    text-align: center;

    color: #888;

    font-size: 12px;
}

footer a {
    color: #4c7dff;
}


/* =========================
   屏幕适配
========================= */

/* 普通笔记本仍保持6列 */

@media (max-width: 1180px) {

    .all-tools-grid {
        grid-template-columns:
            repeat(5, minmax(0, 1fr));
    }

}


/* 平板 */

@media (max-width: 900px) {

    .all-tools-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

}


/* 手机 */

@media (max-width: 620px) {

    .nav {
        height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .nav-links {
        display: none;
    }

    .hero h1 {
        font-size: 23px;
    }

    .all-tools-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .tool-card {
        height: 145px;
    }

    .result-box {
        grid-template-columns: 1fr;
    }

    .password-options {
        grid-template-columns: 1fr;
    }

}


/* 很窄的手机 */

@media (max-width: 380px) {

    .all-tools-grid {
        grid-template-columns: 1fr;
    }

}