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

:root {
  --bg-1: #fff6e9;
  --bg-2: #e8f6ff;
  --pink: #ff6fa5;
  --purple: #9b5de5;
  --blue: #4d96ff;
  --green: #35c46b;
  --yellow: #ffc93d;
  --orange: #ff914d;
  --ink: #2f2a4a;
  --card: #ffffff;
  --card-shadow: 0 8px 0 rgba(47, 42, 74, 0.08), 0 12px 24px rgba(47, 42, 74, 0.08);
  --radius: 22px;
  font-size: 18px;
}

body[data-theme='pink'] {
  --bg-1: #fff0f7;
  --bg-2: #ffe3ef;
  --purple: #ff6fa5;
  --pink: #ff9ecf;
}

body[data-theme='ocean'] {
  --bg-1: #e6f7ff;
  --bg-2: #d2eeff;
  --purple: #2f8fd6;
  --pink: #4dd0e1;
}

body[data-theme='sunshine'] {
  --bg-1: #fffbe6;
  --bg-2: #fff2c2;
  --purple: #ffb703;
  --pink: #ff914d;
}

body[data-theme='rainbow'] {
  --bg-1: #fef6ff;
  --bg-2: #e9f9ff;
}

body[data-theme='rainbow'] .hero {
  background: linear-gradient(135deg, #ff6fa5, #ffc93d, #35c46b, #4d96ff);
}

body[data-theme='galaxy'] {
  --bg-1: #1b1035;
  --bg-2: #2a1a4a;
  --purple: #7b5cff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Baloo 2', 'Comic Sans MS', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2) 70%);
  background-attachment: fixed;
  padding-bottom: 60px;
}

a {
  color: inherit;
}

.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px 26px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border-radius: 0 0 32px 32px;
  box-shadow: 0 10px 24px rgba(155, 93, 229, 0.35);
  flex-wrap: wrap;
}

.hero-avatar {
  font-size: 3.2rem;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  overflow: hidden;
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.hero-info h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
}

.hero-stats {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.stat-chip {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 22px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1.3rem;
  font-weight: 800;
}

#message-banner {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: #fff;
  display: none;
}

#message-banner.show {
  display: block;
}

#message-banner p {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: #f6f4ff;
  margin-bottom: 10px;
  transition: transform 0.15s, background 0.2s;
}

.task-item.pending-approval {
  background: #fff6da;
}

.task-item.done {
  background: #e4faec;
}

.task-item .tick {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #d8d4f5;
  background: #fff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

.task-item.done .tick {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.task-item .emoji {
  font-size: 1.7rem;
}

.task-item .title {
  font-weight: 700;
  flex: 1;
}

.task-item .points {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--purple);
  white-space: nowrap;
}

.task-item .status-note {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #a9860c;
}

.task-item.done .status-note {
  color: var(--green);
}

.empty-note {
  text-align: center;
  color: #8b87a6;
  font-weight: 600;
  padding: 20px 0;
}

.quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.quick-option {
  background: #f0edff;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--purple);
}

.quick-option.selected {
  background: var(--purple);
  color: #fff;
}

textarea#reflection-text {
  width: 100%;
  border-radius: 14px;
  border: 2px solid #e6e2fb;
  padding: 12px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  min-height: 70px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--green), #21a05a);
  box-shadow: 0 6px 0 rgba(33, 160, 90, 0.35);
  margin-top: 10px;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(33, 160, 90, 0.35);
}

.btn.secondary {
  background: linear-gradient(135deg, var(--orange), #e0762f);
  box-shadow: 0 6px 0 rgba(224, 118, 47, 0.35);
}

.reflection-saved {
  font-weight: 700;
  color: var(--green);
  margin-top: 8px;
  display: none;
}

.reflection-saved.show {
  display: block;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.badge {
  background: #f6f4ff;
  border-radius: 16px;
  padding: 14px 6px;
  text-align: center;
  font-weight: 700;
  font-size: 0.78rem;
}

.badge .badge-emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 6px;
}

.badge.locked {
  opacity: 0.35;
  filter: grayscale(1);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.game-tile {
  display: block;
  text-decoration: none;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  border-radius: 18px;
  padding: 22px 10px;
  text-align: center;
  font-weight: 800;
  box-shadow: 0 6px 0 rgba(77, 150, 255, 0.3);
}

.game-tile .game-emoji {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 6px;
}

.badge-popup {
  position: fixed;
  inset: 0;
  background: rgba(47, 42, 74, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.badge-popup.show {
  display: flex;
}

.badge-popup-card {
  background: #fff;
  border-radius: 26px;
  padding: 30px 24px;
  text-align: center;
  max-width: 320px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.badge-popup-card .big-emoji {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 10px;
}

.badge-popup-card h3 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.badge-popup-card p {
  margin: 0 0 18px;
  color: #6a6484;
}

.profile-card {
  max-width: 360px;
  text-align: left;
  width: 100%;
}

.profile-card h3 {
  text-align: center;
  margin: 0 0 16px;
}

.field-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: #8b87a6;
  margin: 14px 0 6px;
}

#profile-name-input {
  width: 100%;
  border-radius: 12px;
  border: 2px solid #e6e2fb;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 1rem;
}

.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f6f4ff;
  font-size: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 0 auto 10px;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.emoji-swatches,
.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emoji-swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #e6e2fb;
  background: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-swatch.selected {
  border-color: var(--purple);
  background: #f6f4ff;
}

.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
}

.theme-swatch.selected {
  border-color: var(--ink);
}

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.small-file-btn {
  font-size: 0.85rem;
  padding: 9px 16px;
}

.profile-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn.ghost {
  background: #f0edff;
  color: var(--purple);
  box-shadow: none;
}

.btn.ghost-link {
  background: #f0edff;
  color: var(--purple);
  box-shadow: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.scrapbook-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.carousel {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #f6f4ff;
  aspect-ratio: 4 / 3;
}

.carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.carousel-slide.active {
  opacity: 1;
}

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
}

.carousel-dot.active {
  background: #fff;
}

.carousel-empty {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: #8b87a6;
  font-weight: 600;
}

.carousel-empty.show {
  display: flex;
}

.scrapbook-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.scrapbook-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #f6f4ff;
}

.scrapbook-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scrapbook-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(47, 42, 74, 0.65);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-note.hide {
  display: none;
}
