/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主题色彩 */
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #10B981;
    --background-color: #F9FAFB;
    --card-background: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--background-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7C3AED 100%);
    color: white;
    text-align: center;
    padding: 40px 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.logo-text {
    text-align: left;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
    margin: 0;
}

/* 广告位样式 */
.ad-space {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
}

.ad-placeholder {
    background: #F3F4F6;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

.ad-top .ad-placeholder,
.ad-bottom .ad-placeholder {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.ad-sidebar .ad-placeholder {
    width: 300px;
    height: 250px;
}

/* 主内容区域 */
.main-content {
    display: flex;
    gap: 20px;
    padding: 30px 20px;
    align-items: flex-start;
}

.ad-sidebar {
    flex-shrink: 0;
}

.word-section {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
}

/* 分类筛选区域 */
.filter-section {
    background: var(--card-background);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    min-width: 180px;
}

.filter-group:last-child {
    margin-left: auto;
}

.filter-label {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    font-size: 0.95rem;
}

.filter-select {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--background-color);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 单词显示卡片 */
.word-display {
    margin-bottom: 30px;
}

.words-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.word-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: var(--shadow);
    text-align: center;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.5s ease both;
}

.word-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Single word card (full width) */
.words-container:has(.word-card:only-child) {
    grid-template-columns: 1fr;
}

.words-container:has(.word-card:only-child) .word-card {
    padding: 60px 40px;
    min-height: 250px;
}

.word-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    word-break: break-word;
    line-height: 1.2;
}

/* Large text for single word */
.words-container:has(.word-card:only-child) .word-text {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.word-meaning {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.words-container:has(.word-card:only-child) .word-meaning {
    font-size: 1.3rem;
}

.word-type {
    display: inline-block;
    padding: 6px 16px;
    background: var(--secondary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow);
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7C3AED 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--card-background);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* 通知消息 */
.notification {
    text-align: center;
    padding: 12px 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.notification.show {
    opacity: 1;
}

.notification.success {
    background: #D1FAE5;
    color: #065F46;
}

/* 历史记录 */
.history-section {
    background: var(--card-background);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.history-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.history-empty {
    color: var(--text-secondary);
    font-style: italic;
}

.history-item {
    padding: 8px 16px;
    background: var(--background-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
}

.history-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* 页脚 */
.footer {
    background: var(--card-background);
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.footer p {
    margin: 8px 0;
    font-size: 0.9rem;
}

.footer-stats {
    font-weight: 500;
    color: var(--primary-color);
}

/* 插屏广告 */
.interstitial-ad {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.interstitial-ad.show {
    display: flex;
}

.interstitial-content {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 90%;
}

.close-ad {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-ad:hover {
    background: var(--primary-hover);
    transform: rotate(90deg);
}

.interstitial-placeholder {
    width: 300px;
    height: 250px;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 响应式设计 - 平板 */
@media (max-width: 1024px) {
    .ad-sidebar {
        display: none;
    }
    
    .main-content {
        justify-content: center;
    }
    
    .word-text {
        font-size: 2.8rem;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .filter-section {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        width: 100%;
        min-width: auto;
    }
    
    .container {
        border-radius: 0;
    }
    
    .logo-container {
        gap: 15px;
    }
    
    .logo-icon {
        width: 50px;
        height: 50px;
    }
    
    .logo {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .header {
        padding: 30px 15px;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .words-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .word-card {
        padding: 40px 20px;
        min-height: 200px;
    }
    
    .word-text {
        font-size: 2rem;
    }
    
    .words-container:has(.word-card:only-child) .word-text {
        font-size: 2.2rem;
    }
    
    .word-meaning {
        font-size: 1rem;
    }
    
    .words-container:has(.word-card:only-child) .word-meaning {
        font-size: 1.1rem;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
    }
    
    .ad-top .ad-placeholder,
    .ad-bottom .ad-placeholder {
        width: 320px;
        height: 50px;
    }
    
    .history-section {
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .word-text {
        font-size: 1.6rem;
    }
    
    .words-container:has(.word-card:only-child) .word-text {
        font-size: 1.8rem;
    }
    
    .word-meaning {
        font-size: 0.95rem;
    }
    
    .word-card {
        padding: 30px 15px;
        min-height: 180px;
    }
    
    .logo-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo-text {
        text-align: center;
    }
    
    .logo-icon {
        width: 45px;
        height: 45px;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
}

/* Footer Links */
.footer-links {
    margin-top: 10px;
    font-size: 0.9rem;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #4CAF50;
    text-decoration: underline;
}

