.q37,
.q37-m {
  --q37-gold-ink: #7a5717;
  --q37-first: #fbf3e2;
  color: var(--ink);
  font-family: var(--font-sans);
}

.q37 {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 52px 64px 26px;
  background: var(--paper);
}

.q37 *,
.q37-m * {
  box-sizing: border-box;
}

.q37 [hidden],
.q37-m [hidden] {
  display: none !important;
}

/* header */

.q37-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.q37-heading {
  min-width: 0;
}

.q37-title {
  margin: 0;
  font-size: 40px;
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--navy);
}

.q37-sub {
  margin: 6px 0 0;
  font-size: 20px;
  line-height: 1.6;
  color: var(--muted);
}

.q37-head-meta {
  flex: 0 0 auto;
  padding-bottom: 2px;
  text-align: right;
}

.q37-state {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.q37-tag {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--q37-gold-ink);
  white-space: nowrap;
}

/* body and panels */

.q37-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 0 12px;
}

.q37-panel {
  height: 100%;
  min-height: 0;
}

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

/* b0 */

.q37-b0 {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
}

.q37-grid-wrap {
  min-width: 0;
}

.q37-grid-cap {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--muted);
}

.q37-grid-scroll {
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.q37-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: max-content;
}

.q37-chain {
  display: flex;
  align-items: center;
}

.q37-chain-label {
  flex: 0 0 72px;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.q37-chain-cells {
  display: flex;
  align-items: center;
}

.q37-cell {
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  font-size: 17px;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
}

.q37-cell.is-first {
  border-color: var(--gold);
  background: var(--q37-first);
  color: var(--q37-gold-ink);
  font-weight: 600;
}

.q37-arrow {
  flex: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  color: var(--gold);
}

.q37-arrow svg {
  display: block;
  width: 12px;
  height: 8px;
}

.q37-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.q37-b0-side {
  min-width: 0;
  border-top: 2px solid var(--gold);
  padding-top: 12px;
}

.q37-eq {
  margin: 0;
  font-size: 38px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.q37-eq strong {
  font-weight: 600;
  color: var(--q37-gold-ink);
}

.q37-eq-unit {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.5;
  color: var(--muted);
}

.q37-b0-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.q37-b0-list li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  font-size: 19px;
  line-height: 1.62;
  color: var(--ink);
}

.q37-b0-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 11px;
  border-radius: 50%;
  background: var(--gold);
}

.q37-scroll-hint {
  display: none;
}

/* b1 */

.q37-b1 {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.q37-compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}

.q37-side {
  min-width: 0;
}

.q37-side h2 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--navy);
}

.q37-scroll {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.q37-ind-wrap,
.q37-ser-wrap {
  width: max-content;
}

.q37-ind {
  display: grid;
  grid-template-columns: repeat(16, 28px);
  grid-auto-rows: 30px;
  gap: 6px;
  width: max-content;
}

.q37-mini-cell {
  width: 28px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
}

.q37-mini-cell.is-first {
  border-color: var(--gold);
  background: var(--q37-first);
}

.q37-serial {
  position: relative;
  width: 538px;
  height: 282px;
}

.q37-ser-grid {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.q37-ser-row {
  display: flex;
  align-items: center;
}

.q37-ser-gap {
  flex: 0 0 6px;
  width: 6px;
  height: 30px;
}

.q37-thread {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 538px;
  height: 282px;
  overflow: visible;
  pointer-events: none;
}

.q37-thread > path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.q37-thread marker path {
  fill: var(--gold);
  stroke: none;
}

.q37-side-count {
  margin: 10px 0 0;
  font-size: 20px;
  line-height: 1.5;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.q37-side-count strong {
  font-weight: 600;
  color: var(--navy);
}

.q37-side-note {
  margin: 6px 0 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}

.q37-ref {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.q37-ref-k {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.q37-ref-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: max-content;
  opacity: 0.55;
}

.q37-ref-row {
  display: flex;
  align-items: center;
}

.q37-ref-cell {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
}

.q37-ref-arrow {
  flex: 0 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5px;
  color: var(--gold);
}

.q37-ref-arrow svg {
  display: block;
  width: 5px;
  height: 4px;
}

.q37-ref-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.q37-ref-note {
  margin: 8px 0 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* b2 */

.q37-b2 {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.q37-answer {
  max-width: 1180px;
}

.q37-answer h2 {
  margin: 0;
  font-size: 40px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--navy);
}

.q37-answer-text {
  margin: 10px 0 0;
  font-size: 24px;
  line-height: 1.65;
  color: var(--ink);
}

.q37-boundaries {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
}

.q37-boundary {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.q37-boundary-k {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.q37-boundary-v {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.42;
  font-weight: 600;
  color: var(--navy);
}

.q37-boundary-note {
  margin: 6px 0 0;
  font-size: 19px;
  line-height: 1.62;
  color: var(--muted);
}

.q37-caveat {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}

/* footer */

.q37-foot {
  flex: 0 0 auto;
  min-height: 84px;
  display: flex;
  align-items: center;
  padding-top: 12px;
  border-top: 2px solid var(--gold);
}

.q37-foot-text {
  margin: 0;
  font-size: 28px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--navy);
}

.q37-question {
  margin: 0;
  font-size: 30px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--navy);
}

/* mobile document flow */

.q37.q37-m {
  position: static;
  inset: auto;
  display: block;
  height: auto;
  padding: 0;
  background: transparent;
}

.q37-m {
  min-width: 0;
}

.q37-m .q37-head {
  display: block;
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.q37-m .q37-title {
  font-size: 28px;
  line-height: 1.38;
}

.q37-m .q37-sub {
  font-size: 16px;
  line-height: 1.6;
}

.q37-m .q37-head-meta {
  margin-top: 10px;
  text-align: left;
}

.q37-m .q37-state {
  font-size: 15px;
  line-height: 1.6;
  white-space: normal;
}

.q37-m .q37-tag {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
}

.q37-m .q37-body {
  padding: 0;
}

.q37-m .q37-panel {
  height: auto;
}

.q37-m .q37-b0 {
  display: block;
  height: auto;
}

.q37-m .q37-grid-wrap {
  margin-bottom: 24px;
}

.q37-m .q37-grid-cap {
  font-size: 14px;
  line-height: 1.55;
}

.q37-m .q37-grid-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.q37-m .q37-grid {
  gap: 8px;
}

.q37-m .q37-chain-label {
  flex: 0 0 48px;
  font-size: 14px;
}

.q37-m .q37-cell {
  flex: 0 0 46px;
  width: 46px;
  height: 40px;
  font-size: 12px;
}

.q37-m .q37-arrow {
  flex: 0 0 10px;
  width: 10px;
}

.q37-m .q37-arrow svg {
  width: 10px;
  height: 7px;
}

.q37-m .q37-scroll-hint {
  display: block;
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.q37-m .q37-b0-side {
  padding-top: 12px;
}

.q37-m .q37-eq {
  font-size: 30px;
}

.q37-m .q37-eq-unit {
  font-size: 17px;
}

.q37-m .q37-b0-list {
  gap: 10px;
  margin-top: 14px;
}

.q37-m .q37-b0-list li {
  font-size: 16px;
  line-height: 1.7;
}

.q37-m .q37-b0-list li::before {
  margin-top: 9px;
}

.q37-m .q37-b1 {
  display: block;
  height: auto;
}

.q37-m .q37-compare {
  display: block;
}

.q37-m .q37-side {
  margin-bottom: 30px;
}

.q37-m .q37-side h2 {
  font-size: 20px;
  line-height: 1.5;
}

.q37-m .q37-ref-k {
  font-size: 14px;
}

.q37-m .q37-scroll {
  overflow-x: auto;
}

.q37-m .q37-side-count {
  font-size: 17px;
}

.q37-m .q37-side-note {
  font-size: 15px;
  line-height: 1.65;
}

.q37-m .q37-ref {
  margin-bottom: 30px;
}

.q37-m .q37-ref-grid {
  opacity: 0.6;
}

.q37-m .q37-ref-note {
  font-size: 15px;
}

.q37-m .q37-b2 {
  display: block;
  height: auto;
}

.q37-m .q37-answer h2 {
  font-size: 26px;
  line-height: 1.45;
}

.q37-m .q37-answer-text {
  font-size: 17px;
  line-height: 1.75;
}

.q37-m .q37-boundaries {
  display: block;
  margin-top: 24px;
}

.q37-m .q37-boundary {
  padding-top: 14px;
}

.q37-m .q37-boundary + .q37-boundary {
  margin-top: 22px;
}

.q37-m .q37-boundary-k {
  font-size: 15px;
}

.q37-m .q37-boundary-v {
  font-size: 21px;
  line-height: 1.5;
}

.q37-m .q37-boundary-note {
  font-size: 16px;
  line-height: 1.7;
}

.q37-m .q37-caveat {
  margin-top: 24px;
  font-size: 15px;
  line-height: 1.7;
}

.q37-m .q37-foot {
  display: block;
  min-height: 0;
  margin-top: 24px;
  padding-top: 14px;
}

.q37-m .q37-foot-text {
  font-size: 21px;
  line-height: 1.55;
}

.q37-m .q37-question {
  font-size: 23px;
  line-height: 1.55;
}

.q37-m-link {
  margin: 24px 0 0;
  font-size: 15px;
  line-height: 1.6;
}

/* instant and reduced motion */

.is-instant .q37 *,
.is-instant .q37-m * {
  transition: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .q37 *,
  .q37-m * {
    transition: none !important;
    animation: none !important;
  }
}
