/* reset & base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    color: #1e2a3a;
    background: #f8fafc;
    padding: 0 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* header */
header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(4px);
    background-color: rgba(255,255,255,0.95);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
}

.logo h1 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #0f3b5c;
    letter-spacing: -0.5px;
    display: inline-block;
    margin-right: 0.75rem;
}

.tagline {
    font-size: 0.85rem;
    color: #2c6e9e;
    border-left: 2px solid #cbd5e1;
    padding-left: 0.75rem;
}

nav a {
    text-decoration: none;
    color: #334155;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover, nav a.active {
    color: #0f3b5c;
    border-bottom: 2px solid #0f3b5c;
    padding-bottom: 0.25rem;
}

/* hero */
.hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
    background: linear-gradient(135deg, #e6f0fa 0%, #ffffff 100%);
    border-radius: 1.5rem;
    margin: 2rem 0;
}

.hero h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #0f3b5c;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.2rem;
    color: #2c6e9e;
}

/* 卡片网格 */
.tools-section, .specs-section {
    margin: 2.5rem 0;
}

h3 {
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    border-left: 4px solid #0f3b5c;
    padding-left: 1rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03), 0 1px 2px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, transform 0.1s;
    border: 1px solid #e2e8f0;
}

.card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.card h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #0f3b5c;
}

.card p {
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.btn {
    display: inline-block;
    background: #0f3b5c;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn:hover {
    background: #1e5a7a;
}

/* 规范列表 */
.spec-list {
    list-style: none;
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0;
}

.spec-list li {
    border-bottom: 1px solid #f1f5f9;
    padding: 0.75rem 1.5rem;
}

.spec-list li:last-child {
    border-bottom: none;
}

.spec-list a {
    text-decoration: none;
    font-weight: 500;
    color: #0f3b5c;
}

.spec-list a:hover {
    text-decoration: underline;
}

.more-link {
    text-align: right;
    margin-top: 1rem;
}

footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.8rem;
}

/* 工具页面共用样式 */
.tool-container {
    max-width: 800px;
    margin: 2rem auto;
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

.tool-container h2 {
    margin-bottom: 0.5rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #0f3b5c;
}

input, textarea {
    width: 100%;
    padding: 0.7rem;
    font-family: monospace;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    background: #fefce8; /* 轻微底色提示输入区 */
}

button {
    background: #0f3b5c;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

button:hover {
    background: #1e5a7a;
}

.result {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 0.75rem;
    font-family: monospace;
    word-break: break-all;
}

.error {
    color: #b91c1c;
    background: #fee2e2;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* 响应式 */
@media (max-width: 640px) {
    header .container {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    nav a {
        margin: 0 0.75rem;
    }
    .hero h2 {
        font-size: 1.5rem;
    }
    .tool-container {
        padding: 1.2rem;
    }
}

/* 搜索框样式 */
.search-container {
    position: relative;
    margin-left: 1rem;
}
.search-container input {
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    border: 1px solid #cbd5e1;
    background: white;
    font-size: 0.9rem;
    width: 200px;
    transition: width 0.2s;
}
.search-container input:focus {
    width: 260px;
    outline: none;
    border-color: #0f3b5c;
}
.search-results {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}
.search-results.show {
    display: block;
}
.search-result-item {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item a {
    text-decoration: none;
    color: #0f3b5c;
    font-weight: 500;
    display: block;
}
.search-result-item .type {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.2rem;
}
@media (max-width: 640px) {
    .search-container {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }
    .search-container input {
        width: 100%;
    }
    .search-container input:focus {
        width: 100%;
    }
}
/* 移动端增强 */
@media (max-width: 640px) {
    body {
        font-size: 14px;
    }
    .container {
        padding: 0 0.75rem;
    }
    .hero {
        padding: 2rem 1rem;
        margin: 1rem 0;
    }
    .hero h2 {
        font-size: 1.4rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .tool-container {
        padding: 1rem;
        margin: 1rem;
    }
    .aid-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .search-results {
        left: 0;
        right: 0;
    }
    button, .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    input, textarea, select {
        font-size: 16px; /* 防止 iOS 缩放 */
    }
}