@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── RESET & BASE ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #1565C0;
  --blue-lt: #1976D2;
  --blue-dk: #0D47A1;
  --amber:   #FF8F00;
  --amber-lt:#FFA000;
  --green:   #2E7D32;
  --red:     #C62828;
  --bg:      #E8EAF6;
  --card:    #FFFFFF;
  --text:    #1A237E;
  --sub:     #5C6BC0;
  --border:  #C5CAE9;
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }
#confetti-canvas {
  position: fixed; inset: 0; pointer-events: none; z-index: 1000; display: none;
}

/* ── HOME SCREEN ──────────────────────────────────────── */
.home-screen {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.home-header {
  position: relative;
  text-align: center;
  width: 100%;
}

.home-title {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.15;
  color: var(--blue-dk);
  letter-spacing: -0.5px;
  text-shadow: 0 2px 0 rgba(0,0,0,.08);
}

.earnings-pill {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  padding: 6px 18px;
  border-radius: 999px;
  margin-top: 10px;
}

.honeydo-pill {
  display: inline-block;
  background: var(--amber);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 5px 16px;
  border-radius: 999px;
  margin-top: 6px;
}

.daily-pill {
  display: inline-block;
  background: #E8EAF6;
  color: var(--sub);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 14px;
  border-radius: 999px;
  border: 2px solid var(--border);
  margin-top: 6px;
}
.daily-pill.daily-done {
  background: #E8F5E9;
  color: var(--green);
  border-color: #A5D6A7;
}

.gear-btn {
  position: absolute;
  top: 0; right: 0;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  padding: 4px;
}
.gear-btn:hover { opacity: 1; }

.home-sub {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sub);
  text-align: center;
}

/* ── CATEGORY GRID ───────────────────────────────────── */
.category-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 2px solid transparent;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
  color: #fff;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.cat-card:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 7px 20px rgba(0,0,0,.18); }
.cat-card:active { transform: scale(0.98); }

.cat-0 { background: linear-gradient(135deg, #1565C0 0%, #1976D2 100%); }
.cat-1 { background: linear-gradient(135deg, #00695C 0%, #00897B 100%); }
.cat-2 { background: linear-gradient(135deg, #E65100 0%, #FF6D00 100%); }
.cat-3 { background: linear-gradient(135deg, #283593 0%, #3949AB 100%); }
.cat-4 { background: linear-gradient(135deg, #B71C1C 0%, #D32F2F 100%); }

.cat-emoji { font-size: 1.7rem; flex-shrink: 0; }
.cat-info  { display: flex; flex-direction: column; flex: 1; }
.cat-name  { font-size: 1rem; font-weight: 800; }
.cat-count { font-size: 0.8rem; font-weight: 600; opacity: 0.8; margin-top: 1px; }
.cat-arrow { font-size: 1.5rem; opacity: 0.7; }

.back-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--sub);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}
.back-link:hover { color: var(--blue); }

/* ── QUIZ SCREEN ─────────────────────────────────────── */
.quiz-screen {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.home-btn {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.home-btn:hover { background: var(--bg); }

.progress-wrap { flex: 1; }
.progress-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sub);
  margin-bottom: 4px;
}
.progress-track {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--amber));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.score-chip {
  background: var(--green);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 10px;
  flex-shrink: 0;
}

.question-card {
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,.10);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.5;
  text-align: center;
  white-space: pre-wrap;
}

/* Number input */
.num-input-wrap { display: flex; justify-content: center; }
.ans-input {
  width: 140px;
  font-size: 1.6rem;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  text-align: center;
  border: 3px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.ans-input:focus { border-color: var(--blue); }
.ans-input:disabled { background: #f5f5f5; }

/* Choices */
.choices-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.choice-btn {
  padding: 14px 10px;
  border-radius: 12px;
  border: 2.5px solid var(--border);
  background: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--blue);
  background: #E8EAF6;
}
.choice-btn.selected {
  border-color: var(--blue);
  background: #BBDEFB;
  color: var(--blue-dk);
}
.choice-btn.correct-highlight {
  border-color: var(--green);
  background: #E8F5E9;
  color: var(--green);
}
.choice-btn.wrong-highlight {
  border-color: var(--red);
  background: #FFEBEE;
  color: var(--red);
}
.choice-btn:disabled { cursor: default; }

/* Check button */
.check-btn {
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: var(--blue);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.check-btn:hover:not(:disabled) { background: var(--blue-lt); transform: translateY(-1px); }
.check-btn:disabled { background: #B0BEC5; cursor: default; }

/* Feedback */
.feedback-box {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}
.feedback-box.hidden { display: none; }
.fb-correct { background: #E8F5E9; color: var(--green); border: 2px solid #A5D6A7; }
.fb-wrong   { background: #FFEBEE; color: var(--red);   border: 2px solid #EF9A9A; }

/* ── RESULTS SCREEN ──────────────────────────────────── */
.results-screen {
  max-width: 440px;
  margin: 32px auto;
  padding: 0 16px;
}
.results-card {
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.results-pass { border-top: 6px solid var(--green); }
.results-fail { border-top: 6px solid var(--amber); }

.results-trophy { font-size: 3.5rem; line-height: 1; }
.results-cat { font-size: 1.15rem; font-weight: 800; color: var(--sub); }

.score-row { display: flex; align-items: baseline; gap: 10px; }
.score-big { font-size: 3rem; font-weight: 900; color: var(--text); }
.score-sep { font-size: 1rem; font-weight: 700; color: var(--sub); }

.pct-badge {
  font-size: 1.4rem;
  font-weight: 900;
  padding: 6px 20px;
  border-radius: 999px;
}
.pct-pass { background: #E8F5E9; color: var(--green); }
.pct-fail { background: #FFF3E0; color: var(--amber); }

.earned-block {
  background: #E8F5E9;
  border: 2px solid #A5D6A7;
  border-radius: 12px;
  padding: 14px 18px;
  width: 100%;
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
  text-align: center;
  line-height: 1.7;
}
.cap-block   { background: #FFF3E0; border-color: #FFCC80; color: #E65100; }
.balance-line { font-size: 0.9rem; font-weight: 600; color: var(--sub); }
.try-block {
  background: #FFF3E0;
  border: 2px solid #FFCC80;
  border-radius: 12px;
  padding: 14px 18px;
  width: 100%;
  font-size: 1rem;
  font-weight: 700;
  color: #E65100;
  line-height: 1.7;
}

.results-btns { display: flex; gap: 10px; width: 100%; }
.btn-try {
  flex: 1; padding: 13px; border-radius: 12px; border: none;
  background: var(--amber); color: #fff;
  font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: filter 0.15s;
}
.btn-try:hover { filter: brightness(1.08); }
.btn-home {
  flex: 1; padding: 13px; border-radius: 12px;
  border: 2.5px solid var(--border); background: #fff; color: var(--sub);
  font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: background 0.15s;
}
.btn-home:hover { background: var(--bg); }

/* ── PARENT SCREEN ───────────────────────────────────── */
.parent-screen {
  max-width: 560px;
  margin: 32px auto;
  padding: 0 16px;
}
.parent-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
}
.parent-lock-title { font-size: 1.5rem; font-weight: 900; text-align: center; margin-bottom: 6px; }
.parent-lock-sub   { font-size: 0.95rem; font-weight: 600; color: var(--sub); text-align: center; margin-bottom: 16px; }

.pin-input {
  width: 100%;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 6px;
  border: 3px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  outline: none;
  margin-bottom: 10px;
}
.pin-input:focus { border-color: var(--blue); }

.pin-error {
  background: #FFEBEE; color: var(--red);
  border: 2px solid #EF9A9A;
  border-radius: 8px; padding: 8px 12px;
  font-weight: 700; font-size: 0.9rem; margin-bottom: 10px;
}
.pin-error.hidden { display: none; }

.pin-btns { display: flex; gap: 10px; }
.btn-cancel {
  flex: 1; padding: 12px; border-radius: 12px;
  border: 2.5px solid var(--border); background: #fff;
  font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 800;
  color: var(--sub); cursor: pointer;
}
.btn-cancel:hover { background: var(--bg); }
.btn-verify {
  flex: 1; padding: 12px; border-radius: 12px; border: none;
  background: var(--blue); color: #fff;
  font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: background 0.15s;
}
.btn-verify:hover { background: var(--blue-lt); }

/* Parent dashboard */
.parent-dashboard { display: flex; flex-direction: column; gap: 16px; }
.parent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.parent-header h2 { font-size: 1.3rem; font-weight: 900; }
.parent-header .btn-cancel { flex: none; padding: 6px 14px; font-size: 0.85rem; }

.parent-balance {
  background: #E8EAF6;
  border-radius: 12px;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.parent-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-danger {
  padding: 9px 14px; border-radius: 10px; border: none;
  background: #FFEBEE; color: var(--red);
  font-family: 'Nunito', sans-serif; font-size: 0.9rem; font-weight: 800;
  cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #FFCDD2; }
.btn-pin-change {
  padding: 9px 14px; border-radius: 10px;
  border: 2px solid var(--border); background: #fff;
  font-family: 'Nunito', sans-serif; font-size: 0.9rem; font-weight: 800;
  color: var(--sub); cursor: pointer; transition: background 0.15s;
}
.btn-pin-change:hover { background: var(--bg); }

.change-pin-wrap {
  background: #F5F5F5;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.change-pin-wrap.hidden { display: none; }
.change-pin-wrap .pin-input { margin-bottom: 0; font-size: 1.2rem; letter-spacing: 4px; }
.pin-msg { border-radius: 8px; padding: 8px 12px; font-weight: 700; font-size: 0.9rem; }
.pin-msg.hidden { display: none; }
.pin-msg-ok  { background: #E8F5E9; color: var(--green); border: 2px solid #A5D6A7; }
.pin-msg-err { background: #FFEBEE; color: var(--red);   border: 2px solid #EF9A9A; }

.history-heading { font-size: 1rem; font-weight: 800; color: var(--sub); }
.no-history { font-size: 0.9rem; color: #9E9E9E; font-weight: 600; }

.history-table-wrap { overflow-x: auto; border-radius: 10px; border: 2px solid var(--border); }
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-weight: 700;
}
.history-table thead th {
  background: #E8EAF6;
  padding: 9px 10px;
  text-align: left;
  font-size: 0.78rem;
  color: var(--sub);
  font-weight: 800;
  white-space: nowrap;
}
.history-table tbody td {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.row-pass { background: #F1F8E9; }
.row-fail { background: #FFF9C4; }
