.q36,
.q36-m {
  --q36-gold-ink: #7a5717;
  --q36-danger: #9b353b;
  --q36-pass: #1e6848;
  --q36-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  color: var(--ink);
  font-family: var(--font-sans);
}

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

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

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

/* header */

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

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

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

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

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

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

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

/* body */

.q36-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 0 16px;
}

.q36-ledger {
  flex: 0 0 auto;
  min-width: 0;
}

.q36-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 8px;
}

.q36-sec-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--navy);
}

.q36-sec-head p {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  white-space: nowrap;
}

.q36-table {
  width: 100%;
  border-bottom: 1px solid var(--line);
}

.q36-tr {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 300px;
  column-gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.q36-thead {
  padding: 8px 0;
  align-items: end;
}

.q36[data-q36-cue="b1"] .q36-tr {
  grid-template-columns: 88px minmax(0, 1fr) 220px 270px 270px;
}

.q36-th {
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.q36-td {
  min-width: 0;
}

.q36-cand {
  display: flex;
  align-items: center;
}

.q36-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--navy);
  border-radius: 8px;
  background: var(--white);
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
  color: var(--navy);
}

.q36-method-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--navy);
}

.q36-code {
  display: block;
  margin-top: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  font-family: var(--q36-mono);
  font-size: 20px;
  line-height: 1.5;
  color: var(--muted);
  white-space: nowrap;
}

.q36-code-line {
  display: block;
}

.q36-five {
  min-width: 0;
}

.q36-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 20px;
  line-height: 1.5;
}

.q36-page {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  font-family: var(--q36-mono);
  font-size: 20px;
  line-height: 1.3;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.q36-page.is-dup {
  border-color: var(--q36-danger);
  color: var(--q36-danger);
  background: #fdfbfb;
}

.q36-ok {
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--q36-pass);
  white-space: nowrap;
}

.q36-scope {
  margin: 8px 0 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}

.q36-scope strong {
  color: var(--navy);
  font-weight: 600;
}

.q36-scope code {
  font-family: var(--q36-mono);
  font-size: 18px;
  color: var(--ink);
}

/* b1 probe columns */

.q36-td.q36-probe-col {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.q36-gap-tag {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--q36-danger);
}

.q36-gap-note {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
}

.q36-error {
  margin: 0;
  font-family: var(--q36-mono);
  font-size: 20px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--q36-danger);
}

.q36-error-sub {
  margin: 0;
  font-family: var(--q36-mono);
  font-size: 18px;
  line-height: 1.5;
  color: var(--q36-danger);
}

.q36-probe-note {
  margin: 8px 0 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}

/* b0 next-step prompt */

.q36-prompt {
  flex: 0 0 auto;
  border-top: 2px solid var(--gold);
  padding-top: 16px;
}

.q36-prompt-k {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--q36-gold-ink);
}

.q36-prompt h2 {
  margin: 0;
  max-width: 1200px;
  font-size: 30px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--navy);
}

.q36-choice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.q36-choice {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink);
}

.q36-choice-sep {
  font-size: 18px;
  line-height: 1.5;
  color: var(--muted);
}

/* footer */

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

.q36-foot-k {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--q36-gold-ink);
}

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

/* b2 answer and two unknowns */

.q36-answer {
  flex: 0 0 auto;
  min-width: 0;
}

.q36-answer-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
}

.q36-answer-k {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--q36-gold-ink);
}

.q36-answer-main h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--navy);
}

.q36-answer-text {
  margin: 8px 0 0;
  font-size: 22px;
  line-height: 1.65;
  color: var(--ink);
}

.q36-answer-note {
  margin: 8px 0 0;
  font-size: 20px;
  line-height: 1.6;
  color: var(--muted);
}

.q36-answer-side {
  border-top: 2px solid var(--gold);
  padding-top: 8px;
}

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

.q36-record-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.q36-record-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink);
}

.q36-mini-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--navy);
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  color: var(--navy);
}

.q36-mini-letter.is-bad {
  border-color: var(--q36-danger);
  color: var(--q36-danger);
}

.q36-answer-code {
  margin: 8px 0 0;
  font-family: var(--q36-mono);
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.q36-unknowns {
  margin-top: 8px;
}

.q36-unknown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 48px 200px;
  gap: 20px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

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

.q36-cell-v {
  margin: 0;
  font-size: 24px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--navy);
}

.q36-action-v {
  margin: 0;
  font-size: 26px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--q36-pass);
}

.q36-arrow-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.q36-flow {
  display: block;
  width: 48px;
  height: 24px;
}

.q36-flow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* mobile document flow */

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

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

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

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

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

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

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

.q36-m .q36-body {
  display: block;
  padding: 0;
}

.q36-m .q36-sec-head {
  display: block;
  margin-bottom: 12px;
}

.q36-m .q36-sec-head h2 {
  font-size: 20px;
  line-height: 1.5;
}

.q36-m .q36-sec-head p {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.6;
  white-space: normal;
}

.q36-m .q36-tr {
  display: block;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.q36-m .q36-thead {
  display: none;
}

.q36-m .q36-td {
  display: block;
}

.q36-m .q36-td + .q36-td {
  margin-top: 10px;
}

.q36-m .q36-td[data-label]::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.q36-m .q36-cand {
  margin-bottom: 8px;
}

.q36-m .q36-method-title {
  font-size: 18px;
  line-height: 1.5;
}

.q36-m .q36-code {
  font-size: 16px;
  line-height: 1.6;
}

.q36-m .q36-result {
  font-size: 17px;
  gap: 6px;
}

.q36-m .q36-page {
  min-height: 28px;
  padding: 2px 6px;
  font-size: 17px;
}

.q36-m .q36-ok {
  font-size: 15px;
}

.q36-m .q36-td.q36-probe-col {
  display: block;
}

.q36-m .q36-gap-tag {
  font-size: 15px;
}

.q36-m .q36-gap-note {
  font-size: 15px;
  line-height: 1.65;
}

.q36-m .q36-error {
  font-size: 17px;
}

.q36-m .q36-error-sub {
  font-size: 15px;
}

.q36-m .q36-scope {
  font-size: 15px;
  line-height: 1.65;
}

.q36-m .q36-scope code {
  font-size: 15px;
}

.q36-m .q36-probe-note {
  font-size: 15px;
  line-height: 1.65;
}

.q36-m .q36-prompt {
  margin-top: 18px;
  padding-top: 14px;
}

.q36-m .q36-prompt-k {
  font-size: 14px;
}

.q36-m .q36-prompt h2 {
  font-size: 22px;
  line-height: 1.5;
}

.q36-m .q36-choice-row {
  gap: 8px;
  margin-top: 12px;
}

.q36-m .q36-choice {
  min-height: 40px;
  padding: 4px 12px;
  font-size: 17px;
}

.q36-m .q36-choice-sep {
  font-size: 15px;
}

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

.q36-m .q36-foot-k {
  font-size: 14px;
}

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

.q36-m .q36-answer-band {
  display: block;
}

.q36-m .q36-answer-k {
  font-size: 14px;
}

.q36-m .q36-answer-main h2 {
  font-size: 24px;
  line-height: 1.45;
}

.q36-m .q36-answer-text {
  font-size: 17px;
  line-height: 1.7;
}

.q36-m .q36-answer-note {
  font-size: 16px;
  line-height: 1.65;
}

.q36-m .q36-answer-side {
  margin-top: 18px;
}

.q36-m .q36-answer-side-k {
  font-size: 14px;
}

.q36-m .q36-record-list li {
  font-size: 17px;
}

.q36-m .q36-mini-letter {
  width: 26px;
  height: 26px;
  font-size: 15px;
}

.q36-m .q36-answer-code {
  font-size: 14px;
}

.q36-m .q36-unknown-row {
  display: block;
  padding: 16px 0;
}

.q36-m .q36-unknown-cell {
  margin-bottom: 12px;
}

.q36-m .q36-cell-k {
  font-size: 14px;
}

.q36-m .q36-cell-v {
  font-size: 19px;
  line-height: 1.55;
}

.q36-m .q36-action-v {
  font-size: 21px;
}

.q36-m .q36-arrow-cell {
  height: 48px;
  margin-bottom: 12px;
  justify-content: flex-start;
}

.q36-m .q36-flow {
  transform: rotate(90deg);
}

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

/* instant and reduced motion */

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

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