/* 客观题分页：题面在上，翻页在下，样式尽量简约 */

.objective-problem-root {
    position: relative;
}

.objective-pager-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #eaeaea;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin-bottom: 12px;
}

/* 题面在上 */
.objective-pager-viewport {
    position: relative;
    padding: 20px 22px 8px;
    background: #fff;
}

.objective-pager-viewport .objective-page {
    font-size: 15px;
    line-height: 1.75;
    color: #333;
}

.objective-pager-viewport .objective-page p,
.objective-pager-viewport .objective-page li {
    font-size: 15px;
    line-height: 1.75;
}

.objective-pager-viewport .objective-page ul,
.objective-pager-viewport .objective-page ol {
    margin: 0.45em 0 0.65em;
    padding-left: 1.25em;
}

/* ========== 选项样式：对齐 ChoiceQuestionSystem choice_practice .cp-option ========== */

/* 含单选/多选的列表：纵向卡片选项区 */
.objective-problem-root ul:has(> li input[type='radio']),
.objective-problem-root ul:has(> li input[type='checkbox']),
.objective-problem-root ol:has(> li input[type='radio']),
.objective-problem-root ol:has(> li input[type='checkbox']) {
    list-style: none;
    padding-left: 0;
    margin: 8px 0 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 每一项 = .cp-option 卡片 */
.objective-problem-root li:has(input[type='radio']),
.objective-problem-root li:has(input[type='checkbox']) {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-size: 15px;
    line-height: 1.6;
    color: #262626;
    margin: 0;
}

.objective-problem-root li:has(input[type='radio']):hover,
.objective-problem-root li:has(input[type='checkbox']):hover {
    border-color: #91d5ff;
    background: #e6f7ff;
}

.objective-problem-root li:has(input[type='radio']:checked),
.objective-problem-root li:has(input[type='checkbox']:checked) {
    border-color: #1890ff;
    background: #e6f7ff;
}

.objective-problem-root li:has(input[type='radio']) input,
.objective-problem-root li:has(input[type='checkbox']) input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 4px;
    cursor: pointer;
}

/* label 包住 input 时，与 .cp-option 内排版一致 */
.objective-problem-root li:has(input[type='radio']) label,
.objective-problem-root li:has(input[type='checkbox']) label {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

.objective-problem-root li:has(input[type='radio']) label input,
.objective-problem-root li:has(input[type='checkbox']) label input {
    margin-top: 4px;
}

/* li 已做卡片时，内层 radiobox 不再套一层边框 */
.objective-problem-root li:has(input) label.radiobox {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* Hydro 题面里可能出现的 radiobox */
.objective-problem-root label.radiobox {
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-size: 15px;
    line-height: 1.6;
    color: #262626;
    margin: 6px 0;
    box-sizing: border-box;
}

.objective-problem-root label.radiobox:hover {
    border-color: #91d5ff;
    background: #e6f7ff;
}

.objective-problem-root label.radiobox:has(input:checked) {
    border-color: #1890ff;
    background: #e6f7ff;
}

.objective-problem-root label.radiobox input[type='radio'],
.objective-problem-root label.radiobox input[type='checkbox'] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 4px;
    cursor: pointer;
}

.objective-problem-root label.radiobox .markdown-body {
    flex: 1;
    min-width: 0;
}

/* 翻页条在题面下方 */
.objective-pager-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.objective-pager-nav {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.objective-pager-counter {
    font-size: 13px;
    font-weight: 500;
    color: #888;
    min-width: 3.5em;
    text-align: center;
    user-select: none;
}

.objective-pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #ddd;
    background: #fff;
    color: #444;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
}

.objective-pager-btn:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #ccc;
}

.objective-pager-btn--accent {
    color: #1677ff;
    border-color: #91caff;
    background: #fff;
}

.objective-pager-btn--accent:hover:not(:disabled) {
    background: #e6f4ff;
    border-color: #1677ff;
}

.objective-pager-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.objective-pager-btn--unlock {
    color: #ea580c;
    border-color: #fdba74;
    background: #fff7ed;
}

.objective-pager-btn--unlock:hover:not(:disabled) {
    background: #ffedd5;
    border-color: #ea580c;
    color: #c2410c;
}

.objective-preview-lock {
    margin: 4px 16px 16px;
    padding: 16px 18px 18px;
    border-radius: 10px;
    border: 1px solid #fed7aa;
    background: linear-gradient(180deg, #fffbeb 0%, #fff7ed 100%);
    text-align: center;
}

.objective-preview-lock__title {
    font-size: 16px;
    font-weight: 600;
    color: #9a3412;
    margin-bottom: 6px;
}

.objective-preview-lock__hint {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #9a3412;
}

.objective-preview-lock__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.objective-preview-lock__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
}

.objective-preview-lock__btn--primary {
    background: linear-gradient(135deg, #fb923c, #ea580c);
    color: #fff;
    border-color: transparent;
}

.objective-preview-lock__btn--ghost {
    background: #fff;
    color: #c2410c;
    border-color: #fdba74;
}

.objective-preview-lock__btn--ghost:hover {
    background: #fff7ed;
    border-color: #ea580c;
}

#rightSidebarCol .contest-problems a[href^='#p'].objective-sidebar-q--locked,
#scratchpad .contest-problems a[href^='#p'].objective-sidebar-q--locked,
.scratchpad-container .contest-problems a[href^='#p'].objective-sidebar-q--locked {
    background: #f4f4f5 !important;
    color: #a1a1aa !important;
    border-color: #e4e4e7 !important;
    cursor: not-allowed;
    opacity: 0.72;
}

#rightSidebarCol .contest-problems a[href^='#p'].objective-sidebar-q--locked .id,
#scratchpad .contest-problems a[href^='#p'].objective-sidebar-q--locked .id,
.scratchpad-container .contest-problems a[href^='#p'].objective-sidebar-q--locked .id {
    color: #a1a1aa !important;
}

.objective-page {
    display: none;
    animation: objective-page-in 0.22s ease-out;
}

.objective-page.is-active {
    display: block;
}

@keyframes objective-page-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 暗色 */
.theme--dark .objective-pager-card {
    background: #161b22;
    border-color: #30363d;
    box-shadow: none;
}

.theme--dark .objective-pager-viewport {
    background: #161b22;
}

.theme--dark .objective-pager-viewport .objective-page {
    color: #c9d1d9;
}

.theme--dark .objective-pager-toolbar {
    background: #0d1117;
    border-top-color: #30363d;
}

.theme--dark .objective-pager-counter {
    color: #8b949e;
}

.theme--dark .objective-pager-btn {
    background: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}

.theme--dark .objective-pager-btn:hover:not(:disabled) {
    background: #30363d;
    border-color: #484f58;
}

.theme--dark .objective-pager-btn--accent {
    color: #58a6ff;
    border-color: #388bfd;
    background: #161b22;
}

.theme--dark .objective-pager-btn--accent:hover:not(:disabled) {
    background: #1c2a3a;
}

/* 选项：暗色（对齐 cp-option 在暗色下的对比） */
.theme--dark .objective-problem-root li:has(input[type='radio']),
.theme--dark .objective-problem-root li:has(input[type='checkbox']) {
    border-color: #30363d;
    color: #c9d1d9;
}

.theme--dark .objective-problem-root li:has(input[type='radio']):hover,
.theme--dark .objective-problem-root li:has(input[type='checkbox']):hover {
    border-color: #388bfd;
    background: #1c2a3a;
}

.theme--dark .objective-problem-root li:has(input[type='radio']:checked),
.theme--dark .objective-problem-root li:has(input[type='checkbox']:checked) {
    border-color: #388bfd;
    background: #1c3a4f;
}

.theme--dark .objective-problem-root label.radiobox {
    border-color: #30363d;
    color: #c9d1d9;
}

.theme--dark .objective-problem-root label.radiobox:hover {
    border-color: #388bfd;
    background: #1c2a3a;
}

.theme--dark .objective-problem-root label.radiobox:has(input:checked) {
    border-color: #388bfd;
    background: #1c3a4f;
}

/* ========== 客观题右侧题号格：未选灰、已选高亮（由 JS 加 .objective-sidebar-q--answered）========== */

#rightSidebarCol .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered),
#scratchpad .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered),
.scratchpad-container .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered) {
    border-color: #d9d9d9 !important;
    background: #f5f5f5 !important;
    color: #8c8c8c !important;
    box-shadow: none !important;
}

#rightSidebarCol .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered) .id,
#scratchpad .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered) .id,
.scratchpad-container .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered) .id {
    color: #8c8c8c !important;
}

#rightSidebarCol .contest-problems a[href^='#p'].objective-sidebar-q--answered,
#scratchpad .contest-problems a[href^='#p'].objective-sidebar-q--answered,
.scratchpad-container .contest-problems a[href^='#p'].objective-sidebar-q--answered {
    border-color: #69c0ff !important;
    background: #e6f7ff !important;
    color: #1890ff !important;
}

#rightSidebarCol .contest-problems a[href^='#p'].objective-sidebar-q--answered .id,
#scratchpad .contest-problems a[href^='#p'].objective-sidebar-q--answered .id,
.scratchpad-container .contest-problems a[href^='#p'].objective-sidebar-q--answered .id {
    color: #1890ff !important;
}

.theme--dark #rightSidebarCol .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered),
.theme--dark #scratchpad .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered),
.theme--dark .scratchpad-container .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered) {
    border-color: #30363d !important;
    background: #21262d !important;
    color: #8b949e !important;
}

.theme--dark #rightSidebarCol .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered) .id,
.theme--dark #scratchpad .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered) .id,
.theme--dark .scratchpad-container .contest-problems a[href^='#p']:not(.objective-sidebar-q--answered) .id {
    color: #8b949e !important;
}

.theme--dark #rightSidebarCol .contest-problems a[href^='#p'].objective-sidebar-q--answered,
.theme--dark #scratchpad .contest-problems a[href^='#p'].objective-sidebar-q--answered,
.theme--dark .scratchpad-container .contest-problems a[href^='#p'].objective-sidebar-q--answered {
    border-color: #388bfd !important;
    background: #1c2a3a !important;
    color: #58a6ff !important;
}

.theme--dark #rightSidebarCol .contest-problems a[href^='#p'].objective-sidebar-q--answered .id,
.theme--dark #scratchpad .contest-problems a[href^='#p'].objective-sidebar-q--answered .id,
.theme--dark .scratchpad-container .contest-problems a[href^='#p'].objective-sidebar-q--answered .id {
    color: #58a6ff !important;
}

.theme--dark .objective-pager-btn--unlock {
    color: #fb923c;
    border-color: #9a3412;
    background: #3d2a1a;
}

.theme--dark .objective-pager-btn--unlock:hover:not(:disabled) {
    background: #4a3018;
    border-color: #fb923c;
    color: #fdba74;
}

.theme--dark .objective-preview-lock {
    border-color: #9a3412;
    background: linear-gradient(180deg, #3d2a1a 0%, #2a1f14 100%);
}

.theme--dark .objective-preview-lock__title,
.theme--dark .objective-preview-lock__hint {
    color: #fdba74;
}

.theme--dark .objective-preview-lock__btn--ghost {
    background: #21262d;
    color: #fdba74;
    border-color: #9a3412;
}

.theme--dark .objective-preview-lock__btn--ghost:hover {
    background: #3d2a1a;
    border-color: #fb923c;
}

.theme--dark #rightSidebarCol .contest-problems a[href^='#p'].objective-sidebar-q--locked,
.theme--dark #scratchpad .contest-problems a[href^='#p'].objective-sidebar-q--locked,
.theme--dark .scratchpad-container .contest-problems a[href^='#p'].objective-sidebar-q--locked {
    background: #21262d !important;
    color: #484f58 !important;
    border-color: #30363d !important;
}

.theme--dark #rightSidebarCol .contest-problems a[href^='#p'].objective-sidebar-q--locked .id,
.theme--dark #scratchpad .contest-problems a[href^='#p'].objective-sidebar-q--locked .id,
.theme--dark .scratchpad-container .contest-problems a[href^='#p'].objective-sidebar-q--locked .id {
    color: #484f58 !important;
}
