:root {
  --bg-sky: linear-gradient(180deg, #e0f2fe 0%, #fef9c3 100%);
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --purple: #7c3aed;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --radius: 22px;
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-main);
  background: var(--bg-sky);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, .hud-name, .btn-primary, .btn-pill, .subject-tag {
  font-family: 'Fredoka', 'Nunito', sans-serif;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2000;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* ==================== PROFILE PICKER ==================== */
#screen-profiles {
  position: relative;
  justify-content: center;
  align-items: center;
  padding: 28px 18px;
  background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 55%, #fef3c7 100%);
}

.sky-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.cloud {
  position: absolute;
  font-size: 3.5rem;
  opacity: 0.7;
  animation: floatSlow 9s ease-in-out infinite;
}

.c1 { top: 6%; left: 8%; animation-delay: 0s; }
.c2 { top: 12%; right: 10%; animation-delay: 3s; font-size: 4.2rem; }
.c3 { bottom: 12%; right: 8%; animation-delay: 1.5s; font-size: 3rem; }

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-14px); }
}

.profiles-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 960px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 4px 0 #b45309;
  margin-bottom: 12px;
}

.hero-header h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #0f172a;
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 1.1rem;
  color: #334155;
  margin-bottom: 28px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.profile-card {
  background: #fff;
  border-radius: 26px;
  padding: 24px 18px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1), 0 6px 0 #cbd5e1;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 3px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.profile-card:hover {
  transform: translateY(-6px);
  border-color: #38bdf8;
  box-shadow: 0 16px 30px rgba(2, 132, 199, 0.18), 0 8px 0 #0284c7;
}

.profile-card:active {
  transform: translateY(-2px);
}

.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: #fef3c7;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08);
}

.profile-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.45rem;
  color: #0f172a;
}

.profile-tier {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
}

.profile-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #475569;
}

.team-banner {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  border-radius: 24px;
  padding: 20px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 0 #3730a3, 0 14px 25px rgba(79, 70, 229, 0.25);
  transition: transform 0.18s ease;
  margin-bottom: 22px;
}

.team-banner:hover {
  transform: translateY(-4px);
}

.team-icon {
  font-size: 2.6rem;
  flex-shrink: 0;
}

.team-text h2 {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.team-text p {
  font-size: 0.95rem;
  opacity: 0.92;
}

.team-cta {
  background: #fde047;
  color: #1e1b4b;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 16px;
  white-space: nowrap;
  box-shadow: 0 4px 0 #ca8a04;
}

.start-footer {
  margin-top: 8px;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid #cbd5e1;
  padding: 10px 18px;
  border-radius: 14px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-ghost:hover {
  background: #fff;
}

/* ==================== TOP BAR (MAP) ==================== */
.top-bar {
  background: #ffffff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-left, .top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.active-explorer-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f1f5f9;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
}

.hud-avatar {
  font-size: 1.8rem;
  background: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.hud-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
}

.hud-level {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
}

.points-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
  border: 2px solid #eab308;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #713f12;
  cursor: pointer;
  box-shadow: 0 3px 0 #ca8a04;
}

.dollars-badge {
  background: #16a34a;
  color: #fff;
  font-size: 0.85rem;
  padding: 2px 9px;
  border-radius: 999px;
}

.btn-pill {
  border: none;
  padding: 9px 15px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s;
}

.btn-pill:active { transform: translateY(2px); }

.btn-passport {
  background: #2563eb;
  box-shadow: 0 4px 0 #1d4ed8;
}

.btn-shop {
  background: #ec4899;
  box-shadow: 0 4px 0 #be185d;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { background: #e2e8f0; }

/* ==================== MAP STAGE ==================== */
.map-stage {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.map-banner {
  background: #fff;
  border-radius: 18px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  border-left: 6px solid #f59e0b;
}

#map-guide-avatar { font-size: 1.8rem; }

.map-container {
  position: relative;
  width: 100%;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #0284c7;
}

#world-svg {
  display: block;
  width: 100%;
  height: auto;
}

.map-pins-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.18s ease;
  z-index: 5;
}

.map-pin:hover {
  transform: translate(-50%, -58%) scale(1.08);
  z-index: 10;
}

.pin-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.3);
  position: relative;
  animation: pulsePin 2.4s infinite;
}

.map-pin.completed .pin-bubble {
  border-color: #16a34a;
  background: #dcfce7;
  animation: none;
}

.pin-check {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #16a34a;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

@keyframes pulsePin {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7), 0 6px 14px rgba(15, 23, 42, 0.3); }
  50% { box-shadow: 0 0 0 12px rgba(251, 191, 36, 0), 0 6px 14px rgba(15, 23, 42, 0.3); }
}

.pin-label {
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.destination-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
}

.dest-mini-card {
  background: #fff;
  border-radius: 18px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s, border-color 0.15s;
}

.dest-mini-card:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
}

.dest-mini-card.completed {
  background: #f0fdf4;
  border-color: #86efac;
}

.dest-mini-emoji { font-size: 1.8rem; }
.dest-mini-title { font-family: 'Fredoka', sans-serif; font-size: 0.95rem; }
.dest-mini-status { font-size: 0.78rem; color: var(--text-muted); font-weight: 700; }

/* ==================== MODALS ==================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  background: #fff;
  border-radius: 28px;
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.35);
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-sub {
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 2px;
}

.btn-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  color: #475569;
}

.btn-close:hover { background: #e2e8f0; }

/* ==================== CHALLENGE MODAL ==================== */
.challenge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 2px solid #f1f5f9;
  margin-bottom: 18px;
}

.dest-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef3c7;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: #92400e;
}

.turn-badge {
  background: #ede9fe;
  color: #5b21b6;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
}

.challenge-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.9rem;
  color: #475569;
}

.step-dots {
  display: flex;
  gap: 6px;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e2e8f0;
}

.step-dot.done { background: #16a34a; }
.step-dot.current { background: #f59e0b; transform: scale(1.2); }

.subject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.subject-tag {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
}

.subject-tag.math { background: #dbeafe; color: #1d4ed8; }
.subject-tag.science { background: #dcfce7; color: #15803d; }
.subject-tag.geography { background: #fce7f3; color: #be185d; }

.btn-speak {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  color: #92400e;
  padding: 7px 14px;
  border-radius: 999px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.92rem;
  cursor: pointer;
}

.btn-speak:hover { background: #fde68a; }

.challenge-visual {
  text-align: center;
  font-size: 3.4rem;
  background: #f8fafc;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  letter-spacing: 6px;
}

.challenge-question {
  font-size: clamp(1.25rem, 2.8vw, 1.55rem);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.35;
}

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

.option-btn {
  background: #f8fafc;
  border: 3px solid #cbd5e1;
  border-radius: 20px;
  padding: 18px 14px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 5px 0 #cbd5e1;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.option-btn:hover:not(:disabled) {
  border-color: #38bdf8;
  background: #f0f9ff;
  transform: translateY(-2px);
}

.option-btn:active:not(:disabled) {
  transform: translateY(2px);
}

.option-btn .opt-emoji {
  font-size: 2.2rem;
}

.option-btn.correct {
  background: var(--green-light);
  border-color: var(--green);
  box-shadow: 0 5px 0 var(--green);
  color: #14532d;
}

.option-btn.wrong {
  background: var(--red-light);
  border-color: var(--red);
  box-shadow: 0 5px 0 var(--red);
  opacity: 0.72;
}

.feedback-box {
  background: #fef9c3;
  border: 2px solid #eab308;
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.feedback-box.success {
  background: #dcfce7;
  border-color: #16a34a;
}

.feedback-icon { font-size: 2.3rem; flex-shrink: 0; }
.feedback-content { flex: 1; }
.feedback-title { font-family: 'Fredoka', sans-serif; font-size: 1.15rem; margin-bottom: 2px; }
.feedback-text { font-size: 0.96rem; font-weight: 700; color: #334155; }

.complete-screen {
  text-align: center;
  padding: 14px 6px;
}

.stamp-celebration {
  font-size: 5rem;
  margin-bottom: 10px;
  animation: popIn 0.35s ease;
}

.earned-summary {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 22px 0;
  flex-wrap: wrap;
}

.earned-box {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px 22px;
  min-width: 170px;
}

.earned-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
}

.earned-val {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  color: #0f172a;
}

/* ==================== BUTTONS ==================== */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 16px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform 0.12s;
}

.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(2px); }
.btn-lg { padding: 14px 28px; font-size: 1.15rem; }

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 14px;
  font-family: 'Fredoka', sans-serif;
  cursor: pointer;
}

/* ==================== PASSPORT ==================== */
.passport-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: #f8fafc;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  border: 2px solid #e2e8f0;
}

.stat-card strong {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.35rem;
  margin-top: 2px;
}

.passport-stamps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.stamp-card {
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  border: 3px dashed #cbd5e1;
  background: #f8fafc;
  opacity: 0.6;
}

.stamp-card.earned {
  opacity: 1;
  border-style: solid;
  border-color: #16a34a;
  background: #f0fdf4;
}

.stamp-card .stamp-emoji { font-size: 2.6rem; margin-bottom: 6px; }
.stamp-card .stamp-title { font-family: 'Fredoka', sans-serif; font-size: 1rem; }
.stamp-card .stamp-sub { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; }

/* ==================== REWARD SHOP ==================== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.reward-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reward-emoji { font-size: 2.5rem; }
.reward-title { font-family: 'Fredoka', sans-serif; font-size: 1.05rem; }
.reward-cost { font-weight: 800; color: #b45309; font-size: 0.95rem; }

.reward-btn {
  margin-top: auto;
  border: none;
  border-radius: 12px;
  padding: 9px 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
  background: #16a34a;
  color: #fff;
  box-shadow: 0 3px 0 #15803d;
}

.reward-btn:disabled {
  background: #cbd5e1;
  color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
}

.tickets-section h3 { margin-bottom: 10px; }

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

.ticket-row {
  background: #fef9c3;
  border: 2px dashed #eab308;
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
}

.ticket-row.fulfilled {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

/* ==================== PIN & PARENT DASHBOARD ==================== */
.pin-card {
  max-width: 380px;
  text-align: center;
}

.pin-hint { color: var(--text-muted); margin-bottom: 14px; font-weight: 700; }

.pin-input {
  width: 180px;
  font-size: 2rem;
  text-align: center;
  letter-spacing: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 3px solid #cbd5e1;
  margin-bottom: 14px;
  display: block;
  margin-inline: auto;
}

.pin-error {
  color: var(--red);
  font-weight: 800;
  margin-bottom: 12px;
}

.parent-card { max-width: 780px; }

.parent-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 12px;
}

.tab-btn {
  border: none;
  background: #f1f5f9;
  padding: 9px 14px;
  border-radius: 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
  color: #475569;
}

.tab-btn.active {
  background: #2563eb;
  color: #fff;
}

.badge-count {
  background: #ef4444;
  color: #fff;
  font-size: 0.78rem;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 4px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

.parent-row {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.parent-kid-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.parent-kid-edit input, .add-reward-form input, .setting-row input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid #cbd5e1;
  font-family: inherit;
  font-weight: 700;
}

.input-sm { width: 58px; text-align: center; }
.input-md { width: 110px; }

.add-reward-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.add-reward-form input[type="text"]:not(.input-sm) {
  flex: 1;
  min-width: 180px;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 800;
}

.setting-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 680px) {
  .team-banner { flex-direction: column; text-align: center; }
  .options-grid { grid-template-columns: 1fr; }
  .pin-bubble { width: 44px; height: 44px; font-size: 1.45rem; }
  .pin-label { font-size: 0.72rem; }
}

/* ==================== OPEN-WORLD COUNTRY SCENE ==================== */
.btn-back-map {
  background: #0284c7;
  box-shadow: 0 4px 0 #0369a1;
}

.btn-radar {
  background: #f59e0b;
  box-shadow: 0 4px 0 #b45309;
}

.country-title-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f1f5f9;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
}

.cty-flag { font-size: 1.7rem; }

.country-stage {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.country-scene {
  position: relative;
  width: 100%;
  height: clamp(320px, 48vh, 450px);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 4px solid #ffffff;
  user-select: none;
}

.scene-sky-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 2.6rem;
}

.sky-item {
  position: absolute;
  opacity: 0.9;
  animation: floatSlow 8s ease-in-out infinite;
}

.scene-horizon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 42%;
  height: 110px;
  pointer-events: none;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  font-size: 4rem;
  opacity: 0.85;
}

.scene-ground {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: -10%;
  height: 58%;
  border-radius: 50% 50% 0 0 / 22% 22% 0 0;
  pointer-events: none;
}

.scene-spots-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.explore-spot {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 6px;
  transition: transform 0.16s ease;
}

.explore-spot:hover {
  transform: translate(-50%, -56%) scale(1.12);
}

.spot-emoji {
  font-size: clamp(2.5rem, 5vw, 3.6rem);
  filter: drop-shadow(0 6px 8px rgba(15, 23, 42, 0.28));
  transition: transform 0.15s;
}

.spot-tag {
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.76rem;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.explore-spot.hint-wiggle .spot-emoji {
  animation: wiggleSpot 0.55s ease-in-out infinite;
  filter: drop-shadow(0 0 14px #fde047);
}

.explore-spot.shaking .spot-emoji {
  animation: shakeSpot 0.35s ease;
}

.explore-spot.found .spot-tag {
  background: #16a34a;
}

.explore-spot.decoy-checked .spot-tag {
  background: #64748b;
}

@keyframes wiggleSpot {
  0%, 100% { transform: rotate(0deg) scale(1.08); }
  25% { transform: rotate(-10deg) scale(1.16); }
  75% { transform: rotate(10deg) scale(1.16); }
}

@keyframes shakeSpot {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px) rotate(-6deg); }
  75% { transform: translateX(8px) rotate(6deg); }
}

.scene-popup {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 12;
  background: #ffffff;
  border: 3px solid #f59e0b;
  border-radius: 20px;
  padding: 12px 20px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: popIn 0.2s ease;
  max-width: 92%;
}

.scene-popup.treasure {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #14532d;
}

.scene-popup.trick {
  border-color: #a855f7;
  background: #faf5ff;
  color: #581c87;
}

/* ==================== ACTIVITIES DOCK ==================== */
.activities-dock {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.activity-card {
  background: #ffffff;
  border: 3px solid #e2e8f0;
  border-radius: 22px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 0 #cbd5e1;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.activity-card:hover {
  transform: translateY(-4px);
}

.activity-card:active {
  transform: translateY(1px);
}

.act-quiz { border-color: #60a5fa; box-shadow: 0 6px 0 #2563eb; }
.act-memory { border-color: #c084fc; box-shadow: 0 6px 0 #7c3aed; }
.act-catch { border-color: #fbbf24; box-shadow: 0 6px 0 #d97706; }

.act-icon {
  font-size: 2.3rem;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.act-info { flex: 1; }
.act-title { font-family: 'Fredoka', sans-serif; font-size: 1.15rem; color: #0f172a; }
.act-sub { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); margin-top: 2px; }

.act-go {
  font-family: 'Fredoka', sans-serif;
  background: #0f172a;
  color: #fff;
  padding: 7px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  white-space: nowrap;
}

/* ==================== MINI-GAMES ==================== */
.minigame-card { max-width: 620px; }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 12px 0 16px;
}

.memory-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.mem-card {
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  border: 3px solid #cbd5e1;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #fff;
  font-size: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 0 #4338ca;
  transition: transform 0.15s, background 0.15s;
}

.mem-card.flipped, .mem-card.matched {
  background: #ffffff;
  border-color: #f59e0b;
  box-shadow: 0 5px 0 #d97706;
  color: #0f172a;
}

.mem-card.matched {
  background: #dcfce7;
  border-color: #16a34a;
  box-shadow: 0 5px 0 #15803d;
}

.catch-hud {
  display: flex;
  justify-content: space-between;
  background: #f1f5f9;
  padding: 10px 18px;
  border-radius: 14px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.catch-arena {
  position: relative;
  height: 320px;
  border-radius: 22px;
  background: linear-gradient(180deg, #e0f2fe 0%, #fef9c3 100%);
  border: 3px solid #bae6fd;
  overflow: hidden;
  user-select: none;
}

.falling-item {
  position: absolute;
  font-size: 2.6rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px;
  transform: translate(-50%, -50%);
  transition: transform 0.1s;
}

.falling-item:active {
  transform: translate(-50%, -50%) scale(1.3);
}

.minigame-win {
  text-align: center;
  padding: 14px;
  background: #f0fdf4;
  border: 2px solid #16a34a;
  border-radius: 18px;
  margin-top: 10px;
}

