@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Nunito:wght@500;700;800&display=swap');

:root {
  --bg-top: #1a1030;
  --bg-bottom: #2d1b4e;
  --purple: #7c3aed;
  --pink: #ec4899;
  --cyan: #22d3ee;
  --yellow: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --card-bg: rgba(255, 255, 255, 0.06);
  --ink: #fff;
  --ink-dim: rgba(255, 255, 255, 0.65);
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(124, 58, 237, 0.5), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(236, 72, 153, 0.35), transparent 40%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

h1, h2, h3, .display {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
  font-weight: 800;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.card {
  background: var(--card-bg);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* ---- Hero / profile header ---- */
.hero {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-avatar {
  font-size: 64px;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

.hero-name {
  font-size: 24px;
  margin: 6px 0 2px;
}

.level-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 0 16px rgba(236, 72, 153, 0.6);
}

.xp-bar-track {
  height: 16px;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
  border: 2px solid rgba(255,255,255,0.2);
  overflow: hidden;
  margin: 12px 0 4px;
}

.xp-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: 0 0 12px var(--cyan);
  transition: width 0.6s cubic-bezier(.3,1.5,.5,1);
}

.xp-label {
  font-size: 13px;
  color: var(--ink-dim);
  font-weight: 700;
}

.streak-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
  font-weight: 800;
}

.streak-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

/* ---- Section headings ---- */
.section-title {
  font-size: 18px;
  margin: 24px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Task cards ---- */
.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.12);
  transition: transform 0.15s ease;
}

.task.done {
  opacity: 0.55;
}

.task-icon {
  font-size: 30px;
  width: 42px;
  text-align: center;
}

.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 800; font-size: 15px; }
.task-points {
  display: inline-block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 800;
  color: var(--yellow);
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 10px 16px;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 4px 14px rgba(124,58,237,0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.94); }
.btn:disabled { opacity: 0.6; cursor: default; }

.btn.ghost {
  background: rgba(255,255,255,0.1);
  box-shadow: none;
  border: 2px solid rgba(255,255,255,0.25);
}

.btn.small { padding: 7px 12px; font-size: 12px; }

.status-pill {
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill.wait { background: rgba(251,191,36,0.2); color: var(--yellow); }
.status-pill.approved { background: rgba(52,211,153,0.2); color: var(--green); }
.status-pill.rejected { background: rgba(248,113,113,0.2); color: var(--red); }

/* ---- Rewards ---- */
.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.balance-value {
  font-size: 30px;
  font-family: 'Baloo 2', sans-serif;
  color: var(--yellow);
}

/* ---- Badges ---- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.badge {
  aspect-ratio: 1;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.14);
}
.badge.locked { opacity: 0.28; filter: grayscale(1); }
.badge-name { font-size: 9px; font-weight: 800; text-align: center; margin-top: 2px; padding: 0 2px; }

/* ---- Modal / celebration ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 20, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.overlay.hidden { display: none; }

.modal {
  background: linear-gradient(160deg, #2d1b4e, #1a1030);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 60px rgba(124,58,237,0.6);
}

.modal .big-emoji { font-size: 72px; margin-bottom: 8px; }
.modal h2 { margin: 0 0 8px; font-size: 26px; }
.modal p { color: var(--ink-dim); margin: 0 0 20px; }

input, select {
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: var(--ink);
  width: 100%;
}
input::placeholder { color: rgba(255,255,255,0.4); }

label { font-size: 13px; font-weight: 700; color: var(--ink-dim); display: block; margin: 12px 0 4px; }

.confetti-piece {
  position: fixed;
  top: -20px;
  z-index: 60;
  border-radius: 2px;
  pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(360deg); opacity: 0.8; }
}

/* ---- Nav / parent link ---- */
.top-link {
  text-align: right;
  margin-bottom: 4px;
}
.top-link a {
  color: var(--ink-dim);
  font-size: 12px;
  text-decoration: none;
}

/* ---- Parent panel ---- */
.tabs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding: 2px 2px 8px;
}
.tab-btn {
  flex: none;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 2px solid transparent;
  color: var(--ink-dim);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; row-gap: 10px; }
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.muted { color: var(--ink-dim); font-size: 12px; }
.empty-state { text-align: center; padding: 30px 10px; color: var(--ink-dim); }
.error-text { color: var(--red); font-size: 13px; margin-top: 6px; }

.card > .btn:last-child { margin-top: 20px; width: 100%; }
label { margin-top: 18px; }
label:first-child { margin-top: 0; }
