/* Формулы остаются текстом: таблица доступна только для чтения. */
.solution-sheet {
  margin: 8px 0 16px;
  max-width: 48rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: clip;
  background: var(--surface);
}
.solution-sheet > summary {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}
.solution-sheet-controls,
.solution-sheet-pages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 4px 8px;
  border-top: 1px solid var(--line);
}
.solution-sheet-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.solution-sheet-controls select {
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--field-line);
  border-radius: 5px;
  color: var(--text);
  font: inherit;
  padding: 4px 8px;
}
.solution-cell-bar {
  display: grid;
  grid-template-columns: 52px 24px minmax(0, 1fr);
  align-items: center;
  position: sticky;
  left: 0;
  width: 100%;
  min-height: 30px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  z-index: 1;
}
.solution-sheet .solution-cell-bar {
  width: 100%;
  border-inline: 0;
}
.solution-cell-address {
  padding: 3px 5px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  border-right: 1px solid var(--line);
}
.solution-cell-fx {
  font:
    italic 15px Georgia,
    serif;
  text-align: center;
  color: var(--text-2);
}
.solution-cell-formula {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font:
    13px/1.5 "JetBrains Mono",
    monospace;
  caret-color: var(--accent);
}
.solution-cell-formula:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -3px;
  border-radius: 4px;
}
.solution-sheet-status {
  display: block;
  position: sticky;
  left: 0;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
}
.solution-sheet > .solution-sheet-status {
  padding: 0 16px;
  margin: 8px 0 12px;
}
.solution-sheet-scroll {
  max-height: min(40vh, 20rem);
  overflow: auto;
  border-block: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--field-line) var(--surface);
}
.solution-sheet table.solution-sheet-grid {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
}
.solution-sheet-grid caption {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-2);
}
.solution-sheet-grid th {
  background: var(--frame-bg);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  text-align: center;
  position: sticky;
  z-index: 1;
}
.solution-sheet-grid thead th {
  top: 0;
}
.solution-sheet-grid tbody th {
  left: 0;
}
.solution-sheet table.solution-sheet-grid :is(td, th) {
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.solution-sheet table.solution-sheet-grid td {
  padding: 0;
  background: var(--surface);
}
.solution-sheet-cell {
  display: block;
  width: 100%;
  min-width: 72px;
  min-height: 24px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font:
    13px/1.5 Onest,
    sans-serif;
  text-align: right;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.solution-sheet-cell[aria-pressed="true"] {
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.solution-sheet-cell:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.solution-sheet-action {
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font:
    12px/1.5 Onest,
    sans-serif;
  cursor: pointer;
}
.solution-sheet-action:disabled {
  opacity: 0.4;
  cursor: default;
}
.solution-sheet-pages > span {
  font-size: 12px;
  color: var(--text-2);
  margin-inline: auto;
}
.solution-cell-stage {
  display: block;
  position: relative;
  width: 100%;
}
.solution-cell-widget {
  width: min(100%, 48rem, var(--sheet-preview-width, 48rem));
  min-width: 0;
  max-width: 100%;
  position: relative;
}
.solution-cell-widget > .solution-cell-bar {
  top: 68px;
  z-index: 3;
}
.solution-block :not(pre) > code {
  overflow-wrap: anywhere;
}
.solution-diagram .solution-cell-stage img[data-solution-diagram] {
  width: 100%;
  min-width: 0;
  display: block;
}
.solution-cell-hit {
  position: absolute;
  padding: 0;
  margin: 0;
  border: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  cursor: cell;
}
.solution-cell-hit:hover {
  border-color: var(--field-line);
}
.solution-cell-hit[aria-pressed="true"],
.solution-cell-hit:focus-visible {
  border-color: var(--accent);
  outline: 1px solid var(--surface);
  outline-offset: -3px;
}
.solution-cell-hit:focus-visible {
  border-color: var(--focus-ring);
}
@media (max-width: 650px) {
  .solution-sheet-pages > span {
    flex-basis: 100%;
    order: 1;
  }
  .solution-sheet-cell {
    min-height: 32px;
  }
  .solution-cell-formula {
    font-size: 16px;
  }
}
@media screen {
  .solution-cell-widget .solution-cell-stage {
    zoom: .86;
  }
  .solution-cell-widget .solution-diagram {
    margin-block: 0 1em;
    padding: 0;
  }
  .solution-image-preview {
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    cursor: zoom-in;
  }
  .solution-image-preview > img {
    width: auto;
    height: auto;
    max-width: min(100%, 38rem);
    max-height: 18rem;
    object-fit: contain;
    object-position: left center;
  }
  .solution-image-preview:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
  }
}
.solution-sheet-status:empty,
.solution-sheet [hidden] {
  display: none;
}
@media print {
  .solution-sheet,
  .solution-cell-bar,
  .solution-cell-hit,
  .solution-sheet-status {
    display: none !important;
  }
  .solution-cell-stage {
    min-width: 0 !important;
  }
}
