/* Savings Challenge app: Quality Hunt brand, the same colours and fonts as the website (app/globals.css) */
@font-face { font-family: "Bricolage Grotesque"; src: url(fonts/bricolage.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url(fonts/dm-sans.woff2) format("woff2"); font-weight: 100 1000; font-display: swap; }
:root {
  --bg: #F1F3F0; --wall: #DCE6E1; --floor: #C7D6CF; --ink: #1B2A28; --euc: #2F6B62; --mus: #E2A93B;
  --mus-soft: #F0CF7A; --brick: #B4553A; --brick-text: #9E4931; --soft-ink: #3C4A48; --muted: #6B7875; --line: #E3E8E5;
  --head: "Bricolage Grotesque", system-ui, sans-serif; --body: "DM Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { font-family: var(--body); color: var(--ink); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; text-align: inherit; }
h1, h2, h3 { font-family: var(--head); font-weight: 800; letter-spacing: -.02em; }
:focus-visible { outline: 3px solid var(--euc); outline-offset: 2px; }
.px { image-rendering: pixelated; }
.loading { text-align: center; color: var(--muted); padding: 40vh 20px 0; margin: 0; }

#app { height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; background: var(--bg); }

/* top bar, like the website header */
.bar { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 12px) 18px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.bar b { font-family: var(--head); font-size: 18px; font-weight: 800; }
.pill-sm { margin-left: auto; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }

.screen { flex: 1; overflow-y: auto; overflow-x: hidden; padding: calc(env(safe-area-inset-top) + 28px) 18px 24px; animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
.bar + .screen { padding-top: 18px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
h2 { font-size: 30px; line-height: 1.08; margin: 12px 0 8px; }
.lead { color: var(--soft-ink); margin: 0 0 18px; font-size: 16px; line-height: 1.5; }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--brick-text); font-weight: 700; }
.uline { position: relative; white-space: nowrap; }
.uline svg { position: absolute; left: -2%; bottom: -8px; width: 104%; height: 12px; }
.uline path { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw .8s .35s cubic-bezier(.6,0,.3,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.dots { display: flex; gap: 6px; margin: 2px 0 6px; }
.dots i { width: 26px; height: 6px; border-radius: 3px; background: var(--floor); }
.dots i.on { background: var(--euc); }

/* a villager talking */
.talk { display: flex; gap: 10px; align-items: flex-end; margin: 6px 0 16px; }
.talk img { width: 56px; height: 56px; flex: none; border-radius: 14px; background: var(--wall); }
.bubble { background: #fff; border-radius: 18px 18px 18px 4px; padding: 10px 14px; font-size: 15px; line-height: 1.4; box-shadow: 0 1px 0 rgba(27,42,40,.06); }
.bubble small { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--brick-text); font-weight: 700; margin-bottom: 2px; }

/* challenge cards, like the website's category cards */
.card { width: 100%; text-align: left; border-radius: 24px; padding: 18px 18px 16px; margin-bottom: 12px; display: block; transition: transform .2s, box-shadow .2s; position: relative; }
.card:active { transform: scale(.98); }
.card svg.ic { width: 28px; height: 28px; }
.card h3 { font-size: 21px; margin: 8px 0 4px; }
.card p { margin: 0 0 10px; font-size: 14px; opacity: .92; }
.card .go { font-weight: 700; font-size: 14px; }
.card .tag { position: absolute; top: 16px; right: 16px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.c-euc { background: var(--euc); color: #fff; } .c-euc .ic { stroke: var(--mus-soft); }
.c-brick { background: var(--brick); color: #fff; } .c-brick .ic { stroke: var(--mus-soft); }
.c-mus { background: var(--mus-soft); color: var(--ink); } .c-mus .ic { stroke: var(--ink); }
.c-wall { background: var(--wall); color: var(--ink); } .c-wall .ic { stroke: var(--euc); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { padding: 11px 16px; border-radius: 99px; background: #fff; font-weight: 700; font-size: 15px; border: 1.5px solid #D5DDD9; }
.chip-cal { display: inline-flex; align-items: center; gap: 6px; }
.chip-cal svg { width: 17px; height: 17px; stroke: currentColor; }
.date-pick { position: fixed; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; }
.chip.sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.label { font-family: var(--head); font-weight: 800; font-size: 17px; margin: 4px 0 10px; }

/* pill buttons, like the website */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 16px 20px; border-radius: 99px; font-weight: 700; font-size: 17px; text-align: center; transition: transform .1s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; stroke: currentColor; }
.b-euc { background: var(--euc); color: #fff; }
.b-mus { background: var(--mus); color: var(--ink); }
.b-line { border: 1.5px solid var(--ink); color: var(--ink); }
.btn + .btn { margin-top: 10px; }
.back { display: block; margin: 14px auto 0; color: var(--soft-ink); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-align: center; }

/* home: the savings box */
.hero { background: var(--wall); border-radius: 28px; padding: 18px 18px 16px; position: relative; overflow: hidden; }
.hero .row1 { display: flex; justify-content: space-between; gap: 6px; }
.hero .amt { font-family: var(--head); font-weight: 800; font-size: 46px; line-height: 1; margin: 6px 0 14px; letter-spacing: -.03em; }
.hero .amt.small { font-size: 34px; }
.catbox { width: 132px; height: 132px; flex: none; margin: -10px -6px -4px 0; transform-origin: 50% 100%; }
.meter { height: 14px; border-radius: 99px; background: #fff; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--euc); transition: width .7s cubic-bezier(.2,.7,.2,1); }
.meta { display: flex; justify-content: space-between; font-size: 13px; margin-top: 7px; color: var(--soft-ink); }
.meta b { color: var(--ink); }
.draw { font-size: 13px; font-weight: 700; color: var(--euc); text-decoration: underline; text-underline-offset: 3px; margin-top: -6px; display: inline-block; }
.note { background: #fff; border-radius: 20px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; margin-top: 12px; font-size: 14px; line-height: 1.4; }
.note svg { width: 26px; height: 26px; flex: none; stroke: var(--euc); }
.note b { display: block; font-size: 15px; }
.note .x { margin-left: auto; color: var(--muted); font-size: 20px; padding: 4px 6px; }

/* board: one checked box per deposit */
.grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.grid.g10 { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.box { aspect-ratio: 1; border-radius: 10px; background: #fff; border: 1.5px solid #D5DDD9; font-weight: 700; font-size: 13px; display: grid; place-items: center; text-align: center; line-height: 1; transition: transform .12s, background .2s; }
.box small { display: block; font-size: 9px; font-weight: 500; color: var(--muted); margin-bottom: 3px; }
.g10 .box { font-size: 9px; border-radius: 7px; }
.box:active { transform: scale(.9); }
.box.done { background: var(--euc); border-color: var(--euc); color: #fff; }
.box.done svg { width: 55%; height: 55%; }
.box.next { border: 2px solid var(--mus); background: #FFF8E6; }

/* stamps from the villagers */
.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge { background: #fff; border-radius: 20px; padding: 14px 12px; text-align: center; position: relative; }
.badge img { width: 64px; height: 64px; border-radius: 16px; background: var(--wall); filter: grayscale(1); opacity: .4; }
.badge.got img { filter: none; opacity: 1; background: var(--mus-soft); }
.badge b { display: block; font-family: var(--head); font-size: 16px; margin-top: 6px; }
.badge span { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; line-height: 1.35; }
.badge.got span { color: var(--euc); font-weight: 700; }
.badge .stamp { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--mus); display: grid; place-items: center; }
.badge .stamp svg { width: 16px; height: 16px; }

/* settings */
.group { font-family: var(--head); font-weight: 800; font-size: 15px; margin: 20px 0 8px; color: var(--soft-ink); }
.row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #fff; border-radius: 18px; padding: 15px 16px; margin-bottom: 8px; font-size: 15px; text-align: left; }
.row span { color: var(--soft-ink); text-align: right; }
a.row { color: inherit; text-decoration: none; }
.row.warn b { color: var(--brick-text); }
.foot { text-align: center; font-size: 12px; color: var(--muted); margin: 22px 0 4px; line-height: 1.5; }

.tabs { display: flex; background: #fff; border-top: 1px solid var(--line); padding: 8px 4px calc(env(safe-area-inset-bottom) + 10px); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.tabs svg { width: 24px; height: 24px; stroke: currentColor; }
.tabs button.on { color: var(--euc); }

/* bottom sheets */
.sheet { position: absolute; inset: 0; background: rgba(27,42,40,.5); display: flex; align-items: flex-end; z-index: 10; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet > div { background: var(--bg); width: 100%; max-height: 92%; overflow-y: auto; border-radius: 28px 28px 0 0; padding: 22px 18px calc(env(safe-area-inset-bottom) + 26px); animation: up .3s cubic-bezier(.2,.7,.2,1); }
@keyframes up { from { transform: translateY(100%); } }
.sheet h2 { font-size: 26px; }
.steps { background: #fff; border-radius: 20px; padding: 14px 16px 14px 36px; margin: 0 0 12px; line-height: 1.55; font-size: 15px; }
.steps li + li { margin-top: 6px; }
.steps-title { font-family: var(--head); font-weight: 800; font-size: 16px; margin: 14px 0 8px; display: flex; gap: 8px; align-items: center; }
.steps-title svg { width: 20px; height: 20px; flex: none; stroke: var(--euc); }
.key { white-space: nowrap; display: inline-block; background: var(--wall); border-radius: 6px; padding: 0 6px; font-weight: 700; }

.toast { position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: 90%; top: calc(env(safe-area-inset-top) + 70px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; font-weight: 700; z-index: 20; text-align: center; animation: rise .25s both; }
.fly { position: absolute; left: 0; top: 0; z-index: 25; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .uline path { stroke-dashoffset: 0; }
}

/* welcome + quiz */
.welcome-cat { display: flex; justify-content: center; margin: 4px 0 -4px; }
.welcome-cat .catbox { width: 170px; height: 170px; margin: 0; }
.opt { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #fff; border: 1.5px solid #D5DDD9; border-radius: 20px; padding: 18px; margin-bottom: 10px; font-size: 17px; font-weight: 700; text-align: left; transition: transform .1s, border-color .15s; }
.opt:active { transform: scale(.98); }
.opt b { color: var(--euc); font-size: 20px; }
.opt.sel { border-color: var(--euc); background: #EEF6F2; }
.reasons { list-style: none; padding: 0; margin: 4px 0 18px; }
.reasons li { display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; font-size: 15px; line-height: 1.4; }
.reasons svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* pace line, custom goal field, undo */
.pace-row { margin-top: 4px; flex-wrap: wrap; gap: 4px 12px; }
.pace { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--brick-text, #9E4931); }
.pace.ok { color: var(--euc); }
.pace svg { width: 15px; height: 15px; }
.field { display: flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--ink); border-radius: 18px; padding: 6px 16px; margin-bottom: 10px; }
.field span { font-family: var(--head); font-weight: 800; font-size: 26px; }
.field input { border: 0; outline: 0; background: transparent; font: 800 26px var(--head); color: var(--ink); width: 100%; min-width: 0; }
.err { color: #9E4931; font-weight: 700; font-size: 14px; margin: 0 0 10px; }
.toast .undo { margin-left: 12px; color: #F0CF7A; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; padding: 2px 0; }

/* ---------- responsive: the app fills tablets and computers, not just a phone-sized strip ---------- */
/* large phones and small tablets: keep a comfortable reading width */
@media (min-width: 560px) {
  .screen { padding-left: max(24px, calc((100% - 600px) / 2)); padding-right: max(24px, calc((100% - 600px) / 2)); }
  .bar { padding-left: 24px; padding-right: 24px; }
}
/* tablets and computers: header across the top, menu down the left, roomy content */
@media (min-width: 760px) {
  #app { display: grid; grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .bar { grid-column: 1 / -1; padding: 14px 28px; }
  .bar b { font-size: 20px; }
  .pill-sm { font-size: 13px; padding: 6px 14px; }
  .tabs { grid-column: 1; grid-row: 2; flex-direction: column; justify-content: flex-start; gap: 4px; border-top: 0; border-right: 1px solid var(--line); padding: 20px 14px; }
  .tabs button { flex: none; flex-direction: row; gap: 12px; font-size: 15px; padding: 12px 14px; border-radius: 14px; }
  .tabs button.on { background: #EEF6F2; }
  .tabs button:hover { color: var(--euc); }
  .screen { grid-column: 2; grid-row: 2; padding: 36px max(36px, calc((100% - 980px) / 2)) 40px; }
  /* the set-up screens (welcome, quiz, goal, payday) have no menu: one centred column */
  #app > .screen:first-child { grid-column: 1 / -1; grid-row: 1 / -1; padding: 56px max(24px, calc((100% - 580px) / 2)) 48px; }
  h2 { font-size: 36px; }
  .btn:hover, .opt:hover, .chip:hover, .row:hover, .card:hover { filter: brightness(.97); }
  .card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(27,42,40,.1); }
  /* home: savings box on the left, the next step on the right */
  .home-b > div:first-child { margin-top: 18px !important; }
  .home .hero { padding: 26px 26px 22px; }
  .home .hero .amt { font-size: 60px; }
  .home .catbox { width: 170px; height: 170px; }
  .grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
  .grid.g10 { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; }
  .box, .g10 .box { font-size: 14px; border-radius: 12px; }
  .box:hover:not(.done) { border-color: var(--euc); }
  .badges { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .settings { max-width: 640px; }
  /* pop-ups open in the middle of the screen instead of sliding up from the bottom */
  .sheet { align-items: center; justify-content: center; padding: 24px; }
  .sheet > div { max-width: 520px; max-height: 88%; border-radius: 28px; padding: 28px 28px 30px; animation: rise .3s cubic-bezier(.2,.7,.2,1); }
  .toast { top: 84px; }
}
.home-board { display: none; }
@media (min-width: 760px) {
  .home-board { display: block; margin-top: 30px; }
  .home-board .label span { font-family: var(--body); font-weight: 500; font-size: 14px; color: var(--muted); margin-left: 8px; }
}
@media (min-width: 1000px) {
  #app { grid-template-columns: 230px minmax(0, 1fr); }
  .home { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .home-b > div:first-child { margin-top: 0 !important; }
  .grid { grid-template-columns: repeat(13, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .badges { grid-template-columns: repeat(6, 1fr); }
}

/* currency picker line on the goal screen */
.curline { display: block; font-size: 14px; color: var(--soft-ink); margin: -8px 0 14px; text-decoration: underline; text-underline-offset: 3px; }
.curline b { color: var(--ink); }
.peek { text-align: center; font-size: 13px; color: var(--muted); margin: 16px 0 4px; line-height: 1.5; }
.peek a { color: var(--euc); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.bubble a.draw { display: inline; }
/* Sidebar shop link: computers only (the phone's bottom bar stays at 4 buttons), pinned quietly at the bottom */
.tab-shop { display: none; }
@media (min-width: 760px) {
  .tab-shop { display: flex; align-items: center; gap: 12px; margin-top: auto; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.35; }
  .tab-shop svg { width: 22px; height: 22px; flex: none; stroke: currentColor; }
  .tab-shop b { display: block; font-size: 14px; color: var(--ink); }
  .tab-shop:hover { color: var(--euc); border-color: var(--euc); }
}
@media (min-width: 760px) { .peek.phone-only { display: none; } }
.home-link { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; border-radius: 10px; }
.home-link:hover b { text-decoration: underline; text-decoration-color: var(--mus); text-underline-offset: 4px; }
