/* Review workbench. Kangaroo cream, pine, and gold, loaded after the theme. */

.app-shell,
#app,
.family-card,
.review-banner,
.question-prompt,
.excerpt {
  max-width: 100%;
}

.family-card,
.question-prompt,
.excerpt,
.review-banner {
  overflow-wrap: anywhere;
}

.review-banner {
  margin: 18px 0 0;
  color: #ffe7a8;
  font-size: 15px;
  line-height: 1.5;
}

.review-loading {
  color: #f7eed4;
}

.boot-loading {
  margin: 16px 0;
  padding: 16px 18px;
  background: #fff6df;
  color: #1f3d2b;
  border: 3px solid #d8b56a;
  border-radius: 24px;
  box-shadow: 0 6px 0 rgba(31, 61, 43, 0.14);
}

.boot-loading p {
  margin: 0 0 10px;
  font-weight: 800;
}

.boot-track {
  height: 12px;
  overflow: hidden;
  border: 2px solid #1f3d2b;
  border-radius: 999px;
  background: #e7f0cf;
}

.boot-bar {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 999px;
  background: #1f3d2b;
  animation: boot-indeterminate 1.1s ease-in-out infinite;
}

@keyframes boot-indeterminate {
  from { transform: translateX(-120%); }
  to { transform: translateX(320%); }
}

.boot-loading.is-error .boot-track {
  display: none;
}

#bootRetry {
  min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
  .boot-bar {
    width: 100%;
    animation: none;
    transform: none;
  }
}

.review-toolbar,
.review-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
}

.review-toolbar .search-field {
  flex: 1 1 220px;
  min-width: 0;
}

.review-toolbar input[type="search"],
.review-tools select,
.level-select,
.skill-select,
.source-select {
  width: 100%;
  min-height: 44px;
  border: 3px solid #d8b56a;
  border-radius: 14px;
  background: #fff6df;
  color: #2a1a12;
  padding: 0 12px;
}

.review-toolbar .subject-btn {
  min-height: 44px;
  color: #1f3d2b;
  background: #fff6df;
  border: 3px solid #d8b56a;
  font-weight: 800;
}

.review-toolbar .subject-btn.active {
  background: #1f3d2b;
  color: #f4e7c8;
  border-color: #1f3d2b;
}

.catalog-error {
  margin-bottom: 16px;
}

.catalog-error p {
  margin: 0 0 10px;
}

.family-block {
  margin: 8px 0 18px;
}

.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

button.family-card {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: #2a1a12;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 18%),
    #fff6df;
  border: 3px solid #d8b56a;
  border-radius: 24px;
  box-shadow: 0 6px 0 rgba(31, 61, 43, 0.14);
  padding: 16px;
  min-height: 44px;
}

button.family-card:hover,
button.family-card:focus-visible {
  transform: translateY(-1px);
}

.family-card h3 {
  margin: 0 0 6px;
  font-size: 22px;
  color: #1f3d2b;
}

.family-card p,
.fine {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.45;
  color: #5c4030;
}

.tag {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6d8;
  color: #1f3d2b;
  font-size: 12px;
  font-weight: 800;
}

.tag.warn {
  background: #f4e7c8;
  color: #7a4a28;
}

.review-detail .description {
  margin: 0 0 12px;
  color: #f7eed4;
  max-width: 70ch;
}

.grade-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.grade-switch button,
.level-buttons button,
.review-tools button,
.shot-toggle,
#sourceNext,
.lightbox-close {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 3px solid #d8b56a;
  background: #fff6df;
  color: #1f3d2b;
  font-weight: 800;
}

.grade-switch button.active,
.level-buttons button.active {
  background: #1f3d2b;
  color: #f4e7c8;
  border-color: #1f3d2b;
}

.source-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 0 0 12px;
}

.review-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 767px) {
  .review-split,
  .review-split.is-side,
  .review-split.is-aligned {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    overflow-x: visible;
    max-width: 100%;
    padding-bottom: 0;
  }

  .review-split.is-aligned > .panel {
    display: block;
    grid-row: auto;
    grid-column: auto;
    grid-template-rows: none;
  }
}

@media (min-width: 768px) {
  .review-split.is-side.is-aligned {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 16px;
    row-gap: 12px;
    align-items: start;
  }

  .review-split.is-side.is-aligned > .panel {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 2;
    align-self: stretch;
    min-width: 0;
    padding: 0;
  }

  .review-split.is-side.is-aligned > .ai-pane { grid-column: 1; }
  .review-split.is-side.is-aligned > .source-pane { grid-column: 2; }

  .review-split.is-side.is-aligned .pane-meta,
  .review-split.is-side.is-aligned .pane-body {
    min-width: 0;
    max-width: 100%;
  }

  .review-split.is-side.is-aligned .pane-meta { padding: 23px 23px 0; }
  .review-split.is-side.is-aligned .pane-body { padding: 0 23px 23px; }

  .review-split.is-side.is-aligned .pane-body > :first-child { margin-top: 0; }
}

@supports not (grid-template-rows: subgrid) {
  .review-split.is-aligned > .panel {
    display: block;
    grid-row: auto;
    grid-column: auto;
    padding: 23px;
  }

  .review-split.is-aligned .pane-meta,
  .review-split.is-aligned .pane-body {
    padding: 0;
  }
}

.review-split > * { min-width: 0; }

.review-split .panel h2 {
  margin-top: 0;
}

.level-row {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}

.level-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.level-buttons button {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  max-width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.level-buttons button small,
.grade-switch button {
  font-weight: 700;
}

.level-buttons button:disabled {
  cursor: not-allowed;
  background: #f4e7c8;
  color: #7a4a28;
}

#curriculumGrade {
  font-size: 16px;
  font-weight: 800;
}

.grade-switch button {
  background: #efe0b5;
}

.ai-actions,
.answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.option-label {
  width: 100%;
  text-align: left;
  font: inherit;
}

.rit-card {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #eef6d8;
  color: #1f3d2b;
  font-size: 13px;
  line-height: 1.4;
}

.rit-card p {
  margin: 0;
}

.rit-card details {
  margin-top: 4px;
}

.source-cite {
  font-weight: 800;
  margin-top: 0;
}

.shot-frame {
  margin-top: 8px;
}

.shot-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.shot-zoom img,
.lightbox img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  background: #fff;
}

.shot-missing {
  margin: 8px 0 0;
  font-weight: 800;
  color: #7a4a28;
}

.classify-note {
  margin-top: 10px;
  font-size: 13px;
}

.limits {
  color: #f7eed4;
  font-size: 13px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(20, 32, 24, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
}

.lightbox img {
  max-height: calc(100vh - 100px);
  max-width: min(1100px, 100%);
}

#printRoot {
  display: none;
}

.check-note {
  margin: 10px 0 0;
  font-weight: 800;
}

#answerBlock {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #d8b56a;
}

#answerBlock p {
  color: #fff9e9;
}

#answerBlock ol {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.empty-note {
  color: #f7eed4;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #e3a12b;
  outline-offset: 2px;
}

.page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
}

.page-heading > div.heading-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.page-heading .type-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
}

.page-heading .next-type,
.page-heading .prev-type {
  flex: 0 1 auto;
  max-width: 100%;
  white-space: normal;
  text-align: center;
}

.page-heading .prev-type:disabled,
.page-heading .next-type:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.type-switch-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
  color: #ffe7a8;
}

@media (max-width: 390px) {
  .page-heading {
    flex-wrap: wrap;
  }

  .page-heading > div.heading-copy.heading-copy {
    flex: 1 1 100%;
    min-width: 0;
  }

  .page-heading .back-btn,
  .page-heading .type-nav,
  .page-heading .prev-type,
  .page-heading .next-type {
    max-width: 100%;
    white-space: normal;
  }
}

@media (max-width: 767px) {
  .review-banner {
    font-size: 14px;
  }

  .family-grid {
    grid-template-columns: 1fr;
  }

  .level-buttons button,
  .review-tools button,
  .grade-switch button {
    flex: 1 1 auto;
  }
}

.rating-row,
.review-stars,
.practice-grade,
.star-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rating-row {
  margin: 10px 0;
}

.review-stars button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  border: 3px solid #d8b56a;
  background: #fff6df;
  color: #1f3d2b;
  font-weight: 800;
}

.review-stars button.active {
  background: #1f3d2b;
  color: #f4e7c8;
  border-color: #1f3d2b;
}

.rating-sync,
#ratingLoginHint,
#practiceGradeHint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.review-toolbar .rating-sync,
.review-toolbar .fine {
  color: #ffe7a8;
  flex: 1 1 100%;
}

.rating-row .rating-sync,
.rating-row .fine {
  color: #5c4030;
  flex: 1 1 100%;
}

@media print {
  .app-shell {
    display: none !important;
  }

  #printRoot {
    display: block !important;
    color: #111 !important;
    background: #fff !important;
  }

  #printRoot .print-question {
    break-inside: avoid;
  }
}

.review-stars button::after { content: "★"; margin-left: .25em; color: #c58a13; }

/* Bitmaps inside question figures scale down inside the box. Source shots stay on .shot-zoom. */
.question-card .figure-wrap,
#answerBlock .figure-wrap,
.review-item .figure-wrap,
#examFigure.figure-wrap,
.exam-figure.exam-figure {
  max-height: none;
  overflow: visible;
  text-align: center;
}

.question-card .figure-wrap img,
#answerBlock .figure-wrap img,
.review-item .figure-wrap img,
#examFigure.figure-wrap img,
.exam-figure.exam-figure img {
  display: inline-block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  vertical-align: middle;
}

.question-card .figure-wrap svg,
#answerBlock .figure-wrap svg,
.review-item .figure-wrap svg,
#examFigure.figure-wrap svg,
.exam-figure.exam-figure svg {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 290px;
}

#printRoot .print-figure {
  max-height: none;
  overflow: visible;
  text-align: center;
}

#printRoot .print-figure img {
  display: inline-block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
  vertical-align: middle;
}

@media print {
  #printRoot .print-figure {
    max-width: 320px;
    max-height: none;
    overflow: visible;
  }

  #printRoot .print-figure img {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 145px;
    object-fit: contain;
  }
}

.map-reader { background: #fff9e9; color: #243f2c; border-radius: 16px; padding: 14px; margin: 16px 0; }
.map-reader-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.map-reader button[aria-pressed="true"] { background: #365f43; color: #fff9e9; }
@media print { .map-reader { display: none; } }

.question-card.is-sample .question-prompt {
  font-size: 22px;
  line-height: 1.45;
  margin: 0 0 10px;
}

.question-card.is-sample .figure-wrap {
  margin: 0 0 14px;
  padding: 14px 12px;
}

.question-card.is-sample .option-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.question-card.is-sample .option-label {
  min-height: 54px;
  padding: 12px 14px;
  font-size: 20px;
  font-weight: 800;
}

.parent-demo {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: #fff6df;
  color: #1f3d2b;
  border: 3px solid #d8b56a;
}

.demo-kicker,
.demo-caption,
.demo-extra,
.demo-result {
  margin: 8px 0 0;
  color: #1f3d2b;
  line-height: 1.45;
}

.demo-result {
  font-size: 20px;
  font-weight: 800;
}

.demo-stage {
  margin-top: 8px;
}

.demo-chart,
.parent-demo svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
}

.demo-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.demo-col {
  min-height: 96px;
  padding: 8px;
  border: 2px solid #d8b56a;
  border-radius: 14px;
  background: #fff;
  text-align: center;
}

.demo-col span {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.demo-col strong {
  display: block;
  margin-top: 6px;
  font-size: 32px;
  line-height: 1;
  color: #25324a;
}

.demo-col.is-hot,
.col-place.is-hot {
  background: #fff3cc;
  border-color: #e3a12b;
  box-shadow: inset 0 0 0 3px #e3a12b;
}

.demo-tray {
  min-height: 72px;
  margin-top: 10px;
  padding: 8px;
  border: 2px dashed #1f3d2b;
  border-radius: 14px;
  background: #fff;
}

.demo-piece {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-end;
  max-width: 100%;
  min-height: 48px;
  padding: 8px;
  border: 3px solid #1f3d2b;
  border-radius: 14px;
  background: #fffaf0;
  cursor: grab;
  touch-action: none;
}

.demo-piece.is-dragging {
  cursor: grabbing;
  z-index: 3;
}

.demo-block {
  display: block;
  border-radius: 3px;
}

.demo-block-hundreds {
  width: 26px;
  height: 26px;
  background: #3d79c6;
}

.demo-block-tens {
  width: 10px;
  height: 34px;
  background: #1f3d2b;
}

.demo-block-ones {
  width: 12px;
  height: 12px;
  background: #e3a12b;
}

.col-board {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.col-place {
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 8px;
  border-radius: 14px;
  border: 2px solid transparent;
}

.col-head,
.col-carry {
  min-height: 18px;
  font-size: 13px;
  font-weight: 800;
  color: #1f3d2b;
}

.col-carry {
  color: #9a6410;
}

.col-digit,
.col-write {
  min-height: 34px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: #25324a;
}

.col-write {
  width: 100%;
  text-align: center;
  border-top: 3px solid #25324a;
}

.col-op {
  color: #1f3d2b;
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.parent-demo button,
.demo-piece {
  background: #fff;
  color: #1f3d2b;
}

.demo-controls button {
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid #1f3d2b;
  border-radius: 12px;
  font-weight: 800;
}

.demo-controls button:disabled {
  opacity: 0.45;
}

.demo-piece.is-snapped,
.demo-token.demo-snap {
  animation: demo-settle 280ms ease;
}

.demo-piece.is-return {
  animation: demo-return 280ms ease;
}

.demo-guide {
  stroke-dasharray: 180;
  stroke-dashoffset: 180;
  animation: demo-draw 280ms ease forwards;
}

@keyframes demo-settle {
  0% { transform: translateY(-10px); }
  60% { transform: translateY(3px); }
  100% { transform: translateY(0); }
}

@keyframes demo-return {
  0% { transform: translateY(-6px); }
  55% { transform: translateY(3px); }
  100% { transform: translateY(0); }
}

@keyframes demo-draw {
  to { stroke-dashoffset: 0; }
}

@media (max-width: 767px) {
  .question-card.is-sample .question-prompt {
    font-size: 18px;
  }

  .question-card.is-sample .option-label {
    font-size: 18px;
  }

  .col-place {
    width: 54px;
  }

  .col-digit,
  .col-write {
    font-size: 22px;
  }

  .demo-controls button {
    flex: 1 1 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-piece.is-snapped,
  .demo-token.demo-snap,
  .demo-piece.is-return,
  .demo-guide {
    animation: none;
    stroke-dashoffset: 0;
    transform: none;
  }
}

@media print {
  #parentDemo,
  .parent-demo {
    display: none !important;
  }
}
