* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
    background-color: #64748b;
}
::-webkit-scrollbar-track {
    background-color: #f8fafc;
}
html {
    scroll-behavior: smooth;
    font-family: "Inter", "Microsoft Yahei", sans-serif;
}
body {
    background-color: #f1f5f9;
    color: #334155;
}

.letter-active {
    background-color: #22c55e;
    color: white;
    font-weight: 600;
}
.text-hidden {
    color: transparent !important;
    text-shadow: none !important;
    user-select: none;
}
.btn-disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
/* 汉堡按钮隐藏类 */
.mobile-nav-toggle.hidden {
    display: none !important;
}

.letter-nav {
    width: auto;
    background-color: white;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    border-radius: 8px;
    margin: 16px 8px;
    padding: 16px 8px;
    height: calc(100vh - 32px);
    overflow-y: auto;
    position: relative;
}
/* 侧边导航关闭按钮样式 */
.nav-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background-color: #22c55e;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px 0 rgb(34 197 94 / 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    display: none; /* 桌面端隐藏 */
    z-index: 1002;
}
.nav-close-btn:hover {
    background-color: #16a34a;
    transform: scale(1.05);
}

.letter-link {
    display: block;
    text-align: center;
    padding: 8px 4px;
    border-radius: 6px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin: 2px 0;
}
.letter-link:hover {
    background-color: #e0f2fe;
    color: #0284c7;
    transform: scale(1.05);
}

.control-bar {
    z-index: 900;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    padding: 20px 24px !important;
    margin: 0 0 16px 0;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.control-bar h1 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.5px;
    width: 100%;
}
.search-box-wrapper {
    position: relative;
    width: 100%;
    max-width: 550px;
}
.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.search-input:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}
.search-input::placeholder {
    color: #94a3b8;
}

.btn-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.toggle-translate-btn {
    padding: 12px 24px;
    background-color: #22c55e;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px 0 rgb(34 197 94 / 0.3);
    width: auto;
    white-space: nowrap;
}
.toggle-translate-btn:hover {
    background-color: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px 0 rgb(34 197 94 / 0.3);
}
.toggle-translate-btn:active {
    transform: translateY(0);
}

.word-list-wrapper {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    padding: 24px;
    border: 1px solid #e2e8f0;
}
.letter-section {
    margin-bottom: 24px;
}
.letter-section h2 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px;
}
.word-list-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: #f8fafc;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom: none;
}
.word-list-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    transition: background-color 0.2s ease;
}
.word-list-item:last-child {
    border-radius: 0 0 6px 6px;
    border-bottom: 1px solid #e2e8f0;
}
.word-list-item:hover {
    background-color: #fafafa;
}
.english-col {
    width: 48%;
    font-weight: 500;
}
.chinese-col {
    width: 48%;
    color: #64748b;
    transition: all 0.2s ease;
}

.search-result-container {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    z-index: 998;
    display: none;
    border: 1px solid #e2e8f0;
}
.search-result-container.active {
    display: block;
}
.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 14px;
}
.search-result-item:hover {
    background-color: #f8fafc;
}
.search-result-item:last-child {
    border-bottom: none;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background-color: #22c55e;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px 0 rgb(34 197 94 / 0.3);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}
.back-to-top.active {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    background-color: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px 0 rgb(34 197 94 / 0.4);
}

/* 移动端导航触发按钮 */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    left: 16px;
    top: 20px;
    z-index: 1001;
    background-color: #22c55e;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px 0 rgb(34 197 94 / 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}
.mobile-nav-toggle:hover {
    background-color: #16a34a;
    transform: scale(1.05);
}

/* 移动端侧边导航样式 */
.letter-nav.mobile-active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .flex {
        flex-direction: column;
    }
    .mobile-nav-toggle {
        display: flex;
    }
    .nav-close-btn {
        display: flex;
    }
    .letter-nav {
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        height: 100vh;
        width: 200px;
        margin: 0;
        border-radius: 0 8px 8px 0;
        transition: all 0.3s ease-in-out;
        padding-top: 60px;
    }
    .letter-nav ul {
        grid-template-columns: repeat(3, 1fr) !important;
        padding: 8px;
    }
    main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 8px !important;
    }
    .control-bar {
        padding: 16px 16px !important;
        padding-top: 60px !important;
    }
    .search-box-wrapper {
        max-width: 100%;
    }
    .toggle-translate-btn {
        width: 200px;
        margin: 0 auto;
    }
    .btn-wrapper {
        justify-content: center;
    }
    .word-list-wrapper {
        padding: 16px;
    }
}