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

body {
    font-family: 'Segoe UI', 'Noto Sans CJK TC', 'Microsoft YaHei', 'PingFang TC', system-ui, sans-serif;
    background: #f0f2f5;
    padding: 14px;
    color: #1e2a3a;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.back-link {
    display: inline-block;
    margin-top: 12px;
    color: #ffd966;
    text-decoration: none;
    font-size: 0.75rem;
}

/* 為每張卡片添加版權水印 */
.card {
    position: relative;
    overflow: hidden;
}

.card::after {
    content: "© 潘傳振  禁止盗用";
    position: absolute;
    bottom: 8px;
    right: 15px;
    font-size: 0.7rem;
    color: rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.6);
    padding: 2px 6px;
    border-radius: 12px;
    pointer-events: none;
    z-index: 1;
    font-family: inherit;
    white-space: nowrap;
}

.container {
    max-width: 1210px;
    margin: 0 auto;
}

.header {
    background: linear-gradient(135deg, #2c3e50 0%, #1a2a3a 100%);
    color: white;
    padding: 28px 24px;
    border-radius: 20px 20px 0 0;
}

.header h1 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.header p {
    opacity: 0.85;
    font-size: 0.7rem;
}

.search-section {
    background: white;
    padding: 20px 24px;
    border-radius: 0 0 20px 20px;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-group {
    flex: 2;
    min-width: 200px;
}

.search-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #5a6e7c;
    margin-bottom: 4px;
}

.search-group input,
.search-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfdde6;
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: inherit;
}

.search-group input:focus,
.search-group select:focus {
    outline: none;
    border-color: #2c3e50;
}

.search-buttons {
    display: flex;
    gap: 10px;
}

button {
    background: #2c3e50;
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}

button:hover {
    background: #1e2f3c;
}

.reset-btn {
    background: #7f8c8d;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    gap: 12px;
}

.stats {
    background: white;
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.page-btn {
    background: white;
    color: #2c3e50;
    border: 1px solid #cfdde6;
    padding: 6px 10px;
    border-radius: 30px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}

.page-btn:hover {
    background: #e9ecef;
}

.page-btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* 底部分頁按鈕懸停效果 */
.page-bottom-btn,
.bottom-page-num {
    transition: all 0.2s ease;
    cursor: pointer;
}

/* 普通狀態：保持原有內聯樣式，但確保邊框為透明或無 */
.page-bottom-btn,
.bottom-page-num {
    border: 1px solid transparent !important;  /* 保留占位，避免hover時跳動 */
}

/* 懸停時：白色背景、深藍色邊框、深藍色文字 */
.page-bottom-btn:hover,
.bottom-page-num:hover {
    background: white !important;
    color: #2c3e50 !important;
    border: 1px solid #2c3e50 !important;
}

/* 禁用按鈕保持原有樣式，不應用懸停效果 */
.page-bottom-btn:disabled,
.bottom-page-num:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e9ecef !important;
    color: #2c3e50 !important;
    border: none !important;
}

/* 當前頁碼按鈕（active）保持深藍色背景，但懸停時也變為白色背景加邊框，可按需調整 */
.bottom-page-num[style*="background: #2c3e50"]:hover {
    background: white !important;
    color: #2c3e50 !important;
    border: 1px solid #2c3e50 !important;
}





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

.card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: 0.2s;
    border: 1px solid #e9edf2;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

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

.card-header {
    background: #f8fafc;
    padding: 16px 20px;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.simp-big {
    font-size: 2rem;
    font-weight: 700;
    color: #1e466e;
}

.trad-big {
    font-size: 1.2rem;
    font-weight: 500;
    color: #8b5a2b;
    word-break: break-word;
}

.variant-badge {
    background: #eef2fa;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 1.2rem;
    color: #2c3e50;
    font-family: monospace;
}

.card-body {
    padding: 20px;
    flex: 1;
}

.pronounce {
    background: #fef5e7;
    padding: 6px 12px;
    border-radius: 24px;
    font-size: 0.75rem;
    display: inline-block;
    margin-bottom: 16px;
    color: #b45f06;
    font-weight: 500;
}

.meaning-section {
    margin-bottom: 16px;
}

.meaning-icon {
    font-size: 0.95rem;
    font-weight: 600;
    color: #5a6e7c;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.meaning {
    font-size: 0.9rem;
    line-height: 1.65;
    color: #2c3e50;
    background: #fefefe;
    padding: 12px;
    border-radius: 12px;
    border-left: 3px solid #8aaec0;
    white-space: normal;
    word-break: break-word;
}

.meaning .term {
    color: #c7254e;
    font-weight: 600;
    background: #f9f2f4;
    padding: 0 4px;
    border-radius: 6px;
    display: inline-block;
}

.meaning .pinyin {
    color: #c7254e;
    font-weight: 500;
}

.example {
    font-size: 0.85rem;
    background: #f0f4f9;
    padding: 12px;
    border-radius: 12px;
    color: #2c5f8a;
    margin-top: 12px;
}

.note {
    font-size: 0.8rem;
    color: #b45f6b;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
    background: #fff9f0;
    padding: 10px 12px;
    border-radius: 12px;
}

.no-result {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 32px;
    color: #7f8c8d;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    font-size: 0.75rem;
    color: #7f8c8d;
}

footer a {
    color: inherit;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 700px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .search-section {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination {
        justify-content: center;
    }
}