/* The problem page (question.html): a desk with the problem on the left and
   the work on the right. The two halves scroll on their own and the line
   between them can be dragged. Nothing decorative here: the squares under the
   verdict are the tests. */

.solve { min-height: 100vh; display: flex; flex-direction: column; }
@media (min-width: 901px) { .solve { height: 100vh; overflow: hidden; } }

.desk {
  --left: 46%;
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(320px, var(--left)) 9px minmax(380px, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.pane { min-width: 0; min-height: 0; }
.statement { display: flex; flex-direction: column; }
.st-body { flex: 1; min-height: 0; overflow: auto; padding: 1.8rem clamp(18px, 2.6vw, 40px) 4rem; }
.split { position: relative; cursor: col-resize; background: var(--bg); border-inline: 1px solid var(--border); touch-action: none; }
.split::after { content: ''; position: absolute; top: 50%; left: 50%; width: 3px; height: 36px; translate: -50% -50%; background: repeating-linear-gradient(var(--text3) 0 3px, transparent 3px 6px); opacity: 0.7; }
.split:hover, .split.drag, .split:focus-visible { background: var(--bg3); }

/* the problem's own bar, level with the editor's: the way back, the text size (zoom on
   .st-text, so the title, the examples and the pictures grow with it) and the
   problem alone on the screen */
.st-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; min-height: 51px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
/* the way back (the list, the contest or the tree) on the left of it */
.st-nav { display: flex; gap: 1rem; align-items: center; margin-right: auto; font-size: 0.9rem; white-space: nowrap; }
.st-nav a, .p-meta a { color: var(--text2); }
.st-nav a:hover, .p-meta a:hover { color: var(--text); }
.st-size { display: inline-flex; align-items: center; gap: 2px; }
.st-size-now { min-width: 3.3em; text-align: center; font-size: 0.84rem; color: var(--text2); }
.st-size .btn[aria-disabled="true"] { opacity: 0.5; cursor: default; }

/* ⛶ in that bar. Not the browser's Fullscreen API, like the compiler's focus
   mode: a locked-down exam holds the browser in full screen itself. */
.read-full .navbar, .read-full .split, .read-full .work,
.read-full #chat-widget { display: none !important; }
.read-full .desk { grid-template-columns: minmax(0, 1fr); }
.read-full .st-text { max-width: 60rem; margin-inline: auto; }

/* statement */
.p-head { display: flex; gap: 1rem; align-items: center; }
.p-head h1 { font-size: clamp(1.8rem, 2.4vw, 2.4rem); line-height: 1.05; letter-spacing: -0.04em; }
.p-meta { color: var(--text3); font-size: 0.92rem; margin-top: 0.3rem; }
.limits { display: flex; flex-wrap: wrap; gap: 0.5rem 1.8rem; margin: 1.3rem 0 0; padding: 0.85rem 0; border-block: 1px solid var(--border); }
.limits > div { display: flex; flex-direction: column; }
.limits dt { font-size: 0.8rem; color: var(--text3); }
.limits dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.limits .rating { margin-top: 2px; }
.langs { display: inline-flex; margin-top: 1.2rem; border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
.langs .stmt-lang-btn { border: 0; background: none; padding: 0.35rem 0.75rem; border-radius: 2px; font-size: 0.9rem; color: var(--text2); cursor: pointer; }
.langs .stmt-lang-btn:hover { color: var(--text); }
.langs .stmt-lang-btn.active { background: var(--text); color: var(--bg); font-weight: 600; }

/* A PDF statement, one canvas per page (js/pdf-statement.js) */
.q-desc:has(.pdfv), #stText:has(.pdfv) { max-width: none; }
.pdfv { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2); overflow: hidden; font-size: 0.85rem; }
.pdfv-bar { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); color: var(--text2); }
.pdfv-btn { min-width: 30px; height: 30px; padding: 0 0.55rem; background: none; border: 1px solid var(--border2); border-radius: var(--radius-sm); color: var(--text); font: inherit; cursor: pointer; }
.pdfv-btn:hover { background: var(--bg3); }
.pdfv-btn.on { background: var(--bg3); border-color: var(--text3); }
.pdfv-btn.pdfv-main { background: var(--accent); border-color: var(--accent); color: var(--bg2); font-weight: 600; }
.pdfv-btn.pdfv-main:hover { opacity: 0.88; }
.pdfv-pageno { width: 3em; height: 30px; text-align: center; background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius-sm); color: var(--text); font: inherit; }
.pdfv-zoom { min-width: 3.2em; text-align: center; font-variant-numeric: tabular-nums; }
.pdfv-gap { width: 0.6rem; }
.pdfv-space { flex: 1; }
.pdfv-pages { position: relative; overflow: auto; max-height: 82vh; padding: 0.75rem; background: var(--bg3); outline: none; }
.pdfv:fullscreen { display: flex; flex-direction: column; border: 0; border-radius: 0; }
.pdfv:fullscreen .pdfv-pages { flex: 1; max-height: none; }
.pdfv-page { position: relative; margin: 0 auto 0.75rem; background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.28); }
.pdfv-page:last-child { margin-bottom: 0; }
.pdfv-page canvas { display: block; width: 100%; height: 100%; }
.textLayer { position: absolute; inset: 0; overflow: hidden; opacity: 0.25; line-height: 1; text-align: initial; -webkit-text-size-adjust: none; transform-origin: 0 0; }
.textLayer span, .textLayer br { position: absolute; color: transparent; white-space: pre; cursor: text; transform-origin: 0 0; }
.textLayer ::selection { background: #2a6fdb; }
.stmt-pdf-note { color: var(--text3); }
#qDescription { margin-top: 1.4rem; max-width: 70ch; }
#qImage img { max-width: 100%; border-radius: var(--radius); margin-top: 1rem; }
.ex-title { font-size: 1rem; font-weight: 700; letter-spacing: 0; margin: 2.2rem 0 0.75rem; }
.example { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 0.75rem; background: var(--bg2); }
.example > div + div { border-left: 1px solid var(--border); }
.ex-head { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0.5rem 0.4rem 0.8rem; background: var(--bg3); font-size: 0.84rem; color: var(--text3); border-bottom: 1px solid var(--border); }
.example pre { margin: 0; padding: 0.75rem 0.85rem; font: 0.93rem/1.6 var(--mono); font-variant-ligatures: none; white-space: pre-wrap; word-break: break-all; }
.subs-wrap td { padding-top: 0.6rem; padding-bottom: 0.6rem; }

/* work */
.work { display: flex; flex-direction: column; background: var(--bg2); }
/* One screen high on a computer: if everything below the editor does not fit
   (a long verdict, a short window), the column scrolls rather than hiding
   Run and Submit below the screen (2026-11-05, the owner). */
@media (min-width: 901px) { .work { overflow-y: auto; overscroll-behavior: contain; } }
.ed-bar, .act-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
/* The editor's bar on one line (2026-11-05, the owner): a narrower language
   box, short labels; it wraps only on a phone. */
.ed-bar { border-bottom: 1px solid var(--border); flex-wrap: nowrap; }
@media (max-width: 600px) { .ed-bar { flex-wrap: wrap; } }
.ed-bar select { flex: 0 1 auto; width: auto; min-width: 6.5rem; max-width: 10rem; min-height: 34px; padding: 0 2rem 0 0.7rem; border: 1px solid var(--border2); border-radius: var(--radius-sm); background-color: var(--bg); font-size: 0.9rem; font-weight: 600; }
.saved { font-size: 0.84rem; color: var(--text3); transition: opacity 0.5s; white-space: nowrap; }
.ed-tools { display: flex; gap: 6px; margin-left: auto; flex: none; }
/* Time left in a timed contest, in the statement's bar (2026-11-01). */
.exam-clock { padding: 0.15rem 0.6rem; border: 1px solid var(--border2); border-radius: 99px;
              font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exam-clock.warn { color: var(--error); border-color: var(--error); }
.exam-clock.up { color: var(--error); border-color: var(--error); background: color-mix(in srgb, var(--error) 8%, transparent); }
/* The column is one screen high, so the editor is what gives way when the
   input, Run's output or a verdict opens under it: with a fixed 260px it held
   its height and pushed them, and Run and Submit, off the bottom. */
/* A grader problem's files: the learner's own, then the locked ones (js/question.js). */
.gr-tabs { flex: none; display: flex; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--border); }
.gr-tab { flex: none; display: flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.8rem; background: none; border: 0;
          border-right: 1px solid var(--border); font: 0.82rem var(--mono); color: var(--text2); cursor: pointer; white-space: nowrap; }
.gr-tab.on { background: var(--bg); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.gr-tab svg { color: var(--text3); }
.gr-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.work #editor-container { flex: 1 1 0; min-height: 120px; border: 0; }
.work #editor { height: 100%; min-height: 140px; }
#runSection { flex: 0 4 auto; min-height: 4.5rem; max-height: 40vh; overflow: auto; border-top: 1px solid var(--border); padding: 10px 12px 6px; }
.run-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.run-head label { font-size: 0.88rem; font-weight: 600; color: var(--text2); }
#customInput { min-height: 64px; font-family: var(--mono); font-size: 0.9rem; }
#runOutput { margin-top: 8px; }
#runOutput .example-box { max-height: 180px; overflow-y: auto; margin: 4px 0 0; }
#resultArea { flex: 0 1 auto; min-height: 0; padding: 0 12px; max-height: 40vh; overflow: auto; }
#resultArea .res-close { float: right; margin: -2px 0 0 0.5rem; }
#resultArea:not(:empty) { border-top: 1px solid var(--border); padding-top: 12px; padding-bottom: 8px; }
#resultArea .tests { margin: 0.7rem 0 0.4rem; }
#resultArea .result-line { color: var(--text2); font-size: 0.94rem; }
.act-bar { border-top: 1px solid var(--border); justify-content: flex-end; flex: none;
           position: sticky; bottom: 0; z-index: 3; background: var(--bg2); }
.act-bar #submitBtn { min-width: 120px; }
.act-bar .judge-mode { margin-right: auto; display: flex; gap: 6px; align-items: center; }

@media (max-width: 900px) {
  .desk { display: block; }
  .split { display: none; }
  .statement { display: block; }
  .st-body { overflow: visible; padding-bottom: 2rem; }
  .read-full .st-bar { position: sticky; top: 0; z-index: 5; background: var(--bg); }
  .work { border-top: 1px solid var(--border); }
  .work #editor-container { flex: none; height: 380px; }
  #runSection { max-height: none; }
  #resultArea { max-height: none; }
}
@media (max-width: 520px) {
  .example { grid-template-columns: 1fr; }
  .example > div + div { border-left: 0; border-top: 1px solid var(--border); }
}

/* toasts and the chat button keep clear of Run and Submit */
.solve .toast { bottom: 72px; }
.solve #chat-widget { left: 1rem; right: auto; bottom: 1rem; }
.solve #chat-panel { left: 0; right: auto; }

/* The bookmark star beside the title (2026-11-04): "Save" puts the problem on
   the learner's "Solve later" list. */
.bm-btn { margin-left: auto; align-self: flex-start; flex: none; padding: 0.35rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--text2); font: inherit; font-size: 0.9rem; cursor: pointer; white-space: nowrap; }
.bm-btn:hover { border-color: var(--text3); color: var(--text); }
.bm-btn[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.bm-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Save, Editorial and Share sit together at the right */
.bm-btn:not([hidden]) ~ .bm-btn { margin-left: 0.4rem; }
a.bm-btn { text-decoration: none; }
