:root {
  --purple: #6c4ce6;
  --purple-dark: #4329bd;
  --purple-soft: #eee9ff;
  --ink: #22223b;
  --muted: #6d6d80;
  --green: #168354;
  --green-soft: #d9f7e7;
  --red: #a43636;
  --red-soft: #ffe0e0;
  --yellow: #ffc94d;
  --card: rgba(255, 255, 255, .96);
  font-family: Inter, ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #f7f4ff;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 8%, #fff2bc 0 7%, transparent 7.5%),
    radial-gradient(circle at 91% 16%, #d9f7ea 0 8%, transparent 8.5%),
    linear-gradient(180deg, #f7f4ff 0%, #eef8ff 100%);
}
button, input, textarea { font: inherit; }
button { touch-action: manipulation; }
.app-shell {
  width: min(980px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 30px) 42px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--purple);
  color: white;
  font-size: 28px;
  box-shadow: 0 10px 26px rgba(108, 76, 230, .25);
}
.brand h1 { margin: 0; font-size: clamp(23px, 4.5vw, 36px); }
.brand p { margin: 3px 0 0; color: var(--muted); }
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pill {
  border: 0;
  border-radius: 999px;
  background: white;
  padding: 11px 15px;
  font-weight: 800;
  color: var(--ink);
  box-shadow: 0 7px 22px rgba(35, 30, 70, .11);
}
.pill.primary { background: var(--purple); color: white; }
.card {
  background: var(--card);
  border: 1px solid rgba(108, 76, 230, .10);
  border-radius: 28px;
  box-shadow: 0 18px 48px rgba(45, 38, 90, .12);
  padding: clamp(20px, 4vw, 38px);
}
.hero {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}
.hero h2 { font-size: clamp(30px, 6vw, 52px); margin: 0 0 10px; }
.hero p { color: var(--muted); font-size: 18px; line-height: 1.55; margin: 0 0 22px; }
.hero-art {
  min-height: 180px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #eee9ff, #dff7ff);
  font-size: clamp(68px, 12vw, 120px);
}
.primary-btn, .secondary-btn, .choice-btn {
  border: 0;
  border-radius: 18px;
  font-weight: 900;
  cursor: pointer;
}
.primary-btn {
  min-height: 58px;
  padding: 0 24px;
  color: white;
  background: var(--purple);
  box-shadow: 0 9px 22px rgba(108, 76, 230, .25);
}
.secondary-btn {
  min-height: 48px;
  padding: 0 18px;
  color: var(--purple-dark);
  background: var(--purple-soft);
}
.primary-btn:focus-visible, .secondary-btn:focus-visible, .choice-btn:focus-visible,
.pill:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 4px solid rgba(108, 76, 230, .25);
  outline-offset: 2px;
}
.section-title {
  margin: 28px 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.section-title h3 { margin: 0; font-size: 24px; }
.section-title span { color: var(--muted); }
.day-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.day-card {
  min-height: 132px;
  border: 0;
  border-radius: 22px;
  padding: 16px;
  text-align: left;
  background: white;
  box-shadow: 0 10px 24px rgba(40, 35, 80, .09);
  cursor: pointer;
}
.day-card strong { display: block; font-size: 21px; margin-bottom: 7px; }
.day-card span { color: var(--muted); line-height: 1.35; }
.day-card.active { background: linear-gradient(145deg, #7456e9, #5d40d3); color: white; }
.day-card.active span { color: rgba(255,255,255,.84); }
.day-card.done { box-shadow: inset 0 0 0 3px #75d8a8, 0 10px 24px rgba(40,35,80,.09); }
.day-card.locked { opacity: .55; cursor: default; }
.progress-track {
  width: 100%;
  height: 14px;
  background: #e9e6f4;
  border-radius: 999px;
  overflow: hidden;
}
.progress-track > span {
  display: block;
  height: 100%;
  background: var(--purple);
  transition: width .25s ease;
}
.activity-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.activity-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-weight: 900;
}
.activity-count { color: var(--muted); font-weight: 800; }
.question-wrap { text-align: center; padding: 12px 0 4px; }
.question-title { font-size: clamp(24px, 5vw, 39px); margin: 8px 0 10px; }
.question-text {
  color: var(--muted);
  font-size: clamp(17px, 3vw, 21px);
  line-height: 1.55;
  max-width: 760px;
  margin: 0 auto 24px;
}
.math-display {
  font-size: clamp(42px, 10vw, 76px);
  font-weight: 950;
  margin: 24px 0;
}
.emoji-equations {
  display: inline-grid;
  gap: 9px;
  padding: 18px 24px;
  border-radius: 22px;
  background: #fff9df;
  font-size: clamp(25px, 5vw, 38px);
  font-weight: 900;
  margin-bottom: 20px;
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.choice-btn {
  min-height: 76px;
  padding: 10px;
  background: #f0edff;
  color: var(--purple-dark);
  font-size: clamp(22px, 4vw, 31px);
  box-shadow: inset 0 0 0 2px rgba(108, 76, 230, .11);
}
.choice-btn.selected-correct { background: var(--green-soft); color: #12633f; }
.choice-btn.selected-wrong { background: var(--red-soft); color: var(--red); }
.answer-input, .writing-input {
  width: min(620px, 100%);
  border: 3px solid #ded8f6;
  border-radius: 18px;
  background: white;
  color: var(--ink);
}
.answer-input {
  height: 76px;
  padding: 0 18px;
  text-align: center;
  font-size: 32px;
  font-weight: 900;
}
.writing-input {
  min-height: 180px;
  padding: 16px;
  resize: vertical;
  font-size: 19px;
  line-height: 1.5;
}
.feedback {
  min-height: 48px;
  margin: 18px 0 0;
  text-align: center;
  font-size: 20px;
  font-weight: 900;
}
.feedback.good { color: var(--green); }
.feedback.bad { color: var(--red); }
.activity-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.reading-box {
  max-width: 760px;
  margin: 0 auto 22px;
  text-align: left;
  padding: 22px;
  border-radius: 20px;
  background: #f5fbff;
  line-height: 1.65;
  font-size: 18px;
}
.summary {
  text-align: center;
}
.summary-badge {
  width: 120px;
  height: 120px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff2bc;
  font-size: 60px;
}
.summary h2 { font-size: clamp(30px, 6vw, 48px); margin: 8px 0; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 650px;
  margin: 24px auto;
}
.stat {
  border-radius: 18px;
  background: #f6f4ff;
  padding: 18px 10px;
}
.stat strong { display: block; font-size: 28px; }
.stat span { color: var(--muted); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(30, 25, 55, .55);
}
.modal {
  width: min(580px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: white;
  border-radius: 26px;
  padding: 25px;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
.modal h2 { margin-top: 0; }
.parent-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}
.parent-table th, .parent-table td {
  padding: 11px 8px;
  border-bottom: 1px solid #e9e6f4;
  text-align: left;
}
.small-note { color: var(--muted); font-size: 14px; line-height: 1.5; }
.install-note {
  margin-top: 18px;
  padding: 15px;
  border-radius: 18px;
  background: #eef8ff;
  color: #28536a;
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 135px; }
  .day-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .topbar { align-items: flex-start; }
  .brand p { display: none; }
  .top-actions { flex-direction: column-reverse; align-items: flex-end; }
  .pill { padding: 9px 12px; }
  .day-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .day-card { min-height: 112px; padding: 13px; }
}
.gate-shell { display: grid; place-items: center; }
.gate-card { width: min(560px, 100%); text-align: center; }
.gate-card h1 { font-size: clamp(30px, 6vw, 46px); margin: 10px 0; }
.gate-card p { color: var(--muted); font-size: 18px; line-height: 1.55; }
.login-card .answer-input { display: block; margin: 20px auto; max-width: 320px; letter-spacing: .25em; }
.link-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.sync-pill { font-size: 13px; color: var(--muted); }
@media (max-width: 620px) { .sync-pill { display: none; } }
