* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f7fa;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 头部 */
.app-header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.5em;
    color: #1a73e8;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.remaining-badge {
    background: #48bb78;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.btn-referral {
    padding: 8px 16px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-referral:hover {
    background: #38a169;
}

.btn-logout {
    padding: 8px 16px;
    background: #f56565;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #e53e3e;
}

.close-referral-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    z-index: 10;
}

.close-referral-btn:hover {
    color: #333;
}

/* 主内容区 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧年份列表 */
.year-sidebar {
    width: 160px;
    background: #fafbfc;
    border-right: 1px solid #e1e4e8;
    overflow-y: auto;
    padding: 20px 0;
}

.year-list {
    display: flex;
    flex-direction: column;
}

.year-item {
    padding: 15px 25px;
    font-size: 1.1em;
    color: #586069;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.year-item:hover {
    background: #f3f4f6;
    color: #1a73e8;
}

.year-item.active {
    color: #1a73e8;
    background: #e8f0fe;
    border-left-color: #1a73e8;
    font-weight: 600;
}

/* 右侧题目区域 */
.topic-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: white;
}

.topic-content {
    max-width: 800px;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 100px 20px;
    font-size: 1.1em;
}

.topic-section {
    margin-bottom: 40px;
}

.topic-section h2 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.topic-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.topic-btn {
    padding: 12px 30px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.topic-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.topic-btn.large {
    background: #e3f2fd;
    color: #1976d2;
}

.topic-btn.large:hover {
    background: #bbdefb;
}

.topic-btn.small {
    background: #f3e5f5;
    color: #7b1fa2;
}

.topic-btn.small:hover {
    background: #e1bee7;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close-btn, .close-result-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    z-index: 10;
}

.close-btn:hover, .close-result-btn:hover {
    color: #333;
}

.modal-body {
    padding: 40px;
}

.modal-body h2 {
    margin-bottom: 25px;
    color: #333;
}

.modal-body h3 {
    margin: 30px 0 15px;
    color: #333;
    font-size: 1.2em;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: #1a73e8;
}

/* 输入模式切换 */
.input-mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.input-mode-header h3 {
    margin: 0;
    color: #1a73e8;
}

.mode-toggle {
    display: flex;
    gap: 10px;
}

.mode-btn {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.mode-btn:hover {
    background: #f5f5f5;
}

.mode-btn.active {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.input-mode {
    margin-bottom: 20px;
}

/* 上传区域 */
.upload-hint {
    margin-bottom: 20px;
}

.upload-area {
    text-align: center;
}

.upload-label {
    display: inline-block;
    padding: 60px 80px;
    border: 2px dashed #1a73e8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fbff;
}

.upload-label:hover {
    background: #e8f0fe;
    border-color: #1557b0;
}

.camera-icon {
    font-size: 60px;
    margin-bottom: 10px;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    border-radius: 50%;
    transition: all 0.3s;
}

.upload-label p {
    color: #1a73e8;
    font-size: 16px;
    margin: 0;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #1a73e8;
    color: white;
    width: 100%;
    margin-top: 15px;
}

.btn-primary:hover:not(:disabled) {
    background: #1557b0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
}

.question-image {
    text-align: center;
    margin-bottom: 20px;
}

.question-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: white;
    margin-top: 20px;
    font-size: 1.2em;
}

/* 图片放大查看 */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: zoom-out;
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.3s;
}

.image-viewer-close:hover {
    color: #ccc;
}

.viewer-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.question-image img {
    cursor: zoom-in;
}

/* 响应式设计 - 平板 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .year-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e1e4e8;
        padding: 15px 0;
        max-height: 150px;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .year-list {
        flex-direction: row;
        gap: 10px;
        padding: 0 20px;
    }
    
    .year-item {
        padding: 10px 20px;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }
    
    .year-item.active {
        border-left: none;
        border-bottom-color: #1a73e8;
    }
    
    .topic-area {
        padding: 20px;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 768px) {
    .app-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .app-header h1 {
        font-size: 1.2em;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .remaining-badge {
        font-size: 12px;
        padding: 4px 10px;
    }
    
    .btn-referral, .btn-logout {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .year-sidebar {
        max-height: 120px;
    }
    
    .year-item {
        font-size: 1em;
        padding: 8px 15px;
    }
    
    .topic-area {
        padding: 15px;
    }
    
    .topic-section h2 {
        font-size: 1.1em;
    }
    
    .topic-btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-body h2 {
        font-size: 1.3em;
    }
    
    .input-mode-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .mode-toggle {
        width: 100%;
        justify-content: space-between;
    }
    
    .mode-btn {
        flex: 1;
        font-size: 13px;
        padding: 6px 12px;
    }
    
    textarea {
        font-size: 14px;
    }
    
    .upload-label {
        padding: 40px 50px;
    }
    
    .camera-icon {
        width: 100px;
        height: 100px;
        font-size: 50px;
    }
}

/* 响应式设计 - 小屏手机 */
@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1em;
    }
    
    .user-info {
        font-size: 12px;
    }
    
    .year-item {
        font-size: 0.9em;
        padding: 6px 12px;
    }
    
    .topic-btn {
        padding: 8px 16px;
        font-size: 0.85em;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .upload-label {
        padding: 30px 40px;
    }
    
    .camera-icon {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }
}

/* 提交错误提示 */
.submit-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #856404;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.submit-error .error-icon {
    background: #ffc107;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}
