:root {
  --ink: #24334c;
  --muted: #68758c;
  --cream: #fff8df;
  --paper: #fffef9;
  --coral: #f47764;
  --coral-dark: #b83e34;
  --blue: #4c79d8;
  --green: #3a9a70;
  --purple: #8267c7;
  --gold: #f3cf68;
  --line: #e5e4dc;
  --shadow: 0 18px 50px rgba(45, 67, 94, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 4%, #dff5ff 0 13%, transparent 28%),
    radial-gradient(circle at 94% 18%, #ffe0d9 0 11%, transparent 26%),
    linear-gradient(180deg, #fffdf4, #f7fbff 50%, #fff9e9);
  font-family: Inter, ui-rounded, "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}
button, input, select { font: inherit; }
button, .button { touch-action: manipulation; }
.skip-link { position: fixed; left: 10px; top: -80px; z-index: 100; padding: 12px 16px; background: #fff; border-radius: 12px; }
.skip-link:focus { top: 10px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 10px max(16px, calc((100vw - 1180px) / 2));
  background: rgba(255, 254, 249, .94);
  border-bottom: 1px solid rgba(93, 112, 138, .15);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 46px; height: 46px; }
.brand strong { display: block; font-size: 22px; line-height: 1; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.privacy-pill { padding: 9px 12px; border-radius: 999px; background: #eaf8f0; color: #27674e; font-size: 12px; font-weight: 800; }
main { width: min(1180px, calc(100% - 28px)); margin: 0 auto; }
.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: clamp(24px, 6vw, 80px);
  align-items: center;
  min-height: 500px;
  padding: 70px clamp(20px, 4vw, 52px);
  overflow: hidden;
}
.eyebrow { display: inline-block; color: #53708a; font-size: 12px; font-weight: 900; letter-spacing: .13em; }
h1, h2, h3, p { margin-top: 0; }
.hero h1 { margin: 12px 0 20px; font-size: clamp(50px, 8vw, 92px); line-height: .9; letter-spacing: -.06em; }
.hero h1 em { color: var(--coral); font-style: normal; }
.hero > div > p { max-width: 650px; color: #586982; font-size: clamp(17px, 2vw, 21px); line-height: 1.6; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 9px; }
.hero-badges span { padding: 10px 13px; border-radius: 999px; background: #fff; box-shadow: 0 8px 28px rgba(45, 67, 94, .08); font-weight: 850; }
.quest-map { position: relative; min-height: 330px; padding: 26px; border: 2px solid #fff; border-radius: 42px; background: linear-gradient(145deg, #dff5ff, #fff4bf 54%, #ffe1d8); box-shadow: var(--shadow); transform: rotate(1.5deg); }
.map-card { position: absolute; display: grid; grid-template-columns: 54px 1fr; align-items: center; width: min(230px, 70%); padding: 16px; border-radius: 22px; background: #fff; box-shadow: 0 12px 28px rgba(54, 75, 105, .13); font-size: 34px; }
.map-card b, .map-card span { grid-column: 2; font-size: 15px; }
.map-card span { color: var(--green); font-size: 12px; font-weight: 850; }
.map-card-one { left: 8%; top: 11%; }
.map-card-two { right: 7%; bottom: 10%; }
.map-path { position: absolute; inset: 46% 8% auto; color: #b7893a; font-size: clamp(22px, 4vw, 40px); letter-spacing: .1em; transform: rotate(12deg); }
.dashboard { padding: 14px 0 60px; }
.dashboard-head, .section-title { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.dashboard-head h2, .section-title h2 { margin: 5px 0 0; font-size: clamp(28px, 4vw, 45px); letter-spacing: -.035em; }
.kid-picker { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 850; }
.kid-picker select, input, select { min-height: 46px; padding: 10px 13px; color: var(--ink); background: #fff; border: 1px solid #cfd7df; border-radius: 14px; }
.score-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.score-card { display: flex; align-items: center; gap: 15px; min-height: 105px; padding: 20px; border-radius: 24px; background: #fff; box-shadow: 0 10px 32px rgba(46, 67, 96, .09); }
.score-card > span { font-size: 36px; }
.score-card strong { display: block; font-size: 28px; }
.score-card small { color: var(--muted); font-weight: 750; }
.score-card.stars { border-bottom: 5px solid var(--gold); }
.score-card.coins { border-bottom: 5px solid #72c4a0; }
.score-card.review { border-bottom: 5px solid #92b8ed; }
.tabs { display: flex; gap: 8px; margin: 24px 0; padding: 6px; overflow-x: auto; border-radius: 18px; background: #edf2f7; }
.tab { flex: 1; min-width: max-content; min-height: 46px; padding: 10px 16px; color: #53627a; border: 0; border-radius: 13px; background: transparent; font-weight: 850; cursor: pointer; }
.tab.active { color: #fff; background: var(--blue); }
.section-title { margin-top: 34px; }
.section-title > p { max-width: 470px; color: var(--muted); line-height: 1.55; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.quest-card, .reward-card {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 22px;
  border: 1px solid rgba(60, 79, 105, .09);
  border-radius: 27px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(45, 66, 95, .09);
}
.card-icon { font-size: 42px; }
.quest-card h3, .reward-card h3 { margin: 14px 0 8px; font-size: 21px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.card-meta span { padding: 6px 9px; border-radius: 999px; background: #f1f5f8; color: #596982; font-size: 12px; font-weight: 800; }
.quest-card .button, .reward-card .button { width: 100%; margin-top: auto; }
.empty { grid-column: 1 / -1; padding: 38px; text-align: center; border: 2px dashed #cfdbe5; border-radius: 24px; background: rgba(255,255,255,.65); }
.history-list, .review-list, .payout-list { display: grid; gap: 10px; }
.history-item, .review-item, .payout-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 15px 17px; border-radius: 18px; background: #fff; }
.history-item small, .review-item small { display: block; margin-top: 3px; color: var(--muted); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  padding: 10px 15px;
  border: 0;
  border-radius: 14px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: #fff; background: var(--coral-dark); }
.button-secondary { color: #fff; background: var(--blue); }
.button-soft { color: #29415e; background: #edf3f9; }
.button-danger { color: #8a2925; background: #ffdfdc; }
.button[disabled] { cursor: default; opacity: .55; }
.family-note, .proposal { display: flex; align-items: center; gap: 22px; margin: 32px 0; padding: 28px; border-radius: 28px; }
.family-note { background: #e5f7ed; }
.family-note h2, .proposal h2 { margin-bottom: 8px; }
.family-note p, .proposal p { margin: 0; line-height: 1.6; }
.note-icon { font-size: 46px; }
.proposal { position: relative; flex-wrap: wrap; justify-content: space-between; background: #fff1c7; }
.proposal-tag { flex-basis: 100%; color: #785b15; font-size: 11px; font-weight: 950; letter-spacing: .1em; }
.coming-soon { padding: 10px 14px; border-radius: 999px; color: #fff; background: #856415; font-weight: 900; }
footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; padding: 35px 16px 46px; color: #617087; text-align: center; font-size: 13px; border-top: 1px solid #e2e5e9; }
footer a { color: #35577c; font-weight: 850; }

.modal { width: min(620px, calc(100% - 24px)); padding: 0; overflow: hidden; color: var(--ink); border: 0; border-radius: 28px; box-shadow: 0 25px 90px rgba(26, 42, 62, .28); }
.modal::backdrop { background: rgba(28, 43, 62, .56); backdrop-filter: blur(4px); }
.modal form, .parent-shell { display: grid; gap: 14px; padding: clamp(22px, 5vw, 38px); }
.modal label { display: grid; gap: 6px; color: #4c5c70; font-size: 13px; font-weight: 850; }
.modal h2 { margin-bottom: 0; font-size: 31px; }
.modal p { color: var(--muted); line-height: 1.5; }
.compact { width: min(430px, calc(100% - 24px)); }
.close { justify-self: end; width: 42px; height: 42px; color: #536279; border: 0; border-radius: 50%; background: #eef2f5; font-size: 26px; cursor: pointer; }
.pin-input { text-align: center; font-size: 28px; letter-spacing: .35em; }
.form-error { min-height: 20px; margin: 0; color: #a8322d !important; font-weight: 800; }
.parent-modal { width: min(950px, calc(100% - 20px)); max-height: calc(100vh - 24px); overflow-y: auto; }
.parent-shell { gap: 24px; }
.parent-shell > header { display: flex; justify-content: space-between; gap: 20px; }
.parent-shell h3 { margin-bottom: 12px; font-size: 20px; }
.parent-notice { padding: 13px 15px; color: #624f18 !important; border-radius: 15px; background: #fff3c6; }
.parent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.stack-form { display: grid; gap: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.review-item > div:first-child { flex: 1; }
.review-actions, .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.review-actions .button { min-height: 38px; padding: 8px 12px; font-size: 13px; }
.data-tools { padding-top: 20px; border-top: 1px solid var(--line); }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 24px; max-width: calc(100% - 28px); padding: 13px 18px; color: #fff; border-radius: 14px; background: #24334c; box-shadow: var(--shadow); font-weight: 800; opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 780px) {
  .privacy-pill { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 45px 8px; }
  .quest-map { min-height: 285px; }
  .dashboard-head, .section-title { align-items: stretch; flex-direction: column; }
  .kid-picker select { width: 100%; }
  .score-row { grid-template-columns: 1fr; }
  .score-card { min-height: 85px; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .parent-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar { min-height: 64px; }
  .brand strong { font-size: 18px; }
  .brand small { max-width: 155px; font-size: 9px; }
  .brand img { width: 38px; height: 38px; }
  .top-actions .button { min-height: 40px; padding: 8px 10px; font-size: 12px; }
  .hero h1 { font-size: 52px; }
  .card-grid { grid-template-columns: 1fr; }
  .quest-card, .reward-card { min-height: 205px; }
  .family-note { align-items: flex-start; }
  .proposal { align-items: flex-start; flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .review-item, .payout-item { align-items: stretch; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

#setup-dialog { max-height: calc(100dvh - 24px); overflow-y: auto; }
.setup-buy { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 14px 18px; background: #f3f1ff; border-bottom: 1px solid rgba(99, 91, 255, .25); text-align: center; }
.setup-buy p { flex-basis: 100%; margin: 0; color: var(--ink); }
.setup-buy .button-primary { background: #635bff; color: #fff; }
