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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 15px;
    color: #666;
}

.upload-section {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    flex: 1;
}

.upload-area {
    border: 2px dashed #d0d5dd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #667085;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #4f46e5;
    background: #f5f3ff;
    color: #4f46e5;
}

.upload-icon {
    margin-bottom: 12px;
}

.upload-area p {
    font-size: 14px;
    margin-bottom: 4px;
}

.upload-area .hint {
    font-size: 12px;
    color: #98a2b3;
}

.preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e4e7ec;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
}

.answer-config {
    margin-bottom: 16px;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.config-row label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0;
}

.config-row input[type="number"] {
    width: 80px;
}

.btn-secondary {
    padding: 8px 16px;
    background: #fff;
    color: #4f46e5;
    border: 1px solid #4f46e5;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.answer-grid {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
}

.answer-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
}

.answer-row:last-child {
    border-bottom: none;
}

.answer-row .q-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    min-width: 50px;
}

.answer-row .type-select {
    padding: 4px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    background: #fff;
    cursor: pointer;
}

.answer-row .type-select:focus {
    outline: none;
    border-color: #4f46e5;
}

.answer-row .choice-group {
    display: flex;
    gap: 4px;
}

.answer-row .choice-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-row .choice-btn:hover {
    border-color: #4f46e5;
    color: #4f46e5;
    background: #f5f3ff;
}

.answer-row .choice-btn.selected {
    border-color: #4f46e5;
    background: #4f46e5;
    color: #fff;
}

.answer-row .fill-input {
    flex: 1;
    max-width: 200px;
    padding: 6px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
}

.answer-row .fill-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
}

input[type="number"]:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.btn-primary {
    display: block;
    width: 100%;
    padding: 14px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-primary:disabled {
    background: #a5b4fc;
    cursor: not-allowed;
}

/* 结果区域 */
.result-section {
    margin-top: 32px;
}

.result-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.student-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.student-info h3 {
    font-size: 18px;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.student-info .sid {
    font-size: 13px;
    color: #667085;
}

.score-badge {
    font-size: 32px;
    font-weight: 700;
}

.score-badge.high { color: #059669; }
.score-badge.mid { color: #d97706; }
.score-badge.low { color: #dc2626; }

.stats {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.stat-item {
    font-size: 13px;
    color: #667085;
}

.stat-item strong {
    color: #333;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    background: #f9fafb;
}

.detail-item.correct {
    background: #ecfdf5;
    color: #065f46;
}

.detail-item.wrong {
    background: #fef2f2;
    color: #991b1b;
}

.detail-item .q-num {
    font-weight: 600;
    min-width: 24px;
}

.detail-item .ans {
    font-family: "SF Mono", monospace;
}

.detail-item .cross {
    color: #dc2626;
    font-size: 11px;
}

.detail-item .arrow {
    color: #9ca3af;
    font-size: 11px;
}

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

.loading-content {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 15px;
    color: #666;
}

/* 错误提示 */
.error-msg {
    background: #fef2f2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 16px;
    border: 1px solid #fecaca;
}

@media (max-width: 640px) {
    .container {
        padding: 20px 12px;
    }
    .upload-section {
        padding: 20px;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .details-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}
