/* Gameficate cartridge — the question panel tightens step by step until the whole question fits without a scrollbar
   (js/ui/PanelFit.js adds fit1…fit6 to #qpanel, each step keeping the ones before it). */

/* While it measures, nothing may animate its height (a half-finished transition would be measured). */
#qpanel[data-fit] .qmedia {
  transition: none;
}

/* ---------- fit1: fold away what the top bar already says ---------- */
#qpanel.fit1 .cat-head,
#qpanel.fit1 .progress {
  display: none;
}

/* ---------- fit2: smaller picture strip, the hint bar on one line ---------- */
#qpanel.fit2 .qmedia {
  height: 96px;
}
#qpanel.fit2 .qmedia .fallback img {
  width: 48px;
  height: 48px;
}
#qpanel.fit2 .qmedia .fallback .hint {
  display: none;
}
#qpanel.fit2 .hintbar {
  padding: 6px 10px;
  gap: 8px;
}
#qpanel.fit2 .hb-btns {
  flex-direction: row;
}
#qpanel.fit2 .hintbar .hb-t2 {
  display: none;
}
#qpanel.fit2 .btn-chip {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

/* ---------- fit3: tighter spacing and answer buttons ---------- */
#qpanel.fit3 {
  gap: 8px;
  padding-top: 10px;
  padding-bottom: 10px;
}
#qpanel.fit3 .qbody {
  padding: 10px 14px 12px;
}
#qpanel.fit3 .qnum {
  margin-bottom: 4px;
}
#qpanel.fit3 .qz-opts,
#qpanel.fit3 .quizbox {
  gap: 6px;
}
#qpanel.fit3 .qz-opt {
  min-height: 44px;
  padding: 6px 10px;
}
#qpanel.fit3 .clues {
  margin-top: 8px;
  gap: 5px;
}
#qpanel.fit3 .clues li {
  padding: 4px 8px;
}
#qpanel.fit3 .btn-primary {
  height: 52px;
}

/* ---------- fit4: a slim picture band; four or more answers in two columns ---------- */
#qpanel.fit4 .qmedia {
  height: 56px;
}
#qpanel.fit4 .qmedia .fallback img {
  width: 34px;
  height: 34px;
}
/* An empty strip (no picture of its own, only the category icon) goes altogether. */
#qpanel.fit4 .qmedia:not(.loaded) {
  display: none;
}
#qpanel.fit4 .qz-opts:not(.tf):has(> .qz-opt:nth-child(4)) {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
#qpanel.fit4 .qz-head {
  display: none;
}
/* Questions without a map (a card): long lists flow into two columns, a crossword's clues sit beside the grid. */
#qpanel.fit4 .card-a .qt-sort,
#qpanel.fit4 .card-a .qt-order {
  display: block;
  columns: 2;
  column-gap: 10px;
}
#qpanel.fit4 .card-a .qt-sort > *,
#qpanel.fit4 .card-a .qt-order > * {
  break-inside: avoid;
  margin-bottom: 6px;
}
#qpanel.fit4 .card-a .qt-cw-wrap {
  flex-wrap: nowrap;
}
#qpanel.fit4 .card-a .qt-ord,
#qpanel.fit4 .card-a .qt-sort-row {
  padding-top: 4px;
  padding-bottom: 4px;
}

/* ---------- fit5 / fit6: everything a little smaller ---------- */
#qpanel.fit5 > * {
  zoom: 0.9;
}
#qpanel.fit6 > * {
  zoom: 0.8;
}
#qpanel.fit6 .qmedia {
  display: none;
}

/* ---------- Still too tall: scroll, but keep Check in view and show that there is more ---------- */
#qpanel.fit-more .card-act,
#qpanel.fit-more .card-btns:has(#checkBtn) {
  position: sticky;
  bottom: -10px;
  z-index: 3;
  padding-bottom: 6px;
  background: linear-gradient(transparent, var(--panel) 18px);
}
/* No scrollbar on touch screens (a swipe scrolls); a slim one elsewhere. */
body.touch #qpanel {
  scrollbar-width: none;
}
body.touch #qpanel::-webkit-scrollbar {
  display: none;
}
#qpanel.fit-more {
  scrollbar-width: thin;
}
