/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: #e3f2fd;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    overflow-x: hidden; /* 禁止水平滚动 */
    touch-action: pan-y; /* 只允许垂直滚动 */
    position: fixed; /* 固定页面位置，防止滑动 */
    width: 100%;
}

.container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 进度显示 */
.progress-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.progress-item {
    display: flex;
    align-items: center;
}

.progress-label {
    font-weight: bold;
    margin-right: 5px;
    color: #1976d2;
}

.progress-value {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

/* 卡片容器 */
.card-container {
    width: 100%;
    perspective: 1000px;
    margin-bottom: 30px;
}

/* 卡片样式 */
.card {
    position: relative;
    width: 100%;
    height: 400px;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: white;
}

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

/* 卡片正面样式 */
.word-container {
    text-align: center;
    padding: 20px;
}

.word {
    font-size: 48px;
    font-weight: bold;
    color: #1976d2;
    margin-bottom: 10px;
}

.phonetic {
    font-size: 20px;
    color: #757575;
    font-style: italic;
}

/* 卡片反面样式 */
.word-info {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.back-word {
    font-size: 32px;
    color: #1976d2;
    margin-bottom: 10px;
}

.chinese-meaning {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

.part-of-speech {
    font-size: 18px;
    margin-bottom: 15px;
    color: #555;
    font-style: italic;
}

.example-container {
    margin-bottom: 15px;
}

.example {
    font-size: 16px;
    color: #424242;
    margin-bottom: 5px;
}

.example-translation {
    font-size: 16px;
    color: #666;
    font-style: italic;
}

.mastery-container {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
}

.mastery-item {
    display: flex;
    flex-direction: column;
}

.mastery-label {
    font-size: 14px;
    color: #757575;
    margin-bottom: 5px;
}

.mastery-value {
    font-size: 18px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #2196f3;
    color: white;
}

/* 反馈按钮 */
.feedback-buttons {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 25px;
}

.feedback-button {
    flex: 1;
    padding: 15px;
    margin: 0 10px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.feedback-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.know {
    background-color: #4caf50;
}

.fuzzy {
    background-color: #ff9800;
}

.forget {
    background-color: #f44336;
}

/* 模式选择器 */
.mode-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    width: 100%;
}

.mode-label {
    font-size: 16px;
    font-weight: bold;
    color: #555;
    margin: 0 15px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #2196f3;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* 重置按钮 */
.reset-button {
    padding: 12px 25px;
    background-color: #9c27b0;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.reset-button:hover {
    background-color: #7b1fa2;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 加载弹窗 */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.loading-content h2 {
    margin-bottom: 20px;
    color: #1976d2;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background-color: #f1f1f1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar-fill {
    height: 100%;
    background-color: #2196f3;
    width: 0%;
    transition: width 0.3s;
}

.progress-percent {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* 浮窗提示 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    display: none;
    z-index: 1001;
    animation: fadeIn 0.5s, fadeOut 0.5s 0.5s;
}

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

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* 确认对话框 */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1002;
}

.confirm-content {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.confirm-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.confirm-content p {
    margin-bottom: 20px;
    color: #555;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
}

.confirm-button {
    padding: 10px 20px;
    margin: 0 10px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.confirm-yes {
    background-color: #f44336;
    color: white;
}

.confirm-no {
    background-color: #2196f3;
    color: white;
}

.confirm-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 600px) {
    .card {
        height: 350px;
    }

    .word {
        font-size: 40px;
    }

    .back-word {
        font-size: 28px;
    }

    .chinese-meaning {
        font-size: 22px;
    }
}

@media (max-width: 400px) {
    .card {
        height: 300px;
    }

    .word {
        font-size: 32px;
    }

    .phonetic {
        font-size: 18px;
    }

    .back-word {
        font-size: 24px;
    }

    .chinese-meaning {
        font-size: 20px;
    }

    .example, .example-translation {
        font-size: 14px;
    }

    .feedback-button {
        padding: 12px;
        font-size: 16px;
    }
}