:root {
  --dark: #111827;
  --dark-btn: #1a1a2e;
  --white: #ffffff;
  --bg: #f9fafb;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --answer-bg: #f3f4f6;
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  transition: background 0.3s;
}
body.op-add  { background: #D1FAE5; }
body.op-sub  { background: #FFE4E4; }
body.op-mul  { background: #FFEDD5; }
body.op-div  { background: #FEFCE8; }
body.op-frac { background: #DBEAFE; }

/* SCREENS */
.screen { display: none; min-height: 100vh; }
body.in-iframe .home-start { display: none !important; }
.screen.active { display: block; }
#screen-tracing-practice.active { display: flex; height: 100vh; }
/* Reading practice screens: fixed viewport height so the question list scrolls
   independently while the passage panel stays frozen at the top. */
#screen-rd-poetry.active,
#screen-rd-theme.active,
#screen-rd-compare.active,
#screen-rd-wordstudy.active,
#screen-rd-nonfic.active,
#screen-rd-author.active,
#screen-rd-comp-mid.active,
#screen-rd-comp-build.active,
#screen-rd-skills-practice.active { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }
/* Reading question grids: natural-height cards that scroll, NOT the math grid's
   fixed 5-row stretch (which truncated cards once the screen had a bounded height). */
#screen-rd-poetry .ratios-grid.word-mode,
#screen-rd-theme .ratios-grid.word-mode,
#screen-rd-compare .ratios-grid.word-mode,
#screen-rd-wordstudy .ratios-grid.word-mode,
#screen-rd-nonfic .ratios-grid.word-mode,
#screen-rd-author .ratios-grid.word-mode,
#screen-rd-comp-mid .ratios-grid.word-mode,
#screen-rd-comp-build .ratios-grid.word-mode { height: auto; grid-template-rows: none; align-content: start; }
#screen-cursive-alpha-practice.active { display: flex; flex-direction: column; min-height: 100vh; }
#screen-testprep-home.active { display: flex; flex-direction: column; min-height: 100vh; background: #DBEAFE; }
#screen-act-home.active { display: flex; flex-direction: column; min-height: 100vh; }
#screen-act-sets.active { display: flex; flex-direction: column; min-height: 100vh; }
#screen-act-worksheet.active { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
#screen-cursive-words.active { display: flex; flex-direction: column; min-height: 100vh; }
#screen-cursive-sentences.active { display: flex; flex-direction: column; min-height: 100vh; }
#screen-cursive-wb-practice.active { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* HOME */
.home-wrap {
  min-height: 100vh;
  padding: 40px 32px 60px;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.home-header { text-align: center; padding: 8px 0 4px; }
.home-title {
  font-size: 52px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
}
.title-noku { color: #6EE7B7; font-weight: 800; }
.title-dot  { color: #111827; font-weight: 800; }
.title-ai   { color: #6EE7B7; font-weight: 800; }
.home-sub { font-size: 20px; color: #FF9EC4; font-weight: 800; margin-top: 6px; }

.home-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  text-align: center;
}
.home-section { display: flex; flex-direction: column; align-items: center; }
.home-section .option-group { justify-content: center; }

/* Operation cards */
.home-op-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.home-op-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  border-radius: var(--radius);
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}
.home-op-btn.op-add  { background: #D1FAE5; border-color: #A7F3D0; }
.home-op-btn.op-sub  { background: #FFE4E4; border-color: #FCA5A5; }
.home-op-btn.op-mul  { background: #FFEDD5; border-color: #FDBA74; }
.home-op-btn.op-div  { background: #FEFCE8; border-color: #FDE047; }
.home-op-btn.op-frac { background: #DBEAFE; border-color: #93C5FD; }

.home-op-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.home-op-btn.active { border-width: 3px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); transform: translateY(-2px); }
.home-op-btn.op-add.active  { border-color: #34d399; }
.home-op-btn.op-sub.active  { border-color: #f87171; }
.home-op-btn.op-mul.active  { border-color: #fb923c; }
.home-op-btn.op-div.active  { border-color: #facc15; }
.home-op-btn.op-frac.active { border-color: #60a5fa; }

.hop-icon {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.hop-name { font-size: 13px; font-weight: 600; color: var(--text); }
.home-op-btn.home-alpha-btn { background: #D1FAE5; border-color: #A7F3D0; }
.hop-icon-aa {
  font-family: 'Edu NSW ACT Foundation', cursive;
  font-size: 28px;
  font-weight: 700;
  color: #FF6B6B;
  line-height: 1;
}
.hop-sub  { font-size: 11px; font-weight: 700; color: #111; margin-top: 1px; }

.home-start { align-items: center; gap: 12px; }
input.home-name-input {
  width: 100%;
  max-width: 360px;
  padding: 15px 18px;
  border: 2px solid #F9A8D4 !important;
  border-radius: var(--radius-sm);
  font-size: 18px;
  background: #FCE7F3 !important;
  color: #831843;
  outline: none;
  text-align: center;
}
input.home-name-input:focus { border-color: #ec4899 !important; }
input.home-name-input::placeholder { color: #F9A8D4; }
.btn-dark.home-start-btn { max-width: 360px; font-size: 18px; padding: 18px 32px; background: #DBEAFE; color: #1e3a6e; border: 2px solid #93C5FD; }
.btn-dark.home-start-btn:hover { background: #BFDBFE; opacity: 1; }

/* keep old login card for fallback */
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

/* TYPOGRAPHY */
.app-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.app-sub {
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
}

/* PAGE LAYOUT */
.page-top {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 24px 32px 0;
  max-width: 1400px;
  margin: 0 auto;
}
.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-title-row .app-title { text-align: left; }
.page-title-row .app-sub { text-align: left; }

.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.student-badge {
  background: #FFF9C4;
  border: 2px solid #FFD166;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #7c5f00;
}

/* SETTINGS CARD */
.settings-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.setting-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 180px;
}
.option-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* OPTION BUTTONS */
.opt-btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
  min-height: 44px;
}
.opt-btn:hover { border-color: var(--dark); }
.opt-btn.active { background: var(--dark); color: var(--white); border-color: var(--dark); }
.opt-btn.op-add.active  { background: #A8F5D1; color: #1a5c3a; border-color: #A8F5D1; }
.opt-btn.op-sub.active  { background: #FF9494; color: #7a0000; border-color: #FF9494; }
.opt-btn.op-mul.active  { background: #FFB87A; color: #7a3800; border-color: #FFB87A; }
.opt-btn.op-div.active  { background: #FFF176; color: #5a4a00; border-color: #FFF176; }
.opt-btn.op-frac.active { background: #93C5FD; color: #1e3a6e; border-color: #93C5FD; }

/* Difficulty pastel colors */
.diff-btn[data-val="easy"]   { background: #D1FAE5; border-color: #6EE7B7; color: #065f46; }
.diff-btn[data-val="medium"] { background: #FFEDD5; border-color: #FDBA74; color: #7c2d12; }
.diff-btn[data-val="hard"]   { background: #DBEAFE; border-color: #93C5FD; color: #1e3a6e; }
.diff-btn[data-val="easy"].active   { background: #6EE7B7; border-color: #34d399; color: #064e3b; box-shadow: 0 2px 10px rgba(52,211,153,0.4); }
.diff-btn[data-val="medium"].active { background: #FDBA74; border-color: #fb923c; color: #7c2d12; box-shadow: 0 2px 10px rgba(251,146,60,0.4); }
.diff-btn[data-val="hard"].active   { background: #93C5FD; border-color: #60a5fa; color: #1e3a6e; box-shadow: 0 2px 10px rgba(96,165,250,0.4); }

/* Count pastel colors */
.count-btn[data-val="5"]   { background: #EDE9FE; border-color: #C4B5FD; color: #4c1d95; }
.count-btn[data-val="10"]  { background: #DBEAFE; border-color: #93C5FD; color: #1e3a6e; }
.count-btn[data-val="15"]  { background: #FCE7F3; border-color: #F9A8D4; color: #831843; }
.count-btn[data-val="20"]  { background: #D1FAE5; border-color: #6EE7B7; color: #065f46; }
.count-btn[data-val="5"].active  { background: #C4B5FD; border-color: #7C3AED; color: #3b0764; box-shadow: 0 2px 10px rgba(124,58,237,0.3); }
.count-btn[data-val="10"].active { background: #93C5FD; border-color: #3b82f6; color: #1e3a6e; box-shadow: 0 2px 10px rgba(59,130,246,0.3); }
.count-btn[data-val="15"].active { background: #F9A8D4; border-color: #ec4899; color: #831843; box-shadow: 0 2px 10px rgba(236,72,153,0.3); }
.count-btn[data-val="20"].active { background: #6EE7B7; border-color: #34d399; color: #064e3b; box-shadow: 0 2px 10px rgba(52,211,153,0.4); }
.count-btn[data-val="25"]  { background: #D1FAE5; border-color: #6EE7B7; color: #065f46; }
.count-btn[data-val="50"]  { background: #FCE7F3; border-color: #F9A8D4; color: #831843; }
.count-btn[data-val="75"]  { background: #FFEDD5; border-color: #FDBA74; color: #7c2d12; }
.count-btn[data-val="100"] { background: #FEFCE8; border-color: #FDE047; color: #713f12; }
.count-btn[data-val="25"].active  { background: #6EE7B7; border-color: #34d399; color: #064e3b; box-shadow: 0 2px 10px rgba(52,211,153,0.4); }
.count-btn[data-val="50"].active  { background: #F9A8D4; border-color: #ec4899; color: #831843; box-shadow: 0 2px 10px rgba(236,72,153,0.3); }
.count-btn[data-val="75"].active  { background: #FDBA74; border-color: #fb923c; color: #7c2d12; box-shadow: 0 2px 10px rgba(251,146,60,0.4); }
.count-btn[data-val="100"].active { background: #FDE047; border-color: #eab308; color: #713f12; box-shadow: 0 2px 10px rgba(234,179,8,0.4); }

.diff-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 24px;
  gap: 2px;
}
.diff-btn span { font-size: 16px; font-weight: 600; }
.diff-btn small { font-size: 12px; opacity: 0.7; }
.diff-btn.active small { opacity: 0.8; }

.count-btn {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

.ws-info {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  padding: 10px 0 16px;
}

.ws-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ws-settings-label { font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }

/* Signs on left, label+count on right — all on one visual row */
.ws-signs-count-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.ws-diff-section  { display: flex; flex-direction: column; align-items: center; }
.ws-count-section { display: flex; flex-direction: column; align-items: center; margin-left: auto; }

.ws-title-area { flex: 1; min-width: 0; }
.ws-title-row  { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; margin-bottom: 2px; }

/* Compact diff buttons for inline title row */
.diff-btn-sm { padding: 3px 18px !important; min-height: 34px !important; }
.diff-btn-sm span { font-size: 13px !important; }
.diff-btn-sm small { font-size: 10px !important; }

.ws-op-btn {
  padding: 5px 18px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  background: #fff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  min-height: 38px;
  min-width: 48px;
  touch-action: manipulation;
  transition: all 0.12s;
  color: #374151;
}
.ws-op-btn:hover { border-color: #9ca3af; }
.ws-op-btn.op-add        { border-color: #6EE7B7; background: #D1FAE5; color: #065f46; }
.ws-op-btn.op-sub        { border-color: #F9A8D4; background: #FCE7F3; color: #831843; }
.ws-op-btn.op-mul        { border-color: #FDBA74; background: #FFEDD5; color: #7c2d12; }
.ws-op-btn.op-div        { border-color: #FDE047; background: #FEFCE8; color: #713f12; }
.ws-op-btn.op-add.active { background: #6EE7B7; border-color: #34d399; box-shadow: 0 2px 8px rgba(52,211,153,0.4); }
.ws-op-btn.op-sub.active { background: #F9A8D4; border-color: #ec4899; box-shadow: 0 2px 8px rgba(236,72,153,0.3); }
.ws-op-btn.op-mul.active { background: #FDBA74; border-color: #fb923c; box-shadow: 0 2px 8px rgba(251,146,60,0.4); }
.ws-op-btn.op-div.active { background: #FDE047; border-color: #eab308; box-shadow: 0 2px 8px rgba(234,179,8,0.4); }

/* PROBLEMS GRID */
.problems-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.problems-grid.frac-grid {
  grid-template-columns: repeat(5, 1fr);
}

.problem-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.op-add .problem-card  { background: #F0FDF7; border: 3px solid #6EE7B7; }
.op-sub .problem-card  { background: #FFF5F5; border: 3px solid #FCA5A5; }
.op-mul .problem-card  { background: #FFF8F0; border: 3px solid #FDBA74; }
.op-div .problem-card  { background: #FEFEF0; border: 3px solid #FDE047; }
.op-frac .problem-card { background: #F0F7FF; border: 3px solid #93C5FD; }
.problem-card.correct { border-color: var(--green); }
.problem-card.wrong { border-color: var(--red); }

.prob-numbers {
  text-align: right;
  line-height: 1.2;
  margin-bottom: 10px;
}
.prob-a {
  font-size: 32px;
  font-weight: 700;
  display: block;
  color: var(--text);
  font-family: 'Edu NSW ACT Foundation', cursive;
}
.prob-b {
  font-size: 32px;
  font-weight: 700;
  display: block;
  color: var(--text);
  font-family: 'Edu NSW ACT Foundation', cursive;
}
.prob-b .op {
  margin-right: 6px;
  font-weight: 400;
}
.prob-line {
  border: none;
  border-top: 2px solid var(--text);
  margin-bottom: 10px;
  width: 100%;
}

/* ANSWER INPUT — large for stylus writing */
.answer-input {
  background: rgba(255,255,255,0.75);
  border: none;
  border-radius: var(--radius-sm);
  width: 100%;
  padding: 14px 10px;
  font-size: 32px !important;
  font-weight: 700;
  font-family: 'Edu NSW ACT Foundation', cursive !important;
  text-align: center;
  color: var(--text);
  outline: none;
  cursor: text;
  min-height: 56px;
  -webkit-appearance: none;
  -webkit-user-select: text;
  user-select: text;
}
.answer-input::placeholder { color: #c0c4cc; font-weight: 400; font-size: 20px; }
.answer-input:focus { background: #ebebf0; }
.answer-input.correct-ans { background: #dcfce7; color: var(--green); }
.answer-input.wrong-ans { background: #fee2e2; color: var(--red); }

/* DIVISION CARDS */
.div-display { display: flex; justify-content: center; margin-bottom: 4px; }
.div-display .frac-n, .div-display .frac-d { font-size: 28px; font-weight: 700; }

/* FRACTION CARDS */
.frac-card {
  padding: 12px 8px;
}
.frac-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.frac-display {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
}
.frac-n, .frac-d { display: block; text-align: center; min-width: 18px; font-family: 'Edu NSW ACT Foundation', cursive; font-weight: 700; }
.frac-bar-h {
  width: 100%;
  border-top: 2px solid var(--text);
  display: block;
  min-width: 20px;
}
.frac-op, .frac-eq {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 0 1px;
}
.frac-answer {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.frac-input {
  width: 34px;
  height: 28px;
  background: var(--answer-bg);
  border: none;
  border-radius: 5px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.frac-input::placeholder { color: #c0c4cc; font-size: 13px; }
.frac-input:focus { background: #ebebf0; }
.frac-input.correct-ans { background: #dcfce7; color: var(--green); }
.frac-input.wrong-ans { background: #fee2e2; color: var(--red); }
.frac-bar-ans {
  width: 34px;
  border-top: 2px solid var(--text);
  display: block;
}
.prob-frac { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.prob-frac .frac-input { width: 52px; height: 40px; font-size: 22px; }
.prob-frac .frac-bar-ans { width: 52px; border-top-width: 2.5px; }
/* Calc card 3-row question area */
.prob-q-area { flex: 1; min-height: 0; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; justify-content: flex-start; }
.prob-sentence { font-size: 13px; color: #555; line-height: 1.35; }
.prob-visual { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0; }
.prob-question { font-size: 14px; font-weight: 700; color: #111; line-height: 1.3; }
.pm-dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.pm-tile { background: #3b82f6; color: #fff; min-width: 26px; height: 32px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; padding: 0 4px; }
.pm-dice { font-size: 32px; line-height: 1; }

.result-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  min-height: 18px;
}
.result-badge .correct-label { color: var(--green); }
.result-badge .wrong-label { color: var(--red); }
.result-badge .correct-val { color: var(--green); font-family: 'Edu NSW ACT Foundation', cursive; font-weight: 700; }

/* SUBMIT ROW */
.submit-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 32px 48px;
  max-width: 1400px;
  margin: 0 auto;
}

/* INPUTS */
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 15px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
input:focus { border-color: var(--dark); }

/* BUTTONS */
.btn-dark {
  background: var(--dark);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 50px;
  touch-action: manipulation;
  transition: opacity 0.15s;
}
.btn-dark:hover { opacity: 0.85; }
.btn-dark:active { opacity: 0.7; }
.btn-green {
  background: #4ADE80;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  min-height: 50px;
  touch-action: manipulation;
  transition: opacity 0.15s;
}
.btn-green:hover { opacity: 0.85; }
.btn-green:active { opacity: 0.7; }
.btn-full { width: 100%; }
.btn-submit { min-width: 140px; background: #4ADE80 !important; color: #fff !important; border: none !important; border-radius: 12px !important; font-weight: 800 !important; font-size: 16px !important; padding: 12px 28px !important; cursor: pointer; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 50px;
  touch-action: manipulation;
}
.btn-outline:hover { border-color: var(--dark); }

.btn-back {
  background: #FF6B6B;
  color: #fff;
  border: 2px solid #E84040;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  min-height: 38px;
  touch-action: manipulation;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-back:hover { filter: brightness(0.93); }

.btn-outline-sm {
  background: #f3f4f6;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 38px;
  touch-action: manipulation;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-outline-sm:hover { filter: brightness(0.93); }

/* Nav button colors */
.btn-home        { background: #D1FAE5; border-color: #6EE7B7; color: #065f46; }
.btn-progress    { background: #DBEAFE; border-color: #93C5FD; color: #1e3a6e; }
.btn-workbook    { background: #FFEDD5; border-color: #FDBA74; color: #7c2d12; }
.btn-logout      { background: #FFE4E4; border-color: #FCA5A5; color: #7f1d1d; }
.btn-draw-toggle { background: #F3E8FF; border-color: #C084FC; color: #6b21a8; }
.btn-draw-toggle.draw-active { background: #C084FC; border-color: #a855f7; color: #fff; }

/* Draw mode canvas */
.answer-canvas {
  width: 100%;
  height: 70px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1.5px solid var(--border);
  cursor: crosshair;
  touch-action: none;
  display: block;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.frac-canvas {
  width: 60px;
  height: 34px;
}

.btn-ghost {
  background: #FFEDD5;
  border: 2px solid #FDBA74;
  border-radius: var(--radius-sm);
  color: #7c2d12;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 24px;
  text-align: center;
  touch-action: manipulation;
  transition: all 0.15s;
}
.btn-ghost:hover { background: #FED7AA; }

/* RESULTS */
.results-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px;
}
.score-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  margin-bottom: 24px;
}
.res-emoji { font-size: 56px; margin-bottom: 12px; }
.res-score { font-size: 52px; font-weight: 800; color: var(--text); }
.res-pct { font-size: 22px; color: var(--muted); margin-bottom: 8px; }
.res-msg { font-size: 20px; font-weight: 600; }

.res-review {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rev-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
}
.rev-icon { font-size: 18px; width: 24px; }
.rev-problem { font-weight: 600; flex: 1; }
.rev-answer { color: var(--muted); }
.rev-correct { color: var(--red); font-weight: 600; }
.res-actions { display: flex; gap: 12px; }

/* PROGRESS */
.inner-wrap { max-width: 900px; margin: 0 auto; padding: 28px 32px; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 10px 20px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.tab.active { background: var(--dark); border-color: var(--dark); color: var(--white); }

.mastery-summary { font-size: 15px; color: var(--muted); margin-bottom: 16px; }
.mastery-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.fact-cell {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}
.fact-cell.mastered { background: #f0fdf4; border-color: #86efac; color: #166534; }
.fact-cell.learning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.fact-cell.weak { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }

.legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--border); }

/* WORKBOOK */
.workbook-list { display: flex; flex-direction: column; gap: 12px; }
.wb-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wb-title { font-size: 16px; font-weight: 600; }
.wb-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.wb-pct { font-size: 24px; font-weight: 800; color: var(--text); }
.wb-pct.high { color: var(--green); }
.wb-pct.mid { color: var(--yellow); }
.wb-pct.low { color: var(--red); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon { font-size: 40px; display: block; margin-bottom: 12px; }

/* PARENT SIGN IN BUTTON */
.btn-parent-signin {
  background: #EDE9FE;
  border: 2px solid #C4B5FD;
  border-radius: var(--radius-sm);
  color: #4c1d95;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 11px 24px;
  text-align: center;
  touch-action: manipulation;
  transition: all 0.15s;
}
.btn-parent-signin:hover { background: #DDD6FE; }

.home-divider {
  width: 100%;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.home-divider::before,
.home-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* CHILD SELECTED BADGE */
.child-selected-badge {
  background: #F0FDF4;
  border: 2px solid #86EFAC;
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 18px;
  color: #14532d;
  text-align: center;
  max-width: 360px;
  width: 100%;
}
.child-sel-avatar { font-size: 22px; }

/* AUTH SCREEN */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: #F5F3FF;
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.auth-logo { font-size: 56px; }
.auth-title { font-size: 26px; font-weight: 700; color: var(--text); }
.auth-desc { font-size: 15px; color: var(--muted); line-height: 1.5; }
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
  touch-action: manipulation;
}
.btn-google:hover { background: #f9fafb; border-color: #9ca3af; }
.google-g {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #4285F4, #34A853, #FBBC05, #EA4335);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

/* PROFILES SCREEN */
.profiles-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  width: 100%;
}
.profile-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}
.profile-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); border-color: #93C5FD; }
.profile-avatar { font-size: 52px; line-height: 1; }
.profile-name { font-size: 18px; font-weight: 700; color: var(--text); }
.profile-grade { font-size: 13px; color: var(--muted); font-weight: 500; }
.profiles-empty { text-align: center; color: var(--muted); font-size: 16px; line-height: 1.6; }
.btn-add-child {
  background: var(--dark);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.15s;
}
.btn-add-child:hover { opacity: 0.85; }

/* ADD CHILD SCREEN */
.add-child-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.add-child-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.avatar-btn {
  font-size: 28px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-btn:hover { border-color: #93C5FD; background: #EFF6FF; }
.avatar-btn.active { border-color: #3B82F6; background: #DBEAFE; box-shadow: 0 0 0 3px #BFDBFE; }
.grade-btn { min-width: 52px; font-size: 15px; font-weight: 700; }
.grade-btn.active { background: #6EE7B7; border-color: #34d399; color: #064e3b; }

/* PROGRESS STATS */
.progress-stats { margin-bottom: 20px; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-box {
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
}
.stat-box:nth-child(1) { background: #D1FAE5; border: 2px solid #A7F3D0; }
.stat-box:nth-child(2) { background: #DBEAFE; border: 2px solid #93C5FD; }
.stat-box:nth-child(3) { background: #FFF9C4; border: 2px solid #FFD166; }
.stat-box:nth-child(4) { background: #FFE4E4; border: 2px solid #FCA5A5; }
.stat-box:nth-child(5) { background: #EDE9FE; border: 2px solid #C4B5FD; }
.stat-box:nth-child(6) { background: #FFF0E0; border: 2px solid #FDBA74; }
.stat-val { font-size: 30px; font-weight: 800; color: var(--text); }
.stat-lbl { font-size: 12px; color: #555; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

/* SCORE HISTORY CHART */
.score-history-wrap { margin-bottom: 24px; }
.sh-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.sh-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 16px; }
.sh-bars { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.sh-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sh-pct { font-size: 10px; font-weight: 700; color: var(--text); }
.sh-bar-track { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.sh-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 4px; }
.sh-bar.high { background: #16a34a; }
.sh-bar.mid  { background: #d97706; }
.sh-bar.low  { background: #dc2626; }
.sh-date { font-size: 9px; color: var(--muted); text-align: center; }

/* ── Progress Report v2 (IXL-style, positive reinforcement) ─────────────── */
.pr-statbar { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:14px; }
.pr-stat { display:flex; flex-direction:column; align-items:center; gap:4px; border-radius:18px; padding:16px 10px; }
.pr-stat-v { font-size:24px; font-weight:900; color:#111; line-height:1.1; }
.pr-stat-l { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
.pr-statbar .pr-stat:nth-child(1) { background:#FEF9C3; } .pr-statbar .pr-stat:nth-child(1) .pr-stat-l { color:#A16207; }
.pr-statbar .pr-stat:nth-child(2) { background:#FFE4E6; } .pr-statbar .pr-stat:nth-child(2) .pr-stat-l { color:#BE123C; }
.pr-statbar .pr-stat:nth-child(3) { background:#FED7AA; } .pr-statbar .pr-stat:nth-child(3) .pr-stat-l { color:#C2410C; }
.pr-statbar .pr-stat:nth-child(4) { background:#E0E7FF; } .pr-statbar .pr-stat:nth-child(4) .pr-stat-l { color:#4338CA; }
@media (max-width:480px) { .pr-statbar { grid-template-columns:repeat(2,1fr); } }
.pr-trings { display:flex; flex-wrap:wrap; gap:14px 18px; margin:4px 0 8px; }
.pr-tringitem { display:flex; flex-direction:column; align-items:center; gap:4px; width:64px; }
.pr-tring-wrap { position:relative; width:44px; height:44px; }
.pr-tring-star { position:absolute; top:-6px; right:-6px; font-size:13px; }
.pr-tring-name { font-size:10px; font-weight:700; color:#374151; text-align:center; line-height:1.15; }
.pr-hero { display:flex; align-items:center; gap:18px; background:#fff; border:2px solid #EEF2F7; border-radius:18px; padding:16px; margin-bottom:14px; }
.pr-ring { position:relative; flex-shrink:0; width:116px; height:116px; }
.pr-ring-label { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.pr-ring-pct { font-size:26px; font-weight:900; color:#15803D; line-height:1; }
.pr-ring-sub { font-size:11px; color:#6B7280; font-weight:700; margin-top:3px; }
.pr-hero-stats { flex:1; display:grid; grid-template-columns:1fr 1fr; gap:8px; min-width:0; }
.pr-hstat { display:flex; flex-direction:column; background:#F9FAFB; border-radius:12px; padding:8px 10px; }
.pr-hstat-v { font-size:20px; font-weight:900; color:#111; line-height:1.1; }
.pr-hstat-l { font-size:10px; color:#6B7280; font-weight:700; text-transform:uppercase; letter-spacing:.03em; margin-top:2px; }
.pr-act { background:#fff; border:2px solid #EEF2F7; border-radius:16px; padding:12px 14px; margin-bottom:14px; }
.pr-act-title { font-size:12px; font-weight:800; color:#6B7280; text-transform:uppercase; letter-spacing:.04em; margin-bottom:8px; }
.pr-act-bars { display:flex; align-items:flex-end; gap:8px; height:64px; }
.pr-act-col { flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; }
.pr-act-track { flex:1; display:flex; align-items:flex-end; width:100%; }
.pr-act-bar { width:100%; border-radius:4px 4px 0 0; background:#E5E7EB; min-height:6px; }
.pr-act-bar.on { background:#8B5CF6; }
.pr-act-dow { font-size:10px; color:#9CA3AF; font-weight:700; }
.pr-subj { background:#fff; border:2px solid #EEF2F7; border-radius:14px; padding:12px 14px; margin-bottom:10px; }
.pr-subj-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.pr-subj-name { font-size:15px; font-weight:900; color:#111; }
.pr-subj-avg { font-size:18px; font-weight:900; color:#111; }
.pr-subj-avg-l { font-size:11px; font-weight:700; color:#9CA3AF; }
.pr-bands { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:8px; }
.pr-band { font-size:11px; font-weight:800; padding:3px 8px; border-radius:999px; }
.pr-line { font-size:12px; color:#374151; line-height:1.5; margin-top:3px; }
.pr-line-h { font-weight:800; }
.pr-h-str { color:#15803D; }
.pr-h-build { color:#C2410C; }
.pr-h-go { color:#4338CA; }
.pr-chips { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:6px; }
.pr-chip { font-size:13px; font-weight:800; color:#4338CA; background:#EEF2FF; border:2px solid #C7D2FE; border-radius:999px; padding:8px 14px; cursor:pointer; font-family:inherit; }
.pr-chip-r { font-size:11px; font-weight:600; color:#6366F1; margin-left:2px; }
.pr-details { margin:14px 0 4px; }
.pr-summary { font-size:13px; font-weight:800; color:#6B7280; cursor:pointer; padding:8px 0; }

/* ADMIN */
.admin-parents-list { display: flex; flex-direction: column; gap: 12px; }
.admin-parent-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-parent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  cursor: pointer;
  transition: background 0.15s;
}
.admin-parent-header:hover { background: #f9fafb; }
.admin-parent-email { font-size: 16px; font-weight: 600; color: var(--text); }
.admin-parent-name  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.admin-children-wrap { border-top: 1px solid var(--border); padding: 16px; background: #f9fafb; }
.admin-children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.admin-child-card { cursor: pointer; }
.admin-child-card:hover { border-color: #93C5FD; transform: translateY(-2px); }

/* WORKBOOK ENTRIES */
.wb-entry {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.wb-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s;
}
.wb-entry-header:hover { background: #f9fafb; }
.wb-entry-left { flex: 1; }
.wb-entry-right { display: flex; align-items: center; gap: 12px; }
.wb-chevron { font-size: 13px; color: var(--muted); }

/* Workbook detail (hidden by default, shown when .open) */
.wb-detail { display: none; border-top: 1px solid var(--border); }
.wb-detail.open { display: block; }

/* Problem grid inside workbook entry */
.wb-prob-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  pointer-events: none;
}
.wb-prob-card { cursor: default; }
.wb-correct { border-color: var(--green) !important; background: #f0fdf4 !important; }
.wb-wrong   { border-color: var(--red)   !important; background: #fff5f5 !important; }
.wb-student-ans {
  font-size: 26px;
  font-weight: 700;
  font-family: 'Edu NSW ACT Foundation', cursive;
  text-align: center;
  padding: 8px 4px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wb-ans-ok  { color: var(--green); }
.wb-ans-bad { color: var(--red); }
.wb-frac-ans {
  font-size: 18px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

/* HOME TRACING BOX */
.home-tracing-section { padding: 0; flex-direction: row !important; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.home-counting-btn { background: #FFE4E4 !important; border-color: #FCA5A5 !important; width: 140px; min-height: 110px; }
.home-tracing-btn  { background: #FFF9C4 !important; border-color: #FFD166 !important; width: 140px; min-height: 110px; }
.home-shapes-btn   { background: #BAE6FD !important; border-color: #38BDF8 !important; width: 140px; min-height: 110px; }
.home-time-btn     { background: #FFEDD5 !important; border-color: #FB923C !important; width: 140px; min-height: 110px; }
.home-notebook-btn { background: #E8F5E9 !important; border-color: #A5D6A7 !important; width: 140px; min-height: 110px; }
.home-drill-btn    { background: #FFE4E4 !important; border-color: #FCA5A5 !important; width: 140px; min-height: 110px; }

/* MATH HOME UNIFIED 6x2 TILE GRID */
.subject-home-section { padding: 0; }
.subject-home { display: none; }
.subject-home.active { display: block; }
.subject-home-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.subject-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px;
  min-height: 110px;
  border-radius: var(--radius);
  border: 2.5px solid transparent;
  background: #fff;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  touch-action: manipulation;
}
.subject-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.10); }
.subject-tile .hop-icon { font-size: 30px; font-weight: 800; line-height: 1; }
.subject-tile .hop-name { font-size: 13px; font-weight: 800; color: #111; text-align: center; line-height: 1.2; }
.subject-tile .hop-sub  { font-size: 10px; font-weight: 700; color: #555; }

.subject-tile.mt-counting { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.mt-tracing  { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.mt-shapes   { background: #BAE6FD; border-color: #38BDF8; }
.subject-tile.mt-time     { background: #FFEDD5; border-color: #FB923C; }
.subject-tile.mt-notebook { background: #E8F5E9; border-color: #A5D6A7; }
.subject-tile.mt-drill    { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.op-add  { background: #D1FAE5; border-color: #A7F3D0; }
.subject-tile.op-sub  { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.op-mul  { background: #FFEDD5; border-color: #FDBA74; }
.subject-tile.op-div  { background: #FEFCE8; border-color: #FDE047; }
.subject-tile.op-frac { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.op-dec  { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.op-dec .hop-icon { font-size: 22px; color: #7a5000; }

/* Middle (6-8) tile colors — distinct pastels */
.subject-tile.mid-ratios      { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.mid-percent     { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.mid-rational    { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.mid-exprs       { background: #D1FAE5; border-color: #6EE7B7; }
.subject-tile.mid-stats       { background: #FFEDD5; border-color: #FB923C; }
.subject-tile.mid-probability { background: #EDE9FE; border-color: #A78BFA; }
.subject-tile.mid-geometry    { background: #CCFBF1; border-color: #5EEAD4; }
.subject-tile.mid-functions   { background: #FED7AA; border-color: #FDBA74; }
.subject-tile .mt-fx-icon     { font-style: italic; font-size: 22px; color: #1e3a6e; }

/* High (9-12) tile colors */
.subject-tile.hs-alg1     { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.hs-geom     { background: #CCFBF1; border-color: #5EEAD4; }
.subject-tile.hs-alg2     { background: #EDE9FE; border-color: #A78BFA; }
.subject-tile.hs-precalc  { background: #FED7AA; border-color: #FDBA74; }
.subject-tile.hs-sat-math { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.hs-act-math { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.hs-calc     { background: #D1FAE5; border-color: #6EE7B7; }
.subject-tile.hs-stats    { background: #FFEDD5; border-color: #FB923C; }
.subject-tile .mt-text-icon { font-size: 22px; font-weight: 800; color: #1e3a6e; letter-spacing: 0.5px; }

/* Reading tile colors */
.subject-tile.rd-alpha       { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.rd-alpha .hop-icon { font-size: 30px; }
.subject-tile.rd-sight       { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.rd-svwords     { background: #D1FAE5; border-color: #6EE7B7; }
.subject-tile.rd-shortvowel  { background: #ECFDF5; border-color: #6EE7B7; }
.subject-tile.rd-longvowel   { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.rd-sentences   { background: #EDE9FE; border-color: #C4B5FD; }
.subject-tile.rd-stories     { background: #FEF3C7; border-color: #FCD34D; }
.subject-tile.rd-fluency     { background: #FFEDD5; border-color: #FB923C; }
.subject-tile.rd-skills      { background: #EDE9FE; border-color: #A78BFA; }
.subject-tile.rd-comp        { background: #CCFBF1; border-color: #5EEAD4; }

.subject-tile.rd-vocab       { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.rd-comp-mid    { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.rd-nonfic      { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.rd-author      { background: #EDE9FE; border-color: #A78BFA; }
.subject-tile.rd-poetry      { background: #FCE7F3; border-color: #F9A8D4; }
.subject-tile.rd-theme       { background: #D1FAE5; border-color: #6EE7B7; }
.subject-tile.rd-compare     { background: #FFEDD5; border-color: #FB923C; }
.subject-tile.rd-context     { background: #CCFBF1; border-color: #5EEAD4; }

.subject-tile.rd-sat         { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.rd-act         { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.rd-litanalysis { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.rd-rhetoric    { background: #EDE9FE; border-color: #A78BFA; }
.subject-tile.rd-argument    { background: #D1FAE5; border-color: #6EE7B7; }
.subject-tile.rd-poetrydrama { background: #FCE7F3; border-color: #F9A8D4; }
.subject-tile.rd-aplit       { background: #FFEDD5; border-color: #FB923C; }
.subject-tile.rd-aplang      { background: #CCFBF1; border-color: #5EEAD4; }

/* Writing tile colors */
.subject-tile.wrt-alpha        { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.wrt-alpha .hop-icon-aa { font-size: 32px; color: #FF6B6B; }
.subject-tile.wrt-cursive      { background: #EDE9FE; border-color: #C4B5FD; }
.subject-tile.wrt-sentence     { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.wrt-spelling     { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.wrt-punct        { background: #FFEDD5; border-color: #FB923C; }
.subject-tile.wrt-narrative-e  { background: #D1FAE5; border-color: #6EE7B7; }
.subject-tile.wrt-opinion      { background: #FCE7F3; border-color: #F9A8D4; }
.subject-tile.wrt-informative  { background: #CCFBF1; border-color: #5EEAD4; }

.subject-tile.wrt-grammar       { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.wrt-punct-mid     { background: #FFEDD5; border-color: #FB923C; }
.subject-tile.wrt-paragraph     { background: #D1FAE5; border-color: #6EE7B7; }
.subject-tile.wrt-style         { background: #FCE7F3; border-color: #F9A8D4; }
.subject-tile.wrt-argumentative { background: #EDE9FE; border-color: #A78BFA; }
.subject-tile.wrt-narrative-m   { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.wrt-research-m    { background: #CCFBF1; border-color: #5EEAD4; }
.subject-tile.wrt-edit-m        { background: #FFE4E4; border-color: #FCA5A5; }

.subject-tile.wrt-sat        { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.wrt-act        { background: #FFF9C4; border-color: #FFD166; }
.subject-tile.wrt-essay      { background: #FFE4E4; border-color: #FCA5A5; }
.subject-tile.wrt-edit-h     { background: #EDE9FE; border-color: #A78BFA; }
.subject-tile.wrt-aplang     { background: #FFEDD5; border-color: #FB923C; }
.subject-tile.wrt-creative   { background: #FCE7F3; border-color: #F9A8D4; }
.subject-tile.wrt-rhetoric   { background: #CCFBF1; border-color: #5EEAD4; }
.subject-tile.wrt-research-h { background: #D1FAE5; border-color: #6EE7B7; }

/* Test Prep tile colors */
.subject-tile.tp-k5  { background: #D1FAE5; border-color: #6EE7B7; }
.subject-tile.tp-68  { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.tp-sat { background: #DBEAFE; border-color: #93C5FD; }
.subject-tile.tp-act { background: #FFF1F2; border-color: #FECDD3; }

/* Summer Fun tile colors */
.subject-tile.sf-k5       { background: #FEF9C3; border-color: #FDE047; }
.subject-tile.sf-68       { background: #FEF9C3; border-color: #FDE047; }
.subject-tile.sf-creative { background: #FCE7F3; border-color: #F9A8D4; }

/* ===== WELCOME LANDING (hero + 6 features + CTA on green bg) ===== */
.welcome-landing { padding: 0; }
.welcome-landing.subject-home.active { display: block; }
.wl-hero {
  background: transparent;
  border: none;
  padding: 32px 8px 0;
  text-align: center;
  margin-bottom: 140px;
}
.wl-greeting { font-size: 40px; font-weight: 900; margin: 0 0 14px; line-height: 1.1; letter-spacing: -0.5px; }
.wl-greeting .wl-greet-prefix { color: #6EE7B7; }
.wl-greeting .t-n { color: #FF6B6B; }
.wl-greeting .t-d { color: #FFD166; }
.wl-greeting .t-a { color: #4DBFFF; }
.wl-headline { font-size: 22px; font-weight: 400; margin: 0 0 18px; color: #111; line-height: 1.3; letter-spacing: -0.2px; }
.wl-desc { font-size: 17px; font-weight: 400; color: #4B5563; margin: 0 auto; line-height: 1.6; max-width: 720px; }

.wl-cta { background: linear-gradient(90deg, #6EE7B7 0%, #4DBFFF 100%); border-radius: 14px; padding: 22px 18px 24px; text-align: center; color: #fff; }
.wl-cta h2 { font-size: 20px; font-weight: 900; margin: 0 0 6px; color: #fff; }
.wl-cta p  { font-size: 12.5px; margin: 0 0 14px; color: rgba(255,255,255,0.92); }
.wl-cta-url { display: inline-block; background: #fff; color: #111; font-weight: 900; font-size: 16px; padding: 10px 28px; border-radius: 999px; }

@media (max-width: 760px) {
  .wl-greeting { font-size: 30px; }
  .wl-headline { font-size: 18px; }
  .wl-desc { font-size: 15px; }
  .wl-hero { padding: 20px 14px 0; margin-bottom: 48px; }
}

/* Parent-view section labels (Foundations / Build / Rise / Launch) */
.level-section-label {
  grid-column: 1 / -1;
  display: none;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 800;
  margin: 6px 0 0;
  justify-self: start;
  width: fit-content;
}
.level-section-label.foundations  { background: #FEF3C7; color: #92400e; }
.level-section-label.build        { background: #D1FAE5; color: #065f46; }
.level-section-label.rise   { background: #DBEAFE; color: #1e40af; }
.level-section-label.launch { background: #EDE9FE; color: #5b21b6; }
.parent-view .level-section-label { display: block; }

/* Level picker modal cards responsive (2x2 on narrow) */
@media (max-width: 760px) {
  #level-picker-modal .lvl-cards { grid-template-columns: 1fr 1fr !important; }
}

.subject-tile[disabled] { cursor: default; opacity: 0.7; }
.subject-tile[disabled]:hover { transform: none; box-shadow: none; }
.subject-tile[disabled] .hop-sub { font-style: italic; }

.subject-tile.mt-coming {
  background: #FAFAF7;
  border: 2.5px dashed #d4d4d4;
  cursor: default;
  opacity: 0.7;
}
.subject-tile.mt-coming:hover { transform: none; box-shadow: none; }
.subject-tile.mt-coming .hop-icon { color: #aaa; }
.subject-tile.mt-coming .hop-name { color: #777; }

/* iPad mini / narrower: 2 columns so tiles stay tappable */
@media (max-width: 760px) {
  .subject-home-grid { grid-template-columns: repeat(2, 1fr); }
}

/* MATH OP CONFIG MODAL */
.math-op-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.math-op-modal-bg.open { display: flex; }
.math-op-modal {
  background: #ECFDF5;
  border-radius: 20px;
  padding: 28px 24px 24px;
  max-width: 880px;
  width: 100%;
  border: 4px solid #FFD166;
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
}
.math-op-modal .option-group { justify-content: center; flex-wrap: nowrap; }
.math-op-modal #home-count-group { gap: 8px; }
.math-op-modal .home-label { text-align: center; }
@media (max-width: 760px) {
  .math-op-modal .option-group { flex-wrap: wrap; }
}
.math-op-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 28px;
  font-weight: 700;
  color: #888;
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1;
}
.math-op-modal-close:hover { color: #111; }
.math-op-modal-title {
  margin: 0 0 18px;
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  color: #111;
}
.math-op-modal-section { margin-bottom: 16px; }
.math-op-modal-actions { display: flex; justify-content: center; margin-top: 18px; }

/* COUNTING SCREEN */
#screen-counting-practice.active { display: flex; height: 100vh; overflow: hidden; }
.counting-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 24px 16px;
  height: 100%;
  gap: 14px;
}
.counting-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.counting-main {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.counting-left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.counting-card {
  background: #FFF9F0;
  border-radius: 20px;
  border: 2.5px solid #FCA5A5;
  padding: 28px 20px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.counting-apples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 400px;
}
.counting-apple { line-height: 1; }
.counting-bundle { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.counting-bundle-row { display: flex; gap: 4px; }
.counting-tens-wrap { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 420px; }
.counting-tens-group { display: flex; flex-wrap: wrap; width: 5em; gap: 2px; background: #FFF0E0; border: 2px solid #FDBA74; border-radius: 12px; padding: 6px; justify-content: center; }
.counting-feedback {
  font-size: 28px; font-weight: 800; min-height: 36px;
}
.counting-num-col {
  display: grid;
  gap: 8px;
  height: 100%;
  flex-shrink: 0;
}
.counting-num-col.ten    { grid-template-columns: repeat(2, 72px); grid-template-rows: repeat(5, 1fr); }
.counting-num-col.twenty { grid-template-columns: repeat(4, 62px); grid-template-rows: repeat(5, 1fr); }
.counting-num-card {
  border-radius: 18px;
  border: 2.5px solid #ccc;
  background: #f5f5f5;
  font-family: 'Edu NSW ACT Foundation', cursive;
  font-size: 30px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}
.counting-num-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.counting-num-card.correct { background: #6BCB77 !important; border-color: #34d399 !important; color: #fff !important; }
.counting-num-card.wrong   { background: #FF6B6B !important; border-color: #dc2626 !important; color: #fff !important; }

/* COUNTING WORKSHEET SETTINGS */
.cw-settings-wrap {
  max-width: 480px;
  margin: 40px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.cw-settings-row { display: flex; align-items: center; gap: 20px; }
.cw-settings-label { font-size: 18px; font-weight: 700; color: var(--text); min-width: 110px; }
.cw-settings-group { display: flex; gap: 10px; flex-wrap: wrap; }
.cw-set-btn {
  padding: 10px 22px;
  border-radius: 14px;
  border: 2.5px solid;
  font-family: 'Edu NSW ACT Foundation', cursive;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  opacity: 0.65;
}
.cw-set-btn.active { opacity: 1; transform: scale(1.06); box-shadow: 0 4px 14px rgba(0,0,0,0.15); }
.cw-set-btn:hover { opacity: 0.9; }
.cw-start-btn {
  margin-top: 12px;
  padding: 18px;
  width: 100%;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #6BCB77, #4DBFFF);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(77,191,255,0.35);
}
.cw-start-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(77,191,255,0.45); }

/* COUNTING WORKSHEET PRACTICE */
#screen-counting-ws-practice.active { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.cw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 24px;
  overflow-y: auto;
  flex: 1;
}
.cw-card {
  background: #fff;
  border: 2.5px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.cw-objects {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  align-content: center;
}
.cw-obj { font-size: 32px; line-height: 1.1; }
.cw-answer-box {
  width: 64px;
  height: 52px;
  border: 3px solid #93C5FD;
  border-radius: 12px;
  background: #EFF6FF;
  font-family: 'Edu NSW ACT Foundation', cursive;
  font-size: 26px;
  font-weight: 700;
  color: #1e3a6e;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.cw-answer-box.selected { border-color: #3B82F6; background: #DBEAFE; box-shadow: 0 0 0 3px rgba(59,130,246,0.3); }
.cw-answer-box.correct  { border-color: #34d399 !important; background: #D1FAE5 !important; color: #065f46 !important; }
.cw-answer-box.wrong    { border-color: #EF4444 !important; background: #FFE4E4 !important; color: #991b1b !important; font-size: 13px !important; width: auto !important; min-width: 80px !important; padding: 0 8px; }
.cw-numpad {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px 14px;
  flex-shrink: 0;
  background: #f9fafb;
  border-top: 1.5px solid #e5e7eb;
}
.cw-num-btn {
  width: 54px; height: 50px;
  border-radius: 12px;
  border: 2.5px solid;
  font-family: 'Edu NSW ACT Foundation', cursive;
  font-size: 22px; font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s;
}
.cw-num-btn:hover { transform: scale(1.08); }
.cw-clear-btn { background: #FEE2E2 !important; border-color: #FCA5A5 !important; color: #991b1b !important; font-size: 20px !important; }
.cw-result-banner {
  background: #D1FAE5;
  border: 2.5px solid #6BCB77;
  border-radius: 14px;
  margin: 8px 24px 0;
  padding: 12px 20px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #065f46;
  flex-shrink: 0;
}
.cw-result-banner.low { background: #FFE4E4; border-color: #FCA5A5; color: #991b1b; }

.drill-op-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.drill-op-btn { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; border: 2.5px solid transparent; font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.drill-op-btn.op-add  { background: #D1FAE5; border-color: #A7F3D0; }
.drill-op-btn.op-sub  { background: #FFE4E4; border-color: #FCA5A5; }
.drill-op-btn.op-mul  { background: #FFEDD5; border-color: #FDBA74; }
.drill-op-btn.op-div  { background: #FEFCE8; border-color: #FDE047; }
.drill-op-btn.op-frac { background: #DBEAFE; border-color: #93C5FD; }
.drill-op-btn.active  { border-width: 3px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); transform: translateY(-1px); }
.drill-horiz-grid { grid-template-columns: repeat(5, 1fr) !important; }
.drill-result-banner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; background: linear-gradient(135deg,#A78BFA,#4DBFFF); color:#fff; border-radius: 12px; padding: 12px 20px; font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.drill-problems-grid { grid-template-columns: repeat(10, 1fr) !important; gap: 4px !important; }
.drill-problems-grid .problem-card { padding: 6px 4px; gap: 2px; }
.drill-problems-grid .prob-a, .drill-problems-grid .prob-b { font-size: 18px; }
.drill-problems-grid .prob-numbers { margin-bottom: 4px; }
.drill-problems-grid .answer-input { font-size: 18px !important; min-height: 32px; padding: 4px 2px; }
.drill-problems-grid .answer-canvas { height: 44px; }
.drill-problems-grid .result-badge { font-size: 9px; min-height: 10px; }
.drill-problems-grid .correct-label, .drill-problems-grid .wrong-label { font-size: 9px; }
.drill-problems-grid .correct-val { font-size: 9px; }
.drill-eraser-btn { font-size: 14px; padding: 1px 4px; background: #fff3cd; border: 1px solid #ffc107; border-radius: 4px; cursor: pointer; margin-top: 2px; }

/* PRACTICE NOTEBOOK */
#screen-notebook { background: #f0ebe3; min-height: 100vh; display: none; align-items: center; justify-content: center; padding: 24px 16px; }
#screen-notebook.active { display: flex; }
.notebook-outer { display: flex; align-items: stretch; width: 100%; max-width: 900px; }
.notebook-outer {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 860px;
  position: relative;
}
.notebook-wrap {
  display: flex;
  position: relative;
  background: #fff;
  border-radius: 4px 12px 12px 4px;
  box-shadow: -4px 4px 20px rgba(0,0,0,0.18), 4px 4px 20px rgba(0,0,0,0.1);
  min-height: 80vh;
  flex: 1;
  overflow: hidden;
}
.notebook-spiral {
  width: 28px;
  background: linear-gradient(180deg, #b0a8f8 0%, #7ec8f8 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 16px 0;
  flex-shrink: 0;
}
.spiral-ring {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #e8e0ff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.notebook-tabs {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 0;
  margin-left: 4px;
  flex-shrink: 0;
}
.nb-tab {
  flex: 1;
  width: 52px;
  padding: 4px 2px;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  text-align: center;
  opacity: 0.75;
  transition: all 0.15s;
  box-shadow: 2px 0 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.nb-tab .nb-tab-sym { font-size: 22px; font-weight: 900; line-height: 1; color: #000; margin-bottom: 6px; }
.nb-tab .nb-tab-word { font-size: 13px; font-weight: 900; line-height: 1; color: #000; writing-mode: vertical-rl; text-orientation: upright; letter-spacing: 2px; }
.nb-tab { opacity: 1; }
.nb-tab.active { opacity: 1; width: 60px; box-shadow: 3px 0 10px rgba(0,0,0,0.2); }
.nb-tab-add  { background: #A8F5D1; color: #000; }
.nb-tab-sub  { background: #FF9494; color: #000; }
.nb-tab-mul  { background: #FFB87A; color: #000; }
.nb-tab-div  { background: #FFF176; color: #000; }
.nb-tab-frac { background: #93C5FD; color: #000; }
.notebook-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 56px 16px 12px;
  background: #fff;
  background-image: repeating-linear-gradient(transparent, transparent 31px, #e8f0fe 31px, #e8f0fe 32px);
  background-position: 0 40px;
}
.nb-submit-result {
  background: linear-gradient(135deg, #A78BFA, #4DBFFF);
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
/* ── RATIOS & PROPORTIONS ─────────────────────────────────────────────── */
/* Full-screen layout: sidebar tabs + content, no scroll */
#screen-ratios.active { display: flex !important; flex-direction: column; height: 100dvh; overflow: hidden; }
.ratio-topbar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 2px solid #E5E7EB; flex-shrink: 0; background: #fff; }
.ratio-screen-title { flex: 1; font-size: 15px; font-weight: 900; color: #111; text-align: center; }
.ratio-main { display: flex; flex: 1; overflow: hidden; min-height: 0; }
/* Vertical sidebar tabs */
.ratio-sidebar { width: 120px; flex-shrink: 0; display: flex; flex-direction: column; gap: 3px; padding: 8px 6px; border-right: 2px solid #E5E7EB; background: #F9FAFB; overflow-y: auto; }
.ratio-tab { width: 100%; text-align: left; padding: 9px 9px; border-radius: 10px; border: 2px solid transparent; background: transparent; font-size: 11.5px; font-weight: 700; color: #6B7280; cursor: pointer; font-family: inherit; line-height: 1.35; transition: all .15s; }
.ratio-tab.active { background: #EEF2FF; border-color: #6366F1; color: #4338CA; }
/* Content area */
.ratio-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.ratios-top-bar { display: flex; align-items: center; gap: 6px; padding: 5px 8px; flex-shrink: 0; flex-wrap: wrap; border-bottom: 1px solid #F0F0F0; }
.ratio-set-row { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.ratio-set-btn { padding: 4px 9px; border-radius: 12px; border: 2px solid #E5E7EB; background: #F9FAFB; font-size: 11px; font-weight: 700; color: #6B7280; cursor: pointer; font-family: inherit; }
.ratio-set-btn.active { background: #DBEAFE; border-color: #93C5FD; color: #1D4ED8; }
.ratio-grid-wrap { flex: 1; min-height: 0; padding: 5px 8px 0; overflow: hidden; }
/* Grid: fills all available space with fixed row/col counts */
.ratios-grid { display: grid; height: 100%; gap: 5px; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(5, 1fr); }
.ratios-grid.word-mode { grid-template-columns: repeat(2, 1fr); }
/* Cards — 50% question / 50% answer, matching Math Facts style */
.ratio-card { background: #fff; border: 2px solid #D1FAE5; border-radius: 12px; min-height: 0; font-family: inherit; display: flex; flex-direction: column; }
.ratio-card.correct { border-color: #6BCB77; background: #F0FDF4; }
.ratio-card.wrong   { border-color: #FCA5A5; background: #FFF1F2; }
/* Top 50%: equation — non-bold for older kids */
.ratio-calc-q { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 4px 8px; font-size: 24px; font-weight: 400; color: #111; }
/* Top for word problems */
.ratio-word-q { flex: 1; font-size: 15px; font-weight: 400; color: #111; line-height: 1.35; padding: 8px 10px; display: flex; align-items: center; }
/* Bottom 50%: answer fills the full green area */
.ratio-calc-ans { margin-top: auto; display: flex; flex-direction: column; align-items: stretch; border-top: 2px solid #D1FAE5; background: #F0FDF4; padding: 2px 8px; }
.ratio-card.wrong .ratio-calc-ans { border-top-color: #FCA5A5; background: #FFF1F2; }
/* Answer row fills full height; input stretches inside it */
.ratio-ans-row { flex: 1; display: flex; align-items: center; gap: 6px; }
/* "x =" label */
.ratio-ans-label { display: flex; align-items: center; gap: 1px; flex-shrink: 0; }
.ratio-eq-sign { font-size: 18px; font-weight: 400; color: #374151; flex-shrink: 0; }
.ratio-input { flex: 1; align-self: stretch; border: 2px solid #9CA3AF; border-radius: 8px; padding: 0 8px; font-size: 17px; font-weight: 700; text-align: center; font-family: inherit; background: #fff; min-height: 0; }
.ratio-canvas { border: 2px solid #9CA3AF; border-radius: 8px; background: #fff; display: block; flex: 1; }
.ratio-unit { font-size: 11px; font-weight: 700; color: #6B7280; flex-shrink: 0; }
.ratio-card .result-badge { font-size: 10px; line-height: 1.3; padding: 0 2px; flex-shrink: 0; }
.ratio-card .result-badge:empty { display: none; }
.ratio-card .correct-label { color: #065f46; font-size: 10px; font-weight: 800; }
.ratio-card .wrong-label { color: #991b1b; font-size: 10px; font-weight: 800; }
.ratio-card .correct-val { color: #1D4ED8; font-size: 10px; font-weight: 800; margin-left: 3px; }
.ratio-submit-row { display: flex; gap: 8px; padding: 6px 10px; flex-shrink: 0; align-items: center; justify-content: flex-end; }
.ratio-submit-row .btn-outline { border: 2px solid #9CA3AF; background: #F3F4F6; color: #374151; font-weight: 800; }
/* Scratch pad type mode — step rows */
.scratch-step-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.scratch-step-num { width: 22px; height: 22px; background: #6366F1; color: #fff; border-radius: 50%; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 9px; }
.scratch-step-body { flex: 1; }
.scratch-step-input { width: 100%; padding: 7px 12px; border: 2px solid #E5E7EB; border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; box-sizing: border-box; }
.scratch-step-input:focus { border-color: #6366F1; outline: none; }
.scratch-step-render { padding: 4px 10px 6px; font-size: 20px; font-weight: 400; color: #111; line-height: 2; display: none; }
.sp-frac { font-size: 18px !important; }
.sp-fn { font-size: 18px !important; font-weight: 400 !important; }
.sp-fd { font-size: 18px !important; font-weight: 400 !important; }
.sp-eq { font-size: 20px; font-weight: 400; color: #374151; margin: 0 4px; }
/* Example modal */
.ratio-example-block { background: #F8FAFF; border: 2px solid #BFDBFE; border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.ratio-example-label { font-size: 11px; font-weight: 800; color: #2563EB; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.ratio-example-problem { font-size: 15px; font-weight: 800; color: #111; margin-bottom: 10px; }
.ratio-example-steps { display: flex; flex-direction: column; gap: 6px; }
.ratio-step { font-size: 13px; color: #374151; display: flex; align-items: baseline; gap: 8px; }
.ratio-step-n { background: #2563EB; color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
/* Stacked fraction */
.r-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 3px; line-height: 1; }
.r-fn { border-bottom: 2px solid #374151; padding: 1px 6px; font-size: 22px; font-weight: 400; }
.r-fd { padding: 1px 6px; font-size: 22px; font-weight: 400; }
/* Math italic x — matches equation text size, not bold */
.vx { font-family: 'Georgia', 'Times New Roman', serif; font-style: italic; font-size: 24px; color: #111; font-weight: 400; line-height: 1; vertical-align: middle; flex-shrink: 0; }
@media (max-width: 760px) {
  .ratio-sidebar { width: 88px; }
  .ratio-tab { font-size: 10px; padding: 7px 6px; }
  .ratios-grid { gap: 3px; }
  .ratio-calc-q { font-size: 20px; }
  .vx { font-size: 22px; }
  .ratio-input { width: 56px; height: 30px; font-size: 14px; }
}
/* ──────────────────────────────────────────────────────────────────────── */

.notebook-page-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.nb-page-info { font-size: 14px; font-weight: 700; color: #374151; flex: 1; }
.nb-fact-select { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.nb-fact-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid #d1d5db;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Edu NSW ACT Foundation', cursive;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nb-fact-btn.active { background: #111827; color: #fff; border-color: #111827; }
.nb-problems-area { overflow-y: auto; }
.nb-card { break-inside: avoid; }
.nb-horiz-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.nb-horiz-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1.5px solid #e5e7eb; border-radius: 10px; background: #fff; }
.nb-horiz-row { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.nb-horiz-grid.op-add  .nb-horiz-card { background: #F0FDF7; border: 3px solid #6EE7B7; }
.nb-horiz-grid.op-sub  .nb-horiz-card { background: #FFF5F5; border: 3px solid #FCA5A5; }
.nb-horiz-grid.op-mul  .nb-horiz-card { background: #FFF8F0; border: 3px solid #FDBA74; }
.nb-horiz-grid.op-div  .nb-horiz-card { background: #FEFEF0; border: 3px solid #FDE047; }
.nb-horiz-grid.op-frac .nb-horiz-card { background: #F0F7FF; border: 3px solid #93C5FD; }
.nb-horiz-grid .nb-horiz-card.correct { border-color: #16a34a; }
.nb-horiz-grid .nb-horiz-card.wrong   { border-color: #dc2626; }
.nb-horiz-label { font-family: 'Edu NSW ACT Foundation', cursive; font-size: 42px; font-weight: 700; white-space: nowrap; }
.nb-horiz-canvas { border-bottom: 2px solid #111827; background: transparent; width: 70px; height: 50px; }
.nb-horiz-input { width: 60px; font-family: 'Edu NSW ACT Foundation', cursive; font-size: 28px !important; font-weight: 700; padding: 2px 4px; text-align: center; border-bottom: 2px solid #111827; border-top: none; border-left: none; border-right: none; background: transparent; }
.nb-horiz-badge { font-size: 12px; }
.nb-rec-label { font-family: 'Edu NSW ACT Foundation', cursive; font-size: 16px; font-weight: 700; }
.nb-frac-grid { grid-template-columns: repeat(3, 1fr) !important; }
.nb-frac-grid .frac-n, .nb-frac-grid .frac-d { font-size: 26px; min-width: 28px; }
.nb-frac-grid .frac-op, .nb-frac-grid .frac-eq { font-size: 24px; }
.nb-frac-grid .frac-bar-h { min-width: 28px; }
.nb-frac-grid .frac-input { width: 44px; height: 36px; font-size: 20px; }
.nb-frac-grid .frac-bar-ans { width: 44px; }
.nb-clear-btn { font-size: 11px; padding: 2px 8px; background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; border-radius: 6px; cursor: pointer; margin-top: 2px; }
.notebook-page-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

/* TRACING OPTIONS SCREEN */
.tracing-opts-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px;
  gap: 24px;
}
.tracing-opts-sub { color: var(--muted); font-size: 15px; margin: 0; }
.tracing-opts-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 700px;
}
.tracing-opt-card {
  flex: 1;
  min-width: 160px;
  max-width: 220px;
  background: color-mix(in srgb, var(--card-color, #ccc) 25%, white);
  border: 2.5px solid var(--card-color, #ccc);
  border-radius: 20px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
}
.tracing-opt-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.toc-num {
  font-family: 'Edu NSW ACT Foundation', cursive;
  font-size: 52px;
  font-weight: 700;
  color: var(--card-color, #ccc);
  line-height: 1;
}
.toc-label { font-size: 16px; font-weight: 700; color: var(--text); }
.toc-sub   { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* TRACING PRACTICE SCREEN */
.tracing-screen { background: #f4e3bb; flex-direction: column; }
.tracing-top { background: #f4e3bb; border-bottom: 1px solid #d4b896; }
.tracing-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.tracing-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 16px 24px;
  background: #f4e3bb;
  border-top: 1px solid #d4b896;
}

/* SINGLE NUMBER TRACING */
.tracing-single-wrap {
  position: relative;
  flex: 1;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* SINGLE LETTER TRACING — bigger, centered */
.alpha-single-wrap {
  position: relative;
  width: min(88vw, 88vh, 560px);
  height: min(88vw, 88vh, 560px);
  margin: auto;
  flex-shrink: 0;
}
.tracing-abs-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
  z-index: 1;
}
.tracing-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
  z-index: 2;
}

/* WORKSHEET TRACING */
.tracing-sheet {
  padding: 20px 16px;
  background: #f4e3bb;
}
.tracing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px dashed #c4a87a;
}
.tr-label {
  font-family: 'Edu NSW ACT Foundation', cursive;
  font-size: 36px;
  font-weight: 700;
  width: 44px;
  text-align: center;
  flex-shrink: 0;
}
.tr-cells {
  display: flex;
  gap: 8px;
  flex: 1;
}
.tr-cell {
  position: relative;
  flex: 1;
  aspect-ratio: 1 / 1.1;
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
  border: 1px solid #d4b896;
  overflow: hidden;
}
.tr-guide {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Edu NSW ACT Foundation', cursive;
  font-size: min(70px, 12vw);
  font-weight: 700;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
.tr-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
  z-index: 2;
}

/* WORKBOOK FLIP VIEW */
.wb-flip-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.wb-flip-counter {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}
.wb-flip-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.wb-flip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.wb-flip-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.wb-flip-body {
  padding: 0;
}

/* PRINT */
@media print {
  .page-top, .top-actions, .submit-row, .btn-dark, .btn-outline, .btn-outline-sm { display: none !important; }
  .problems-grid { padding: 0; }
  .problem-card { break-inside: avoid; border: 1px solid #ccc; }
  .answer-input { background: white; border: none; border-radius: 0; }
}

/* HOME RESPONSIVE */
@media (max-width: 768px) {
  .home-wrap { padding: 28px 20px 48px; gap: 20px; }
  .home-title { font-size: 40px; }
  .home-op-grid { grid-template-columns: repeat(2, 1fr); }
  .home-row { flex-direction: column; }
}

/* RESPONSIVE — iPad portrait op grid: 3+2 layout */
@media (min-width: 600px) and (max-width: 1024px) {
  .home-op-grid { grid-template-columns: repeat(3, 1fr); }
}

/* RESPONSIVE — iPad portrait */
@media (max-width: 1024px) {
  .problems-grid { grid-template-columns: repeat(5, 1fr); padding: 20px 24px; }
  .page-top { padding: 20px 24px 0; }
}
@media (max-width: 768px) {
  .problems-grid { grid-template-columns: repeat(5, 1fr); padding: 6px 8px; gap: 5px; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .setting-label { min-width: unset; }
  .page-top { padding: 6px 12px 0; }
  .app-title { font-size: 15px; }
  .app-sub { font-size: 12px; margin-top: 2px; }
  .page-title-row { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 8px; }
  .top-actions { gap: 4px; }
  .btn-outline-sm { padding: 5px 8px; font-size: 11px; }
  .ws-info { font-size: 12px; padding: 4px 0 6px; }
  .submit-row { padding: 6px 12px 10px; gap: 8px; }
  .btn-submit { font-size: 14px; padding: 10px 16px; min-height: 40px; }
  .btn-outline { font-size: 14px; padding: 10px 16px; min-height: 40px; }
  .problem-card { padding: 8px 8px 6px; align-items: center; }
  .prob-a, .prob-b { font-size: 26px; }
  .prob-line { margin-bottom: 5px; }
  .answer-input { font-size: 26px !important; padding: 7px 4px; min-height: 40px; }
  .result-badge { margin-top: 3px; min-height: 14px; font-size: 12px; }
  .prob-numbers { display: inline-block; text-align: right; margin-bottom: 4px; }
  .prob-line { width: 100%; }
}

@media (max-width: 480px) {
  .problems-grid { grid-template-columns: repeat(3, 1fr); }
  .home-op-grid { grid-template-columns: repeat(2, 1fr); }
  .home-wrap { padding: 20px 14px 40px; }
  .home-title { font-size: 32px; }
}

/* ── Landing screen ── */
#screen-landing.active {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 24px 16px 40px;
  background: linear-gradient(135deg, #6EE7B7 0%, #4DBFFF 100%);
}
.landing-wrap { max-width: 1100px; width: 100%; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; gap: 0; }
.landing-header { text-align: center; padding: 8px 0 0; }
.landing-title { font-size: 60px; font-weight: 900; letter-spacing: -1px; margin: 0; line-height: 1; }
.landing-title .t-n { color: #FF6B6B; }
.landing-title .t-d { color: #FFD166; }
.landing-title .t-a { color: #4DBFFF; text-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.landing-sub { font-size: 26px; color: #FF4FA3; font-weight: 800; margin: 6px 0 0; }

/* Emoji clock circle */
.emoji-circle { position: relative; width: min(380px, 80vw); aspect-ratio: 1; margin: 0 auto; }
.cf-center {
  position: absolute; left: 50%; top: 50%;
  font-size: 52px; line-height: 1;
  transform: translate(-50%, -50%);
  z-index: 2;
  opacity: 0;
}
@keyframes trophy-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.cf-center { animation: trophy-in 0.5s cubic-bezier(0.34,1.56,0.64,1) 12.8s forwards; }

/* MASTER inner ring — 6 letters evenly spaced on r≈20% circle */
.ml-pos {
  position: absolute; font-size: 44px; font-weight: 900; line-height: 1;
  opacity: 0; transform: translate(-50%, -50%);
  display: inline-block; position: absolute;
}
.ml-letter { display: block; line-height: 1; }
.ml-sub {
  position: absolute; top: 52%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px; line-height: 1;
}
.ml-M { left: 67.3%; top: 40%;   color: #FF3B30; }
.ml-A { left: 67.3%; top: 60%;   color: #FFD60A; }
.ml-S { left: 50%;   top: 70%;   color: #C6FF00; }
.ml-T { left: 32.7%; top: 60%;   color: #FF6EC7; }
.ml-E { left: 32.7%; top: 40%;   color: #BF5AF2; }
.ml-R { left: 50%;   top: 30%;   color: #FF9F0A; }
/* Wrapper rotates once, letters counter-rotate to stay upright */
.master-ring-wrap {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  transform-origin: 50% 50%;
  animation: ring-orbit 2.5s ease-in-out 2s 1 forwards;
}
@keyframes ring-orbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes counter-orbit {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(-360deg); }
}
@keyframes master-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.ml-M { animation: master-in 0.35s cubic-bezier(0.34,1.56,0.64,1) 0.2s forwards, counter-orbit 2.5s ease-in-out 2s 1 forwards; }
.ml-A { animation: master-in 0.35s cubic-bezier(0.34,1.56,0.64,1) 0.5s forwards, counter-orbit 2.5s ease-in-out 2s 1 forwards; }
.ml-S { animation: master-in 0.35s cubic-bezier(0.34,1.56,0.64,1) 0.8s forwards, counter-orbit 2.5s ease-in-out 2s 1 forwards; }
.ml-T { animation: master-in 0.35s cubic-bezier(0.34,1.56,0.64,1) 1.1s forwards, counter-orbit 2.5s ease-in-out 2s 1 forwards; }
.ml-E { animation: master-in 0.35s cubic-bezier(0.34,1.56,0.64,1) 1.4s forwards, counter-orbit 2.5s ease-in-out 2s 1 forwards; }
.ml-R { animation: master-in 0.35s cubic-bezier(0.34,1.56,0.64,1) 1.7s forwards, counter-orbit 2.5s ease-in-out 2s 1 forwards; }

/* 12 grade emojis — clock positions (grade N at N o'clock, radius 42%) */
/* fade-in touches only opacity, cf-bounce touches only transform — no conflict */
.cf-pos { position: absolute; font-size: 38px; line-height: 1; opacity: 0; }
.cf-g1  { left: 71%;   top: 13.6%; }
.cf-g2  { left: 86.4%; top: 29%; }
.cf-g3  { left: 92%;   top: 50%; }
.cf-g4  { left: 86.4%; top: 71%; }
.cf-g5  { left: 71%;   top: 86.4%; }
.cf-g6  { left: 50%;   top: 92%; }
.cf-g7  { left: 29%;   top: 86.4%; }
.cf-g8  { left: 13.6%; top: 71%; }
.cf-g9  { left: 8%;    top: 50%; }
.cf-g10 { left: 13.6%; top: 29%; }
.cf-g11 { left: 29%;   top: 13.6%; }
.cf-g12 { left: 50%;   top: 8%; }

@keyframes grade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes cf-bounce {
  0%, 100% { transform: translate(-50%, -50%); }
  50%       { transform: translate(-50%, calc(-50% - 8px)); }
}
.cf-g1  { animation: grade-in 0.4s ease-out 5.0s forwards, cf-bounce 2.4s ease-in-out 5.0s  infinite; }
.cf-g2  { animation: grade-in 0.4s ease-out 5.6s forwards, cf-bounce 2.4s ease-in-out 5.6s  infinite; }
.cf-g3  { animation: grade-in 0.4s ease-out 6.2s forwards, cf-bounce 2.4s ease-in-out 6.2s  infinite; }
.cf-g4  { animation: grade-in 0.4s ease-out 6.8s forwards, cf-bounce 2.4s ease-in-out 6.8s  infinite; }
.cf-g5  { animation: grade-in 0.4s ease-out 7.4s forwards, cf-bounce 2.4s ease-in-out 7.4s  infinite; }
.cf-g6  { animation: grade-in 0.4s ease-out 8.0s forwards, cf-bounce 2.4s ease-in-out 8.0s  infinite; }
.cf-g7  { animation: grade-in 0.4s ease-out 8.6s forwards, cf-bounce 2.4s ease-in-out 8.6s  infinite; }
.cf-g8  { animation: grade-in 0.4s ease-out 9.2s forwards, cf-bounce 2.4s ease-in-out 9.2s  infinite; }
.cf-g9  { animation: grade-in 0.4s ease-out 9.8s forwards, cf-bounce 2.4s ease-in-out 9.8s  infinite; }
.cf-g10 { animation: grade-in 0.4s ease-out 10.4s forwards, cf-bounce 2.4s ease-in-out 10.4s infinite; }
.cf-g11 { animation: grade-in 0.4s ease-out 11.0s forwards, cf-bounce 2.4s ease-in-out 11.0s infinite; }
.cf-g12 { animation: grade-in 0.4s ease-out 11.6s forwards, cf-bounce 2.4s ease-in-out 11.6s infinite; }

.landing-line { font-size: 26px; font-weight: 800; color: #111; margin: 14px 0 4px; text-align: center; line-height: 1.35; letter-spacing: -0.2px; }
.landing-welcome { margin: 6px auto 0; max-width: 720px; text-align: center; padding: 8px 12px; }
.lw-desc { margin: 0; font-size: 16px; line-height: 1.6; color: #1f2937; font-weight: 500; }
.lw-desc .t-n { color: #FF6B6B; font-weight: 800; }
.lw-desc .t-d { color: #FFD166; font-weight: 800; }
.lw-desc .t-a { color: #FF4FA3; font-weight: 800; }
.landing-cta {
  margin-top: 16px; margin-bottom: 8px;
  padding: 18px 42px;
  border: 2px solid rgba(255,255,255,0.55);
  border-radius: 999px;
  background: linear-gradient(135deg, #6EE7B7 0%, #4DBFFF 100%);
  color: #FF4FA3; font-size: 20px; font-weight: 900; letter-spacing: 0.3px;
  cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  transition: transform .15s, box-shadow .15s;
}
.landing-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,0.25); }
.landing-student-btn {
  display: block; margin: 4px auto 16px;
  padding: 12px 32px;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: #1e3a6e; font-size: 16px; font-weight: 800;
  cursor: pointer; letter-spacing: 0.2px;
  transition: background .15s;
}
.landing-student-btn:hover { background: rgba(255,255,255,0.3); }
@media (max-width: 760px) {
  .landing-title { font-size: 44px; }
  .landing-sub { font-size: 18px; }
  .emoji-circle { width: min(360px, 88vw); }
  .cf-center { font-size: 48px; }
  .cf-pos { font-size: 32px; }
  .landing-line { font-size: 20px; }
  .landing-cta { padding: 14px 28px; font-size: 16px; }
}

/* ── HELP / ABOUT SCREEN ──────────────────────────────────────────────── */
.help-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  flex: 1;
}
#screen-help {
  background: linear-gradient(160deg, #D1FAE5 0%, #DBEAFE 40%, #FFF9C4 100%);
}
.help-card {
  background: #fff;
  border-radius: 16px;
  border: 2px solid #e5e7eb;
  padding: 24px;
}
.help-card-icon { font-size: 32px; margin-bottom: 8px; }
.help-card-title { font-size: 20px; font-weight: 800; color: #111; margin: 0 0 10px; }
.help-card-text  { font-size: 15px; color: #444; line-height: 1.6; margin: 0; }
.help-subjects   { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.help-subject-chip { padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: 700; }
.faq-list  { display: flex; flex-direction: column; gap: 12px; }
.faq-item  { background: rgba(255,255,255,0.45); border-radius: 10px; padding: 14px 16px; }
.faq-q     { font-size: 14px; font-weight: 800; color: #111; margin-bottom: 6px; }
.faq-a     { font-size: 14px; color: #555; line-height: 1.5; }
.help-form { display: flex; flex-direction: column; gap: 12px; }
.help-input {
  width: 100%; box-sizing: border-box;
  padding: 10px 14px; border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.6); font-size: 15px;
  font-family: inherit; background: rgba(255,255,255,0.45);
  outline: none;
}
.help-input:focus { border-color: #7DD3FC; background: #fff; }
.help-textarea { resize: vertical; min-height: 120px; }

/* Parent message history */
.help-msg-empty { font-size:14px; color:#6b7280; text-align:center; padding:12px 0; }
.help-msg-thread { background:rgba(255,255,255,0.5); border-radius:12px; padding:14px 16px; margin-bottom:12px; }
.help-msg-thread:last-child { margin-bottom:0; }
.help-msg-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.help-msg-subject { font-size:14px; font-weight:800; color:#111; }
.help-msg-meta { font-size:12px; color:#9ca3af; }
.help-msg-body { font-size:14px; color:#374151; line-height:1.5; }
.help-msg-unread-dot { display:inline-block; width:8px; height:8px; background:#FF6B6B; border-radius:50%; margin-right:6px; vertical-align:middle; }
.help-msg-replies { margin-top:10px; border-top:1px solid rgba(0,0,0,0.08); padding-top:10px; display:flex; flex-direction:column; gap:8px; }
.help-msg-reply { background:#E0F2FE; border-radius:8px; padding:8px 12px; font-size:13px; color:#0c4a6e; }
.help-msg-reply-label { font-weight:800; margin-right:6px; }
.help-msg-reply-text { line-height:1.4; }

/* Admin tabs */
.admin-tabs { display:flex; gap:8px; margin-bottom:20px; }
.admin-tab { padding:9px 20px; border-radius:10px; border:2px solid #e5e7eb; background:#fff; font-size:14px; font-weight:700; cursor:pointer; font-family:inherit; color:#374151; transition:all .15s; position:relative; }
.admin-tab.active { background:#0F172A; color:#fff; border-color:#0F172A; }
.admin-msg-badge { display:inline-block; background:#FF6B6B; color:#fff; font-size:11px; font-weight:800; border-radius:20px; padding:1px 7px; margin-left:6px; }

/* Admin message cards */
.admin-msg-card { background:#fff; border:2px solid #e5e7eb; border-radius:14px; padding:18px 20px; margin-bottom:14px; }
.admin-msg-card-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:8px; }
.admin-msg-from { font-size:15px; font-weight:800; color:#111; }
.admin-msg-email { font-size:12px; color:#6b7280; margin-top:2px; }
.admin-msg-subject { font-size:13px; font-weight:700; color:#4F46E5; margin-bottom:6px; }
.admin-msg-body { font-size:14px; color:#374151; line-height:1.5; margin-bottom:12px; }
.admin-msg-status { font-size:11px; font-weight:800; padding:3px 10px; border-radius:20px; text-transform:uppercase; }
.status-open { background:#FEF3C7; color:#92400e; }
.status-replied { background:#D1FAE5; color:#065f46; }
.admin-msg-reply-list { margin-bottom:12px; display:flex; flex-direction:column; gap:6px; }
.admin-msg-reply-item { font-size:13px; color:#374151; background:#EEF2FF; border-radius:8px; padding:8px 12px; }
.admin-msg-reply-form { border-top:1px solid #f3f4f6; padding-top:12px; }
.admin-msg-reply-input { width:100%; box-sizing:border-box; padding:10px 14px; border-radius:10px; border:2px solid #e5e7eb; font-size:14px; font-family:inherit; resize:vertical; outline:none; }
.admin-msg-reply-input:focus { border-color:#818CF8; }

/* About screen — flyer content */
.about-hero {
  background: linear-gradient(135deg, #D1FAE5, #FFF9C4);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 20px;
  text-align: center;
}
.about-hero h1 { font-size: 22px; font-weight: 900; color: #111; margin-bottom: 8px; }
.about-hero p  { font-size: 15px; color: #444; line-height: 1.6; max-width: 540px; margin: 0 auto; }

.about-subjects {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
@media (max-width: 700px) { .about-subjects { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 460px) { .about-subjects { grid-template-columns: repeat(2, 1fr); } }
.about-subject-card {
  border-radius: 12px;
  padding: 16px 10px;
  text-align: center;
}
.about-s-icon { font-size: 28px; margin-bottom: 6px; }
.about-subject-card h3 { font-size: 13px; font-weight: 800; margin-bottom: 4px; }
.about-subject-card p  { font-size: 11px; color: #555; line-height: 1.4; }
.as-math    { background: #D1FAE5; border: 2px solid #6BCB77; }
.as-reading { background: #FFF9C4; border: 2px solid #FFD166; }
.as-writing { background: #FFE4E4; border: 2px solid #FCA5A5; }
.as-testprep{ background: #DBEAFE; border: 2px solid #93C5FD; }
.as-summer  { background: #FFF3E0; border: 2px solid #FFCC80; }

.about-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 460px) { .about-features { grid-template-columns: 1fr; } }
.about-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: 10px;
  padding: 14px 16px;
}
.about-f-icon { font-size: 22px; flex-shrink: 0; }
.about-feature h4 { font-size: 13px; font-weight: 800; margin-bottom: 3px; }
.about-feature p  { font-size: 12px; color: #555; line-height: 1.4; }
.af1 { background: #D1FAE5; border: 1.5px solid #6BCB77; }
.af2 { background: #FFF9C4; border: 1.5px solid #FFD166; }
.af3 { background: #DBEAFE; border: 1.5px solid #93C5FD; }
.af4 { background: #FFE4E4; border: 1.5px solid #FCA5A5; }
.af5 { background: #F3E8FF; border: 1.5px solid #C4B5FD; }
.af6 { background: #FFF3E0; border: 1.5px solid #FFCC80; }

.about-grades-bar {
  background: #FFE4E0;
  border: 2px solid #FF8A7A;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.about-grades-bar h3 { font-size: 15px; font-weight: 800; }
.about-grades-bar p  { font-size: 12px; color: #555; margin-top: 2px; }
.about-grade-pills { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.about-grade-pill {
  background: #6BCB77;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
}
.about-gp-sat { background: #818CF8; }
