/* ========== 基础 ========== */
:root {
    --primary: #16a34a;
    --primary-dark: #15803d;
    --primary-light: #dcfce7;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --bg: #f6f8f7;
    --card-bg: #ffffff;
    --danger: #dc2626;
    --warning: #d97706;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-hover: 0 8px 24px rgba(22, 163, 74, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; width: 100%; }
.main { flex: 1; padding-top: 24px; padding-bottom: 48px; }

code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .9em;
    color: #374151;
}

/* ========== 头部导航 ========== */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    height: 60px;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}
.logo:hover { color: var(--text); }

.logo-mark {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, #22c55e, #15803d);
    position: relative;
}
.logo-mark::after {
    content: "";
    position: absolute;
    left: 7px; top: 7px;
    width: 12px; height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    border-right-color: transparent;
    transform: rotate(-45deg);
}

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
    padding: 6px 12px;
    border-radius: 8px;
    color: #374151;
    font-size: 14.5px;
}
.site-nav a:hover { background: var(--primary-light); color: var(--primary-dark); }

.nav-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: 0;
    cursor: pointer;
    width: 40px; height: 40px;
}
.nav-toggle span {
    display: block;
    width: 22px; height: 2px;
    background: var(--text);
    margin: 5px auto;
    border-radius: 2px;
}

/* ========== 首页 Hero ========== */
.hero {
    text-align: center;
    padding: 44px 16px 36px;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 100%);
    border-radius: 0 0 28px 28px;
    margin: -24px -16px 28px;
}
.hero-title { font-size: 34px; font-weight: 800; letter-spacing: 1px; }
.hero-slogan { color: var(--text-light); margin-top: 10px; font-size: 15.5px; }

/* ========== 工具卡片 ========== */
.tool-section { margin-bottom: 36px; }
.section-title {
    font-size: 19px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.title-bar { width: 4px; height: 18px; background: var(--primary); border-radius: 2px; }

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.tool-card {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    color: var(--text);
}
.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: #bbf7d0;
    color: var(--text);
}

.tool-icon { font-size: 30px; line-height: 1; margin-bottom: 12px; }
.tool-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tool-desc {
    color: var(--text-light);
    font-size: 13.5px;
    margin-top: 7px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tool-go { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--primary); }

.tool-card.is-coming { opacity: .65; cursor: not-allowed; }
.badge-coming {
    font-size: 11px;
    font-weight: 500;
    background: #f3f4f6;
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 20px;
}

/* ========== 工具页 ========== */
.breadcrumb { font-size: 13px; color: var(--text-light); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-light); }
.breadcrumb span { margin: 0 6px; }

.tool-h1 { font-size: 26px; display: flex; align-items: center; gap: 10px; }
.tool-lead { color: var(--text-light); margin: 8px 0 20px; font-size: 14.5px; }

.panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* ========== 密码工具：表格表单（参考经典表单排版） ========== */
.pwd-table {
    width: 100%;
    border-collapse: collapse;
}
.pwd-table th,
.pwd-table td {
    border: 1px solid #cfe0d6;
    padding: 15px 18px;
    vertical-align: middle;
    font-weight: 400;
}
.pwd-table th {
    width: 130px;
    background: #f6f8f7;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
}
.pwd-table .th-middle {
    width: 120px;
    text-align: right;
}
.pwd-table td { background: #fff; }

/* 青绿色自定义勾选框 */
.opt-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-right: 30px;
    font-size: 16px;
    color: #1f2937;
    cursor: pointer;
    vertical-align: middle;
    user-select: none;
}
.opt-check:last-child { margin-right: 0; }
.opt-check input {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #aebbb3;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
}
.opt-check input:checked {
    background: #2a9d8f;
    border-color: #2a9d8f;
}
.opt-check input:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

/* 特殊字符边框盒子 */
.sym-box {
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    border: 1px solid #c3c9c6;
    background: #fafafa;
    border-radius: 3px;
    padding: 2px 10px;
    font-size: 15px;
    color: #374151;
}

/* 排除字符输入框 */
.exclude-input {
    width: 230px;
    max-width: 100%;
    padding: 8px 12px;
    border: 1.5px solid #aab5ae;
    border-radius: 4px;
    font-size: 15px;
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    color: #1f2937;
    vertical-align: middle;
}
.exclude-input:focus { outline: none; border-color: #2a9d8f; box-shadow: 0 0 0 3px rgba(42, 157, 143, .12); }
.exclude-input:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.field-hint { margin-left: 12px; color: #9ca3af; font-size: 12.5px; }

/* 长度 / 数量下拉 */
.sel-cell select {
    width: 80px;
    padding: 7px 8px;
    border: 1.5px solid #c3c9c6;
    border-radius: 10px;
    font-size: 16px;
    color: #0f766e;
    background: #fff;
    cursor: pointer;
    vertical-align: middle;
}
.sel-cell select:focus { outline: none; border-color: #2a9d8f; }

/* 操作行 */
.pwd-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
}
.pwd-actions .remember-check { font-size: 14px; color: #4b5563; margin-right: 4px; }

.btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14.5px;
    cursor: pointer;
    transition: background .15s, border-color .15s, opacity .15s;
    font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-lg { padding: 11px 28px; font-size: 15.5px; font-weight: 600; }
.btn-ghost { background: #fff; border-color: var(--border); color: #374151; }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); }
.btn-link { background: none; border: 0; color: var(--text-light); font-size: 13px; padding: 4px; }
.btn-link:hover { color: var(--danger); }

/* ========== IP 地址查询 ========== */
.ip-self-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ip-self-title { font-size: 17px; }
.ip-self-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-dark);
    background: var(--primary-light);
    border-radius: 20px;
    padding: 2px 10px;
}
.ip-self-loading { color: var(--text-light); font-size: 14px; padding: 20px 0; text-align: center; }

.ip-hero-line {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 6px 0 4px;
}
.ip-big {
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 34px;
    font-weight: 700;
    color: #0f5132;
    word-break: break-all;
    cursor: pointer;
    line-height: 1.25;
}
.ip-location-line {
    font-size: 15.5px;
    color: #374151;
    margin-bottom: 18px;
}
.ip-isp { color: var(--text-light); font-size: 14px; }

.ip-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    padding: 16px 0;
    border-top: 1px dashed var(--border);
}
.ip-detail-grid > div {
    background: #f8faf9;
    border: 1px solid #e7eee9;
    border-radius: 8px;
    padding: 10px 14px;
}
.ip-detail-grid dt { font-size: 12px; color: var(--text-light); margin-bottom: 3px; }
.ip-detail-grid dd { font-size: 14.5px; font-weight: 600; color: #1f2937; word-break: break-all; }

.ip-headers { margin-top: 6px; }
.ip-headers summary { cursor: pointer; font-size: 13.5px; color: var(--primary-dark); user-select: none; }
.head-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}
.head-table th, .head-table td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
    word-break: break-all;
}
.head-table th {
    width: 170px;
    background: #f6f8f7;
    font-weight: 600;
    color: #374151;
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
}

.ip-q-title { font-size: 17px; margin-bottom: 12px; }
#ipInput {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #c3c9c6;
    border-radius: 8px;
    font-size: 14.5px;
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    resize: vertical;
}
#ipInput:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.ip-result-wrap { margin-top: 18px; overflow-x: auto; }
.ip-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.ip-result-table th, .ip-result-table td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}
.ip-result-table th {
    background: #f6f8f7;
    font-weight: 600;
    color: #374151;
}
.res-ip {
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-weight: 600;
    color: var(--primary-dark);
}

/* ========== 结果区 ========== */
.result-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13.5px;
    color: var(--text-light);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}
.strength { font-style: normal; font-weight: 700; color: var(--primary); }
.strength.s-weak { color: var(--danger); }
.strength.s-mid { color: var(--warning); }
.strength.s-strong { color: var(--primary); }
.strength.s-vstrong { color: #15803d; }

.pwd-list { list-style: none; }
.pwd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    border-bottom: 1px solid #f3f4f6;
}
.pwd-item:last-child { border-bottom: 0; }
.pwd-index {
    width: 26px;
    text-align: right;
    color: #9ca3af;
    font-size: 12.5px;
    flex-shrink: 0;
}
.pwd-text {
    flex: 1;
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 15px;
    word-break: break-all;
    user-select: all;
}
.pwd-copy {
    flex-shrink: 0;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 0;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
}
.pwd-copy:hover { background: #bbf7d0; }
.pwd-copy.copied { background: var(--primary); color: #fff; }

.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

/* ========== 历史 ========== */
.history-head { display: flex; justify-content: space-between; align-items: center; }
.history-head h2 { font-size: 16.5px; }
.history-tip { font-size: 12.5px; color: #9ca3af; margin: 6px 0 12px; }
.history-list { list-style: none; }
.history-item {
    padding: 11px 0;
    border-bottom: 1px solid #f3f4f6;
}
.history-item:last-child { border-bottom: 0; }
.history-meta {
    font-size: 12.5px;
    color: var(--text-light);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.history-pwds {
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 13px;
    color: #374151;
    word-break: break-all;
    cursor: pointer;
}
.history-pwds:hover { color: var(--primary-dark); }
.history-empty { text-align: center; color: #9ca3af; font-size: 13.5px; padding: 12px 0; }

/* ========== SEO 文章 ========== */
.seo-article {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 28px;
    color: #374151;
    font-size: 14.5px;
}
.seo-article h2 { font-size: 18px; margin: 22px 0 10px; }
.seo-article h2:first-child { margin-top: 0; }
.seo-article h3 { font-size: 15px; margin: 16px 0 6px; color: #1f2937; }
.seo-article p { margin-bottom: 8px; color: #4b5563; }

/* ========== 页脚 ========== */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 22px 0;
    margin-top: auto;
}
.footer-inner { text-align: center; color: #9ca3af; font-size: 13px; }
.footer-inner p { margin: 3px 0; }
.footer-inner a { color: #9ca3af; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .site-nav {
        display: none;
        position: absolute;
        top: 60px; left: 0; right: 0;
        background: #fff;
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 8px 16px 14px;
        gap: 2px;
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: 10px 12px; }

    .hero { padding: 32px 16px 26px; }
    .hero-title { font-size: 26px; }

    /* 密码表单表格在手机上纵向堆叠 */
    .pwd-table, .pwd-table tbody, .pwd-table tr,
    .pwd-table th, .pwd-table td { display: block; width: 100%; }
    .pwd-table th, .pwd-table .th-middle {
        text-align: left;
        width: 100%;
        padding: 10px 14px;
    }
    .pwd-table td { padding: 14px; }
    .pwd-table .th-middle { border-top: 0; }
    .opt-check { margin-right: 18px; margin-bottom: 4px; }
    .field-hint { display: block; margin: 8px 0 0; }
    .pwd-actions .btn { flex: 1; min-width: 120px; }

    .panel { padding: 18px 16px; }
    .seo-article { padding: 20px 18px; }
    .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .tool-card { padding: 16px; }
    .tool-icon { font-size: 26px; }
}
