/* WriteStep — app.css */
:root {
  --cream:   #FDF8F0;
  --white:   #FFFFFF;
  --coral:   #E8834A;
  --blue:    #5B8DD9;
  --green:   #4CAF78;
  --purple:  #9C6DD4;
  --red:     #D94F4F;
  --text:    #2C2C2C;
  --muted:   #7B7B7B;
  --border:  #E8E0D4;
  --line-solid:  #9EC5E8;
  --line-dashed: #C4DCF0;
  --shadow:  0 2px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.11);
  --radius:  18px;
  --radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

/* ─── Header ───────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 12px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  gap: 12px;
}
.app-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 26px;
  color: var(--coral);
  text-decoration: none;
  flex-shrink: 0;
}
.app-logo span { color: var(--blue); }
.header-nav { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px; border-radius: 50px;
  font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 700;
  border: none; cursor: pointer; transition: all 0.18s ease;
  text-decoration: none; line-height: 1;
}
.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--coral); color: #fff; }
.btn-primary:hover { background: #d4723d; }
.btn-secondary { background: var(--blue); color: #fff; }
.btn-secondary:hover { background: #4a7bc8; }
.btn-success   { background: var(--green); color: #fff; }
.btn-outline   { background: transparent; color: var(--text); border: 2px solid var(--border); }
.btn-outline:hover { border-color: var(--coral); color: var(--coral); transform: translateY(-2px); }
.btn-lg  { padding: 14px 28px; font-size: 17px; }
.btn-sm  { padding: 8px 15px; font-size: 13px; }
.btn-icon { padding: 9px; width: 38px; height: 38px; border-radius: 50%; }
.btn-icon:hover { transform: scale(1.1) translateY(-1px); }
.btn.w-full { width: 100%; }

/* ─── Cards ─────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.card-hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

/* ─── Badges ─────────────────────────────────── */
.family-badge {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.family-badge-lg { width: 60px; height: 60px; border-radius: 16px; font-size: 30px; }

/* ─── Section title ──────────────────────────── */
.section-title {
  font-family: 'Fredoka One', cursive;
  font-size: 20px; color: var(--text);
  margin-bottom: 14px; margin-top: 8px;
}

/* ─── Breadcrumb ─────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); margin-bottom: 18px; flex-wrap: wrap;
}
.breadcrumb a   { color: var(--blue); text-decoration: none; font-weight: 700; }
.breadcrumb a:hover { text-decoration: underline; }

/* ─── Home ──────────────────────────────────── */
.home-hero { text-align: center; padding: 36px 0 28px; }
.home-hero h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(30px, 5vw, 52px);
  color: var(--coral); line-height: 1.1; margin-bottom: 10px;
}
.home-hero p { font-size: 17px; color: var(--muted); max-width: 460px; margin: 0 auto 28px; }

.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 14px; margin-bottom: 28px;
}

.family-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
  cursor: pointer; transition: all 0.2s ease;
  border: 3px solid transparent;
  display: flex; flex-direction: column; gap: 10px;
}
.family-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(0,0,0,0.06); }
.family-card-header { display: flex; align-items: center; gap: 12px; }
.family-card h3 { font-family: 'Fredoka One', cursive; font-size: 17px; }
.family-card p  { font-size: 13px; color: var(--muted); line-height: 1.5; }
.letter-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.letter-chip {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka One', cursive; font-size: 13px; color: #fff;
  cursor: pointer; transition: transform 0.14s;
}
.letter-chip:hover { transform: scale(1.18); }

/* ─── Family intro ───────────────────────────── */
.family-intro { max-width: 700px; margin: 0 auto; }
.family-intro-header { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }

.cue-list { list-style: none; }
.cue-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; font-size: 16px; font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.cue-list li:last-child { border-bottom: none; }
.cue-number {
  width: 26px; height: 26px; border-radius: 50%; background: var(--coral);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px; margin: 20px 0;
}
.letter-button {
  background: var(--white); border: 2.5px solid var(--border);
  border-radius: 12px; padding: 14px 6px; cursor: pointer;
  transition: all 0.18s; display: flex; flex-direction: column;
  align-items: center; gap: 5px;
}
.letter-button:hover { border-color: var(--coral); transform: translateY(-2px); }
.letter-button .glyph { font-family: 'Fredoka One', cursive; font-size: 30px; line-height: 1; }
.letter-button .label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.letter-button.done    { border-color: var(--green); background: #f0fdf5; }
.letter-button.partial { border-color: var(--coral); }

/* ─── Character Lesson ───────────────────────── */
.lesson-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 740px) {
  .lesson-layout { grid-template-columns: 1fr; }
}

.lesson-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--white);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.lesson-header-left { display: flex; align-items: center; gap: 12px; }
.lesson-breadcrumb  { font-size: 12px; color: var(--muted); }
.lesson-title       { font-family: 'Fredoka One', cursive; font-size: 20px; }
.progress-pips { display: flex; gap: 4px; }
.pip { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.pip.done    { background: var(--green); }
.pip.current { background: var(--coral); }

/* Mode tabs */
.mode-tabs {
  display: flex; gap: 6px; background: var(--cream);
  border-radius: 50px; padding: 4px; margin-bottom: 14px;
}
.mode-tab {
  flex: 1; padding: 8px 10px; border: none; border-radius: 50px;
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; color: var(--muted); background: transparent;
  transition: all 0.18s; white-space: nowrap;
}
.mode-tab.active { background: var(--white); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

/* Demo panel */
.demo-panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.demo-panel-title { font-family: 'Fredoka One', cursive; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }

.start-rule {
  font-size: 13px; font-weight: 700; color: var(--text);
  padding: 9px 12px; background: #FFF8F2;
  border-left: 3px solid var(--coral); border-radius: 0 8px 8px 0;
  margin-bottom: 12px;
}

.demo-svg-wrap {
  background: #F8F4EE; border-radius: 12px;
  overflow: hidden; position: relative;
}
.demo-svg-wrap svg { display: block; width: 100%; height: auto; }

.cue-steps { margin-top: 14px; }
.cue-step {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 13px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--border); transition: color 0.2s;
}
.cue-step:last-child { border-bottom: none; }
.cue-step.active { color: var(--coral); }
.cue-step.done   { color: var(--green); }
.stroke-dot {
  width: 22px; height: 22px; border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: var(--muted); flex-shrink: 0;
  transition: all 0.2s;
}
.cue-step.active .stroke-dot { background: var(--coral); color: #fff; }
.cue-step.done   .stroke-dot { background: var(--green);  color: #fff; }

.example-word-box {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: #F5F8FF;
  border-radius: 10px; border: 2px solid #D8E6FA; margin-top: 14px;
}
.example-word-box .word { font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--blue); }
.example-word-box .label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }

/* Practice panel */
.practice-panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }

.writing-area {
  position: relative; border-radius: 12px; overflow: hidden;
  background: #FFFDF8; border: 2px solid var(--border);
  cursor: crosshair; touch-action: none;
  aspect-ratio: 5 / 6;
  min-height: 320px;
}
.writing-area canvas,
.practice-guide-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.writing-area canvas {
  display: block;
  touch-action: none;
  z-index: 2;
  background: transparent;
}
.practice-guide-overlay {
  z-index: 1;
  pointer-events: none;
}
.practice-guide-overlay svg {
  display: block;
  width: 100%;
  height: 100%;
}

.feedback-area {
  min-height: 56px; border-radius: 12px; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700;
  background: var(--cream); border: 2px solid var(--border);
  transition: all 0.25s ease; margin-top: 14px;
}
.feedback-area.great     { background: #F0FDF5; border-color: var(--green); color: #1f6b45; }
.feedback-area.good      { background: #FFF8F2; border-color: var(--coral); color: #7a3a15; }
.feedback-area.try-again { background: #FFF5F5; border-color: var(--red);   color: #7a1f1f; }
.feedback-icon { font-size: 22px; flex-shrink: 0; }

.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* Check mode */
.check-list { list-style: none; }
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; font-size: 15px; font-weight: 600;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.15s; border-radius: 4px;
}
.check-item:last-child { border-bottom: none; }
.check-item:hover { background: #FAFAF8; }
.check-box {
  width: 26px; height: 26px; border-radius: 7px; border: 2.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0; font-size: 14px; font-weight: 800;
}
.check-item.checked .check-box { background: var(--green); border-color: var(--green); color: #fff; }

/* Nav row */
.nav-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--white);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-top: 16px; gap: 12px; flex-wrap: wrap;
}

/* ─── Warmups ────────────────────────────────── */
.warmup-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.warmup-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; cursor: pointer; transition: all 0.2s; text-align: center;
  border: 3px solid transparent;
}
.warmup-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.warmup-icon  { font-size: 38px; margin-bottom: 8px; }
.warmup-title { font-family: 'Fredoka One', cursive; font-size: 15px; }
.warmup-desc  { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.4; }

/* Warmup canvas */
.warmup-canvas-area { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.warmup-canvas-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #FFFDF8; border: 2px solid var(--border); cursor: crosshair; touch-action: none; }
.warmup-canvas-wrap canvas { display: block; width: 100%; touch-action: none; }

/* ─── Teacher ─────────────────────────────────── */
.teacher-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.prog-bar-track { background: var(--cream); border-radius: 20px; height: 10px; overflow: hidden; margin: 10px 0 6px; }
.prog-bar-fill  { height: 100%; border-radius: 20px; transition: width 0.6s ease; }

/* ─── Settings ────────────────────────────────── */
.settings-section { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 14px; }
.settings-section h3 { font-family: 'Fredoka One', cursive; font-size: 17px; margin-bottom: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 16px; flex-wrap: wrap; }
.setting-row:last-child { border-bottom: none; }
.setting-row label { font-size: 15px; font-weight: 700; display: block; }
.setting-row p     { font-size: 12px; color: var(--muted); margin-top: 2px; }

.toggle {
  position: relative; width: 46px; height: 26px; background: var(--border);
  border-radius: 50px; cursor: pointer; transition: background 0.2s; border: none; flex-shrink: 0;
}
.toggle.on { background: var(--green); }
.toggle::after {
  content: ''; position: absolute; width: 20px; height: 20px; background: #fff;
  border-radius: 50%; top: 3px; left: 3px; transition: left 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle.on::after { left: 23px; }

.radio-group { display: flex; gap: 7px; flex-wrap: wrap; }
.radio-btn {
  padding: 7px 14px; border: 2.5px solid var(--border); border-radius: 50px;
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; background: transparent; color: var(--muted); transition: all 0.18s;
}
.radio-btn.active { background: var(--coral); border-color: var(--coral); color: #fff; }

/* ─── Utilities ───────────────────────────────── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.align-center{ align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-14  { margin-top: 14px; }
.mt-20  { margin-top: 20px; }
.mb-14  { margin-bottom: 14px; }
.mb-20  { margin-bottom: 20px; }
.w-full { width: 100%; }
.text-muted  { color: var(--muted); }
.text-center { text-align: center; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.22s ease; }
