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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.screen {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
}

/* 语言切换 */
.language-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lang-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.lang-btn.active {
    background: #42b983;
    color: white;
    border-color: #42b983;
}

/* 图标 */
.header-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.icon-large {
    width: 64px;
    height: 64px;
    color: #42b983;
}

.icon-small {
    width: 20px;
    height: 20px;
}

/* 标题 */
h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.subtitle {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1.5rem;
}

/* 说明 */
.instructions {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    text-align: left;
    border: 1px solid #e9ecef;
}

.instructions h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.5;
    color: #495057;
    font-size: 0.9rem;
}

.instructions li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #42b983;
    font-weight: bold;
}

/* 免责声明 */
.disclaimer {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border: 1px solid #ffc107;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: left;
}

.disclaimer h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #856404;
}

.disclaimer p {
    margin: 0;
    color: #856404;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* 按钮 */
.btn-primary, .btn-secondary, .btn-warning, .btn-danger {
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0.25rem;
}

.btn-primary {
    background: linear-gradient(135deg, #42b983 0%, #359268 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(66, 185, 131, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(66, 185, 131, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #42b983 0%, #359268 100%);
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

/* 计时器 */
.timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #42b983;
}

.timer.warning {
    color: #e74c3c;
    animation: pulse 0.5s infinite;
}

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

/* 图片容器 */
.image-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

#testCanvas {
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-width: 100%;
    height: auto;
}

/* 答题区域 */
#answerArea {
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.choice-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.choice-btn:hover {
    border-color: #42b983;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 185, 131, 0.2);
}

.choice-btn.selected {
    border-color: #42b983;
    background: rgba(66, 185, 131, 0.1);
    box-shadow: 0 0 0 4px rgba(66, 185, 131, 0.1);
}

.choice-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #42b983;
    color: white;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.choice-btn.selected .choice-label {
    background: #359268;
}

.choice-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    flex: 1;
    text-align: center;
}

.number-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    max-width: 500px;
    margin: 0 auto;
}

.number-btn {
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.number-btn:hover {
    border-color: #42b983;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 185, 131, 0.2);
}

.number-btn.selected {
    border-color: #42b983;
    background: rgba(66, 185, 131, 0.1);
    box-shadow: 0 0 0 4px rgba(66, 185, 131, 0.1);
}

.answer-input input {
    width: 100px;
    padding: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fa;
}

.answer-input input:focus {
    outline: none;
    border-color: #42b983;
    background: white;
}

.shape-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    max-width: 600px;
    margin: 0 auto;
}

.shape-btn {
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 2rem;
}

.shape-btn:hover {
    border-color: #42b983;
    background: white;
    transform: translateY(-2px);
}

.shape-btn.selected {
    border-color: #42b983;
    background: rgba(66, 185, 131, 0.1);
}

/* 结果页面 */
.summary {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
}

.stat .value {
    font-weight: 700;
    font-size: 1.1rem;
}

.diagnosis {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid rgba(66, 185, 131, 0.2);
}

.diagnosis h2 {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.diagnosis p {
    color: #2c5530;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* 历史记录 */
.history-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
    text-align: left;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 色盲知识页面 */
.knowledge-content {
    text-align: left;
    max-width: 800px;
    margin: 0 auto;
}

.knowledge-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

.knowledge-section h2 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #42b983;
}

.knowledge-section p {
    line-height: 1.8;
    color: #495057;
    margin-bottom: 1rem;
}

.knowledge-list {
    list-style: none;
    padding: 0;
}

.knowledge-list li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
}

.knowledge-list li:last-child {
    border-bottom: none;
}

.knowledge-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #42b983;
    font-weight: bold;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.type-card {
    background: white;
    padding: 1.25rem;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s;
}

.type-card:hover {
    border-color: #42b983;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(66, 185, 131, 0.2);
}

.type-card h3 {
    font-size: 1.1rem;
    color: #42b983;
    margin-bottom: 0.75rem;
}

.type-card p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #6c757d;
    margin: 0;
}

/* Footer */
.footer {
    margin-top: 2rem;
    padding: 1.5rem 1rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
    background: #f8f9fa;
}

.links {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: #6c757d;
}

.links a {
    color: #42b983;
    text-decoration: none;
    transition: color 0.3s;
}

.links a:hover {
    color: #359268;
}

.seo-text {
    max-width: 800px;
    margin: 1rem auto;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.seo-text p {
    font-size: 0.8rem;
    line-height: 1.6;
    color: #6c757d;
    margin: 0;
    text-align: left;
}

.copyright {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-top: 0.75rem;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* 测试页面移动端优化 */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    #app {
        padding: 0.5rem;
    }
    
    .screen {
        padding: 0.5rem;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    /* 测试屏幕特殊优化 - 确保一屏显示 */
    #testScreen {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: auto;
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.3rem;
        margin-bottom: 0.3rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }
    
    .instructions {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .instructions h2 {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }
    
    .instructions li {
        margin: 0.4rem 0;
        font-size: 0.8rem;
        padding-left: 1.2rem;
    }
    
    .disclaimer {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .disclaimer h3 {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }
    
    .disclaimer p {
        font-size: 0.75rem;
    }
    
    .progress-bar {
        margin-bottom: 0.4rem;
    }
    
    .progress-text {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }
    
    .timer {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .image-container {
        margin-bottom: 0.5rem;
    }
    
    #testCanvas {
        width: 220px;
        height: 220px;
    }
    
    /* 选项按钮移动端优化 */
    .choice-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
        margin-bottom: 0.5rem;
    }
    
    .choice-btn {
        padding: 0.5rem 0.6rem;
        gap: 0.4rem;
    }
    
    .choice-label {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }
    
    .choice-value {
        font-size: 1.2rem;
    }
    
    /* 操作按钮移动端优化 */
    .actions {
        gap: 0.4rem;
        margin-top: 0.5rem;
    }
    
    .btn-primary, .btn-secondary, .btn-warning, .btn-danger {
        padding: 0.45rem 0.9rem;
        font-size: 0.8rem;
        margin: 0.1rem;
    }
    
    .shape-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .summary {
        grid-template-columns: 1fr;
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .stat {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    .diagnosis {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .diagnosis h2 {
        font-size: 1.1rem;
    }
    
    .diagnosis p {
        font-size: 0.75rem;
    }
    
    .footer {
        padding: 0.75rem 0.5rem;
        margin-top: 0.5rem;
    }
    
    .seo-text {
        padding: 0.75rem;
        margin: 0.75rem auto;
    }
    
    .seo-text p {
        font-size: 0.7rem;
    }
    
    .links {
        font-size: 0.7rem;
        margin-bottom: 0.5rem;
    }
    
    .copyright {
        font-size: 0.7rem;
    }
    
    /* 知识页面移动端优化 */
    .knowledge-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .knowledge-section h2 {
        font-size: 1.1rem;
    }
    
    .knowledge-section p {
        font-size: 0.85rem;
    }
    
    .knowledge-list li {
        font-size: 0.85rem;
        padding: 0.5rem 0;
        padding-left: 1.2rem;
    }
    
    .type-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .type-card {
        padding: 1rem;
    }
    
    .type-card h3 {
        font-size: 1rem;
    }
    
    .type-card p {
        font-size: 0.85rem;
    }
}

/* 超小屏幕优化 (iPhone SE 等) */
@media (max-width: 375px) {
    #app {
        padding: 0.3rem;
    }
    
    .screen {
        padding: 0.4rem;
    }
    
    h1 {
        font-size: 1.2rem;
    }
    
    .progress-text {
        font-size: 0.75rem;
    }
    
    .timer {
        font-size: 0.85rem;
    }
    
    #testCanvas {
        width: 180px;
        height: 180px;
    }
    
    .choice-options {
        gap: 0.3rem;
    }
    
    .choice-btn {
        padding: 0.4rem 0.5rem;
    }
    
    .choice-label {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
    
    .choice-value {
        font-size: 1rem;
    }
    
    .btn-primary, .btn-secondary, .btn-warning, .btn-danger {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .instructions {
        padding: 0.6rem;
    }
    
    .instructions li {
        font-size: 0.7rem;
        margin: 0.3rem 0;
    }
    
    .disclaimer {
        padding: 0.6rem;
    }
}
