/* ==========================================
   基于 Glasswork 的英语学习网站样式
   ========================================== */

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

:root {
    /* Glasswork 单位系统 */
    --u: 1px;

    /* 光玻璃材质参数 (Lumno 默认值) */
    --l-tint: #ffffff;
    --l-thin: 0.06;
    --l-dense: 0.22;
    --l-blur: 2;
    --l-sat: 1.8;
    --l-bri: 1.06;
    --l-catch: 1;
    --l-bevel: 1;
    --l-shadow: 1;

    /* 颜色 */
    --primary: #667eea;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

html, body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: #0b0c0e;
    color: #000;
    position: relative;
}

/* ========== 动态壁纸背景 ========== */
.wallpaper {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.wallpaper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('wallpaper.jpg') center center / cover no-repeat;
    animation: wallpaperZoom 30s ease-in-out infinite;
}

@keyframes wallpaperZoom {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ========== 主容器 ========== */
.content {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(var(--u) * 32) calc(var(--u) * 24);
}

/* ========== 页面切换 ========== */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 导航栏 ========== */
.navbar {
    position: sticky;
    top: calc(var(--u) * 16);
    z-index: 100;
    padding: 0 calc(var(--u) * 24);
    margin-bottom: calc(var(--u) * 32);
}

.nav-inner {
    --radius: 48;
    padding: calc(var(--u) * 16) calc(var(--u) * 32);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-stats {
    display: flex;
    gap: calc(var(--u) * 32);
    font-size: 0.95rem;
    font-weight: 600;
}

/* ========== 欢迎区域 ========== */
.welcome-section {
    text-align: center;
    margin-bottom: calc(var(--u) * 48);
}

.welcome-section h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: calc(var(--u) * 12);
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.25rem;
    font-weight: 500;
    opacity: 0.7;
}

.loading-hint {
    margin-top: calc(var(--u) * 16);
    font-weight: 600;
    color: var(--warning);
}

/* ========== 模式卡片 ========== */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: calc(var(--u) * 24);
    margin-bottom: calc(var(--u) * 48);
}

.mode-card {
    --radius: 32;
    padding: calc(var(--u) * 32);
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mode-card:hover {
    transform: translateY(calc(var(--u) * -8));
}

.mode-icon {
    font-size: 3.5rem;
    margin-bottom: calc(var(--u) * 16);
    display: inline-block;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.mode-card:hover .mode-icon {
    transform: scale(1.1);
}

.mode-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: calc(var(--u) * 12);
    letter-spacing: -0.02em;
}

.mode-card p {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.75;
}

/* ========== 底部导航 ========== */
.bottom-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: calc(var(--u) * 16);
}

.nav-btn {
    --radius: 24;
    padding: calc(var(--u) * 20);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(var(--u) * 12);
    transition: transform 0.2s ease;
}

.nav-btn:hover {
    transform: translateY(calc(var(--u) * -4));
}

.nav-btn span {
    font-size: 1.5rem;
}

/* ========== 练习页面 ========== */
.practice-header {
    display: flex;
    align-items: center;
    gap: calc(var(--u) * 16);
    margin-bottom: calc(var(--u) * 32);
}

.back-btn {
    --radius: 20;
    padding: calc(var(--u) * 12) calc(var(--u) * 24);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
}

.back-btn:hover {
    transform: translateX(calc(var(--u) * -4));
}

.progress-bar {
    flex: 1;
    height: calc(var(--u) * 10);
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    overflow: hidden;
    backdrop-filter: blur(calc(var(--u) * 4));
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #764ba2);
    border-radius: 999px;
    transition: width 0.6s ease;
    box-shadow: 0 0 calc(var(--u) * 16) rgba(102, 126, 234, 0.6);
}

#question-counter {
    --radius: 20;
    padding: calc(var(--u) * 12) calc(var(--u) * 20);
    font-weight: 700;
    font-size: 1rem;
}

/* ========== 题目卡片 ========== */
.question-card {
    --radius: 36;
    padding: calc(var(--u) * 48);
    max-width: 900px;
    margin: 0 auto;
}

.question-text {
    font-size: 2.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: calc(var(--u) * 48);
    min-height: calc(var(--u) * 90);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    letter-spacing: -0.02em;
}

/* ========== 选项按钮 ========== */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: calc(var(--u) * 16);
}

.option-btn {
    --radius: 24;
    padding: calc(var(--u) * 24);
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    min-height: calc(var(--u) * 90);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
}

.option-btn:hover {
    transform: translateY(calc(var(--u) * -6)) scale(1.02);
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.2) !important;
    animation: correctPulse 0.5s ease;
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.2) !important;
    animation: wrongShake 0.4s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========== 拼写模式 ========== */
.spelling-hint {
    text-align: center;
    opacity: 0.75;
    margin-bottom: calc(var(--u) * 24);
    font-size: 1.1rem;
    font-weight: 600;
}

.spelling-input {
    --radius: 24;
    width: 100%;
    padding: calc(var(--u) * 20);
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: calc(var(--u) * 24);
    transition: all 0.3s ease;
}

.spelling-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.submit-btn {
    --radius: 24;
    width: 100%;
    padding: calc(var(--u) * 20);
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.submit-btn:hover {
    transform: translateY(calc(var(--u) * -4));
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
}

/* ========== 单词卡片 ========== */
.flashcard {
    perspective: 1200px;
    max-width: 650px;
    margin: 0 auto calc(var(--u) * 32);
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 450px;
    transition: transform 0.7s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    --radius: 36;
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--u) * 48);
}

.flashcard-back {
    transform: rotateY(180deg);
}

.flashcard-word {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.flashcard-meaning {
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.5;
}

.flashcard-controls {
    display: flex;
    gap: calc(var(--u) * 16);
    justify-content: center;
}

.card-btn {
    --radius: 24;
    padding: calc(var(--u) * 16) calc(var(--u) * 32);
    font-size: 1.3rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.card-btn.difficult {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.card-btn.easy {
    background: linear-gradient(135deg, var(--success), #059669);
}

.card-btn:hover {
    transform: translateY(calc(var(--u) * -4)) scale(1.05);
}

/* ========== 结果弹窗 ========== */
.result-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(calc(var(--u) * 8));
    z-index: 1000;
}

.result-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-content {
    --radius: 36;
    padding: calc(var(--u) * 48);
    max-width: 550px;
    text-align: center;
    animation: modalSlide 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.result-icon {
    font-size: 6rem;
    margin-bottom: calc(var(--u) * 16);
}

.result-text {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: calc(var(--u) * 12);
    letter-spacing: -0.02em;
}

.result-detail {
    opacity: 0.75;
    margin-bottom: calc(var(--u) * 32);
    font-size: 1.2rem;
    line-height: 1.6;
    font-weight: 600;
}

.next-btn {
    --radius: 24;
    width: 100%;
    padding: calc(var(--u) * 20);
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #764ba2);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.next-btn:hover {
    transform: translateY(calc(var(--u) * -4));
}

/* ========== 其他元素 ========== */
.favorite-btn, .action-btn, .danger-btn {
    --radius: 20;
    padding: calc(var(--u) * 16) calc(var(--u) * 24);
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.favorite-btn:hover, .action-btn:hover, .danger-btn:hover {
    transform: translateY(calc(var(--u) * -2)) scale(1.05);
}

.favorite-btn.active {
    background: rgba(245, 158, 11, 0.2);
}

.action-btn {
    background: linear-gradient(135deg, var(--primary), #764ba2);
}

.danger-btn {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

/* ========== 页面头部 ========== */
.page-header {
    display: flex;
    align-items: center;
    gap: calc(var(--u) * 16);
    margin-bottom: calc(var(--u) * 32);
}

.page-header h2 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: calc(var(--u) * 24);
    margin-bottom: calc(var(--u) * 32);
}

.stat-card {
    --radius: 28;
    padding: calc(var(--u) * 32);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(calc(var(--u) * -6));
}

.stat-number {
    font-size: 3.25rem;
    font-weight: 900;
    margin-bottom: calc(var(--u) * 12);
    letter-spacing: -0.04em;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.75;
    font-weight: 600;
}

/* ========== 单词列表 ========== */
.word-list {
    --radius: 28;
    padding: calc(var(--u) * 16);
    max-height: 550px;
    overflow-y: auto;
}

.word-item {
    padding: calc(var(--u) * 16);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.word-item:last-child {
    border-bottom: none;
}

.word-item:hover {
    background: rgba(255, 255, 255, 0.05);
    padding-left: calc(var(--u) * 24);
}

.word-en {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: calc(var(--u) * 4);
}

.word-cn {
    font-size: 1rem;
    opacity: 0.75;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: calc(var(--u) * 8);
    transition: transform 0.2s ease;
}

.icon-btn:hover {
    transform: scale(1.3);
}

.empty-msg {
    text-align: center;
    opacity: 0.6;
    padding: calc(var(--u) * 48);
    font-size: 1.1rem;
}

/* ========== 设置 ========== */
.settings-list {
    --radius: 28;
    padding: calc(var(--u) * 16);
}

.setting-item {
    padding: calc(var(--u) * 24);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
}

.setting-item select,
.setting-item input[type="number"] {
    --radius: 16;
    padding: calc(var(--u) * 12) calc(var(--u) * 16);
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.setting-item select:focus,
.setting-item input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========== 滚动条 ========== */
.word-list::-webkit-scrollbar {
    width: 8px;
}

.word-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.word-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
}

.word-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .welcome-section h2 {
        font-size: 2rem;
    }

    .mode-grid,
    .options-grid {
        grid-template-columns: 1fr;
    }

    .question-text {
        font-size: 1.75rem;
    }

    .flashcard-word {
        font-size: 2.5rem;
    }

    .nav-stats {
        font-size: 0.85rem;
        gap: calc(var(--u) * 16);
    }
}
