/* EKG — clean medical, friendly identity
   Warm off-white paper, deep heart red, sage green, soft gold.
   Serif headlines (Fraunces) + clean sans body (Inter).
*/

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --paper:        #FBF8F4;
  --paper-deep:   #F4EFE7;
  --card:         #FFFFFF;
  --ink:          #221F1C;
  --ink-soft:     #5B544C;
  --ink-faint:    #9C948A;
  --rule:         #EAE2D5;

  --heart:        #C8453E;   /* primary */
  --heart-deep:   #8C2F2A;
  --heart-soft:   #F4D7D2;

  --sage:         #6B9080;   /* correct/healthy */
  --sage-deep:    #436358;
  --sage-soft:    #DCE9E3;

  --gold:         #E0A458;   /* XP/badges */
  --gold-soft:    #FAEBD3;

  --shadow:       0 1px 2px rgba(34,31,28,0.04), 0 8px 24px rgba(34,31,28,0.06);
  --shadow-lift:  0 2px 4px rgba(34,31,28,0.06), 0 16px 40px rgba(34,31,28,0.10);

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 22px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 12% -10%, rgba(200,69,62,0.05), transparent 40%),
    radial-gradient(circle at 95% 110%, rgba(107,144,128,0.06), transparent 45%);
  background-attachment: fixed;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; }
h2 { font-size: 1.5rem; line-height: 1.2; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }
strong { color: var(--ink); }
em { font-style: italic; color: var(--ink-soft); }

/* ============ Layout shell ============ */

.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--heart-soft);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
}
.brand-mark svg { width: 28px; height: 28px; color: var(--heart); }
.brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.brand-tag {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: -2px;
}

.stats {
  display: flex;
  gap: 10px;
  align-items: center;
}
.stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--paper-deep);
  font-weight: 600;
  font-size: 0.9rem;
}
.stat--streak  { color: var(--heart-deep); background: var(--heart-soft); }
.stat--xp      { color: #8a6322;          background: var(--gold-soft); }
.stat--preview { color: var(--sage-deep); background: var(--sage-soft); font-variant: small-caps; letter-spacing: 0.04em; }
.stat--edit    { color: var(--heart-deep); background: var(--heart-soft); font-variant: small-caps; letter-spacing: 0.04em; }
.stat .label  { font-weight: 500; color: var(--ink-soft); }

/* ============ Animated EKG line motif ============ */

.pulse-band {
  height: 60px;
  width: 100%;
  margin-bottom: 28px;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: linear-gradient(180deg, transparent, var(--paper-deep));
  position: relative;
}
.pulse-band svg { width: 200%; height: 100%; display: block; }
.pulse-band path {
  stroke: var(--heart);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: pulseScroll 6s linear infinite;
}
@keyframes pulseScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============ Today's lesson card ============ */

.today {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  padding: 32px;
  box-shadow: var(--shadow-lift);
  position: relative;
  overflow: hidden;
  margin-bottom: 36px;
}
.today::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(180deg, var(--heart-soft) 0%, transparent 30%);
  opacity: 0.35;
  pointer-events: none;
}
.today > * { position: relative; }

.today .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--heart-deep);
  background: var(--heart-soft);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
  font-weight: 600;
}
.today .kicker::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--heart);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.today h1 { margin-bottom: 6px; }
.today .hook {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-bottom: 22px;
}
.today .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============ Buttons ============ */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  transition: transform 80ms ease, box-shadow 200ms ease, background 200ms ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--heart);
  color: #fff;
  box-shadow: 0 6px 16px rgba(200,69,62,0.25);
}
.btn--primary:hover { background: var(--heart-deep); }

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.btn--ghost:hover { background: var(--paper-deep); color: var(--ink); }

.btn--sage {
  background: var(--sage);
  color: #fff;
  box-shadow: 0 6px 16px rgba(107,144,128,0.25);
}
.btn--sage:hover { background: var(--sage-deep); }

/* ============ Path / Units ============ */

.path-title {
  font-size: 1.6rem;
  margin-bottom: 4px;
}
.path-sub {
  color: var(--ink-soft);
  margin-bottom: 28px;
}

.unit {
  margin-bottom: 28px;
}
.unit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 0 4px 12px;
  border-bottom: 1px dashed var(--rule);
  margin-bottom: 14px;
}
.unit-head h2 { margin: 0; }
.unit-head .subtitle {
  font-size: 0.9rem;
  color: var(--ink-faint);
}

.lessons {
  display: grid;
  gap: 10px;
}

.lesson-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
  transition: transform 100ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.lesson-row:hover {
  border-color: var(--heart-soft);
  box-shadow: var(--shadow);
}
.lesson-row[data-status="locked"],
.lesson-row[data-status="soon"],
.lesson-row[data-status="tomorrow"] {
  cursor: not-allowed;
  opacity: 0.55;
}
.lesson-row[data-status="locked"]:hover,
.lesson-row[data-status="soon"]:hover,
.lesson-row[data-status="tomorrow"]:hover {
  border-color: var(--rule);
  box-shadow: none;
}
.lesson-row[data-status="soon"] .lesson-meta,
.lesson-row[data-status="tomorrow"] .lesson-meta {
  color: var(--heart-deep);
  font-style: italic;
}
.lesson-row[data-status="today"] {
  border-color: var(--heart);
  background: linear-gradient(180deg, var(--heart-soft) 0%, var(--card) 90%);
}
.lesson-row[data-status="done"] .lesson-title { color: var(--ink-soft); }

.lesson-pill {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-deep);
  color: var(--ink-faint);
  font-weight: 700;
  font-size: 0.85rem;
}
.lesson-row[data-status="done"] .lesson-pill { background: var(--sage-soft); color: var(--sage-deep); }
.lesson-row[data-status="today"] .lesson-pill { background: var(--heart); color: #fff; }

.lesson-title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
}
.lesson-hook {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 2px;
}

.lesson-meta {
  font-size: 0.8rem;
  color: var(--ink-faint);
  white-space: nowrap;
}
.lesson-meta .xp {
  color: #8a6322;
  background: var(--gold-soft);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

/* ============ Lesson reader ============ */

.reader {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  padding: 36px clamp(20px, 5vw, 56px) 44px;
  box-shadow: var(--shadow);
}
.reader header { margin-bottom: 24px; }
.reader .crumb {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.reader h1 { font-size: 2.2rem; margin-bottom: 4px; }
.reader .hook {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.2rem;
  color: var(--ink-soft);
}

.reader .body {
  font-size: 1.05rem;
  color: var(--ink);
}
.reader .body p { margin-bottom: 1.1em; }
.reader .body h3 { margin: 1.6em 0 0.5em; color: var(--heart-deep); }
.reader .body ol, .reader .body ul { margin: 0 0 1.2em 1.4em; }
.reader .body li { margin-bottom: 0.4em; }

.callout {
  background: var(--sage-soft);
  border-left: 4px solid var(--sage);
  padding: 16px 20px;
  border-radius: var(--radius-s);
  margin: 24px 0;
  color: var(--ink);
}
.callout strong { color: var(--sage-deep); }

.diagram {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  margin: 20px auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: 12px;
}
.diagram .dlabel    { font: 600 11px 'Inter', sans-serif; fill: var(--ink); }
.diagram .dlabel-sm { font: 500 10px 'Inter', sans-serif; fill: var(--ink-soft); }

.reader .body p.source {
  margin-top: 1.8em;
  padding-top: 0.9em;
  border-top: 1px dashed var(--rule);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-faint, var(--ink-soft));
}
.reader .body p.source a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.reader .body p.source a:hover { color: var(--heart-deep); }

.reader-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

/* ============ Quiz ============ */

.quiz {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  padding: 32px clamp(20px, 5vw, 48px);
  box-shadow: var(--shadow);
}
.quiz .progress {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.quiz .progress-bar {
  height: 6px;
  background: var(--paper-deep);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}
.quiz .progress-bar > div {
  height: 100%;
  background: var(--heart);
  border-radius: 999px;
  transition: width 300ms ease;
}
.quiz h2 {
  font-size: 1.5rem;
  margin-bottom: 22px;
}

.choices { display: grid; gap: 10px; }
.choice {
  text-align: left;
  font: inherit;
  padding: 14px 18px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-m);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 80ms ease;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--ink);
}
.choice:hover { border-color: var(--heart); background: #fff; }
.choice .letter {
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--rule);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.choice[data-state="correct"] {
  border-color: var(--sage);
  background: var(--sage-soft);
  cursor: default;
}
.choice[data-state="correct"] .letter {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}
.choice[data-state="wrong"] {
  border-color: var(--heart);
  background: var(--heart-soft);
  cursor: default;
}
.choice[data-state="wrong"] .letter {
  background: var(--heart);
  color: #fff;
  border-color: var(--heart);
}
.choice[data-state="disabled"] { opacity: 0.55; cursor: default; }

.explain {
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--paper-deep);
  border-radius: var(--radius-m);
  font-size: 0.95rem;
  color: var(--ink);
  border-left: 3px solid var(--ink-faint);
}
.explain.correct  { border-left-color: var(--sage); background: var(--sage-soft); }
.explain.wrong    { border-left-color: var(--heart); background: var(--heart-soft); }
.explain strong   { display: block; margin-bottom: 4px; }

.quiz-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============ Completion screen ============ */

.complete {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  padding: 56px 32px;
  box-shadow: var(--shadow-lift);
}
.complete .medal {
  width: 96px; height: 96px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #F6D08C, var(--gold) 60%, #B47A2C);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 16px 36px rgba(224,164,88,0.35);
  position: relative;
}
.complete .medal::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px dashed var(--gold);
  opacity: 0.4;
  animation: spin 16s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.complete h1 { font-size: 2.2rem; }
.complete p  { color: var(--ink-soft); max-width: 36ch; margin: 0 auto 24px; }
.complete .score {
  display: inline-flex;
  gap: 18px;
  margin: 16px 0 28px;
}
.complete .score > div {
  background: var(--paper-deep);
  padding: 10px 18px;
  border-radius: var(--radius-m);
  font-weight: 600;
}
.complete .score .num {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.8rem;
  color: var(--heart-deep);
}
.complete .score .lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

/* ============ Empty / locked state ============ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-soft);
}
.empty-state h2 { color: var(--ink); }

/* ============ Tiny utility ============ */

.hidden { display: none !important; }
.center { text-align: center; }

/* ============ Intro (first-visit landing) ============ */

body.intro-active .topbar,
body.intro-active .pulse-band { display: none; }

.intro {
  max-width: 640px;
  margin: 40px auto 0;
  padding: 32px clamp(20px, 5vw, 48px) 60px;
  text-align: center;
}

.intro-line {
  height: 90px;
  margin-bottom: 36px;
  overflow: hidden;
  border-radius: var(--radius-m);
  position: relative;
  background: linear-gradient(180deg, transparent, var(--paper-deep));
}
.intro-line svg {
  width: 200%;
  height: 100%;
  display: block;
}
.intro-line path {
  fill: none;
  stroke: var(--heart);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: pulseScroll 6s linear infinite;
}

.intro .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--heart-deep);
  background: var(--heart-soft);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 22px;
  font-weight: 600;
}
.intro .kicker::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--heart);
  animation: blink 1.4s ease-in-out infinite;
}

.intro h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.intro-sub {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  color: var(--heart-deep);
  margin: 0 0 30px;
  font-style: italic;
}

.intro-lead {
  font-size: 1.1rem;
  color: var(--ink);
  line-height: 1.7;
  max-width: 50ch;
  margin: 0 auto 36px;
}

.intro-cta {
  margin: 0 0 22px;
}
.intro-cta .btn--primary {
  font-size: 1.05rem;
  padding: 14px 28px;
}

.intro-footnote {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 0;
}

/* ============ WYSIWYG editor (in-page editing, ?edit) ============ */

/* Make space for the fixed save bar at the bottom of the viewport */
body.has-edit-flag .shell { padding-bottom: 120px; }

/* Edit affordances on the live lesson elements ----------------------------- */
.edit-on [contenteditable="true"] {
  transition: background-color 100ms ease, outline-color 100ms ease;
  outline: 1px dashed transparent;
  outline-offset: 4px;
  border-radius: 4px;
}
.edit-on [contenteditable="true"]:hover {
  background-color: rgba(244, 215, 210, 0.18);
  outline-color: var(--heart-soft);
}
.edit-on [contenteditable="true"]:focus {
  background-color: rgba(244, 215, 210, 0.32);
  outline: 2px solid var(--heart);
  outline-offset: 3px;
}
.edit-on [contenteditable="true"]:empty::before,
.edit-on [contenteditable="true"][data-empty]::before {
  content: attr(data-placeholder);
  color: var(--ink-faint);
  font-style: italic;
  pointer-events: none;
}

/* Formatting toolbar ------------------------------------------------------- */
.ed-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  margin: 28px 0 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 12px;
  z-index: 5;
  flex-wrap: wrap;
}
.ed-tool {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 6px;
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: background 100ms ease;
}
.ed-tool:hover { background: var(--paper-deep); color: var(--heart-deep); }
.ed-tool:active { background: var(--heart-soft); }
.ed-tool-sep {
  width: 1px; height: 18px;
  background: var(--rule);
  margin: 0 4px;
}

/* Inline quiz editor ------------------------------------------------------- */
.ed-quiz-editor {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px dashed var(--rule);
}
.ed-quiz-title {
  margin: 0 0 6px;
  color: var(--heart-deep);
  font-size: 1.4rem;
}
.ed-quiz-hint {
  color: var(--ink-faint);
  font-size: 0.85rem;
  margin: 0 0 22px;
}
.qedit-list { display: grid; gap: 18px; margin-bottom: 18px; }

.qedit-card {
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: 22px;
  display: grid;
  gap: 14px;
}
.qedit-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.qedit-num {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  color: var(--heart-deep);
  font-size: 1.05rem;
}
.qedit-rm {
  appearance: none;
  font: inherit;
  font-size: 0.78rem;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  padding: 4px 12px;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.qedit-rm:hover { color: var(--heart); border-color: var(--heart); background: #fff; }

.qedit-q {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  padding: 6px 10px;
  margin: -6px -10px;
  border-radius: 6px;
}

.qedit-choices { display: grid; gap: 8px; }
.qedit-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-m);
  padding: 10px 14px;
  transition: border-color 120ms ease, background 120ms ease;
}
.qedit-choice[data-correct="true"] {
  border-color: var(--sage);
  background: var(--sage-soft);
}
.qedit-correct-btn {
  appearance: none;
  border: 1.5px solid var(--rule);
  background: var(--card);
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 120ms ease;
}
.qedit-correct-btn:hover {
  border-color: var(--sage);
  color: var(--sage-deep);
}
.qedit-choice[data-correct="true"] .qedit-correct-btn {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}
.qedit-choice-text {
  flex: 1;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 4px;
  font-size: 0.95rem;
}

.qedit-explain-label {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin-top: 4px;
}
.qedit-explain {
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  min-height: 48px;
}
.qedit-add {
  display: block;
  margin: 0 auto;
}

/* Floating save bar ------------------------------------------------------- */
.ed-savebar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -8px 28px rgba(34,31,28,0.08);
  z-index: 50;
  padding: 14px clamp(16px, 4vw, 28px);
}
.ed-savebar.hidden { display: none; }
.ed-savebar-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.ed-savebar-status {
  font-size: 0.88rem;
  color: var(--heart-deep);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.ed-savebar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ed-savebar-actions .btn {
  padding: 10px 18px;
  font-size: 0.92rem;
}

/* Edited tag in the path ------------------------------------------------- */
.edited-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--sage-deep);
  background: var(--sage-soft);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  vertical-align: middle;
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ============ Mobile ============ */

@media (max-width: 600px) {
  .shell { padding: 16px 14px 60px; }
  .today { padding: 24px 20px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .stats { justify-content: center; }
  .brand { justify-content: center; }
  .reader { padding: 24px 18px 32px; }
  .quiz   { padding: 22px 18px; }
  .lesson-row { grid-template-columns: 32px 1fr; }
  .lesson-row .lesson-meta { grid-column: 2; padding-top: 4px; }
}
