:root {
  --bg-cream: #fbf3e4;
  --hero-dark: #1a1208;
  --accent-pink: #e63973;
  --accent-gold: #f2c14e;
  --accent-teal: #2d8c7f;
  --ink: #1a1208;
  --muted: #6b5d4a;
  --card-bg: #fff8ec;
  --border: #d6c8a8;
  --fred-bg: #1f2a23;
  --fred-green: #6dd99a;
  --correct-green: #2d8c5a;
  --wrong-red: #c43d3d;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Georgia, "Times New Roman", serif; background: var(--bg-cream); color: var(--ink); line-height: 1.6; }
a { color: inherit; }
.top-bar { background: var(--hero-dark); color: #fff; padding: 14px 32px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo { font-weight: bold; font-size: 22px; }
.logo-link { text-decoration: none; color: #fff; }
.logo-link:hover { color: var(--accent-gold); }
.top-bar .buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.top-bar .buttons button { background: #2c2114; color: #fff; border: 1px solid #3d3020; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.fred-bar { background: var(--fred-bg); color: var(--fred-green); padding: 14px 32px; display: flex; gap: 14px; align-items: center; border-bottom: 1px solid #2a3a2f; }
.fred-avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-gold), #d9a632); color: #1f2a23; display: flex; align-items: center; justify-content: center; font-size: 28px; box-shadow: inset 0 2px 8px rgba(255,255,255,.25); flex: 0 0 auto; }
.fred-avatar svg.fm-logo { width: 64%; height: 64%; display: block; }
.fred-bar .name { color: #fff; font-weight: bold; margin-right: 8px; }
.hero { background: var(--hero-dark); color: #fff; padding: 56px 32px; }
.hero .breadcrumb { color: var(--accent-gold); text-transform: uppercase; letter-spacing: 2px; font-size: 13px; margin-bottom: 16px; }
.hero h1 { font-size: clamp(40px, 6vw, 62px); margin: 0 0 12px; line-height: 1.05; }
.hero .byline { color: #c9b890; font-style: italic; font-size: 18px; margin-bottom: 20px; max-width: 980px; }
.hero .tags { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .tag { padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; border: 2px solid var(--accent-pink); color: var(--accent-pink); }
.hero .tag.grade { background: var(--accent-pink); color: #fff; }
.hero .tag.questions { background: var(--accent-gold); color: var(--ink); border-color: var(--accent-gold); }
.tools-bar { background: var(--bg-cream); padding: 12px 32px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tools-bar button { background: #fff8ec; border: 1px solid var(--border); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.tab-nav { background: var(--bg-cream); padding: 0 32px; border-bottom: 1px solid var(--border); display: flex; gap: 24px; overflow-x: auto; }
.tab-nav a { background: none; border: none; padding: 18px 4px; font-size: 17px; color: var(--muted); cursor: pointer; font-family: inherit; border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; display: inline-block; }
.tab-nav a.active { color: var(--accent-pink); border-bottom-color: var(--accent-pink); font-weight: bold; }
.progress-strip { position: sticky; top: 0; z-index: 100; background: linear-gradient(135deg, #fef6e0, #f5ead0); border-bottom: 2px solid var(--accent-pink); padding: 10px 32px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.progress-chip { font-weight: bold; color: var(--accent-pink); }
.progress-action { background: #fff8ec; border: 1px solid var(--border); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.page-shell { max-width: 1120px; margin: 0 auto; padding: 24px 24px 60px; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.intro-card, .story-card, .strategy-card, .question-card, .review-card, .library-card, .set-summary, .guided-card, .lesson-card, .question-type-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: 0 8px 24px rgba(26, 18, 8, 0.06); margin-bottom: 18px; }
.section-header { font-size: 30px; margin: 8px 0 14px; }
.library-grid, .lesson-grid, .type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.lesson-card h3, .question-type-card h3 { margin-top: 0; }
.lesson-card .meta { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.cta-row a, .cta-row button { background: var(--accent-pink); color: white; padding: 10px 14px; border-radius: 8px; text-decoration: none; border: none; cursor: pointer; font-family: inherit; }
.cta-row .secondary { background: var(--accent-teal); }
.bullet-list { margin: 0; padding-left: 20px; }
.guided-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.guided-card button { background: var(--accent-teal); color: #fff; border: none; border-radius: 8px; padding: 10px 14px; cursor: pointer; font-family: inherit; }
.guided-reveal { margin-top: 12px; padding: 12px 14px; border-left: 4px solid var(--accent-teal); background: #f4fbf9; display: none; }
.guided-reveal.show { display: block; }
.question-card h4 { margin: 0 0 12px; font-size: 20px; }
.question-family { font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-teal); font-weight: bold; margin-bottom: 8px; }
.options { display: grid; gap: 10px; margin-top: 16px; }
.option-btn { width: 100%; text-align: left; background: white; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-family: inherit; font-size: 16px; display: flex; gap: 12px; align-items: center; }
.option-btn:hover { border-color: var(--accent-pink); }
.option-btn.correct { border-color: var(--correct-green); background: #effaf4; }
.option-btn.wrong { border-color: var(--wrong-red); background: #fff4f4; }
.feedback { margin-top: 14px; padding: 14px 16px; border-radius: 12px; display: none; }
.feedback.show { display: block; }
.feedback.correct { background: #effaf4; border: 1px solid #c7e7d3; }
.feedback.wrong { background: #fff4f4; border: 1px solid #efc7c7; }
.analogy-line, .sentence-prompt, .number-puzzle, .number-series { font-size: 22px; line-height: 1.35; }
.classification-group { display: flex; gap: 10px; flex-wrap: wrap; }
.group-chip { padding: 8px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border); }
.foundation-shape-strip { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.foundation-shape-card { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 110px; }
.foundation-shape-frame { width: 92px; height: 92px; border: 1px solid var(--border); border-radius: 16px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--hero-dark); }
.foundation-shape-svg { width: 74px; height: 74px; overflow: visible; }
.foundation-picture-strip { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.foundation-picture-card { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 110px; }
.foundation-picture-frame { width: 92px; height: 92px; border: 1px solid var(--border); border-radius: 16px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 44px; }
.option-btn .foundation-shape-card { flex-direction: row; align-items: center; min-width: 0; }
.option-btn .foundation-shape-frame { width: 58px; height: 58px; border-radius: 12px; flex: 0 0 auto; }
.option-btn .foundation-shape-svg { width: 44px; height: 44px; }
.matrix-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 340px; margin-top: 10px; }
.matrix-cell { min-height: 86px; border: 1px solid var(--border); border-radius: 14px; display: flex; justify-content: center; align-items: center; background: #fff; }
.matrix-cell.blank { background: linear-gradient(135deg, #fffaf0, #f8edd9); }
.blank-mark { font-size: 36px; color: var(--accent-pink); font-weight: bold; }
.shape-token { display: flex; gap: 8px; justify-content: center; align-items: center; font-size: 30px; min-height: 56px; }
.tiny-figure-card { display: flex; justify-content: center; align-items: center; min-height: 70px; }
.classification-figures { display: flex; gap: 12px; flex-wrap: wrap; }
.hole-grid { display: grid; grid-template-columns: repeat(var(--cols), 24px); gap: 6px; margin-top: 12px; }
.hole-cell { width: 24px; height: 24px; border-radius: 6px; background: #fff; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.hole-cell.hole { background: #ffe7ef; color: var(--accent-pink); border-color: var(--accent-pink); }
.paper-direction { margin-top: 0; }
.bottom-bar { background: var(--hero-dark); color: #fff; padding: 18px 32px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bottom-bar a { color: #fff; }
.modal-overlay { position: fixed; inset: 0; background: rgba(10,10,10,.5); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay.show { display: flex; }
.modal-card { background: #fff8ec; width: min(620px, calc(100vw - 32px)); border-radius: 18px; padding: 24px; border: 1px solid var(--border); box-shadow: 0 12px 32px rgba(0,0,0,.2); }
.modal-card h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.modal-actions button, .modal-actions a { background: var(--accent-teal); color: #fff; border: none; border-radius: 8px; padding: 10px 14px; cursor: pointer; text-decoration: none; font-family: inherit; }
.pill { display: inline-block; padding: 5px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 13px; }
.counts-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.count-box { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; min-width: 140px; }
.count-box strong { display: block; font-size: 26px; color: var(--accent-pink); }
.muted-note { color: var(--muted); }
@media (max-width: 720px) {
  .hero, .top-bar, .fred-bar, .tools-bar, .tab-nav, .progress-strip, .bottom-bar { padding-left: 18px; padding-right: 18px; }
  .page-shell { padding-left: 16px; padding-right: 16px; }
  .hero h1 { font-size: 42px; }
}

/* OLSAT item types (Flying Minds additions) */
.figure-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.figure-row .rel { font-size: 16px; color: var(--muted); font-style: italic; }
.figure-row .blank-mark { font-size: 36px; color: var(--accent-pink); font-weight: bold; }
.pattern-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 420px; margin-top: 10px; }
.letter-series { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.letter-box { min-width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: bold; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.letter-box.blank { color: var(--accent-pink); background: linear-gradient(135deg, #fffaf0, #f8edd9); }
.num-cell { font-size: 28px; font-weight: bold; }

.bubble-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.bubble { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bub-letter { font-weight: bold; font-size: 14px; }
.bub { font-size: 26px; color: var(--muted); }
.bub.filled { color: var(--accent-pink); }

/* Read-aloud button */
.read-btn { font-family: inherit; font-size: 13px; background: var(--accent-teal); color: #fff; border: none; border-radius: 8px; padding: 4px 10px; cursor: pointer; vertical-align: middle; margin-left: 8px; }
.read-btn:hover { filter: brightness(1.08); }

/* Primary (K-1) picture rendering */
.pic { font-size: 30px; line-height: 1; }
.picture-card { display: inline-flex; align-items: center; justify-content: center; min-width: 56px; min-height: 56px; font-size: 38px; }
.picture-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.picture-row .rel { font-size: 30px; color: var(--accent-pink); font-weight: bold; }
.count-pics { font-size: 34px; letter-spacing: 6px; margin-top: 8px; line-height: 1.6; }
.sd-card { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sd-letter { font-weight: bold; font-size: 14px; }

/* Following Directions boxes */
.fd-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.fd-box { border: 2px solid var(--border); border-radius: 12px; background: #fff; padding: 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 70px; }
.fd-box .fd-letter { font-weight: bold; font-size: 14px; color: var(--accent-teal); }
.fd-box .shape-token { font-size: 26px; min-height: 40px; }

/* Progress tracker UI */
.fm-bar { background: #eaddc2; border-radius: 999px; height: 12px; overflow: hidden; margin-top: 4px; max-width: 460px; }
.fm-bar-fill { height: 100%; border-radius: 999px; }
.fm-chip { color: #fff; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: bold; white-space: nowrap; }
.fm-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.fm-table th, .fm-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 15px; text-align: left; vertical-align: middle; }
.fm-table th { background: #f3e7cf; }
.fm-table tr:last-child td { border-bottom: none; }
