/* ==========================================================================
   V0.86 — the backlog from the UX review: Practice multi-select, paper card
   one-action, photo upload, real pen previews, skeletons, paywall.
   Loaded last, so every rule here outranks the layers before it.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Practice list: a tick box and a thumbnail per question.
   -------------------------------------------------------------------------- */
body.ial-v030 .qcard.v086-qcard {
  display: grid !important;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
}
/* The whole row used to be clickable, so the tick box had to be protected:
   it stops propagation itself, and the label is only a target for the box. */
.qpick { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; cursor: pointer; }
.qpick input {
  width: 17px; height: 17px; margin: 0; accent-color: #4F46E5;
  cursor: pointer; display: block;
}
/* A tick box nobody notices is a tick box that collects no sets. */
.qpick input:checked + span::after {
  content: ''; position: absolute; pointer-events: none;
}
.qthumb {
  width: 52px; height: 34px; object-fit: cover; object-position: top center;
  border: 1px solid #e2e8f0; border-radius: 6px; background: #f1f5f9;
  display: block;
}
/* The thumb must not swallow the click that opens the question. */
.qthumb { pointer-events: none; }

.v086-preset {
  border-radius: 999px !important;
  padding: 6px 13px !important;
  font-size: 12.5px !important; font-weight: 700 !important;
  background: #fff !important; color: #334155 !important;
  border: 1px solid #d7dfec !important;
}
.v086-preset:hover { background: #eef2ff !important; color: #3730a3 !important; }
.v086-preset.active { background: #4F46E5 !important; color: #fff !important; border-color: #4F46E5 !important; }

/* Only comes alive once something is ticked — the button is the reward for
   the ticking, so it must look inert until there is something to reward. */
.v086-practice-picked {
  border-radius: 999px !important;
  padding: 7px 15px !important; font-size: 12.5px !important; font-weight: 800 !important;
  background: #4F46E5 !important; color: #fff !important; border: 1px solid #4F46E5 !important;
}
.v086-practice-picked:disabled {
  background: #eef2f7 !important; color: #94a3b8 !important;
  border-color: #e2e8f0 !important; cursor: default;
}
.v086-practice-picked.is-armed { box-shadow: 0 4px 14px rgba(79, 70, 229, .3); }

/* "Filters ▾" — the label says what the row does now. */
.v086-filtersToggle { border-radius: 999px !important; }
.v086-filtersToggle[aria-expanded="true"] {
  background: #eef2ff !important; color: #3730a3 !important; border-color: #c7d2fe !important;
}
.v086-buildSet {
  background: linear-gradient(135deg, #4F46E5 0%, #6D28D9 100%) !important;
  color: #fff !important; border: 0 !important; font-weight: 800 !important;
  padding: 10px 18px !important; border-radius: 10px !important;
}

/* --------------------------------------------------------------------------
   2. Paper card: mode tags, one action, one tick.
   -------------------------------------------------------------------------- */
.v085-paper-modes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }
.v085-paper-mode {
  font-size: 11px; font-weight: 700; color: #475569;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
/* The card's single primary action sits under the progress, full width. */
.btn.v085-paper-start {
  width: 100%; display: block; text-align: center;
  padding: 11px 12px !important; border-radius: 10px !important;
  background: linear-gradient(135deg, #4F46E5 0%, #6D28D9 100%) !important;
  color: #fff !important; border: 0 !important;
  font-weight: 800 !important; font-size: 13.5px !important;
}
.btn.v085-paper-start:hover { filter: brightness(1.07); }

/* Timed exam is a tick, not a second button. */
.v085-paper-timed {
  display: flex; align-items: center; gap: 8px;
  margin-top: 9px; padding: 8px 10px; cursor: pointer;
  border: 1px dashed #c7d2fe; border-radius: 9px;
  background: #fafbff; font-size: 12px; font-weight: 700; color: #3730a3;
}
.v085-paper-timed input { width: 16px; height: 16px; accent-color: #4F46E5; cursor: pointer; margin: 0; }
.v085-paper-timed:hover { background: #f2f5ff; }
.v085-paper-original {
  width: 100%; margin-top: 8px; text-align: center;
  background: none; border: 0; padding: 2px 0;
  color: #6366f1; font-size: 11.5px; font-weight: 800; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.v085-paper-original:hover { color: #4338ca; }

/* --------------------------------------------------------------------------
   3. Photo upload: visible, not buried in the overflow menu.
   -------------------------------------------------------------------------- */
body.ial-v030 .workspacePhotoBtn {
  display: inline-flex !important; align-items: center; gap: 6px;
  background: #ecfdf5 !important; color: #047857 !important;
  border: 1px solid #a7f3d0 !important; font-weight: 800 !important;
}
body.ial-v030 .workspacePhotoBtn:hover { background: #d1fae5 !important; }
/* A small permanent strip under the answer book, phones included. */
.v086-photoBar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 12px; border-top: 1px solid #e2e8f0; background: #f8fafc;
}
.v086-photoBar button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #cbd5e1; background: #fff; border-radius: 9px;
  padding: 7px 12px; font-size: 12px; font-weight: 800; color: #334155; cursor: pointer;
}
.v086-photoBar button.primary {
  background: linear-gradient(135deg, #4F46E5, #6D28D9); color: #fff; border-color: #4F46E5;
}
/* `hidden` on a button loses to the display above, so say it back. */
.v086-photoBar button[hidden] { display: none; }
/* The way back to the pen, offered only while the pad is collapsed. */
.v086-photoBar button[data-v086-write] { border-color: #c7d2fe; color: #3730a3; }
.v086-photoBar .v086-photoHint { font-size: 11px; color: #64748b; font-weight: 600; }

/* --------------------------------------------------------------------------
   4. Pen buttons: the preview draws the real line, not a different emoji.
   -------------------------------------------------------------------------- */
.ialPenTool .ialGlyph {
  display: block; width: 26px; height: 18px;
}
.ialPenTool .ialGlyph svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ialPenTool.active { border-color: #4F46E5 !important; background: #eef2ff !important; }

/* --------------------------------------------------------------------------
   5. Loading: a grey block, not the word "Loading".
   -------------------------------------------------------------------------- */
.v086-skeleton {
  border-radius: 10px; background: linear-gradient(100deg, #eef2f7 30%, #f7fafc 50%, #eef2f7 70%);
  background-size: 220% 100%; animation: v086shimmer 1.25s ease-in-out infinite;
}
/* Hidden until the load outstays the delay - the point of the delay is that
   a fast answer never shows a skeleton at all. */
.v086-skeletonWrap { display: none; padding: 12px; }
.v086-skeletonWrap.v086-when { display: block; }
.v086-skeleton.q { min-height: 320px; }
.v086-skeleton.line { height: 14px; margin-bottom: 10px; }
@keyframes v086shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }

/* --------------------------------------------------------------------------
   6. A short question should not leave a hole under it.
   `safe centre` so a tall paper still scrolls from its top rather than the
   browser cropping the first line (plain flex centre does exactly that).
   -------------------------------------------------------------------------- */
#workspaceQuestionPdf,
#questionPaperInner {
  display: flex; flex-direction: column; justify-content: safe center;
  min-height: 100%;
}
#workspaceQuestionPdf img { display: block; max-width: 100%; height: auto; margin-inline: auto; }

/* --------------------------------------------------------------------------
   7. Paywall.
   -------------------------------------------------------------------------- */
.v086-paywall { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(8, 20, 40, .55); backdrop-filter: blur(3px); }
.v086-paywall.show { display: flex; }
.v086-paywallCard {
  width: min(520px, 100%); max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 18px; padding: 26px 26px 22px;
  box-shadow: 0 26px 70px rgba(8, 20, 40, .4);
}
.v086-paywallCard h3 { margin: 0 0 6px; font-size: 21px; }
.v086-paywallCard .v086-paywallLead { margin: 0 0 16px; font-size: 13px; color: #475569; font-weight: 600; }
.v086-paywallCard ul { margin: 0 0 16px; padding-left: 20px; font-size: 13.5px; color: #334155; }
.v086-paywallCard ul li { margin-bottom: 5px; }
.v086-prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.v086-price {
  border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 12px 8px; text-align: center; cursor: pointer;
  background: #fff;
}
.v086-price.selected { border-color: #4F46E5; background: #f5f3ff; }
.v086-price b { display: block; font-size: 19px; color: #312e81; }
.v086-price small { font-size: 11px; color: #64748b; font-weight: 700; }
.v086-price .v086-best { display: inline-block; margin-top: 5px; font-size: 10px; font-weight: 900; color: #fff; background: #4F46E5; border-radius: 999px; padding: 2px 7px; }
.v086-paywallActions { display: flex; gap: 10px; }
.v086-paywallActions .v086-primary {
  flex: 1; background: linear-gradient(135deg, #4F46E5, #6D28D9); color: #fff; border: 0;
  border-radius: 11px; padding: 12px; font-weight: 800; font-size: 14px; cursor: pointer;
}
.v086-paywallActions .v086-secondary {
  border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 11px;
  padding: 12px 16px; font-weight: 800; font-size: 13px; cursor: pointer;
}
.v086-paywallClose { position: absolute; top: 14px; right: 18px; border: 0; background: none; font-size: 22px; color: #94a3b8; cursor: pointer; }

/* Locked Summary chapters keep a readable preview instead of a dead panel.
   The blur alone reads as broken, so the caption names what is behind it. */
.v086-summaryLock { filter: blur(3.2px); user-select: none; pointer-events: none; }
.v086-lockNote {
  display: block; margin-top: 6px;
  font-size: 11px; font-weight: 800; color: #7c3aed;
  background: #f5f3ff; border: 1px solid #ddd6fe;
  border-radius: 999px; padding: 3px 9px;
}
