/* ========== 全局重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #534AB7;
    --primary-light: #EEEDFE;
    --primary-dark: #3C3489;
    --danger: #D85A30;
    --danger-light: #FAECE7;
    --success: #1D9E75;
    --success-light: #E1F5EE;
    --gray-50: #F8F8F6;
    --gray-100: #F1EFE8;
    --gray-200: #D3D1C7;
    --gray-400: #888780;
    --gray-800: #2C2C2A;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* ========== 顶部标题 ========== */
.header {
    background: linear-gradient(135deg, #534AB7, #7F77DD);
    color: white;
    padding: 20px 16px;
    text-align: center;
}
.header h1 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.header p { font-size: 12px; opacity: 0.85; }

/* ========== 打分须知 ========== */
.notice-box {
    margin: 12px;
    padding: 14px 16px;
    background: var(--primary-light);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}
.notice-box h2 { font-size: 14px; font-weight: 600; color: var(--primary-dark); margin-bottom: 8px; }
.notice-box ul { list-style: none; }
.notice-box li {
    font-size: 12px;
    color: var(--gray-800);
    line-height: 1.8;
    padding-left: 16px;
    position: relative;
}
.notice-box li::before {
    content: '';
    width: 4px; height: 4px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    left: 4px; top: 10px;
}
.notice-box li strong { color: var(--danger); }

/* ========== 打分码输入 ========== */
.code-section {
    margin: 12px;
    padding: 20px 16px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.code-section h3 { font-size: 15px; margin-bottom: 12px; }
.code-input-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.code-input {
    flex: 1;
    max-width: 200px;
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 4px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    outline: none;
    text-transform: uppercase;
    transition: border-color 0.2s;
}
.code-input:focus { border-color: var(--primary); }
.btn-primary {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-primary:active { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.5; }
.code-msg {
    margin-top: 10px;
    font-size: 13px;
    min-height: 20px;
}
.code-msg.error { color: var(--danger); }
.code-msg.success { color: var(--success); }

/* ========== 评分标准 ========== */
.criteria-toggle {
    margin: 12px;
    padding: 12px 16px;
    background: var(--gray-100);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.criteria-toggle h3 { font-size: 14px; font-weight: 500; }
.criteria-toggle .arrow { font-size: 12px; color: var(--primary); transition: transform 0.2s; }
.criteria-toggle.open .arrow { transform: rotate(180deg); }

.criteria-content {
    margin: 0 12px;
    padding: 0 16px;
    background: white;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
}
.criteria-content.open { max-height: 3000px; padding: 16px; }

.criterion-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-100);
}
.criterion-item:last-child { border-bottom: none; }
.criterion-item h4 { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--primary-dark); }
.criterion-item .opt { font-size: 12px; color: var(--gray-800); margin: 4px 0; padding-left: 8px; }
.criterion-item .opt-label { font-weight: 600; color: var(--primary); }
.criterion-item .deduction-desc { font-size: 12px; color: var(--danger); }

/* ========== 打分表单 ========== */
.scoring-form { display: none; }
.scoring-form.show { display: block; }

.dept-section {
    margin: 12px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.dept-header {
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
}
.dept-body { padding: 12px 16px; }

.dimension {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}
.dimension:last-child { border-bottom: none; margin-bottom: 0; }
.dim-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dim-score-tag {
    font-size: 11px;
    font-weight: 400;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 10px;
}
.dim-score-tag.deduction { color: var(--danger); background: var(--danger-light); }

.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.option-item {
    padding: 8px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.option-item.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.deduction-box {
    margin-top: 8px;
}
.deduction-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 13px;
}
.deduction-check input { width: 18px; height: 18px; accent-color: var(--danger); }
.deduction-textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px 10px;
    border: 1px solid var(--danger);
    border-radius: 6px;
    font-size: 12px;
    resize: vertical;
    outline: none;
    display: none;
}
.deduction-textarea.show { display: block; }
.deduction-textarea::placeholder { color: var(--gray-400); }

.interaction-input {
    width: 80px;
    padding: 6px 10px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    outline: none;
}
.interaction-input:focus { border-color: var(--primary); }

.dept-total {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--primary-light);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    text-align: right;
}

/* ========== 底部提交 ========== */
.submit-section {
    position: sticky;
    bottom: 0;
    padding: 16px;
    background: white;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.total-display {
    text-align: center;
    margin-bottom: 12px;
    font-size: 14px;
}
.total-display .num {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}
.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-submit:active { opacity: 0.8; }
.btn-submit:disabled { opacity: 0.5; }

/* ========== 成功页 ========== */
.success-page {
    display: none;
    text-align: center;
    padding: 60px 24px;
}
.success-page.show { display: block; }
.success-icon {
    width: 64px; height: 64px;
    margin: 0 auto 20px;
    background: var(--success-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.success-icon svg { width: 32px; height: 32px; }
.success-page h2 { font-size: 18px; margin-bottom: 12px; }
.success-page p { font-size: 14px; color: var(--gray-400); }

/* ========== 管理端样式 ========== */
.admin-body { max-width: 800px; }
.admin-header {
    background: var(--primary-dark);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.admin-header h1 { font-size: 16px; }
.admin-header .logout { font-size: 12px; cursor: pointer; opacity: 0.8; }

.admin-login {
    max-width: 360px;
    margin: 80px auto;
    padding: 32px 24px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.admin-login h2 { text-align: center; font-size: 18px; margin-bottom: 24px; }
.admin-login input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}
.admin-login input:focus { border-color: var(--primary); }
.admin-login .btn-primary { width: 100%; }
.login-msg { text-align: center; color: var(--danger); font-size: 13px; margin-top: 8px; }

.admin-content { display: none; }
.admin-content.show { display: block; }

.admin-card {
    margin: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.admin-card h2 { font-size: 15px; margin-bottom: 12px; }
.admin-card input, .admin-card select {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    margin-right: 8px;
}
.admin-card input:focus, .admin-card select:focus { border-color: var(--primary); }

.quarter-list { margin-top: 12px; }
.quarter-item {
    padding: 12px;
    border: 1px solid var(--gray-100);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.quarter-item .info { font-size: 13px; }
.quarter-item .info .name { font-weight: 600; }
.quarter-item .info .stats { font-size: 12px; color: var(--gray-400); }
.quarter-item .actions { display: flex; gap: 8px; }
.btn-sm {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.btn-sm.active { background: var(--success); color: white; }
.btn-sm.normal { background: var(--gray-100); color: var(--gray-800); }

.codes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 8px;
}
.codes-table th, .codes-table td {
    border: 1px solid var(--gray-100);
    padding: 6px 10px;
    text-align: center;
}
.codes-table th { background: var(--gray-100); font-weight: 600; }
.codes-table .used { color: var(--success); }
.codes-table .unused { color: var(--gray-400); }

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
    overflow-x: auto;
}
.summary-table th, .summary-table td {
    border: 1px solid var(--gray-100);
    padding: 6px 8px;
    text-align: center;
    white-space: nowrap;
}
.summary-table th { background: var(--primary); color: white; font-weight: 600; }
.summary-table tr:hover td { background: var(--primary-light); }
.summary-table .rank { font-weight: 700; }
.rank-1 { color: #BA7517; }
.rank-2 { color: #888780; }
.rank-3 { color: #993C1D; }

@media (max-width: 400px) {
    .option-item { padding: 6px 10px; font-size: 11px; }
    .header h1 { font-size: 16px; }
}
