* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

#app {
    max-width: 600px;
    margin: 0 auto;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
}

.auth-card {
    background: white;
    border-radius: 25px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 16px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.auth-tab:hover {
    color: #667eea;
}

.auth-tab.active {
    color: #667eea;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

.auth-form h2 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #666;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group input::placeholder {
    color: #aaa;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-checkbox input {
    width: auto;
    margin: 0;
}

.form-checkbox label {
    margin-bottom: 0;
    font-weight: normal;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
}

.form-footer a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

.form-footer a:hover {
    text-decoration: underline;
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.logo-wrapper {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

.subtitle {
    font-size: 12px;
    color: #764ba2;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f0f0;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    color: #333;
    transition: all 0.2s;
}

.user-btn:hover {
    background: #e0e0e0;
}

.user-icon {
    font-size: 18px;
}

.title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
}

.back-btn {
    background: #f0f0f0;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    color: #333;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.back-btn:hover {
    background: #e0e0e0;
}

.spacer {
    width: 70px;
}

.progress-count {
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

.home-content,
.grade-content,
.unit-content,
.learning-content,
.review-content {
    padding: 10px;
}

.welcome-text {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.welcome-text h1 {
    font-size: 28px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.welcome-text p {
    font-size: 18px;
}

.progress-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.progress-card h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.progress-info {
    display: flex;
    justify-content: space-around;
}

.progress-item {
    text-align: center;
}

.progress-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.progress-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    border: none;
    padding: 18px 30px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-large {
    font-size: 20px;
    padding: 22px 30px;
}

.btn-next {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    width: 100%;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .learning-content {
        padding: 10px 10px 90px 10px;
        min-height: calc(100vh - 200px);
        display: flex;
        flex-direction: column;
    }
    
    .word-card {
        margin-bottom: 15px;
        padding: 25px 20px;
    }
    
    .word-text {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .phonetic {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .speak-btn {
        padding: 10px 25px;
        font-size: 14px;
    }
    
    .options-container {
        flex: 1;
        min-height: 120px;
    }
    
    .option-btn {
        padding: 15px;
        font-size: 16px;
    }
    
    .feedback {
        margin: 10px 0;
    }
    
    .btn-next {
        position: fixed;
        bottom: 20px;
        left: 20px;
        right: 20px;
        width: auto;
        margin-top: 0;
        padding: 18px 30px;
        font-size: 18px;
        border-radius: 30px;
        box-shadow: 0 4px 15px rgba(67, 233, 123, 0.4);
        z-index: 100;
    }
}

@media (max-width: 480px) {
    .learning-content {
        padding: 10px 10px 80px 10px;
    }
    
    .word-card {
        padding: 20px 15px;
    }
    
    .word-text {
        font-size: 32px;
    }
    
    .phonetic {
        font-size: 16px;
    }
    
    .btn-next {
        bottom: 15px;
        left: 15px;
        right: 15px;
        padding: 15px 25px;
        font-size: 16px;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    .learning-content {
        padding: 5px 10px 70px 10px;
    }
    
    .word-card {
        padding: 15px 20px;
        margin-bottom: 10px;
    }
    
    .word-text {
        font-size: 28px;
        margin-bottom: 5px;
    }
    
    .phonetic {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .speak-btn {
        padding: 8px 20px;
        font-size: 13px;
    }
    
    .options-container {
        min-height: 80px;
    }
    
    .option-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .btn-next {
        bottom: 10px;
        left: 15px;
        right: 15px;
        padding: 12px 20px;
        font-size: 15px;
    }
}

.page-title {
    font-size: 24px;
    color: white;
    text-align: left;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.grade-grid,
.unit-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.grade-card,
.unit-card {
    background: white;
    border-radius: 20px;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.grade-card:hover,
.unit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.grade-card.selected,
.unit-card.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.grade-card.selected .grade-icon-container,
.unit-card.selected .unit-icon-container {
    background: rgba(255, 255, 255, 0.2);
}

.grade-card.selected .grade-number,
.unit-card.selected .unit-number {
    color: white;
}

.grade-card.selected .grade-name,
.unit-card.selected .unit-name {
    color: white;
}

.grade-icon-container,
.unit-icon-container {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    transition: all 0.3s;
}

.grade-number,
.unit-number {
    font-size: 28px;
    font-weight: bold;
    color: white;
}

.grade-name,
.unit-name {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    line-height: 1.4;
}

.word-card {
    background: white;
    border-radius: 25px;
    padding: 40px 30px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.word-text {
    font-size: 48px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.phonetic {
    font-size: 24px;
    color: #666;
    margin-bottom: 20px;
}

.speak-btn {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.speak-btn:hover {
    transform: scale(1.05);
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.option-btn {
    background: white;
    border: 3px solid transparent;
    padding: 20px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.option-btn:hover:not(.disabled) {
    background: #f0f0f0;
    border-color: #667eea;
}

.option-btn.correct {
    background: #43e97b;
    border-color: #43e97b;
    color: white;
}

.option-btn.wrong {
    background: #f5576c;
    border-color: #f5576c;
    color: white;
}

.option-btn.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.feedback {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 20px;
    margin-bottom: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.feedback.show {
    opacity: 1;
}

.feedback-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.feedback-text {
    font-size: 22px;
    font-weight: bold;
}

.feedback-text.correct {
    color: #43e97b;
}

.feedback-text.wrong {
    color: #f5576c;
}

.review-item {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.review-word {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.review-phonetic {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
}

.review-meaning {
    font-size: 18px;
    color: #667eea;
    font-weight: bold;
}

.review-stats {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #999;
}

.empty-review {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.empty-review .icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.empty-review .text {
    font-size: 20px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 350px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: white;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.user-nickname {
    font-size: 14px;
    color: #999;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
}

.modal-footer .btn {
    width: 100%;
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .header {
        padding: 12px 15px;
    }

    .logo {
        font-size: 16px;
    }

    .subtitle {
        font-size: 13px;
    }

    .welcome-text h1 {
        font-size: 24px;
    }

    .welcome-text p {
        font-size: 16px;
    }

    .grade-grid,
    .unit-grid {
        grid-template-columns: 1fr;
    }

    .word-text {
        font-size: 40px;
    }

    .phonetic {
        font-size: 20px;
    }

    .option-btn {
        padding: 16px;
        font-size: 16px;
    }

    .auth-card {
        padding: 20px;
    }
}
