/* nimiq.kids — Direction A ("Friendly Nimiq"). Nimiq brand tokens, kid-warm treatment.
   Look & feel is Andrew's call (2-3 options presented separately); this is a solid default. */

/* Self-hosted Mulish (single variable woff2, weights 200–1000). This is the reliable
   brand-font path under a strict Nimiq Pay mini-app CSP and offline; the Google Fonts
   <link> in index.html stays as progressive enhancement. Precached in sw.js SHELL. */
@font-face {
  font-family: 'Mulish';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('/fonts/mulish-latin-wght-normal.woff2') format('woff2');
}

:root {
  --navy: #1F2348;
  --purple: #260133;
  --blue: #0582CA;
  --blue-2: #265DD7;
  --green: #21BCA5;
  --green-2: #41A38E;
  --gold: #E9B213;
  --orange: #EC991C;
  --red: #D94432;
  --navy-bg: radial-gradient(120% 120% at bottom right, #260133, #1F2348);
  --blue-bg: radial-gradient(120% 120% at bottom right, #265DD7, #0582CA);
  --green-bg: radial-gradient(120% 120% at bottom right, #41A38E, #21BCA5);
  --gold-bg: radial-gradient(120% 120% at bottom right, #EC991C, #E9B213);
  --bg: #F4F4F7;
  --card: #ffffff;
  --ink: #1F2348;
  --muted: rgba(31, 35, 72, 0.5);
  --line: rgba(31, 35, 72, 0.08);
  --card-shadow: 0 4px 24px rgba(31, 35, 72, 0.10);
  --r-card: 22px;
  --r-pill: 500px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Mulish', 'Muli', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* App frame (phone-width) */
.app { width: 100%; max-width: 460px; flex: 1; display: flex; flex-direction: column; }

/* Header */
.hdr {
  background-image: var(--navy-bg); color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.hdr-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hdr-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* the flag row can get wide with 5 flags — let it shrink and scroll on narrow
   phones instead of pushing the connect button off-screen (layout-integrity) */
.hdr-lang { display: flex; align-items: center; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hdr-lang::-webkit-scrollbar { display: none; }
.hdr-wallet { display: flex; align-items: center; flex-shrink: 0; justify-content: flex-end; }
/* dual-mode connect button (the shell swaps in its profile widget once connected) */
.shell-connect {
  border: none; background: rgba(255,255,255,.14); color: #fff;
  font-weight: 700; font-size: 12.5px; padding: 7px 13px; border-radius: var(--r-pill);
  transition: .2s; white-space: nowrap;
}
.shell-connect:hover { background: rgba(255,255,255,.22); }
.shell-connect:disabled { opacity: .6; cursor: default; }
.hdr-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -0.2px; }
/* Real Nimiq hexagon mark (the SVG carries the gold gradient — no tinted tile/glow) */
.hdr-logo { display: inline-flex; align-items: center; }
.hdr-logo svg { width: 26px; height: 26px; display: block; }
/* keep the flag-hex language switcher buttons tappable (>=36px) on narrow phones */
.hdr-lang button { min-width: 36px; min-height: 36px; }
.role-switch { display: flex; background: rgba(255,255,255,.12); border-radius: var(--r-pill); padding: 3px; align-self: flex-start; }
.role-switch button {
  border: none; background: transparent; color: rgba(255,255,255,.7);
  font-weight: 700; font-size: 12.5px; padding: 7px 14px; border-radius: var(--r-pill); transition: .2s;
}
.role-switch button.on { background: #fff; color: var(--navy); box-shadow: 0 2px 6px rgba(0,0,0,.15); }

/* Scroll body */
.view { flex: 1; padding: 18px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.section-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; padding: 0 4px; }

/* Child picker */
.kids { display: flex; gap: 12px; overflow-x: auto; padding: 2px 4px 6px; scrollbar-width: none; }
.kids::-webkit-scrollbar { display: none; }
.kid-chip { display: flex; flex-direction: column; align-items: center; gap: 7px; flex-shrink: 0; }
.kid-av {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 30px;
  background: #fff; box-shadow: var(--card-shadow); border: 3px solid transparent; transition: .2s;
}
.kid-chip.on .kid-av { border-color: var(--green); transform: scale(1.04); }
.kid-name { font-size: 13px; font-weight: 700; }
.kid-chip.add .kid-av { background: transparent; border: 2px dashed rgba(31,35,72,.22); color: var(--muted); box-shadow: none; font-size: 26px; }

/* Cards */
.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--card-shadow); overflow: hidden; }
.card-hd { padding: 16px 18px 12px; display: flex; align-items: center; justify-content: space-between; }
.card-hd h3 { font-size: 16px; font-weight: 800; }
.card-hd .add { font-size: 13px; font-weight: 800; color: var(--blue); background: rgba(5,130,202,.08); border: none; padding: 7px 12px; border-radius: var(--r-pill); }

/* Chore row */
.chore { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.chore:first-child { border-top: none; }
.chore-ic { width: 46px; height: 46px; border-radius: 12px; background: #F4F4F7; display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }
.chore-main { flex: 1; min-width: 0; }
.chore-title { font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chore-reward { font-size: 13px; font-weight: 800; color: var(--green-2); margin-top: 2px; }
.chore.done { opacity: .5; }
.tag { font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: var(--r-pill); flex-shrink: 0; }
.tag.paid { background: rgba(33,188,165,.14); color: var(--green-2); }
.tag.waiting { background: rgba(236,153,28,.16); color: var(--orange); }

/* Buttons */
.btn { border: none; border-radius: var(--r-pill); font-weight: 800; font-size: 15px; color: #fff; padding: 0 18px; height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .25s cubic-bezier(.25,0,0,1), box-shadow .25s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn.full { width: 100%; }
.btn.blue { background-image: var(--blue-bg); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.btn.green { background-image: var(--green-bg); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.btn.navy { background-image: var(--navy-bg); }
.btn.ghost { background: #fff; color: var(--navy); box-shadow: var(--card-shadow); }
.btn.sm { height: 38px; font-size: 13.5px; padding: 0 16px; min-width: 0; }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 10px; }

/* Approve card (pending) */
.approve-card { padding: 18px; display: flex; align-items: center; gap: 14px; background-image: linear-gradient(135deg,#fff, #fff); border: 1.5px solid rgba(236,153,28,.28); }
.approve-card .chore-ic { background: rgba(236,153,28,.12); }

/* Kid balance hero */
.hero { background-image: var(--navy-bg); color: #fff; border-radius: var(--r-card); padding: 26px 22px; text-align: center; box-shadow: var(--card-shadow); position: relative; overflow: hidden; }
.hero .who { font-size: 15px; font-weight: 700; opacity: .8; display: flex; gap: 8px; justify-content: center; align-items: center; }
.hero .bal { font-size: 52px; font-weight: 900; letter-spacing: -2px; margin: 6px 0 2px; }
.hero .bal .u { font-size: 22px; font-weight: 800; opacity: .8; margin-left: 4px; }
.hero .sub { font-size: 13px; opacity: .65; }
.hero .streak { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.14); border-radius: var(--r-pill); font-size: 12px; font-weight: 800; padding: 5px 11px; }

/* Empty */
.empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 14px; font-weight: 600; }

/* Connect banner */
.banner { background: rgba(233,178,19,.12); border: 1px solid rgba(233,178,19,.4); color: var(--ink); border-radius: 12px; padding: 11px 14px; font-size: 12.5px; font-weight: 700; text-align: center; }

/* Sheet (bottom modal) */
.scrim { position: fixed; inset: 0; background: rgba(26,26,62,.55); backdrop-filter: blur(2px); display: flex; align-items: flex-end; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet { background: #fff; border-radius: 28px 28px 0 0; width: 100%; max-width: 460px; margin: 0 auto; padding: 26px 22px calc(28px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .3s cubic-bezier(.25,0,0,1); max-height: 92dvh; overflow-y: auto; }
.scrim.show .sheet { transform: translateY(0); }
.sheet h2 { font-size: 22px; font-weight: 900; text-align: center; }
.sheet .sub { text-align: center; color: var(--muted); font-size: 14px; margin: 4px 0 16px; font-weight: 600; }
.sheet .amount { text-align: center; font-size: 40px; font-weight: 900; color: var(--green-2); letter-spacing: -1.5px; margin-bottom: 14px; }
.qr-wrap { width: 200px; height: 200px; margin: 0 auto 16px; background: #fff; padding: 12px; border-radius: 18px; box-shadow: var(--card-shadow); display: grid; place-items: center; }
.qr-wrap img, .qr-wrap canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 4px 7px; }
.input { width: 100%; height: 50px; border: none; border-radius: 12px; box-shadow: inset 0 0 0 1.5px rgba(31,35,72,.12); padding: 0 16px; font-size: 16px; font-weight: 600; font-family: inherit; color: var(--ink); background: #fff; }
.input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--blue); }
.emoji-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.emoji-pick button { width: 46px; height: 46px; border-radius: 12px; border: none; background: #F4F4F7; font-size: 24px; transition: .15s; }
.emoji-pick button.on { background: rgba(5,130,202,.14); box-shadow: inset 0 0 0 2px var(--blue); }
.amount-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.amount-pick button { flex: 1; min-width: 64px; height: 44px; border-radius: 12px; border: none; background: #F4F4F7; font-weight: 800; font-size: 15px; color: var(--ink); }
.amount-pick button.on { background-image: var(--green-bg); color: #fff; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Confetti canvas */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; }

/* balance count pop */
@keyframes pop { 0%{transform:scale(1)} 40%{transform:scale(1.18)} 100%{transform:scale(1)} }
.bal.pop { animation: pop .5s cubic-bezier(.25,0,0,1); }

@keyframes floatUp { from { opacity:0; transform: translateY(8px);} to {opacity:1; transform:none;} }
.view > * { animation: floatUp .3s ease both; }

/* Receipt + proof */
.receipt-link { border: none; background: rgba(31,35,72,.06); border-radius: var(--r-pill); width: 30px; height: 30px; font-size: 13px; flex-shrink: 0; margin-right: 2px; }
.receipt-box { background: #F4F4F7; border-radius: 12px; padding: 4px 16px; margin-bottom: 14px; }
.rrow { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.rrow:first-child { border-top: none; }
.rrow span { color: var(--muted); font-weight: 600; }
.rrow b { font-weight: 800; font-variant-numeric: tabular-nums; }
.microline { background: rgba(233,178,19,.12); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-size: 12.5px; font-weight: 700; text-align: center; margin-bottom: 14px; }
.pollnote { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 12px; min-height: 18px; }
a.btn { text-decoration: none; }

/* Weekly leaderboard */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.lb-row + .lb-row { border-top: 1px solid var(--line); }
.lb-rank { width: 26px; text-align: center; font-size: 19px; font-weight: 800; flex-shrink: 0; }
.lb-amt { font-size: 14px; font-weight: 800; color: var(--green-2); flex-shrink: 0; font-variant-numeric: tabular-nums; }
