@charset "utf-8";
/* ============================================================================
   problem-view.css — 题目详情页（工作台模式）
   结构：标题栏 / 左题面（独立滚动）/ 右编辑器 / 分工况页脚
   作用域：全部以 .pv- 前缀或 body.problem-view 起头，本文件只由
           views/problem/view.php 注册，classic.php（旧版界面）不会加载，
           因此 body.problem-view 这层"全屏模式"开关不会误伤旧版页。
   注意：.problem-view 这个类名在 classic.php 里被用作内容容器
         （<div class="col-md-9 problem-view">），所以本文件禁止出现裸
         .problem-view 选择器，模式开关一律写成 body.problem-view。
   ============================================================================ */

/* ------------------------------------------------ 全屏模式：接管布局外框 */
/* theme.css 给 .wrap 留了 footer 高度，题目页不需要页脚；
   height:100vh + 内部 overflow 消化滚动，不再像原版那样粗暴
   写 body{overflow:hidden}（那条规则会连带影响旧版界面之外的页面） */
body.problem-view {
    overflow: hidden;
}
body.problem-view .site-footer {
    display: none;
}
body.problem-view .wrap {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
    padding: 0;
}
body.problem-view .wrap > .container {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    /* site.css 给 .wrap > .container 设了 padding: 25px 15px 20px，
       不清零的话工作台上下各空一截，占不满视口 */
    padding-top: 0;
    padding-bottom: 0;
}

/* 工作台外框：上下 14px 呼吸，卡片化 */
.pv-page {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin: 14px 0;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
}

/* ------------------------------------------------------------ 顶部标题栏 */
.pv-head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
}
.pv-head-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* 题号：淡色 P + 等宽数字 */
.pv-no {
    display: inline-flex;
    align-items: baseline;
    flex: none;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: .2px;
}
.pv-no i {
    margin-right: 1px;
    color: var(--muted);
    font-size: 10px;
    font-style: normal;
    font-weight: 400;
}

.pv-title {
    overflow: hidden;
    max-width: 34em;
    margin: 0;
    color: var(--ink);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 元信息小标签：难度 / 分类 / 标签 */
.pv-chip {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 5px;
    height: 20px;
    padding: 0 7px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper);
    color: var(--ink-3);
    font-size: 11.5px;
    line-height: 1;
    white-space: nowrap;
}
.pv-chip.is-tag {
    background: var(--page);
    color: var(--ink-3);
}

/* 难度左侧 3px 色条，色阶与列表页 .diff-1 ~ .diff-8 同源 */
.pv-diff::before {
    content: "";
    width: 3px;
    height: 11px;
    border-radius: 1px;
    background: var(--diff-c, #B9C0BC);
}
.pv-diff[data-diff="0"] { --diff-c: #B9C0BC; }
.pv-diff[data-diff="1"] { --diff-c: #D01938; }
.pv-diff[data-diff="2"] { --diff-c: #D01938; }
.pv-diff[data-diff="3"] { --diff-c: #FFA500; }
.pv-diff[data-diff="4"] { --diff-c: #E8B107; }
.pv-diff[data-diff="5"] { --diff-c: #52C41A; }
.pv-diff[data-diff="6"] { --diff-c: #3FB3B5; }
.pv-diff[data-diff="7"] { --diff-c: #3498DB; }
.pv-diff[data-diff="8"] { --diff-c: #9D3DCF; }

/* 右侧操作 + 统计 */
.pv-head-act {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
}
.pv-act {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper);
    color: var(--ink-2);
    font-size: 12.5px;
    line-height: 1;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}
.pv-act:hover,
.pv-act:focus {
    border-color: var(--brand);
    color: var(--brand);
    text-decoration: none;
}
.pv-act.is-quiet {
    border-color: transparent;
    color: var(--muted);
    font-size: 12px;
}
.pv-act.is-quiet:hover {
    border-color: var(--line);
    color: var(--ink-2);
}
.pv-act .glyphicon {
    font-size: 11px;
    top: 0;
}

.pv-stat {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding-left: 10px;
    margin-left: 2px;
    border-left: 1px solid var(--line);
    white-space: nowrap;
}
.pv-stat b {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.pv-stat span {
    color: var(--muted);
    font-size: 11px;
}

/* -------------------------------------------------------- 左右分栏主体 */
.pv-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: row;
    overflow: hidden;
}

/* 分栏宽度由 Split.js 写入内联 width，所以这里不能用 flex-grow：
   留 flex:1 1 0 的话 flex-basis:0 + grow 会把内联 width 盖掉，
   两侧永远均分（原版 sizes 恰好是 [50,50] 才一直没暴露）。
   width:50% 只是 JS 未执行时的兜底。 */
.problem-left,
.problem-right {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    width: 50%;
    min-width: 0;
}
.problem-right {
    border-left: 1px solid var(--line);
}

/* 题面滚动区 */
.pv-desc {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 22px 26px;
}
.pv-desc::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.pv-desc::-webkit-scrollbar-track {
    background: transparent;
}
.pv-desc::-webkit-scrollbar-thumb {
    background: #DCE0DD;
    border-radius: 4px;
}
.pv-desc::-webkit-scrollbar-thumb:hover {
    background: #C6CBC8;
}

/* 时限 / 内存 */
.pv-limits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.pv-limit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--page);
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
}
.pv-limit b {
    color: var(--ink-2);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* 区块标题 */
.pv-sec {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 22px 0 9px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}
.pv-sec::before {
    content: "";
    width: 3px;
    height: 12px;
    border-radius: 1px;
    background: var(--brand);
}
.pv-limits + .pv-sec {
    margin-top: 0;
}

/* ------------------------------------------------------ 题面 Markdown 排版 */
.pv-md {
    color: var(--ink-2);
    font-size: 13.5px;
    line-height: 1.85;
    overflow-wrap: break-word;
    word-break: break-word;
}
.pv-md > *:first-child {
    margin-top: 0;
}
.pv-md > *:last-child {
    margin-bottom: 0;
}
.pv-md p {
    margin: 0 0 11px;
}
.pv-md h1,
.pv-md h2,
.pv-md h3,
.pv-md h4,
.pv-md h5,
.pv-md h6 {
    margin: 18px 0 8px;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.45;
}
.pv-md h1 { font-size: 17px; }
.pv-md h2 { font-size: 15.5px; }
.pv-md h3 { font-size: 14.5px; }
.pv-md h4,
.pv-md h5,
.pv-md h6 { font-size: 13.5px; }

.pv-md ul,
.pv-md ol {
    margin: 0 0 11px;
    padding-left: 22px;
}
.pv-md li {
    margin: 3px 0;
}
.pv-md li > p {
    margin: 0;
}

.pv-md code {
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
}
.pv-md pre {
    overflow-x: auto;
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--page);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
    line-height: 1.7;
}
.pv-md pre code {
    padding: 0;
    background: none;
    color: var(--ink);
    font-size: inherit;
}
.pv-md blockquote {
    margin: 0 0 12px;
    padding: 9px 14px;
    border-left: 3px solid var(--line);
    background: var(--page);
    color: var(--ink-3);
}
.pv-md blockquote > *:last-child {
    margin-bottom: 0;
}
.pv-md table {
    width: 100%;
    margin: 0 0 12px;
    border-collapse: collapse;
    font-size: 12.5px;
}
.pv-md th,
.pv-md td {
    padding: 7px 10px;
    border: 1px solid var(--line);
    text-align: left;
}
.pv-md th {
    background: var(--page);
    color: var(--ink);
    font-weight: 600;
}
.pv-md img {
    max-width: 100%;
    height: auto;
}
.pv-md hr {
    margin: 18px 0;
    border: 0;
    border-top: 1px solid var(--line);
}
.pv-md strong {
    color: var(--ink);
    font-weight: 600;
}

/* ------------------------------------------------------------ 样例对照卡 */
.pv-sample {
    overflow: hidden;
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
}
.pv-sample:last-child {
    margin-bottom: 0;
}
.pv-sample-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--page);
    color: var(--ink-3);
    font-size: 11.5px;
}
.pv-sample-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.pv-io {
    min-width: 0;
    border-right: 1px solid var(--line);
}
.pv-io:last-child {
    border-right: 0;
}
.pv-io-label {
    padding: 8px 12px 0;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .3px;
}
.pv-io pre {
    overflow-x: auto;
    margin: 0;
    padding: 5px 12px 12px;
    border: 0;
    background: none;
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
    line-height: 1.65;
}

.pv-copy {
    flex: none;
    height: 22px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper);
    color: var(--ink-3);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.pv-copy:hover,
.pv-copy:focus {
    border-color: var(--brand);
    color: var(--brand);
    outline: none;
}
.pv-copy.is-done {
    border-color: #D8E7D2;
    background: #F1F7EF;
    color: var(--ok);
}

/* ------------------------------------------------- 工作台页脚（左右共用） */
.pv-foot {
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid var(--line);
    background: var(--paper);
}
.pv-foot-left {
    justify-content: space-between;
}

.pv-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper);
    color: var(--ink-2);
    font-size: 12.5px;
    line-height: 1;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}
.pv-nav:hover,
.pv-nav:focus {
    border-color: var(--brand);
    color: var(--brand);
    text-decoration: none;
}
.pv-nav .glyphicon {
    font-size: 10px;
    top: 0;
}
/* 首/末题：渲染成 span，不用 a[disabled]（对 <a> 无效，仍会响应点击） */
.pv-nav.is-off {
    background: var(--page);
    border-color: var(--line-soft);
    color: #B9C0BC;
    cursor: not-allowed;
}
.pv-nav.is-off:hover {
    border-color: var(--line-soft);
    color: #B9C0BC;
}

/* --------------------------------------------------------- 右侧编辑器区 */
.problem-editor {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}
.pv-editor-head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--line);
}
.pv-lang {
    height: 28px;
    min-width: 104px;
    padding: 0 26px 0 9px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background-color: var(--paper);
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238A9490' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    color: var(--ink);
    font-size: 12.5px;
    line-height: 1;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.pv-lang:focus {
    border-color: var(--brand);
    outline: none;
}
.pv-editor-tip {
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
}

.code-input {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
/* CodeMirror 由 widget 内联高度撑开，这里强制跟随父容器。
   注意两份外部样式会影响它：
   1) widget 自己 registerCss 了 `.CodeMirror{border:1px solid black;font-size:15px}`，
      内联 <style> 排在 css 文件之后，同特异性会赢 —— 所以这里的规则必须挂在
      .code-input 下提高特异性，否则字号和黑边框会盖回来；
   2) codemirror.css 自带 `.CodeMirror{height:300px}` 且晚于本文件加载，
      同样靠 .code-input 前缀压过。 */
.code-input .CodeMirror {
    height: 100%;
    border: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.6;
}
/* 编辑器是 darcula 深色，但 codemirror.css 里滚动条轨道和两个"补角方块"
   默认是白色，会在右侧露出一条浅灰竖带。这里统一成深色系。 */
.code-input .CodeMirror-vscrollbar,
.code-input .CodeMirror-hscrollbar {
    scrollbar-width: thin;
    scrollbar-color: #4D4D4D #2B2B2B;
}
.code-input .CodeMirror-vscrollbar::-webkit-scrollbar,
.code-input .CodeMirror-hscrollbar::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.code-input .CodeMirror-vscrollbar::-webkit-scrollbar-track,
.code-input .CodeMirror-hscrollbar::-webkit-scrollbar-track {
    background: #2B2B2B;
}
.code-input .CodeMirror-vscrollbar::-webkit-scrollbar-thumb,
.code-input .CodeMirror-hscrollbar::-webkit-scrollbar-thumb {
    border-radius: 5px;
    background: #4D4D4D;
}
.code-input .CodeMirror-vscrollbar::-webkit-scrollbar-thumb:hover,
.code-input .CodeMirror-hscrollbar::-webkit-scrollbar-thumb:hover {
    background: #616161;
}
.code-input .CodeMirror-scrollbar-filler,
.code-input .CodeMirror-gutter-filler {
    background-color: #2B2B2B;
}

/* 提交栏 */
.pv-foot-right {
    justify-content: space-between;
}
.pv-last {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
}
.pv-last .pv-last-time {
    color: var(--muted);
}
.pv-last strong {
    font-weight: 600;
}
/* 原逻辑用 text-success / text-danger，这里统一到主题色 */
.pv-last .text-success,
.pv-last .text-success strong {
    color: var(--ok);
}
.pv-last .text-danger,
.pv-last .text-danger strong {
    color: var(--danger);
}
.pv-last img {
    height: 11px;
    margin-left: 3px;
    vertical-align: -1px;
}

.pv-submit-zone {
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
}
.pv-btn {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper);
    color: var(--ink-2);
    font-size: 12.5px;
    line-height: 1;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.pv-btn:hover,
.pv-btn:focus {
    border-color: var(--brand);
    color: var(--brand);
    outline: none;
    text-decoration: none;
}
.pv-submit {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 20px;
    border: 1px solid var(--brand);
    border-radius: 3px;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.pv-submit:hover,
.pv-submit:focus {
    border-color: var(--brand-dark);
    background: var(--brand-dark);
    color: #fff;
    outline: none;
}
.pv-blocked {
    color: var(--danger);
    font-size: 12px;
    line-height: 1.4;
}

/* 我的提交弹窗 */
#pv-submissions-modal .modal-header {
    border-bottom: 1px solid var(--line);
    padding: 13px 18px;
}
#pv-submissions-modal .modal-title {
    font-size: 14px;
    font-weight: 600;
}
/* bootstrap 3 默认 600px，比内容宽出一截，收窄到 520 */
@media (min-width: 768px) {
    #pv-submissions-modal .modal-dialog {
        width: 520px;
    }
}
#pv-submissions-modal .modal-body {
    padding: 0;
}
#pv-submissions-modal .modal-footer {
    border-top: 1px solid var(--line);
    padding: 10px 18px;
}
#pv-submissions-modal .table {
    margin: 0;
    font-size: 12.5px;
}
#pv-submissions-modal .table > tbody > tr > td {
    padding: 9px 14px;
    border-top: 1px solid var(--line-soft);
    color: var(--ink-2);
    vertical-align: middle;
}
#pv-submissions-modal .table > tbody > tr:first-child > td {
    border-top: 0;
}
#pv-submissions-modal .table > tbody > tr:hover > td {
    background: var(--page);
}
#pv-submissions-modal .table td:first-child {
    color: var(--muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------------------------------------------------------- 分栏拖拽手柄 */
.gutter {
    background-color: var(--line-soft);
    background-repeat: no-repeat;
    background-position: 50%;
    transition: background-color .15s ease;
}
.gutter.gutter-horizontal {
    cursor: col-resize;
}
.gutter.gutter-horizontal:hover,
.gutter.gutter-horizontal:active {
    background-color: var(--brand-soft);
}
/* splitter.min.js 会写入内联 flex-basis，这里只保证不被压成 0 */
.gutter.gutter-horizontal {
    min-width: 6px;
}

/* ------------------------------------------------------------- 窄屏适配 */
/* <992：放弃全屏工作台，改回整页滚动；题面在上、编辑器在下固定高 */
@media (max-width: 991px) {
    body.problem-view {
        overflow: auto;
    }
    body.problem-view .wrap {
        height: auto;
        min-height: 100vh;
    }
    body.problem-view .wrap > .container {
        flex: 0 0 auto;
    }
    .pv-page {
        margin: 12px 0;
    }
    .pv-body {
        flex-direction: column;
        overflow: visible;
    }
    /* Split 写入的内联宽高在纵向堆叠下必须强制失效 */
    .problem-left,
    .problem-right {
        width: 100% !important;
        flex: 0 0 auto !important;
    }
    .problem-right {
        height: 440px;
        border-left: 0;
        border-top: 1px solid var(--line);
    }
    .pv-desc {
        overflow: visible;
    }
    .pv-head {
        flex-wrap: wrap;
        gap: 10px;
    }
    .pv-head-act {
        flex-wrap: wrap;
    }
    .pv-title {
        max-width: 100%;
        font-size: 16px;
        white-space: normal;
    }
    /* 纵向堆叠时分割手柄无意义 */
    .gutter.gutter-horizontal {
        display: none;
    }
    .pv-editor-tip {
        display: none;
    }
}

/* <640：样例两栏改上下堆叠 */
@media (max-width: 640px) {
    .pv-desc {
        padding: 14px 14px 20px;
    }
    .pv-sample-body {
        grid-template-columns: 1fr;
    }
    .pv-io {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .pv-io:last-child {
        border-bottom: 0;
    }
    .pv-head {
        padding: 10px 12px;
    }
    .pv-head-act {
        width: 100%;
    }
    .pv-stat:first-of-type {
        padding-left: 0;
        margin-left: 0;
        border-left: 0;
    }
    /* 460 以下的窄屏放不下三个统计块，通过率最次要，先让位给排版
       （否则标题栏会被撑成三行，"64.6% 通过率"单独占一行很难看） */
    .pv-stat.is-rate {
        display: none;
    }
    .pv-md {
        font-size: 13px;
    }
    .pv-foot {
        padding: 8px 10px;
    }
    .pv-last {
        display: none;
    }
    .pv-submit-zone {
        width: 100%;
        justify-content: flex-end;
    }
}

/* <480：隐藏"旧版界面"，给标题让位 */
@media (max-width: 479px) {
    .pv-act.is-quiet {
        display: none;
    }
    .pv-chip.is-plain {
        display: none;
    }
}
