:root {
  --bg: #0a0a0a; --surface: #141414; --surface-2: #1b1b1b; --line: rgba(255, 255, 255, .07);
  --text: #f4f1ea; --muted: #8b877f; --dim: #5d5a55;
  --gold: #d9c59c; --gold-2: #a8916a; --green: #74e0a4; --red: #ff8a7a;
  --radius: 22px; --sans: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; --serif: "Instrument Serif", Georgia, serif;
  --tabbar: 74px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 var(--sans); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; padding: 0 20px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); }
.view { display: none; animation: rise .45s cubic-bezier(.2, .8, .2, 1); }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* type */
.eyebrow { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.hero { padding: calc(28px + env(safe-area-inset-top)) 0 22px; }
.hero.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
h1 { margin: 10px 0 0; font-size: 40px; line-height: 1.02; font-weight: 800; letter-spacing: -.035em; }
h1 em, .serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; color: var(--gold); }
.sub { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.section-label { margin: 26px 2px 12px; }

/* surfaces */
.neu {
  background: linear-gradient(160deg, #181818, #101010); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 40px -24px rgba(0, 0, 0, .9);
}
.press { transition: transform .12s ease, box-shadow .12s ease; }
.press:active, .tile:active, .cta:active, .pill:active, .quick button:active { transform: scale(.97); }

/* amount */
.amount-box { padding: 18px 20px 16px; }
.amount { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 12px; }
.rupee { font-size: 34px; font-weight: 300; color: var(--muted); }
#amount {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 0;
  font-size: 54px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums;
}
#amount::placeholder { color: #2e2d2b; }
.quick { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.quick button {
  flex: 1; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 7px 0;
  font-size: 13px; font-weight: 700; color: var(--muted); transition: transform .12s, color .2s;
}
.quick button:hover { color: var(--text); }
.amount-box.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

/* where tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 11px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  font-size: 11.5px; font-weight: 600; color: var(--muted); transition: transform .12s, border-color .2s, background .2s, color .2s;
}
.tile i {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal;
  font-size: 14px; font-weight: 800; color: #0a0a0a; background: var(--c, #555);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .03), 0 6px 16px -6px var(--c, #000);
}
.tile[aria-checked="true"] { border-color: var(--gold); color: var(--text); background: linear-gradient(160deg, #1f1c16, #131210); }
.field {
  width: 100%; margin-top: 12px; padding: 15px 18px; border-radius: 16px; outline: 0;
  background: var(--surface); border: 1px solid var(--line); font-size: 15px; transition: border-color .2s;
}
.field:focus { border-color: var(--gold-2); }
.field::placeholder { color: var(--dim); }

.cta {
  width: 100%; margin-top: 22px; padding: 18px; border: 0; border-radius: 18px;
  background: linear-gradient(180deg, #f6efe0, #d9c9a5); color: #0b0b0b;
  font-size: 16px; font-weight: 800; letter-spacing: -.01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 14px 30px -14px rgba(217, 197, 156, .55);
  transition: transform .12s, opacity .2s;
}
.cta:disabled { opacity: .55; }
.cta.ghost { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--line); }
.cta.danger { background: none; color: var(--red); border: 1px solid rgba(255, 138, 122, .25); box-shadow: none; }
.pill {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 10px 18px;
  font-weight: 700; font-size: 14px; transition: transform .12s;
}

/* card art */
.card-art {
  --a: #23262e; --b: #0c0d10; --ink: #f4f1ea;
  position: relative; aspect-ratio: 1.586; border-radius: 18px; padding: 18px 20px; overflow: hidden; color: var(--ink);
  background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .16), transparent 55%), linear-gradient(135deg, var(--a), var(--b));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 0 0 1px rgba(255, 255, 255, .06) inset, 0 24px 44px -22px rgba(0, 0, 0, .95);
  display: flex; flex-direction: column; justify-content: space-between; isolation: isolate;
}
.card-art::before { /* fine brushed texture */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 5px);
}
.card-art::after { /* sheen */
  content: ""; position: absolute; inset: -40% -60%; z-index: -1;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .09) 50%, transparent 58%);
  transform: translateX(-30%); animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%, 70% { transform: translateX(-30%); } 100% { transform: translateX(30%); } }
.card-art .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-art .bank { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.card-art .kind { font-size: 9.5px; font-weight: 800; letter-spacing: .2em; border: 1px solid currentColor; border-radius: 6px; padding: 2px 6px; opacity: .7; }
.card-art .peek { display: none; font-size: 17px; font-weight: 800; letter-spacing: -.02em; margin-top: 1px; }
.stack .card-art:not(:last-of-type) .peek { display: block; }
.stack .card-art:not(:last-of-type) .bank { font-size: 10px; opacity: .6; }
.card-art .chip {
  width: 40px; height: 30px; border-radius: 6px; margin-top: 4px;
  background: linear-gradient(135deg, #e9d8a6, #a88b4f 50%, #e3cf96); box-shadow: 0 0 0 1px rgba(0, 0, 0, .25) inset;
  position: relative;
}
.card-art .chip::after { content: ""; position: absolute; inset: 7px 9px; border: 1px solid rgba(0, 0, 0, .25); border-radius: 3px; }
.card-art .bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.card-art .name { font-size: 19px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.card-art .net { font-family: var(--serif); font-style: italic; font-size: 20px; opacity: .9; white-space: nowrap; }
.card-art.sm { padding: 10px 12px; border-radius: 9px; width: 64px; flex: 0 0 64px; }
.card-art.sm > * { display: none; }
.skeleton { background: linear-gradient(100deg, #151515 30%, #1f1f1f 50%, #151515 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton::before, .skeleton::after { display: none; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* wallet stack */
.stack { display: flex; flex-direction: column; padding-bottom: 6px; }
.stack .card-art { margin-bottom: -46%; cursor: pointer; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.stack .card-art:last-of-type { margin-bottom: 0; }
.stack .card-art:hover { transform: translateY(-10px); }
.stack-hint { text-align: center; color: var(--dim); font-size: 12.5px; margin-top: 18px; }
.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 18px; border-radius: 16px;
  background: linear-gradient(160deg, #1d1a14, #12110e); border: 1px solid rgba(217, 197, 156, .18); font-size: 13.5px; color: #d6cdbb;
}
.banner b { color: var(--gold); }
.banner.warn { border-color: rgba(255, 138, 122, .25); background: #1a1210; color: #f0c4bc; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* result */
#result:empty { display: none; }
#result { margin-top: 34px; }
.result-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.winner { position: relative; }
.winner .card-art { animation: deal .6s cubic-bezier(.2, .9, .2, 1.05); }
@keyframes deal { from { opacity: 0; transform: translateY(26px) rotate(-3deg) scale(.96); } to { opacity: 1; transform: none; } }
.value { padding: 22px 4px 6px; }
.value .big { font-size: 52px; font-weight: 800; letter-spacing: -.045em; line-height: 1; color: var(--green); font-variant-numeric: tabular-nums; }
.value .how { margin-top: 8px; font-size: 15px; color: var(--muted); }
.value .how b { color: var(--text); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 0; }
.stat { padding: 13px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.stat .k { font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.stat .v { margin-top: 4px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { font-size: 12.5px; padding: 6px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: #cfcac0; }
.tag.warn { color: #ffc2b8; border-color: rgba(255, 138, 122, .22); background: #1b1311; }
.why { margin-top: 18px; padding: 18px; }
.why p { margin: 10px 0 0; white-space: pre-wrap; color: #ddd8ce; font-size: 14.5px; line-height: 1.6; }
.why.muted p { color: var(--muted); }
.others { margin-top: 26px; }
.other { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.other:last-child { border-bottom: 0; }
.other .meta { flex: 1; min-width: 0; }
.other .nm { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.other .sb { font-size: 12.5px; color: var(--muted); }
.bar { height: 3px; border-radius: 3px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: 3px; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.other .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.other .amt.none { color: var(--dim); font-weight: 600; font-size: 13px; }
.thinking { text-align: center; }
.thinking .card-art { margin-bottom: 22px; }
.thinking .msg { color: var(--muted); font-size: 14px; min-height: 1.5em; transition: opacity .3s; }
.dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* guide */
.g-row { display: flex; align-items: center; gap: 14px; padding: 15px 16px; margin-bottom: 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.g-row .cat { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.g-row .card { font-weight: 800; font-size: 15.5px; letter-spacing: -.01em; margin-top: 2px; }
.g-row .alt { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.g-row .pct { margin-left: auto; text-align: right; font-size: 22px; font-weight: 800; letter-spacing: -.03em; color: var(--gold); white-space: nowrap; }
.g-row .pct small { display: block; font-size: 11px; font-weight: 600; color: var(--dim); letter-spacing: 0; }
.g-row .dot { width: 10px; height: 34px; border-radius: 4px; flex: 0 0 10px; background: linear-gradient(180deg, var(--a), var(--b)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset; }

/* tab bar */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; gap: 4px; padding: 6px; border-radius: 26px; width: min(340px, calc(100% - 40px));
  background: rgba(22, 22, 22, .82); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .9);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 7px; border: 0; border-radius: 20px;
  background: none; color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: .06em; transition: color .2s, background .25s;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab[data-view="spend"] svg { fill: currentColor; stroke: none; }
.tab.active { color: var(--text); background: #232323; }
.tab.active svg { color: var(--gold); }

/* bottom sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(4px); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; max-height: 92dvh;
  display: flex; flex-direction: column; background: #111; border-radius: 28px 28px 0 0; border: 1px solid var(--line); border-bottom: 0;
  animation: up .38s cubic-bezier(.2, .9, .2, 1);
}
@keyframes up { from { transform: translate(-50%, 100%); } }
.sheet.closing { transform: translate(-50%, 100%); transition: transform .25s ease-in; }
.grab { width: 40px; height: 4px; border-radius: 4px; background: #333; margin: 10px auto 0; flex: 0 0 auto; }
.x { position: absolute; right: 16px; top: 14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 13px; }
.sheet-body { overflow-y: auto; padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.sheet-body h2 { margin: 6px 0 4px; font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.sheet-body h2 em { font-family: var(--serif); font-weight: 400; color: var(--gold); }
.sheet-body .lead { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.option {
  display: flex; gap: 16px; align-items: center; width: 100%; text-align: left; padding: 18px; margin-bottom: 12px;
  border-radius: 20px; background: var(--surface); border: 1px solid var(--line); transition: transform .12s, border-color .2s;
}
.option:hover { border-color: rgba(217, 197, 156, .35); }
.option:active { transform: scale(.98); }
.option .ic { width: 46px; height: 46px; border-radius: 14px; flex: 0 0 46px; display: grid; place-items: center; background: linear-gradient(160deg, #26221a, #17150f); color: var(--gold); font-size: 20px; }
.option b { display: block; font-size: 16px; }
.option span { color: var(--muted); font-size: 13px; }
.detail .card-art { margin: 8px 0 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv { padding: 13px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.kv .k { font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.kv .v { margin-top: 3px; font-weight: 800; font-size: 16px; }
.block-title { margin: 22px 2px 10px; }
.rule { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rule:last-child { border-bottom: 0; }
.rule .r { font-weight: 800; color: var(--gold); white-space: nowrap; }
.rule small { display: block; color: var(--dim); font-size: 12px; }
.notes { color: #cfc9be; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.actions .cta { margin-top: 0; }

/* form */
.form label.f { display: block; margin-bottom: 12px; }
.form label.f > span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 2px 6px; }
.form label.f > small { display: block; color: var(--dim); font-size: 12px; margin: 5px 2px 0; }
.inp {
  width: 100%; padding: 13px 14px; border-radius: 14px; outline: 0; background: var(--surface); border: 1px solid var(--line);
  font-size: 15px; transition: border-color .2s; appearance: none;
}
.inp:focus { border-color: var(--gold-2); }
textarea.inp { resize: vertical; min-height: 70px; }
select.inp { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.seg { display: flex; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.seg button.on { background: #262626; color: var(--text); }
.fs { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; }
.chipset { display: flex; flex-wrap: wrap; gap: 8px; }
.chipset button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 13px; color: var(--muted); }
.chipset button.on { border-color: rgba(255, 138, 122, .4); color: #ffc2b8; background: #1b1311; }
.boost { display: grid; grid-template-columns: 1.2fr 1fr .8fr 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
.boost .inp { padding: 11px 10px; font-size: 14px; }
.boost .rm { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--muted); }
.linkish { border: 0; background: none; color: var(--gold); font-weight: 700; padding: 6px 2px; font-size: 14px; }
.save-bar { position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); margin: 20px -20px 0; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(17, 17, 17, 0), #111 30%); }
.save-bar .cta { margin-top: 0; }
.reading { text-align: center; padding: 30px 0 10px; }
.reading .doc { width: 84px; height: 104px; margin: 0 auto 24px; border-radius: 12px; position: relative; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.reading .doc::before { content: ""; position: absolute; inset: 18px 14px; background: repeating-linear-gradient(180deg, #333 0 3px, transparent 3px 11px); }
.reading .doc::after { content: ""; position: absolute; left: 0; right: 0; height: 30px; background: linear-gradient(180deg, transparent, rgba(217, 197, 156, .45), transparent); animation: scan 1.6s ease-in-out infinite; }
@keyframes scan { from { top: -30px; } to { top: 104px; } }

/* toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(16px + env(safe-area-inset-top)); z-index: 60; max-width: calc(100% - 40px);
  padding: 12px 18px; border-radius: 16px; background: #1f1f1f; border: 1px solid var(--line); font-size: 14px; font-weight: 600;
  box-shadow: 0 16px 30px -12px #000; animation: drop .3s cubic-bezier(.2, .9, .2, 1);
}
.toast.err { color: #ffc2b8; border-color: rgba(255, 138, 122, .3); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -12px); } }

@media (min-width: 520px) { h1 { font-size: 46px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
