.board-dialog {
  --board-navy: #123756;
  --board-blue: #066c9e;
  --board-line: #c6dfef;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  inset: 0;
  margin: 0;
  border: 0;
  padding: 0;
  color: var(--board-navy);
  background: #eef6fc;
}

.board-dialog::backdrop { background: #142f49; }
.board-shell:fullscreen { background: #eef6fc; }
body:has(.board-dialog[open]) { overflow: hidden; }

.board-shell {
  position: relative;
  width: min(100%, 1640px);
  min-height: 100%;
  height: 100%;
  margin: auto;
  padding: clamp(12px, 2vw, 32px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(10px, 1.6vh, 20px);
}

.board-toolbar, .board-heading, .board-tools,
.board-nav-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.board-toolbar { gap: 8px 16px; }
.board-heading {
  flex-wrap: wrap;
  min-width: 0;
  margin: 0;
  gap: 3px 10px;
  font-size: clamp(15px, 1.25vw, 21px);
  line-height: 1.2;
  font-weight: 800;
}
#board-counter { white-space: nowrap; color: #255570; font-weight: 750; }
.board-tools { margin-inline-start: auto; flex-shrink: 0; gap: 8px; }
.board-dialog .button { min-height: 44px; font-size: clamp(14px, 1.25vw, 19px); padding: 8px 16px; }
.board-toolbar .button { min-height: 44px; font-size: clamp(13px, 1vw, 16px); padding: 6px 12px; box-shadow: none; }
.board-dialog .button-blue { background: var(--board-blue); border-color: var(--board-blue); color: #fff; }
.board-dialog .button-light { background: #fff; color: #12577b; border-color: var(--board-line); }
.board-dialog .button-ghost { color: #254c68; }

.board-setup { display: grid; place-items: center; overflow: auto; padding: 16px 0; }
.board-setup-panel {
  width: min(100%, 790px);
  padding: clamp(20px, 4vw, 46px);
  border: 1px solid var(--board-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 14px 42px #194e7314;
}
.board-setup h3 { font-size: clamp(24px, 3vw, 40px); letter-spacing: -.04em; line-height: 1.1; margin: 0 0 26px; }
.board-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.board-fields label { display: grid; gap: 5px; min-width: 0; font-weight: 750; font-size: clamp(14px, 1.4vw, 20px); }
.board-fields select { width: 100%; min-height: 48px; padding: 6px 11px; color: var(--board-navy); background: #f7fbfe; border: 1px solid var(--board-line); border-radius: 10px; }

.board-lesson { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: clamp(8px, 1.3vh, 16px); min-height: 0; }

.board-problem, .board-solution {
  display: grid;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.board-figure, .board-solution-figure {
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  background: #fbfdff;
  border: 1px solid var(--board-line);
  border-radius: 16px;
}
.board-shell:has(.board-lesson[data-solving="true"]:not([hidden])) {
  width: 100%;
  padding: clamp(6px, 1vw, 14px);
  gap: 6px;
}
.board-lesson[data-solving="true"] { grid-template-rows: minmax(0, 1fr); }
.board-solution {
  position: relative;
  grid-template-rows: minmax(130px, 1fr) auto;
  gap: 6px;
  padding: 0;
}
.board-solution-figure {
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  min-height: 0;
}
.board-solution-figure .q-svg, .board-solution-figure .solution-graphic,
.board-solution-figure .option-svg { max-height: 100%; max-width: 100%; }
.board-solution-actions {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1vw, 12px);
  width: min(100%, 1230px);
  min-width: 0;
  margin: 0 auto;
  padding: 4px;
  border: 1px solid var(--board-line);
  border-radius: 12px;
  background: #f8fcff;
}
.board-motion-controls {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(4px, 1vw, 12px);
  min-width: 0;
}
.board-step-controls { display: flex; align-items: center; gap: 4px; margin-left: auto; }
#board-step-count {
  min-width: 4ch;
  text-align: center;
  white-space: nowrap;
  font-size: clamp(13px, 1.2vw, 17px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.board-dialog .board-icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  box-shadow: none;
}
.board-icon-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#board-play[data-playing="true"] .board-play-icon,
#board-play[data-playing="false"] .board-pause-icon { display: none; }
#board-info[aria-expanded="true"] { background: #e2f3fc; border-color: var(--board-blue); }
.board-step-notes {
  position: absolute;
  z-index: 1;
  bottom: 64px;
  right: max(4px, (100% - 1230px) / 2);
  width: min(calc(100% - 8px), 470px);
  max-height: min(42%, 260px);
  overflow: auto;
  padding: 14px 18px;
  color: var(--board-navy);
  background: #fff;
  border: 1px solid var(--board-line);
  border-radius: 12px;
  box-shadow: 0 8px 32px #194e732e;
}
.board-step-notes h3 { margin: 0 0 5px; font-size: 18px; }
.board-step-notes p { margin: 0; font-size: clamp(14px, 1.1vw, 17px); line-height: 1.4; }
#board-scrub {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
}
#board-scrub:focus-visible { outline: 3px solid var(--board-blue); outline-offset: 2px; border-radius: 8px; }
#board-scrub::-webkit-slider-runnable-track {
  height: 10px; border-radius: 99px; background: #b2d7ed;
}
#board-scrub::-moz-range-track {
  height: 10px; border-radius: 99px; background: #b2d7ed;
}
#board-scrub::-webkit-slider-thumb {
  appearance: none; width: 30px; height: 30px; margin-top: -10px;
  border: 2px solid #fff; border-radius: 50%; background: var(--board-blue); box-shadow: 0 0 0 1px var(--board-blue);
}
#board-scrub::-moz-range-thumb {
  width: 26px; height: 26px;
  border: 2px solid #fff; border-radius: 50%; background: var(--board-blue); box-shadow: 0 0 0 1px var(--board-blue);
}
.board-shell:has(.board-status:not([hidden])) { grid-template-rows: auto minmax(0, 1fr) auto; }
.board-status { margin: 0 auto; width: fit-content; padding: 6px 12px; background: #fff2d7; color: #743c0e; border-radius: 8px; font-weight: 750; }

.board-shell:has(.board-lesson[data-solving="false"]:not([hidden])) {
  width: 100%;
  padding: clamp(7px, 1vw, 16px);
  gap: 6px;
}
.board-shell:has(.board-lesson[data-solving="false"]:not([hidden])) .board-toolbar {
  gap: 4px 12px;
}
.board-shell:has(.board-lesson[data-solving="false"]:not([hidden])) .board-heading {
  font-size: clamp(13px, 1vw, 17px);
}
.board-shell:has(.board-lesson[data-solving="false"]:not([hidden])) .board-toolbar .button,
.board-navigation .button {
  min-height: 36px;
  padding: 4px 10px;
  font-size: clamp(12px, .9vw, 15px);
  box-shadow: none;
}
.board-lesson[data-solving="false"] { gap: 6px; }
.board-problem {
  position: relative;
  grid-template-rows: auto minmax(110px, 1fr) auto;
  gap: 6px;
}
#board-question {
  margin: 0 auto;
  max-width: 48em;
  font-size: clamp(18px, 2.1vw, 34px);
  line-height: 1.16;
  letter-spacing: -.023em;
  text-align: center;
  text-wrap: balance;
}
.board-figure { grid-template: minmax(0, 1fr) / minmax(0, 1fr); border-radius: 12px; }
.board-figure > svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.board-answers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 auto;
  width: min(100%, var(--answer-width, 820px));
  gap: clamp(4px, .7vw, 9px);
  --answer-height: clamp(66px, 12vh, 104px);
}
.board-answers[data-profile="scalar"] {
  --answer-width: 620px;
  --answer-height: clamp(48px, 7.5vh, 64px);
}
.board-answers[data-profile="digits"] {
  --answer-width: 940px;
  --answer-height: clamp(52px, 8vh, 73px);
}
.board-answers[data-profile="symbol"] {
  --answer-width: 740px;
  --answer-height: clamp(57px, 9.5vh, 84px);
}
.board-answers:is([data-profile="outline"], [data-profile="rings"], [data-profile="silhouette"]) {
  --answer-width: 860px;
  --answer-height: clamp(66px, 11.8vh, 110px);
}
.board-answers:is([data-profile="tile"], [data-profile="features"], [data-profile="dotgrid"]) {
  --answer-width: 910px;
  --answer-height: clamp(74px, 14vh, 128px);
}
.board-answers:is([data-profile="paper"], [data-profile="foldgrid"]) {
  --answer-width: 950px;
  --answer-height: clamp(82px, 15vh, 142px);
}
.board-option {
  position: relative;
  display: grid;
  grid-template: minmax(0, 1fr) / auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  height: var(--answer-height);
  gap: 3px;
  border: 1.5px solid var(--board-line);
  background: #fff;
  border-radius: 10px;
  padding: 2px 6px;
}
.board-option > svg { width: 100%; height: 100%; min-height: 0; }
.board-option-letter {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: #e4f0f8;
  font-weight: 850;
  width: clamp(20px, 2vw, 28px);
  font-size: clamp(12px, 1.2vw, 17px);
  border-radius: 6px;
}
.board-option.is-correct { border-color: #14804e; background: #edf9f1; }
.board-option.is-correct .board-option-letter { background: #146743; color: #fff; }
.board-option.is-correct::after {
  content: "✓";
  position: absolute;
  top: 2px;
  right: 4px;
  color: #146743;
  font-size: 12px;
}
.board-answer {
  position: absolute;
  inset: 0 auto auto 0;
  margin: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.board-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid var(--board-line);
}
#board-next { justify-self: end; }
@media (max-width: 640px) {
  .board-toolbar, .board-tools, .board-navigation, .board-nav-group { gap: 6px; }
  .board-toolbar { flex-wrap: wrap; }
  .board-heading { flex-basis: 100%; }
  .board-dialog .button { padding-inline: 9px; }
  .board-option { padding-inline: 4px; }
  .board-answers {
    --answer-height: clamp(57px, 10vh, 77px);
  }
  .board-answers:is([data-profile="tile"], [data-profile="features"], [data-profile="dotgrid"],
    [data-profile="paper"], [data-profile="foldgrid"]) {
    --answer-height: clamp(61px, 11.5vh, 95px);
  }
  .board-navigation .button { line-height: 1.12; text-align: center; }
}
@media (max-width: 650px) and (orientation: portrait) {
  .board-answers:is([data-profile="paper"], [data-profile="foldgrid"]) {
    --answer-height: clamp(77px, 14vh, 114px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .board-answers[data-profile="digits"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 425px) {
  .board-answers:not([data-profile="scalar"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-answers[data-profile="scalar"] .board-option { padding-inline: 3px; }
  .board-navigation { grid-template-columns: 1fr 1.35fr 1fr; }
  .board-navigation .button { padding-inline: 5px; white-space: normal; }
  #board-prev, #board-next { width: 100%; }
  .board-solution-actions { flex-wrap: wrap; justify-content: space-between; }
  .board-motion-controls { flex-basis: 100%; }
  .board-step-controls { margin-left: 0; }
  .board-solution:has(.board-motion-controls:not([hidden])) .board-step-notes { bottom: 112px; }
}
@media (max-width: 380px) {
  .board-fields { grid-template-columns: 1fr; gap: 8px; }
  .board-setup h3 { margin-bottom: 15px; }
  .board-fields select { min-height: 42px; }
}
@media (max-height: 540px) and (min-width: 641px) {
  .board-shell { padding: 8px 12px; gap: 6px; }
  .board-lesson { gap: 6px; }
  #board-question { font-size: clamp(18px, 2vw, 26px); }
}

@media (max-height: 540px) {
  .board-option { height: min(var(--answer-height), 70px); }
  .board-problem { grid-template-rows: auto minmax(82px, 1fr) auto; }
}

.board-answers[data-profile="lineup"] {
  --answer-width: 980px;
  --answer-height: clamp(52px, 10vh, 90px);
}
@media (max-width: 650px) {
  .board-answers[data-profile="lineup"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.board-lesson[data-kind="twoview"] .board-answers {
  --answer-width: 1160px;
  --answer-height: clamp(73px, 14vh, 148px);
}
@media (max-width: 650px) and (orientation: portrait) {
  .board-lesson[data-kind="twoview"] .board-answers {
    --answer-height: clamp(73px, 13vh, 110px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.board-answers[data-profile="words"] { max-width: 1050px; }
.board-problem:has(> .board-answers[data-profile="cube-comparison"]) {
  grid-template-rows: auto auto;
  align-content: start;
}
.board-answers[data-profile="cube-comparison"] {
  --answer-width: 1000px;
  --answer-height: clamp(86px, 34dvh, 296px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (orientation: landscape) and (max-height: 480px) {
  .board-answers[data-profile="cube-comparison"] {
    --answer-height: clamp(85px, 38dvh, 175px);
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.board-problem:has(> .board-answers[data-profile="relation-pairs"]) {
  grid-template-rows: auto auto;
  align-content: start;
}
.board-answers[data-profile="relation-pairs"] {
  --answer-width: 900px;
  --answer-height: clamp(92px, 20dvh, 165px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px;
  border: 1px solid #b8dddc;
  border-radius: 22px;
  background: #e3f4f4;
}
.board-answers[data-profile="relation-pairs"] .board-option {
  border-radius: 15px;
  padding-inline: 10px;
}
[data-bs-theme="dark"] .board-answers[data-profile="relation-pairs"] {
  background: #172e3e;
  border-color: #3e6372;
}
@media (max-width: 590px) and (orientation: portrait) {
  .board-answers[data-profile="relation-pairs"] {
    --answer-height: 70px;
    grid-template-columns: minmax(0, 1fr);
    padding: 6px;
  }
}
@media (orientation: landscape) and (max-height: 480px) {
  .board-answers[data-profile="relation-pairs"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.board-answers[data-profile="visual-detail"] { max-width:930px; }

.board-lesson[data-kind="detailmatch"] .board-problem:has(.board-answers:not([hidden])) {
  grid-template: "prompt prompt" auto "sample choices" minmax(0, 1fr) / minmax(0, 1fr) minmax(0, 2fr);
  gap: 9px;
}
.board-lesson[data-kind="detailmatch"] .board-problem > .instruction-line { grid-area: prompt; }
.board-lesson[data-kind="detailmatch"] .board-figure {
  justify-self: center;
  width: min(100%, 255px);
  max-height: 255px;
  align-self: center;
  aspect-ratio: 1;
  background: white;
}
.board-lesson[data-kind="detailmatch"] .board-problem:has(.board-answers:not([hidden])) .board-figure { grid-area: sample; }
.board-lesson[data-kind="detailmatch"] .board-answers {
  grid-area: choices;
  width: 100%;
  max-width: 480px;
  align-self: center;
  --answer-height: clamp(64px, 21dvh, 208px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.board-lesson[data-kind="detailmatch"] .board-problem:has(.board-answers[hidden]) .instruction-line { grid-area: auto; }
@media (max-width: 530px) and (orientation: portrait) {
  .board-lesson[data-kind="detailmatch"] .board-problem:has(.board-answers:not([hidden])) {
    grid-template: "prompt" auto "sample" minmax(0, 1fr) "choices" auto / minmax(0, 1fr);
  }
  .board-lesson[data-kind="detailmatch"] .board-figure { height: 100%; width: min(100%, 110px); }
  .board-lesson[data-kind="detailmatch"] .board-answers { --answer-height: clamp(82px, 18dvh, 135px); }
}

.board-answers[data-profile="workshop"] {
  --answer-height: clamp(94px, 19dvh, 160px);
  --answer-width: 1100px;
}
@media (max-height: 480px) and (orientation: landscape) {
  .board-answers[data-profile="workshop"] { --answer-height: 65px; }
}
