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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 500px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.header-left, .header-right {
    position: absolute;
    top: 16px;
    display: flex;
    align-items: center;
}

.header-left {
    left: 12px;
}

.header-right {
    right: 12px;
}

.header .emoji {
    font-size: 32px;
}

.progress-info {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
}

.progress-info strong {
    color: white;
    font-size: 16px;
}

.content {
    padding: 40px 30px;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.welcome-screen {
    text-align: center;
}

.welcome-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.welcome-screen h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
}

.welcome-screen .subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.info-box {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.info-box p {
    color: #555;
    font-size: 14px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-box .icon {
    font-size: 20px;
}

.btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px 0;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.mode-selector {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 20px 0;
}

.mode-btn {
    flex: 1;
    min-width: 150px;
    padding: 24px 16px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mode-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mode-btn.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.mode-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.mode-icon {
    font-size: 2.5em;
}

.mode-title {
    font-size: 1.2em;
    font-weight: bold;
}

.mode-desc {
    font-size: 0.9em;
    opacity: 0.9;
}

.btn-test-type {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-test-type:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.test-screen {
    text-align: center;
}

.char-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 20px;
    padding: 60px 40px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(240, 147, 251, 0.3);
    position: relative;
}

.pinyin-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 1.5em;
    padding: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

.pinyin-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.pinyin-wrapper {
    min-height: 2em;

    margin-bottom: 5px;
}

.pinyin-wrapper .pinyin {
    font-size: 1.5em;
    color: white;
    font-weight: 500;
    opacity: 0.9;
}

.pinyin-wrapper .pinyin.hidden {
    display: none;
}

.char-display .char {
    font-size: 80px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
    word-break: keep-all;
    font-family: "KaiTi", "STKaiti", "楷体", serif;
}

.explanation-wrapper {
    min-height: 1em;
    margin-top: 10px;
}

.explanation-wrapper .explanation {
    font-size: 1em;
    color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.explanation-wrapper .explanation.hidden {
    display: none;
}

.input-mode-toggle {
    text-align: right;
    margin-bottom: 16px;
}

.answer-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.btn-answer {
    padding: 25px;
    font-size: 22px;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.btn-know {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-know:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(17, 153, 142, 0.4);
}

.btn-dont-know {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.btn-dont-know:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(235, 51, 73, 0.4);
}

.report-screen {
    text-align: center;
}

.report-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    color: white;
    margin-bottom: 30px;
}

.report-card h2 {
    font-size: 20px;
    margin-bottom: 15px;
}

.literacy-result {
    font-size: 48px;
    font-weight: bold;
    margin: 20px 0;
}

.literacy-range {
    font-size: 28px;
    margin: 10px 0;
}

.grade-level {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    margin: 16px auto;
    font-weight: bold;
    font-size: 1.1em;
    display: inline-block;
}

.level-badge {
    font-size: 24px;
    margin: 15px 0;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    display: inline-block;
}

.stars {
    font-size: 30px;
    margin: 15px 0;
}

.suggestion {
    font-size: 16px;
    margin-top: 20px;
    opacity: 0.9;
}

.stats-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
}

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

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.history-screen {
    padding: 0;
}

.history-header {
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: white;
}

.back-btn:hover {
    opacity: 0.7;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

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

.history-date {
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
}

.history-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-range {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.history-level {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.history-stats {
    text-align: right;
}

.history-correct {
    font-size: 18px;
    font-weight: bold;
    color: #38ef7d;
}

.history-accuracy {
    font-size: 14px;
    color: #999;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.clear-btn {
    background: none;
    border: none;
    color: #eb3349;
    cursor: pointer;
    font-size: 14px;
    padding: 10px;
    margin-top: 20px;
}

.clear-btn:hover {
    opacity: 0.7;
}

.stats-summary {
    padding: 20px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 25px;
    color: white;
    margin-bottom: 20px;
}

.summary-card h3 {
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

.avg-literacy {
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
}

.summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.summary-label {
    font-size: 14px;
    opacity: 0.9;
}

.summary-value {
    font-size: 18px;
    font-weight: bold;
}

.trend-indicator {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    margin-top: 15px;
}

.trend-icon {
    font-size: 24px;
    margin-right: 10px;
}

.trend-text {
    font-size: 16px;
    font-weight: bold;
}

@media (max-width: 480px) {
    .container {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .char-display .char {
        font-size: 60px;
    }
    
    .answer-buttons {
        grid-template-columns: 1fr;
    }
    
    .btn-answer {
        padding: 20px;
    }
}
