/* —— 示例交互 —— */
button:hover { transform: scale(1.1); }
button:hover .tooltip { opacity: 1; }

/* ====== Scheme A：把这一行改为 Flex，杜绝换行错位 ====== */
.row[data-sticky-parent] {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;              /* 不允许换行 */
}
.row[data-sticky-parent] > .columns {
  float: none;                    /* 取消 float，交给 flex 控制 */
  min-width: 0;                   /* 防止内容把列撑爆 */
}

/* 主内容列：占剩余空间 */
#mainCol,
.row[data-sticky-parent] > .medium-9.columns {
  flex: 0 0 75%;
  max-width: 75%;
}

/* 右侧栏默认 25% 宽 */
#rightSidebarCol {
  flex: 0 0 25%;
  max-width: 25%;
  overflow: hidden;
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
  transition:
    transform .28s ease,
    opacity .28s ease,
    flex-basis .28s ease,
    max-width .28s ease;
}

/* 打开题库：右侧栏向右滑出并“占位宽度=0” */
body.pset-drawer-open #rightSidebarCol {
  transform: translateX(120%);
  opacity: 0;
  pointer-events: none;
  flex-basis: 0;
  max-width: 0;
}

/* 题库抽屉主体（保持 sticky 行为，与 pd-header-card / pd-main-card 统一视觉） */
.pset-drawer {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  background: #fff;
  border: none;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* 题库列：关闭时 0 宽并左移；打开时展开为 --pset-w */
:root { --pset-w: clamp(220px, 24vw, 320px); }

.pset-col {
  will-change: transform;
  flex: 0 0 0;
  max-width: 0;
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform .28s ease,
    opacity .28s ease,
    flex-basis .28s ease,
    max-width .28s ease;
}

body.pset-drawer-open .pset-col {
  flex: 0 0 var(--pset-w);
  max-width: var(--pset-w);
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* ====== 题库内部样式 ====== */
.pset-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 8px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 1;
}
.pset-drawer__header h3 {
  font-size: 13px;
  font-weight: 700;
  color: #262626;
  line-height: 1.35;
  margin: 0;
}
.pset-drawer__header h5 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #595959;
  line-height: 1.35;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pset-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #8c8c8c;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.pset-drawer__close:hover {
  background: #f0f0f0;
  color: #262626;
}

.pset-list,
#psetFlatList { padding: 4px 0; flex-grow: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

.pset-ul { list-style: none; margin: 0; padding: 0; }
.pset-item {
  padding: 8px 14px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.12s ease;
}
.pset-item:hover { background: #f9fafb; }
.pset-item--ac { background: #f6ffed; }
.pset-item--ac:hover { background: #edfce5; }
.pset-item--active {
  background: #e6f4ff;
  border-left: 2px solid #1677ff;
  padding-left: 12px;
}
.pset-item__main { display: flex; align-items: center; gap: 6px; }
.pset-item__title {
  flex: 1 1 auto;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.35;
  color: #262626;
  max-width: 220px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-decoration: none;
}
.pset-item__title:hover { color: #0958d9; }
.pset-item__dif {
  font-weight: 600;
  font-size: 11px;
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1;
  padding: 1px 6px;
  border-radius: 999px;
}
.dif-easy { color: #389e0d; background: #f6ffed; }
.dif-medium { color: #d48806; background: #fff7e6; }
.dif-hard { color: #cf1322; background: #fff1f0; }
.dif-none { color: #8c8c8c; }

.green-button {
  padding: 10px 16px;
  font-size: 15px;
  margin-left: 8px;
  border: 1px solid #d1d5da;
  border-radius: 6px;
  background: #ffffff;
  color: #24292e;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.green-button:hover { 
  background: #f6f8fa; 
  border-color: #d1d5da;
}
.green-button:active { 
  background: #f3f4f6;
  border-color: #d1d5da;
}

.pset-search-row { width: 100%; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; background: #fafafa; }
.pset-search { display: flex; align-items: center; background: #fff; border: 1px solid #e8e8e8; border-radius: 6px; padding: 5px 8px; transition: border-color 0.15s ease; }
.pset-search:focus-within { border-color: #91caff; }
.pset-search input { flex: 1; border: none; outline: none; font-size: 12px; color: #262626; }
.pset-search input::placeholder { color: #bfbfbf; }

.pset-drawer .section .section__header.clearfix {
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: center;
  padding: 8px 14px 6px;
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
  background: transparent;
}
.pset-drawer .section .section__header.clearfix > * { min-width: 0; }
.pset-drawer .section .section__header.clearfix > .float-left {
  float: none;
  flex: 1 1 auto;
}
.pset-drawer .section .section__header.clearfix .mysection__title {
  margin: 0;
  text-align: center;
}

.mysection__title {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: 12px;
  font-weight: 600;
  color: #595959;
}
.pset-item--focus {
  background: #e6f4ff;
  border-left: 2px solid #1677ff;
  padding-left: 12px;
  transition: background .2s ease;
}
@media (max-width: 480px) {
  .pset-item__title { font-size: 11px; }
}

/*  视图切换按钮样式 */
.view-mode-toggle {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 38px;
  color: #666;
  margin-left: 8px;
  vertical-align: middle;
}
.view-mode-toggle:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #333;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.view-mode-toggle .icon-list {
  font-style: normal;
}

/* 筛选控件样式 (仅在平铺视图下由 JS 控制显示) */
.pset-filter-row {
  width: 100%;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}
.pset-filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pset-filter-select-row {
  display: flex;
  gap: 8px;
}
.pset-filter-select-row > .pset-select {
  flex: 1;
  min-width: 0;
}

.pset-select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease;
  color: #262626;
}
.pset-select:hover {
  border-color: #d9d9d9;
}
.pset-select:focus {
  outline: none;
  border-color: #91caff;
}
.pset-checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  padding: 4px 0;
  color: #333;
}

/* 内部的真实 label 标签 */
.pset-checkbox-label > label {
  cursor: pointer; /* 让文字部分也可点击 */
  font-weight: normal; /* 覆盖浏览器默认的label加粗样式 */
  margin: 0; /* 清除可能存在的默认外边距 */
}

.pset-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  margin: 0; /* 确保复选框本身没有多余边距 */
}

/* 列表滚动条 */
.pset-list::-webkit-scrollbar,
#psetFlatList.pset-list::-webkit-scrollbar {
  width: 5px;
}
.pset-list::-webkit-scrollbar-track,
#psetFlatList.pset-list::-webkit-scrollbar-track {
  background: transparent;
}
.pset-list::-webkit-scrollbar-thumb,
#psetFlatList.pset-list::-webkit-scrollbar-thumb {
  background: #d9d9d9;
  border-radius: 3px;
}
.pset-list::-webkit-scrollbar-thumb:hover,
#psetFlatList.pset-list::-webkit-scrollbar-thumb:hover {
  background: #bfbfbf;
}

/* ✨ 调整窄屏幕下的筛选控件 */
@media (max-width: 480px) {
  .pset-filter-group {
    gap: 6px;
  }
  .pset-select,
  .pset-checkbox-label {
    font-size: 12px;
  }
}

/* 抽屉主体（与深色卡片统一） */
.theme--dark .pset-drawer {
  background: #1f1f1f;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* 抽屉头部、搜索行和筛选行 */
.theme--dark .pset-drawer__header,
.theme--dark .pset-search-row,
.theme--dark .pset-filter-row {
  background: #252525;
  border-bottom-color: #333;
  color: #e8e8e8;
}
.theme--dark .pset-drawer__header h3 { color: #e8e8e8; }
.theme--dark .pset-drawer__header h5 { color: #bfbfbf; }
.theme--dark .pset-drawer__close { color: #6b6b6b; }
.theme--dark .pset-drawer__close:hover { background: #333; color: #e8e8e8; }

/* 列表项分隔线 */
.theme--dark .pset-item {
  border-bottom-color: #2a2a2a;
}
.theme--dark .pset-item:hover {
  background: #262626;
}

/* 列表项 - 已通过 (AC) */
.theme--dark .pset-item--ac {
  background: #162312;
}
.theme--dark .pset-item--ac:hover {
  background: #1a2c14;
}
.theme--dark .pset-item--ac .pset-item__title {
  color: #95de64;
}
.theme--dark .pset-item--ac .pset-item__title:hover {
  color: #b7eb8f;
}

/* 列表项 - 当前/聚焦 */
.theme--dark .pset-item--active {
  background: #111d2c;
  border-left-color: #1677ff;
}
.theme--dark .pset-item--focus {
  background: #111d2c;
  border-left-color: #1677ff;
}

/* 列表项标题 */
.theme--dark .pset-item__title {
  color: #d9d9d9;
}
.theme--dark .pset-item__title:hover {
  color: #69b1ff;
}

/* 难度标签 */
.theme--dark .dif-easy { color: #95de64; background: #162312; }
.theme--dark .dif-medium { color: #ffc53d; background: #2b2111; }
.theme--dark .dif-hard { color: #ff7875; background: #2a1215; }
.theme--dark .dif-none { color: #6b6b6b; background: transparent; }

/* 章节标题 */
.theme--dark .pset-drawer .section .section__header.clearfix {
  border-bottom-color: #333;
}
.theme--dark .mysection__title { color: #bfbfbf; }

/* 按钮（深色主题） */
.theme--dark .green-button {
  background: #21262d;
  border-color: #30363d;
  color: #c9d1d9;
}
.theme--dark .green-button:hover {
  background: #30363d;
  border-color: #484f58;
  color: #ffffff;
}
.theme--dark .green-button:active {
  background: #1c2128;
  border-color: #30363d;
}

/* 搜索框 */
.theme--dark .pset-search {
  background: #1a1a1a;
  border-color: #333;
}
.theme--dark .pset-search:focus-within {
  border-color: #3c89e8;
}
.theme--dark .pset-search input {
  background: transparent;
  color: #e8e8e8;
}
.theme--dark .pset-search input::placeholder {
  color: #555;
}

/* 视图切换按钮 */
.theme--dark .view-mode-toggle {
  background: #3c3c3c;
  border-color: #555;
  color: #ccc;
  box-shadow: none;
}
.theme--dark .view-mode-toggle:hover {
  background: #4a4a4a;
  border-color: #666;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 下拉选择框 */
.theme--dark .pset-select {
  background: #1a1a1a;
  border-color: #333;
  color: #d9d9d9;
}
.theme--dark .pset-select:hover {
  border-color: #444;
}
.theme--dark .pset-select:focus {
  border-color: #3c89e8;
}

/* 复选框 */
.theme--dark .pset-checkbox-label,
.theme--dark .pset-checkbox-label > label {
  color: #ccc;
}
.theme--dark .pset-checkbox {
  accent-color: #22c55e;
  color-scheme: dark; /* 增强兼容性 */
}

/* 滚动条 */
.theme--dark .pset-list::-webkit-scrollbar-track,
.theme--dark #psetFlatList.pset-list::-webkit-scrollbar-track {
  background: #1f1f1f;
}
.theme--dark .pset-list::-webkit-scrollbar-thumb,
.theme--dark #psetFlatList.pset-list::-webkit-scrollbar-thumb {
  background: #3a3a3a;
}
.theme--dark .pset-list::-webkit-scrollbar-thumb:hover,
.theme--dark #psetFlatList.pset-list::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* =============================================================================
 * 题目详情：统一卡片外壳（顶栏标签区 / 题面 / 右侧侧栏）
 * ============================================================================= */
.pd-header-card.section,
.pd-main-card.section,
#rightSidebarCol .section.side {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
  margin-bottom: 12px;
  overflow: hidden;
  border: none;
}

.pd-header-card .section__header {
  padding: 12px 16px 10px;
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.pd-header-card .section__title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0;
  gap: 8px;
}

.pd-header-card .section__title > div:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  gap: 6px;
  display: flex;
  align-items: center;
}

.pd-header-card .problem-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  flex-shrink: 0;
  background: #f5f5f5;
  color: #595959;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
}

.pd-header-card .problem-nav-btn svg {
  width: 20px;
  height: 20px;
}

.pd-header-card .problem-nav-btn:hover:not(:disabled) {
  background: #e6f7ff;
  color: #1890ff;
}

.pd-header-card .problem-nav-btn:disabled {
  cursor: not-allowed;
}

.pd-header-card .section__body {
  padding: 10px 16px 12px;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.pd-header-card ul.problem__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0 !important;
  padding: 0;
  list-style: none;
  align-items: center;
  flex: 1 1 100%;
  width: 100%;
}

/*
 * 算法标签与 ul 内其它标签同一行流动；父级 ul 已有 flex-wrap，窄屏自动换行。
 * 使用 display:contents 让嵌套 div 不参与布局，子项直接参与 ul 的 flex（勿对子项用 display:!important）。
 */
.pd-header-card ul.problem__tags > .problem__tags-nested {
  display: contents;
}

/*
 * 标签样式：禁止对 display 使用 !important。
 * Hydro 依赖 .hasjs .hasjs--hide { display:none } 与点击后内联 display:inline-block。
 *
 * 仅用 .problem__tag-item.bp6-tag（不写重复的 a.…）：题目里的标签无论是 <span> 还是 <a> 都有这两类名。
 * 修饰色必须写成 .problem__tag-item.bp6-tag.problem__tag-item--*，否则基础选择器含 .bp6-tag，
 * 特异性 (0,3,0) 会压过单独的 .problem__tag-item--* (0,2,0)，导致彩色标签不生效。
 */
.pd-header-card .problem__tag-item.bp6-tag {
  box-sizing: border-box;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  min-height: auto;
  border: none;
  box-shadow: none;
  text-decoration: none;
  background: #f5f5f5;
  color: #595959;
}

/*
 * Hydro 把 hasjs / nojs 加在 <html> 上，不是 body。
 * 若写 body:not(.hasjs)，在「仅 html.hasjs」时恒成立，特异性又高于 .hasjs .hasjs--hide，
 * 会把带 hasjs--hide 的算法标签也显示出来。
 */
.hasjs .pd-header-card .problem__tag-item.bp6-tag:not(.hasjs--hide) {
  display: inline-flex;
}

.nojs .pd-header-card .problem__tag-item.bp6-tag {
  display: inline-flex;
}

.pd-header-card a.problem__tag-item.bp6-tag:hover {
  filter: brightness(0.96);
}

/* 时限：中性灰蓝（规格）；已尝试：天蓝（统计），避免两枚标签同色 */
.pd-header-card .problem__tag-item.bp6-tag.icon-stopwatch {
  background: #f1f5f9;
  color: #475569;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--tried {
  background: #e6f4ff;
  color: #0958d9;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--ac {
  background: #f6ffed;
  color: #389e0d;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--diff {
  background: #fff7e6;
  color: #d48806;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company {
  background: #f9f0ff;
  color: #531dab;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company .problem__tag-item__link {
  color: #391085;
  font-weight: 600;
  text-decoration: none;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company .problem__tag-item__link:hover {
  text-decoration: underline;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--ref {
  background: #e6fffb;
  color: #08979c;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--alg-toggle {
  background: #eef2ff;
  color: #4f46e5;
  cursor: pointer;
}

.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--alg-toggle:hover {
  background: #e0e7ff;
  color: #3730a3;
}

/* 算法标签展开后：按序号轮换配色 */
.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-0 { background: #fff0f6; color: #c41d7f; }
.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-1 { background: #e6f4ff; color: #0958d9; }
.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-2 { background: #f6ffed; color: #237804; }
.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-3 { background: #fff7e6; color: #ad6800; }
.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-4 { background: #f9f0ff; color: #531dab; }
.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-5 { background: #e6fffb; color: #006d75; }

.pd-header-card .section__body > .green-button {
  margin: 0;
  border-radius: 7px;
  font-size: 12px;
  padding: 6px 12px;
  border-color: #e8e8e8;
  line-height: 1.35;
}

.pd-header-card .section__tools.contest-problems {
  margin-top: 0;
}

/* =============================================================================
 * 题目详情：题面主区 .problem-content（仅标题 + Tab；不覆盖题面 markdown 正文样式）
 * 在线编程时 Hydro 会把 .problem-content 挪到 .scratchpad__problem 下，不再位于 .pd-main-card 内，
 * 故需同时写 body.mode--scratchpad .scratchpad__problem … 选择器。
 * ============================================================================= */
.pd-main-card .problem-content-container {
  background: transparent;
}

.pd-main-card .problem-content,
body.mode--scratchpad .scratchpad__problem .problem-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pd-main-card .problem-content .section__header,
body.mode--scratchpad .scratchpad__problem .problem-content .section__header {
  padding: 10px 16px 10px;
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.pd-main-card .problem-content .section__title,
body.mode--scratchpad .scratchpad__problem .problem-content .section__title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.pd-main-card .section__tab-container,
body.mode--scratchpad .scratchpad__problem .section__tab-container {
  background: #fff;
  border-bottom: none;
}

.pd-main-card .section__tab-header-wrapper,
body.mode--scratchpad .scratchpad__problem .section__tab-header-wrapper {
  padding: 0;
}

.pd-main-card ul.section__tab-header.flex-row,
body.mode--scratchpad .scratchpad__problem ul.section__tab-header.flex-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  padding: 0 12px;
  margin: 0;
  list-style: none;
  border-bottom: 1px solid #e8e8e8;
}

.pd-main-card .section__tab-header-item,
body.mode--scratchpad .scratchpad__problem .section__tab-header-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  margin: 0;
  border: none;
  border-top: 2px solid transparent;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #595959;
  text-decoration: none !important;
  background: transparent;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.pd-main-card .section__tab-header-item:hover,
body.mode--scratchpad .scratchpad__problem .section__tab-header-item:hover {
  background: transparent;
  border-top-color: #bbb;
  color: #0958d9;
}

.pd-main-card .section__tab-header-item.tab--active,
body.mode--scratchpad .scratchpad__problem .section__tab-header-item.tab--active {
  background: transparent;
  border-top-color: #1677ff;
  color: #0958d9;
  font-weight: 600;
}

/* =============================================================================
 * 题目详情：右侧菜单（多块 section.side 各为一张卡片）
 * ============================================================================= */
#rightSidebarCol .section.side .section__header {
  padding: 10px 14px 8px;
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

#rightSidebarCol .section.side .section__title {
  font-size: 13px;
  font-weight: 700;
  color: #262626;
  line-height: 1.35;
  margin: 0;
}

#rightSidebarCol .section.side > div:not(.section__header) {
  padding: 4px 6px 8px;
}

/* 侧栏菜单：去掉 ol 序号、整行可点，hover/active 背景铺满宽度 */
#rightSidebarCol ol.menu {
  list-style: none;
  padding: 0;
  margin: 0 -6px;
  width: calc(100% + 12px);
}

#rightSidebarCol .menu .menu__item {
  margin: 2px 0;
}

#rightSidebarCol .menu .menu__item > form {
  margin: 0;
  display: block;
}

#rightSidebarCol .menu__link,
#rightSidebarCol button.menu__link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-left: none;
  border-radius: 6px;
  padding: 8px 16px;
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}

#rightSidebarCol button.menu__link {
  font: inherit;
  line-height: inherit;
  background: transparent;
  cursor: pointer;
}

#rightSidebarCol .menu__link .icon {
  display: inline-block;
  vertical-align: -0.2em;
  margin-right: 6px;
}

#rightSidebarCol .menu__link:hover,
#rightSidebarCol button.menu__link:hover {
  background: #f5f5f5;
  border: none;
  border-left: none;
}

#rightSidebarCol .menu__link.active,
#rightSidebarCol button.menu__link.active {
  background: #e6f4ff;
  color: #0958d9;
  border: none;
  border-left: none;
}

#rightSidebarCol .menu__seperator {
  margin: 6px 16px;
  background: #f0f0f0;
}

/* =============================================================================
 * 题目详情页顶栏导航（本样式表随 problem_detail 加载）
 * ============================================================================= */
nav#menu.nav.slideout-menu {
  box-sizing: border-box;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
  border-radius: 0 0 10px 10px;
  margin-bottom: 12px;
}

nav#menu.nav .nav__item {
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
}

nav#menu.nav .nav__list-item {
  margin-left: 2px;
  margin-right: 2px;
}

nav#menu.nav .nav__item:hover {
  background: #f5f5f5;
}

/* 深色主题 */
.theme--dark .pd-header-card.section,
.theme--dark .pd-main-card.section,
.theme--dark #rightSidebarCol .section.side {
  background: #1f1f1f;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.theme--dark .pd-main-card .problem-content .section__header,
.theme--dark body.mode--scratchpad .scratchpad__problem .problem-content .section__header {
  border-bottom-color: #333;
  background: #252525;
}

.theme--dark .pd-main-card .problem-content .section__title,
.theme--dark body.mode--scratchpad .scratchpad__problem .problem-content .section__title {
  color: #f0f0f0;
}

.theme--dark .pd-main-card .section__tab-container,
.theme--dark body.mode--scratchpad .scratchpad__problem .section__tab-container {
  background: #1f1f1f;
  border-bottom-color: #333;
}

.theme--dark .pd-main-card ul.section__tab-header.flex-row,
.theme--dark body.mode--scratchpad .scratchpad__problem ul.section__tab-header.flex-row {
  border-bottom-color: #333;
}

.theme--dark .pd-main-card .section__tab-header-item,
.theme--dark body.mode--scratchpad .scratchpad__problem .section__tab-header-item {
  background: transparent;
  border-color: transparent;
  color: #bfbfbf;
}

.theme--dark .pd-main-card .section__tab-header-item:hover,
.theme--dark body.mode--scratchpad .scratchpad__problem .section__tab-header-item:hover {
  background: transparent;
  border-top-color: #555;
  color: #69b1ff;
}

.theme--dark .pd-main-card .section__tab-header-item.tab--active,
.theme--dark body.mode--scratchpad .scratchpad__problem .section__tab-header-item.tab--active {
  background: transparent;
  border-top-color: #1677ff;
  color: #69b1ff;
  font-weight: 600;
}

.theme--dark #rightSidebarCol .section.side .section__header {
  background: #252525;
  border-bottom-color: #333;
}

.theme--dark #rightSidebarCol .section.side .section__title {
  color: #e8e8e8;
}

.theme--dark #rightSidebarCol .menu__link:hover,
.theme--dark #rightSidebarCol button.menu__link:hover {
  background: #2a2a2a;
  border: none;
  border-left: none;
}

.theme--dark #rightSidebarCol .menu__link.active,
.theme--dark #rightSidebarCol button.menu__link.active {
  background: #111d2c;
  color: #69b1ff;
  border: none;
  border-left: none;
}

.theme--dark #rightSidebarCol .menu__seperator {
  background: #333;
}

.theme--dark nav#menu.nav.slideout-menu {
  background: #1a1a1a;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.theme--dark nav#menu.nav .nav__item:hover {
  background: #2a2a2a;
}

.theme--dark .pd-header-card .section__header {
  border-bottom-color: #333;
}

.theme--dark .pd-header-card .section__title {
  color: #f0f0f0;
}

.theme--dark .pd-header-card .problem-nav-btn {
  background: #2a2a2a;
  color: #bfbfbf;
}

.theme--dark .pd-header-card .problem-nav-btn:hover:not(:disabled) {
  background: #111d2c;
  color: #69b1ff;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag {
  background: #2a2a2a;
  color: #d0d0d0;
}

.theme--dark .pd-header-card a.problem__tag-item.bp6-tag:hover {
  filter: brightness(1.12);
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.icon-stopwatch {
  background: #1e293b;
  color: #cbd5e1;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--tried {
  background: #111d2c;
  color: #69b1ff;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--ac {
  background: #162312;
  color: #95de64;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--diff {
  background: #2b2111;
  color: #ffc53d;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company {
  background: #1f1533;
  color: #d3adf7;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company .problem__tag-item__link {
  color: #efdbff;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--ref {
  background: #112123;
  color: #5cdbd3;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--alg-toggle {
  background: #1e1b4b;
  color: #a5b4fc;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--alg-toggle:hover {
  background: #312e81;
  color: #c7d2fe;
}

.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-0 { background: #291321; color: #ffadd2; }
.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-1 { background: #111d2c; color: #8dc5ff; }
.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-2 { background: #162312; color: #95de64; }
.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-3 { background: #2b2111; color: #ffd666; }
.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-4 { background: #1f1533; color: #d3adf7; }
.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-5 { background: #112123; color: #5cdbd3; }

.theme--dark .pd-header-card .section__body > .green-button {
  background: #2a2a2a;
  border-color: #444;
  color: #e0e0e0;
}

.theme--dark .pd-header-card .section__body > .green-button:hover {
  background: #333;
  border-color: #555;
}

/* =============================================================================
 * 在线编程模式（Scratchpad）：与题目详情卡片 / 侧栏同款视觉
 * body 会带上 .mode--scratchpad（Hydro 内置）
 * ============================================================================= */

body.mode--scratchpad .scratchpad-container {
  background: #f0f2f5;
}

body.mode--scratchpad .scratchpad__toolbar {
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  padding: 8px 12px;
}

body.mode--scratchpad .scratchpad__toolbar__button.enabled:hover {
  color: #0958d9;
  background: #f5f5f5;
}

body.mode--scratchpad .scratchpad__toolbar__split {
  background: #e8e8e8;
}

body.mode--scratchpad .scratchpad__panel-title {
  background: #fafafa !important;
  color: #262626 !important;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 600;
  line-height: 2rem;
}

body.mode--scratchpad .scratchpad__panel-button {
  color: #595959 !important;
  opacity: 1;
}

body.mode--scratchpad .scratchpad__panel-button:hover {
  color: #1677ff !important;
}

body.mode--scratchpad .scratchpad__tablist div {
  border-radius: 8px;
  margin: 0.35rem 0;
  transition: background 0.12s ease, color 0.12s ease, fill 0.12s ease;
}

body.mode--scratchpad .scratchpad__tablist div:hover {
  background: #f5f5f5;
  fill: #1677ff !important;
  color: #1677ff !important;
}

body.mode--scratchpad .scratchpad__data-input {
  border-left-color: #91caff !important;
  background: #fff !important;
  color: #262626;
}

body.mode--scratchpad .scratchpad__data-input:focus {
  border-left-color: #1677ff !important;
  background: #fff !important;
}

body.mode--scratchpad .scratchpad__problem {
  background: #fff;
}

body.mode--scratchpad .scratchpad__records__table .col--detail {
  border-right-color: #f0f0f0;
}

/* 深色：与 pd-main-card / 侧栏深色一致 */
.theme--dark body.mode--scratchpad .scratchpad-container {
  background: #141414;
}

.theme--dark body.mode--scratchpad .scratchpad__toolbar {
  background: #252525;
  border-bottom-color: #333;
  box-shadow: none;
}

.theme--dark body.mode--scratchpad .scratchpad__toolbar__button.enabled:hover {
  color: #69b1ff;
  background: #2a2a2a;
}

.theme--dark body.mode--scratchpad .scratchpad__toolbar__split {
  background: #444;
}

.theme--dark body.mode--scratchpad .scratchpad__panel-title {
  background: #252525 !important;
  color: #e8e8e8 !important;
  border-bottom-color: #333;
}

.theme--dark body.mode--scratchpad .scratchpad__panel-button {
  color: #bfbfbf !important;
}

.theme--dark body.mode--scratchpad .scratchpad__panel-button:hover {
  color: #69b1ff !important;
}

.theme--dark body.mode--scratchpad .scratchpad__tablist div:hover {
  background: #2a2a2a;
  fill: #69b1ff !important;
  color: #69b1ff !important;
}

.theme--dark body.mode--scratchpad .scratchpad__tablist div.scratchpad__tab-active {
  background: #111d2c;
  border-left-color: #69b1ff !important;
  fill: #69b1ff !important;
  color: #69b1ff !important;
}

.theme--dark body.mode--scratchpad .scratchpad__data-input {
  border-left-color: #3c89e8 !important;
  background: #1f1f1f !important;
  color: #e8e8e8 !important;
}

.theme--dark body.mode--scratchpad .scratchpad__data-input:focus {
  border-left-color: #69b1ff !important;
  background: #1a1a1a !important;
}

.theme--dark body.mode--scratchpad .scratchpad__problem {
  background: #1f1f1f;
}

.theme--dark body.mode--scratchpad .scratchpad__records__table .col--detail {
  border-right-color: #333;
}