/* RESET -------------------------------------------------------- */

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, #020617 55%, #000 100%);
  color: #f9fafb;
}

/* APP WRAPPER -------------------------------------------------- */

.app {
  min-height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 16px 24px;
}

/* HEADER ------------------------------------------------------- */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #020617, #111827);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  margin-bottom: 14px;
}

.app-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
}

.app-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: #9ca3af;
}

.family-badge {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* FAMILY LEVEL ------------------------------------------------- */

.family-level {
  padding: 10px 14px 12px;
  border-radius: 16px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.4);
  margin-bottom: 12px;
}

.family-level-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.family-level-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ca3af;
}

.family-level-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.family-level-bar {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #020617;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.8);
}

.family-level-fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, #22c55e, #a3e635, #f97316);
  transition: width 0.3s ease-out;
}

.family-summary-text {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #9ca3af;
}

/* PROFILE SELECTOR --------------------------------------------- */

.kid-selector {
  margin-bottom: 10px;
}

.section-label {
  margin: 0 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ca3af;
}

.kid-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.kid-tab {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  padding: 6px 10px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease-out, transform 0.06s ease-out, box-shadow 0.1s;
}

.kid-tab span {
  font-size: 1rem;
}

.kid-tab.active {
  background: radial-gradient(circle at top, #22c55e, #16a34a);
  color: #022c22;
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(34, 197, 94, 0.55);
  transform: translateY(-1px);
}

/* Extra chaos glow for Toby 😈 */
.kid-tab.toby.active {
  background: radial-gradient(circle at top, #f97316, #b91c1c);
  color: #fef2f2;
  box-shadow: 0 10px 24px rgba(248, 113, 113, 0.7);
}

/* Royal glow for Mum 👑 */
.kid-tab.mum.active {
  background: radial-gradient(circle at top, #f9a8d4, #c4b5fd);
  color: #0f172a;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(244, 114, 182, 0.7);
}

/* PROFILE SUMMARY ---------------------------------------------- */

.kid-summary {
  margin-top: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kid-summary-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kid-emoji {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.kid-name {
  font-size: 1rem;
  font-weight: 600;
}

.kid-tagline {
  font-size: 0.75rem;
  color: #9ca3af;
}

.kid-summary-right {
  text-align: right;
}

.coins-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9ca3af;
}

.coins-value {
  font-size: 1.7rem;
  font-weight: 800;
}

/* MOOD CARD ---------------------------------------------------- */

.mood-card {
  padding: 12px 14px;
  border-radius: 18px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 16px;
}

.mood-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.mood-label {
  font-size: 0.85rem;
}

.mood-status-text {
  font-size: 0.75rem;
  color: #9ca3af;
}

.mood-buttons {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.mood-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 6px 0;
  font-size: 1.3rem;
  cursor: pointer;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.4);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out, border-color 0.06s;
}

.mood-btn.active {
  background: #22c55e;
  border-color: #22c55e;
  color: #022c22;
  box-shadow: 0 10px 22px rgba(34, 197, 94, 0.5);
}

.mood-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* QUESTS ------------------------------------------------------- */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.section-title {
  margin: 0;
  font-size: 1.05rem;
}

.section-caption {
  font-size: 0.75rem;
  color: #9ca3af;
}

.quests-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.quest-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 56px;
}

.quest-icon {
  font-size: 1.7rem;
}

.quest-coins {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.quest-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quest-title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.quest-title {
  margin: 0;
  font-size: 0.95rem;
}

.quest-status-pill {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: #e5e7eb;
  white-space: nowrap;
}

.quest-desc {
  margin: 0;
  font-size: 0.8rem;
  color: #9ca3af;
}

.quest-button {
  margin-top: 6px;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.4);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out, opacity 0.2s;
}

.quest-button:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.4);
}

.quest-button.completed {
  background: #111827;
  color: #9ca3af;
  opacity: 0.7;
  box-shadow: none;
  cursor: default;
}

/* REWARD SHOP -------------------------------------------------- */

.rewards-section {
  margin-top: 18px;
}

.rewards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reward-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.reward-icon {
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reward-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.reward-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.reward-desc {
  font-size: 0.75rem;
  color: #9ca3af;
}

.reward-meta {
  font-size: 0.75rem;
  color: #facc15;
}

.reward-actions {
  display: flex;
  align-items: center;
}

.reward-button {
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  background: #facc15;
  color: #1f2937;
  white-space: nowrap;
}

.reward-button.disabled {
  background: #111827;
  color: #9ca3af;
  cursor: default;
}

/* READING & PLAY TIME ------------------------------------------ */

.learning-section {
  margin-top: 20px;
}

.learning-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.learn-btn {
  flex: 1;
  min-width: 30%;
  border: none;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #e5e7eb;
}

/* LEARNING MODAL ----------------------------------------------- */

.learning-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.learning-modal.open {
  display: flex;
}

.learning-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
}

.learning-dialog {
  position: relative;
  width: min(480px, 100% - 32px);
  border-radius: 18px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 14px 14px 12px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.7);
  z-index: 1;
}

.learning-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.learning-title {
  margin: 0;
  font-size: 1rem;
}

.learning-close {
  border: none;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #0f172a;
  color: #e5e7eb;
}

.learning-body {
  min-height: 120px;
  padding: 10px 4px;
}

.learning-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.learning-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: #1f2937;
  color: #e5e7eb;
}

.learning-btn.primary {
  background: #22c55e;
  color: #022c22;
}

/* STORYBOOK / CARTOON BOOK ------------------------------------ */

.book-layout {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(circle at top, #111827, #020617);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.book-page {
  padding: 14px 10px;
  background: rgba(15, 23, 42, 0.96);
}

.book-page + .book-page {
  border-left: 1px solid rgba(31, 41, 55, 0.9);
}

.book-spine-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0), rgba(0, 0, 0, 0.5), rgba(15, 23, 42, 0));
  pointer-events: none;
}

.book-emoji-main {
  font-size: 2.8rem;
  margin-bottom: 6px;
}

.book-text {
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.book-subtext {
  font-size: 0.8rem;
  color: #9ca3af;
}

.book-page-label {
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 6px;
}

.book-cast {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.book-cast-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

.book-cast-row {
  font-size: 1.6rem;
}

.book-cast-names {
  font-size: 0.7rem;
  color: #9ca3af;
}

/* stack pages on very small phones */
@media (max-width: 420px) {
  .book-layout {
    grid-template-columns: 1fr;
  }
  .book-page + .book-page {
    border-left: none;
    border-top: 1px solid rgba(31, 41, 55, 0.9);
  }
}

/* MILO GAME ---------------------------------------------------- */

.milo-game-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.milo-card {
  flex: 1;
  min-width: 70px;
  border-radius: 16px;
  padding: 14px 6px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.5);
  text-align: center;
  cursor: pointer;
}

.milo-card-emoji {
  font-size: 2rem;
  margin-bottom: 4px;
}

.milo-card-label {
  font-size: 0.75rem;
}

/* PARENT CONTROLS --------------------------------------------- */

.parent-section {
  margin-top: 24px;
  text-align: center;
}

.ghost-button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  color: #cbd5f5;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
}

.parent-panel {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: #020617;
  border: 1px dashed rgba(148, 163, 184, 0.5);
}

.parent-note {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: #9ca3af;
}

.parent-button {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  background: #1f2937;
  color: #e5e7eb;
}

.parent-button.danger {
  background: #7f1d1d;
}

/* FOOTER ------------------------------------------------------- */

.footer {
  margin-top: 20px;
  font-size: 0.75rem;
  text-align: center;
  color: #6b7280;
}

/* DESKTOP TWEAKS ---------------------------------------------- */

@media (min-width: 600px) {
  .app {
    padding-top: 24px;
  }
}
