@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap");

/* Shared IDE workspace */

.custom-toolbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: var(--ide-toolbar-height);
  padding: 0.3rem 0.8rem;
  background: var(--background);
  font-family: "Nunito", Arial, sans-serif;
}

.custom-toolbar button,
.custom-toolbar input,
.custom-toolbar output {
  font-family: inherit;
}

.custom-toolbar-start {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 0.45rem;
}

.go-back-button,
.input-button,
.restart-button,
.settings-button,
.stopwatch-button,
.compile-button,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  cursor: pointer;
  background: var(--transparent);
}

.go-back-button {
  gap: 0.45rem;
  min-height: 34px;
  padding: 0 0.35rem;
  border: 0;
  font-size: var(--nav-text-size);
}

.input-button {
  margin-left: 0.25rem;
  min-height: 34px;
  padding: 0 0.65rem;
  border: 1.5px solid currentColor;
  border-radius: 6px;
  font-size: var(--nav-text-size);
}

.go-back-button svg {
  width: 1.1rem;
  height: 1.1rem;
}

.stopwatch-tools,
.custom-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.stopwatch-tools {
  grid-column: 2;
  justify-self: center;
}

.clock-mode-label {
  min-width: 5.5rem;
  color: var(--ink);
  cursor: text;
  font-size: var(--nav-text-size);
  font-weight: 700;
  text-align: right;
}

.custom-toolbar-actions {
  grid-column: 3;
  justify-self: end;
}

.settings-popover {
  position: relative;
  display: flex;
}

.settings-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
}

.restart-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
}

.stopwatch-display {
  width: 6.3rem;
  min-width: 6.3rem;
  min-height: 30px;
  padding: 0 0.25rem;
  border: 0;
  border-radius: 5px;
  outline: none;
  color: var(--ink);
  appearance: none;
  background: var(--transparent);
  caret-color: var(--accent-bright);
  cursor: text;
  font-size: var(--nav-text-size);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-align: center;
}

.stopwatch-display[readonly] {
  cursor: text;
}

.stopwatch-display:hover,
.stopwatch-display:focus {
  color: var(--accent-bright);
  background: var(--transparent);
}

.stopwatch-display.is-stopwatch:hover,
.stopwatch-display.is-stopwatch:focus {
  color: var(--ink);
}

.practice-time-controls {
  display: none;
  align-items: baseline;
  gap: 0.28rem;
  margin-left: 0.4rem;
  color: var(--ink);
  font-size: var(--nav-text-size);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.practice-solver .practice-time-controls:not([hidden]) {
  display: inline-flex;
}

.practice-time-controls strong {
  font-weight: 700;
}

.practice-overtime-limit {
  color: var(--error);
}

.practice-solver #problem-input-open {
  display: none;
}

.practice-solver.has-enforced-timer #time-toggle,
.practice-solver.has-enforced-timer #time-reset {
  visibility: hidden;
  pointer-events: none;
}

.practice-solver.has-enforced-timer .stopwatch-display,
.practice-solver.has-enforced-timer .stopwatch-display:hover,
.practice-solver.has-enforced-timer .stopwatch-display:focus {
  caret-color: var(--transparent);
  color: var(--ink);
  cursor: text;
  opacity: 1;
  background: var(--transparent);
  -webkit-text-fill-color: currentColor;
}

.practice-solver .clock-mode-label.is-overtime,
.practice-solver .stopwatch-display.is-overtime,
.practice-solver .stopwatch-display.is-overtime:hover,
.practice-solver .stopwatch-display.is-overtime:focus {
  color: var(--error);
  -webkit-text-fill-color: currentColor;
}

.stopwatch-button {
  width: 34px;
  height: 34px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.practice-solver .stopwatch-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: none;
}

.compile-button {
  width: 86px;
  min-height: 34px;
  padding: 0 0.9rem;
  border: 1.5px solid currentColor;
  border-radius: 6px;
  font-size: var(--nav-text-size);
}

.submit-button {
  width: 86px;
  min-height: 34px;
  padding: 0 0.9rem;
  border: 1.5px solid var(--surface-active);
  border-radius: 6px;
  color: var(--accent-bright);
  font-size: var(--nav-text-size);
  font-weight: 600;
  background: var(--surface-active);
}

.go-back-button svg,
.restart-button svg,
.settings-button svg,
.stopwatch-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.restart-button svg,
.settings-button svg,
.stopwatch-button svg {
  width: 1.05rem;
  height: 1.05rem;
}

.stopwatch-button .time-reset-icon {
  width: 1.22rem;
  height: 1.22rem;
}

.play-icon {
  fill: currentColor !important;
  stroke: currentColor;
}

.pause-icon,
.stopwatch-button.is-running .play-icon {
  display: none;
}

.stopwatch-button.is-running .pause-icon {
  display: block;
}

.go-back-button,
.input-button,
.restart-button,
.settings-button,
.stopwatch-button,
.compile-button,
.submit-button {
  transition:
    color 150ms ease,
    background-color 150ms ease,
    filter 150ms ease,
    transform 150ms ease;
}

.go-back-button:hover,
.go-back-button:focus-visible,
.restart-button:hover,
.restart-button:focus-visible,
.settings-button:hover,
.settings-button:focus-visible,
.stopwatch-button:hover,
.stopwatch-button:focus-visible,
.input-button:hover,
.input-button:focus-visible,
.compile-button:hover,
.compile-button:focus-visible {
  color: var(--accent-bright);
  outline: none;
  background: var(--surface-active);
  filter: brightness(1.3);
}

.submit-button:hover,
.submit-button:focus-visible {
  outline: none;
  color: var(--ink);
  background: var(--surface-hover);
  filter: brightness(1.3);
}

.go-back-button:active,
.input-button:active,
.restart-button:active,
.settings-button:active,
.stopwatch-button:active,
.compile-button:active,
.submit-button:active {
  transform: translateY(1px);
}

.settings-menu {
  --settings-label-inset: 0;
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  z-index: 20;
  width: 216px;
  max-height: calc(100vh - 62px);
  padding: 0.75rem;
  overflow-y: auto;
  border: 0;
  border-radius: 8px;
  background: var(--surface-deep);
  scrollbar-color: var(--scrollbar-thumb) var(--surface-deep);
  scrollbar-width: thin;
}

.settings-menu[hidden] {
  display: none;
}

.settings-section {
  display: block;
}

.settings-section h2 {
  margin: 0 0 0.7rem var(--settings-label-inset);
  color: var(--accent-bright);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.setting-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.52rem;
  width: 100%;
  min-height: 29px;
  padding-left: var(--settings-label-inset);
  color: var(--muted);
  cursor: default;
  font-size: 0.8rem;
}

.setting-row:hover {
  color: var(--ink);
}

.setting-row > span:first-child {
  flex: 1 1 auto;
  text-align: left;
}

.setting-toggle {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  cursor: pointer;
}

.setting-toggle:has(.setting-checkbox:disabled) {
  cursor: not-allowed;
}

.setting-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.setting-switch {
  position: relative;
  flex: 0 0 auto;
  width: 31px;
  height: 18px;
  border-radius: 10px;
  background: var(--surface-active);
  transition:
    background-color 150ms ease,
    filter 150ms ease;
}

.setting-switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  content: "";
  background: var(--muted);
  transition:
    background-color 150ms ease,
    transform 150ms ease;
}

.setting-checkbox:checked + .setting-switch {
  background: var(--accent);
}

.setting-checkbox:checked + .setting-switch::after {
  background: var(--text-on-accent);
  transform: translateX(13px);
}

.setting-checkbox:focus-visible + .setting-switch,
.setting-toggle:hover .setting-switch {
  filter: brightness(1.3);
}

.setting-checkbox:disabled + .setting-switch {
  cursor: not-allowed;
  filter: brightness(0.65);
}

.settings-divider {
  width: 100%;
  height: 1px;
  margin: 0.65rem 0;
  background: var(--surface-active);
}

.setting-row-stepper {
  cursor: default;
}

.setting-stepper {
  display: grid;
  grid-template-columns: 24px 32px 24px;
  min-height: 25px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--surface-active);
}

.setting-stepper button {
  display: grid;
  padding: 0;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  background: var(--transparent);
  place-items: center;
  transition:
    background-color 140ms ease,
    filter 140ms ease;
}

.setting-stepper button:hover,
.setting-stepper button:focus-visible {
  outline: none;
  background: var(--surface-hover);
  filter: brightness(1.35);
}

.setting-stepper button:disabled {
  color: var(--subtle);
  cursor: default;
  filter: none;
}

.setting-stepper svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.setting-stepper output {
  display: grid;
  color: var(--accent-bright);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  background: var(--surface-hover);
  place-items: center;
}

.custom-mode-main {
  min-height: calc(100vh - var(--ide-toolbar-height));
}

.ide-main {
  height: calc(100vh - var(--ide-toolbar-height));
  min-height: 360px;
  padding: 0;
  overflow: hidden;
  background: var(--background);
}

.ide-workspace {
  --divider-size: 7px;
  --left-pane-percent: 51%;
  --problem-pane-percent: 30%;
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-columns:
    minmax(0, var(--left-pane-percent))
    var(--divider-size)
    minmax(0, 1fr);
  grid-template-rows:
    minmax(0, var(--problem-pane-percent))
    var(--divider-size)
    minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface-deep);
  box-shadow: 0 10px 28px var(--shadow);
}

.ide-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.ide-workspace[data-problem-position="above-pdf"] .editor-pane {
  grid-column: 1;
  grid-row: 1 / 4;
}

.ide-workspace[data-problem-position="above-pdf"] .ide-resizer-vertical {
  grid-column: 2;
  grid-row: 1 / 4;
}

.ide-workspace[data-problem-position="above-pdf"] .problem-pane {
  grid-column: 3;
  grid-row: 1;
}

.ide-workspace[data-problem-position="above-pdf"] .ide-resizer-horizontal {
  grid-column: 3;
  grid-row: 2;
}

.ide-workspace[data-problem-position="above-pdf"] .pdf-pane {
  grid-column: 3;
  grid-row: 3;
}

.ide-workspace[data-problem-position="above-editor"] .problem-pane {
  grid-column: 1;
  grid-row: 1;
}

.ide-workspace[data-problem-position="above-editor"] .ide-resizer-horizontal {
  grid-column: 1;
  grid-row: 2;
}

.ide-workspace[data-problem-position="above-editor"] .editor-pane {
  grid-column: 1;
  grid-row: 3;
}

.ide-workspace[data-problem-position="above-editor"] .ide-resizer-vertical {
  grid-column: 2;
  grid-row: 1 / 4;
}

.ide-workspace[data-problem-position="above-editor"] .pdf-pane {
  grid-column: 3;
  grid-row: 1 / 4;
}

.ide-resizer {
  position: relative;
  z-index: 4;
  display: grid;
  padding: 0;
  border: 0;
  background: var(--surface-deep);
  touch-action: none;
  place-items: center;
}

.ide-resizer::before {
  position: absolute;
  content: "";
  background: var(--surface-active);
  transition: background-color 120ms ease;
}

.ide-resizer span {
  position: relative;
  z-index: 1;
  display: block;
  border-radius: 999px;
  background: var(--subtle);
  opacity: 0.75;
  transition:
    background-color 120ms ease,
    opacity 120ms ease;
}

.ide-resizer-vertical {
  cursor: col-resize;
}

.ide-resizer-vertical::before {
  top: 0;
  bottom: 0;
  left: 3px;
  width: 1px;
}

.ide-resizer-vertical span {
  width: 2px;
  height: 28px;
}

.ide-resizer-horizontal {
  cursor: row-resize;
}

.ide-resizer-horizontal::before {
  top: 3px;
  right: 0;
  left: 0;
  height: 1px;
}

.ide-resizer-horizontal span {
  width: 28px;
  height: 2px;
}

.ide-resizer:hover span,
.ide-resizer:focus-visible span,
.ide-resizer.is-dragging span {
  background: var(--accent-bright);
  opacity: 1;
}

.is-resizing-ide {
  cursor: col-resize;
  user-select: none;
}

.is-resizing-ide::after {
  position: fixed;
  z-index: 1000;
  inset: 0;
  content: "";
  cursor: inherit;
}

.is-resizing-ide[data-resize-axis="horizontal"] {
  cursor: row-resize;
}

.editor-pane {
  display: grid;
  grid-template-rows: 34px minmax(0, 1fr) 22px;
}

.editor-tabs {
  display: flex;
  align-items: end;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface-deep);
  scrollbar-width: thin;
}

.editor-tab {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.36rem;
  height: 34px;
  padding: 0 0.75rem;
  border: 0;
  color: var(--subtle);
  cursor: pointer;
  background: var(--surface-deep);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.76rem;
}

.editor-tab::after {
  position: absolute;
  right: 0.65rem;
  bottom: 0;
  left: 0.65rem;
  height: 2px;
  content: "";
  background: var(--transparent);
}

.editor-tab:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.editor-tab.is-active {
  color: var(--ink);
  background: var(--surface);
}

.editor-tab.is-active::after {
  background: var(--accent);
}

.editor-tab span[aria-hidden="true"] {
  color: var(--subtle);
  font-size: 0.5rem;
}

.latex-editor {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface-deep);
}

.editor-fallback {
  width: 100%;
  height: 100%;
  padding: 0.75rem;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: var(--surface-deep);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.55;
  tab-size: 4;
}

.editor-fallback[readonly] {
  color: var(--muted);
}

.editor-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 0.6rem;
  color: var(--subtle);
  background: var(--surface-deep);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.67rem;
}

#vim-status {
  margin-left: 0.35rem;
  color: var(--accent-bright);
}

.problem-tabs {
  display: flex;
  align-items: end;
  min-width: 0;
  min-height: 40px;
  padding-inline: 0.35rem;
  overflow-x: auto;
  background: var(--surface-deep);
  scrollbar-width: thin;
}

.problem-tab {
  position: relative;
  display: inline-flex;
  min-height: 40px;
  flex: 0 0 auto;
  padding: 0 0.8rem;
  border: 0;
  align-items: center;
  color: var(--subtle);
  cursor: pointer;
  background: var(--transparent);
  font-size: 0.78rem;
  font-weight: 600;
}

.problem-tab[hidden] {
  display: none;
}

.problem-tab::after {
  position: absolute;
  right: 0.7rem;
  bottom: 0;
  left: 0.7rem;
  height: 2px;
  content: "";
  background: var(--transparent);
}

.problem-tab:hover,
.problem-tab:focus-visible {
  color: var(--ink);
  outline: 0;
  background: var(--surface-hover);
}

.problem-tab.is-active {
  color: var(--ink);
  background: var(--surface);
}

.problem-tab.is-active::after {
  background: var(--accent);
}

.problem-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  font-family: "Nunito", Arial, sans-serif;
}

.problem-pane button {
  font-family: inherit;
}

.problem-tab-panel {
  min-height: 0;
}

.problem-tab-panel[hidden] {
  display: none;
}

.problem-content {
  --problem-separator-thickness: 1.5px;
  min-height: 0;
  padding: 0.8rem 1rem 1.2rem;
  overflow: auto;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.problem-name {
  margin: 0.48rem 0 0.9rem;
  color: var(--ink);
  font-size: 1.32rem;
  line-height: 1.1;
}

.problem-statement {
  width: 100%;
  max-width: none;
  margin: 0.65rem 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: normal;
}

.problem-statement-main,
.problem-latex-text {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}

.problem-rendered-subproblem,
.problem-rendered-subsubproblem {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.25rem;
  margin-top: 0.72rem;
}

.problem-rendered-subproblem {
  margin-left: 2ch;
}

.problem-rendered-subsubproblem {
  margin-left: 4ch;
}

.problem-rendered-label {
  color: var(--ink);
  font-weight: 700;
}

.problem-statement :is(.problem-statement-main, .problem-latex-text) strong {
  color: var(--ink);
}

.problem-statement mjx-container {
  color: var(--ink);
  pointer-events: none;
  user-select: none;
}

.problem-statement mjx-container * {
  pointer-events: none;
  user-select: none;
}

.problem-statement mjx-container[display="true"] {
  margin-block: 0.45em;
}

.problem-statement .transpose-horizontal-reflection {
  display: inline-block;
  transform: scaleX(-1);
  transform-origin: center;
}

.problem-meta {
  display: grid;
  gap: 0.42rem;
}

.problem-meta-primary,
.problem-topic-row,
.problem-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.problem-meta-primary {
  gap: 0.58rem;
}

.problem-topic-row {
  gap: 0.34rem;
}

.problem-topic-row[hidden] {
  display: none;
}

.problem-flags {
  gap: 0.28rem;
}

.problem-topic-row:empty,
.problem-flags:empty {
  display: none;
}

.problem-topic {
  position: relative;
  padding: 0.22rem 0.45rem;
  border: 1px solid color-mix(in srgb, var(--muted) 25%, transparent);
  border-radius: 4px;
  color: var(--muted);
  background: var(--transparent);
  font-size: 0.7rem;
}

.problem-topic.is-multicolor {
  border-color: color-mix(in srgb, var(--muted) 25%, transparent);
}


.problem-subject {
  padding: 0.17rem 0.4rem;
  border-radius: 999px;
  color: var(--text-on-accent);
  background: var(--muted);
  font-size: 0.82rem;
}

.problem-subject strong {
  font-weight: 700;
}

.problem-meta-arrow {
  display: inline-flex;
  width: 24px;
  height: 12px;
  flex: 0 0 24px;
  margin-inline: 0.2rem;
  align-self: center;
  color: var(--subtle);
}

.problem-meta-arrow svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.problem-meta-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.problem-difficulty {
  padding: 0.17rem 0.4rem;
  border-radius: 999px;
  color: var(--text-on-accent);
  background: var(--accent);
  font-size: 0.82rem;
}

.problem-difficulty-cluster {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.problem-flag {
  --problem-flag-outline-width: 1px;
  display: inline-grid;
  width: 17px;
  height: 17px;
  padding: 0;
  border: var(--problem-flag-outline-width) solid var(--subtle);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-family: inherit;
  font-size: 0.58rem;
  font-weight: 400;
  line-height: 1;
  place-items: center;
  cursor: pointer;
  transition:
    filter 120ms ease,
    transform 120ms ease;
}

.problem-difficulty-cluster .problem-flags {
  position: absolute;
  top: 0;
  left: calc(100% + 0.28rem);
  z-index: 1;
  flex-wrap: nowrap;
  gap: 0.16rem;
}

.problem-flag:hover,
.problem-flag:focus-visible {
  filter: brightness(1.25);
  transform: translateY(-1px);
}

.problem-flag:focus-visible {
  outline: 1px solid var(--accent-bright);
  outline-offset: 2px;
}

.problem-flag-letter {
  display: block;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  transform: translateY(0.03em);
}

.problem-flag-creative .problem-flag-letter {
  min-width: 0;
  font-family: inherit;
  font-size: 1.08em;
  line-height: 1;
  transform: translateY(-0.01em);
}

.problem-flag { cursor: help; }
.problem-flag-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  width: max-content;
  max-width: min(300px, calc(100vw - 16px));
  box-sizing: border-box;
  padding: .6rem .75rem;
  font-family: "Nunito", Arial, sans-serif;
  font-size: .75rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--subtle);
  border-radius: 5px;
  box-shadow: 0 4px 12px #00000040;
}
.problem-flag-tooltip[hidden] { display: none; }

.problem-flag-dialog {
  width: min(430px, calc(100vw - 2rem));
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 70px var(--shadow);
  font-family: "Nunito", Arial, sans-serif;
}

.problem-flag-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.problem-flag-dialog-card {
  display: grid;
}

.problem-flag-dialog-header {
  display: flex;
  min-height: 48px;
  padding: 0.6rem 0.65rem 0.6rem 1rem;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-deep);
}

.problem-flag-dialog-header h2 {
  margin: 0;
  font-size: 1.02rem;
}

.problem-flag-dialog-card > p {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.problem-flag-dialog-close {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  background: var(--transparent);
}

.problem-flag-dialog-close span::before,
.problem-flag-dialog-close span::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.problem-flag-dialog-close span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.problem-flag-dialog-close span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.problem-flag-dialog-close:hover,
.problem-flag-dialog-close:focus-visible {
  color: var(--accent-bright);
}

.problem-hidden-topic {
  opacity: 0.5;
}

.problem-statement-separator {
  width: 100%;
  height: var(--problem-separator-thickness);
  margin-top: 0.7rem;
  background: var(--subtle);
}

.problem-results {
  min-height: 0;
  padding: 0.85rem 1rem 1.1rem;
  overflow: auto;
  color: var(--muted);
  scrollbar-color: var(--scrollbar-thumb) var(--surface-deep);
  scrollbar-width: thin;
}

.problem-result-sections mjx-container {
  color: var(--ink);
  pointer-events: none;
  user-select: none;
}

.problem-result-sections mjx-container * {
  pointer-events: none;
  user-select: none;
}

.problem-result-sections .transpose-horizontal-reflection {
  display: inline-block;
  transform: scaleX(-1);
  transform-origin: center;
}

.problem-result-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.48rem 0;
  border-radius: 7px;
  background: var(--surface);
}

.problem-result-hero h2 {
  margin: 0;
  color: var(--success);
  font-size: 1.12rem;
  line-height: 1.1;
}

.problem-result-hero-failed h2 {
  color: var(--error);
}

.problem-result-score {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.problem-result-score-zero {
  color: var(--rating-zero);
}

.problem-result-score-plus-epsilon {
  color: var(--rating-plus-epsilon);
}

.problem-result-score-minus-epsilon {
  color: var(--rating-minus-epsilon);
}

.problem-result-score-full-solve {
  color: var(--rating-full-solve);
}

.problem-result-score strong {
  font-size: 1.12rem;
  line-height: 1.1;
  white-space: nowrap;
}

.problem-result-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin-top: 0.65rem;
}

.problem-result-section {
  min-width: 0;
  padding: 0.65rem 0;
}

.problem-result-section + .problem-result-section {
  border-top: 1.5px solid var(--subtle);
}

.problem-result-section h3 {
  margin: 0 0 0.38rem;
  color: var(--ink);
  font-size: 1rem;
}

.problem-result-section p,
.problem-result-section ul {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.problem-result-section ul {
  padding-inline-start: 1.05rem;
}

.problem-result-section p + ul {
  margin-top: 0.4rem;
}

.problem-result-section li + li {
  margin-top: 0.32rem;
}

.pdf-pane {
  display: grid;
  grid-template-rows: 34px minmax(0, 1fr) fit-content(30%);
}

.pdf-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  padding: 0 0.45rem;
  background: var(--surface-deep);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.68rem;
}

.pdf-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.24rem;
}

.pdf-toolbar button {
  display: inline-grid;
  min-width: 25px;
  height: 25px;
  padding: 0 0.3rem;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  background: var(--transparent);
  place-items: center;
}

.pdf-toolbar button:hover,
.pdf-toolbar button:focus-visible {
  color: var(--accent-bright);
  background: var(--surface-hover);
}

.pdf-toolbar button:disabled {
  opacity: 0.38;
  cursor: default;
}

.pdf-zoom-input {
  width: 4.65ch;
  min-width: 0;
  height: 25px;
  padding: 0 0.2rem;
  border: 0;
  border-radius: 4px;
  outline: 0;
  color: var(--ink);
  appearance: none;
  background: var(--transparent);
  caret-color: var(--accent-bright);
  font-family: inherit;
  font-size: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pdf-zoom-controls {
  gap: 0.04rem;
}

.pdf-zoom-controls button {
  min-width: 21px;
  width: 21px;
  padding-inline: 0;
}

.pdf-zoom-input:hover,
.pdf-zoom-input:focus {
  color: var(--accent-bright);
  background: var(--transparent);
}

.pdf-zoom-input::selection {
  color: var(--ink);
  background: var(--selection);
}

.pdf-toolbar-status {
  min-width: 0;
  padding: 0 0.45rem;
  overflow: hidden;
  color: var(--subtle);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-toolbar-status[data-status="working"] {
  color: var(--accent-bright);
}

.pdf-toolbar-status[data-status="success"] {
  color: var(--success);
}

.pdf-toolbar-status[data-status="error"] {
  color: var(--error);
}

.pdf-viewport {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: auto;
  background: var(--surface-active);
  align-items: start;
  justify-items: center;
  overscroll-behavior: contain;
}

.pdf-viewport[data-pdf-clipped] {
  justify-items: start;
}

.pdf-empty-state {
  align-self: center;
  justify-self: center;
  display: grid;
  max-width: 300px;
  gap: 0.35rem;
  color: var(--subtle);
  text-align: center;
}

.pdf-empty-state[hidden] {
  display: none;
}

.pdf-empty-state strong {
  color: var(--muted);
  font-size: 1rem;
}

.pdf-empty-state span {
  font-size: 0.8rem;
}

#pdf-canvas {
  display: block;
  max-width: none;
  background: var(--pdf-paper);
  box-shadow: 0 8px 24px var(--shadow);
}

#pdf-canvas[hidden],
#pdf-fallback[hidden] {
  display: none;
}

#pdf-fallback {
  display: block;
  max-width: none;
  height: 100%;
  border: 0;
  background: var(--pdf-paper);
}

.compile-diagnostics {
  min-height: 0;
  padding: 0.55rem 0.75rem;
  overflow: auto;
  color: var(--warning);
  background: var(--surface-deep);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.7rem;
  line-height: 1.4;
}

.compile-diagnostics strong {
  color: var(--error);
}

.compile-diagnostics ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.layout-reset-button {
  min-height: 25px;
  padding: 0 0.55rem;
  border: 0;
  border-radius: 4px;
  color: var(--accent-bright);
  cursor: pointer;
  background: var(--surface-hover);
  font-size: 0.74rem;
}

.layout-reset-button:hover,
.layout-reset-button:focus-visible {
  color: var(--ink);
  background: var(--surface-active);
}

body.has-problem-input-open {
  overflow: hidden;
}

.problem-input-dialog {
  width: min(880px, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 70px var(--shadow);
  font-family: "Nunito", Arial, sans-serif;
}

.problem-input-dialog button,
.problem-input-dialog input,
.problem-input-dialog textarea {
  font-family: inherit;
}

.problem-input-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.problem-input-form {
  display: grid;
  max-height: calc(100vh - 2rem);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.problem-input-header,
.problem-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-deep);
}

.problem-input-header {
  min-height: 52px;
  padding: 0.65rem 0.75rem 0.65rem 1rem;
}

.problem-input-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
}

.problem-input-close {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  background: var(--transparent);
  place-items: center;
}

.problem-input-close svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.problem-input-close:hover,
.problem-input-close:focus-visible {
  color: var(--accent-bright);
  background: var(--surface-active);
}

.problem-input-body {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  overflow: auto;
  scrollbar-color: var(--scrollbar-thumb) var(--surface-deep);
  scrollbar-width: thin;
}

.problem-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.problem-topic-grid {
  align-items: stretch;
}

.problem-field {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
}

.problem-field-label {
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.problem-field > input,
.problem-field > textarea,
.problem-choice-editor,
.problem-difficulty-stepper {
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-deep);
}

.problem-field > input,
.problem-field > textarea {
  width: 100%;
  padding: 0.62rem 0.7rem;
  outline: 0;
  caret-color: var(--accent-bright);
}

.problem-field > input {
  min-height: 38px;
}

.problem-field > textarea {
  min-height: 72px;
  overflow: auto;
  line-height: 1.45;
  resize: vertical;
  scrollbar-color: var(--scrollbar-thumb) var(--surface-deep);
  scrollbar-width: thin;
}

#problem-statement-input {
  height: 140px;
  min-height: 110px;
  max-height: 42vh;
}

.problem-hierarchy {
  --problem-subproblem-indent: 1.75rem;
  --problem-subsubproblem-indent: 1.75rem;
  display: grid;
  gap: 0.75rem;
}

.problem-hierarchy-add {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 30px;
  padding: 0;
  border: 0;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  cursor: pointer;
  background: var(--transparent);
  font-size: 0.84rem;
  text-align: left;
}

.problem-hierarchy-add > span {
  display: inline-grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border-radius: 5px;
  color: var(--text-on-accent);
  background: var(--accent);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  place-items: center;
}

.problem-hierarchy-add-subsubproblem > span {
  background: var(--accent-soft);
}

.problem-hierarchy-add-subproblem {
  margin-inline-start: var(--problem-subproblem-indent);
}

.problem-hierarchy-add:hover > span,
.problem-hierarchy-add:focus-visible > span {
  filter: brightness(1.2);
}

.problem-hierarchy-add:disabled {
  opacity: 0.38;
  cursor: default;
}

.problem-hierarchy-add:disabled > span {
  filter: none;
}

#subproblem-list,
.problem-subsubproblem-list {
  display: grid;
  gap: 0.85rem;
}

#subproblem-list:empty {
  display: none;
}

.problem-subproblem {
  display: grid;
  gap: 0.65rem;
  margin-inline-start: var(--problem-subproblem-indent);
}

.problem-subsubproblem-list {
  margin-inline-start: var(--problem-subsubproblem-indent);
}

.problem-subsubproblem {
  display: grid;
  gap: 0.35rem;
}

.problem-hierarchy-field {
  position: relative;
  display: grid;
  gap: 0.35rem;
}

.problem-hierarchy-field-header {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
}

.problem-hierarchy-field-title {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.problem-hierarchy-remove {
  display: inline-grid;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--subtle);
  cursor: pointer;
  background: var(--transparent);
  font-size: 1rem;
  line-height: 1;
  place-items: center;
}

.problem-hierarchy-remove:hover,
.problem-hierarchy-remove:focus-visible {
  color: var(--accent-bright);
  background: var(--surface-active);
}

.problem-hierarchy-field textarea {
  width: 100%;
  min-height: 88px;
  padding: 0.62rem 0.7rem;
  border: 0;
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: var(--surface-deep);
  caret-color: var(--accent-bright);
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
  scrollbar-color: var(--scrollbar-thumb) var(--surface-deep);
  scrollbar-width: thin;
}

.problem-hierarchy-field textarea:hover,
.problem-hierarchy-field textarea:focus {
  background: var(--surface-active);
}

.problem-field > input:hover,
.problem-field > input:focus,
.problem-field > textarea:hover,
.problem-field > textarea:focus,
.problem-choice-editor:focus-within,
.problem-difficulty-stepper:focus-within {
  background: var(--surface-active);
}

.problem-choice-editor {
  position: relative;
  display: flex;
  min-height: 38px;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.4rem;
}

.problem-choice-editor > input {
  min-width: 8rem;
  min-height: 28px;
  flex: 1 1 9rem;
  padding: 0 0.25rem;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: var(--transparent);
  caret-color: var(--accent-bright);
}

.problem-choice-editor > input[hidden] {
  display: none;
}

.problem-choice-editor[data-choice-editor="subject"].has-selection {
  min-height: 30px;
  padding: 0;
  background: var(--transparent);
}

.problem-choice-editor[data-choice-editor="topics"],
.problem-choice-editor[data-choice-editor="hiddenTopics"] {
  flex-direction: column;
  align-items: stretch;
}

.problem-choice-editor[data-choice-editor="topics"] > input,
.problem-choice-editor[data-choice-editor="hiddenTopics"] > input {
  width: 100%;
  flex: 0 0 28px;
}

.problem-choice-editor[data-choice-editor="topics"] .problem-choice-chips,
.problem-choice-editor[data-choice-editor="hiddenTopics"] .problem-choice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.problem-choice-editor[data-choice-editor="topics"] .problem-choice-chips:empty,
.problem-choice-editor[data-choice-editor="hiddenTopics"] .problem-choice-chips:empty {
  display: none;
}

.problem-choice-editor[data-choice-editor="topics"] .problem-choice-results,
.problem-choice-editor[data-choice-editor="hiddenTopics"] .problem-choice-results {
  top: auto;
  bottom: calc(100% + 0.35rem);
}

.problem-choice-editor input::placeholder,
.problem-field input::placeholder,
.problem-field textarea::placeholder {
  color: var(--subtle);
  opacity: 0.58;
}

.problem-choice-chips {
  display: contents;
}

.problem-choice-chip {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.35rem 0.28rem 0.52rem;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-hover);
  font-size: 0.76rem;
}

.problem-choice-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.problem-choice-chip button {
  display: inline-grid;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  background: var(--transparent);
  font-size: 0.9rem;
  line-height: 1;
  place-items: center;
}

.problem-choice-chip button:hover,
.problem-choice-chip button:focus-visible {
  color: var(--accent-bright);
  background: var(--surface-active);
}

.problem-choice-results {
  position: absolute;
  top: auto;
  right: 0;
  bottom: calc(100% + 0.35rem);
  left: 0;
  z-index: 30;
  max-height: 180px;
  padding: 0.3rem;
  overflow-y: auto;
  border-radius: 6px;
  background: var(--surface-deep);
  box-shadow: 0 12px 30px var(--shadow);
  scrollbar-color: var(--scrollbar-thumb) var(--surface-deep);
  scrollbar-width: thin;
}

.problem-choice-results[hidden] {
  display: none;
}

.problem-choice-option,
.problem-choice-empty {
  width: 100%;
  min-height: 32px;
  padding: 0.42rem 0.55rem;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: var(--transparent);
  font-size: 0.8rem;
  text-align: left;
}

.problem-choice-option {
  cursor: pointer;
}

.problem-choice-option:hover,
.problem-choice-option:focus-visible {
  color: var(--ink);
  background: var(--surface-active);
}

.problem-choice-empty {
  display: flex;
  align-items: center;
  color: var(--subtle);
}

.problem-difficulty-stepper {
  display: grid;
  min-height: 38px;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
}

.problem-difficulty-stepper button {
  display: grid;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  background: var(--transparent);
  font-size: 1.1rem;
  place-items: center;
}

.problem-difficulty-stepper button:hover,
.problem-difficulty-stepper button:focus-visible {
  color: var(--accent-bright);
  background: var(--surface-hover);
}

.problem-difficulty-stepper button:disabled {
  opacity: 0.3;
  cursor: default;
}

.problem-difficulty-stepper button svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.problem-difficulty-stepper input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 0.35rem;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: var(--transparent);
  caret-color: var(--accent-bright);
  text-align: center;
}

.problem-difficulty-stepper input::placeholder {
  color: var(--subtle);
  opacity: 0.58;
}

.problem-input-footer {
  min-height: 56px;
  gap: 1rem;
  padding: 0.65rem 1rem;
}

.problem-input-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.problem-input-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
}

.problem-input-checkbox input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.problem-input-checkbox > span {
  position: relative;
  display: inline-grid;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--surface-active);
  place-items: center;
}

.problem-input-checkbox input:checked + span {
  background: var(--accent);
}

.problem-input-checkbox input:checked + span::after {
  width: 8px;
  height: 4px;
  border-bottom: 2px solid var(--text-on-accent);
  border-left: 2px solid var(--text-on-accent);
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

.problem-input-checkbox input:focus-visible + span {
  background: var(--surface-hover);
  filter: brightness(1.25);
}

.problem-input-checkbox input:checked:focus-visible + span {
  background: var(--accent);
}

.problem-input-add {
  min-width: 82px;
  min-height: 36px;
  padding: 0 1rem;
  border: 0;
  border-radius: 6px;
  color: var(--text-on-accent);
  cursor: pointer;
  background: var(--accent);
  font-weight: 700;
}

.problem-input-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.problem-input-reset {
  min-width: 82px;
  min-height: 36px;
  padding: 0 1rem;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  background: var(--surface-active);
  font-weight: 700;
}

.problem-input-reset:not(:disabled):hover,
.problem-input-reset:not(:disabled):focus-visible {
  color: var(--accent-bright);
  background: var(--surface-hover);
  filter: brightness(1.2);
}

.problem-input-add:disabled,
.problem-input-reset:disabled {
  opacity: 0.55;
  cursor: wait;
  filter: none;
}

.problem-input-error {
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  color: var(--warning);
  background: var(--surface-deep);
  font-size: 0.82rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.problem-input-error[hidden] {
  display: none;
}

.problem-input-add:not(:disabled):hover,
.problem-input-add:not(:disabled):focus-visible {
  background: var(--accent);
  filter: brightness(1.28);
}

body.has-submission-dialog-open {
  overflow: hidden;
}

.submission-dialog {
  width: min(470px, calc(100vw - 2rem));
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 70px var(--shadow);
}

.submission-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.submission-dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(70vh, 560px);
}

.submission-dialog-header,
.submission-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-deep);
}

.submission-dialog-header {
  min-height: 48px;
  padding: 0.6rem 0.65rem 0.6rem 1rem;
}

.submission-dialog-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.02rem;
}

.submission-dialog-close {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  background: var(--transparent);
}

.submission-dialog-close span::before,
.submission-dialog-close span::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.submission-dialog-close span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.submission-dialog-close span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.submission-dialog-close:not(:disabled):hover,
.submission-dialog-close:not(:disabled):focus-visible {
  color: var(--accent-bright);
  background: var(--surface-active);
}

.submission-dialog-body {
  padding: 1rem;
  overflow: auto;
  color: var(--muted);
  scrollbar-color: var(--scrollbar-thumb) var(--surface-deep);
  scrollbar-width: thin;
}

.submission-dialog-body p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.submission-dialog-errors {
  max-height: 230px;
  margin: 0.8rem 0 0;
  padding: 0.75rem 0.8rem 0.75rem 1.8rem;
  overflow: auto;
  border-radius: 6px;
  color: var(--error);
  background: var(--surface-deep);
  font-size: 0.84rem;
  line-height: 1.4;
}

.submission-dialog-errors li + li {
  margin-top: 0.4rem;
}

.submission-dialog-footer {
  min-height: 56px;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
}

.submission-dialog-return,
.submission-dialog-confirm {
  min-height: 36px;
  padding: 0 1rem;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.submission-dialog-return {
  color: var(--muted);
  background: var(--surface-active);
}

.submission-dialog-confirm {
  margin-left: auto;
  color: var(--text-on-accent);
  background: var(--accent);
}

.submission-dialog-return:not(:disabled):hover,
.submission-dialog-return:not(:disabled):focus-visible {
  color: var(--accent-bright);
  background: var(--surface-hover);
  filter: brightness(1.2);
}

.submission-dialog-confirm:not(:disabled):hover,
.submission-dialog-confirm:not(:disabled):focus-visible {
  background: var(--accent);
  filter: brightness(1.28);
}

.submission-dialog button:disabled {
  opacity: 0.55;
  cursor: wait;
  filter: none;
}

.ide-workspace[data-vertical-collapse="before"] {
  grid-template-columns: 0 var(--divider-size) minmax(0, 1fr);
}

.ide-workspace[data-vertical-collapse="after"] {
  grid-template-columns: minmax(0, 1fr) var(--divider-size) 0;
}

.ide-workspace[data-horizontal-collapse="before"] {
  grid-template-rows: 0 var(--divider-size) minmax(0, 1fr);
}

.ide-workspace[data-horizontal-collapse="after"] {
  grid-template-rows: minmax(0, 1fr) var(--divider-size) 0;
}

.ide-workspace[data-horizontal-collapse="before"] .problem-pane,
.ide-workspace[data-problem-position="above-pdf"][data-horizontal-collapse="after"] .pdf-pane,
.ide-workspace[data-problem-position="above-editor"][data-horizontal-collapse="after"] .editor-pane,
.ide-workspace[data-problem-position="above-pdf"][data-vertical-collapse="before"] .editor-pane,
.ide-workspace[data-problem-position="above-pdf"][data-vertical-collapse="after"] .problem-pane,
.ide-workspace[data-problem-position="above-pdf"][data-vertical-collapse="after"] .pdf-pane,
.ide-workspace[data-problem-position="above-editor"][data-vertical-collapse="before"] .problem-pane,
.ide-workspace[data-problem-position="above-editor"][data-vertical-collapse="before"] .editor-pane,
.ide-workspace[data-problem-position="above-editor"][data-vertical-collapse="after"] .pdf-pane {
  visibility: hidden;
}

@media (max-width: 760px) {
  .custom-toolbar {
    grid-template-areas:
      "back actions"
      "timer timer";
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.35rem;
    min-height: var(--ide-toolbar-height-stacked);
    padding-block: 0.35rem 0.5rem;
  }

  .custom-toolbar-start {
    grid-area: back;
  }

  .stopwatch-tools {
    grid-area: timer;
    grid-column: auto;
  }

  .custom-toolbar-actions {
    grid-area: actions;
    grid-column: auto;
  }

  .settings-menu {
    position: fixed;
    top: 48px;
    right: 0.45rem;
    width: min(216px, calc(100vw - 0.9rem));
    max-height: calc(100vh - 60px);
  }

  .custom-mode-main {
    min-height: calc(100vh - var(--ide-toolbar-height-stacked));
  }

  .ide-main {
    height: calc(100vh - var(--ide-toolbar-height-stacked));
    min-height: 420px;
    padding: 0;
  }

}

@media (max-width: 700px) {
  .problem-input-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
  }

  .problem-input-form {
    max-height: calc(100vh - 1rem);
  }

  .problem-input-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .problem-hierarchy {
    --problem-subproblem-indent: 1rem;
    --problem-subsubproblem-indent: 1rem;
  }
}

@media (max-width: 640px) {
  .custom-toolbar {
    min-height: var(--ide-toolbar-height-compact);
    padding-inline: 0.45rem;
  }

  .stopwatch-tools,
  .custom-toolbar-actions {
    gap: 0.32rem;
  }

  .go-back-button,
  .input-button,
  .restart-button,
  .settings-button,
  .stopwatch-button {
    min-height: 30px;
  }

  .restart-button,
  .settings-button,
  .stopwatch-button {
    width: 30px;
    height: 30px;
  }

  .stopwatch-display {
    width: 5.25rem;
    min-width: 5.25rem;
  }

  .clock-mode-label {
    min-width: 4.75rem;
  }

  .compile-button,
  .submit-button {
    width: 68px;
    min-height: 30px;
    padding-inline: 0.55rem;
  }

  .custom-mode-main {
    min-height: calc(100vh - var(--ide-toolbar-height-compact));
  }

  .ide-main {
    height: calc(100vh - var(--ide-toolbar-height-compact));
  }
}

@media (max-width: 380px) {
  .go-back-button {
    width: 30px;
    padding: 0;
  }

  .go-back-button span {
    display: none;
  }

  .custom-toolbar-start {
    gap: 0.15rem;
  }

  .input-button {
    margin-left: 0.1rem;
    padding-inline: 0.25rem;
  }

  .compile-button,
  .submit-button {
    width: 62px;
    padding-inline: 0.35rem;
  }

}
