/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 导航栏 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 15px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.nav-links a:hover,
.nav-links a.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Hero区域 */
.hero {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero .subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
}

/* 主内容 */
.main-content {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}

/* 工具卡片网格 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 1200px;
    margin: 0 auto 2.5rem auto;
    gap: 1.5rem;
    padding: 0 1rem;
}

.tool-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.tool-icon {
    font-size: 3.5rem;
    margin-bottom: 0.8rem;
}

.tool-card h2 {
    color: #333;
    margin-bottom: 0.8rem;
    font-size: 1.4rem;
}

.tool-card p {
    color: #666;
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.feature-list {
    list-style: none;
    text-align: left;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.feature-list li {
    padding: 0.3rem 0;
    color: #555;
    font-size: 0.9rem;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-top: auto;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* 特性部分 */
.features-section {
    margin-top: 3rem;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #333;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    max-width: 1000px;
    margin: 0 auto;
    gap: 1.5rem;
}

.feature-item {
    text-align: center;
    padding: 1.5rem;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-item h3 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.feature-item p {
    color: #666;
}

/* 页面头部 */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #667eea;
}

.page-header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #666;
    font-size: 1.1rem;
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 表单卡片 */
.form-card {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.form-card h3 {
    color: #333;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group select {
    cursor: pointer;
    background-color: white;
}

.form-group select.algorithm-select {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #999;
    font-size: 0.9rem;
}

/* 单选按钮组 */
.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #555;
}

.radio-group input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

/* 结果框 */
.result-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.result-box h4 {
    color: #333;
    margin-bottom: 1rem;
}

.result-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.result-content textarea {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    background: #f5f5f5;
}

/* 时间显示 */
.time-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.time-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-item label {
    font-weight: 500;
    color: #333;
}

.value-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.value-row input {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
}

/* IP信息显示 */
.ip-info {
    background: #f5f7fa;
    border-radius: 10px;
    padding: 1.5rem;
}

.ip-info-item {
    display: flex;
    padding: 0.8rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.ip-info-item:last-child {
    border-bottom: none;
}

.ip-info-label {
    font-weight: 600;
    color: #667eea;
    min-width: 120px;
}

.ip-info-value {
    color: #333;
}

/* 域名信息显示 */
.domain-info {
    background: #f5f7fa;
    border-radius: 10px;
    padding: 1.5rem;
}

.domain-section {
    margin-bottom: 2rem;
}

.domain-section:last-child {
    margin-bottom: 0;
}

.domain-section h5 {
    color: #667eea;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.domain-info-item {
    display: flex;
    padding: 0.8rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.domain-info-item:last-child {
    border-bottom: none;
}

.domain-info-label {
    font-weight: 600;
    color: #667eea;
    min-width: 120px;
}

.domain-info-value {
    color: #333;
    word-break: break-word;
}

/* 加载动画样式 */
.loading-container {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
    border-radius: 12px;
    border: 2px dashed #667eea;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e3f2fd;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.1rem;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.loading-steps {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #f5f5f5;
    border-radius: 25px;
    color: #999;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.step.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    animation: pulse 1.5s infinite;
}

.step-icon {
    font-size: 1.1rem;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* 按钮加载状态 */
.btn.loading {
    background: linear-gradient(135deg, #a0a0a0 0%, #808080 100%);
    cursor: not-allowed;
    position: relative;
}

.loading-dots {
    display: inline-block;
    animation: dots 1.4s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.loading-dots::after {
    content: '';
    animation: dots 1.4s infinite;
}

/* 错误显示样式 */
.error-container {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-radius: 12px;
    border: 2px solid #f44336;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-message {
    font-size: 1.1rem;
    color: #d32f2f;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.error-tips {
    text-align: left;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #f44336;
}

.error-tips h5 {
    color: #d32f2f;
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

.error-tips ul {
    margin: 0;
    padding-left: 1.2rem;
}

.error-tips li {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.3rem;
}

/* 信息框 */
.info-box {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.info-box h3 {
    color: #1976d2;
    margin-bottom: 1rem;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 0.5rem 0;
    color: #333;
}

.info-box strong {
    color: #1976d2;
}

/* 提示消息 */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 底部 */
footer {
    background: rgba(255, 255, 255, 0.95);
    color: #666;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

footer p {
    margin: 0.5rem 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        padding: 0.3rem 0.5rem;
        font-size: 0.9rem;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .tools-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }

    .result-content {
        flex-direction: column;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 滑块样式 */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* 复选框样式 */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

input[type="checkbox"]:hover {
    transform: scale(1.1);
}

/* 密码长度快捷按钮 */
.length-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid #667eea;
    border-radius: 5px;
    color: #667eea;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.length-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.length-btn:active {
    transform: translateY(0);
}

/* ================================================
   移动端响应式设计 - 全局优化
   ================================================ */

/* 大屏幕 (Desktop) */
@media (min-width: 1200px) {
    .container {
        max-width: 1300px;
        padding: 0 40px;
    }

    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1200px;
        gap: 2rem;
        margin: 0 auto;
        padding: 0;
    }

    .features-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1000px;
        gap: 2rem;
    }
}

/* 超大屏幕优化 */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
        padding: 0 60px;
    }

    .tools-grid {
        max-width: 1200px;
        gap: 2.5rem;
    }

    .features-grid {
        max-width: 1200px;
        gap: 2.5rem;
    }
}

/* 中大屏幕优化 */
@media (min-width: 900px) and (max-width: 1199px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 800px;
        gap: 1.8rem;
        padding: 0;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 700px;
        gap: 1.5rem;
    }
}

/* 平板设备 (Tablet) */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }

    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero .subtitle {
        font-size: 1.2rem;
    }

    .main-content {
        padding: 1.5rem;
    }
}

/* 移动设备 (Mobile) */
@media (max-width: 768px) {
    /* 全局容器 */
    .container {
        padding: 0 12px;
    }

    /* 导航栏移动端优化 */
    .navbar .container {
        flex-direction: column;
        padding: 0.8rem 12px;
        gap: 1rem;
    }

    .logo {
        font-size: 1.3rem;
        margin-bottom: 0.5rem;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 0.8rem;
        justify-content: center;
        width: 100%;
    }

    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
        border-radius: 20px;
        flex: 1;
        text-align: center;
        min-width: 0;
    }

    /* Hero区域 */
    .hero {
        padding: 2.5rem 0;
        margin-bottom: 2rem;
    }

    .hero h1 {
        font-size: 2.2rem;
        margin-bottom: 0.8rem;
    }

    .hero .subtitle {
        font-size: 1.1rem;
        padding: 0 1rem;
    }

    /* 主内容区域 */
    .main-content {
        border-radius: 12px;
        padding: 1.2rem;
        margin-bottom: 2rem;
    }

    /* 工具卡片网格 */
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
        margin-bottom: 2rem;
    }

    .tool-card {
        padding: 1.5rem;
        border-radius: 10px;
        text-align: left; /* 移动端左对齐更易读 */
    }

    .tool-card:hover {
        transform: translateY(-2px);
    }

    .tool-card .tool-icon {
        text-align: center;
        display: block;
        width: 100%;
    }

    .tool-icon {
        font-size: 3rem;
        margin-bottom: 0.8rem;
    }

    .tool-card h2 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }

    .tool-card p {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }

    .feature-list {
        margin-bottom: 1.2rem;
    }

    .feature-list li {
        font-size: 0.9rem;
        padding: 0.2rem 0;
    }

    /* 按钮优化 */
    .btn {
        padding: 0.9rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        text-align: center;
        border-radius: 8px;
    }

    .btn:hover {
        transform: scale(1.02);
    }

    .btn-small {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        margin-left: 0;
        margin-top: 0.5rem;
        width: auto;
        display: inline-block;
    }

    /* 特性部分 */
    .features-section {
        margin-top: 2.5rem;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
        padding: 0 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .feature-item {
        padding: 1.2rem;
    }

    .feature-icon {
        font-size: 2.5rem;
        margin-bottom: 0.8rem;
    }

    .feature-item h3 {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
    }

    .feature-item p {
        font-size: 0.95rem;
    }

    /* 表单元素优化 */
    .form-group {
        margin-bottom: 1.2rem;
    }

    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 0.6rem;
        font-weight: 600;
    }

    .input-field, .textarea-field, select {
        width: 100%;
        padding: 0.8rem 1rem;
        border: 2px solid #e1e5e9;
    }

    /* 单选按钮组移动端优化 */
    .radio-group {
        flex-direction: column;
        gap: 0.8rem;
        margin-top: 0.8rem;
    }

    .radio-group label {
        padding: 0.5rem 0;
        font-size: 0.95rem;
    }

    .input-field, .textarea-field, select {
        border-radius: 8px;
        font-size: 16px; /* 防止iOS Safari自动缩放 */
        background: #fafbfc;
        transition: all 0.3s ease;
    }

    .input-field:focus, .textarea-field:focus, select:focus {
        border-color: #667eea;
        background: white;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        outline: none;
    }

    .textarea-field {
        min-height: 100px;
        resize: vertical;
    }

    /* 工具特定页面优化 */
    .tool-section {
        margin-bottom: 2rem;
        padding: 1.5rem;
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    }

    .tool-section h2 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
        color: #2c3e50;
        border-bottom: 2px solid #667eea;
        padding-bottom: 0.5rem;
    }

    /* 结果显示区域 */
    .result-section {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        padding: 1rem;
        margin-top: 1rem;
    }

    .result-section pre {
        background: #2d3748;
        color: #e2e8f0;
        padding: 1rem;
        border-radius: 6px;
        overflow-x: auto;
        font-size: 13px;
        line-height: 1.4;
    }

    /* 长度按钮组 */
    .length-buttons {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 0.5rem;
        margin: 1rem 0;
    }

    .length-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        text-align: center;
        border-radius: 6px;
    }

    /* 加载动画移动端优化 */
    .loading-container {
        padding: 1.5rem 1rem;
    }

    .loading-spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }

    .loading-steps {
        flex-direction: column;
        gap: 0.8rem;
    }

    .step {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        justify-content: center;
    }

    .error-container {
        padding: 1.5rem 1rem;
    }

    .error-tips {
        text-align: center;
    }
}

/* 小屏幕移动设备 (Small Mobile) */
@media (max-width: 480px) {
    /* 进一步缩小间距和字体 */
    .container {
        padding: 0 10px;
    }

    .navbar .container {
        padding: 0.6rem 10px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .nav-links a {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    /* 超小屏幕的汉堡菜单 */
    .nav-toggle {
        display: none;
        flex-direction: column;
        cursor: pointer;
        gap: 3px;
    }

    .nav-toggle span {
        width: 25px;
        height: 3px;
        background: #667eea;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    @media (max-width: 480px) {
        .navbar .container {
            flex-direction: row;
            justify-content: space-between;
            padding: 0.8rem 10px;
        }

        .nav-toggle {
            display: flex;
        }

        .nav-links {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(10px);
            flex-direction: column;
            gap: 0;
            padding: 1rem 0;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
            transform: translateY(-100%);
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .nav-links.active {
            transform: translateY(0);
            opacity: 1;
            visibility: visible;
        }

        .nav-links a {
            padding: 0.8rem 1rem;
            margin: 0;
            border-radius: 0;
            border-bottom: 1px solid #f0f0f0;
            text-align: center;
            width: 100%;
        }

        .nav-links a:last-child {
            border-bottom: none;
        }

        .navbar {
            position: relative;
        }
    }

    .hero {
        padding: 2rem 0;
    }

    .hero h1 {
        font-size: 1.9rem;
        margin-bottom: 0.6rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    .main-content {
        padding: 1rem;
        border-radius: 8px;
    }

    .tool-card {
        padding: 1.2rem;
    }

    .tool-icon {
        font-size: 2.5rem;
    }

    .tool-card h2 {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 1.6rem;
        margin-bottom: 1.2rem;
    }

    .feature-item {
        padding: 1rem;
    }

    .feature-icon {
        font-size: 2rem;
    }

    .input-field, .textarea-field, select {
        padding: 0.7rem 0.8rem;
        font-size: 16px;
    }

    .btn {
        padding: 0.8rem 1.2rem;
    }

    /* 长度按钮适应更小屏幕 */
    .length-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.4rem;
    }

    .length-btn {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }

    /* 面包屑导航 */
    nav[aria-label="breadcrumb"] ol {
        flex-wrap: wrap;
        font-size: 0.85rem;
    }

    /* 工具部分间距调整 */
    .tool-section {
        padding: 1.2rem;
        margin-bottom: 1.5rem;
    }

    .tool-section h2 {
        font-size: 1.2rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 移除hover效果，优化触摸体验 */
    .tool-card:hover {
        transform: none;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    }

    .btn:hover {
        transform: none;
    }

    .nav-links a:hover {
        background: rgba(102, 126, 234, 0.2);
    }

    /* 增大触摸目标 */
    .btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    button, input[type="button"], input[type="submit"] {
        min-height: 44px;
    }
}

/* 横屏手机优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 1.5rem 0;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .navbar .container {
        flex-direction: row;
        padding: 0.6rem 12px;
    }

    .nav-links {
        flex-direction: row;
        gap: 1rem;
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

    /* 标签页移动端优化 */
    .tabs {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        padding-bottom: 0.5rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex-shrink: 0;
        padding: 0.6rem 1rem;
        border: none;
        background: #f8f9fa;
        color: #6c757d;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 0.85rem;
        font-weight: 500;
        white-space: nowrap;
        min-width: fit-content;
    }

    .tab-btn:hover {
        background: rgba(102, 126, 234, 0.1);
        color: #667eea;
    }

    .tab-btn.active {
        background: #667eea;
        color: white;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }

    .tab-content {
        display: none;
    }

    .tab-content.active {
        display: block;
    }

    /* 表单卡片移动端优化 */
    .form-card {
        background: white;
        border: 1px solid #e9ecef;
        border-radius: 10px;
        padding: 1.2rem;
        margin-bottom: 1.5rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    }

    .form-card h3 {
        font-size: 1.2rem;
        color: #2c3e50;
        margin-bottom: 1rem;
        border-bottom: 2px solid #667eea;
        padding-bottom: 0.5rem;
    }

    /* 结果框优化 */
    .result-box {
        margin-top: 1.5rem;
        padding: 1rem;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 8px;
    }

    .result-box h4 {
        color: #495057;
        margin-bottom: 0.8rem;
        font-size: 1rem;
    }

    .result-content {
        position: relative;
    }

    .result-content textarea {
        width: 100%;
        min-height: 80px;
        padding: 0.8rem;
        border: 1px solid #ced4da;
        border-radius: 6px;
        background: white;
        font-family: 'Consolas', monospace;
        font-size: 13px;
        resize: vertical;
    }

    /* 信息框优化 */
    .info-box {
        background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
        border: 1px solid #e1f5fe;
        border-radius: 10px;
        padding: 1.2rem;
        margin-top: 2rem;
    }

    .info-box h3 {
        color: #1976d2;
        margin-bottom: 1rem;
        font-size: 1.1rem;
    }

    .info-box ul {
        list-style: none;
        padding: 0;
    }

    .info-box li {
        padding: 0.4rem 0;
        color: #424242;
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .info-box li:before {
        content: "▪ ";
        color: #667eea;
        font-weight: bold;
        margin-right: 0.5rem;
    }

    /* 页面标题移动端优化 */
    .page-header {
        text-align: center;
        margin-bottom: 2rem;
        padding: 1rem;
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
        border-radius: 12px;
    }

    .page-header h1 {
        font-size: 1.8rem;
        color: #2c3e50;
        margin-bottom: 0.5rem;
        background: linear-gradient(45deg, #667eea, #764ba2);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .page-header p {
        color: #6c757d;
        font-size: 0.95rem;
        margin: 0;
    }

    /* 算法选择器优化 */
    .algorithm-select {
        width: 100%;
        padding: 0.8rem;
        border: 2px solid #e1e5e9;
        border-radius: 8px;
        background: #fafbfc;
        font-size: 14px;
        transition: all 0.3s ease;
    }

    .algorithm-select:focus {
        border-color: #667eea;
        background: white;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        outline: none;
    }

    /* 小提示文本 */
    small {
        display: block;
        margin-top: 0.5rem;
        color: #6c757d;
        font-size: 0.8rem;
        line-height: 1.4;
    }

    /* 打印样式 */
@media print {
    .navbar, .hero {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .main-content {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .btn {
        display: none;
    }
}