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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --bg-dark: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    background: var(--bg-dark);
}

.background {
    display: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    margin-bottom: 60px;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.title-icon {
    font-size: 2.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* 目录导航样式 */
.category-nav {
    margin-bottom: 40px;
    padding: 20px 0;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 20px;
    z-index: 100;
    border: 1px solid var(--border);
}

.category-nav-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 0 20px;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.category-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.category-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.category-icon {
    font-size: 1.2rem;
}

.category-name {
    white-space: nowrap;
}

.category-count {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.category-link.active .category-count {
    background: rgba(255, 255, 255, 0.3);
}

/* 分类标题样式 */
.category-section {
    grid-column: 1 / -1;
    margin: 40px 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
    scroll-margin-top: 140px; /* 确保滚动时不被固定目录遮挡 */
}

.category-section:first-of-type {
    margin-top: 0;
}

.category-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-title-icon {
    font-size: 1.8rem;
}

/* 工具快速浏览区域 */
.tools-overview {
    margin-bottom: 40px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.search-section {
    margin-bottom: 20px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0;
    margin-bottom: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    height: 52px;
}

.search-wrapper:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.search-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(59, 130, 246, 0.15);
    background: white;
    transform: translateY(-1px);
}

.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    pointer-events: none;
    color: var(--text-secondary);
    opacity: 0.6;
    transition: all 0.3s ease;
    margin-left: 4px;
}

.search-icon svg {
    width: 18px;
    height: 18px;
}

.search-wrapper:focus-within .search-icon {
    color: var(--primary);
    opacity: 1;
}

.search-input {
    flex: 1;
    padding: 0 12px 0 8px;
    background: transparent;
    border: none;
    border-radius: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    line-height: 1.5;
    box-sizing: border-box;
    height: 52px;
    margin: 0;
    margin-bottom: 0 !important;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}


.search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    margin-right: 6px;
}

.search-clear svg {
    width: 16px;
    height: 16px;
}

.search-clear:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    transform: scale(1.1);
}

.search-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-left: 5px;
}

.tools-quick-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.tool-quick-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tool-quick-card:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tool-quick-card.hidden {
    display: none;
}

.tool-quick-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.tool-quick-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.tool-quick-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tool-quick-card:hover .tool-quick-desc {
    color: rgba(255, 255, 255, 0.9);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: box-shadow 0.2s ease;
    box-shadow: var(--shadow);
    scroll-margin-top: 140px; /* 确保滚动时不被固定目录遮挡 */
}

.tool-card:hover {
    box-shadow: var(--hover-shadow);
}

.tool-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: inline-block;
}

.tool-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.tool-card > p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.tool-content {
    margin-top: 20px;
}

textarea, input[type="text"], input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Monaco', 'Menlo', monospace;
    resize: vertical;
    transition: border-color 0.2s ease;
    margin-bottom: 15px;
}

input[readonly] {
    background: #f9fafb;
    cursor: not-allowed;
}

textarea:focus, input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    min-height: 120px;
}

.tool-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

button {
    padding: 10px 20px;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:hover {
    background: var(--primary-dark);
}

button:active {
    opacity: 0.9;
}

.text-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.text-stats strong {
    color: var(--primary);
    font-weight: 700;
}

.string-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
    font-family: 'Monaco', 'Menlo', monospace;
}

.color-picker-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#colorPicker {
    width: 80px;
    height: 50px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: none;
}

#colorHex {
    flex: 1;
    margin-bottom: 0;
}

.color-preview {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
}

.color-rgb {
    text-align: center;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 15px;
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--text-secondary);
}

.time-result {
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    margin-top: 15px;
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--text-primary);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vmess-info {
    margin-top: 15px;
}

.vmess-info div {
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.vmess-info strong {
    color: var(--primary);
    font-weight: 600;
}

@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .category-nav {
        position: relative;
        top: 0;
        margin-bottom: 30px;
    }
    
    .category-nav-inner {
        padding: 0 15px;
        gap: 8px;
    }
    
    .category-link {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .category-icon {
        font-size: 1rem;
    }
    
    .category-count {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    .tools-overview {
        padding: 20px;
    }
    
    .tools-quick-view {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .tool-quick-card {
        padding: 12px;
    }
    
    .tool-quick-icon {
        font-size: 1.5rem;
    }
    
    .tool-quick-name {
        font-size: 0.85rem;
    }
    
    .tool-quick-desc {
        font-size: 0.75rem;
    }
    
    .category-title {
        font-size: 1.5rem;
    }
    
    .category-title-icon {
        font-size: 1.5rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .tool-card {
        padding: 20px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 货币汇率工具样式 */
.currency-converter {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.currency-input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.currency-input-group input {
    flex: 1.5;
    margin-bottom: 0;
    min-width: 0;
}

.currency-input-group select {
    flex: 1;
    padding: 10px 40px 10px 12px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231f2937' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    min-width: 0;
}

.currency-input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.currency-input-group select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.currency-swap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: -5px 0;
}

.swap-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--primary);
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
    color: white;
    font-weight: 600;
}

.swap-btn:hover {
    background: var(--primary-dark);
}

.swap-btn:active {
    opacity: 0.9;
}

.currency-info {
    margin-top: 15px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.rate-display {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    font-family: 'Monaco', 'Menlo', monospace;
    text-align: center;
    word-break: break-word;
}

.last-update {
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .currency-input-group {
        flex-direction: column;
    }
    
    .currency-input-group input,
    .currency-input-group select {
        width: 100%;
    }
    
    .currency-swap {
        margin: 5px 0;
    }
}

/* JWT工具样式 */
.jwt-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.jwt-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.jwt-tab:hover {
    color: var(--primary);
}

.jwt-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.jwt-mode {
    margin-top: 10px;
}

.jwt-verify-result {
    margin-top: 15px;
}

.jwt-verify-result div {
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .jwt-tabs {
        gap: 5px;
    }
    
    .jwt-tab {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}
