.sidebar-nav[data-active-section="revision"] { --sidebar-active-y: 114px; }
body.revision-open .workspace,
body.revision-open .mobile-switcher,
body.revision-open .support-chat { visibility: hidden; pointer-events: none; }
body.revision-open .topbar :is(.document-name, .view-mode-switcher, .page-settings-button, .page-settings-popover, .download-button, .download-menu) { display: none !important; }
body.revision-open .topbar .top-actions { margin-inline-start: auto; }

/* The study space uses the application's own palette: ink on warm white, black actions. */
#revisionView {
  --rv-ink: #111111;
  --rv-text: rgba(17, 17, 17, 0.82);
  --rv-muted: rgba(17, 17, 17, 0.58);
  --rv-line: rgba(17, 17, 17, 0.12);
  --rv-line-strong: rgba(17, 17, 17, 0.22);
  --rv-surface: #ffffff;
  --rv-canvas: #fbfbf9;
  --rv-wash: rgba(17, 17, 17, 0.05);
  --rv-gold: #e8940f;
  --rv-gold-soft: #fff5df;
  --rv-ok: #15803d;
  --rv-ok-soft: #ecfdf3;
  --rv-bad: #b42318;
  --rv-bad-soft: #fef3f2;
  position: fixed;
  inset: var(--topbar-height) 0 0 var(--sidebar-width);
  z-index: 97;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--rv-canvas);
  padding: clamp(22px, 3.4vw, 44px) clamp(18px, 4vw, 48px) 56px;
  color: var(--rv-ink);
  font-family: var(--ui-font, "Instrument Sans", Helvetica, Arial, sans-serif);
}
body.sidebar-collapsed #revisionView { left: 0; }
#revisionView * { min-width: 0; }
#revisionView button { cursor: pointer; font-family: inherit; }
#revisionView button:disabled { cursor: default; }
#revisionView :is(button, input, summary):focus-visible,
.revision-intent-card:focus-visible,
.revision-onboarding-back:focus-visible { outline: 3px solid rgba(232, 148, 15, 0.7); outline-offset: 3px; }
.revision-shell { width: 100%; max-width: 1120px; margin-inline: auto; }
.revision-sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Header */
.revision-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: clamp(22px, 3vw, 34px); }
.revision-header h1 { max-width: 760px; margin: 0; font-size: clamp(30px, 3.7vw, 48px); line-height: 1.04; letter-spacing: -0.035em; font-weight: 780; overflow-wrap: anywhere; text-wrap: balance; }
.revision-subtitle { max-width: 560px; margin: 14px 0 0; color: var(--rv-muted); font-size: 17px; line-height: 1.5; font-weight: 500; }
.revision-header.has-result { align-items: center; margin-bottom: 16px; }
.revision-file-chip { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin: 0; color: var(--rv-text); font-size: 14px; font-weight: 620; }
.revision-file-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.revision-close { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--rv-line); border-radius: 10px; background: var(--rv-surface); color: var(--rv-ink); transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease; }
.revision-close:hover { border-color: var(--rv-line-strong); background: #fafafa; transform: translateY(-1px); }
.revision-close svg { width: 16px; height: 16px; }
.revision-message { margin-bottom: 18px; padding: 13px 16px; border: 1px solid #f3c7c1; border-radius: 12px; background: var(--rv-bad-soft); color: var(--rv-bad); font-size: 14px; line-height: 1.5; font-weight: 560; }

/* Buttons */
.revision-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 9px 16px; border: 1px solid var(--rv-line-strong); border-radius: 10px; background: var(--rv-surface); color: var(--rv-ink); font-size: 14px; font-weight: 640; line-height: 1.25; text-align: center; white-space: normal; transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease; }
.revision-button:hover:not(:disabled) { background: #f6f6f4; border-color: rgba(17, 17, 17, 0.34); transform: translateY(-1px); }
.revision-button:disabled { opacity: 0.5; }
.revision-button.revision-primary { border-color: var(--rv-ink); background: var(--rv-ink); color: #ffffff; box-shadow: rgba(0, 0, 0, 0.14) 0 10px 20px, inset rgba(255, 255, 255, 0.08) 0 1px 0; }
.revision-button.revision-primary:hover:not(:disabled) { background: #000000; border-color: #000000; }
.revision-button.revision-primary:disabled { opacity: 1; border-color: transparent; background: rgba(17, 17, 17, 0.1); color: rgba(17, 17, 17, 0.42); box-shadow: none; }
.revision-button.revision-primary.is-working:disabled { background: var(--rv-ink); color: #ffffff; }
.revision-text-button { border: 0; padding: 6px 4px; background: none; color: var(--rv-muted); font-size: 13.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.revision-text-button:hover:not(:disabled) { color: var(--rv-ink); }
.revision-spinner { flex: 0 0 auto; width: 17px; height: 17px; border: 2px solid rgba(17, 17, 17, 0.16); border-top-color: var(--rv-ink); border-radius: 50%; animation: revision-spin 0.8s linear infinite; }
.revision-primary .revision-spinner { border-color: rgba(255, 255, 255, 0.3); border-top-color: #ffffff; }
@keyframes revision-spin { to { transform: rotate(360deg); } }

/* Start: drop a course */
.revision-start-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); align-items: start; gap: clamp(26px, 4.4vw, 64px); }
.revision-dropzone { min-height: 292px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 34px 24px; border: 1.5px dashed var(--rv-line-strong); border-radius: 22px; background: var(--rv-surface); text-align: center; cursor: pointer; transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease; }
.revision-dropzone:hover { border-color: rgba(17, 17, 17, 0.5); box-shadow: rgba(20, 20, 20, 0.06) 0 14px 34px; }
.revision-dropzone.is-dragging { border-style: solid; border-color: var(--rv-gold); background: var(--rv-gold-soft); }
.revision-dropzone.has-file, .revision-dropzone.is-reading { cursor: default; }
.revision-dropzone.has-file { min-height: 0; align-items: stretch; gap: 18px; padding: 22px; border-style: solid; border-color: var(--rv-line); text-align: start; }
.revision-dropzone.has-file:hover { border-color: var(--rv-line); box-shadow: none; }
.revision-dropzone h2 { max-width: 100%; margin: 18px 0 4px; font-size: 21px; line-height: 1.25; letter-spacing: -0.012em; font-weight: 720; overflow-wrap: anywhere; }
.revision-dropzone p { margin: 0 0 18px; color: var(--rv-muted); font-size: 14.5px; line-height: 1.45; font-weight: 500; }
.revision-dropzone.is-reading h2 { margin-top: 14px; font-size: 17px; font-weight: 640; }
.revision-file-stack { position: relative; width: 104px; height: 92px; }
.revision-file-stack span { position: absolute; top: 9px; inset-inline-start: 38px; width: 60px; height: 76px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px; border: 1px solid rgba(232, 148, 15, 0.35); border-radius: 10px; background: var(--rv-gold-soft); color: #a3600a; font-size: 11px; font-weight: 800; letter-spacing: 0.03em; box-shadow: rgba(20, 20, 20, 0.1) 0 10px 22px; transform: rotate(9deg); }
.revision-file-stack span:first-child { top: 2px; inset-inline-start: 4px; align-items: flex-start; justify-content: flex-start; padding: 11px 0 0 8px; border-color: var(--rv-line); background: #ffffff; color: var(--rv-muted); font-size: 9.5px; box-shadow: rgba(20, 20, 20, 0.07) 0 8px 18px; transform: rotate(-10deg); }
.revision-file-card { display: flex; align-items: center; gap: 14px; }
.revision-file-card h2 { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 700; }
.revision-file-card p { display: flex; align-items: center; gap: 7px; margin: 5px 0 0; font-size: 13.5px; }
.revision-ready-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--rv-ok); }
.revision-file-badge, .revision-history-icon { flex: 0 0 auto; display: grid; place-items: center; width: 46px; height: 54px; border: 1px solid rgba(232, 148, 15, 0.35); border-radius: 10px; background: var(--rv-gold-soft); color: #a3600a; font-size: 10px; font-weight: 800; letter-spacing: 0.03em; }
.revision-file-chip .revision-file-badge { width: 38px; height: 24px; border-radius: 7px; font-size: 9.5px; }
.revision-file-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.revision-preview { margin-top: 12px; border: 1px solid var(--rv-line); border-radius: 12px; background: var(--rv-surface); font-size: 13.5px; }
.revision-preview summary { cursor: pointer; padding: 12px 14px; color: var(--rv-text); font-weight: 600; }
.revision-preview p { max-height: 180px; margin: 0; padding: 0 14px 14px; overflow: auto; color: var(--rv-muted); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.revision-generate-row { margin-top: 16px; }
.revision-generate-row .revision-button { width: 100%; min-height: 56px; border-radius: 14px; font-size: 16.5px; font-weight: 700; }

/* A picture of the result: the sheet and its quiz. Decorative, hidden from assistive technology. */
.revision-showcase { position: relative; padding: 6px 8px 150px 0; pointer-events: none; user-select: none; }
.rv-demo-sheet, .rv-demo-quiz { border: 1px solid var(--rv-line); border-radius: 20px; background: var(--rv-surface); box-shadow: rgba(20, 20, 20, 0.1) 0 24px 54px; }
.rv-demo-sheet { padding: 24px; transform: rotate(-1.6deg); }
.rv-demo-quiz { position: absolute; inset-inline-end: 0; bottom: 6px; width: 50%; padding: 16px; transform: rotate(2.6deg); }
.rv-demo-tag { display: inline-block; margin-bottom: 14px; padding: 5px 10px; border-radius: 999px; background: var(--rv-ink); color: #ffffff; font-size: 11.5px; line-height: 1; font-weight: 700; }
.rv-demo-quiz .rv-demo-tag { background: var(--rv-gold-soft); color: #a3600a; }
.revision-showcase i { display: block; height: 8px; border-radius: 999px; background: rgba(17, 17, 17, 0.1); }
.rv-bar-title { width: 72%; height: 20px !important; border-radius: 7px !important; background: var(--rv-ink) !important; }
.rv-bar-sub { width: 48%; margin-top: 10px; }
.rv-demo-quiz .rv-bar { width: 88%; height: 10px; background: rgba(17, 17, 17, 0.72); }
.rv-demo-quiz .rv-bar-sub { width: 54%; margin-top: 7px; }
.rv-demo-dark { display: grid; gap: 9px; margin-top: 20px; padding: 16px; border-radius: 14px; background: var(--rv-ink); }
.rv-demo-dark i { background: rgba(255, 255, 255, 0.5); }
.rv-demo-dark i:last-child { width: 62%; }
.rv-demo-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.rv-demo-keys span { display: grid; gap: 7px; padding: 12px; border-radius: 12px; background: var(--rv-gold-soft); }
.rv-demo-keys b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #ffffff; color: #a3600a; font-size: 11.5px; font-weight: 800; }
.rv-demo-keys i { background: rgba(163, 96, 10, 0.24); }
.rv-demo-keys i:last-child { width: 66%; }
.rv-demo-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 12px; }
.rv-demo-steps span { position: relative; padding: 13px 12px; border: 1px solid var(--rv-line); border-radius: 12px; }
.rv-demo-steps span:not(:last-child)::after { content: ""; position: absolute; top: 50%; inset-inline-end: -15px; width: 7px; height: 7px; border-top: 2px solid rgba(17, 17, 17, 0.4); border-inline-end: 2px solid rgba(17, 17, 17, 0.4); transform: translateY(-50%) rotate(45deg); }
[dir="rtl"] .rv-demo-steps span:not(:last-child)::after { transform: translateY(-50%) rotate(-45deg); }
.rv-demo-quiz ul { display: grid; gap: 7px; margin: 14px 0 0; padding: 0; list-style: none; }
.rv-demo-quiz li { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--rv-line); border-radius: 10px; }
.rv-demo-quiz li b { flex: 0 0 20px; display: grid; place-items: center; height: 20px; border-radius: 6px; background: var(--rv-wash); font-size: 10.5px; font-weight: 800; }
.rv-demo-quiz li i { flex: 1; }
.rv-demo-quiz li.is-correct { border-color: rgba(21, 128, 61, 0.45); background: var(--rv-ok-soft); }
.rv-demo-quiz li.is-correct b { background: var(--rv-ok); color: #ffffff; }
.rv-demo-quiz li.is-correct i { background: rgba(21, 128, 61, 0.3); }
.revision-start-grid.is-generating .rv-demo-sheet i { animation: revision-shimmer 1.3s ease-in-out infinite; }
.revision-start-grid.is-generating .rv-demo-sheet i:nth-child(even) { animation-delay: 0.22s; }
@keyframes revision-shimmer { 50% { opacity: 0.35; } }

/* Saved sheets */
.revision-history { margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--rv-line); }
.revision-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.revision-section-heading h2 { margin: 0; font-size: 17px; font-weight: 720; letter-spacing: -0.01em; }
.revision-history-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.revision-history-row { display: flex; border: 1px solid var(--rv-line); border-radius: 14px; background: var(--rv-surface); transition: border-color 120ms ease, transform 120ms ease; }
.revision-history-row:hover { border-color: var(--rv-line-strong); transform: translateY(-1px); }
.revision-history-row > button:first-child { flex: 1; display: flex; align-items: center; gap: 13px; padding: 12px 14px; border: 0; background: none; color: inherit; text-align: start; }
.revision-history-row strong { display: block; overflow: hidden; font-size: 14.5px; line-height: 1.35; font-weight: 660; text-overflow: ellipsis; white-space: nowrap; }
.revision-history-row small { display: block; margin-top: 3px; overflow: hidden; color: var(--rv-muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.revision-history-icon { width: 38px; height: 46px; font-size: 9px; }
.revision-history-delete { flex: 0 0 40px; border: 0; background: transparent; color: var(--rv-muted); font-size: 21px; line-height: 1; }
.revision-history-delete:hover:not(:disabled) { color: var(--rv-bad); }

/* Result toolbar */
.revision-toolbar { position: sticky; top: calc(-1 * clamp(22px, 3.4vw, 44px)); z-index: 3; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin: 0 -6px 22px; padding: 10px 6px; background: rgba(251, 251, 249, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.revision-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: rgba(17, 17, 17, 0.06); }
.revision-tabs button { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 18px; border: 0; border-radius: 10px; background: transparent; color: var(--rv-muted); font-size: 14px; font-weight: 660; transition: background-color 120ms ease, color 120ms ease; }
.revision-tabs button:hover { color: var(--rv-ink); }
.revision-tabs button[aria-selected="true"] { background: var(--rv-ink); color: #ffffff; }
.revision-tabs span { min-width: 20px; padding: 2px 6px; border-radius: 6px; background: rgba(17, 17, 17, 0.08); font-size: 11.5px; line-height: 1.3; text-align: center; }
.revision-tabs button[aria-selected="true"] span { background: rgba(255, 255, 255, 0.2); }
.revision-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.revision-toolbar-actions .revision-button { min-height: 40px; padding: 8px 14px; font-size: 13.5px; }

/* Earlier illustrated sheets keep their own document frame. */
.revision-illustrated { max-width: 794px; margin-inline: auto; overflow: hidden; border: 1px solid #e1ddcd; border-radius: 6px; background: #f7f3df; box-shadow: rgba(20, 20, 20, 0.07) 0 14px 40px; }
.revision-illustrated-frame { display: block; width: 100%; min-height: 240px; height: 1123px; border: 0; background: #f7f3df; }
.revision-illustrated-source { margin: 0; padding: 12px 20px; border-top: 1px solid #e1ddcd; color: #797567; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

/* ---------- The designed sheet ---------- */
.rs-sheet {
  --rs-accent: #2563eb; --rs-soft: #eef4ff; --rs-deep: #1e3a8a; --rs-light: #93c5fd;
  max-width: 860px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 58px);
  border: 1px solid var(--rv-line, rgba(17, 17, 17, 0.12));
  border-radius: 24px;
  background: #ffffff;
  box-shadow: rgba(20, 20, 20, 0.08) 0 22px 60px;
  color: #111111;
  overflow-wrap: anywhere;
}
.rs-sheet[data-accent="green"] { --rs-accent: #15803d; --rs-soft: #ecfdf3; --rs-deep: #14532d; --rs-light: #86efac; }
.rs-sheet[data-accent="violet"] { --rs-accent: #7c3aed; --rs-soft: #f4efff; --rs-deep: #4c1d95; --rs-light: #c4b5fd; }
.rs-sheet[data-accent="rose"] { --rs-accent: #e11d48; --rs-soft: #fff0f3; --rs-deep: #881337; --rs-light: #fda4af; }
.rs-sheet[data-accent="amber"] { --rs-accent: #d97706; --rs-soft: #fff5df; --rs-deep: #7c2d12; --rs-light: #fcd34d; }
.rs-sheet[data-accent="teal"] { --rs-accent: #0d9488; --rs-soft: #e9fbf8; --rs-deep: #134e4a; --rs-light: #5eead4; }
.rs-sheet :is(h2, h3, p, ol, ul, dl, dd, figure) { margin: 0; }
.rs-sheet :is(ol, ul) { padding: 0; list-style: none; }
.rs-title { font-size: clamp(31px, 4.6vw, 48px); line-height: 1.04; letter-spacing: -0.035em; font-weight: 790; text-wrap: balance; }
.rs-title::after { content: ""; display: block; width: 56px; height: 6px; margin-top: 18px; border-radius: 999px; background: var(--rs-accent); }
.rs-subtitle { max-width: 640px; margin-top: 16px !important; color: rgba(17, 17, 17, 0.62); font-size: 18px; line-height: 1.45; font-weight: 520; }
.rs-sheet h3 { font-size: 12.5px; line-height: 1.2; letter-spacing: 0.1em; font-weight: 780; text-transform: uppercase; }
.rs-overview { margin-top: 30px !important; padding: 24px 26px; border-radius: 20px; background: #111111; color: #ffffff; }
.rs-overview h3 { color: var(--rs-light); }
.rs-overview p { margin-top: 10px; font-size: 19px; line-height: 1.46; font-weight: 540; }
.rs-keys { margin-top: 28px !important; }
.rs-keys h3, .rs-terms h3 { color: rgba(17, 17, 17, 0.55); }
.rs-keys ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.rs-keys li { display: grid; align-content: start; gap: 11px; padding: 16px 17px 18px; border-radius: 18px; background: var(--rs-soft); }
/* No orphan card: four points sit two by two, five as three then two. */
.rs-keys:is([data-count="4"], [data-count="2"]) ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rs-keys:is([data-count="3"], [data-count="6"]) ol { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rs-keys[data-count="5"] ol { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.rs-keys[data-count="5"] li { grid-column: span 2; }
.rs-keys[data-count="5"] li:nth-child(n + 4) { grid-column: span 3; }
.rs-keys:is([data-count="7"], [data-count="8"]) ol { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rs-keys b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #ffffff; color: var(--rs-accent); font-size: 14px; font-weight: 800; }
.rs-keys p { color: var(--rs-deep); font-size: 15.5px; line-height: 1.42; font-weight: 620; }
.rs-section { margin-top: 34px; padding-top: 30px; border-top: 1px solid rgba(17, 17, 17, 0.1); }
.rs-section > header { display: flex; align-items: center; gap: 13px; }
.rs-index { flex: 0 0 34px; display: grid; place-items: center; height: 34px; border-radius: 11px; background: var(--rs-accent); color: #ffffff; font-size: 16px; font-weight: 800; }
.rs-section h3 { font-size: clamp(21px, 2.5vw, 25px); line-height: 1.18; letter-spacing: -0.02em; font-weight: 760; text-transform: none; }
.rs-summary { margin-top: 14px !important; font-size: 17px; line-height: 1.5; font-weight: 620; }
.rs-points { display: grid; gap: 9px; margin-top: 13px !important; }
.rs-points li { position: relative; padding-inline-start: 22px; color: rgba(17, 17, 17, 0.8); font-size: 15.5px; line-height: 1.55; }
.rs-points li::before { content: ""; position: absolute; top: 0.62em; inset-inline-start: 3px; width: 8px; height: 8px; border-radius: 3px; background: var(--rs-accent); }

/* Visuals */
.rs-visual { margin-top: 20px !important; padding: 20px; border: 1px solid rgba(17, 17, 17, 0.1); border-radius: 20px; background: #fbfbf9; }
.rs-visual figcaption { margin-bottom: 14px; font-size: 14px; line-height: 1.3; font-weight: 740; }
.rs-visual strong { display: block; font-size: 15px; line-height: 1.3; font-weight: 720; }
.rs-visual li > span, .rs-timeline div > span { display: block; margin-top: 5px; color: rgba(17, 17, 17, 0.66); font-size: 13.5px; line-height: 1.45; }
.rs-steps ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 26px; counter-reset: none; }
.rs-steps li { position: relative; padding: 15px 15px 16px; border: 1px solid rgba(17, 17, 17, 0.1); border-radius: 16px; background: #ffffff; }
.rs-steps li > b { display: grid; place-items: center; width: 26px; height: 26px; margin-bottom: 10px; border-radius: 9px; background: var(--rs-soft); color: var(--rs-accent); font-size: 13px; font-weight: 800; }
.rs-steps li:not(:last-child)::after { content: ""; position: absolute; top: 50%; inset-inline-end: -17px; width: 8px; height: 8px; border-top: 2.5px solid var(--rs-accent); border-inline-end: 2.5px solid var(--rs-accent); transform: translateY(-50%) rotate(45deg); }
[dir="rtl"] .rs-steps li:not(:last-child)::after { transform: translateY(-50%) rotate(-45deg); }
.rs-steps:is([data-count="5"], [data-count="6"]) ol { grid-template-columns: 1fr; gap: 22px; }
.rs-steps:is([data-count="5"], [data-count="6"]) li { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 13px; align-items: start; }
.rs-steps:is([data-count="5"], [data-count="6"]) li > b { grid-row: span 2; margin: 0; }
.rs-steps:is([data-count="5"], [data-count="6"]) li > span { grid-column: 2; }
.rs-steps:is([data-count="5"], [data-count="6"]) li:not(:last-child)::after,
[dir="rtl"] .rs-steps:is([data-count="5"], [data-count="6"]) li:not(:last-child)::after { top: auto; bottom: -15px; inset-inline-end: auto; inset-inline-start: 24px; transform: rotate(135deg); }
.rs-steps.is-loop ol::after { content: "↻"; grid-column: 1 / -1; justify-self: center; display: grid; place-items: center; width: 34px; height: 34px; margin-top: -8px; border-radius: 50%; background: var(--rs-soft); color: var(--rs-accent); font-size: 19px; font-weight: 800; line-height: 1; }
.rs-timeline ol { position: relative; display: grid; gap: 18px; }
.rs-timeline ol::before { content: ""; position: absolute; top: 8px; bottom: 8px; inset-inline-start: 139px; width: 2px; border-radius: 2px; background: rgba(17, 17, 17, 0.12); }
.rs-timeline li { position: relative; display: grid; grid-template-columns: 118px minmax(0, 1fr); column-gap: 44px; align-items: start; }
.rs-timeline li::before { content: ""; position: absolute; top: 5px; inset-inline-start: 133px; width: 14px; height: 14px; border: 3px solid #fbfbf9; border-radius: 50%; background: var(--rs-accent); box-sizing: border-box; }
.rs-timeline time { justify-self: end; padding: 4px 10px; border-radius: 9px; background: var(--rs-soft); color: var(--rs-deep); font-size: 13px; line-height: 1.3; font-weight: 760; text-align: center; }
.rs-compare-scroll { overflow-x: auto; }
.rs-compare table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; line-height: 1.45; }
.rs-compare :is(th, td) { padding: 12px 14px; border-bottom: 1px solid rgba(17, 17, 17, 0.09); text-align: start; vertical-align: top; }
.rs-compare thead td { border-bottom: 0; }
.rs-compare thead th { border-bottom: 0; background: var(--rs-soft); color: var(--rs-deep); font-size: 14px; font-weight: 760; }
.rs-compare thead th:first-of-type { border-start-start-radius: 12px; border-end-start-radius: 12px; }
.rs-compare thead th:last-child { border-start-end-radius: 12px; border-end-end-radius: 12px; }
.rs-compare tbody th { width: 26%; font-weight: 720; }
.rs-compare tbody td { color: rgba(17, 17, 17, 0.8); }
.rs-compare tbody tr:last-child :is(th, td) { border-bottom: 0; }
.rs-tree-root { position: relative; width: fit-content; max-width: 100%; margin: 0 auto 26px; padding: 11px 18px; border-radius: 13px; background: var(--rs-accent); color: #ffffff; text-align: center; }
.rs-tree-root strong { font-size: 15.5px; }
.rs-tree-root::after { content: ""; position: absolute; top: 100%; left: calc(50% - 1px); width: 2px; height: 13px; background: rgba(17, 17, 17, 0.2); }
.rs-tree > ul { --rs-n: 2; position: relative; display: grid; grid-template-columns: repeat(var(--rs-n), minmax(0, 1fr)); gap: 12px; }
.rs-tree[data-count="3"] > ul { --rs-n: 3; }
.rs-tree[data-count="4"] > ul { --rs-n: 4; }
.rs-tree[data-count="5"] > ul { --rs-n: 5; }
.rs-tree > ul::before { content: ""; position: absolute; top: -13px; height: 2px; left: calc((100% - (var(--rs-n) - 1) * 12px) / (2 * var(--rs-n))); right: calc((100% - (var(--rs-n) - 1) * 12px) / (2 * var(--rs-n))); background: rgba(17, 17, 17, 0.2); }
.rs-tree > ul > li { position: relative; padding: 14px; border: 1px solid rgba(17, 17, 17, 0.1); border-top: 3px solid var(--rs-accent); border-radius: 14px; background: #ffffff; }
.rs-tree > ul > li::before { content: ""; position: absolute; top: -16px; left: calc(50% - 1px); width: 2px; height: 13px; background: rgba(17, 17, 17, 0.2); }
.rs-tree li ul { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rs-tree li li { padding: 4px 9px; border-radius: 8px; background: var(--rs-soft); color: var(--rs-deep); font-size: 12.5px; line-height: 1.3; font-weight: 640; }
.rs-formula-expression { padding: 20px 18px; border-radius: 16px; background: var(--rs-soft); color: var(--rs-deep); font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", Georgia, "Times New Roman", serif; font-size: clamp(21px, 3.2vw, 30px); line-height: 1.3; font-weight: 600; text-align: center; }
.rs-formula dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 9px 14px; margin-top: 14px; }
.rs-formula dl > div { display: flex; align-items: baseline; gap: 10px; }
.rs-formula dt { flex: 0 0 auto; min-width: 30px; padding: 3px 8px; border-radius: 8px; background: #ffffff; border: 1px solid rgba(17, 17, 17, 0.12); font-size: 14px; font-weight: 720; text-align: center; }
.rs-formula dd { color: rgba(17, 17, 17, 0.76); font-size: 14px; line-height: 1.4; }
.rs-figures ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.rs-figures li { padding: 16px; border-radius: 16px; background: #ffffff; border: 1px solid rgba(17, 17, 17, 0.1); }
.rs-figures strong { color: var(--rs-accent); font-size: clamp(24px, 3.2vw, 32px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; }
.rs-terms { margin-top: 34px !important; padding-top: 30px; border-top: 1px solid rgba(17, 17, 17, 0.1); }
.rs-terms dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.rs-terms dl > div { padding: 15px 17px; border: 1px solid rgba(17, 17, 17, 0.1); border-radius: 16px; background: #fbfbf9; }
.rs-terms dt { font-size: 15.5px; line-height: 1.3; font-weight: 740; }
.rs-terms dd { margin-top: 5px; color: rgba(17, 17, 17, 0.72); font-size: 14.5px; line-height: 1.48; }
.rs-foot { margin-top: 30px; padding-top: 16px; border-top: 1px solid rgba(17, 17, 17, 0.1); color: rgba(17, 17, 17, 0.5); font-size: 12.5px; line-height: 1.4; }

/* Quiz */
.revision-quiz-card { max-width: 760px; margin: 0 auto; padding: clamp(22px, 4vw, 44px); border: 1px solid var(--rv-line); border-radius: 24px; background: var(--rv-surface); box-shadow: rgba(20, 20, 20, 0.08) 0 22px 60px; }
.revision-eyebrow { margin: 0; color: var(--rv-muted); font-size: 13px; line-height: 1.3; font-weight: 700; }
.revision-quiz-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.revision-quiz-heading > span { padding: 4px 10px; border-radius: 999px; background: var(--rv-wash); color: var(--rv-text); font-size: 13px; font-weight: 700; }
.revision-quiz-progress { display: block; width: 100%; height: 6px; margin: 14px 0 26px; overflow: hidden; border: 0; border-radius: 999px; background: rgba(17, 17, 17, 0.08); color: var(--rv-ink); }
.revision-quiz-progress::-webkit-progress-bar { background: rgba(17, 17, 17, 0.08); }
.revision-quiz-progress::-webkit-progress-value { border-radius: 999px; background: var(--rv-ink); }
.revision-quiz-progress::-moz-progress-bar { border-radius: 999px; background: var(--rv-ink); }
.revision-quiz-card fieldset { margin: 0; padding: 0; border: 0; }
.revision-quiz-card legend { margin-bottom: 22px; padding: 0; font-size: clamp(21px, 2.5vw, 27px); line-height: 1.3; letter-spacing: -0.015em; font-weight: 720; overflow-wrap: anywhere; }
.revision-quiz-options { display: grid; gap: 10px; margin-bottom: 22px; }
.revision-quiz-option { display: flex; align-items: center; gap: 13px; min-height: 56px; padding: 13px 15px; border: 1.5px solid var(--rv-line); border-radius: 15px; background: var(--rv-surface); cursor: pointer; font-size: 15.5px; line-height: 1.45; font-weight: 540; transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease; }
.revision-quiz-option:hover:not(:has(input:disabled)) { border-color: rgba(17, 17, 17, 0.4); transform: translateY(-1px); }
.revision-quiz-option input { position: absolute; opacity: 0; pointer-events: none; }
.revision-option-letter { flex: 0 0 30px; display: grid; place-items: center; height: 30px; border-radius: 9px; background: var(--rv-wash); color: var(--rv-ink); font-size: 13px; font-weight: 800; }
.revision-quiz-option:has(input:checked) { border-color: var(--rv-ink); background: #fafafa; }
.revision-quiz-option:has(input:checked) .revision-option-letter { background: var(--rv-ink); color: #ffffff; }
.revision-quiz-option:has(input:focus-visible) { outline: 3px solid rgba(232, 148, 15, 0.7); outline-offset: 2px; }
/* A checked answer shows its verdict, which outranks the plain "selected" look. */
.revision-quiz-options .revision-quiz-option.is-correct { border-color: rgba(21, 128, 61, 0.6); background: var(--rv-ok-soft); }
.revision-quiz-options .revision-quiz-option.is-correct .revision-option-letter { background: var(--rv-ok); color: #ffffff; }
.revision-quiz-options .revision-quiz-option.is-incorrect { border-color: rgba(180, 35, 24, 0.5); background: var(--rv-bad-soft); }
.revision-quiz-options .revision-quiz-option.is-incorrect .revision-option-letter { background: var(--rv-bad); color: #ffffff; }
.revision-quiz-option:has(input:disabled) { cursor: default; }
.revision-quiz-card > .revision-button { width: 100%; min-height: 54px; border-radius: 14px; font-size: 16px; font-weight: 700; }
.revision-feedback { margin: 0 0 20px; padding: 15px 17px; border-radius: 15px; background: var(--rv-wash); font-size: 15px; line-height: 1.5; }
.revision-feedback strong { font-weight: 760; }
.revision-quiz-card:has(.revision-quiz-option.is-incorrect) .revision-feedback { background: var(--rv-bad-soft); }
.revision-quiz-card:has(.revision-quiz-option.is-incorrect) .revision-feedback strong { color: var(--rv-bad); }
.revision-quiz-card:has(.revision-quiz-option.is-correct):not(:has(.revision-quiz-option.is-incorrect)) .revision-feedback { background: var(--rv-ok-soft); }
.revision-quiz-card:has(.revision-quiz-option.is-correct):not(:has(.revision-quiz-option.is-incorrect)) .revision-feedback strong { color: var(--rv-ok); }
.revision-feedback p { margin: 5px 0 0; color: var(--rv-text); }
.revision-results > .revision-eyebrow, .revision-results > h2 { text-align: center; }
.revision-results h2 { margin: 6px 0 0; font-size: 24px; letter-spacing: -0.02em; font-weight: 740; }
.revision-score { padding: 10px 0 22px; font-size: clamp(64px, 12vw, 96px); line-height: 1.05; letter-spacing: -0.06em; font-weight: 800; text-align: center; }
.revision-result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.revision-answer-review { margin-top: 32px; }
.revision-answer-review section { padding: 20px 0; border-top: 1px solid var(--rv-line); }
.revision-answer-review h3 { margin: 10px 0 8px; font-size: 16px; line-height: 1.45; font-weight: 700; }
.revision-answer-review p { margin: 0 0 4px; color: var(--rv-text); font-size: 14.5px; line-height: 1.55; }
.revision-answer-badge { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 760; }
.revision-answer-badge.is-correct { background: var(--rv-ok-soft); color: var(--rv-ok); }
.revision-answer-badge.is-incorrect { background: var(--rv-bad-soft); color: var(--rv-bad); }

/* Onboarding: what would you like to do? */
.revision-intent-step { width: min(720px, 100%) !important; }
.revision-intent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 25px; }
.revision-intent-card { display: flex; flex-direction: column; align-items: flex-start; gap: 13px; padding: 23px 18px; border: 1px solid rgba(17, 17, 17, 0.12); border-radius: 14px; background: #ffffff; color: #111111; text-align: start; cursor: pointer; transition: border-color 0.15s, background-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.revision-intent-card:hover { border-color: rgba(17, 17, 17, 0.34); transform: translateY(-1px); box-shadow: rgba(20, 20, 20, 0.08) 0 10px 26px; }
.revision-intent-card svg { width: 24px; height: 24px; color: #e8940f; }
.revision-intent-label { font-size: 17px; font-weight: 700; }
.revision-intent-description { color: rgba(17, 17, 17, 0.58); font-size: 13px; line-height: 1.55; }
/* Back is a text control, separate from the specialty form's primary button. */
.onboarding-card button.revision-onboarding-back {
  display: block;
  width: fit-content;
  height: auto;
  min-height: 0;
  margin: 0 auto 10px;
  padding: 8px 4px;
  border: 0;
  border-radius: 0;
  background: none;
  color: #62665e;
  box-shadow: none;
  font-size: 12px;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.onboarding-card button.revision-onboarding-back:hover {
  background: none;
  color: #111111;
  box-shadow: none;
  transform: none;
}

@media screen and (max-width: 1000px) {
  .revision-start-grid { grid-template-columns: 1fr; }
  .revision-showcase { display: none; }
  .revision-upload-panel { width: 100%; max-width: 640px; }
}
/* Screens only: an A4 page is narrower than this breakpoint but must keep the full layout. */
@media screen and (max-width: 760px) {
  #revisionView { inset-inline-start: 0; padding: 20px 16px 44px; }
  .revision-header { gap: 12px; margin-bottom: 22px; }
  .revision-header h1 { font-size: 31px; }
  .revision-subtitle { margin-top: 11px; font-size: 16px; }
  .revision-dropzone { min-height: 250px; padding: 28px 18px; border-radius: 20px; }
  .revision-dropzone.has-file { padding: 18px; }
  .revision-generate-row { position: sticky; bottom: 12px; z-index: 2; }
  .revision-history-list { grid-template-columns: 1fr; }
  /* On a phone only the two tabs stay pinned; the three actions scroll away with the page. */
  .revision-toolbar { display: contents; }
  .revision-tabs { position: sticky; top: -12px; z-index: 3; width: 100%; margin-bottom: 10px; background: #efefed; box-shadow: 0 0 0 8px var(--rv-canvas); }
  .revision-tabs button { flex: 1; justify-content: center; }
  .revision-toolbar-actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-bottom: 16px; }
  .revision-toolbar-actions .revision-button { min-height: 44px; padding: 6px 8px; font-size: 12.5px; }
  .rs-sheet { padding: 24px 18px 26px; border-radius: 20px; }
  .rs-subtitle { font-size: 16.5px; }
  .rs-overview { padding: 20px; border-radius: 18px; }
  .rs-overview p { font-size: 17.5px; }
  .rs-keys ol, .rs-keys[data-count] ol { grid-template-columns: 1fr; gap: 9px; }
  .rs-keys[data-count] li, .rs-keys[data-count] li:nth-child(n + 4) { grid-column: auto; }
  .rs-keys li { grid-template-columns: 28px minmax(0, 1fr); align-items: start; gap: 12px; padding: 14px 15px; }
  .rs-section { margin-top: 28px; padding-top: 26px; }
  .rs-summary { font-size: 16.5px; }
  .rs-visual { padding: 16px 14px; border-radius: 18px; }
  .rs-steps ol { grid-template-columns: 1fr; gap: 22px; }
  .rs-steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 13px; align-items: start; }
  .rs-steps li > b { grid-row: span 2; margin: 0; }
  .rs-steps li > span { grid-column: 2; }
  .rs-steps li:not(:last-child)::after,
  [dir="rtl"] .rs-steps li:not(:last-child)::after { top: auto; bottom: -15px; inset-inline-end: auto; inset-inline-start: 24px; transform: rotate(135deg); }
  .rs-timeline ol::before { inset-inline-start: 6px; }
  .rs-timeline li { grid-template-columns: 1fr; row-gap: 7px; padding-inline-start: 28px; }
  .rs-timeline li::before { inset-inline-start: 0; }
  .rs-timeline time { justify-self: start; }
  .rs-compare table, .rs-compare tbody, .rs-compare tr, .rs-compare :is(th, td) { display: block; width: auto; }
  .rs-compare thead { display: none; }
  .rs-compare tbody tr { padding: 14px; border: 1px solid rgba(17, 17, 17, 0.1); border-radius: 14px; background: #ffffff; }
  .rs-compare tbody tr + tr { margin-top: 10px; }
  .rs-compare tbody :is(th, td) { padding: 0; border: 0; }
  .rs-compare tbody th { width: auto; margin-bottom: 8px; font-size: 15.5px; }
  .rs-compare tbody td + td { margin-top: 9px; }
  .rs-compare tbody td::before { content: attr(data-label); display: block; width: fit-content; margin-bottom: 4px; padding: 2px 8px; border-radius: 7px; background: var(--rs-soft); color: var(--rs-deep); font-size: 12px; font-weight: 760; }
  .rs-tree-root { margin-bottom: 14px; }
  .rs-tree-root::after, .rs-tree > ul::before, .rs-tree > ul > li::before { display: none; }
  .rs-tree > ul { grid-template-columns: 1fr; gap: 9px; }
  .rs-tree > ul > li { border-top-width: 1px; border-inline-start: 3px solid var(--rs-accent); }
  .rs-figures ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .rs-figures li { padding: 14px; }
  .rs-terms dl { grid-template-columns: 1fr; gap: 9px; }
  .revision-quiz-card { padding: 22px 16px; border-radius: 20px; }
  .revision-quiz-option { padding: 12px; gap: 11px; font-size: 15px; }
  .revision-intent-grid { grid-template-columns: 1fr; gap: 10px; }
  .revision-intent-card { gap: 6px; padding: 17px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .revision-spinner, .revision-start-grid.is-generating .rv-demo-sheet i { animation: none; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  body.revision-printing { height: auto !important; overflow: visible !important; background: #fff !important; zoom: 1 !important; }
  body.revision-printing > :not(#revisionView) { display: none !important; }
  body.revision-printing #revisionView { display: block !important; position: static !important; overflow: visible !important; padding: 0 !important; background: #fff !important; }
  body.revision-printing .revision-header,
  body.revision-printing .revision-toolbar,
  body.revision-printing .revision-history,
  body.revision-printing .revision-message,
  body.revision-printing #revisionQuizPanel { display: none !important; }
  body.revision-printing #revisionSheetPanel { display: block !important; }
  body.revision-printing .rs-sheet { max-width: none; padding: 0 1px; border: 0; border-radius: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.revision-printing .rs-title { font-size: 30px; }
  body.revision-printing .rs-subtitle { font-size: 13px; }
  body.revision-printing .rs-overview { margin-top: 18px !important; padding: 15px 18px; }
  body.revision-printing .rs-overview p { font-size: 13.5px; }
  body.revision-printing .rs-keys p, body.revision-printing .rs-summary { font-size: 12px; }
  body.revision-printing :is(.rs-points li, .rs-terms dd, .rs-compare table, .rs-visual li > span, .rs-timeline div > span, .rs-formula dd) { font-size: 11px; }
  body.revision-printing .rs-section h3 { font-size: 17px; }
  body.revision-printing .rs-section { margin-top: 20px; padding-top: 18px; }
  body.revision-printing .rs-visual { padding: 14px; }
  body.revision-printing .rs-visual strong { font-size: 12.5px; }
  body.revision-printing .rs-figures strong { font-size: 22px; }
  body.revision-printing .rs-tree-root strong { font-size: 13px; }
  body.revision-printing .rs-steps ol { gap: 20px; }
  body.revision-printing .rs-steps li:not(:last-child)::after { inset-inline-end: -14px; }
  /* Cards stay whole; a tall visual may continue on the next page rather than leave half a page blank. */
  body.revision-printing :is(.rs-overview, .rs-keys li, .rs-terms dl > div, .rs-section > header, .rs-visual li, .rs-visual tr, .rs-tree-root, .rs-formula-expression, .rs-visual figcaption) { break-inside: avoid; }
  body.revision-printing .rs-visual figcaption { break-after: avoid; }
  body.revision-printing .rs-section > header { break-after: avoid; }
}
