/* ============ PiggyCove — seaside toy-box ============ */
:root {
  --sand: #fdf3e3;
  --sand-deep: #f7e6c8;
  --ink: #4a3728;
  --ink-soft: #8a715c;
  --pig: #ff8fab;
  --pig-deep: #f25c8a;
  --sea: #23b5af;
  --sea-deep: #128a85;
  --sun: #ffd66b;
  --sun-deep: #f5b81e;
  --card: #fffdf7;
  --good: #59c26a;
  --bad: #e5484d;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(74, 55, 40, .12);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { height: 100%; background: var(--sand); overscroll-behavior-y: contain; }
body {
  font-family: "Nunito", sans-serif;
  font-weight: 600;
  background:
    radial-gradient(1200px 500px at 50% -200px, #ffedc2 0%, transparent 60%),
    var(--sand);
  color: var(--ink);
  min-height: 100%;
}
h1, h2, h3, .balance-chip, .celebrate-word, button { font-family: "Baloo 2", cursive; }
.screen { max-width: 520px; margin: 0 auto; padding: 24px 18px calc(28px + env(safe-area-inset-bottom)); position: relative; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px solid rgba(74, 55, 40, .08);
}

/* ---- picker ---- */
.cove-sky {
  position: absolute; inset: 0 0 auto 0; height: 210px; z-index: -1;
  background: linear-gradient(#bdeeeb, transparent);
  border-radius: 0 0 50% 50%;
}
.logo { font-size: 44px; font-weight: 800; text-align: center; padding-top: 40px; letter-spacing: -1px; }
.logo-pig { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-7px) rotate(-6deg); } }
.tagline { text-align: center; color: var(--ink-soft); font-size: 19px; margin: 6px 0 30px; }
.picker-cards { display: grid; gap: 18px; }
.picker-card {
  display: flex; align-items: center; gap: 18px;
  padding: 22px; font-size: 26px; font-weight: 800;
  background: var(--card); border: 3px solid var(--sun);
  border-radius: 28px; box-shadow: 0 8px 0 var(--sun-deep);
  cursor: pointer; transition: transform .1s;
}
.picker-card:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--sun-deep); }
.picker-card .face { font-size: 52px; }

/* ---- kid header ---- */
.kid-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar-btn {
  font-size: 34px; width: 62px; height: 62px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--sun); box-shadow: var(--shadow); cursor: pointer;
}
.kid-title { flex: 1; }
.kid-title h2 { font-size: 27px; line-height: 1.05; }
.streak-chip { font-size: 14px; color: var(--ink-soft); font-weight: 800; }
.balance-chip {
  background: var(--sun); border-radius: 999px; padding: 9px 16px;
  font-size: 19px; font-weight: 800; box-shadow: 0 4px 0 var(--sun-deep);
}
body.mini .balance-chip { font-size: 23px; }

/* ---- tv meter ---- */
.tv-meter { padding: 16px 18px; margin-bottom: 22px; }
.tv-meter-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.tv-label { color: var(--ink-soft); font-size: 15px; }
#tv-mins { font-family: "Baloo 2", cursive; font-size: 23px; color: var(--sea-deep); }
.meter-track { height: 18px; background: var(--sand-deep); border-radius: 999px; overflow: hidden; }
.meter-track.slim { height: 12px; }
.meter-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: repeating-linear-gradient(45deg, var(--sea), var(--sea) 12px, #35c9c3 12px, #35c9c3 24px);
  transition: width .6s cubic-bezier(.2, .9, .3, 1.2);
}
.meter-fill.pink { background: repeating-linear-gradient(45deg, var(--pig), var(--pig) 12px, #ffa5bd 12px, #ffa5bd 24px); }
.tv-hint { margin-top: 10px; font-weight: 800; color: var(--ink-soft); font-size: 15px; text-align: center; }
.tv-live { margin-top: 12px; text-align: center; }
.tv-live-label { font-weight: 800; color: var(--pig-deep); font-size: 15px; animation: pulse 1.2s infinite; }
.tv-countdown {
  display: inline-block; font-family: "Baloo 2", cursive; font-weight: 800; font-size: 42px;
  color: var(--pig-deep); line-height: 1; margin: 0 8px; font-variant-numeric: tabular-nums;
}
@keyframes pulse { 50% { opacity: .55; } }
@keyframes wiggle { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
.pending-strip {
  background: #fff3d1; border: 2px dashed var(--sun-deep); border-radius: 14px;
  padding: 10px 14px; margin-bottom: 12px; font-weight: 800; font-size: 14px; color: var(--ink);
}
.pts.waiting { background: var(--sand-deep); color: var(--ink-soft); }
.pts.earned { background: #d9f2de; color: #2f7c3d; }

/* ---- tasks ---- */
.section-title { font-size: 21px; margin-bottom: 12px; }
.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.task-card {
  position: relative; padding: 18px 14px; text-align: center;
  background: var(--card); border: 2px solid rgba(74, 55, 40, .08);
  border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; transition: transform .1s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.task-card:active { transform: scale(.96); }
.task-card .icon { font-size: 46px; }
body.mini .task-card .icon { font-size: 56px; }
.task-card .name { font-weight: 800; font-size: 16px; }
body.mini .task-card .name { font-size: 18px; }
body.mini .task-card { padding: 22px 14px; }
.task-card .pts {
  background: var(--sun); border-radius: 999px; padding: 3px 12px;
  font-size: 14px; font-weight: 800;
}
.task-card .stars { font-size: 16px; letter-spacing: 2px; }
.task-card.done { opacity: .6; }
.task-card.pending { border-color: var(--sun); background: #fffaf0; }

/* ---- piggy bank ---- */
.piggy { display: flex; gap: 16px; align-items: center; padding: 16px 18px; }
.piggy-jar {
  position: relative; width: 74px; height: 88px; flex: none;
  background: #eaf7f6; border: 3px solid var(--sea);
  border-radius: 14px 14px 26px 26px; overflow: hidden;
}
.jar-fill {
  position: absolute; bottom: 0; left: 0; right: 0; height: 0;
  background: linear-gradient(var(--pig), var(--pig-deep));
  transition: height .8s cubic-bezier(.2, .9, .3, 1.2);
}
.jar-pig { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; }
.piggy-info { flex: 1; }
.piggy-info h3 { font-size: 19px; }
.piggy-info p { color: var(--ink-soft); font-size: 14px; margin: 3px 0 8px; }

.kid-footer { text-align: center; margin-top: 30px; display: grid; gap: 14px; justify-items: center; }
.switch-pill {
  font-family: "Baloo 2", cursive; font-weight: 700; font-size: 16px; color: var(--ink);
  background: var(--card); border: 2px solid rgba(74, 55, 40, .18); border-radius: 999px;
  padding: 11px 22px; box-shadow: var(--shadow); cursor: pointer;
}
.switch-pill:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(74, 55, 40, .12); }
.lock-link { color: var(--ink-soft); text-decoration: none; font-size: 14px; opacity: .7; }

/* ---- loading splash ---- */
.splash {
  position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; gap: 10px;
  background: var(--sand); text-align: center;
}
.splash-pig { font-size: 74px; animation: bob 1.2s ease-in-out infinite; }
.splash-word { font-family: "Baloo 2", cursive; font-weight: 700; font-size: 19px; color: var(--ink-soft); }

/* ---- celebration ---- */
.celebrate {
  position: fixed; inset: 0; z-index: 50; display: grid; place-content: center;
  background: rgba(255, 214, 107, .92); text-align: center;
}
.celebrate-word { font-size: 74px; font-weight: 800; color: var(--pig-deep); animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.celebrate-sub { font-size: 19px; font-weight: 800; color: var(--ink); }
@keyframes pop { 0% { transform: scale(.2) rotate(-10deg); } }
.burst { position: absolute; inset: 0; pointer-events: none; }
.burst span { position: absolute; top: 50%; left: 50%; font-size: 30px; animation: fly 1.3s ease-out forwards; }
.burst span:nth-child(1) { --dx: -130px; --dy: -160px; }
.burst span:nth-child(2) { --dx: 120px; --dy: -190px; animation-delay: .05s; }
.burst span:nth-child(3) { --dx: -190px; --dy: -40px; animation-delay: .1s; }
.burst span:nth-child(4) { --dx: 180px; --dy: -60px; animation-delay: .05s; }
.burst span:nth-child(5) { --dx: -110px; --dy: 130px; animation-delay: .12s; }
.burst span:nth-child(6) { --dx: 140px; --dy: 110px; animation-delay: .08s; }
.burst span:nth-child(7) { --dx: -30px; --dy: -220px; animation-delay: .15s; }
.burst span:nth-child(8) { --dx: 40px; --dy: 170px; animation-delay: .1s; }
@keyframes fly {
  0% { transform: translate(0, 0) scale(.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.4) rotate(200deg); opacity: 0; }
}

/* ============ parent mode ============ */
body.parent { background: #f3efe6; }
.parent-wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; }
.parent-title { font-size: 26px; margin-bottom: 4px; }
.parent-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 18px; }

/* pin pad */
.pin-screen { text-align: center; padding-top: 8vh; }
.pin-dots { font-size: 34px; letter-spacing: 14px; margin: 22px 0; min-height: 46px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; justify-content: center; }
.pin-pad button {
  width: 76px; height: 76px; border-radius: 50%; font-size: 27px; font-weight: 700;
  background: var(--card); border: 2px solid rgba(74, 55, 40, .12); box-shadow: var(--shadow); cursor: pointer;
}
.pin-pad button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(74, 55, 40, .12); }
.pin-error { color: var(--bad); font-weight: 800; min-height: 22px; margin-top: 14px; }

/* tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  flex: 1; padding: 10px 12px; border-radius: 999px; white-space: nowrap;
  border: 2px solid rgba(74, 55, 40, .12); background: transparent;
  font-family: "Baloo 2", cursive; font-size: 15px; font-weight: 700; color: var(--ink-soft); cursor: pointer;
}
.tabs button.active { background: var(--ink); color: var(--sand); border-color: var(--ink); }

.panel { display: none; }
.panel.active { display: block; }
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  border: 2px solid rgba(74, 55, 40, .08); padding: 13px 14px; margin-bottom: 10px;
}
.row .grow { flex: 1; min-width: 0; }
.row .meta { color: var(--ink-soft); font-size: 13px; }
.btn {
  font-family: "Baloo 2", cursive; font-weight: 700; font-size: 15px;
  border: none; border-radius: 999px; padding: 10px 16px; cursor: pointer;
}
.btn:active { transform: translateY(2px); }
.btn.approve { background: var(--good); color: #fff; box-shadow: 0 4px 0 #3e9c4e; }
.btn.reject { background: transparent; color: var(--bad); border: 2px solid var(--bad); }
.btn.primary { background: var(--sea); color: #fff; box-shadow: 0 4px 0 var(--sea-deep); }
.btn.warn { background: var(--pig-deep); color: #fff; box-shadow: 0 4px 0 #c23368; }
.btn.ghost { background: transparent; border: 2px solid rgba(74, 55, 40, .25); color: var(--ink); }
.empty { text-align: center; color: var(--ink-soft); padding: 26px 0; }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.form-grid .full { grid-column: 1 / -1; }
input, select {
  font-family: "Nunito", sans-serif; font-weight: 600; font-size: 15px; color: var(--ink);
  background: var(--card); border: 2px solid rgba(74, 55, 40, .15); border-radius: 12px; padding: 11px 12px; width: 100%;
}
label { font-size: 13px; color: var(--ink-soft); font-weight: 800; display: block; margin-bottom: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid rgba(74, 55, 40, .1); font-size: 14px; }
th { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: var(--sand); border-radius: 999px; padding: 11px 20px;
  font-weight: 800; z-index: 60; transition: opacity .3s; opacity: 0; pointer-events: none;
}
.toast.show { opacity: 1; }
