/* qtypes-preview-r5 */
/* Sidebar + Question Types. Animate transform and opacity only.
   Hidden in Strict Exam and on the welcome gate. */

/* ---- Top bar: keep the logo next to the menu; shorten the name on a narrow phone ---- */
.topbar-start {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
#sidebar-toggle { margin-right: 2px; flex: none; }

body[data-route=exam] #sidebar-toggle,
body[data-route=reading-session] #sidebar-toggle,
html[data-gate=on] #sidebar-toggle,
body.rd-active #sidebar-toggle { display: none !important; }

@media (max-width: 520px) {
  .topbar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .topbar-start .brand-name {
    font-size: 0;
    line-height: 0;
    overflow: visible;
  }
  .topbar-start .brand-name::after {
    content: attr(data-short);
    font: 600 17px/1.1 var(--font-head, inherit);
    letter-spacing: -.01em;
    color: inherit;
    white-space: nowrap;
  }
}

/* ---- Sidebar backdrop + panel ---- */
.sb-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(16, 14, 12, .42);
  opacity: 0; pointer-events: none;
  transition: opacity 220ms ease;
}
html[data-theme=dark] .sb-backdrop { background: rgba(2, 3, 6, .58); }
html[data-motion=off] .sb-backdrop,
html[data-motion=none] .sb-backdrop { transition: none; }
.sb-backdrop.is-on { opacity: 1; pointer-events: auto; }

.sb-panel {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 81;
  width: min(320px, 88vw);
  display: flex; flex-direction: column;
  background: var(--surface, #FFFDF9);
  color: var(--ink, #1A1A1F);
  box-shadow: 8px 0 36px rgba(20, 18, 16, .16);
  border-right: 1px solid var(--line, #E4DED3);
  -webkit-transform: translateX(-105%);
  transform: translateX(-105%);
  transition: transform 580ms cubic-bezier(.18, .82, .22, 1);
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
}
html[data-theme=dark] .sb-panel { box-shadow: 8px 0 40px rgba(0, 0, 0, .45); }
html[data-motion=off] .sb-panel,
html[data-motion=none] .sb-panel { transition: none; }
.sb-panel.is-on { -webkit-transform: translateX(0); transform: translateX(0); }

body[data-route=exam] .sb-panel,
body[data-route=exam] .sb-backdrop,
body[data-route=exam] #sb-pal,
body[data-route=exam] #sb-fx,
body[data-route=exam] #sb-tour,
body[data-route=exam] .sb-coach,
body[data-route=reading-session] .sb-panel,
body[data-route=reading-session] .sb-backdrop,
body[data-route=reading-session] #sb-pal,
body[data-route=reading-session] #sb-fx,
body[data-route=reading-session] #sb-tour,
body[data-route=reading-session] .sb-coach,
html[data-gate=on] .sb-panel,
html[data-gate=on] .sb-backdrop,
html[data-gate=on] #sb-pal,
html[data-gate=on] #sb-fx,
html[data-gate=on] #sb-tour,
html[data-gate=on] .sb-coach,
body.rd-active .sb-panel,
body.rd-active .sb-backdrop,
body.rd-active #sb-pal,
body.rd-active #sb-fx,
body.rd-active #sb-tour,
body.rd-active .sb-coach { display: none !important; }

.sb-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; min-height: 64px; padding: 8px 10px 8px 18px;
  border-bottom: 1px solid var(--line, #E4DED3);
}
.sb-brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-height: 44px; min-width: 0; }
.sb-brand .brand-mark { width: 24px; height: 24px; fill: var(--brand, #1D3557); }
.sb-brand .brand-mark rect:nth-child(2) { fill: var(--accent, #B08440); }
.sb-brand-name { font: 600 16px/1.1 var(--font-head, inherit); }

.sb-nav { flex: 1; overflow: auto; padding: 14px 12px; }
.sb-group { list-style: none; margin: 0 0 18px; padding: 0; }
.sb-group:last-child { margin-bottom: 0; }
.sb-link, .sb-soon {
  display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 8px 10px; border-radius: 14px;
  color: inherit; text-decoration: none; font: 600 14px/1.2 var(--font-ui, inherit);
  border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer;
  position: relative;
}
.sb-ico {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-50, #ECF0F5); color: var(--brand, #1D3557);
}
.sb-link svg, .sb-soon svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.sb-link:hover { background: var(--brand-50, #ECF0F5); }
.sb-link.is-active {
  background: var(--brand-50, #ECF0F5);
  color: var(--brand, #1D3557);
  box-shadow: inset 3px 0 0 var(--accent, #B08440);
}
.sb-soon { opacity: .55; cursor: default; }
.sb-soon-tag {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px currentColor; opacity: .85;
}

.sb-guide-bar {
  position: relative;
  min-height: 0;
  padding: 0 12px 8px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
  flex: none;
}
.sb-panel.is-guided .sb-guide-bar { min-height: 84px; padding-right: 108px; }
.sb-guide-toggle {
  appearance: none; border: 0; background: transparent;
  color: var(--muted, #5F5B55); font: 600 12px/1.2 var(--font-ui, inherit);
  padding: 8px 4px; min-height: 36px; cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px;
}
.sb-guide-toggle:hover { color: var(--ink, #1A1A1F); }
.sb-bubble {
  position: absolute;
  left: 12px;
  right: 108px;
  bottom: 86px;
  z-index: 2;
  max-width: 210px;
  padding: 8px 10px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface, #FFFDF9);
  color: var(--ink, #1A1A1F);
  font: 600 13px/1.35 var(--font-ui, inherit);
  box-shadow: 0 8px 24px rgba(20,18,16,.14), 0 0 0 1px var(--line, #E4DED3);
  opacity: 0;
  pointer-events: none;
  -webkit-transform: translateY(8px) scale(.96);
  transform: translateY(8px) scale(.96);
  transform-origin: 20% 100%;
}
html[data-theme=dark] .sb-bubble {
  background: #1E2430;
  box-shadow: 0 8px 24px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.08);
}
.sb-bubble.is-on {
  opacity: 1;
  -webkit-transform: translateY(0) scale(1);
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
html[data-motion=on] .sb-bubble {
  transition: transform 280ms cubic-bezier(.22,1,.36,1), opacity 220ms ease;
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-top: 1px solid var(--line, #E4DED3);
  min-height: 68px;
  background: var(--surface-2, #FAF7F1);
}
.sb-avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand, #1D3557); color: var(--on-brand, #fff); font: 700 14px/1 var(--font-ui, inherit);
}
.sb-user-text { min-width: 0; }
.sb-user-name { font: 600 14px/1.2 var(--font-ui, inherit); display: block; }
.sb-user-email { font-size: 12px; color: var(--muted, #5F5B55); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* Staggered menu items when the panel opens */
html[data-motion=on] .sb-panel.is-on .sb-link,
html[data-motion=on] .sb-panel.is-on .sb-soon {
  animation: qt-rise 360ms cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}

/* ---- Question Types pages ---- */
.page.qt-page {
  max-width: 1000px;
  margin: 0 auto;
  padding-top: 16px;
  padding-bottom: 72px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow-x: hidden;
  overflow-x: clip;
  box-sizing: border-box;
}
@media (min-width: 600px) {
  .page.qt-page {
    padding-top: 24px;
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
  }
}

.qt-hero {
  position: relative;
  margin: 0 0 16px;
  padding: 6px 0 0;
  overflow: hidden;
}
.qt-hero::before {
  content: "";
  position: absolute;
  left: -12%;
  top: -48px;
  width: 70%;
  height: 180px;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 40%, var(--paper-glow, rgba(255,251,242,.9)), transparent 68%);
}
html[data-theme=dark] .qt-hero::before {
  background: radial-gradient(ellipse at 30% 40%, rgba(212, 176, 106, .16), transparent 70%);
}
.qt-hero > * { position: relative; z-index: 1; }

.qt-kicker {
  margin: 0 0 6px;
  font: 650 12px/1.3 var(--font-ui, inherit);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent, #B08440);
}
.qt-title {
  margin: 0 0 8px;
  font: 700 clamp(26px, 6vw, 36px)/1.15 var(--font-head, inherit);
  letter-spacing: -.02em;
  color: var(--head-ink, var(--ink));
}
.qt-lede {
  margin: 0;
  color: var(--muted, #5F5B55);
  max-width: 38em;
  font-size: 15px;
  line-height: 1.45;
}

/* Segmented tabs with a sliding pill (transform only) */
.qt-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  padding: 4px;
  margin: 0 0 26px;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  background: var(--brand-50, #ECF0F5);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px var(--brand-line, rgba(29,53,87,.12));
}
.qt-tab-pill {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  width: 0;
  border-radius: 12px;
  background: var(--surface, #FFFDF9);
  box-shadow: var(--shadow-1, 0 1px 3px rgba(45,36,22,.08));
  pointer-events: none;
  z-index: 0;
  transition: transform 240ms cubic-bezier(.22, 1, .36, 1);
}
html[data-motion=off] .qt-tab-pill,
html[data-motion=none] .qt-tab-pill { transition: none; }
.qt-tab {
  position: relative;
  z-index: 1;
  min-height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted, #5F5B55);
  font: 600 14px/1 var(--font-ui, inherit);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.qt-tab.is-on { color: var(--brand, #1D3557); }
.qt-tab.is-soon { opacity: .7; cursor: default; font-size: 13px; }
.qt-tab .qt-soon-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding: 2px 5px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px currentColor;
}

.qt-block { margin: 0 0 22px; }
.qt-lede, .qt-block-desc, .qt-card-blurb { display: none; }
.qt-countline { margin: -6px 0 16px; font: 650 13px/1.3 var(--font-ui, inherit); color: var(--muted, #5F5B55); }
.qt-block-title { margin: 0 0 4px; font: 700 20px/1.25 var(--font-head, inherit); }
.qt-block-desc { margin: 0 0 14px; color: var(--muted, #5F5B55); font-size: 14px; }

/* Colour families for icon tiles */
.qt-fam-chart    { --qt-c: #2B6B8A; --qt-c-bg: #E5F1F6; }
.qt-fam-process  { --qt-c: #3E7A52; --qt-c-bg: #E6F3EA; }
.qt-fam-essay    { --qt-c: #B08440; --qt-c-bg: #F6EEDD; }
.qt-fam-choice   { --qt-c: #2E63C9; --qt-c-bg: #E8EFFB; }
.qt-fam-tf       { --qt-c: #2B7352; --qt-c-bg: #E5F3EB; }
.qt-fam-match    { --qt-c: #6B4E9B; --qt-c-bg: #F0EAF7; }
.qt-fam-complete { --qt-c: #94600F; --qt-c-bg: #F6EDD9; }
html[data-theme=dark] .qt-fam-chart    { --qt-c: #7EC4DE; --qt-c-bg: #173039; }
html[data-theme=dark] .qt-fam-process  { --qt-c: #7ECFA0; --qt-c-bg: #173126; }
html[data-theme=dark] .qt-fam-essay    { --qt-c: #E2C47F; --qt-c-bg: #2A2416; }
html[data-theme=dark] .qt-fam-choice   { --qt-c: #8AB0F0; --qt-c-bg: #1A2740; }
html[data-theme=dark] .qt-fam-tf       { --qt-c: #6FCB9A; --qt-c-bg: #163226; }
html[data-theme=dark] .qt-fam-match    { --qt-c: #C4A6E8; --qt-c-bg: #2A2140; }
html[data-theme=dark] .qt-fam-complete { --qt-c: #E0B56A; --qt-c-bg: #2C2314; }

.qt-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}
@media (min-width: 720px) {
  .qt-cards { grid-template-columns: 1fr 1fr; gap: 14px; }
}
@media (min-width: 1100px) {
  .qt-cards { grid-template-columns: 1fr 1fr 1fr; }
}

.qt-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 88px;
  min-width: 0;
  max-width: 100%;
  padding: 16px;
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
  box-sizing: border-box;
  background:
    linear-gradient(var(--surface, #FFFDF9), var(--surface, #FFFDF9)) padding-box,
    linear-gradient(155deg, var(--qt-c, var(--brand-line)), var(--line, #E4DED3) 62%) border-box;
  border: 1px solid transparent;
  box-shadow: var(--shadow-1, 0 1px 3px rgba(45,36,22,.06)), var(--surface-hi, inset 0 1px 0 rgba(255,255,255,.8));
}
.qt-card:hover { box-shadow: var(--shadow-2, 0 10px 26px -8px rgba(45,36,22,.16)); }
.qt-card-ico {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--qt-c-bg, var(--brand-50));
  color: var(--qt-c, var(--brand));
}
.qt-card-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.qt-card-text { flex: 1; min-width: 0; }
.qt-card-top { display: flex; align-items: flex-start; gap: 8px; }
.qt-card-name { display: block; font: 650 16px/1.3 var(--font-ui, inherit); min-width: 0; }
.qt-card-blurb { display: block; margin-top: 4px; font-size: 13px; line-height: 1.4; color: var(--muted, #5F5B55); }
.qt-badge {
  flex: none;
  margin-left: auto;
  font: 700 11px/1 var(--font-ui, inherit);
  letter-spacing: .02em;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--qt-c-bg, var(--brand-50));
  color: var(--qt-c, var(--brand));
  white-space: nowrap;
}
.qt-card .chev {
  width: 16px; height: 16px; flex: none; margin-top: 4px;
  stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .4;
}

.qt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; width: 100%; }
.qt-item {
  display: flex; align-items: flex-start; gap: 12px;
  min-width: 0; max-width: 100%;
  padding: 14px 16px; border-radius: 16px;
  background: var(--surface, #FFFDF9); color: inherit; text-decoration: none;
  border: 1px solid var(--line, #E4DED3);
  box-shadow: var(--shadow-1, 0 1px 2px rgba(45,36,22,.05));
  box-sizing: border-box;
}
.qt-item:hover { border-color: var(--brand-line, rgba(29,53,87,.35)); box-shadow: var(--shadow-2); }
.qt-item-kicker { font-size: 12px; font-weight: 650; color: var(--brand, #1D3557); letter-spacing: .02em; }
.qt-item-title { display: block; margin-top: 2px; font: 600 15px/1.35 var(--font-ui, inherit); }
.qt-item-sub { display: block; margin-top: 2px; font-size: 13px; color: var(--muted, #5F5B55); }
.qt-item .chev { width: 18px; height: 18px; flex: none; margin-top: 6px; stroke: currentColor; fill: none; stroke-width: 1.8; opacity: .45; }

html[data-motion=on] .qt-card,
html[data-motion=on] .qt-item {
  animation: qt-rise 420ms cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@media (prefers-reduced-motion: no-preference) {
  html[data-motion=on] .qt-card { transition: transform 200ms cubic-bezier(.22, 1, .36, 1); }
  html[data-motion=on] .qt-card:hover { transform: translateY(-3px); }
  html[data-motion=on] .qt-card:active { transform: scale(.98); transition-duration: 100ms; }
  html[data-motion=on] .qt-item { transition: transform 200ms cubic-bezier(.22, 1, .36, 1); }
  html[data-motion=on] .qt-item:hover { transform: translateY(-2px); }
  html[data-motion=on] .qt-item:active { transform: scale(.99); }
}
@keyframes qt-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}


/* First-visit menu tour + study coach (liquid glass). Transform/opacity only. */
#sb-pal.is-tour {
  top: 0;
  left: 0;
  bottom: auto;
  width: 88px;
  opacity: 1;
  z-index: 86;
  transition: transform 420ms cubic-bezier(.18, .82, .22, 1), opacity 200ms ease;
}
@media (min-width: 800px) {
  #sb-pal.is-tour { width: 100px; }
}
html[data-motion=on] #sb-pal.is-tour .sb-pal-drift {
  animation: sb-guide-float 2.8s ease-in-out infinite;
}
html[data-motion=on] #sb-pal.is-tour .sb-pen-glow {
  animation: sb-pen-pulse 1.6s ease-in-out infinite;
  opacity: .85;
}
#sb-pal.is-glow1 { filter: drop-shadow(0 0 8px rgba(232,184,74,.35)); }
#sb-pal.is-glow2 { filter: drop-shadow(0 0 12px rgba(232,184,74,.5)); }
#sb-pal.is-glow3 { filter: drop-shadow(0 0 18px rgba(255,214,90,.72)); }

.sb-streak {
  position: absolute;
  right: 2px;
  top: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 22px;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  font: 700 11px/1 var(--font-ui, inherit);
  color: #5A3A08;
  background: rgba(255,248,225,.92);
  box-shadow: 0 2px 8px rgba(20,18,16,.16), inset 0 1px 0 rgba(255,255,255,.8);
  pointer-events: none;
}
html[data-theme=dark] .sb-streak {
  color: #F6E7B8;
  background: rgba(40,32,16,.86);
  box-shadow: 0 2px 8px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.12);
}
.sb-streak-ico { font-size: 11px; }

.is-tour-on {
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 2px rgba(232,184,74,.9), 0 0 18px rgba(232,184,74,.4) !important;
  border-radius: 14px;
}
html[data-theme=dark] .is-tour-on {
  box-shadow: 0 0 0 2px rgba(232,184,74,.85), 0 0 20px rgba(232,184,74,.35) !important;
}

#sb-tour {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 88;
  box-sizing: border-box;
  max-width: 300px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  color: var(--ink, #1A1A1F);
  font: 650 14px/1.4 var(--font-ui, inherit);
  background: linear-gradient(165deg, rgba(255,255,255,.58), rgba(255,255,255,.22) 55%, rgba(255,248,230,.3));
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  box-shadow:
    0 12px 36px rgba(20,18,16,.2),
    inset 0 1px 0 rgba(255,255,255,.75),
    inset 0 0 0 1px rgba(255,255,255,.28);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  cursor: pointer;
}
#sb-tour.is-on { opacity: 1; pointer-events: auto; }
html[data-motion=on] #sb-tour {
  transition: opacity 280ms ease, transform 420ms cubic-bezier(.18, .82, .22, 1);
}
.sb-tour-text { margin: 0 0 10px; }
.sb-tour-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sb-tour-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.sb-tour-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(26,26,31,.22);
  display: block;
}
.sb-tour-dot.is-on { background: #C9A04A; transform: scale(1.25); }
html[data-theme=dark] .sb-tour-dot { background: rgba(255,255,255,.28); }
html[data-theme=dark] .sb-tour-dot.is-on { background: #E8C56A; }
.sb-tour-skip {
  appearance: none; border: 0; background: transparent;
  color: var(--muted, #5F5B55);
  font: 650 12px/1 var(--font-ui, inherit);
  padding: 8px 2px; min-height: 32px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.sb-tour-hint {
  margin: 6px 0 0;
  font: 600 11px/1 var(--font-ui, inherit);
  color: var(--muted, #5F5B55);
  letter-spacing: .02em;
}
.sb-tour-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 18%, rgba(255,255,255,.5) 42%, transparent 64%);
  -webkit-transform: translateX(-130%);
  transform: translateX(-130%);
  opacity: 0;
}
html[data-motion=on] #sb-tour.is-on .sb-tour-sheen {
  animation: sb-tour-sheen 1.7s ease-in-out 1;
}
@keyframes sb-tour-sheen {
  0%   { -webkit-transform: translateX(-130%); transform: translateX(-130%); opacity: 0; }
  25%  { opacity: .7; }
  100% { -webkit-transform: translateX(130%); transform: translateX(130%); opacity: 0; }
}
html[data-theme=dark] #sb-tour {
  color: #F3EEE6;
  background: linear-gradient(165deg, rgba(48,54,70,.66), rgba(22,26,36,.5));
  box-shadow:
    0 12px 36px rgba(0,0,0,.42),
    inset 0 1px 0 rgba(255,255,255,.18),
    inset 0 0 0 1px rgba(255,255,255,.1);
}

.sb-coach {
  position: relative;
  margin: 0 12px 10px;
  padding: 10px 12px 12px;
  border-radius: 16px;
  color: var(--ink, #1A1A1F);
  font: 600 13px/1.35 var(--font-ui, inherit);
  background: linear-gradient(165deg, rgba(255,255,255,.58), rgba(255,255,255,.22) 55%, rgba(255,248,230,.32));
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow:
    0 8px 24px rgba(20,18,16,.12),
    inset 0 1px 0 rgba(255,255,255,.7),
    inset 0 0 0 1px rgba(255,255,255,.28);
  flex: none;
  overflow: hidden;
}
html[data-theme=dark] .sb-coach {
  color: #F3EEE6;
  background: linear-gradient(165deg, rgba(48,54,70,.66), rgba(22,26,36,.5));
  box-shadow:
    0 8px 24px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.16),
    inset 0 0 0 1px rgba(255,255,255,.1);
}
.sb-coach-peek { margin: 0 0 16px; max-width: 36rem; }
.sb-coach-head {
  display: flex; align-items: center; gap: 8px;
  font: 700 11px/1 var(--font-ui, inherit);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent, #B08440);
  margin: 0 0 8px;
}
.sb-coach-head span:first-child { flex: 1; }
.sb-coach-streak { letter-spacing: 0; text-transform: none; color: inherit; font-size: 12px; }
.sb-coach-hide {
  appearance: none; border: 0; background: transparent;
  color: var(--muted, #5F5B55); font: 700 16px/1 inherit;
  width: 28px; height: 28px; cursor: pointer; border-radius: 8px;
}
.sb-coach-hide:hover { background: rgba(20,18,16,.06); }
.sb-coach-goal { margin: 0 0 6px; }
.sb-coach-goal span { color: var(--muted, #5F5B55); font-weight: 650; }
.sb-coach-goal.is-done { color: #2B7352; }
html[data-theme=dark] .sb-coach-goal.is-done { color: #7ECFA0; }
.sb-coach-note { margin: 0 0 8px; color: var(--muted, #5F5B55); font-weight: 600; }
.sb-coach-go {
  display: inline-block;
  color: var(--brand, #1D3557);
  font-weight: 750;
  text-decoration: none;
  min-height: 32px;
}
html[data-theme=dark] .sb-coach-go { color: #C9D6EA; }
.sb-coach-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted, #5F5B55); }
.sb-coach-burst {
  position: absolute; inset: 0; pointer-events: none; overflow: visible;
}
.sb-coach-burst i {
  position: absolute; left: 50%; top: 40%;
  width: 6px; height: 6px; border-radius: 50%;
  background: #E8C56A;
  opacity: 0;
}
html[data-motion=on] .sb-coach-burst i {
  animation: sb-coach-spark 700ms ease-out both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
@keyframes sb-coach-spark {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -24px)) scale(1.1); }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #sb-tour, .sb-coach { background: rgba(255,253,249,.94); }
  html[data-theme=dark] #sb-tour,
  html[data-theme=dark] .sb-coach { background: rgba(28,32,42,.94); }
}

html[data-motion=off] #sb-pal.is-tour,
html[data-motion=none] #sb-pal.is-tour,
html[data-motion=off] #sb-tour,
html[data-motion=none] #sb-tour { transition: none !important; }
html[data-motion=off] .sb-tour-sheen,
html[data-motion=none] .sb-tour-sheen,
html[data-motion=off] .sb-coach-burst,
html[data-motion=none] .sb-coach-burst { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .qt-card, .qt-item, .sb-link, .sb-soon, .qt-tab-pill { animation: none !important; transition: none !important; }
  .qt-card:hover, .qt-item:hover, .qt-card:active, .qt-item:active { transform: none !important; }
}
html[data-motion=off] .qt-card,
html[data-motion=none] .qt-card,
html[data-motion=off] .qt-item,
html[data-motion=none] .qt-item,
html[data-motion=off] .sb-link,
html[data-motion=none] .sb-link,
html[data-motion=off] .sb-soon,
html[data-motion=none] .sb-soon {
  animation: none !important;
  transition: none !important;
}
html[data-motion=off] .qt-card:hover,
html[data-motion=none] .qt-card:hover,
html[data-motion=off] .qt-item:hover,
html[data-motion=none] .qt-item:hover { transform: none !important; }


/* ---- Original guide character (the user's own art). She swoops in and a
   golden ink ribbon draws the menu open. Then she docks in the panel as a
   guide, with short speech-bubble tips. Animate transform/opacity only.
   Motion-off: instant slide, she appears already docked, bubbles are static.
   Hidden in Strict Exam. */
#sb-fx {
  position: fixed;
  inset: 0;
  z-index: 82;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
#sb-fx.is-burst,
#sb-fx.is-idle { opacity: 1; }
#sb-fx.is-out {
  opacity: 0;
  transition: opacity 280ms ease;
}
html[data-motion=off] #sb-fx,
html[data-motion=none] #sb-fx { display: none !important; }
html[data-motion=off] #sb-pal,
html[data-motion=none] #sb-pal { transition: none !important; }

.sb-fx-ribbon {
  position: absolute;
  left: -8%;
  top: 8%;
  width: 90%;
  height: 70%;
  opacity: 0;
  -webkit-transform: translateX(-12%) scale(.35);
  transform: translateX(-12%) scale(.35);
  -webkit-transform-origin: 12% 55%;
  transform-origin: 12% 55%;
}
.sb-fx-ribbon svg { width: 100%; height: 100%; overflow: visible; display: block; }
html[data-motion=on] #sb-fx.is-burst .sb-fx-ribbon {
  animation: sb-ink-sweep 700ms cubic-bezier(.18, .8, .22, 1) both;
}
@keyframes sb-ink-sweep {
  0%   { opacity: 0; transform: translateX(-12%) scale(.35); }
  18%  { opacity: .95; transform: translateX(0) scale(.8); }
  60%  { opacity: .85; transform: translateX(6%) scale(1); }
  100% { opacity: 0; transform: translateX(12%) scale(1.05); }
}

.sb-fx-sparks, .sb-fx-paper { position: absolute; inset: 0; }
.sb-spark, .sb-paper {
  position: absolute;
  left: var(--x, 20%);
  top: var(--y, 40%);
  opacity: 0;
  pointer-events: none;
}
.sb-spark {
  width: 6px; height: 6px; border-radius: 50%;
  background: #FFE07A;
  box-shadow: 0 0 8px 2px rgba(255, 196, 80, .7);
}
.sb-spark:nth-child(odd) { width: 4px; height: 4px; background: #FFF6D0; }
.sb-paper {
  width: 10px; height: 7px;
  background: #F3E0C0;
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(80,40,0,.2);
  -webkit-transform: rotate(var(--r, -12deg));
  transform: rotate(var(--r, -12deg));
}
html[data-theme=dark] .sb-paper { background: #E8D0A0; }
html[data-motion=on] #sb-fx.is-burst .sb-spark,
html[data-motion=on] #sb-fx.is-idle .sb-spark,
html[data-motion=on] #sb-fx.is-burst .sb-paper,
html[data-motion=on] #sb-fx.is-idle .sb-paper {
  animation: sb-bit-drift 1400ms ease-out infinite;
  animation-delay: var(--d, 0s);
}
html[data-motion=on] #sb-fx.is-burst .sb-spark,
html[data-motion=on] #sb-fx.is-burst .sb-paper {
  animation-iteration-count: 2;
  animation-duration: 900ms;
}
@keyframes sb-bit-drift {
  0%   { opacity: 0; transform: translate(0,0) scale(.6) rotate(var(--r, 0deg)); }
  14%  { opacity: .95; transform: translate(6px,-8px) scale(1) rotate(var(--r, 0deg)); }
  100% { opacity: 0; transform: translate(var(--dx, 24px), var(--dy, -50px)) scale(.5) rotate(calc(var(--r, 0deg) + 24deg)); }
}

#sb-fx.is-paused .sb-fx-ribbon,
#sb-fx.is-paused .sb-spark,
#sb-fx.is-paused .sb-paper,
#sb-pal.is-paused,
#sb-pal.is-paused * {
  -webkit-animation-play-state: paused !important;
  animation-play-state: paused !important;
}

#sb-pal {
  position: fixed;
  left: 0;
  bottom: max(8px, env(safe-area-inset-bottom, 0px));
  z-index: 83;
  width: 200px;
  pointer-events: none;
  -webkit-transform: translate3d(-140%, 8vh, 0) rotate(-14deg) scale(.86);
  transform: translate3d(-140%, 8vh, 0) rotate(-14deg) scale(.86);
  opacity: 0;
  will-change: transform, opacity;
}
#sb-pal.is-dash {
  opacity: 1;
  -webkit-transform: translate3d(16vw, 6vh, 0) rotate(-6deg) scale(1.04);
  transform: translate3d(16vw, 6vh, 0) rotate(-6deg) scale(1.04);
  transition: transform 320ms cubic-bezier(.15, .8, .2, 1), opacity 140ms ease;
}
/* After the swoop she settles into the panel corner, above the guest row. */
#sb-pal.is-dock {
  opacity: 1;
  width: 96px;
  -webkit-transform: translate3d(calc(min(320px, 88vw) - 108px), -70px, 0) rotate(0) scale(1);
  transform: translate3d(calc(min(320px, 88vw) - 108px), -70px, 0) rotate(0) scale(1);
  transition: transform 420ms cubic-bezier(.18, .82, .22, 1), opacity 200ms ease;
}
#sb-pal.is-out {
  opacity: 0;
  -webkit-transform: translate3d(-30%, 10vh, 0) rotate(-8deg) scale(.9);
  transform: translate3d(-30%, 10vh, 0) rotate(-8deg) scale(.9);
  transition: transform 300ms cubic-bezier(.4, 0, .7, .2), opacity 260ms ease;
}
@media (min-width: 800px) {
  #sb-pal { width: 260px; bottom: 4vh; }
  #sb-pal.is-dash {
    -webkit-transform: translate3d(20vw, 4vh, 0) rotate(-5deg) scale(1.05);
    transform: translate3d(20vw, 4vh, 0) rotate(-5deg) scale(1.05);
  }
  #sb-pal.is-dock { width: 112px; }
}

.sb-pal-drift { width: 100%; will-change: transform; position: relative; }
.sb-pal-img { display: block; width: 100%; height: auto; pointer-events: none; }

.sb-pen-glow {
  position: absolute;
  left: 68%;
  top: 18%;
  width: 28%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,224,120,.7) 0%, rgba(255,160,40,.15) 45%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
html[data-motion=on] #sb-pal.is-dash .sb-pen-glow,
html[data-motion=on] #sb-pal.is-dock .sb-pen-glow {
  animation: sb-pen-pulse 1.6s ease-in-out infinite;
}
#sb-pal.is-dock .sb-pen-glow { opacity: .85; }
@keyframes sb-pen-pulse {
  0%, 100% { opacity: .45; transform: scale(.9); }
  50%      { opacity: .95; transform: scale(1.12); }
}

html[data-motion=on] #sb-pal.is-dock:not(.is-dash) .sb-pal-drift {
  animation: sb-guide-float 2.8s ease-in-out infinite;
}
@keyframes sb-guide-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-5px) rotate(-1.4deg); }
}

/* Golden slit on the drawer edge the ink ribbon is drawing open */
.sb-panel::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, transparent 0%, #E8B84A 28%, #FFE9A0 50%, #E8B84A 72%, transparent 100%);
  opacity: 0;
  pointer-events: none;
}
html[data-motion=on] .sb-panel.is-on::after {
  opacity: .85;
  transition: opacity 400ms ease;
}
html[data-motion=off] .sb-panel::after,
html[data-motion=none] .sb-panel::after { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  #sb-fx { display: none !important; animation: none !important; transition: none !important; }
  #sb-pal.is-dash { transition: none !important; }
  .sb-fx-ribbon, .sb-spark, .sb-paper, .sb-pen-glow, .sb-pal-drift { animation: none !important; }
  .sb-bubble { transition: none !important; transform: none !important; }
  .sb-panel { transition: none !important; }
  #sb-tour, #sb-pal.is-tour { transition: none !important; }
  .sb-tour-sheen, .sb-coach-burst { display: none !important; animation: none !important; }
}
