/* ==========================================================
   Motivation: buddy, dock, map, stickers, badges, surprise box,
   feelings, calm corner, celebrations, family jar.
   ========================================================== */

/* ---------- Side column: buddy + jar ---------- */
.kidside { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
html.is-demo .kidside { top: 4.5rem; }
.kidside .jar { position: static; }

.buddybox {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  background: var(--surface); border-radius: 2rem; padding: 1rem 1rem 1.1rem;
  box-shadow: 0 .5rem 1.5rem rgba(40,60,50,.1); text-align: center;
}
.buddybox__bubble {
  position: relative; background: var(--surface2); border: 2px solid var(--line);
  border-radius: 1.25rem; padding: .5rem .9rem; font-size: 1.25rem; font-weight: 800; line-height: 1.25;
}
.buddybox__bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -.6rem; width: 1rem; height: 1rem;
  background: var(--surface2); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line);
  transform: translateX(-50%) rotate(45deg);
}
.buddybox__buddy svg { width: 7.5rem; height: 7.5rem; display: block; }
.buddy--idle svg { animation: float 3.5s ease-in-out infinite; }
.buddy--happy svg { animation: hop .7s cubic-bezier(.3,1.6,.5,1) 2; }
.buddy--party svg { animation: party 1s ease-in-out 3; }
.streak { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.streak__days { font-size: 1.25rem; font-weight: 900; }
.streak__rest { font-size: 1rem; color: var(--muted); font-weight: 700; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.35rem); } }
@keyframes hop { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-1.25rem) scale(1.08, .95); } 70% { transform: translateY(0) scale(.95, 1.06); } 100% { transform: none; } }
@keyframes party { 0% { transform: rotate(0) scale(1); } 25% { transform: rotate(-12deg) scale(1.1); } 50% { transform: rotate(12deg) translateY(-.75rem) scale(1.12); } 75% { transform: rotate(-6deg); } 100% { transform: none; } }

/* ---------- Dock ---------- */
.dock {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: .6rem;
  margin: 1.5rem auto 0; padding: .65rem clamp(.5rem, 2vw, 1rem) calc(.65rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.dock__btn {
  position: relative; flex: 1 1 0; max-width: 9rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  min-height: 4.5rem; padding: .35rem .25rem;
  border: 0; border-radius: 1.25rem; background: var(--surface2); color: var(--ink);
  font: inherit; font-size: 1rem; font-weight: 800; cursor: pointer;
  transition: transform .2s cubic-bezier(.3,1.6,.5,1);
}
.dock__btn:active { transform: scale(.94); }
.dock__emoji { font-size: 2rem; line-height: 1.1; }
.dock__btn--glow { background: #FFF3CC; box-shadow: 0 0 0 3px #F6C453; animation: glowbtn 1.6s ease-in-out infinite; }
.dock__dot { position: absolute; top: .4rem; right: .6rem; width: .9rem; height: .9rem; border-radius: 50%; background: #F49AB0; border: 2px solid #fff; }
@keyframes glowbtn { 50% { box-shadow: 0 0 0 6px rgba(246,196,83,.45); } }

/* ---------- Feelings ---------- */
.feelcard {
  background: var(--surface); border-radius: 2rem; padding: 1.25rem 1.25rem .75rem; margin-bottom: 1.5rem;
  box-shadow: 0 .5rem 1.5rem rgba(40,60,50,.08); text-align: center; border: 3px solid color-mix(in srgb, var(--kid) 70%, #fff);
}
.feelcard__q { font-size: 2rem; margin: 0 0 1rem; }
.feelcard__later { margin-top: .25rem; color: var(--muted); }
.feelings { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; }
.feel {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  min-height: 3.5rem; padding: .75rem .25rem; border: 3px solid transparent; border-radius: 1.5rem;
  background: var(--surface2); color: var(--ink); font: inherit; cursor: pointer;
  transition: transform .2s cubic-bezier(.3,1.6,.5,1);
}
.feel:hover { border-color: var(--kid-deep); }
.feel:active { transform: scale(.92); }
.feel svg { width: 100%; max-width: 6rem; height: auto; }
.feel__emoji { font-size: 4rem; line-height: 1.1; }
.feel__label { font-size: 1.25rem; font-weight: 800; }

/* ---------- Kid overlays (surprise, calm, feelings, celebrations) ---------- */
.kidoverlay {
  position: fixed; inset: 0; z-index: 160; display: grid; place-items: center; padding: 1rem;
  background: rgba(30,40,36,.55); animation: fade .2s ease;
}
.kidoverlay__card {
  position: relative; width: min(36rem, 100%); max-height: calc(100dvh - 2rem); overflow: auto;
  background: var(--surface); color: var(--ink); border-radius: 2.25rem; padding: 1.75rem 1.5rem 2rem; text-align: center;
  box-shadow: 0 1rem 3rem rgba(0,0,0,.25); animation: pop .3s cubic-bezier(.3,1.4,.5,1);
}
.kidoverlay__close { position: absolute; top: 1rem; right: 1rem; width: 3.5rem; height: 3.5rem; }
.kidoverlay__title { font-size: 2.25rem; margin: .25rem 3.5rem 1rem; }
.btnrow--center { justify-content: center; }
.feelover .kidoverlay__card { width: min(44rem, 100%); }

/* Surprise box */
.surprise__stage { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.surprise__box { position: relative; border: 0; background: none; padding: 0; cursor: default; }
.surprise__box--ready { cursor: pointer; }
.gift { width: 14rem; height: 14rem; display: block; overflow: visible; }
.surprise__box--ready .gift { animation: shake 1.4s ease-in-out infinite; transform-origin: 50% 90%; }
.surprise__box--locked .gift, .surprise__box--opened .gift { filter: grayscale(.6); opacity: .6; }
.surprise__lock { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%); font-size: 3.5rem; }
.gift__lid { transition: transform .6s cubic-bezier(.3,1.6,.5,1); transform-origin: 50% 80%; }
.surprise__box--opening .gift__lid { transform: translateY(-60px) rotate(-18deg); }
.surprise__box--opening .gift { animation: none; }
.surprise__text { font-size: 1.375rem; font-weight: 700; margin: 0; }
.surprise__text--big { font-size: 1.75rem; font-weight: 900; }
.surprise__label { font-size: 1.25rem; font-weight: 900; color: var(--primary); margin: 0; text-transform: uppercase; letter-spacing: .04em; }
.surprise__meter { width: 70%; height: 1.25rem; border-radius: 999px; background: var(--surface2); border: 2px solid var(--line); overflow: hidden; }
.surprise__meter span { display: block; height: 100%; background: #F6C453; border-radius: inherit; }
.surprise__progress { font-size: 1.5rem; font-weight: 900; margin: 0; }
.surprise__reveal { animation: reveal .7s cubic-bezier(.3,1.6,.5,1); }
.surprise__reveal .sticker { width: 12rem; height: 12rem; }
.surprise__reveal--points { font-size: 8rem; line-height: 1; }
@keyframes shake { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-6deg); } 80% { transform: rotate(6deg); } 90% { transform: rotate(-3deg); } }
@keyframes reveal { from { transform: scale(.2) rotate(-30deg); opacity: 0; } }

/* Calm corner */
.calm .kidoverlay__card { background: linear-gradient(180deg, #EAF4FF, #F3EEFF); }
.calm__intro { font-size: 1.75rem; font-weight: 800; min-height: 2.6em; margin: 0; }
.calm__stage { display: grid; place-items: center; height: min(20rem, 45vh); }
.calm__bubble {
  width: min(18rem, 40vh); height: min(18rem, 40vh); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, #CFE6FF 30%, #B9A4E8 100%);
  box-shadow: 0 0 3rem rgba(185,164,232,.55), inset 0 -1rem 2rem rgba(255,255,255,.4);
  transform: scale(.55); transition-property: transform; transition-timing-function: ease-in-out;
}
.calm__bubble--in, .calm__bubble--hold { transform: scale(1); }
.calm__bubble--out { transform: scale(.55); }
.calm__count { font-size: 1.375rem; font-weight: 800; color: var(--muted); }
html.reduce-motion .calm__bubble { transform: scale(.8) !important; transition: none !important; }
html.reduce-motion .calm__bubble--in, html.reduce-motion .calm__bubble--hold { background: radial-gradient(circle at 35% 30%, #fff 0, #D8F0E3 30%, #7CC6A0 100%); }

/* Celebration pop-up */
.celebrate-pop__art { display: grid; place-items: center; margin-bottom: .5rem; animation: reveal .7s cubic-bezier(.3,1.6,.5,1); }
.celebrate-pop__art .badgeart { width: 11rem; height: auto; }
.celebrate-pop__world { width: 10rem; height: 10rem; border-radius: 50%; display: grid; place-items: center; font-size: 5.5rem; box-shadow: 0 0 0 .6rem #fff, 0 .5rem 2rem rgba(0,0,0,.15); }
.celebrate-pop__text { font-size: 1.75rem; font-weight: 900; }

/* ---------- Sub pages ---------- */
.screen--sub .kidbar { grid-template-columns: auto 1fr auto; }
.subpage { max-width: 72rem; margin: 0 auto; padding: .5rem clamp(1rem, 3vw, 2rem) 3rem; }
.subpage__h { font-size: 2rem; margin: 2rem 0 1rem; }
.subpage__count { font-size: 1.5rem; font-weight: 800; color: var(--muted); margin: 0 0 1rem; }
.subpage__empty { font-size: 1.375rem; }
.age-big .subpage__count { color: #C9D6F2; }

/* Map */
.mapcard { background: var(--surface); border-radius: 2rem; padding: 1.25rem; box-shadow: 0 .5rem 1.5rem rgba(40,60,50,.1); }
.age-big .mapcard { background: #2A3552; }
.mapcard__head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.mapcard__emoji { font-size: 3.5rem; width: 5rem; height: 5rem; display: grid; place-items: center; border-radius: 1.5rem; background: var(--w-sky); }
.mapcard__name { font-size: 2.25rem; margin: 0; }
.mapcard__steps { font-size: 1.375rem; font-weight: 700; color: var(--muted); margin: 0; }
.age-big .mapcard__steps { color: #C9D6F2; }
.mapcard__map { overflow-x: auto; border-radius: 1.75rem; }
.mapsvg { width: 100%; min-width: 40rem; height: auto; display: block; }
.mapbuddy { animation: float 3s ease-in-out infinite; }
.worldgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem; }
.worldtile {
  display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center;
  padding: 1rem .75rem; border-radius: 1.5rem; color: #2B3A35;
  background: linear-gradient(180deg, var(--w-sky), var(--w-ground)); border: 3px solid transparent;
}
.worldtile__emoji { font-size: 3rem; line-height: 1.1; }
.worldtile__name { font-size: 1.25rem; font-weight: 900; }
.worldtile__note { font-size: 1rem; font-weight: 700; }
.worldtile--here { border-color: var(--kid-deep); box-shadow: 0 .4rem 1rem rgba(0,0,0,.12); }
.worldtile--locked { background: rgba(0,0,0,.06); color: var(--muted); }
.age-big .worldtile--locked { background: rgba(255,255,255,.06); color: #AFC0E4; }

/* Sticker book */
.stickerbook {
  list-style: none; margin: 0; padding: 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 1.25rem;
  background: #FFFDF7; border-radius: 2rem; border: 3px dashed #EAD9B5;
  background-image: radial-gradient(#F1E6CF 1.5px, transparent 1.5px); background-size: 22px 22px;
}
.stickerslot { position: relative; display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center; }
.stickerslot .sticker { width: 7.5rem; height: 7.5rem; transform: rotate(var(--tilt)); filter: drop-shadow(0 .3rem .35rem rgba(0,0,0,.18)); }
.stickerslot__name { font-size: 1.125rem; font-weight: 800; color: #4A4033; line-height: 1.2; }
.stickerslot__x { position: absolute; top: 0; right: .5rem; background: var(--ink); color: #fff; border-radius: 999px; padding: 0 .5rem; font-weight: 900; font-size: 1rem; }
.stickerslot__empty {
  display: grid; place-items: center; width: 7.5rem; height: 7.5rem; border-radius: 50%;
  border: 3px dashed #E3D3B0; color: #D6C59F; font-size: 2.5rem; font-weight: 900;
}

/* Badges */
.badgegrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1rem; }
.badgetile {
  display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center;
  background: var(--surface); border-radius: 1.5rem; padding: 1rem .75rem; box-shadow: 0 .3rem 1rem rgba(40,60,50,.07);
}
.age-big .badgetile { background: #2A3552; color: #EEF3FF; box-shadow: none; }
.badgeart { width: 6.5rem; height: auto; }
.badgetile__name { font-size: 1.125rem; font-weight: 800; line-height: 1.2; }
.badgetile:not(.badgetile--have) .badgetile__name { color: var(--muted); font-weight: 700; }
.age-big .badgetile:not(.badgetile--have) .badgetile__name { color: #AFC0E4; }
.badgetile__date { font-size: 1rem; color: var(--muted); }

/* ---------- Family jar (home) ---------- */
.familyjar {
  display: flex; align-items: center; gap: 1.25rem; text-align: left;
  max-width: 50rem; margin: 2.5rem auto 0; padding: 1.25rem 1.75rem;
  background: var(--surface); border-radius: 2rem; border: 1px solid var(--line);
  box-shadow: 0 .5rem 1.5rem rgba(40,60,50,.08);
}
.familyjar__icon { font-size: 3.5rem; width: 5.5rem; height: 5.5rem; flex: none; display: grid; place-items: center; border-radius: 1.5rem; background: var(--accent-soft); }
.familyjar__body { flex: 1; min-width: 0; }
.familyjar__label { margin: 0; font-size: 1rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.familyjar__title { font-size: 1.75rem; margin: .1rem 0 .5rem; }
.familyjar__bar { display: flex; height: 1.5rem; border-radius: 999px; background: var(--surface2); border: 2px solid var(--line); overflow: hidden; }
.familyjar__bar span { height: 100%; }
.familyjar__bar span + span { border-left: 2px solid #fff; }
.familyjar__nums { margin: .4rem 0 0; font-size: 1.25rem; font-weight: 700; color: var(--muted); }
.familyjar__nums strong { font-size: 2.25rem; color: var(--ink); }
.familyjar--reached { border: 3px solid var(--accent); }

/* ---------- Parent: feelings chart, icon picker ---------- */
.feelchart__head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.feelchart__head .avatar { --size: 3.25rem; }
.feelchart__head h3 { margin: 0; }
.feelchart__scroll { overflow-x: auto; }
.feelchart__table { border-collapse: collapse; width: 100%; min-width: 34rem; }
.feelchart__table th { font-size: 1rem; font-weight: 800; color: var(--muted); padding: .35rem; text-align: center; }
.feelchart__table th[scope="row"] { text-align: left; white-space: nowrap; }
.feelchart__table td { text-align: center; padding: .25rem; border-top: 1px solid var(--line); }
.feelchart__mood { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; }
.feelchart__mood svg { width: 100%; height: 100%; }
.feelchart__mood .feel__emoji { font-size: 1.9rem; }
.feelchart__none { color: var(--line); font-weight: 800; }
.iconpick { display: flex; flex-wrap: wrap; gap: .5rem; }
.iconpick__btn {
  width: 3.5rem; height: 3.5rem; font-size: 1.9rem; border-radius: 1rem;
  border: 2px solid var(--line); background: var(--surface2); cursor: pointer;
}
.iconpick__btn[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary); }

/* ---------- Big Kid touches ---------- */
.age-big .buddybox { background: #2A3552; box-shadow: none; }
.age-big .buddybox__bubble { background: #33405F; border-color: #3E4E72; color: #EEF3FF; }
.age-big .buddybox__bubble::after { background: #33405F; border-color: #3E4E72; }
.age-big .streak__rest { color: #AFC0E4; }
.age-big .dock { background: rgba(31,40,64,.9); border-top-color: rgba(255,255,255,.08); }
.age-big .dock__btn { background: #33405F; color: #EEF3FF; }
.age-big .dock__btn--glow { background: #3E4E72; box-shadow: 0 0 0 3px #6FD3C1; }
.age-big .feelcard { background: #2A3552; border-color: #3E4E72; }
.age-big .feel { background: #33405F; color: #EEF3FF; }

html.hc .buddybox, html.hc .feelcard, html.hc .dock__btn, html.hc .familyjar, html.hc .badgetile, html.hc .mapcard { border: 3px solid currentColor; box-shadow: none; }

/* ---------- Tablet / phone ---------- */
@media (max-width: 1000px) {
  .kidside { order: -1; position: static; flex-direction: row; align-items: stretch; gap: .75rem; }
  .kidside .jar { flex: 1; }
  .buddybox { flex: 0 1 15rem; flex-direction: row; flex-wrap: wrap; justify-content: center; padding: .75rem; }
  .buddybox__buddy svg { width: 5rem; height: 5rem; }
  .buddybox__bubble { order: 2; font-size: 1.125rem; }
  .buddybox__bubble::after { display: none; }
  .streak { order: 3; width: 100%; }
}
@media (max-width: 700px) {
  .kidside { flex-direction: row-reverse; }
  .buddybox { flex: none; padding: .5rem; }
  .buddybox__buddy svg { width: 4.75rem; height: 4.75rem; }
  .buddybox__bubble, .streak { display: none; }
  .dock { gap: .35rem; padding-left: .5rem; padding-right: .5rem; }
  .dock__btn { min-height: 4rem; font-size: 1rem; }
  .dock__emoji { font-size: 1.75rem; }
  .feelings { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .35rem; }
  .feel { padding: .5rem .1rem; border-radius: 1rem; }
  .feel__label { font-size: 1rem; }
  .feel__emoji { font-size: 2.5rem; }
  .feelcard__q { font-size: 1.75rem; }
  .kidoverlay__title { font-size: 2rem; }
  .gift { width: 11rem; height: 11rem; }
  .familyjar { flex-direction: column; text-align: center; padding: 1.25rem; }
  .stickerbook { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); padding: 1rem; gap: 1rem .5rem; }
  .stickerslot .sticker, .stickerslot__empty { width: 6rem; height: 6rem; }
  .badgegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  .dock { flex-wrap: wrap; position: static; background: transparent; border-top: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .dock__btn { flex: 1 1 30%; max-width: none; min-height: 3.75rem; flex-direction: row; gap: .35rem; }
  .dock__emoji { font-size: 1.5rem; }
}
