.cq-screen {
  height: 100%; min-height: 0; width: 100%; min-width: 0;
  display: flex; flex-direction: column; gap: clamp(7px,1.2vh,15px);
}
.cq-screen > :not(.cq-grid):not(.cq-subpane) { flex-shrink: 0; }
.cq-screen .crumb { margin: 0 0 2px; }
.cq-head > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cq-head .quiet { white-space: nowrap; }
.cq-screen .query, .cq-screen .pillrow { margin: 0; }
.cq-screen .pill { line-height: 1.4; min-height: 39px; }
.cq-screen .query { padding: 7px; flex-wrap: nowrap; }
.cq-screen .query .searchbox { min-width: 0; }
.cq-screen .query .q-filter { flex: 0 1 auto; width: auto; max-width: 37%; min-width: 0; }
.cq-screen .query input { font-size: 14px; }
.cq-grid {
  --cq-row: 80px; --cq-cols: 1;
  flex: 1; min-height: 0; min-width: 0;
  display: grid; grid-template-columns: repeat(var(--cq-cols),minmax(0,1fr));
  grid-auto-rows: var(--cq-row); gap: 8px; align-content: start;
}
.cq-grid > [hidden] { display: none !important; }
.cq-pager { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.cq-pager button, .cq-pager select, .cq-actions button {
  color: #275344; background: #fffefa; border: 1px solid #becabd;
  border-radius: 7px; padding: 5px 11px; font-weight: 650; font-size: 13px; min-height: 40px;
}
.cq-pager button:disabled { opacity: .39; }
.cq-pager select { max-width: 40%; padding-right: 3px; text-align: center; }
.cq-chapter-grid .chapter-line { padding: 5px 11px 5px 5px; min-width: 0; gap: 11px; }
.cq-chapter-grid .chapter-line img { width: 86px; max-height: 100%; height: 100%; object-fit: cover; }
.cq-chapter-grid .row-data h3, .cq-chapter-grid .row-data small {
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.cq-chapter-grid .row-data small { -webkit-line-clamp: 1; line-clamp: 1; }
.cq-empty-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
.cq-screen .empty { padding: clamp(10px,3vh,32px) 13px; }
.cq-subpane { display: flex; flex-direction: column; gap: 9px; min-height: 0; min-width: 0; flex: 1; }
.cq-subpane[hidden] { display: none; }
.cq-screen .chapter-head {
  display: grid; grid-template-columns: minmax(100px,28%) minmax(0,1fr);
  min-height: 0; height: clamp(84px,20vh,170px); align-items: stretch;
}
.cq-screen .chapter-head .ch-photo { min-height: 0; max-height: none; height: 100%; width: 100%; object-fit: cover; }
.cq-screen .chapter-copy { min-width: 0; padding: 6px clamp(8px,2vw,26px); }
.cq-screen .chapter-copy h1 { margin: 2px 0; overflow-wrap: anywhere; }
.cq-actions { display: flex; gap: 5px; width: 100%; }
.cq-actions button { display: inline-flex; justify-content: center; align-items: center; gap: 6px; flex: 1; }
.cq-actions button[aria-pressed=true] { background: #245847; color: #fff; border-color: #245847; }
.cq-actions .icon { width: 15px; height: 15px; }
.cq-genre { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 650; }
.cq-genre .genre-select { flex: 1; width: 0; min-width: 0; min-height: 39px; }
.cq-screen .resumebox { margin: 0; padding: 4px 10px; }
.cq-screen .resumebox .btn { padding: 3px 9px; min-height: 31px; font-size: 12px; }
.cq-screen .mode-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.cq-screen .mode { min-width: 0; padding: 10px 12px; }
.cq-screen .mode strong, .cq-screen .mode small { overflow-wrap: anywhere; }
.cq-screen .mode:disabled { opacity: .57; cursor: default; }
.cq-points { --cq-row: 75px; list-style: none; margin: 0; padding: 0; }
.cq-points li { background: var(--card); border: 1px solid var(--rule); border-radius: 9px; display: flex; align-items: center; padding: 9px 12px; gap: 11px; }
.cq-points li > span { color: #84662a; font-weight: 750; font-variant-numeric: tabular-nums; }
.cq-screen .review-block { margin: 0; padding: 12px; }
.cq-screen .review-block h2 { color: #254e40; font-size: 18px; }
.cq-screen .review-block .sec-row { margin: 0; align-items: center; }
.cq-review-grid { --cq-row: 72px; }
.cq-review-grid .chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.cq-review-grid .chip span { font-weight: 650; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.cq-review-grid .chip small { flex-shrink: 0; color: #48745f; font-size: 12px; }
.cq-trophy-grid { --cq-row: 115px; }
.cq-trophy-grid .trophy { min-width: 0; }
.cq-trophy-grid .trophy h3 { line-height: 1.36; }
.cq-trophy-grid .trophy p { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.cq-trophy-detail img { width: min(138px,24vh); height: min(138px,24vh); }
@media (min-width: 700px) {
  .cq-chapter-grid, .cq-review-grid, .cq-trophy-grid, .cq-points { --cq-cols: 2; }
}
@media (min-width: 1050px) {
  .cq-chapter-grid, .cq-trophy-grid, .cq-review-grid { --cq-cols: 3; }
}
@media (max-width: 640px) {
  .cq-screen { gap: 7px; }
  .cq-head .page-heading { font-size: 23px; }
  .cq-head .quiet { font-size: 12px; }
  .cq-screen .chapter-head { grid-template-columns: 28% minmax(0,1fr); height: clamp(86px,14vh,112px); }
  .cq-screen .chapter-copy h1 { font-size: clamp(15px,4vw,22px); line-height: 1.24; }
  .cq-screen .chapter-copy .quiet, .cq-screen .chapter-copy .eyebrow { font-size: 10px; line-height: 1.3; }
  .cq-screen .query { gap: 5px; padding: 4px; }
  .cq-screen .query .q-filter { font-size: 11px; padding: 7px 3px; }
  .cq-chapter-grid { --cq-row: 73px; }
  .cq-chapter-grid .chapter-line { gap: 7px; }
  .cq-chapter-grid .chapter-line img { width: 60px; }
  .cq-chapter-grid .row-data h3 { font-size: 14px; line-height: 1.28; }
  .cq-chapter-grid .row-data small { font-size: 10px; margin-top: 1px; }
  .cq-screen .mode { padding: 8px; gap: 6px; align-items: flex-start; }
  .cq-screen .mode strong { font-size: 14px; }
  .cq-screen .mode small { margin-top: 3px; font-size: 11px; line-height: 1.45; }
  .cq-screen .mode > i { width: 23px; height: 23px; }
  .cq-points { --cq-row: 72px; }
  .cq-points li { font-size: 13px; line-height: 1.5; padding: 6px 9px; }
  .cq-shelf .pillrow { gap: 4px; }
  .cq-shelf .pill { font-size: 12px; padding: 5px 9px; }
  .cq-trophy-grid { --cq-row: 83px; }
  .cq-trophy-grid .trophy { padding: 4px 10px; gap: 7px; grid-template-columns: 58px minmax(0,1fr); }
  .cq-trophy-grid .trophy img { width: 56px; height: 57px; }
  .cq-trophy-grid .trophy h3 { font-size: 15px; }
  .cq-trophy-grid .trophy p { -webkit-line-clamp: 1; line-clamp: 1; font-size: 11px; margin: 1px 0; }
  .cq-trophy-grid .trophy small { font-size: 10px; }
  .cq-review-grid { --cq-row: 83px; }
  .cq-screen .review-block { padding: 8px; }
}
@media (max-width: 360px) {
  .cq-screen .mode > i, .cq-actions .icon { display: none; }
  .cq-actions button { white-space: nowrap; padding-inline: 5px; }
  .cq-review-grid .chip span { font-size: 12px; }
}
@media (max-height: 460px) {
  .cq-screen { overflow-y: auto; }
  .cq-grid { min-height: var(--cq-row); }
  .cq-subpane { min-height: 140px; }
}

/* The chapter's main path stays together. Filters apply only in the practice panel. */
.cq-journey {
  max-width: 840px; margin-inline: auto;
  gap: clamp(8px,1.55dvh,17px);
}
.cq-journey .chapter-head {
  grid-template-columns: minmax(110px,36%) minmax(0,1fr);
  height: clamp(100px,23dvh,208px);
  background: #fffdf5; border-color: #d4d8c8; border-radius: 12px;
}
.cq-journey .chapter-copy { padding: 7px clamp(12px,3.5vw,36px); }
.cq-journey .chapter-copy .eyebrow { color: #60765e; }
.cq-journey .chapter-copy .page-heading { font-size: clamp(22px,3vw,32px); line-height: 1.26; }
.cq-stage-tabs {
  display: flex; gap: 2px; min-width: 0; padding: 3px;
  background: #e8ece2; border: 1px solid #d9dfd1; border-radius: 9px;
}
.cq-stage-tabs button {
  flex: 1; min-width: 0; min-height: 40px; padding: 5px 4px; line-height: 1.25;
  font-size: 14px; font-weight: 650; color: #54665b; background: transparent;
  border: 1px solid transparent; border-radius: 6px;
}
.cq-stage-tabs button[aria-selected=true] {
  background: #fffdf6; color: #1b5948; border-color: #d5dbcf; box-shadow: 0 1px 3px #243d2e12;
}
.cq-stages { display: grid; gap: clamp(5px,1.15dvh,11px); list-style: none; margin: 0; padding: 0; }
.cq-journey .cq-step {
  display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center;
  gap: clamp(9px,2.6vw,17px); width: 100%; min-height: clamp(52px,9.8dvh,82px);
  padding: 7px clamp(10px,2.6vw,22px); border: 1px solid #ced7c9;
  border-radius: 10px; background: #fffef7; color: #284b3d; text-align: left;
}
.cq-journey .cq-step-number {
  display: grid; place-items: center; width: 33px; height: 33px;
  border: 1px solid #bacaba; border-radius: 50%; background: #eff2e8; color: #37664f;
  font: 700 17px/1 Georgia,serif; font-variant-numeric: tabular-nums;
}
.cq-step .cq-step-copy strong { display: block; font-size: clamp(16px,2.4vw,21px); line-height: 1.3; }
.cq-step .cq-step-copy small { display: block; margin: 3px 0 0; color: #536453; font-size: 13px; line-height: 1.35; }
.cq-step .cq-step-cue { display: grid; place-items: center; width: 28px; }
.cq-journey .cq-step[data-step-state=current] {
  color: #fffcf0; background: #215747; border-color: #184d3f;
  box-shadow: inset 3px 0 #d6b767;
}
.cq-journey .cq-step[data-step-state=current] small { color: #e0eddd; }
.cq-journey .cq-step[data-step-state=current] .cq-step-number { background: #f0db9d; border-color: #f0db9d; color: #26473a; }
.cq-journey .cq-step[data-step-state=current] .cq-step-cue { color: #f0d794; }
.cq-journey .cq-step:disabled { color: #526053; background: #f1f2ea; border-color: #d8ddd0; opacity: 1; }
.cq-journey .cq-step:disabled small { color: #566255; }
.cq-journey .cq-step:disabled .cq-step-number { color: #627260; background: transparent; border-color: #c5cec0; }
.cq-journey .cq-step:disabled .cq-step-cue { color: #677562; }
.cq-bookmark {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  color: #556854; font-size: 13px; padding-inline: 3px;
}
.cq-bookmark .btn { min-height: 39px; padding: 5px 10px; white-space: nowrap; }
.cq-medal-trigger {
  display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 8px;
  width: 100%; min-height: 44px; padding: 5px 12px;
  color: #46584c; background: #f8f6eb; border: 1px solid #d9d9c7; border-radius: 8px; text-align: left;
}
.cq-medal-trigger:hover { border-color: #8b9b7b; }
.cq-medal-trigger .icon { width: 14px; height: 14px; }
.cq-medal { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cq-medal + .cq-medal { border-inline-start: 1px solid #d5d8c7; padding-inline-start: 10px; }
.cq-medal strong,.cq-medal small { display: block; line-height: 1.28; }
.cq-medal strong { color: #42503e; font-size: 13px; }
.cq-medal small,.cq-medal-details small { color: #586258; font-size: 11px; }
.cq-medal img,.cq-medal-details img { object-fit: contain; flex: none; }
.cq-medal-trigger [data-earned=false] img,.cq-medal-details [data-earned=false] img { filter: grayscale(1); opacity: .59; }
.cq-medal[data-earned=true] strong,.cq-medal[data-earned=true] small,.cq-medal-details [data-earned=true] small { color: #77521d; }
.cq-medal-details { list-style: none; display: grid; gap: 12px; margin: 0; padding: 0; }
.cq-medal-details li { display: flex; align-items: center; gap: 12px; padding-block: 6px; }
.cq-medal-details li+li { border-top: 1px solid var(--rule); padding-top: 15px; }
.cq-medal-details img { width: 49px; height: 49px; }
.cq-medal-details strong { font-size: 16px; color: #254e40; margin-right: 8px; }
.cq-medal-details small { white-space: nowrap; }
.cq-medal-details p { margin: 3px 0 0; font-size: 14px; line-height: 1.55; }
.cq-journey .cq-quest { margin: 0; font-size: clamp(13px,2.3vw,17px); font-weight: 650; color: #3f5444; }
.cq-journey #cq-practice-pane .mode-grid { grid-template-columns: 1fr; }
.cq-journey #cq-practice-pane .mode { align-items: center; min-height: 46px; }
.cq-journey #cq-practice-pane .mode:disabled { opacity: 1; background: #f1f2ea; color: #526053; }
.cq-journey #cq-practice-pane .mode:disabled small { color: #5c695c; }
@media (min-width: 700px) and (min-height: 600px) {
  .cq-journey #cq-practice-pane .mode-grid { grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); }
  .cq-journey #cq-practice-pane .mode { align-items: flex-start; }
}
@media (max-width: 640px) {
  .cq-journey .chapter-head { grid-template-columns: 32% minmax(0,1fr); height: clamp(88px,17dvh,135px); }
  .cq-journey .chapter-copy { padding-inline: 10px; }
  .cq-journey .chapter-copy .page-heading { font-size: clamp(16px,4.5vw,22px); }
  .cq-stage-tabs button { font-size: clamp(12px,3.4vw,14px); }
  .cq-step .cq-step-copy small { font-size: 12px; }
  .cq-journey .cq-step-number { width: 29px; height: 29px; font-size: 16px; }
}
@media (max-height: 630px) {
  .cq-journey { gap: 6px; }
  .cq-journey .chapter-head { height: clamp(74px,15.8dvh,93px); }
  .cq-journey .cq-step { min-height: 50px; padding-block: 5px; }
  .cq-stage-tabs { padding: 2px; }
  .cq-stage-tabs button { min-height: 38px; }
  .cq-bookmark .btn { min-height: 36px; }
  .cq-journey #cq-practice-pane .mode { padding-block: 5px; }
}
@media (min-width: 650px) and (max-height: 485px) {
  .cq-journey { display: grid; grid-template: auto auto minmax(0,1fr) / minmax(0,35fr) minmax(0,65fr); }
  .cq-journey > .crumb { grid-column: 1/-1; }
  .cq-journey .chapter-head { grid-column: 1; grid-row: 2/4; height: auto; display: flex; flex-direction: column; }
  .cq-journey .chapter-head .ch-photo { height: min(26dvh,96px); flex: none; }
  .cq-journey .chapter-copy { align-self: stretch; overflow-y: auto; }
  .cq-journey .chapter-copy .page-heading { font-size: 17px; }
  .cq-journey .cq-stage-tabs,.cq-journey .cq-subpane { grid-column: 2; }
  .cq-journey #cq-journey-pane:not([hidden]) {
    display: grid; grid-template-columns: minmax(0,1fr) auto; align-content: start; gap: 5px;
  }
  .cq-journey .cq-stages,.cq-journey .cq-medal-trigger { grid-column: 1/-1; }
  .cq-journey .cq-medal-trigger:has(+ .cq-bookmark) { grid-column: 1; }
  .cq-journey .cq-bookmark { grid-column: 2; flex-direction: column; justify-content: center; gap: 0; font-size: 11px; }
  .cq-journey .cq-bookmark .btn { min-height: 32px; padding: 2px 8px; }
}

