.tools-container {
    padding: 80px 0 60px;
    min-height: 100vh;
    color: #fff;
}

body {
    color: #fff !important;
}

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

.tools-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 900;
    background: #ffffff;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

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

.tools-search {
    margin: 30px auto 0;
    max-width: 720px;
    position: relative;
}

.tools-input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    outline: none;
    transition: all .2s ease;
}

.tools-input:focus {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.tools-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.filters {
    margin: 18px auto 0;
    max-width: 960px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.category-tabs {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s ease;
    font-weight: 500;
}

.tab:hover {
    border-color: #ffffff;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.tab.active {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
}

.source-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    overflow: hidden;
}

.source-toggle button {
    padding: 8px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all .2s ease;
}

.source-toggle button.active {
    background: #ffffff;
    color: #000000;
}

.tools-section {
    margin-top: 36px;
}

.tools-section h2 {
    display: none;
}

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

.tool-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
}

.tool-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.tool-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.tool-emoji {
    font-size: 1.4rem;
}

.tool-name {
    font-weight: 600;
    color: var(--text-primary);
}

.tool-desc {
    font-size: .92rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tool-meta {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .78rem;
    border: 1px solid rgba(255, 255, 255, .14);
    color: var(--text-secondary);
}

/* 与 space.html 一致的玻璃拟态返回按钮样式 */
.glass-panel {
    background: rgba(10, 15, 30, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}
.back-button {
    position: fixed;
    top: 30px;
    left: 30px;
    padding: 12px 24px;
    border-radius: 30px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 300;
    letter-spacing: 1px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    font-size: 12px;
}
.back-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
    text-shadow: 0 0 10px #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .tools-title {
        font-size: 2rem;
    }

    .back-button {
        top: 12px;
        left: 12px;
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Modal Styles - Ultra Premium Glassmorphism */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    /* Lighter overlay to show background */
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    /* Completely transparent background as requested */
    background: rgba(0, 0, 0, 0.01);
    /* Strong blur to keep content readable against background */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Delicate borders */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Refined shadow */
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 0 80px rgba(0, 212, 255, 0.05);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: rotate(90deg);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.modal-header {
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.modal-title {
    background: #ffffff;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.modal-header .tools-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.input-group {
    margin-bottom: 25px;
}

.modal-textarea {
    width: 100%;
    height: 160px;
    /* Very transparent input */
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.modal-textarea:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.1);
}

.modal-textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.action-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    color: #ffffff;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}

.action-btn:active {
    transform: translateY(1px);
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.6);
}

.result-box {
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 25px;
    min-height: 120px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    transition: all 0.3s ease;
}

.result-box:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
}

.copy-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.copy-btn:hover {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 30px;
}

/* Scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.02);
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.8;
}

.drop-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.tool-card[data-source="local"] {
    background: #000000 !important;
    border: 1px solid #ffffff !important;
}
.tool-card[data-source="local"] .tool-name,
.tool-card[data-source="local"] .tool-desc,
.tool-card[data-source="local"] .pill {
    color: #ffffff !important;
}
.tool-card[data-source="local"] .pill {
    border-color: rgba(255, 255, 255, 0.3) !important;
}
