/* ============================================================
   Aya's Coins — iOS-native design language
   Tokens sourced from /DESIGN.md (Aya's Coins — iOS Kid spec)
   ============================================================ */
:root {
  /* --- colors (from DESIGN.md) --- */
  --c-primary: #D42A5F;      /* Aya Pink — high-emphasis actions only */
  --c-secondary: #5AC8FA;    /* Sky — informational accents */
  --c-tertiary: #FFC542;     /* Coin Gold — currency, always */
  --c-neutral: #F2F2F7;      /* iOS systemGray6 canvas */
  --c-success: #188039;
  --c-warning: #A65800;
  --c-danger: #D6362B;
  --c-ink: #1C1C1E;
  --c-ink-muted: #6E6E73;
  --c-surface: #FFFFFF;
  --c-border: #E5E5EA;
  --c-purple: #8E3FB0;

  /* --- type --- */
  --font-rounded: -apple-system, "SF Pro Rounded", ui-rounded, system-ui, sans-serif;
  --font-text: -apple-system, "SF Pro Text", system-ui, sans-serif;

  /* --- radius --- */
  --r-xs: 8px; --r-sm: 12px; --r-md: 18px; --r-lg: 24px; --r-xl: 32px; --r-pill: 999px;

  /* --- spacing --- */
  --sp-xs: 4px; --sp-sm: 8px; --sp-md: 16px; --sp-lg: 24px; --sp-xl: 32px; --sp-xxl: 48px;

  /* --- elevation: soft, diffuse, iOS-style --- */
  --shadow-card: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-card-lg: 0 2px 6px rgba(0,0,0,.05), 0 16px 40px rgba(0,0,0,.09);
  --shadow-sheet: 0 -2px 8px rgba(0,0,0,.05), 0 -24px 60px rgba(0,0,0,.12);

  /* --- motion: iOS spring overshoot --- */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { height: 100%; }
body {
  font-family: var(--font-text);
  background: var(--c-neutral);
  color: var(--c-ink);
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}
#app { display: flex; flex-direction: column; height: 100dvh; }

/* ---------- top bar: iOS large-title style, blurred ---------- */
#topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 12px;
  background: rgba(242,242,247,.82);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--c-border);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-icon { width: 30px; height: 30px; border-radius: var(--r-xs); }
.brand-name { color: var(--c-ink); font-weight: 800; font-family: var(--font-rounded); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36vw; letter-spacing: -.01em; }
.top-chips { display: flex; gap: 8px; }
.chip {
  border: none; border-radius: var(--r-pill); padding: 7px 13px; font-family: var(--font-rounded);
  font-size: 14.5px; font-weight: 800; cursor: pointer;
  transition: transform .12s var(--ease-out);
  background: var(--c-surface); color: var(--c-ink); box-shadow: var(--shadow-card);
}
.chip:active { transform: scale(.93); }
.chip-gold { color: #8a6d1a; }
.chip-flame { color: var(--c-danger); }
.chip-sound { color: var(--c-secondary); padding: 7px 10px; }

/* ---------- main ---------- */
#view { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: var(--sp-md) var(--sp-md) 28px; }
.page-title { font-family: var(--font-rounded); font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 12px; }
.page-sub { font-size: 14px; color: var(--c-ink-muted); font-weight: 600; margin: -8px 0 14px; }
.section-label {
  font-family: var(--font-text); font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--c-ink-muted); margin: 22px 4px 8px;
}

/* ---------- cards & buttons ---------- */
.card { background: var(--c-surface); border-radius: var(--r-lg); padding: var(--sp-md); box-shadow: var(--shadow-card); margin-bottom: var(--sp-md); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-rounded); font-weight: 800; font-size: 16.5px; color: #fff;
  background: var(--c-primary); border: none; border-radius: var(--r-pill); padding: 15px 20px;
  cursor: pointer; transition: transform .12s var(--ease-out); width: 100%;
}
.btn:active { transform: scale(.97); }
.btn-blue { background: var(--c-secondary); color: #063a52; }
.btn-pink { background: var(--c-primary); }
.btn-purple { background: var(--c-purple); }
.btn-gray { background: var(--c-neutral); color: var(--c-ink); border: 1.5px solid var(--c-border); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ============================================================
   FOCUS MODE — the one-big-task home screen
   ============================================================ */
.focus-card {
  background: linear-gradient(180deg, #FFF0F5 0%, #FFFFFF 62%);
  border-radius: var(--r-xl);
  padding: var(--sp-xl) var(--sp-lg) var(--sp-lg);
  text-align: center;
  box-shadow: var(--shadow-card-lg);
  margin-bottom: var(--sp-md);
  animation: focusIn .5s var(--ease-spring);
}
.focus-card--done { background: linear-gradient(180deg, #EFFBF3 0%, #FFFFFF 62%); }
@keyframes focusIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.focus-slot {
  font-family: var(--font-text); font-size: 12.5px; font-weight: 800; letter-spacing: .04em;
  color: var(--c-ink-muted); text-transform: uppercase; margin-bottom: 10px;
}
.focus-mascot { display: block; margin: 0 auto var(--sp-md); filter: drop-shadow(0 8px 16px rgba(0,0,0,.08)); animation: focusMascotBob 3.2s ease-in-out infinite; }
@keyframes focusMascotBob { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-7px) rotate(-1.5deg); } }
.focus-task {
  font-family: var(--font-rounded); font-size: 3.1rem; font-weight: 800; letter-spacing: -.025em;
  line-height: 1.05; color: var(--c-ink); margin-bottom: 12px; word-break: break-word;
}
.focus-reward {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-rounded);
  font-size: 16px; font-weight: 700; color: #8a6d1a; background: #FFF3D6;
  border-radius: var(--r-pill); padding: 6px 16px; margin-bottom: var(--sp-lg);
}
.focus-reward b { font-size: 18px; }
.focus-later { font-size: 13px; font-weight: 600; color: var(--c-ink-muted); margin: -14px 0 18px; }
.focus-confirm {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; border: none; border-radius: var(--r-pill);
  background: var(--c-primary); color: #fff;
  font-family: var(--font-rounded); font-size: 22px; font-weight: 800;
  padding: 24px; cursor: pointer;
  box-shadow: 0 8px 20px rgba(212,42,95,.32);
  transition: transform .14s var(--ease-spring), box-shadow .14s var(--ease-out);
}
.focus-confirm:active { transform: scale(.96); box-shadow: 0 4px 10px rgba(212,42,95,.28); }
.fc-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.25); font-size: 15px;
}
.focus-say {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: none; background: none; color: var(--c-secondary);
  font-family: var(--font-rounded); font-weight: 700; font-size: 14.5px;
  padding: 14px; margin-top: 4px; cursor: pointer;
}
.fs-orb { font-size: 16px; }
.focus-sub { color: var(--c-ink-muted); font-weight: 600; font-size: 14.5px; margin-top: 4px; }
.focus-upnext { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 18px; }
.focus-upnext span { font-size: 11.5px; font-weight: 800; color: var(--c-ink-muted); letter-spacing: .04em; text-transform: uppercase; margin-right: 2px; }
.focus-upnext i { font-style: normal; font-size: 19px; opacity: .55; }

/* tiny link-style button under the focus card — opens the day list sheet */
.see-day-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; border: none; background: none; cursor: pointer;
  color: var(--c-ink-muted); font-family: var(--font-rounded); font-size: 13.5px;
  font-weight: 800; padding: 10px; margin-bottom: var(--sp-md);
}
.see-day-btn:active { transform: scale(.97); }

/* home strip: quiet stat row under the focus card */
.home-strip { display: flex; align-items: center; gap: 8px; margin-bottom: var(--sp-sm); }
.strip-pill {
  border: none; background: var(--c-surface); color: var(--c-ink); font-family: var(--font-rounded);
  font-weight: 800; font-size: 13.5px; border-radius: var(--r-pill); padding: 9px 14px;
  box-shadow: var(--shadow-card); cursor: pointer;
}
.strip-stat {
  flex: 1; text-align: center; background: var(--c-surface); border-radius: var(--r-pill);
  padding: 9px 6px; font-family: var(--font-rounded); font-weight: 700; font-size: 13px;
  color: var(--c-ink-muted); box-shadow: var(--shadow-card);
}
.strip-stat b { color: var(--c-ink); font-weight: 800; }

.xp-wrap { margin-bottom: var(--sp-sm); }
.xp-track { height: 10px; background: var(--c-surface); border-radius: var(--r-pill); overflow: hidden; margin-bottom: 6px; box-shadow: inset 0 0 0 1px var(--c-border); }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--c-purple), var(--c-secondary)); border-radius: var(--r-pill); transition: width .7s var(--ease-spring); }
.xp-caption { font-size: 12px; color: var(--c-ink-muted); font-weight: 700; text-align: center; }

/* whole-day-at-a-glance list — quiet, secondary, never competes with focus card */
.day-queue { background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.dq-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--c-border); cursor: pointer;
}
.dq-row:last-child { border-bottom: none; }
.dq-emoji { font-size: 19px; width: 26px; text-align: center; flex: none; }
.dq-name { flex: 1; font-weight: 600; font-size: 14.5px; color: var(--c-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dq-meta { font-size: 12px; font-weight: 700; color: var(--c-ink-muted); flex: none; }
.dq-state { width: 20px; text-align: center; font-weight: 800; color: var(--c-success); flex: none; }
.dq-done { opacity: .48; }
.dq-done .dq-name { text-decoration: line-through; }
.dq-current { background: linear-gradient(90deg, #FFF0F5, transparent); }
.dq-current .dq-name { font-weight: 800; color: var(--c-primary); }

/* legacy chore row (kept for compatibility / day-queue fallback contexts) */
.chore { display: flex; align-items: center; gap: 12px; background: var(--c-surface); border-radius: var(--r-lg); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow-card); }
.chore-emoji { font-size: 30px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--c-neutral); border-radius: var(--r-md); flex: none; }
.chore-main { flex: 1; min-width: 0; }
.chore-name { font-weight: 700; font-size: 16px; }
.chore-reward { font-size: 13px; color: var(--c-ink-muted); font-weight: 600; margin-top: 2px; }
.chore-go { flex: none; border: none; font-family: var(--font-rounded); font-weight: 800; font-size: 14.5px; background: var(--c-primary); color: #fff; border-radius: var(--r-pill); padding: 11px 16px; cursor: pointer; }
.chore-go:active { transform: scale(.95); }
.chore.done { opacity: .5; }
.chore.done .chore-go { background: var(--c-neutral); color: var(--c-ink-muted); }

/* ---------- shop ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.item { background: var(--c-surface); border-radius: var(--r-lg); padding: 14px; text-align: center; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 8px; }
.item-emoji { font-size: 42px; line-height: 1; }
.item-name { font-weight: 700; font-size: 15px; }
.item-price { font-weight: 800; color: #8a6d1a; font-size: 15.5px; font-family: var(--font-rounded); }
.item .btn { width: 100%; padding: 10px 12px; font-size: 14px; }
.item.cant { opacity: .6; }
.item.owned { box-shadow: var(--shadow-card), inset 0 0 0 2px var(--c-success); }
.badge-owned { font-size: 11.5px; font-weight: 800; color: var(--c-success); }

/* ---------- bank / history ---------- */
.balance-hero { text-align: center; padding: 28px 16px; background: linear-gradient(180deg,#FFF8E6,#FFFFFF); border-radius: var(--r-xl); margin-bottom: var(--sp-md); box-shadow: var(--shadow-card-lg); }
.balance-hero .amt { font-family: var(--font-rounded); font-size: 42px; font-weight: 800; color: #6B4E00; letter-spacing: -.02em; }
.balance-hero .lbl { font-weight: 700; color: #8a6d1a; margin-top: 2px; font-size: 14px; }
.tx { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--c-border); font-size: 14.5px; }
.tx:last-child { border-bottom: none; }
.tx .t-ico { width: 30px; height: 30px; border-radius: var(--r-xs); display: flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
.tx .t-ico.in { background: #E4F6EA; }
.tx .t-ico.out { background: #FDEBED; }
.tx .t-main { flex: 1; min-width: 0; }
.tx .t-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .t-time { font-size: 11.5px; color: var(--c-ink-muted); font-weight: 600; }
.t-amt { font-weight: 800; font-family: var(--font-rounded); }
.t-amt.in { color: var(--c-success); }
.t-amt.out { color: var(--c-primary); }

/* ---------- parent ---------- */
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 20px 0; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--c-border); transition: all .15s var(--ease-out); }
.pin-dot.filled { background: var(--c-primary); border-color: var(--c-primary); transform: scale(1.1); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 74px); gap: 12px; justify-content: center; }
.pin-key {
  font-family: var(--font-rounded); font-size: 24px; font-weight: 700; padding: 17px 0;
  background: var(--c-surface); border: none; border-radius: var(--r-md); cursor: pointer;
  box-shadow: var(--shadow-card); transition: transform .1s var(--ease-out);
}
.pin-key:active { transform: scale(.92); }
.parent-row { display: flex; align-items: center; gap: 12px; background: var(--c-surface); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow-card); }
.parent-row .pr-main { flex: 1; min-width: 0; }
.parent-row .pr-name { font-weight: 700; font-size: 15px; }
.parent-row .pr-sub { font-size: 12px; color: var(--c-ink-muted); font-weight: 600; margin-top: 2px; }
.icon-btn { border: none; font-size: 17px; background: var(--c-neutral); width: 38px; height: 38px; border-radius: var(--r-sm); cursor: pointer; flex: none; }
.approve-btn { border: none; font-family: var(--font-rounded); font-weight: 800; background: var(--c-success); color: #fff; border-radius: var(--r-sm); padding: 10px 14px; cursor: pointer; flex: none; font-size: 13.5px; }
.deny-btn { border: none; font-family: var(--font-rounded); font-weight: 800; background: var(--c-danger); color: #fff; border-radius: var(--r-sm); padding: 10px 14px; cursor: pointer; flex: none; font-size: 13.5px; }

input.field, select.field {
  width: 100%; font-family: var(--font-text); font-size: 16px; font-weight: 600; color: var(--c-ink);
  padding: 13px 14px; border: 1.5px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); outline: none;
  margin-bottom: 10px;
}
input.field:focus { border-color: var(--c-primary); }
.emoji-pick { font-size: 24px; display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.emoji-pick button { font-size: 22px; background: var(--c-neutral); border: none; border-radius: var(--r-sm); width: 42px; height: 42px; cursor: pointer; }
.emoji-pick button.sel { background: var(--c-tertiary); }

/* ---------- tab bar: iOS bottom tabs ---------- */
#tabbar {
  flex: none; display: flex; background: rgba(255,255,255,.86);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--c-border);
  padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px);
  z-index: 5;
}
.tab {
  flex: 1; border: none; background: none; font-family: var(--font-text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px;
  color: var(--c-ink-muted);
}
.tab-ico { font-size: 22px; opacity: .55; transition: transform .15s var(--ease-spring), opacity .15s; }
.tab-lbl { font-size: 10.5px; font-weight: 700; }
.tab.is-active { color: var(--c-primary); }
.tab.is-active .tab-ico { opacity: 1; transform: scale(1.08); }

/* ---------- overlays / sheets: iOS action-sheet blur ---------- */
#overlays { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.overlay-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn .2s var(--ease-out); }
.sheet {
  position: relative; width: min(90vw, 400px); max-height: 84dvh; overflow-y: auto;
  background: var(--c-surface); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow-sheet);
  animation: sheetIn .32s var(--ease-spring);
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes sheetIn { from { transform: scale(.9) translateY(14px); opacity: 0; } }
.bigmoji { font-size: 60px; text-align: center; animation: bounceIn .5s var(--ease-spring); }
@keyframes bounceIn { 0% { transform: scale(.2); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.sheet h2 { font-family: var(--font-rounded); text-align: center; font-size: 20px; font-weight: 800; margin: 10px 0 6px; letter-spacing: -.01em; }
.sheet p.center { text-align: center; color: var(--c-ink-muted); font-weight: 600; font-size: 14.5px; margin-bottom: 14px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.toast-wrap { position: absolute; left: 0; right: 0; bottom: 100px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.toast {
  background: rgba(28,28,30,.92); backdrop-filter: blur(10px); color: #fff; font-weight: 700; font-size: 14px;
  padding: 11px 18px; border-radius: var(--r-pill); animation: toastIn .25s var(--ease-spring), toastOut .3s ease 2.2s forwards;
  max-width: 86vw; text-align: center;
}
@keyframes toastIn { from { transform: translateY(14px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(8px); opacity: 0; } }

/* coin burst */
.coin-burst { position: absolute; font-size: 26px; animation: coinFly 1s var(--ease-out) forwards; will-change: transform, opacity; }
@keyframes coinFly {
  0% { transform: translate(0,0) scale(.6); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.15); opacity: 0; }
}
#fx { position: fixed; inset: 0; z-index: 49; pointer-events: none; }

/* ---------- welcome ---------- */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; gap: 6px; background: var(--c-neutral); }
.welcome img.logo { width: 128px; height: 128px; border-radius: var(--r-xl); box-shadow: var(--shadow-card-lg); animation: bounceIn .8s var(--ease-spring); }
.welcome h1 { font-family: var(--font-rounded); font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin-top: 16px; }
.welcome p { color: var(--c-ink-muted); font-weight: 600; font-size: 16px; max-width: 300px; }
.welcome .btn { width: min(320px, 80vw); margin-top: 10px; }
.install-hint { margin-top: 22px; font-size: 12.5px; color: var(--c-ink-muted); font-weight: 500; max-width: 300px; line-height: 1.5; }
.mic-orb {
  width: 88px; height: 88px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--c-secondary); box-shadow: 0 8px 20px rgba(90,200,250,.4); font-size: 36px; color: #fff;
  transition: transform .12s var(--ease-spring);
}
.mic-orb:active { transform: scale(.92); }
.mic-orb.listening { background: var(--c-primary); box-shadow: 0 8px 20px rgba(212,42,95,.4); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 8px 20px rgba(212,42,95,.4), 0 0 0 0 rgba(212,42,95,.4);} 50% { box-shadow: 0 8px 20px rgba(212,42,95,.4), 0 0 0 16px rgba(212,42,95,0);} }
