body.problem-route { overflow: hidden; background: #fff; }
body.problem-route > footer { display: none; }
body.problem-route #app { padding: 0; }
body.problem-route .toast { bottom: 72px; }
.problem-workspace {
  --workspace-top: 72px;
  --statement-width: 50%;
  --test-size: 35%;
  --editor-font-size: 16px;
  display: flex; flex-direction: column;
  width: 100%; max-width: none; height: calc(100dvh - var(--workspace-top));
  min-height: 280px; margin: 0; padding: 0; overflow: hidden;
}
.problem-workspace [hidden] { display: none !important; }
.workspace-navigation {
  flex: 0 0 38px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 22px; border-bottom: 1px solid var(--line);
}
.workspace-navigation .back-link { margin: 0; font-size: 13px; }
.workspace-mobile-tabs { display: none; }
.problem-workspace .problem-layout {
  display: grid; grid-template-columns: minmax(0, var(--statement-width)) 6px minmax(0, 1fr);
  align-items: stretch; gap: 0; flex: 1; min-height: 0; overflow: hidden;
}
.problem-workspace .statement {
  min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain;
  padding: 24px; border: 0; border-radius: 0; box-shadow: none; scrollbar-gutter: stable;
}
.problem-workspace .problem-title-row { gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.problem-workspace .problem-title-row > div:first-child { flex: 1 1 230px; min-width: 0; }
.problem-workspace .statement h1 { font-size: 24px; line-height: 1.4; overflow-wrap: anywhere; }
.problem-workspace .statement h2 { margin: 28px 0 12px; font-size: 18px; }
.problem-workspace #detailMeta { font-size: 12px; font-weight: 400; color: var(--muted); }
.problem-workspace .problem-title-actions { gap: 8px; }
.problem-workspace .problem-title-actions a { padding: 6px 10px; font-size: 13px; }
.problem-workspace .difficulty { font-size: 12px; padding: 5px 8px; }
.problem-workspace .tag-row { margin-top: 12px; }
.problem-workspace .tag { font-size: 12px; }
.problem-workspace .markdown-body { font-size: 15px; line-height: 1.85; overflow-wrap: anywhere; }
.problem-workspace .markdown-body img { max-width: 100%; }
.problem-workspace .markdown-body table { display: block; max-width: 100%; overflow-x: auto; }
.problem-workspace .sample-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.problem-workspace .sample-grid pre { min-height: 70px; max-height: 250px; overflow: auto; background: #f4f8f6; color: var(--text); border: 1px solid #e9efec; }
.problem-workspace .submit-panel {
  position: static; display: flex; flex-direction: column; gap: 0;
  min-width: 0; min-height: 0; overflow: hidden; padding: 0;
  border: 0; border-radius: 0; box-shadow: none;
}
.editor-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex: 0 0 54px; padding: 8px 16px; border-bottom: 1px solid var(--line);
}
.editor-toolbar select { width: auto; min-width: 0; min-height: 32px; padding: 5px 26px 5px 10px; font-size: 13px; }
.editor-tools { display: flex; align-items: center; gap: 8px; }
.workspace-icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: 0 0 32px; padding: 0;
  border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer;
}
.workspace-icon-button:hover { background: var(--surface-soft); color: var(--primary-dark); }
.workspace-icon-button[aria-pressed="true"] { background: var(--surface-soft); color: var(--primary); }
.code-editor-host { flex: 1; min-height: 80px; overflow: hidden; position: relative; }
.code-editor-host #codeInput { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; resize: none; font-size: var(--editor-font-size); }
.code-editor-host .CodeMirror {
  width: 100%; height: 100%; font-family: Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
  font-size: var(--editor-font-size); line-height: 1.65; color: #1d2925;
}
.code-editor-host .CodeMirror-lines { padding: 12px 0 40px; }
.code-editor-host .CodeMirror pre.CodeMirror-line,
.code-editor-host .CodeMirror pre.CodeMirror-line-like { min-height: 0; border: 0; border-radius: 0; background: none; color: inherit; margin: 0; padding: 0 8px; font: inherit; }
.code-editor-host .CodeMirror-gutters { background: #fff; border: 0; padding-right: 8px; }
.code-editor-host .CodeMirror-linenumber { color: #94a59e; }
.code-editor-host .CodeMirror-activeline-background { background: #f1f9f5; }
.code-editor-host .CodeMirror-selected { background: #d9eae4; }
.code-editor-host .CodeMirror-focused .CodeMirror-selected { background: #cce8dd; }
.workspace-divider, .self-test-divider { background: #f2f5f3; touch-action: none; position: relative; z-index: 2; }
.workspace-divider { cursor: col-resize; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.workspace-divider::after { content: ""; position: absolute; top: calc(50% - 18px); left: 1px; height: 36px; width: 2px; background: #a9bdb4; border-radius: 2px; }
.workspace-divider:hover, .self-test-divider:hover { background: #cfe8df; }
.self-test-divider { flex: 0 0 6px; cursor: row-resize; border-top: 1px solid var(--line); }
.problem-workspace .self-test-panel {
  display: flex; flex-direction: column; flex: 0 0 var(--test-size); min-height: 150px;
  max-height: 60%; padding: 0; gap: 0; overflow: hidden;
  border: 0; border-radius: 0; background: #fff;
}
.problem-workspace .self-test-head { display: flex; align-items: center; gap: 6px; padding: 0 12px; min-height: 45px; flex: 0 0 45px; background: #f6f9f7; border-bottom: 1px solid var(--line); }
.self-test-tabs { display: flex; align-self: stretch; margin-right: auto; }
.self-test-tabs button, .workspace-mobile-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: 8px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.self-test-tabs button[aria-selected="true"], .workspace-mobile-tabs button[aria-selected="true"] { border-bottom-color: var(--primary); color: var(--primary-dark); }
.problem-workspace #runSelfTestButton { padding: 6px 12px; min-height: 30px; font-size: 13px; white-space: nowrap; }
.problem-workspace #testInputPane { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; padding: 10px 14px 14px; }
.sample-controls { display: flex; gap: 8px; align-items: center; }
.sample-controls select { width: auto; padding: 4px 8px; min-height: 28px; font-size: 12px; }
.sample-controls button { padding: 4px 8px; min-height: 28px; font-size: 12px; }
.problem-workspace #selfTestInput { flex: 1; width: 100%; min-height: 44px; resize: none; font-size: 14px; border-radius: 4px; }
.problem-workspace #selfTestOutput { display: block; flex: 1; min-height: 0; overflow: auto; padding: 12px 16px; border: 0; border-radius: 0; background: #fff; }
.problem-workspace #selfTestOutput:empty::before { content: "尚未运行"; font-size: 13px; color: var(--muted); }
.problem-workspace #selfTestOutput pre { min-height: 0; max-height: none; white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px; background: #f5f8f6; color: var(--text); }
.problem-workspace #selfTestOutput table { font-size: 13px; }
.problem-workspace .submit-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex: 0 0 56px; margin: 0; padding: 8px 18px; border-top: 1px solid var(--line); }
.problem-workspace .submit-actions button { width: auto; min-width: 78px; padding: 7px 18px; font-size: 14px; white-space: nowrap; }
#workspaceStatus { margin-right: auto; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.problem-workspace .team-submission-panel { box-shadow: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 16px 0 0; overflow-x: auto; }
.team-submission-panel > summary { cursor: pointer; color: var(--primary-dark); font-weight: 600; }
.problem-workspace.editor-expanded .problem-layout { grid-template-columns: minmax(0, 1fr); }
.problem-workspace.editor-expanded .statement, .problem-workspace.editor-expanded .workspace-divider { display: none; }
.problem-workspace :is(button, select, [role="separator"]):focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (max-width: 760px) {
  body.problem-route .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 8px 12px; }
  body.problem-route .brand { gap: 6px; }
  body.problem-route .brand strong { font-size: 13px; }
  body.problem-route .brand small { display: none; }
  body.problem-route .brand-mark { width: 28px; height: 28px; font-size: 11px; }
  body.problem-route .nav { grid-column: 1 / -1; grid-row: 2; }
  body.problem-route .nav a { padding: 6px 10px; font-size: 12px; }
  body.problem-route .auth-actions { grid-column: 2; grid-row: 1; gap: 4px; }
  body.problem-route .auth-actions button { font-size: 11px; min-height: 28px; padding: 3px 5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .problem-workspace { min-height: 240px; }
  .workspace-navigation { padding: 0 12px; }
  .workspace-navigation .back-link { max-width: 60%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .workspace-mobile-tabs { display: flex; align-self: stretch; }
  .problem-workspace .problem-layout { grid-template-columns: minmax(0, 1fr); }
  .problem-workspace .workspace-divider, .problem-workspace .submit-panel { display: none; }
  .problem-workspace .statement { display: block; padding: 18px; }
  .problem-workspace.editor-expanded:not(.code-active) .statement { display: block; }
  .problem-workspace .statement h1 { font-size: 22px; }
  .problem-workspace.code-active .statement { display: none; }
  .problem-workspace.code-active .submit-panel { display: flex; }
  .problem-workspace #expandEditorButton { display: none; }
  .editor-toolbar { padding: 6px 12px; flex-basis: 46px; }
  .problem-workspace .self-test-head { padding: 0 6px; }
  .self-test-tabs button { padding: 8px; }
  .problem-workspace .submit-actions { padding: 8px 12px; gap: 8px; }
  .problem-workspace .submit-actions button { padding: 7px 12px; min-width: 66px; }
  .problem-workspace .sample-grid { grid-template-columns: minmax(0, 1fr); }
}
