@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fredoka-400.ttf") format("truetype");
}

@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fredoka-500.ttf") format("truetype");
}

@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fredoka-600.ttf") format("truetype");
}

@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fredoka-700.ttf") format("truetype");
}

:root {
  color-scheme: light;
  font-family: Fredoka, "Trebuchet MS", "Segoe UI", sans-serif;
  --sky-top: #4ec9ff;
  --sky-mid: #7be7ff;
  --sky-bottom: #ffe56a;
  --coral: #ff5c4a;
  --coral-deep: #e24333;
  --teal: #14b8a6;
  --ink: #16324a;
  --muted: #3d5f78;
  --paper: #ffffff;
  --soft: rgba(255, 255, 255, 0.82);
  --person: var(--coral);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  background:
    linear-gradient(165deg, var(--sky-top) 0%, var(--sky-mid) 42%, var(--sky-bottom) 100%);
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

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

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
}

.blob-a {
  top: 8%;
  left: -8%;
  width: 46vw;
  height: 46vw;
  max-width: 280px;
  max-height: 280px;
  background: radial-gradient(circle at 30% 30%, #fff6a8, #ff9f68 70%);
  animation: drift 12s ease-in-out infinite;
}

.blob-b {
  right: -10%;
  top: 28%;
  width: 40vw;
  height: 40vw;
  max-width: 240px;
  max-height: 240px;
  background: radial-gradient(circle at 40% 40%, #b8fff1, #5ad7ff 75%);
  animation: drift 15s ease-in-out infinite reverse;
}

.blob-c {
  left: 18%;
  bottom: 6%;
  width: 34vw;
  height: 34vw;
  max-width: 220px;
  max-height: 220px;
  background: radial-gradient(circle at 50% 40%, #ffd0e6, #ff8fb3 70%);
  animation: drift 18s ease-in-out infinite;
}

.sun {
  position: absolute;
  top: 4%;
  right: 8%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7b0, #ffd84a 60%, #ffb703 100%);
  box-shadow: 0 0 0 10px rgba(255, 216, 74, 0.28);
  animation: pulse-sun 4.5s ease-in-out infinite;
}

.app {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(18px + var(--safe-top))
    18px
    calc(96px + var(--safe-bottom));
}

.loading-state {
  min-height: 70dvh;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
}

.loading-burst {
  font-size: 42px;
  color: #fff;
  animation: spin-soft 2.4s linear infinite;
}

.loading-state strong {
  font-size: 1.35rem;
  color: #fff;
  text-shadow: 0 2px 0 rgba(22, 50, 74, 0.15);
}

.chooser,
.day-shell {
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: rise-in 420ms ease-out both;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 0 rgba(22, 50, 74, 0.12);
}

.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(145deg, #fff, #ffe8a8);
  color: var(--coral);
  font-size: 34px;
  font-weight: 700;
  box-shadow: 0 10px 0 rgba(22, 50, 74, 0.12);
  animation: pop-in 560ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.brand-lockup h1 {
  margin: 0;
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.brand-lockup p {
  margin: 0;
  max-width: 22rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
}

.chooser-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.person-pick {
  min-height: 148px;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 28px;
  color: var(--ink);
  background: var(--soft);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 0 rgba(22, 50, 74, 0.1);
  transition: transform 160ms ease, box-shadow 160ms ease;
  animation: rise-in 480ms ease-out both;
}

.person-pick:nth-child(1) { animation-delay: 40ms; }
.person-pick:nth-child(2) { animation-delay: 90ms; }
.person-pick:nth-child(3) { animation-delay: 140ms; }
.person-pick:nth-child(4) { animation-delay: 190ms; }
.person-pick:nth-child(5) { animation-delay: 240ms; }
.person-pick:nth-child(6) { animation-delay: 290ms; }

.person-pick:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 rgba(22, 50, 74, 0.1);
}

.person-pick .avatar {
  width: 74px;
  height: 74px;
  font-size: 38px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--person) 35%, transparent);
}

.person-pick strong {
  font-size: 1.25rem;
  font-weight: 700;
}

.person-pick span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--person) 22%, #fff);
  font-size: 28px;
  line-height: 1;
}

.install-tip {
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-align: center;
}

.install-tip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.install-tip p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
}

.day-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 4px;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 0 rgba(22, 50, 74, 0.12);
}

.day-hero .avatar {
  width: 96px;
  height: 96px;
  font-size: 52px;
  background: #fff;
  box-shadow:
    0 0 0 6px color-mix(in srgb, var(--person) 45%, transparent),
    0 12px 0 rgba(22, 50, 74, 0.12);
  animation: pop-in 520ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.day-hero .eyebrow {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.92;
}

.day-hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 10vw, 3.6rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
}

.day-hero .date-line {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
}

.progress-pill {
  min-width: 170px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 6px 0 rgba(22, 50, 74, 0.1);
  text-shadow: none;
}

.progress-pill .meter {
  width: 54px;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eef5;
}

.progress-pill .meter > span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--person));
  transition: width 420ms ease;
}

.celebration-banner {
  padding: 14px 18px;
  border-radius: 20px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f5132;
  background: linear-gradient(135deg, #d8ffe8, #fff7b0);
  box-shadow: 0 6px 0 rgba(22, 50, 74, 0.08);
  animation: pop-in 480ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.top-actions {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 12px;
  display: flex;
  gap: 8px;
}

.ghost-button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(22, 50, 74, 0.08);
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-block > h2 {
  margin: 0;
  padding-left: 6px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-shadow: 0 2px 0 rgba(22, 50, 74, 0.12);
}

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

.task-button {
  width: 100%;
  min-height: 84px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 7px 0 rgba(22, 50, 74, 0.1);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.task-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 4px 0 rgba(22, 50, 74, 0.1);
}

.task-button.done {
  background: color-mix(in srgb, var(--teal) 14%, #fff);
}

.task-button.done .task-title {
  text-decoration: line-through;
  opacity: 0.72;
}

.task-button.reminder {
  opacity: 0.95;
}

.task-emoji {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: color-mix(in srgb, var(--person) 18%, #fff7e8);
  font-size: 26px;
}

.task-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.15;
}

.task-meta {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.task-check {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e7eef5;
  color: transparent;
  font-size: 18px;
  font-weight: 700;
}

.task-button.done .task-check {
  background: var(--teal);
  color: #fff;
}

.empty-copy {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

.points-hero {
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-radius: 28px;
  background: linear-gradient(145deg, #fff, #fff1b8);
  box-shadow: 0 8px 0 rgba(22, 50, 74, 0.1);
  text-align: center;
}

.points-hero span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.points-hero strong {
  font-size: 3rem;
  line-height: 1;
  color: var(--coral-deep);
}

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

.reward-button {
  width: 100%;
  min-height: 88px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 7px 0 rgba(22, 50, 74, 0.1);
}

.reward-button:disabled {
  opacity: 0.55;
}

.reward-button:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: 0 4px 0 rgba(22, 50, 74, 0.1);
}

.reward-emoji {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff4d6;
  font-size: 28px;
}

.reward-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reward-copy strong {
  font-size: 1.12rem;
}

.reward-copy small {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.reward-cost {
  min-width: 48px;
  padding: 8px 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--coral) 16%, #fff);
  color: var(--coral-deep);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  z-index: 5;
  width: min(420px, calc(100% - 24px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(22, 50, 74, 0.18);
}

.bottom-nav button {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 22px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.bottom-nav button span {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav button.active {
  color: #fff;
  background: linear-gradient(145deg, var(--coral), #ff8a3d);
  box-shadow: 0 4px 0 rgba(226, 67, 51, 0.35);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  z-index: 20;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 18px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 24px rgba(22, 50, 74, 0.25);
}

.toast.error {
  background: #b42318;
}

.parent-pin-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 50, 74, 0.45);
  backdrop-filter: blur(4px);
}

.parent-pin-gate[hidden] { display: none; }

.parent-pin-panel {
  width: min(360px, 100%);
  padding: 22px 18px 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 28px;
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 40px rgba(22, 50, 74, 0.28);
}

.parent-pin-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef3f7;
  font-size: 1.4rem;
}

.parent-pin-lock { font-size: 28px; }

.parent-pin-panel h2 {
  margin: 0;
  font-size: 1.35rem;
}

.parent-pin-panel > p {
  margin: 0;
  color: var(--muted);
}

.parent-pin-display {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 6px 0;
}

.parent-pin-display span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d7e2ec;
}

.parent-pin-display span.filled {
  background: var(--coral);
}

.parent-pin-error {
  color: #b42318;
  font-weight: 600;
}

.parent-pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.parent-pin-pad button {
  min-height: 54px;
  border-radius: 18px;
  background: #eef5fa;
  font-size: 1.35rem;
  font-weight: 700;
}

.parent-pin-pad .parent-pin-action {
  font-size: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(12px, -18px, 0) scale(1.05); }
}

@keyframes pulse-sun {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes spin-soft {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (min-width: 720px) {
  .app {
    width: min(960px, 100%);
    padding-left: 28px;
    padding-right: 28px;
  }

  .chooser-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .app {
    width: min(1120px, 100%);
  }

  .chooser-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
