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

/* ============================================================
   Stegjakt – Main Stylesheet
   Mobile-first, friendly, playful outdoor theme
   ============================================================ */

/* ── Custom properties ─────────────────────────────────────── */
:root {
  --clr-bg: #f5f0e8;
  --clr-bg-alt: #fffdf7;
  --clr-primary: #f4a035;
  --clr-primary-dk: #d4861a;
  --clr-secondary: #5cb85c;
  --clr-secondary-dk: #4a9e4a;
  --clr-accent: #e25c5c;
  --clr-text: #2c2c2c;
  --clr-text-muted: #888;
  --clr-white: #ffffff;
  --clr-border: #e8e0d0;
  --clr-shadow: rgba(0, 0, 0, 0.1);
  --clr-coin: #f4c430;
  --clr-coin-border: #d4a017;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px var(--clr-shadow);
  --shadow-md: 0 4px 16px var(--clr-shadow);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.14);

  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --transition: 0.18s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100vh;
  line-height: 1.55;
}
a {
  color: var(--clr-primary-dk);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
img,
svg {
  display: block;
  max-width: 100%;
}

/* ── Layout helpers ─────────────────────────────────────────── */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: linear-gradient(160deg, #fdf6e3 0%, #f0e6cc 100%);
}

.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.two-col {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.form-col {
  flex: 0 0 340px;
}
.map-col {
  flex: 1 1 auto;
  position: sticky;
  top: 80px;
}

@media (max-width: 700px) {
  .two-col {
    flex-direction: column;
  }
  .form-col {
    flex: none;
    width: 100%;
  }
  .map-col {
    position: static;
    width: 100%;
  }
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--clr-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
  position: relative;
}

.hero-card {
  background: var(--clr-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.item-card {
  background: var(--clr-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
}
.item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--clr-primary);
}

.item-card .item-emoji {
  font-size: 2rem;
}
.item-card .item-title {
  font-weight: 700;
  font-size: 1rem;
}
.item-card .item-meta {
  font-size: 0.82rem;
  color: var(--clr-text-muted);
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero-emoji {
  font-size: 4rem;
  margin-bottom: 8px;
}
.hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--clr-primary-dk);
}
.hero-subtitle {
  color: var(--clr-text-muted);
  margin-bottom: 32px;
  font-size: 1.1rem;
}
.card-emoji {
  font-size: 2.5rem;
  margin-bottom: 8px;
  text-align: center;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  background: var(--clr-white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header--game {
  background: #fdf5e4;
  box-shadow: 0 1px 0 rgba(169, 122, 76, 0.18);
}

/* ── Game HUD (play-route) ───────────────────────────────────── */
.game-hud {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fef6df;
  padding: 10px 16px 14px;
  box-shadow: 0 3px 0 rgba(200, 148, 30, 0.4), 0 6px 20px rgba(100, 60, 10, 0.14);
}
.game-hud-nav {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.hud-back {
  font-size: 0.88rem;
  font-weight: 600;
  color: #7a5230;
  text-decoration: none;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.game-hud-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Nunito", sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: #6b3e10;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}
.hud-test-btn {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(244, 160, 53, 0.18);
  border: 1px solid rgba(244, 160, 53, 0.4);
  color: #8a6228;
  border-radius: 20px;
  padding: 4px 10px;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.game-hud-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hud-chest-img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}
.hud-amount {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-text {
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  font-size: 1.18rem;
  color: #7a5230;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-paw {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.welcome-name {
  font-size: 0.9rem;
  color: var(--clr-text-muted);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
  transition:
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
  padding: 10px 22px;
  font-size: 0.95rem;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--clr-primary);
  color: var(--clr-white);
  box-shadow: 0 3px 10px rgba(244, 160, 53, 0.35);
}
.btn-primary:hover {
  background: var(--clr-primary-dk);
  text-decoration: none;
}

.btn-secondary {
  background: var(--clr-secondary);
  color: var(--clr-white);
  box-shadow: 0 3px 10px rgba(92, 184, 92, 0.3);
}
.btn-secondary:hover {
  background: var(--clr-secondary-dk);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-muted);
  border: 2px solid var(--clr-border);
}
.btn-ghost:hover {
  background: var(--clr-bg);
  color: var(--clr-text);
  text-decoration: none;
}

.btn-danger {
  background: var(--clr-accent);
  color: var(--clr-white);
}

.btn-xl {
  padding: 15px 32px;
  font-size: 1.1rem;
}
.btn-sm {
  padding: 7px 16px;
  font-size: 0.85rem;
}
.btn-full {
  width: 100%;
}

.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

/* ── Forms ──────────────────────────────────────────────────── */
.field {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-weight: 600;
  font-size: 0.9rem;
}
.field-hint {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 1rem;
  background: var(--clr-bg-alt);
  color: var(--clr-text);
  transition: border-color var(--transition);
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--clr-primary);
  background: var(--clr-white);
}

.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  background: var(--clr-bg);
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  transition:
    border-color var(--transition),
    background var(--transition);
}
.radio-label:has(input:checked) {
  border-color: var(--clr-primary);
  background: #fff8ee;
}
.radio-label input[type="radio"] {
  accent-color: var(--clr-primary);
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--clr-bg);
  border-radius: var(--radius-md);
  padding: 4px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--clr-text-muted);
  transition:
    background var(--transition),
    color var(--transition);
}
.tab-btn.active {
  background: var(--clr-white);
  color: var(--clr-primary-dk);
  box-shadow: var(--shadow-sm);
}

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

/* ── Messages ───────────────────────────────────────────────── */
.error-msg {
  background: #fef2f2;
  color: #c0392b;
  border: 1.5px solid #f5c6cb;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 12px;
}
.success-msg {
  background: #f0fdf4;
  color: #1a7a3a;
  border: 1.5px solid #b7f0c8;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 12px;
}
.hidden {
  display: none !important;
}

/* ── Dashboard sections ─────────────────────────────────────── */
.dashboard-section {
  margin-bottom: 36px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.back-link {
  font-size: 0.9rem;
  color: var(--clr-primary-dk);
  font-weight: 600;
}
.back-link:hover {
  text-decoration: underline;
}

.hint-text {
  text-align: center;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--clr-text-muted);
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal-box {
  background: var(--clr-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  max-width: 400px;
  width: 100%;
  position: relative;
  text-align: center;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--clr-text-muted);
}
.modal-box h2 {
  margin-bottom: 20px;
}

/* ── Map ────────────────────────────────────────────────────── */
.map-container {
  width: 100%;
  height: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  z-index: 1;
}
.map-fullish {
  height: calc(100vh - 155px);
  border-radius: 0;
  box-shadow: none;
}
.leaflet-control-attribution {
  background: rgba(255, 248, 230, 0.72) !important;
  backdrop-filter: blur(4px);
  color: #8a6a3a !important;
  font-size: 0.62rem !important;
  padding: 2px 6px !important;
  border-radius: 6px 0 0 0 !important;
  box-shadow: none !important;
  opacity: 0.85;
}
.leaflet-control-attribution a {
  color: #7a5a2a !important;
}
.map-hint {
  font-size: 0.78rem;
  color: var(--clr-text-muted);
  text-align: center;
  margin-top: 6px;
}

/* ── Coin markers (Leaflet divIcon) ─────────────────────────── */
.coin-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: all;
}
.coin-img {
  width: 46px;
  height: 46px;
  display: block;
  pointer-events: none;
  user-select: none;
  animation: coin-glint 5s ease-in-out infinite;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.22));
}
.coin-img:hover {
  transform: scale(1.12);
}
.coin-value {
  background: var(--clr-white);
  border: 2px solid var(--clr-coin-border);
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 1px 7px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.coin-marker.collected .coin-img {
  opacity: 0.3;
  filter: grayscale(1);
  animation: none;
}

/* ── Coin particles ─────────────────────────────────────── */
.coin-particle {
  position: fixed;
  width: 46px;
  height: 46px;
  pointer-events: none;
  z-index: 9999;
  opacity: 1;
}
.coin-splash {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  opacity: 1;
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes coin-glint {
  0%,
  85% {
    transform: rotate(0deg);
  }
  90% {
    transform: rotate(-8deg);
  }
  95% {
    transform: rotate(7deg);
  }
  100% {
    transform: rotate(0deg);
  }
}
@keyframes pouch-bounce {
  0%,
  100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.4);
  }
  60% {
    transform: scale(0.88);
  }
  80% {
    transform: scale(1.12);
  }
}
.pouch-bounce {
  display: inline-block;
  animation: pouch-bounce 0.5s ease-out;
}

/* ── Pouch bar ──────────────────────────────────────────────── */
.pouch-bar {
  position: sticky;
  top: 56px;
  z-index: 90;
  background: linear-gradient(160deg, #fff8e7 0%, #fdf3d8 100%);
  border-bottom: 2px solid rgba(244, 160, 53, 0.22);
  border-radius: 0 0 22px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 16px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(169, 122, 76, 0.16);
}
.pouch-chest-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.18));
}
.pouch-amount-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.pouch-total {
  font-family: "Nunito", sans-serif;
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--clr-primary-dk);
  line-height: 1;
}
.pouch-unit {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--clr-primary-dk);
}
.rewards-remaining {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7a5230;
  margin-left: auto;
  background: rgba(244, 160, 53, 0.15);
  border: 1.5px solid rgba(244, 160, 53, 0.3);
  border-radius: 20px;
  padding: 5px 14px;
}

/* ── Collect panel ──────────────────────────────────────────── */
.collect-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--clr-white);
  border-top: 3px solid var(--clr-coin-border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px 20px 28px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  z-index: 200;
  text-align: center;
}
.collect-coin-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.coin-big {
  font-size: 2.5rem;
}
.collect-value-text {
  font-size: 3rem;
  font-weight: 800;
  color: var(--clr-primary-dk);
  line-height: 1;
}
.collect-unit-text {
  font-size: 1.3rem;
  color: var(--clr-primary-dk);
  font-weight: 600;
}
.collect-btn {
  font-size: 1.3rem !important;
  padding: 18px !important;
}

/* ── Dev test panel ─────────────────────────────────────────── */
.dev-panel {
  position: fixed;
  top: 118px;
  right: 12px;
  background: #fffbe6;
  border: 2px dashed #f4c430;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.8rem;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.dev-label {
  font-weight: 700;
  color: #a07000;
}

/* ── Completion overlay ─────────────────────────────────────── */
.completion-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #fff8ee 0%, #f0e6cc 100%);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.completion-card {
  background: var(--clr-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.completion-emoji {
  font-size: 5rem;
  margin-bottom: 12px;
}
.completion-card h1 {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--clr-primary-dk);
}
.completion-card p {
  color: var(--clr-text-muted);
  margin-bottom: 16px;
}
.completion-total {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--clr-primary-dk);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
}

/* ── Hero greeting ──────────────────────────────────────────── */
.hero-greeting {
  text-align: center;
  padding: 24px 0 16px;
}
.big-avatar {
  font-size: 4rem;
  display: block;
  margin-bottom: 8px;
}
.hero-greeting h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.hero-greeting p {
  color: var(--clr-text-muted);
}

/* ── Reward preview ─────────────────────────────────────────── */
.reward-preview-box {
  background: #fff8ee;
  border: 2px solid var(--clr-coin-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}
.reward-preview-box h4 {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--clr-primary-dk);
}
.reward-coins-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.preview-coin {
  background: var(--clr-coin);
  border: 2px solid var(--clr-coin-border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-weight: 800;
  font-size: 0.85rem;
}

/* ── Status badges ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-active {
  background: #d4edda;
  color: #155724;
}
.badge-draft {
  background: #fff3cd;
  color: #856404;
}
.badge-completed {
  background: #cce5ff;
  color: #004085;
}
.badge-archived {
  background: #e2e3e5;
  color: #383d41;
}
.badge-info {
  background: var(--clr-bg);
  color: var(--clr-text-muted);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.82rem;
  display: inline-block;
}

/* ── Loading ────────────────────────────────────────────────── */
.loading-dots {
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  padding: 20px 0;
}

/* ── Route status indicator ─────────────────────────────────── */
.route-type-icon {
  font-size: 0.9rem;
}

/* ── Misc ───────────────────────────────────────────────────── */
h1 {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 6px;
}
h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

/* ── Child login – QR / token flow ─────────────────────────── */
.child-login-intro {
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
  text-align: center;
}
.divider-text {
  text-align: center;
  color: var(--clr-text-muted);
  font-size: 0.82rem;
  margin: 14px 0;
  position: relative;
}
.divider-text::before,
.divider-text::after {
  content: "";
  display: inline-block;
  width: 36%;
  height: 1px;
  background: var(--clr-border);
  vertical-align: middle;
  margin: 0 8px;
}
/* ── Child login page ────────────────────────────────────────── */
.child-login-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 20px;
}
.child-main.child-login-main {
  padding-bottom: 40px;
}
.child-login-form-card {
  background: var(--clr-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px 20px;
}
.child-login-pin-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  margin-bottom: 10px;
}

/* ── Link panel (parent dashboard) ─────────────────────────── */
.link-panel-name {
  color: var(--clr-text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
  text-align: center;
}
.link-qr-box {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.link-qr-box > div {
  display: flex;
  justify-content: center;
}
.link-qr-box img,
.link-qr-box canvas {
  border-radius: var(--radius-md);
  border: 3px solid var(--clr-border);
  display: block;
}
.link-instruction {
  font-size: 0.88rem;
  color: var(--clr-text-muted);
  text-align: center;
  margin-bottom: 14px;
}
.link-code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--clr-bg);
  border: 2px dashed var(--clr-primary);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}
.link-code-big {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--clr-primary-dk);
  font-family: "Courier New", monospace;
}

/* ── Child dashboard ─────────────────────────────────────────────── */
.child-db-page {
  position: relative;
  min-height: 100vh;
}

/* Fixed background layer — works on mobile Safari where background-attachment:fixed breaks */
.child-db-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("../images/background.png") top center / cover no-repeat;
  z-index: -1;
  pointer-events: none;
}

.child-hero {
  position: sticky;
  top: 0;
  z-index: 10;
  height: clamp(340px, 50vh, 460px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: url("../images/background.png") top center / cover no-repeat;
}

.child-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  flex-shrink: 0;
}

.child-logout-btn {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
}

.child-hero-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  padding: 0 20px 28px;
}

.avatar-shadow {
  position: absolute;
  left: 50%;
  top: 282px;
  transform: translateX(-50%);
  width: 135px;
  height: 30px;
  background: rgba(55, 38, 22, 0.28);
  border-radius: 50%;
  filter: blur(10px);
  z-index: 0;
  pointer-events: none;
}

.child-avatar-img {
  position: absolute;
  left: 50%;
  top: 124px;
  transform: translateX(-50%);
  z-index: 1;
  width: 190px;
  height: 190px;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.16));
}

.child-hero-name {
  font-family: "Nunito", sans-serif;
  font-size: 1.9rem;
  font-weight: 900;
  color: #3a2710;
  text-shadow:
    0 1px 6px rgba(255, 255, 255, 0.8),
    0 0 20px rgba(255, 255, 255, 0.5);
  margin-bottom: 2px;
}

.child-hero-sub {
  font-family: "Nunito", sans-serif;
  font-size: 0.95rem;
  color: #5a3e18;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.7);
}

.child-main {
  background: transparent;
  padding: 24px 16px 180px;
  min-height: 50vh;
}

.child-bottom-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  max-width: none;
  height: 150px;
  background: url("../images/background-bottom-overlay.png") no-repeat center
    bottom;
  background-size: 100% auto;
  z-index: 999;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 28%,
    black 100%
  );
  mask-image: linear-gradient(to bottom, transparent 0%, black 28%, black 100%);
}

.child-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.child-section-icon {
  font-size: 1.4rem;
}
.child-section-header h2 {
  font-family: "Nunito", sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
}

/* ── Child route cards ───────────────────────────────────────────── */
.child-routes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.child-route-card {
  background: #fffdf7;
  border-radius: 22px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
  border: 1.5px solid rgba(244, 160, 53, 0.12);
}

.child-route-card:hover,
.child-route-card:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border-color: rgba(244, 160, 53, 0.45);
}

.crc-icon {
  flex-shrink: 0;
  line-height: 1;
}

.route-icon {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.route-icon img {
  width: 100%;
  height: auto;
}

.crc-body {
  flex: 1;
  min-width: 0;
}

.crc-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.crc-title {
  font-family: "Nunito", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--clr-text);
}

.crc-meta {
  font-family: "Nunito", sans-serif;
  font-size: 0.83rem;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.crc-coin-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

.show-more-btn {
  margin-top: 4px;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
}

.route-date {
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  font-weight: 500;
  margin-left: auto;
}

.progress-current {
  font-weight: 700;
  color: var(--clr-text);
}

.progress-total {
  opacity: 0.6;
}

/* ── Child wallet (treasure chest) ──────────────────────────────── */
.child-wallet {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 1200;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.child-wallet:active {
  transform: scale(0.93);
}

.child-wallet-img {
  width: 154px;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.22));
}

/* ── Chest modal ─────────────────────────────────────────────────── */
.chest-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chest-modal.hidden {
  display: none;
}

.chest-modal-card {
  background: #fffdf7;
  border-radius: 28px 28px 0 0;
  padding: 28px 24px 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chest-modal-title {
  font-family: "Nunito", sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: #3a2710;
  margin: 0;
}

.chest-modal-avail-label {
  font-family: "Nunito", sans-serif;
  font-size: 1rem;
  color: #5a3e18;
  margin: 0;
}

.chest-modal-stats {
  display: flex;
  gap: 12px;
}

.chest-stat {
  flex: 1;
  background: #f5edd8;
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chest-stat-label {
  font-family: "Nunito", sans-serif;
  font-size: 0.72rem;
  color: #8a6030;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chest-stat-value {
  font-family: "Nunito", sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  color: #3a2710;
}

.chest-stat-green {
  color: #2d7a2d;
}

.chest-slider-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chest-slider-label {
  font-family: "Nunito", sans-serif;
  font-size: 0.95rem;
  color: #5a3e18;
}

.chest-slider {
  width: 100%;
  accent-color: #f4a035;
  height: 6px;
  cursor: pointer;
}

.chest-modal-success {
  font-family: "Nunito", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #2d7a2d;
  text-align: center;
  padding: 6px 0;
}

.chest-modal-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crc-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e8f5e8;
  color: #2d7a2d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 900;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Parent dashboard ────────────────────────────────────────────── */
.pd-page {
    background: linear-gradient(160deg, #fdf6e3 0%, #f0e6cc 100%);
    min-height: 100vh;
}

.pd-hero {
    background: #fffdf7;
    border-radius: 0 0 24px 24px;
    padding: 24px 20px 20px;
    margin: -20px -16px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

.pd-welcome {
    font-family: 'Nunito', sans-serif;
    font-size: 1.45rem;
    font-weight: 900;
    color: #3a2710;
    margin-bottom: 2px;
}

.pd-welcome-sub {
    font-size: 0.88rem;
    color: var(--clr-text-muted);
    margin-bottom: 16px;
}

.pd-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pd-stat-card {
    background: #f5edd8;
    border-radius: 16px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pd-stat-icon { font-size: 1.1rem; }

.pd-stat-value {
    font-family: 'Nunito', sans-serif;
    font-size: 1.45rem;
    font-weight: 900;
    color: #3a2710;
    line-height: 1;
}

.pd-stat-label {
    font-size: 0.66rem;
    color: #8a6030;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
}

.pd-section {
    margin-bottom: 28px;
}

.pd-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.pd-section-title {
    font-family: 'Nunito', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    color: #3a2710;
}

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

.pd-empty {
    background: #fffdf7;
    border-radius: 16px;
    padding: 16px 20px;
    color: var(--clr-text-muted);
    font-size: 0.88rem;
    text-align: center;
    border: 1.5px dashed var(--clr-border);
}

.pd-child-card {
    background: #fffdf7;
    border-radius: 18px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1.5px solid rgba(244,160,53,0.1);
    transition: transform var(--transition), box-shadow var(--transition);
}

.pd-child-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    border-color: rgba(244,160,53,0.35);
}

.pd-child-avatar {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.pd-child-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pd-child-name {
    font-family: 'Nunito', sans-serif;
    font-size: 0.98rem;
    font-weight: 800;
    color: #3a2710;
}

.pd-child-pin {
    font-size: 0.78rem;
    color: var(--clr-text-muted);
}

.pd-child-qr {
    font-size: 0.8rem;
    color: var(--clr-primary-dk);
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.pd-route-card {
    background: #fffdf7;
    border-radius: 18px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1.5px solid rgba(244,160,53,0.1);
}

.pd-route-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.pd-route-icon img {
    width: 100%;
    height: auto;
}

.pd-route-info {
    flex: 1;
    min-width: 0;
}

.pd-route-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.pd-route-title {
    font-family: 'Nunito', sans-serif;
    font-size: 0.98rem;
    font-weight: 800;
    color: #3a2710;
}

.pd-route-meta {
    font-size: 0.8rem;
    color: var(--clr-text-muted);
    display: block;
}

.pd-route-done {
    font-size: 0.75rem;
    color: #2d7a2d;
    font-weight: 700;
    display: block;
    margin-top: 2px;
}

/* ── Avatar picker ───────────────────────────────────────────────── */
.avatar-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 6px;
    width: 100%;
    box-sizing: border-box;
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #d4a574 #f5edd8;
}
.avatar-picker::-webkit-scrollbar { width: 6px; }
.avatar-picker::-webkit-scrollbar-track { background: #f5edd8; border-radius: 4px; }
.avatar-picker::-webkit-scrollbar-thumb { background: #d4a574; border-radius: 4px; }

.avatar-option {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 2.5px solid transparent;
    border-radius: 12px;
    padding: 4px;
    cursor: pointer;
    background: #f5edd8;
    transition: border-color 0.15s, transform 0.12s;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.avatar-option:hover {
    border-color: rgba(244,160,53,0.5);
    transform: scale(1.06);
}

.avatar-option.selected {
    border-color: #f4a035;
    background: #fff3d8;
    box-shadow: 0 0 0 2px rgba(244,160,53,0.25);
}

/* ── Show-link modal: avatar edit ────────────────────────────── */
.show-avatar-wrap {
    position: relative;
    width: 88px;
    height: 88px;
    margin: 0 auto 10px;
    cursor: pointer;
    display: inline-block;
}
.show-avatar-img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    border-radius: 16px;
    background: #f5edd8;
    padding: 4px;
    box-sizing: border-box;
    display: block;
}
.avatar-edit-btn {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 28px;
    height: 28px;
    background: #f4a035;
    border-radius: 50%;
    border: 2.5px solid #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    pointer-events: none;
    line-height: 1;
}
.show-avatar-picker-wrap {
    margin-bottom: 12px;
}
.show-link-name-heading {
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 2px;
}
.show-link-subtitle {
    font-size: 0.83rem;
    color: var(--clr-text-muted);
    margin-bottom: 14px;
}

.pd-child-avatar-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ── Completed toggle ────────────────────────────────────────────── */
.pd-routes-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.completed-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.completed-toggle input[type="checkbox"] {
    display: none;
}

.toggle-track {
    width: 36px;
    height: 20px;
    background: #ccc;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.completed-toggle input:checked + .toggle-track {
    background: #4CAF50;
}

.completed-toggle input:checked + .toggle-track::after {
    transform: translateX(16px);
}

.toggle-text {
    font-size: 0.8rem;
    color: var(--clr-text-muted);
    font-weight: 600;
    white-space: nowrap;
}
