/* ===== TOKENS ===== */
:root {
  --bg: #f0f4ff;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --muted: #7a7a9a;
  --chloe:  #f472b6;
  --aiyden: #fb923c;
  --kayson: #60a5fa;
  --zander: #a78bfa;
  --corbyn: #34d399;
  --green: #22c55e;
  --green-light: #dcfce7;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 20px;
  --radius-sm: 12px;
  --font: 'Nunito', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ===== HOME HEADER ===== */
.home-header {
  position: relative;
  text-align: center;
  padding: 48px 24px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  border-radius: 0 0 40px 40px;
}
.star-row { font-size: 2rem; margin-bottom: 8px; letter-spacing: 8px; }
.home-header h1 { font-size: 2.8rem; font-weight: 900; letter-spacing: -1px; text-shadow: 0 2px 12px rgba(0,0,0,0.15); }
.subtitle { font-size: 1.1rem; font-weight: 600; opacity: 0.85; margin-top: 6px; }

.hub-home-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  text-decoration: none;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, transform 0.15s ease;
}
.hub-home-btn:hover  { background: rgba(255, 255, 255, 0.3); }
.hub-home-btn:active { transform: scale(0.96); }

/* ===== KID GRID ===== */
.kid-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px 20px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}
.kid-btn {
  background: var(--card-bg);
  border: 3px solid transparent;
  border-radius: var(--radius);
  padding: 24px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.kid-btn:active { transform: scale(0.96); }
.kid-btn[data-kid="Chloe"]  { border-color: var(--chloe); }
.kid-btn[data-kid="Aiyden"] { border-color: var(--aiyden); }
.kid-btn[data-kid="Kayson"] { border-color: var(--kayson); }
.kid-btn[data-kid="Zander"] { border-color: var(--zander); }
.kid-btn[data-kid="Corbyn"] { border-color: var(--corbyn); }
.kid-avatar  { font-size: 3rem; line-height: 1; }
.kid-name    { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.kid-progress {
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
  background: var(--bg); border-radius: 20px; padding: 2px 10px;
}

/* ===== HOME FOOTER ===== */
.home-footer {
  text-align: center;
  padding: 8px 24px 40px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.reset-btn, .history-btn {
  background: none;
  border: 2px solid #d1d5db;
  border-radius: 20px;
  padding: 10px 28px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  width: 220px;
}
.history-btn { border-color: #a5b4fc; color: #6366f1; }
.history-btn:hover { background: #ede9fe; }
.reset-btn:hover   { border-color: #9ca3af; color: var(--text); }

/* ===== CHORE HEADER ===== */
.chore-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  background: var(--card-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}
.back-btn {
  background: var(--bg); border: none; border-radius: 10px;
  padding: 8px 14px; font-family: var(--font); font-size: 0.95rem;
  font-weight: 700; color: var(--text); cursor: pointer;
}
.chore-title-area { display: flex; align-items: center; gap: 8px; }
.chore-avatar { font-size: 1.8rem; }
#chore-kid-name { font-size: 1.4rem; font-weight: 900; }
.chore-score {
  font-size: 1rem; font-weight: 800; color: var(--green);
  background: var(--green-light); border-radius: 10px;
  padding: 6px 12px; min-width: 56px; text-align: center;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap { padding: 16px 20px 8px; max-width: 600px; margin: 0 auto; width: 100%; }
.progress-bar-bg { background: #e5e7eb; border-radius: 99px; height: 14px; overflow: hidden; }
.progress-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.progress-label { text-align: right; font-size: 0.8rem; font-weight: 700; color: var(--muted); margin-top: 4px; }

/* ===== CHORE LIST ===== */
.chore-list {
  list-style: none;
  padding: 12px 20px 100px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chore-item {
  background: var(--card-bg); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); display: flex; align-items: center;
  gap: 16px; padding: 18px 20px; cursor: pointer;
  transition: transform 0.15s ease, opacity 0.3s;
  -webkit-tap-highlight-color: transparent;
  border: 2px solid transparent;
  animation: slideIn 0.3s ease both;
}
.chore-item:active { transform: scale(0.98); }
.chore-item.done { opacity: 0.65; border-color: var(--green); background: #f0fdf4; }
.chore-item.done .chore-label { text-decoration: line-through; color: var(--muted); }
.chore-check {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid #d1d5db;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; font-size: 1.1rem;
}
.chore-item.done .chore-check { background: var(--green); border-color: var(--green); }
.chore-icon  { font-size: 1.6rem; }
.chore-label { font-size: 1.1rem; font-weight: 700; flex: 1; }
.screen-Chloe  .chore-item:not(.done):hover { border-color: var(--chloe); }
.screen-Aiyden .chore-item:not(.done):hover { border-color: var(--aiyden); }
.screen-Kayson .chore-item:not(.done):hover { border-color: var(--kayson); }
.screen-Zander .chore-item:not(.done):hover { border-color: var(--zander); }
.screen-Corbyn .chore-item:not(.done):hover { border-color: var(--corbyn); }

/* ===== OPTIONAL CHORES ===== */
.chore-divider {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 4px;
}
.chore-divider::before,
.chore-divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  border-radius: 2px;
}

.chore-item.optional {
  background: #fafafa;
  border-style: dashed;
  border-color: #e5e7eb;
  box-shadow: none;
}
.chore-item.optional.done {
  border-color: var(--green);
  background: #f0fdf4;
}
.chore-item.optional .chore-check {
  border-color: #d1d5db;
  background: #f3f4f6;
}
.chore-item.optional.done .chore-check {
  background: var(--green);
  border-color: var(--green);
}

.chore-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.chore-freq {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: #f3f4f6;
  border-radius: 6px;
  padding: 1px 7px;
  align-self: flex-start;
}
.chore-item.done .chore-freq { opacity: 0.5; }

.tick-opt       { color: #a78bfa; }
.tick-opt-label { color: var(--muted); font-style: italic; margin-top: 4px; }


.done-banner {
  display: none; text-align: center; font-size: 1.4rem; font-weight: 900;
  color: var(--green); background: var(--green-light); border-radius: var(--radius);
  margin: 0 20px 24px; padding: 20px;
  max-width: 560px; margin-left: auto; margin-right: auto;
}
.done-banner.show { display: block; animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1); }

/* ===== HISTORY SCREEN ===== */
.history-content {
  padding: 16px 16px 60px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  overflow-x: auto;
}
.history-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.8;
}

/* Summary grid */
.history-summary-wrap {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin-bottom: 24px;
  padding: 4px 0;
}
.hist-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #f3f4f6;
}
.hist-row:last-child { border-bottom: none; }
.hist-header-row { background: #f9fafb; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.hist-cell {
  min-width: 70px;
  padding: 10px 8px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.hist-kid-label {
  min-width: 110px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 14px;
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
}
.hist-avatar { font-size: 1.2rem; }
.hist-date { color: var(--muted); line-height: 1.3; }
.hist-na   { color: #d1d5db; font-weight: 700; }

/* Score badge */
.score-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 800;
}

/* Detail cards */
.detail-title {
  font-size: 1rem;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  margin-top: 4px;
}
.day-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.day-card-date {
  background: linear-gradient(90deg, #6366f1, #a855f7);
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 10px 18px;
}
.day-card-kids {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.day-kid {
  flex: 1 1 140px;
  padding: 14px 16px;
  border-right: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.day-kid:last-child { border-right: none; }
.day-kid-avatar { font-size: 1.4rem; }
.day-kid-name   { font-size: 0.85rem; font-weight: 800; }

.chore-breakdown {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.chore-tick {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
}
.tick-yes { color: var(--green); }
.tick-no  { color: #f87171; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: 360px;
  width: 92%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h3 { font-size: 1.4rem; font-weight: 900; margin-bottom: 10px; }
.modal p  { color: var(--muted); font-weight: 600; margin-bottom: 20px; line-height: 1.6; }
.pw-input {
  width: 100%;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  outline: none;
  transition: border-color 0.2s;
}
.pw-input:focus { border-color: #6366f1; }
.pw-error {
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 700;
  min-height: 22px;
  margin-bottom: 14px;
}
.modal-btns { display: flex; gap: 12px; margin-top: 4px; }
.modal-cancel, .modal-confirm {
  flex: 1; padding: 12px; border-radius: 12px; border: none;
  font-family: var(--font); font-size: 1rem; font-weight: 800; cursor: pointer;
}
.modal-cancel  { background: var(--bg); color: var(--text); }
.modal-confirm { background: #6366f1; color: white; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a2e;
  color: white;
  padding: 14px 24px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 0.95rem;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== ANIMATIONS ===== */
@keyframes pop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
  .home-header h1 { font-size: 2.2rem; }
  .kid-avatar { font-size: 2.4rem; }
  .kid-name   { font-size: 1rem; }
  .day-kid    { flex: 1 1 100%; }
}

/* ===== POINTS DISPLAY ===== */
.kid-points {
  font-size: 0.78rem;
  font-weight: 800;
  color: #f59e0b;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 20px;
  padding: 2px 10px;
}

.chore-points-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
  padding: 6px 20px 2px;
  font-size: 1rem;
  font-weight: 800;
}
.pts-label { color: var(--muted); font-size: 0.85rem; }
.pts-value {
  color: #f59e0b;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 12px;
  padding: 3px 14px;
  font-size: 1rem;
}

.rewards-shortcut-wrap {
  text-align: center;
  padding: 6px 20px 2px;
}
.rewards-shortcut-btn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 22px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.rewards-shortcut-btn:active { transform: scale(0.97); }

/* Points tag on optional chore items */
.chore-meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chore-pts-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: #f59e0b;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 6px;
  padding: 1px 7px;
}

/* ===== REWARDS SCREEN ===== */
.reward-pts-total {
  font-size: 0.9rem;
  font-weight: 800;
  color: #f59e0b;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 10px;
  padding: 5px 12px;
}

.reward-list {
  list-style: none;
  padding: 16px 20px 80px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reward-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid #fde68a;
  animation: slideIn 0.3s ease both;
}
.reward-item.reward-locked {
  border-color: #e5e7eb;
  opacity: 0.6;
  background: #fafafa;
}

.reward-icon { font-size: 2rem; flex-shrink: 0; }
.reward-label-wrap { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.reward-label { font-size: 1rem; font-weight: 800; }
.reward-cost  { font-size: 0.8rem; font-weight: 700; color: #f59e0b; }
.reward-item.reward-locked .reward-cost { color: var(--muted); }

.redeem-btn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.redeem-btn.redeem-disabled {
  background: #e5e7eb;
  color: var(--muted);
  cursor: not-allowed;
}

/* Redeem modal extras */
.redeem-reward-preview {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 8px;
}

/* ===== HISTORY POINTS ===== */
.hist-cell-stack { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hist-pts-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: #f59e0b;
  background: #fffbeb;
  border-radius: 6px;
  padding: 1px 5px;
}
.day-pts-earned {
  font-size: 0.75rem;
  font-weight: 800;
  color: #f59e0b;
  background: #fffbeb;
  border-radius: 6px;
  padding: 1px 7px;
  align-self: flex-start;
}

/* Points strip in history */
.pts-strip {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 20px;
}
.pts-strip-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.pts-strip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pts-strip-kid {
  flex: 1 1 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 8px;
}
.pts-strip-avatar { font-size: 1.4rem; }
.pts-strip-name   { font-size: 0.75rem; font-weight: 800; }
.pts-strip-val    { font-size: 0.85rem; font-weight: 900; }
