/* RT Bloom — soft, cozy study UI. Local fonts only, no CDNs. */

:root {
  --blush: #f6d8e4;
  --blush-deep: #e9aac3;
  --lavender: #e3ddf4;
  --lavender-deep: #c5b8ea;
  --cream: #fff8f4;
  --cream-2: #fdeef2;
  --ink: #5b4a55;
  --ink-soft: #8a7b86;
  --ink-faint: #b6a8b2;
  --card: #ffffff;
  --line: #f0e2ea;
  --good: #8bc8a3;
  --good-deep: #4f9e74;
  --shadow: 0 10px 30px -16px rgba(150, 90, 120, 0.45);
  --shadow-soft: 0 6px 18px -12px rgba(150, 90, 120, 0.4);
  --radius: 22px;
  --radius-sm: 14px;
  --maxw: 760px;
  --font: "SF Arabic", "Geeza Pro", "Segoe UI", system-ui, -apple-system,
    "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.bg-bloom {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1100px 520px at 85% -8%, var(--blush) 0%, transparent 60%),
    radial-gradient(900px 520px at 0% 8%, var(--lavender) 0%, transparent 55%),
    linear-gradient(180deg, var(--cream) 0%, var(--cream-2) 100%);
}
/* Two soft, slowly drifting orbs for a cozy, living backdrop. */
.bg-bloom::before,
.bg-bloom::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(34px);
  opacity: .42;
  will-change: transform;
}
.bg-bloom::before {
  width: 260px; height: 260px;
  inset-block-start: 18%;
  inset-inline-start: -70px;
  background: radial-gradient(circle at 35% 35%, var(--blush-deep), transparent 70%);
  animation: floatBlob 16s ease-in-out infinite;
}
.bg-bloom::after {
  width: 320px; height: 320px;
  inset-block-end: 6%;
  inset-inline-end: -90px;
  background: radial-gradient(circle at 60% 40%, var(--lavender-deep), transparent 70%);
  animation: floatBlobAlt 21s ease-in-out infinite;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px calc(14px) ;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(255, 248, 244, 0.92), rgba(255, 248, 244, 0.62));
  backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: .2px;
  padding: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: var(--blush-deep);
  background: linear-gradient(135deg, var(--blush) 0%, var(--lavender) 100%);
  box-shadow: var(--shadow-soft);
}
.brand-name { white-space: nowrap; }
.topbar-tag {
  margin-inline-start: auto;
  color: var(--ink-soft);
  font-size: 13.5px;
  white-space: nowrap;
}

/* ---------- Animation primitives ---------- */
/* Registered so the progress ring's conic sweep can transition smoothly. */
@property --val {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes floatBlob {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(14px, -22px) scale(1.08); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes floatBlobAlt {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-18px, 16px) scale(1.06); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes softShimmer {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
@keyframes statusPulse {
  0%   { box-shadow: 0 0 0 0 rgba(120, 196, 150, .55); }
  60%  { box-shadow: 0 0 0 12px rgba(120, 196, 150, 0); }
  100% { box-shadow: 0 0 0 0 rgba(120, 196, 150, 0); }
}
@keyframes ringGlow {
  0%   { transform: scale(.94); }
  55%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes sparkleTwinkle {
  0%, 100% { opacity: 0; transform: scale(.6) rotate(0deg); }
  50%      { opacity: .9; transform: scale(1) rotate(45deg); }
}

/* ---------- Layout ---------- */
.view {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px 28px;
}
/* Staggered, soft entrance for each direct block of a view. */
.view > * {
  animation: cardIn .5s cubic-bezier(.2,.7,.2,1) both;
}
.view > *:nth-child(1) { animation-delay: .02s; }
.view > *:nth-child(2) { animation-delay: .07s; }
.view > *:nth-child(3) { animation-delay: .12s; }
.view > *:nth-child(4) { animation-delay: .17s; }
.view > *:nth-child(5) { animation-delay: .22s; }
.view > *:nth-child(6) { animation-delay: .27s; }
.view > *:nth-child(7) { animation-delay: .31s; }
.view > *:nth-child(8) { animation-delay: .35s; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #fff 0%, var(--cream-2) 100%);
  text-align: start;
}
.hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -40px;
  inset-block-start: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--blush) 0%, transparent 70%);
  opacity: .8;
  pointer-events: none;
}
/* A tiny four-point sparkle that gently twinkles near the hero corner. */
.hero::before {
  content: "";
  position: absolute;
  inset-inline-end: 26px;
  inset-block-start: 30px;
  width: 16px; height: 16px;
  background:
    radial-gradient(closest-side, var(--blush-deep) 92%, transparent) center / 3px 16px no-repeat,
    radial-gradient(closest-side, var(--blush-deep) 92%, transparent) center / 16px 3px no-repeat;
  opacity: 0;
  pointer-events: none;
  animation: sparkleTwinkle 4.2s ease-in-out infinite;
}
.hello-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--blush-deep);
  background: var(--cream-2);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 27px;
  line-height: 1.3;
  font-weight: 800;
}
.hero p { margin: 0; color: var(--ink-soft); font-size: 15.5px; max-width: 46ch; }

/* ---------- Progress ring + bars ---------- */
.overall {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.ring {
  --val: 0;
  position: relative;
  width: 104px; height: 104px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: conic-gradient(var(--good-deep) calc(var(--val) * 1%), var(--lavender) 0);
  display: grid;
  place-items: center;
  /* @property --val lets the conic fill animate, not just snap. */
  transition: --val 1.1s cubic-bezier(.2,.7,.2,1);
  animation: ringGlow .7s cubic-bezier(.2,.7,.2,1) both;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 11px;
  background: var(--card);
  border-radius: 50%;
}
.ring b {
  position: relative;
  font-size: 24px;
  font-weight: 800;
}
.ring span { position: relative; font-size: 11px; color: var(--ink-soft); display:block; margin-top:-4px;}
.overall-meta { flex: 1 1 200px; min-width: 180px; }
.overall-meta h3 { margin: 0 0 10px; font-size: 16px; }
.mini-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  white-space: nowrap;
}
.chip b { color: var(--ink); }

/* ---------- Section headings ---------- */
.section-h {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 22px 4px 12px;
}
.section-h h2 { margin: 0; font-size: 18px; font-weight: 800; }
.section-h .sub { color: var(--ink-faint); font-size: 13px; }

/* ---------- Recommended ---------- */
.reco {
  background: linear-gradient(135deg, var(--lavender) 0%, var(--blush) 120%);
  border: 0;
  color: var(--ink);
}
.reco .hello-pill { background: rgba(255,255,255,.6); border-color: rgba(255,255,255,.7); color: var(--ink); }
.reco h3 { margin: 4px 0 6px; font-size: 20px; }
.reco p { margin: 0 0 14px; color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 11px 18px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--blush-deep), var(--lavender-deep));
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, filter .15s ease, box-shadow .2s ease;
}
/* Soft light sweep that glides across on hover — no emoji, pure CSS. */
.btn:not(.ghost)::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-18deg) translateX(0);
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}
.btn:not(.ghost):hover::before { transform: skewX(-18deg) translateX(360%); }
.btn:hover { filter: brightness(1.04); box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); }
.btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn svg { width: 18px; height: 18px; }

/* ---------- Topic list ---------- */
.topic-grid { display: grid; gap: 12px; }
.topic-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: start;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 14px 15px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.topic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.topic-card:active { transform: scale(.985); box-shadow: var(--shadow-soft); }
.topic-num {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--blush-deep);
  background: linear-gradient(135deg, var(--cream-2), var(--lavender));
}
.topic-main { flex: 1 1 auto; min-width: 0; }
.topic-main h4 { margin: 0 0 3px; font-size: 16px; font-weight: 800; line-height: 1.35; }
.topic-main .en { color: var(--ink-faint); font-size: 12.5px; }
.topic-srcline { color: var(--ink-soft); font-size: 12.5px; margin-top: 5px; }
.topic-arrow { flex: 0 0 auto; color: var(--ink-faint); }
[dir="rtl"] .topic-arrow svg { transform: scaleX(-1); }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.st-NotStarted { color: #b29db0; background: #f4eef2; }
.st-InProgress { color: #c98a3e; background: #fcf1e2; }
.st-Drafted    { color: #7a86c9; background: #ecedfa; }
.st-Reviewed   { color: #5aa0c2; background: #e6f2f8; }
.st-Completed  { color: var(--good-deep); background: #e4f4ea; }

/* ---------- Topic detail ---------- */
.detail-head { display: flex; gap: 14px; align-items: flex-start; }
.detail-head .topic-num { width: 52px; height: 52px; font-size: 17px; }
.detail-head h1 { margin: 0 0 4px; font-size: 22px; line-height: 1.3; }
.detail-head .en { color: var(--ink-faint); font-size: 13px; }

.now-block {
  background: linear-gradient(135deg, #fff 0%, var(--cream-2) 100%);
  border: 1px solid var(--line);
}
.now-block .now-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 17px; color: var(--blush-deep);
  margin-bottom: 6px;
}
.now-block .covers { color: var(--ink-soft); margin: 4px 0 0; }

/* ---------- Source coverage ---------- */
.src-panel { border-inline-start: 4px solid var(--lavender-deep); }
.src-group + .src-group { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.src-group h5 {
  margin: 0 0 8px;
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px;
}
.src-tag {
  font-size: 11px; font-weight: 800; letter-spacing: .4px;
  padding: 2px 9px; border-radius: 999px;
}
.src-tag.mcu { color: #b85c86; background: var(--blush); }
.src-tag.egan { color: #6a5fb0; background: var(--lavender); }
.src-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.src-item {
  display: flex; gap: 10px; align-items: baseline;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
}
.src-ch { font-weight: 800; font-size: 13px; color: var(--ink); flex: 0 0 auto; }
.src-title { flex: 1 1 auto; font-size: 13.5px; color: var(--ink-soft); }
.src-pages { font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.src-pages .est { color: var(--ink-faint); font-style: normal; font-size: 11px; }
.src-none { color: var(--ink-faint); font-size: 13px; }

/* ---------- Study mode cards ---------- */
.study-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
}
.study-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
  min-height: 92px;
  display: flex; flex-direction: column; gap: 6px;
}
.study-card .sc-icon { color: var(--lavender-deep); }
.study-card .sc-icon svg { width: 22px; height: 22px; }
.study-card h5 { margin: 0; font-size: 14.5px; font-weight: 800; }
.study-card .sc-en { color: var(--ink-faint); font-size: 11.5px; }
.study-card .sc-state {
  margin-top: auto;
  font-size: 11.5px; font-weight: 700;
  color: var(--ink-faint);
}
.study-card.ready {
  border-color: var(--good);
  box-shadow: 0 6px 18px -12px rgba(79, 158, 116, .5);
}
.study-card.ready .sc-state { color: var(--good-deep); }
.study-card.ready .sc-icon { color: var(--good-deep); }
/* Ready cards are <a> links to the study file: keep the card look, no underline. */
a.study-card { text-decoration: none; color: inherit; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
a.study-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -12px rgba(79, 158, 116, .6); }
a.study-card:focus-visible { outline: 2.5px solid var(--good-deep); outline-offset: 2px; }

/* Cards still in preparation get a gentle shimmer so they read as
   "intentionally waiting", not broken or empty. */
.study-card:not(.ready) { overflow: hidden; }
.study-card:not(.ready)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(197, 184, 234, .18) 50%,
    transparent 70%
  );
  transform: translateX(-120%);
  animation: softShimmer 2.8s ease-in-out infinite;
  pointer-events: none;
}
.study-card:not(.ready) .sc-icon { animation: ringGlow 3.4s ease-in-out infinite; }

.empty-banner {
  display: flex; gap: 12px; align-items: center;
  background: linear-gradient(135deg, var(--cream-2), var(--lavender));
  border: 1px dashed var(--lavender-deep);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-size: 14px;
}
.empty-banner svg { color: var(--blush-deep); flex: 0 0 auto; width: 30px; height: 30px; }
.empty-banner b { color: var(--ink); }

/* ---------- Status control ---------- */
.status-control { display: flex; flex-direction: column; gap: 12px; }
.status-control h5 { margin: 0; font-size: 15px; }
.status-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.status-opt {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
}
.status-opt:hover { border-color: var(--lavender-deep); }
.status-opt.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blush-deep), var(--lavender-deep));
  border-color: transparent;
}
/* Soft success pulse applied for one beat when a status is chosen. */
.status-pulse { animation: statusPulse .7s ease-out; }
.saved-note { font-size: 12.5px; color: var(--good-deep); min-height: 18px; }
.device-hint {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px;
  font-size: 12px; font-weight: 700;
  color: var(--good-deep);
}
.device-hint svg { width: 13px; height: 13px; flex: 0 0 auto; }

/* ---------- Progress page ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.prog-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.prog-row:last-child { border-bottom: 0; }
.prog-row .pr-num { width: 38px; color: var(--ink-faint); font-weight: 800; font-size: 13px; }
.prog-row .pr-name { flex: 1 1 auto; min-width: 0; font-size: 14.5px; font-weight: 700; }
.prog-row .pr-name small { display:block; color: var(--ink-faint); font-weight: 500; font-size: 11.5px; }

/* ---------- Back link ---------- */
.backlink {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-soft); font-family: inherit; font-size: 14px; font-weight: 700;
  padding: 4px 0; margin-bottom: 12px;
}
[dir="rtl"] .backlink svg { transform: scaleX(-1); }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed;
  inset-inline: 0; bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,248,244,.6), rgba(255,248,244,.96));
  backdrop-filter: saturate(1.3) blur(12px);
  border-top: 1px solid var(--line);
}
.navbtn {
  flex: 1 1 0;
  max-width: 160px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 11.5px; font-weight: 700;
  color: var(--ink-faint);
  padding: 6px 4px;
  border-radius: 14px;
  transition: color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.navbtn svg { width: 23px; height: 23px; transition: transform .2s cubic-bezier(.2,.7,.2,1); }
.navbtn:active { transform: scale(.94); }
.navbtn.is-active {
  color: var(--blush-deep);
  background: var(--cream-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -12px rgba(207, 122, 153, .7);
}
.navbtn.is-active svg { transform: translateY(-1px) scale(1.08); }

/* ---------- Spinner ---------- */
.spinner { display: flex; gap: 7px; justify-content: center; padding: 50px 0; }
.spinner span {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--lavender-deep);
  animation: bounce 1s infinite ease-in-out;
}
.spinner span:nth-child(2) { animation-delay: .15s; background: var(--blush-deep); }
.spinner span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(.5); opacity: .5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ====================================================================
   Responsive — three explicit tiers
     • Mobile  : <= 480px   (base styles above are mobile-first)
     • Tablet  : 481px – 900px  (iPad: roomier, 2-col where useful)
     • Desktop : > 900px
   ==================================================================== */

/* Global guard: never allow horizontal scrolling on any device. */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video { max-width: 100%; }
.view { width: 100%; }

/* ---------- Mobile: <= 480px ---------- */
@media (max-width: 480px) {
  html, body { font-size: 16.5px; }          /* keep reading text comfortable */
  .view { padding: 14px 13px 26px; }
  .card { padding: 16px; border-radius: 18px; }

  /* topic cards stack cleanly, one per row */
  .topic-grid { grid-template-columns: 1fr; }

  /* study cards: 2 readable columns instead of cramped tiles */
  .study-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }

  /* progress buttons -> touch-friendly pills that wrap */
  .status-opts { gap: 9px; }
  .status-opt { padding: 11px 16px; font-size: 14px; min-height: 42px; }

  /* source coverage stays readable: let long titles wrap */
  .src-item { flex-wrap: wrap; }
  .src-pages { white-space: normal; }

  /* hero / headings sized for small screens */
  .hero h1 { font-size: 23px; }
  .section-h { flex-wrap: wrap; gap: 4px 10px; }
  .topbar-tag { display: none; }              /* avoid topbar crowding */

  /* bottom nav: bigger thumb targets */
  .bottomnav { gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .navbtn { min-height: 52px; padding: 8px 4px; font-size: 11.5px; }
  .navbtn svg { width: 24px; height: 24px; }

  /* progress ring centers nicely when meta wraps under it */
  .overall { justify-content: center; text-align: center; }
  .overall-meta { text-align: start; }
}

/* ---------- Tablet / iPad: 481px – 900px ---------- */
@media (min-width: 481px) and (max-width: 900px) {
  .view { max-width: 720px; padding: 22px 22px 32px; }

  /* 2-column topic grid — balanced, not stretched */
  .topic-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }

  /* study pack reads well at 4 across on a tablet */
  .study-grid { grid-template-columns: repeat(4, 1fr); }

  /* dashboard hero/progress should feel full, not empty */
  .hero h1 { font-size: 28px; }
  .overall { gap: 24px; }
  .ring { width: 118px; height: 118px; }
}

/* ---------- Desktop: > 900px ---------- */
@media (min-width: 901px) {
  .view { max-width: var(--maxw); padding: 24px 16px 36px; }
  .topic-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .study-grid { grid-template-columns: repeat(4, 1fr); }
  .hero h1 { font-size: 30px; }

  /* hover lift only where a real pointer exists */
  .navbtn { max-width: 150px; }
}

/* ---------- Focus (keep keyboard navigation clearly visible) ---------- */
:focus-visible {
  outline: 2.5px solid var(--lavender-deep);
  outline-offset: 2px;
  border-radius: 6px;
}
.btn:focus-visible,
.topic-card:focus-visible,
.status-opt:focus-visible { outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  /* Keep entrance-animated blocks fully visible when motion is off. */
  .view > * { opacity: 1 !important; transform: none !important; }
  .study-card:not(.ready)::after,
  .hero::before { display: none !important; }
}

/* =====================================================================
   IN-APP STUDY READER — vertical step-by-step learning flow
   Reuses the RT Bloom soft visual language. Local, no dependencies.
   ===================================================================== */

.study-reader-card { padding: 18px 16px; }
.sr-head { margin-bottom: 4px; }
.sr-head .section-h h2 { display: inline-flex; align-items: center; gap: 8px; }

/* step-progress bar under the heading */
.step-progress {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 2px 4px;
}
.sp-track {
  flex: 1 1 auto;
  height: 8px; border-radius: 999px;
  background: var(--lavender);
  overflow: hidden;
}
.sp-fill {
  display: block; height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blush-deep), var(--lavender-deep));
  transition: width .5s cubic-bezier(.2,.7,.2,1);
}
.sp-count { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }

/* ---------- Steps + vertical rail ---------- */
.steps { display: flex; flex-direction: column; margin-top: 10px; }
.step {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
}
.step-rail { display: flex; flex-direction: column; align-items: center; }
.step-line { width: 2px; flex: 1 1 auto; background: var(--line); min-height: 8px; }
.step.is-done .step-line { background: var(--good); }
.step-dot {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
  color: var(--ink-soft);
  background: var(--cream-2);
  border: 2px solid var(--line);
  transition: background .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
}
.step-dot svg { width: 16px; height: 16px; }
.step.is-open .step-dot {
  color: #fff;
  background: linear-gradient(135deg, var(--blush-deep), var(--lavender-deep));
  border-color: transparent;
  transform: scale(1.06);
}
.step.is-done .step-dot {
  color: #fff;
  background: var(--good);
  border-color: transparent;
}
.step.is-done.is-open .step-dot { background: var(--good-deep); }

.step-col { min-width: 0; padding-bottom: 16px; }

/* step header (toggle) */
.step-head {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  text-align: start;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit; color: inherit;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.step-head:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.step.is-open .step-head {
  border-color: var(--lavender-deep);
  border-end-start-radius: 0; border-end-end-radius: 0;
}
.step-ic {
  flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--lavender-deep);
  background: linear-gradient(135deg, var(--cream-2), var(--lavender));
}
.step-ic svg { width: 20px; height: 20px; }
.step.is-done .step-ic { color: var(--good-deep); background: #e4f4ea; }
.step-titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.step-kicker { font-size: 11.5px; font-weight: 700; color: var(--ink-faint); letter-spacing: .2px; }
.step-title { font-size: 16px; font-weight: 800; line-height: 1.3; }
.step-chev { flex: 0 0 auto; color: var(--ink-faint); transition: transform .35s cubic-bezier(.2,.7,.2,1); }
.step-chev svg { transform: rotate(90deg); }
.step.is-open .step-chev { transform: rotate(180deg); color: var(--lavender-deep); }

/* collapsible panel via grid-template-rows (smooth, no JS measuring) */
.step-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .42s cubic-bezier(.2,.7,.2,1);
}
.step.is-open .step-panel { grid-template-rows: 1fr; }
.step-inner { overflow: hidden; min-height: 0; }
.step-body {
  border: 1px solid var(--lavender-deep);
  border-top: 0;
  border-end-start-radius: var(--radius-sm);
  border-end-end-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff, var(--cream));
  padding: 16px 16px 14px;
}

/* step footer controls */
.step-foot {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.mini-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: inherit; font-weight: 700; font-size: 13px;
  padding: 9px 14px; border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.mini-btn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.mini-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.mini-btn:active { transform: scale(.97); }
.mini-btn.ghost { color: var(--ink-soft); }
.mini-btn.done-btn { color: var(--good-deep); border-color: #cfe9d8; background: #eef8f1; }
.step.is-done .mini-btn.done-btn { background: var(--good); color: #fff; border-color: transparent; }
.mini-btn.next-btn {
  margin-inline-start: auto;
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--blush-deep), var(--lavender-deep));
}
.mini-btn.next-btn svg { transform: rotate(0deg); }

/* ---------- shared reader content ---------- */
.rd { font-size: 15px; }
.rd-h {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 10px; font-size: 14.5px; font-weight: 800; color: var(--ink);
}
.rd-h:first-child { margin-top: 2px; }
.rd-h-ic { color: var(--lavender-deep); display: inline-grid; place-items: center; }
.rd-lead { margin: 0 0 8px; color: var(--ink); }
.rd-bullets { margin: 6px 0 0; padding-inline-start: 18px; display: grid; gap: 6px; }
.rd-bullets li { color: var(--ink-soft); }
.rd-empty { color: var(--ink-faint); font-size: 13.5px; }
.rd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.cue-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: var(--cream-2); border: 1px solid var(--line); color: var(--ink-soft);
}
.cue-chip .cue-ic { display: inline-grid; place-items: center; }
.cue-chip .cue-ic svg { width: 12px; height: 12px; }
.cue-chip.src { color: #6a5fb0; background: var(--lavender); border-color: transparent; }
.cue-chip.src.sm { font-size: 11px; padding: 3px 9px; }
.cue-chip.exam { color: #b85c86; background: var(--blush); border-color: transparent; }
.cue-chip.term { color: var(--ink); }
.cue-chip.time { color: var(--good-deep); background: #e4f4ea; border-color: transparent; }

/* ---------- Start Here ---------- */
.rd-goals { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.rd-goals li { display: flex; gap: 9px; align-items: flex-start; color: var(--ink-soft); }
.goal-tick {
  flex: 0 0 auto; margin-top: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; background: var(--good);
}
.goal-tick svg { width: 12px; height: 12px; }
.rd-flow { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.rd-flow li { display: flex; gap: 11px; align-items: flex-start; }
.flow-n {
  flex: 0 0 auto;
  width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  color: var(--blush-deep);
  background: linear-gradient(135deg, var(--cream-2), var(--lavender));
}
.flow-b { color: var(--ink-soft); padding-top: 1px; }
.flow-b b { color: var(--ink); }
.rd-twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 14px; }
.rd-pane {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; background: var(--card);
}
.rd-pane h5 {
  margin: 0 0 8px; font-size: 13px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 7px;
}
.rd-pane h5 svg { width: 14px; height: 14px; }
.rd-pane.skim { border-inline-start: 3px solid var(--lavender-deep); }
.rd-pane.skim h5 { color: #6a5fb0; }
.rd-pane.mem { border-inline-start: 3px solid var(--blush-deep); }
.rd-pane.mem h5 { color: #b85c86; }
.rd-pane .rd-bullets li { font-size: 14px; }

/* ---------- Guided Notes ---------- */
.note-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 14px; background: var(--card);
  box-shadow: var(--shadow-soft);
  margin-bottom: 11px;
}
.note-card:last-child { margin-bottom: 0; }
.note-title { margin: 0; font-size: 15px; font-weight: 800; }
.rd-chips.terms { margin-top: 10px; }

/* ---------- Must Memorize ---------- */
.formula-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.formula-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px; background: linear-gradient(135deg, #fff, var(--cream-2));
  border-inline-start: 3px solid var(--blush-deep);
  display: flex; flex-direction: column; gap: 6px;
}
.formula-name { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.formula-code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; color: #6a5fb0;
  background: var(--lavender); border-radius: 8px;
  padding: 7px 10px; white-space: pre-wrap; word-break: break-word;
}
.formula-note { font-size: 12.5px; color: var(--ink-soft); }
.mem-source-chips {
  margin-top: 2px;
}
.mem-source-chips .cue-chip {
  white-space: normal;
  overflow-wrap: anywhere;
}
.fact-list { display: grid; gap: 7px; }
.fact-row { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.fact-dot {
  flex: 0 0 auto; margin-top: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
}
.fact-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fact-text {
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
}
.pattern-list { display: grid; gap: 8px; }
.pattern-row {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 12px;
  min-width: 0;
}
.pattern-copy {
  display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
  min-width: 0;
}
.pattern-cue { font-weight: 800; font-size: 13.5px; color: var(--ink); }
.pattern-arrow { color: var(--lavender-deep); display: inline-grid; place-items: center; }
.pattern-arrow svg { width: 14px; height: 14px; }
.pattern-mean {
  color: var(--ink-soft); font-size: 13.5px; flex: 1 1 160px;
  min-width: 0; overflow-wrap: anywhere;
}

/* ---------- Clinical Scenarios ---------- */
.scenario-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; background: var(--card); box-shadow: var(--shadow-soft);
  margin-bottom: 11px;
}
.scenario-card:last-child { margin-bottom: 0; }
.sc-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.sc-n {
  font-size: 11px; font-weight: 800; letter-spacing: .3px;
  color: var(--blush-deep); background: var(--blush);
  padding: 3px 9px; border-radius: 999px;
}
.sc-head h5 { margin: 0; font-size: 15px; font-weight: 800; }
.sc-context { margin: 9px 0 0; color: var(--ink); }
.sc-data {
  margin-top: 9px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 11px; font-size: 13.5px; color: var(--ink-soft);
}
.sc-data-lbl, .sc-answer-lbl {
  font-size: 11px; font-weight: 800; letter-spacing: .3px;
  color: var(--ink-faint); text-transform: uppercase;
}
.reveal-btn { margin-top: 12px; color: var(--blush-deep); border-color: #f0d5e0; }
.sc-reveal {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .4s cubic-bezier(.2,.7,.2,1), opacity .4s ease, margin .4s ease;
  opacity: 0; margin-top: 0;
}
.scenario-card.revealed .sc-reveal { grid-template-rows: 1fr; opacity: 1; margin-top: 12px; }
.sc-reveal > * { min-height: 0; overflow: hidden; }
.sc-answer {
  background: #eef8f1; border: 1px solid #cfe9d8;
  border-radius: 12px; padding: 11px 13px;
}
.sc-answer p { margin: 4px 0 0; color: var(--ink); font-weight: 600; }
.sc-explain { margin-top: 9px; }
.sc-explain p { margin: 4px 0 0; color: var(--ink-soft); }

/* ---------- MCQ Practice ---------- */
.mcq-scorebar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--lavender), var(--blush));
  border-radius: var(--radius-sm); padding: 10px 14px;
}
.mcq-score-lbl { font-size: 13px; font-weight: 700; color: var(--ink); }
.mcq-score-val { font-size: 17px; font-weight: 800; color: var(--ink); }
.mcq-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; background: var(--card); box-shadow: var(--shadow-soft);
  margin-bottom: 12px;
}
.mcq-card:last-child { margin-bottom: 0; }
.mcq-stem { display: flex; gap: 10px; align-items: flex-start; }
.mcq-stem p { margin: 0; font-weight: 700; color: var(--ink); }
.mcq-n {
  flex: 0 0 auto; font-size: 12px; font-weight: 800;
  color: var(--lavender-deep); background: var(--lavender);
  padding: 3px 9px; border-radius: 8px;
}
.mcq-opts { display: grid; gap: 8px; margin-top: 12px; }
.mcq-opt {
  display: flex; gap: 10px; align-items: center;
  width: 100%; text-align: start;
  border: 1.5px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 10px 12px;
  cursor: pointer; font-family: inherit; color: var(--ink); font-size: 14px;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.mcq-opt:hover:not(.locked) { border-color: var(--lavender-deep); transform: translateX(2px); }
.mcq-letter {
  flex: 0 0 auto;
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  color: var(--ink-soft); background: var(--cream-2);
}
.mcq-choice { flex: 1 1 auto; }
.mcq-opt.locked { cursor: default; }
.mcq-opt.locked:not(.correct):not(.wrong) { opacity: .6; }
.mcq-opt.correct {
  border-color: var(--good); background: #eef8f1;
}
.mcq-opt.correct .mcq-letter { background: var(--good); color: #fff; }
.mcq-opt.wrong {
  border-color: #e7a8a8; background: #fbeeee;
}
.mcq-opt.wrong .mcq-letter { background: #d98a8a; color: #fff; }
.mcq-rationale {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .4s cubic-bezier(.2,.7,.2,1), opacity .35s ease, margin .35s ease;
  opacity: 0; margin-top: 0;
}
.mcq-card.show-rationale .mcq-rationale { grid-template-rows: 1fr; opacity: 1; margin-top: 12px; }
.mcq-rationale > * { min-height: 0; }
.mcq-rationale {
  background: var(--cream-2);
  border-radius: 12px;
}
.mcq-card.show-rationale .mcq-rationale { padding: 0; }
.mcq-rat-lbl {
  display: inline-block; padding: 11px 13px 0;
  font-size: 11px; font-weight: 800; letter-spacing: .3px;
  color: var(--ink-faint); text-transform: uppercase;
}
.mcq-rationale p { margin: 4px 0 0; padding: 0 13px; color: var(--ink-soft); }
.mcq-rationale .rd-chips { padding: 8px 13px 11px; margin: 0; }
.feedback-pulse { animation: mcqPulse .55s ease-out; }
@keyframes mcqPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

/* ---------- Flashcards ---------- */
.rd-flash { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.flash-card {
  width: 100%; max-width: 460px; height: 230px;
  border: 0; background: transparent; padding: 0; cursor: pointer;
  perspective: 1300px;
  font-family: inherit;
}
.flash-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.2,.7,.2,1);
}
.flash-card.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; overflow-y: auto;
  box-shadow: var(--shadow);
}
.flash-face.front { background: linear-gradient(135deg, #fff, var(--cream-2)); }
.flash-face.back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, var(--lavender), #fff);
}
.flash-tag {
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  color: var(--ink-faint);
}
.flash-text { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.flash-face.back .flash-text { font-weight: 600; }
.flash-controls {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; max-width: 460px;
}
.flash-counter { font-size: 13.5px; font-weight: 800; color: var(--ink-soft); min-width: 64px; text-align: center; }
.flash-controls .mini-btn { flex: 0 0 auto; }
.flash-controls .mini-btn.prev svg { transform: rotate(180deg); }
.flash-hint { font-size: 12px; color: var(--ink-faint); }
.flash-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- Mistake Traps ---------- */
.trap-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); box-shadow: var(--shadow-soft);
  margin-bottom: 10px; overflow: hidden;
}
.trap-card:last-child { margin-bottom: 0; }
.trap-head {
  width: 100%; display: flex; gap: 11px; align-items: center;
  text-align: start; border: 0; background: transparent;
  padding: 13px 14px; cursor: pointer; font-family: inherit; color: inherit;
}
.trap-x {
  flex: 0 0 auto; color: #c98a3e;
  display: inline-grid; place-items: center;
}
.trap-x svg { width: 18px; height: 18px; }
.trap-mistake { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 14.5px; color: var(--ink); }
.trap-chev { flex: 0 0 auto; color: var(--ink-faint); transition: transform .3s ease; }
.trap-chev svg { transform: rotate(90deg); }
.trap-card.open .trap-chev { transform: rotate(180deg); }
.trap-panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .38s cubic-bezier(.2,.7,.2,1);
}
.trap-card.open .trap-panel { grid-template-rows: 1fr; }
.trap-inner { overflow: hidden; min-height: 0; }
.trap-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.trap-line p { margin: 4px 0 0; }
.trap-line.correction p { color: var(--ink); }
.trap-line.hook p { color: var(--ink-soft); }
.trap-lbl {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  color: var(--ink-faint);
}
.trap-lbl.ok { color: var(--good-deep); }
.trap-lbl svg { width: 12px; height: 12px; }
.trap-line.hook {
  background: var(--cream-2); border-radius: 10px; padding: 9px 11px;
}

/* ---------- Source Map ---------- */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; background: var(--card);
  border-inline-start: 3px solid var(--lavender-deep);
  display: flex; flex-direction: column; gap: 4px;
}
.role-label { font-size: 13px; font-weight: 800; color: var(--ink); }
.role-text { font-size: 13px; color: var(--ink-soft); }
.srcmap-pages { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 7px; }
.srcmap-pages li {
  display: flex; gap: 9px; align-items: baseline; flex-wrap: wrap;
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 12px;
}
.smp-tag {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 800; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 999px;
}
.smp-tag.mcu { color: #b85c86; background: var(--blush); }
.smp-tag.egan { color: #6a5fb0; background: var(--lavender); }
.smp-ch { font-weight: 800; font-size: 13px; color: var(--ink); flex: 0 0 auto; }
.smp-title { flex: 1 1 140px; font-size: 13px; color: var(--ink-soft); }
.smp-pages { font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.srcmap-list { display: grid; gap: 9px; }
.srcmap-row {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; background: var(--card);
}
.srcmap-sub { font-weight: 800; font-size: 14px; color: var(--ink); }
.srcmap-note { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ink-soft); }
.rd-srcnote {
  margin-top: 14px; padding: 11px 13px;
  font-size: 12.5px; color: var(--ink-soft);
  background: var(--cream-2); border: 1px dashed var(--lavender-deep);
  border-radius: 12px;
}

/* ---------- Reader responsive ---------- */
@media (max-width: 480px) {
  .study-reader-card { padding: 14px 12px; }
  .step { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; }
  .step-dot { width: 28px; height: 28px; font-size: 13px; }
  .step-ic { width: 34px; height: 34px; }
  .step-title { font-size: 15px; }
  .rd-twocol { grid-template-columns: 1fr; }
  .formula-grid { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr; }
  .step-foot { gap: 8px; }
  .mini-btn.next-btn { margin-inline-start: 0; width: 100%; justify-content: center; }
  .flash-card { height: 250px; }
}
@media (min-width: 481px) and (max-width: 900px) {
  .flash-card { height: 240px; }
}

/* ---------- Reader reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .flash-inner { transition: none !important; }
  .step-panel, .trap-panel, .sc-reveal, .mcq-rationale {
    transition: none !important;
  }
  /* Open states still render fully without animating. */
  .step.is-open .step-panel,
  .trap-card.open .trap-panel,
  .scenario-card.revealed .sc-reveal,
  .mcq-card.show-rationale .mcq-rationale { grid-template-rows: 1fr; }
}
