:root {
  --solvida-problem-accent: var(--optfin-link, #174a8b);
  --solvida-problem-accent-strong: var(--optfin-navy, #0c315f);
  --solvida-problem-paper: var(--optfin-paper, #fffdf7);
  --solvida-problem-ink: var(--optfin-ink, #10233f);
  --solvida-problem-muted: var(--optfin-muted, #58677a);
  --solvida-problem-line: var(--optfin-line, #cad5e4);
  --solvida-problem-on-accent: #fff;
}

.problem-family-stack {
  display: grid;
  gap: .8rem;
}

.problem-family-group {
  padding: .5rem;
  border: 1px solid var(--solvida-problem-line);
  border-radius: 18px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--solvida-problem-paper) 88%, #fff 12%), color-mix(in srgb, var(--solvida-problem-paper) 76%, var(--solvida-problem-accent) 10%));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--solvida-problem-accent) 8%, transparent);
}

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

.problem-family-group > summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem .65rem;
  color: var(--solvida-problem-accent-strong);
  font-size: .76rem;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.problem-family-group > summary::-webkit-details-marker {
  display: none;
}

.problem-family-group > summary::before {
  content: "\203A";
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--solvida-problem-accent) 45%, var(--solvida-problem-line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--solvida-problem-paper) 82%, var(--solvida-problem-accent) 10%);
  color: var(--solvida-problem-accent);
  font: 800 1.65rem/1 Manrope, ui-sans-serif, sans-serif;
  transform: rotate(0deg);
  transition: transform .16s ease, background-color .16s ease, color .16s ease;
}

.problem-family-group[open] > summary::before {
  transform: rotate(90deg);
}

.problem-family-group > summary:hover::before,
.problem-family-group > summary:focus-visible::before {
  background: var(--solvida-problem-accent);
  color: var(--solvida-problem-on-accent);
}

.problem-family-group > summary:focus-visible {
  border-radius: 12px;
  outline: 3px solid color-mix(in srgb, var(--solvida-problem-accent) 28%, transparent);
  outline-offset: 2px;
}

.problem-family-group > summary span:first-child {
  margin-right: auto;
  font-size: .88rem;
}

.problem-family-group > summary span:last-child {
  color: var(--solvida-problem-muted);
  font-size: .66rem;
}

.problem-family-group > .problem-grid {
  padding: .35rem;
}

html[data-theme="dark"] .problem-family-group {
  background: linear-gradient(145deg, color-mix(in srgb, var(--solvida-problem-accent-strong) 62%, #07111c), color-mix(in srgb, var(--solvida-problem-accent-strong) 42%, #07111c));
  border-color: color-mix(in srgb, var(--solvida-problem-accent) 42%, #53657a);
}

html[data-theme="dark"] .problem-family-group > summary {
  color: #f4f7fb;
}

.problem-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  grid-auto-rows: 500px;
}

.problem-card {
  display: flex;
  flex-direction: column;
  height: 500px;
  min-height: 500px;
  padding: .88rem;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.problem-card:hover,
.problem-card:focus-visible {
  border-color: var(--solvida-problem-accent);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--solvida-problem-accent) 14%, transparent);
  outline: 0;
  transform: translateY(-2px);
}

.problem-card h3 {
  display: -webkit-box;
  min-height: 2.75em;
  max-height: 2.75em;
  margin: .56rem 0 .32rem;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.problem-card-objective {
  display: flex;
  align-items: center;
  min-height: 64px;
  max-height: 64px;
  overflow: hidden;
}

.problem-card-objective .formula-line {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
}

.problem-card-objective .formula-expression {
  display: block;
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.problem-card-objective .formula-expression::-webkit-scrollbar {
  display: none;
}

.problem-card-signature {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .34rem;
  min-height: 30px;
  margin-top: .32rem;
  padding: .28rem .45rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--solvida-problem-accent) 18%, var(--solvida-problem-line));
  border-radius: 8px;
  color: var(--solvida-problem-muted);
  white-space: nowrap;
}

.problem-card-signature-label {
  color: var(--solvida-problem-accent);
  font: 700 .64rem/1 "Inter", "Segoe UI", sans-serif;
  letter-spacing: .02em;
}

.problem-card-signature > [data-solvida-math-expression] {
  display: block;
  overflow-x: auto;
  scrollbar-width: none;
}

.problem-card-signature > [data-solvida-math-expression]::-webkit-scrollbar {
  display: none;
}

.problem-card-signature math {
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: .72rem;
  line-height: 1.2;
}

.problem-card-constraints {
  display: grid;
  grid-auto-rows: minmax(1.82rem, auto);
  align-content: start;
  gap: .24rem;
  min-height: 8.4rem;
  margin-top: .34rem;
}

.problem-card-constraint {
  display: grid;
  grid-template-columns: 1.55rem minmax(0, 1fr);
  align-items: center;
  min-height: 1.82rem;
  padding: .18rem .4rem;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--solvida-problem-accent) 18%, var(--solvida-problem-line));
  border-radius: 7px;
  color: var(--solvida-problem-muted);
  line-height: 1.45;
}

.problem-card-constraint-label {
  align-self: center;
  color: var(--solvida-problem-accent);
  font: 700 .64rem/1.45 "Inter", "Segoe UI", sans-serif;
}

.problem-card-constraint > [data-solvida-math-expression] {
  display: block;
  min-height: 1.3em;
  overflow-x: auto;
  overflow-y: visible;
  white-space: nowrap;
  scrollbar-width: none;
}

.problem-card-constraint > [data-solvida-math-expression]::-webkit-scrollbar {
  display: none;
}

.problem-card-constraint math {
  overflow: visible;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: .76rem;
  line-height: 1.45;
}

.problem-math-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  align-items: center;
  gap: .42rem;
  min-width: 0;
  min-height: 2rem;
  overflow: visible;
}

.problem-math-surface {
  border: 1px solid color-mix(in srgb, var(--solvida-problem-accent) 18%, var(--solvida-problem-line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--solvida-problem-paper) 56%, transparent);
}

.problem-math-label {
  color: var(--solvida-problem-accent);
  font: 700 .66rem/1.45 "Inter", "Segoe UI", sans-serif;
}

.problem-math-body {
  min-width: 0;
}

.problem-math-expression {
  display: block;
  min-width: 0;
  min-height: 1.45em;
  overflow-x: auto;
  overflow-y: visible;
  white-space: nowrap;
  color: inherit;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: .82rem;
  line-height: 1.45;
  scrollbar-width: none;
}

.problem-math-expression::-webkit-scrollbar {
  display: none;
}

.problem-math-expression math {
  overflow: visible;
  font-family: inherit;
  font-size: 1em;
  line-height: inherit;
}

.problem-card .problem-math-row {
  grid-template-columns: 1.55rem minmax(0, 1fr);
}

.problem-card-variables {
  margin-top: .3rem;
  padding: .18rem .4rem;
}

.formula-expression math,
.problem-inspector math {
  max-width: 100%;
  color: inherit;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1.05em;
  line-height: 1.25;
}

.problem-inspector math {
  font-size: .88rem;
  font-style: normal;
  font-variant-numeric: lining-nums tabular-nums;
}

.formula-expression math {
  font-size: var(--solvida-card-formula-size, 1.02rem);
}

.formula-expression math mtext,
.problem-inspector math mtext {
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
}

.problem-inspector-equation math {
  font-size: .96rem;
}

.problem-card .method-list {
  min-height: 4.4rem;
  max-height: none;
  margin-top: .55rem;
  align-content: start;
  overflow: visible;
}

.problem-card .method-tag {
  padding: .28rem .42rem;
  font-size: .66rem;
  line-height: 1.2;
}

.problem-card-meta {
  display: -webkit-box;
  min-height: 3.85em;
  max-height: 3.85em;
  margin-top: auto;
  padding-top: .4rem;
  overflow: hidden;
  color: var(--solvida-problem-muted);
  font-size: .76rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.luna-rail[data-mode="problem"] {
  width: min(560px, calc(100vw - 2rem)) !important;
}

.problem-inspector {
  display: flex;
  height: calc(100vh - 4rem);
  min-height: 0;
  flex-direction: column;
  padding-right: 2.25rem;
  overflow: hidden;
}

.problem-inspector h2 {
  margin: .14rem 0 .08rem;
  font: 400 1.7rem/1.04 "Instrument Serif", Georgia, serif;
}

.problem-inspector-family {
  margin: 0;
  color: var(--solvida-problem-muted);
  font-size: .78rem;
  font-weight: 800;
}

.problem-inspector-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: .55rem;
  padding-right: .18rem;
  overflow: auto;
  scrollbar-width: none;
}

.problem-inspector-scroll::-webkit-scrollbar {
  display: none;
}

.problem-inspector-block {
  margin: 0 0 .5rem;
  padding: .72rem .78rem;
  border: 1px solid var(--solvida-problem-line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--solvida-problem-paper) 88%, var(--solvida-problem-accent) 4%);
  font-size: .72rem;
  line-height: 1.45;
}

.problem-inspector-block h3 {
  margin: 0 0 .42rem;
  color: var(--solvida-problem-accent);
  font: 800 .62rem/1.2 Manrope, sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
}

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

.problem-encyclopedia-field {
  min-width: 0;
  padding: .58rem;
  border: 1px solid color-mix(in srgb, var(--solvida-problem-line) 82%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--solvida-problem-paper) 92%, var(--solvida-problem-accent) 3%);
}

.problem-encyclopedia-field-wide {
  grid-column: 1 / -1;
}

.problem-encyclopedia-field h4 {
  margin: 0 0 .28rem;
  color: var(--solvida-problem-accent);
  font: 800 .58rem/1.25 Manrope, sans-serif;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.problem-encyclopedia-field p,
.problem-encyclopedia-list,
.problem-encyclopedia-meta {
  margin: 0;
  color: var(--solvida-problem-ink);
  font-size: .7rem;
  line-height: 1.48;
}

.problem-encyclopedia-list {
  display: grid;
  gap: .22rem;
  padding-left: 1rem;
}

.problem-encyclopedia-meta {
  display: grid;
  grid-template-columns: minmax(6.8rem, .34fr) minmax(0, 1fr);
  gap: .32rem .55rem;
}

.problem-encyclopedia-meta dt {
  color: var(--solvida-problem-accent);
  font-weight: 800;
}

.problem-encyclopedia-meta dd {
  margin: 0;
}

.problem-reference-list a,
.problem-article-link {
  color: var(--solvida-problem-accent);
  font-weight: 750;
}

.problem-evidence-note {
  margin-top: .5rem !important;
  color: var(--solvida-problem-muted) !important;
}

.problem-article-link {
  display: inline-flex;
  margin-top: .55rem;
}

.problem-inspector-equation {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  font: 500 1.04rem/1.55 "Cambria Math", "STIX Two Math", "Times New Roman", serif;
}

.problem-inspector-equation::-webkit-scrollbar {
  display: none;
}

.problem-variable-domain,
.problem-constraint-index {
  background: transparent;
  color: var(--solvida-problem-accent);
}

.problem-variable-list {
  display: grid;
  gap: .4rem;
  margin: 0;
}

.problem-variable {
  grid-template-columns: minmax(4.5rem, .34fr) minmax(0, 1fr);
  gap: .45rem;
  padding: .5rem;
}

.problem-variable:first-child,
.problem-constraint:first-child {
  border-top-width: 1px;
}

.problem-variable dt {
  font: 600 .8rem/1.32 "Cambria Math", "STIX Two Math", "Times New Roman", serif;
}

.problem-variable dd {
  margin: 0;
}

.problem-variable-domain {
  display: block;
  margin-bottom: .2rem;
  padding: 0;
}

.problem-variable p,
.problem-constraint p {
  margin: .2rem 0 0;
  color: var(--solvida-problem-muted);
  font-size: .7rem;
  line-height: 1.42;
}

.problem-constraint-list {
  display: grid;
  gap: .48rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.problem-constraint {
  grid-template-columns: 2.1rem minmax(0, 1fr);
  gap: .45rem;
  padding: .5rem;
}

.problem-constraint-index {
  display: grid;
  place-items: center;
  width: 2.1rem;
  min-height: 1.75rem;
}

.problem-constraint-expression {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  color: inherit;
  scrollbar-width: none;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: .82rem;
  line-height: 1.35;
}

.problem-constraint-expression::-webkit-scrollbar {
  display: none;
}

.problem-inspector-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .4rem .7rem;
  margin: 0;
}

.problem-inspector-meta dt {
  color: var(--solvida-problem-accent);
  font-weight: 800;
}

.problem-inspector-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.problem-inspector-luna-message,
.problem-inspector-luna-response {
  margin: 0 0 .55rem;
  padding: .7rem .78rem;
  border: 1px solid color-mix(in srgb, var(--solvida-problem-accent) 44%, var(--solvida-problem-line));
  border-radius: 6px 16px 16px 16px;
  background: color-mix(in srgb, var(--solvida-problem-paper) 82%, var(--solvida-problem-accent) 8%);
}

.problem-inspector-luna-head {
  display: flex;
  gap: .7rem;
  align-items: center;
}

.problem-inspector-luna-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  color: var(--solvida-problem-accent);
}

.problem-inspector-luna-message h3,
.problem-inspector-luna-message p {
  margin: 0;
}

.problem-inspector-luna-message p {
  color: var(--solvida-problem-muted);
  font-size: .7rem;
  line-height: 1.42;
}

.problem-inspector-composer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: .35rem;
  margin-top: .45rem;
  padding: .35rem;
  border: 1px solid var(--solvida-problem-line);
  border-radius: 23px;
  background: var(--solvida-problem-paper);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--solvida-problem-accent) 13%, transparent);
}

.problem-inspector-composer label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.problem-inspector-composer .luna-field[type="text"] {
  min-height: 42px;
  padding: .55rem .7rem;
  border: 0;
  background: transparent;
  font-size: .78rem;
}

.problem-inspector-composer .luna-action {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  font-size: 0;
}

.problem-inspector-composer .luna-action::before {
  content: "\2191";
  font-size: 1.15rem;
}

.problem-inspector-luna-response {
  color: var(--solvida-problem-ink);
  font-size: .74rem;
  line-height: 1.45;
}

.problem-inspector-luna-response:empty {
  display: none;
}

html[data-theme="dark"] .problem-inspector-block {
  background: color-mix(in srgb, var(--solvida-problem-accent-strong) 48%, #07111c);
}

html[data-theme="dark"] .problem-encyclopedia-field {
  background: color-mix(in srgb, var(--solvida-problem-accent-strong) 38%, #07111c);
}

html[data-theme="dark"] .problem-inspector-luna-message,
html[data-theme="dark"] .problem-inspector-luna-response {
  background: color-mix(in srgb, var(--solvida-problem-accent-strong) 54%, #07111c);
}

.sidebar-panel[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .problem-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .problem-encyclopedia {
    grid-template-columns: 1fr;
  }

  .problem-encyclopedia-field-wide {
    grid-column: auto;
  }
  .problem-grid {
    grid-auto-rows: 540px;
  }

  .problem-card {
    height: 540px;
    min-height: 540px;
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .problem-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
