:root{
  --accent:#f59e0b;
  --title-font:'Patrick Hand', cursive;
  --body-font:'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

body{
  background:#f6f7fb;
  color:#0f172a;
  font-family:var(--body-font);
}

/* ===== Sheet & paper ===== */
.paper{
  background:#fff;
  border-radius:1rem;
  box-shadow:0 10px 20px rgba(0,0,0,.06);
}

/* Anchor sheet frame (pink margin line + paper holes) */
.anchor-sheet{
  position:relative;
  border-radius:1rem;
  border:1px solid rgba(15,23,42,.08);
  overflow:hidden;
}
.anchor-sheet::before{
  content:"";
  position:absolute;
  inset:0;
  border-left:4px solid #ff8ab5;
  transform:translateX(46px);
  pointer-events:none;
  opacity:var(--show-margin, 1);
}
.paper-holes{
  position:absolute;
  left:10px;
  top:0;
  bottom:0;
  width:28px;
  pointer-events:none;
  z-index:5;
  display:flex;
  flex-direction:column;
  justify-content:space-evenly;
  align-items:center;
  padding:40px 0;
}
.paper-hole{
  width:20px;
  height:20px;
  border-radius:50%;
  background:#e8e4df;
  box-shadow:inset 0 2px 4px rgba(0,0,0,0.15), inset 0 -1px 2px rgba(255,255,255,0.4);
  border:1px solid rgba(0,0,0,0.08);
}

/* Backgrounds */
.bg-lined-light{
  background:
    repeating-linear-gradient(#0000, #0000 32px, rgba(15,23,42,.06) 33px, rgba(15,23,42,.06) 34px),
    #fff9e8;
}
.bg-lined-dark{
  background:
    repeating-linear-gradient(#0000, #0000 30px, rgba(15,23,42,.14) 31px, rgba(15,23,42,.14) 32px),
    #f5efe3;
}
.bg-graph{
  background:
    linear-gradient(0deg, rgba(14, 165, 233, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 165, 233, .12) 1px, transparent 1px),
    #ffffff;
  background-size: 20px 20px, 20px 20px, auto;
}
.bg-poster{
  background:#ffffff;
}
.bg-blank{
  background:#ffffff;
}

/* ===== Chart borders ===== */
.anchor-sheet.chart-border-simple { border: 2px solid var(--accent); }
.anchor-sheet.chart-border-thick { border: 5px solid var(--accent); }
.anchor-sheet.chart-border-dashed { border: 3px dashed var(--accent); }
.anchor-sheet.chart-border-double { border: 5px double var(--accent); }

.anchor-sheet.chart-border-sketchy {
  border: 3px solid var(--accent);
  border-radius: 0.4rem 0.6rem 0.3rem 0.7rem;
  box-shadow:
    2px 1px 0 -1px var(--accent),
    -1px 2px 0 -1px var(--accent),
    1px -1px 0 0 var(--accent),
    -2px -1px 0 -1px var(--accent);
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  overflow: visible;
}
.anchor-sheet.chart-border-sketchy::after {
  content: "";
  position: absolute;
  inset: 5px;
  pointer-events: none;
  z-index: 10;
  border: 2px solid var(--accent);
  border-radius: 0.8rem 0.3rem 0.7rem 0.4rem;
  opacity: 0.4;
}

/* Typography & highlight */
.marker-title{
  font-family:var(--title-font);
  font-weight:400;
  color:#0f172a;
  letter-spacing:.3px;
}
.marker-h{
  font-family:var(--title-font);
  color:#0f172a;
  font-size:1.15rem;
  line-height:1.1;
  margin-bottom:.25rem;
}

.hl{
  display:inline;
  padding:0 .15em;
  border-radius:.2em;
}

/* 🔥 Clean underline band — this is the one you liked under “make” */
.hl-clean{
  text-decoration: none;
  background: none;
  border-bottom: 3px solid var(--accent);
  padding-bottom: 1px;
}
.hl-clean:empty{
  border-bottom: none;
  padding: 0;
}
.hl-none{
  background:none;
}

/* Brush stroke underline (baseline aligned) */
.hl-brush{
  background-image: var(--brush-url, none);
  background-repeat:no-repeat;
  background-size:100% .82em;
  background-position: 0 100%;
}

/* Title placeholder */
#chart-title:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-style: italic;
  pointer-events: none;
}

/* Cards */
.card{
  background:#ffffffea;
  border:1px solid rgba(15,23,42,.12);
  border-radius:1rem;
  padding:.75rem .9rem;
  box-shadow:0 6px 14px rgba(0,0,0,.05);
}

/* Card style: Open — left accent border, no box */
#sheet.card-style-open .card {
  background: transparent;
  border: none;
  border-left: 4px solid var(--accent, #f59e0b);
  border-radius: 0;
  box-shadow: none;
  padding: .5rem 0 .5rem .9rem;
}

/* Card style: Clean — no containers at all */
#sheet.card-style-clean .card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: .25rem 0;
}
#sheet.card-style-clean .card .marker-h {
  margin-bottom: 0.25rem;
}
.pretty-list li{
  margin:.25rem 0 .35rem 0;
  padding-left:.1rem;
}

/* Accent swatches */
.swatch{
  width:28px;
  height:28px;
  border-radius:.5rem;
  border:1px solid rgba(0,0,0,.1);
  cursor:pointer;
}

/* Big text toggle */
.bigtext .marker-title{
  font-size:2.2rem;
}
.bigtext .pretty-list{
  font-size:1.125rem;
}

/* Badges + progress */
.badge{
  font-size:.75rem;
  font-weight:600;
  background:#e5e7eb;
  color:#111827;
  padding:.25rem .5rem;
  border-radius:.5rem;
}
.progress-wrap{
  position:relative;
  height:10px;
  border-radius:999px;
  background:#e5e7eb;
  overflow:hidden;
}
.progress-fill{
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:0%;
  background:linear-gradient(90deg, var(--accent), #f97316);
  transition:width .25s ease;
}
.pencil{
  position:absolute;
  top:-14px;
  left:0;
  transform:translateX(-8px);
  width:32px;
  height:32px;
}
.pencil svg{
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
}

/* Math / equations */
.eqbox{
  background:#f3f6fb;
  border:1px solid #e5e7eb;
  border-radius:.75rem;
  padding:.6rem .8rem;
}
.math-hand .mathface{
  font-family:'Patrick Hand','Kalam',cursive;
  font-weight:400;
  letter-spacing:.2px;
}
.mathface{
  font-variant-ligatures:none;
}

/* Util */
.visually-hidden{
  position:absolute!important;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}
.ghostbtn{
  border:1px dashed #cbd5e1;
}
.quote{
  font-family:'DM Serif Display',serif;
  font-size:1.25rem;
  line-height:1.35;
}
.pill{
  display:inline-block;
  padding:.2rem .55rem;
  border-radius:999px;
  background:rgba(15,23,42,.05);
  font-size:.75rem;
}

.row-wrap{
  display:flex;
  flex-wrap:wrap;
  gap:.75rem;
}
.minw-0{ min-width:0; }

/* Sticky note */
.sticky{
  position:absolute;
  top:18px;
  right:18px;
  width:220px;
  max-width:40%;
  background:#fff8c7;
  border:1px solid rgba(0,0,0,.12);
  border-radius:.6rem;
  box-shadow:0 12px 24px rgba(0,0,0,.12), inset 0 0 0 1px rgba(255,255,255,.8);
  transform: rotate(1.2deg);
  padding:.65rem .7rem .75rem .7rem;
}
.sticky::after{
  /* “tape” */
  content:"";
  position:absolute;
  top:-10px;
  left:40px;
  right:40px;
  height:16px;
  background:linear-gradient(180deg, rgba(255,255,255,.6), rgba(255,255,255,.15));
  border:1px solid rgba(0,0,0,.08);
  filter: blur(.2px);
  transform: rotate(-1.5deg);
  border-radius:.2rem;
}
.sticky h4{
  font-family:'Patrick Hand', cursive;
  font-size:1.1rem;
  margin-bottom:.25rem;
}
.sticky p{
  font-family:'Patrick Hand', cursive;
  font-size:1rem;
  line-height:1.2;
  white-space:pre-wrap;
}

/* Hero tweaks on dark background */
.bg-slate-900 .marker-title,
.bg-slate-900 .marker-h{
  color:#0f172a;
}
/* Subtle BOOM! pulse once on load */
.tagline-boom {
  display: inline-block;
  animation: boomPulse 0.38s ease-out 1.1s both;
}

@keyframes boomPulse {
  0% {
    transform: scale(1);
    text-shadow: none;
  }
  20% {
    transform: scale(1.06);
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
  }
  60% {
    transform: scale(1.02);
    text-shadow: 0 0 4px rgba(251, 191, 36, 0.35);
  }
  100% {
    transform: scale(1);
    text-shadow: none;
  }
}

/* ===== Builder side-by-side layout ===== */
.input-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.input-row-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}
.input-row-selects {
  display: flex;
  gap: 0.5rem;
}
.input-row-selects > div {
  min-width: 100px;
}
.input-row-action {
  flex-shrink: 0;
}
.input-row-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
@media (max-width: 639px) {
  .input-row-main {
    flex-direction: column;
  }
  .input-row-selects {
    width: 100%;
  }
  .input-row-selects > div {
    flex: 1;
  }
  .input-row-action {
    width: 100%;
  }
  .input-row-action button {
    width: 100%;
  }
}

.builder-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chart-preview-col {
  width: 100%;
  min-width: 0;
  flex: 1;
}

.controls-sidebar {
  width: 100%;
  order: -1;
}

.controls-sidebar.sidebar-mobile-open {
  display: block !important;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  z-index: 50;
  background: white;
  padding: 1rem;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  animation: slideInRight 0.2s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 49;
}

@media (min-width: 1024px) {
  .builder-layout {
    flex-direction: row;
    gap: 1.25rem;
    align-items: flex-start;
  }
  .controls-sidebar {
    order: 1;
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding-right: 0.25rem;
  }
  .controls-sidebar::-webkit-scrollbar {
    width: 4px;
  }
  .controls-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
  }
  .chart-preview-col {
    flex: 1;
    min-width: 0;
  }
}

@media (min-width: 1280px) {
  .controls-sidebar {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
  }
}

@media print {
  @page {
    margin: 0.25in;
  }
  body * { visibility: hidden; }
  #sheet, #sheet * { visibility: visible; }
  #sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0.25in;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }
  #sheet.chart-border-simple,
  #sheet.chart-border-thick,
  #sheet.chart-border-dashed,
  #sheet.chart-border-double,
  #sheet.chart-border-sketchy {
    border: 3px solid var(--accent) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tagline-boom {
    animation: none !important;
    transform: none !important;
    text-shadow: none !important;
  }
}
/* Give all big titles a bit more room so they don't get cut off */
h1 {
  line-height: 1.2;
  padding-top: 0.1em;
  padding-bottom: 0.15em;
}
/* === Fix title clipping on generated charts === */

#output h1,
#print-area h1,
#preview h1,
#rendered-chart h1,
.chart-title,
h1 {
  line-height: 1.25 !important;
  padding-top: 0.3em !important;
  padding-bottom: 0.35em !important;
  display: block !important;
}

/* === Fix the container around the title so it gives room === */

#output,
#print-area,
#preview,
#rendered-chart {
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
  overflow: visible !important;
}
/* === Make landing-page sample charts darker and more readable === */
.landing-preview,
.landing-sample,
#landing-sample,
.sample-chart,
.sample-output {
  color: #1e293b !important;       /* Slate-800 */
}

.landing-preview *,
.landing-sample *,
.sample-chart *,
.sample-output * {
  color: #1e293b !important;        /* applies to all nested text */
}
/* Landing preview "paper" tweaks */
.paper {
  border-radius: 1.25rem;
  overflow: hidden;
}

/* The inner sheet area */
.anchor-sheet {
  border-radius: 1.25rem;
  background-color: #fdfcf7; /* warm off-white */
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.5),
    0 10px 30px rgba(15, 23, 42, 0.6);
}

/* Optional: make the lined-paper effect a bit softer if bg-lined-light is yours */
/*
.bg-lined-light {
  background-size: 100% 24px;
  background-color: #fdfcf7;
  background-blend-mode: multiply;
}
*/
.marker-title {
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
/* Clean up heading highlight in cards (no thick bleedy underline) */
.card .marker-h .hl {
  text-decoration: none;
  box-shadow: none;
}
.card .marker-h .hl.hl-none {
  background: transparent;
}

/* Marker-style underline for section titles */
.card .marker-h {
  position: relative;
  display: inline-block;
  padding-bottom: 0.15rem;
}
.card .marker-h::after {
  content: "";
  position: absolute;
  left: 0.05rem;
  right: 0.4rem;
  bottom: 0.05rem;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(249, 115, 22, 0.9),
    rgba(249, 201, 84, 0.9)
  );
  opacity: 0.9;
}

/* === Larger, more readable sample-chart text === */

/* Step and example text inside the landing sample */
.card ol li,
.card .mathface div {
  font-size: 0.95rem !important;   /* bigger than text-sm */
  line-height: 1.4 !important;
  color: #0f172a !important;       /* keep it dark */
}

/* Make the whole Step list a bit roomier */
.card ol {
  padding-left: 1.25rem !important;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

/* Anchor sheet + card visual styling */
.anchor-sheet {
  position: relative;
  box-shadow:
    inset 0 0 15px rgba(0, 0, 0, 0.06),
    0 10px 30px rgba(15, 23, 42, 0.6);
}

.card {
  background: rgba(255, 255, 255, 0.7);
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Fade-in on landing preview */
.hidden.md\:block .paper {
  opacity: 0;
  transform: translateY(10px);
  animation: paperShow 0.9s cubic-bezier(.19,1,.22,1) forwards;
}

@keyframes paperShow {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Teacher Tip Styling Update ===
   Header = Patrick Hand (clean, spaced right)
   Body   = Satisfy (quick cursive)
   ======================================= */

.anchor-sheet .sticky h4 {
  font-family: 'Patrick Hand', cursive !important;
  font-size: 0.95rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  color: #0f172a !important;
  text-shadow: none !important;
}

.anchor-sheet .sticky p {
  font-family: 'Satisfy', cursive !important;
  font-size: 1.05rem !important;
  line-height: 1.45 !important;
  color: #0f172a !important;
  text-shadow: none !important;
  letter-spacing: 0.01em;
  white-space: pre-wrap;
}
/* Inline stacked fraction styling for math posters */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.9em;
  line-height: 1;
  vertical-align: middle;
  margin: 0 0.08em;
}

.frac .num {
  padding-bottom: 0.05em;
}

.frac .den {
  padding-top: 0.05em;
}

.frac .bar {
  width: 100%;
  border-top: 1.3px solid currentColor;
  margin: 0 -0.05em;
}
/* Mode tabs */
.mode-tab {
  background: #e5e7eb;
  color: #374151;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.mode-tab:hover {
  background: #d1d5db;
}
.mode-tab-active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

/* Lesson plan checklist items */
.lp-check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s;
}
.lp-check-item:hover {
  border-color: #a5b4fc;
}
.lp-check-item input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.lp-check-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #1e293b;
}
.lp-check-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.15rem;
}
.lp-check-layout {
  display: inline-block;
  font-size: 0.65rem;
  background: #e0e7ff;
  color: #4338ca;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  margin-top: 0.25rem;
}

[contenteditable]:hover {
  outline: 2px dashed rgba(99, 102, 241, 0.4);
  outline-offset: 2px;
  border-radius: 0.25rem;
  cursor: text;
}
[contenteditable]:focus {
  outline: 2px solid rgba(99, 102, 241, 0.6);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Highlight controlled by .hl classes, not ::after pseudo */
.card .marker-h::after {
  content: none;
}
.card .marker-h .hl.hl-clean {
  text-decoration: none !important;
  background: none !important;
  border-bottom: 3px solid var(--accent) !important;
  padding-bottom: 1px !important;
}
.card .marker-h .hl.hl-brush {
  background-image: var(--brush-url, none) !important;
  background-repeat: no-repeat !important;
  background-size: 100% .82em !important;
  background-position: 0 100% !important;
}

#sheet u {
  text-decoration: none;
  border-bottom: 2px solid currentColor;
  padding-bottom: 1px;
}

.discovery-tip {
  position: absolute;
  top: -12px;
  right: 16px;
  background: #1e1b4b;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 300px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  z-index: 100;
  animation: tipSlideIn .4s ease-out;
}
.discovery-tip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 24px;
  border: 8px solid transparent;
  border-top-color: #1e1b4b;
  border-bottom: 0;
}
@keyframes tipSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chartie-hashtag {
  color: #6366f1;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color .15s;
}
.chartie-hashtag:hover {
  color: #4338ca;
  text-decoration: underline;
}

.chartie-social-icon {
  color: #94a3b8;
  transition: color .2s, transform .2s;
  display: inline-flex;
  align-items: center;
}
.chartie-social-icon:hover {
  color: #6366f1;
  transform: scale(1.15);
}

.chartie-social-link {
  color: #6366f1;
  font-weight: 600;
  text-decoration: none;
}
.chartie-social-link:hover {
  text-decoration: underline;
}

/* Center title toggle — use IDs for bulletproof specificity */
#sheet.center-title #chart-title {
  text-align: center !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  display: block !important;
  width: 100% !important;
}
#sheet.center-title #chart-sub {
  text-align: center !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  display: block !important;
  width: 100% !important;
}
#sheet.center-title #chart-title .hl {
  display: inline !important;
}

/* Decide modal burst animation */
@keyframes chartie-burst {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.12); opacity: 1; }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes chartie-glow {
  0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.6); }
  70% { box-shadow: 0 0 0 18px rgba(251, 191, 36, 0); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}
.decide-burst {
  animation: chartie-burst 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             chartie-glow 1s ease-out 0.3s;
}

/* Title highlight */
.marker-title .hl {
  display: inline;
  padding: 0 0.15em;
}
.marker-title .hl.hl-clean {
  text-decoration: none;
  background: none;
  border-bottom: 4px solid var(--accent);
  padding-bottom: 2px;
}
.marker-title .hl.hl-brush {
  background-image: var(--brush-url, none);
  background-repeat: no-repeat;
  background-size: 100% .82em;
  background-position: 0 100%;
}
.marker-title .hl.hl-none {
  background: none;
}

/* Watch For → Fix It layout */
.watchfix-pairs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.watchfix-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.watchfix-watch {
  flex: 1;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.3;
  word-break: break-word;
}
.watchfix-arrow {
  font-size: 1.25rem;
  flex-shrink: 0;
}
.watchfix-fix {
  flex: 1;
  background: #dcfce7;
  border: 1px solid #22c55e;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.3;
  word-break: break-word;
}
.watchfix-label {
  font-size: 0.8rem;
  margin-right: 0.25rem;
}

/* Misconception / Clarification layout */
.misconception-card {
  margin-bottom: 0.5rem;
}
.misconception-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.misconception-wrong {
  flex: 1;
  background: #fee2e2;
  border: 1px solid #ef4444;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.3;
  word-break: break-word;
}
.misconception-arrow {
  font-size: 1.25rem;
  flex-shrink: 0;
  color: #64748b;
}
.misconception-right {
  flex: 1;
  background: #dcfce7;
  border: 1px solid #22c55e;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.3;
  word-break: break-word;
}
.misconception-icon {
  font-weight: 700;
  margin-right: 0.15rem;
}
.misconception-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
  display: block;
  margin-bottom: 2px;
}

/* Word Bank layout */
.wordbank-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}
.wordbank-chip {
  display: inline-block;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e40af;
  white-space: nowrap;
}

/* Sentence Stems layout */
.stem-card {
  margin-bottom: 0.5rem;
}
.stem-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 2px;
}
.stem-text {
  font-size: 1rem;
  line-height: 1.4;
  font-style: italic;
  color: #1e293b;
}

/* Gradual Release layout */
.gradrelease-phase {
  padding: 0.75rem 1rem;
}
.gradrelease-icon {
  margin-right: 0.25rem;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== MOBILE-FIRST RESPONSIVE ===== */
@media (max-width: 640px) {
  .anchor-sheet {
    border-radius: 0.75rem;
  }

  #sheet {
    margin: 0 -0.5rem;
  }

  #chart-content {
    padding-left: 2.5rem !important;
    padding-right: 0.75rem !important;
  }

  .marker-title {
    padding-left: 2.5rem !important;
    font-size: 1.5rem !important;
  }

  #chart-sub {
    padding-left: 2.5rem !important;
  }

  .anchor-sheet::before {
    transform: translateX(28px);
  }

  .sticky {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    margin-top: 0.75rem;
    margin-left: 2.5rem;
    margin-right: 0.75rem;
    width: calc(100% - 3.25rem);
    transform: rotate(0.6deg);
  }

  .card {
    padding: 0.5rem 0.6rem;
  }

  #btn-generate {
    width: 100%;
  }

  #single-panel {
    padding: 1rem !important;
  }

  .mode-tab {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
  }

  #btn-decide {
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
  }

  #btn-mystyle {
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
  }

  #chart-mascot {
    width: 60px !important;
    height: 60px !important;
    bottom: 6px !important;
    right: 6px !important;
  }

  .row-wrap {
    flex-direction: column;
    gap: 0.5rem;
  }

  #btn-download,
  #btn-pdf,
  #btn-print {
    flex: 1;
    text-align: center;
  }

  .swatch {
    width: 32px;
    height: 32px;
  }

  .mascot-pick img {
    width: 2.5rem;
    height: 2.5rem;
  }

  .watchfix-row {
    flex-direction: column;
    gap: 0.25rem;
  }
  .misconception-row {
    flex-direction: column;
    gap: 0.25rem;
  }
  .watchfix-arrow {
    transform: rotate(90deg);
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.75rem !important;
  }

  .pill {
    font-size: 0.6rem;
  }

  #style-modal > div {
    padding: 1rem;
  }

  #decide-modal > div {
    padding: 1rem;
  }

  .vibe-btn {
    padding: 0.5rem;
  }

  .style-color-btn {
    width: 2rem;
    height: 2rem;
  }
}

/* Safe area padding for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  footer {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
}

/* PWA standalone mode tweaks */
@media (display-mode: standalone) {
  header {
    padding-top: env(safe-area-inset-top, 0);
  }
}

/* Auth & Paywall modals */
#auth-modal > div,
#paywall-modal > div {
  position: relative;
  animation: modalSlideUp 0.25s ease-out;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.plan-card {
  cursor: pointer;
  transition: all 0.15s;
}
.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#user-dropdown {
  animation: fadeIn 0.15s ease-out;
}

#pro-badge {
  letter-spacing: 0.05em;
}

.handmade-mode {
  background: #fff !important;
  background-image: none !important;
  font-family: 'Kalam', cursive !important;
}

.handmade-mode #chart-title {
  font-family: 'Kalam', cursive !important;
  font-weight: 700 !important;
  font-size: 2.8rem !important;
  color: #1a1a1a !important;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-align: center;
}

.handmade-mode #chart-title .hl {
  background: none !important;
  border-bottom: none !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

.handmade-mode #chart-subtitle {
  font-family: 'Kalam', cursive !important;
  font-weight: 400;
  font-size: 1.1rem;
  color: #555;
  text-align: center;
}

.handmade-mode .card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0.25rem 0 !important;
}

.handmade-mode .card h3.marker-h {
  display: none;
}

.handmade-mode .card:only-child h3.marker-h,
.handmade-mode .grid .card h3.marker-h {
  display: block;
  font-family: 'Kalam', cursive !important;
  font-weight: 700;
  font-size: 1.4rem;
  color: #1a1a1a;
  margin-bottom: 0.3rem;
}

.handmade-mode .card:only-child h3.marker-h .hl,
.handmade-mode .grid .card h3.marker-h .hl {
  background: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

.handmade-steps {
  list-style: none !important;
  padding: 0 !important;
  margin: 0.5rem 0 !important;
}

.handmade-steps li {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  line-height: 1.35;
}

.handmade-num {
  font-family: 'Kalam', cursive;
  font-weight: 700;
  font-size: 1.65rem;
  flex-shrink: 0;
  min-width: 2rem;
}

.handmade-text {
  font-family: 'Kalam', cursive;
  font-weight: 400;
  font-size: 1.45rem;
  color: #1a1a1a;
}

.handmade-mode.bigtext .handmade-num {
  font-size: 2.1rem;
}

.handmade-mode.bigtext .handmade-text {
  font-size: 1.85rem;
}

.handmade-mode.bigtext #chart-title {
  font-size: 3.4rem !important;
}

@media print {
  .handmade-mode {
    background: #fff !important;
    background-image: none !important;
  }
  .handmade-mode .card {
    break-inside: avoid;
  }
  .handmade-num {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Color modes */
.color-mode-bw{
  filter:grayscale(1);
}
.color-mode-bw .card{
  background:#fff !important;
  border-color:#333 !important;
}
.color-mode-bw .marker-title,
.color-mode-bw .marker-h,
.color-mode-bw .hl{
  color:#0f172a !important;
  border-color:#333 !important;
}
.color-mode-rainbow .card:nth-child(1){ border-left-color:#dc2626 !important; }
.color-mode-rainbow .card:nth-child(2){ border-left-color:#2563eb !important; }
.color-mode-rainbow .card:nth-child(3){ border-left-color:#16a34a !important; }
.color-mode-rainbow .card:nth-child(4){ border-left-color:#ea580c !important; }
.color-mode-rainbow .card:nth-child(1) .hl{ border-color:#dc2626 !important; }
.color-mode-rainbow .card:nth-child(2) .hl{ border-color:#2563eb !important; }
.color-mode-rainbow .card:nth-child(3) .hl{ border-color:#16a34a !important; }
.color-mode-rainbow .card:nth-child(4) .hl{ border-color:#ea580c !important; }

/* MathEx layout */
.mathex-steps{
  list-style:none;
  padding:0;
  margin:0;
  counter-reset:mathstep;
}
.mathex-step{
  margin-bottom:0.75rem;
}
.mathex-step-desc{
  font-size:0.95rem;
  line-height:1.4;
  color:#0f172a;
}
.mathex-step-example{
  margin-top:0.25rem;
  padding:0.35rem 0.6rem;
  background:rgba(99,102,241,0.08);
  border-left:3px solid #6366f1;
  border-radius:0 0.4rem 0.4rem 0;
  font-size:0.9rem;
  color:#334155;
  font-style:italic;
}
.mathex-worked{
  font-size:0.95rem;
  line-height:1.5;
}
.mathex-problem{
  margin-bottom:0.5rem;
  font-size:1rem;
}
.mathex-solution{
  padding-left:1.25rem;
  margin:0.25rem 0;
}
.mathex-solution li{
  margin-bottom:0.3rem;
}
.mathex-answer{
  margin-top:0.5rem;
  padding:0.4rem 0.6rem;
  background:rgba(34,197,94,0.1);
  border-left:3px solid #22c55e;
  border-radius:0 0.4rem 0.4rem 0;
  font-weight:700;
  color:#166534;
}

/* Chartie character avatar */
.chartie-avatar{
  width:100px;
  height:100px;
  object-fit:contain;
  flex-shrink:0;
  margin-top:-30px;
  margin-bottom:-10px;
  filter:drop-shadow(0 4px 8px rgba(0,0,0,0.25));
  transform-origin:bottom center;
}
@keyframes chartieWave{
  0%,100%{ transform:rotate(0deg); }
  15%{ transform:rotate(-8deg); }
  30%{ transform:rotate(6deg); }
  45%{ transform:rotate(-6deg); }
  60%{ transform:rotate(4deg); }
  75%{ transform:rotate(-2deg); }
}
.chartie-wave{ animation:chartieWave 1.2s ease-in-out; }

@keyframes chartieBounce{
  0%,100%{ transform:translateY(0); }
  25%{ transform:translateY(-8px); }
  50%{ transform:translateY(0); }
  75%{ transform:translateY(-4px); }
}
.chartie-bounce{ animation:chartieBounce 1s ease-in-out; }

@keyframes chartieNod{
  0%,100%{ transform:rotate(0deg); }
  30%{ transform:rotate(5deg); }
  60%{ transform:rotate(-3deg); }
}
.chartie-nod{ animation:chartieNod 0.6s ease-in-out; }

@keyframes chartieThink{
  0%,100%{ transform:translateX(0) rotate(0deg); }
  25%{ transform:translateX(-3px) rotate(-3deg); }
  75%{ transform:translateX(3px) rotate(3deg); }
}
.chartie-think{ animation:chartieThink 1.5s ease-in-out infinite; }

/* Return greeting toast animation */
@keyframes greetSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
