/* Study path: 🧭 पढ़ने का रास्ता loop, first-visit onboarding (welcome · coach-mark tour · loop explainer),
   returning-user 🎯 आज क्या पढ़ें card. Shared by every chapter page, the homepage and how-to-study. */
:root { --sp-card: #ffffff; --sp-ink: #1a1a2e; --sp-muted: #4b5068; --sp-soft: #f3ece2; --sp-border: #e2d8ca;
  --sp-teal: #0f766e; --sp-acc: #f59e0b; --sp-on-acc: #111111; --sp-ring: #b45309; }
html[data-theme="dark"] { --sp-card: #171b2e; --sp-ink: #e8eaf4; --sp-muted: #b4b9d4; --sp-soft: #21263f; --sp-border: #2f3658;
  --sp-teal: #5eead4; --sp-acc: #fbbf24; --sp-on-acc: #111111; --sp-ring: #fbbf24; }

/* loop strip */
.swm-loop { background: var(--sp-card); color: var(--sp-ink); border: 1px solid var(--sp-border); border-radius: 18px; padding: 12px 14px; margin: 12px 0; }
.swm-loop__h { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.swm-loop__h b { font-size: 1.05rem; }
.swm-loop__h span { display: flex; gap: 10px; align-items: center; font-size: var(--fs-xs); }
.swm-loop__h a { color: var(--sp-teal); font-weight: 700; }
.swm-loop__again { display: none; background: none; border: 0; padding: 4px 0; color: var(--sp-teal); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
html.js .swm-loop__again { display: inline; }
.swm-loop ol { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 0; margin: 0; }
.swm-loop li a { display: block; text-align: center; background: var(--sp-soft); color: var(--sp-ink); border-radius: 12px; padding: 7px 2px; font-size: var(--fs-xs); font-weight: 800; text-decoration: none; line-height: 1.25; }
.swm-loop li a span { display: block; font-size: 1.3rem; line-height: 1.2; }
.swm-loop li a small { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--sp-muted); }
.swm-loop li a:hover, .swm-loop li a:focus-visible { outline: 2px solid var(--sp-teal); }
.swm-loop li.now a { outline: 2px solid var(--sp-acc); }
.swm-loopx__list { padding-left: 0; list-style: none; }
.swm-loopx__list li { background: var(--sp-soft); border-radius: 14px; padding: 10px 12px; margin: 8px 0; }
.swm-loopx__list li p { margin: 4px 0 0; }
.swm-loopx__flow { text-align: center; font-weight: 800; color: var(--sp-teal); }

/* today card: space is reserved before first paint (html.swm-ret is set in <head>) so nothing shifts */
.swm-today { display: none; }
html.swm-ret .swm-today { display: block; box-sizing: border-box; height: 272px; overflow: hidden; contain: layout paint;
  background: var(--sp-card); color: var(--sp-ink); border: 1.5px solid var(--sp-teal); border-radius: 18px; padding: 12px 14px; margin: 10px 0 12px; }
@media (min-width: 700px) { html.swm-ret .swm-today { height: 240px; } }
.swm-today h2 { margin: 0; font-size: var(--fs-h2); display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.swm-today .sp-sub { margin: 2px 0 6px; color: var(--sp-muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swm-today .sp-pbar { height: 8px; background: var(--sp-soft); border-radius: 9px; overflow: hidden; }
.swm-today .sp-pbar b { display: block; height: 100%; background: var(--sp-teal); }
.sp-next { display: flex; gap: 10px; align-items: center; background: var(--sp-soft); border-radius: 14px; padding: 8px 10px; margin: 8px 0; min-width: 0; }
.sp-next .sp-thumb { width: 84px; height: 48px; flex: none; border-radius: 10px; background: #1e3a8a center/cover no-repeat; color: #fff; display: grid; place-items: center; font-size: 1.2rem; }
.sp-next div { min-width: 0; }
.sp-next b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-next small { display: block; color: var(--sp-muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-row { display: flex; gap: 8px; }
.sp-btn { flex: 1; display: block; text-align: center; background: var(--sp-acc); color: var(--sp-on-acc); font: inherit; font-weight: 800; font-size: var(--fs-sm); border: 0; border-radius: 12px; padding: 10px 8px; cursor: pointer; text-decoration: none; }
.sp-btn.ghost { background: transparent; color: var(--sp-teal); border: 2px solid var(--sp-teal); }
.sp-link { background: none; border: 0; padding: 4px 2px; color: var(--sp-muted); text-decoration: underline; font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.sp-exam { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 6px; font-size: var(--fs-xs); color: var(--sp-ink); }
.sp-exam b { color: var(--sp-teal); }
.sp-exam input { font: inherit; font-size: var(--fs-xs); background: var(--sp-soft); color: var(--sp-ink); border: 1px solid var(--sp-border); border-radius: 8px; padding: 2px 4px; max-width: 150px; }

/* modal (welcome + loop explainer) */
.sp-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.62); display: flex; align-items: flex-end; justify-content: center; padding: 10px; }
@media (min-width: 700px) { .sp-modal { align-items: center; } }
.sp-sheet { box-sizing: border-box; width: 100%; max-width: 520px; max-height: calc(100vh - 20px); overflow: auto; background: var(--sp-card); color: var(--sp-ink); border: 1px solid var(--sp-border); border-radius: 20px; padding: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.sp-sheet h2 { margin: 0 0 4px; font-size: var(--fs-h2); }
.sp-sheet .sp-sub { color: var(--sp-muted); font-size: var(--fs-xs); margin: 0 0 10px; }
.sp-dots { display: flex; gap: 6px; margin: 0 0 12px; } .sp-dots span { flex: 1; height: 6px; border-radius: 6px; background: var(--sp-soft); } .sp-dots span.on { background: var(--sp-teal); }
.sp-q { font-weight: 800; margin: 10px 0 4px; }
.sp-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 10px; }
.sp-choice button { font: inherit; font-weight: 800; font-size: var(--fs-base); padding: 13px 6px; border-radius: 14px; border: 2px solid var(--sp-border); background: var(--sp-soft); color: var(--sp-ink); cursor: pointer; }
.sp-choice button[aria-pressed="true"] { border-color: var(--sp-teal); outline: 2px solid var(--sp-teal); }
.sp-loopg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.sp-loopg div { background: var(--sp-soft); border-radius: 14px; padding: 10px; text-align: center; }
.sp-loopg div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.sp-loopg span { display: block; font-size: 2rem; line-height: 1.1; } .sp-loopg b { display: block; } .sp-loopg small { color: var(--sp-muted); font-weight: 700; }
.sp-flow { text-align: center; font-weight: 800; color: var(--sp-teal); margin: 4px 0 8px; }
.sp-center { text-align: center; margin: 6px 0 0; }
.sp-sheet .sp-btn { width: 100%; margin-top: 8px; padding: 12px; font-size: var(--fs-base); }

/* coach-mark tour */
.sp-hole { position: fixed; z-index: 995; pointer-events: none; border-radius: 16px; box-shadow: 0 0 0 4px var(--sp-ring), 0 0 0 200vmax rgba(0,0,0,.62); transition: top .2s, left .2s, width .2s, height .2s; }
.sp-block { position: fixed; inset: 0; z-index: 994; }
.sp-tip { position: fixed; z-index: 1001; left: 12px; right: 12px; max-width: 520px; margin: 0 auto; box-sizing: border-box; background: var(--sp-card); color: var(--sp-ink); border: 2px solid var(--sp-ring); border-radius: 16px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.sp-tip .sp-k { font-size: var(--fs-xs); font-weight: 800; color: var(--sp-teal); }
.sp-tip b { display: block; font-size: 1.05rem; }
.sp-tip p { margin: 4px 0 0; color: var(--sp-muted); font-size: var(--fs-sm); }
.sp-tip .sp-row { margin-top: 10px; }
@media (prefers-reduced-motion: no-preference) { .sp-sheet, .sp-tip { animation: spIn .2s ease-out; } @keyframes spIn { from { opacity: 0; transform: translateY(10px); } } }
@media print { .swm-today, .sp-modal, .sp-dim, .sp-tip, .swm-loop { display: none !important; } }
