/* dewby. Every color is a custom property set from brand.js by theme.js (the values below are only
   fallbacks for the default brand). Light is the default theme. Type: Nunito (SIL OFL 1.1, fonts/). */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 600 900; font-display: swap; src: url("fonts/nunito-latin.woff2") format("woff2"); }
:root {
  --bg: #F5FAF3; --surface: #FFFFFF; --ink: #0D2B26; --muted: #4D6A63; --line: rgba(13, 43, 38, .10);
  --mint: #34D8A6; --lime: #C6F25E; --sea: #A8EBD9; --pop: #FF5A8A; --link: #0B7356;
  --ok: #0E7A54; --warn: #835500; --bad: #C2264B;
  --tile-ink: #0D2B26;
  --shadow: 0 14px 34px rgba(13, 43, 38, .10);
  --soft: color-mix(in srgb, var(--surface) 70%, var(--sea));
  --r: 26px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light only;
}
[data-theme="dark"] { --shadow: 0 16px 40px rgba(0, 0, 0, .4); --soft: color-mix(in srgb, var(--surface) 80%, var(--mint)); color-scheme: dark only; }

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--ink); min-height: 100dvh; background: var(--bg);
  font: 600 17px/1.4 "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom); -webkit-tap-highlight-color: transparent;
}
body::before { /* soft dew blobs in the background */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 26% at 100% 0%, color-mix(in srgb, var(--lime) 35%, transparent), transparent 70%),
              radial-gradient(46% 30% at 0% 18%, color-mix(in srgb, var(--mint) 22%, transparent), transparent 70%);
}
a { color: var(--link); font-weight: 800; }
:focus-visible { outline: 3px solid var(--pop); outline-offset: 3px; }
input:focus-visible, select:focus-visible { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.b { font-weight: 800; }
.center { text-align: center; }
.lead { margin: 0 0 8px; font-size: 18px; }

/* ---- testnet sticker (always visible) ---- */
.testnet { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 25; pointer-events: none; }
.testnet span:first-child {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px 5px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 900; letter-spacing: .04em; text-transform: lowercase;
  color: var(--tile-ink); background: var(--lime); border: 2px solid var(--tile-ink);
  transform: rotate(4deg); box-shadow: 2px 3px 0 var(--tile-ink); animation: wobble 5s ease-in-out infinite;
}
.testnet.live span:first-child { background: var(--pop); }
@keyframes wobble { 0%, 90%, 100% { transform: rotate(4deg); } 94% { transform: rotate(-3deg) scale(1.05); } 97% { transform: rotate(6deg); } }

main { max-width: 460px; margin: 0 auto; padding: 8px 20px 40px; outline: none; }
main > * { animation: rise .5s var(--spring) both; }
main > *:nth-child(2) { animation-delay: .04s; } main > *:nth-child(3) { animation-delay: .08s; }
main > *:nth-child(4) { animation-delay: .12s; } main > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- top bar + brand ---- */
header.bar { display: flex; align-items: center; gap: 10px; margin: 8px 0 18px; min-height: 52px; padding-right: 92px; }
header.bar.home { padding-right: 0; margin-top: 40px; }
header.bar h1 { font-size: 24px; font-weight: 900; letter-spacing: -.02em; margin: 0; flex: 1; line-height: 1.1; }
header.bar h1 small { display: block; font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.brand .wm { width: 92px; height: auto; }
.mark { width: 40px; height: 40px; flex: none; }
.mark.lg { width: 64px; height: 64px; } .mark.xl { width: 96px; height: 96px; }
.mark.bob { animation: bob 2.6s ease-in-out infinite; }
.mark.wave { animation: bob 2.2s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
.iconbtn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; padding: 0;
  background: var(--surface); border: 2px solid var(--line); color: var(--ink); cursor: pointer; text-decoration: none;
  transition: transform .25s var(--spring), border-color .2s;
}
.iconbtn:hover { border-color: var(--mint); transform: rotate(-6deg); }
.iconbtn:active { transform: scale(.88); }
.iconbtn.me { border: 0; background: none; }

h2 { font-size: 15px; font-weight: 900; color: var(--ink); margin: 26px 2px 12px; display: flex; align-items: center; gap: 8px; }
h2 .ic { width: 18px; height: 18px; color: var(--link); }
h2 .hint { font-weight: 700; color: var(--muted); }
.big-h { font-size: 34px; font-weight: 900; letter-spacing: -.03em; margin: 10px 0 0; }

/* ---- buttons: chunky, squishy ---- */
.btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px;
  border-radius: 999px; border: 0; font: inherit; font-size: 18px; font-weight: 900;
  cursor: pointer; text-decoration: none; transition: transform .25s var(--spring), box-shadow .2s, opacity .2s;
}
.btn:active:not([disabled]) { transform: scale(.95) translateY(2px); }
.btn.primary { background: var(--mint); color: var(--tile-ink); box-shadow: 0 5px 0 color-mix(in srgb, var(--mint) 55%, var(--tile-ink)); }
.btn.primary:active:not([disabled]) { box-shadow: 0 1px 0 color-mix(in srgb, var(--mint) 55%, var(--tile-ink)); }
.btn.primary:hover:not([disabled]) .ic { animation: nudge .5s var(--spring); }
@keyframes nudge { 50% { transform: translateX(3px) rotate(-8deg); } }
.btn.secondary { background: var(--surface); color: var(--ink); border: 2px solid var(--line); }
.btn.ghost { background: transparent; color: var(--link); min-height: 48px; font-size: 16px; }
.btn.big { min-height: 64px; font-size: 20px; }
.btn.slim { width: auto; padding: 0 18px; min-height: 48px; font-size: 16px; }
.btn[disabled] { opacity: .4; cursor: default; box-shadow: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* ---- cards ---- */
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); padding: 16px; }
.card + .card { margin-top: 10px; }
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--soft); border-radius: var(--r); padding: 14px 16px; margin: 14px 0; }
.notice > .ic { color: var(--link); margin-top: 1px; }
.notice.pop > .ic { color: var(--pop); }
.notice > div { flex: 1; min-width: 0; }
.notice .btn { margin-top: 10px; min-height: 48px; font-size: 16px; }
.notice .btn + .btn { margin-top: 8px; }

/* ---- home: balance bubble ---- */
.bubble {
  position: relative; overflow: hidden; border-radius: 32px; padding: 22px 22px 20px; color: var(--tile-ink);
  background: var(--mint); background-image: linear-gradient(135deg, var(--lime) 0%, var(--mint) 58%, var(--sea) 100%);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--mint) 35%, transparent);
}
.bubble .dew { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.bubble .d1 { width: 120px; height: 120px; right: -30px; top: -40px; }
.bubble .d2 { width: 46px; height: 46px; right: 70px; bottom: -14px; background: rgba(255, 255, 255, .25); }
.bubble .d3 { width: 16px; height: 16px; right: 40px; top: 64px; animation: bob 3s ease-in-out infinite; }
.bubble .lbl { position: relative; font-size: 15px; font-weight: 900; display: flex; align-items: center; gap: 6px; }
.bubble .num { position: relative; white-space: nowrap; font-size: 52px; font-weight: 900; letter-spacing: -.035em; line-height: 1.05; margin: 4px 0 14px; font-variant-numeric: tabular-nums; }
.bubble .sub { position: relative; display: flex; gap: 8px; flex-wrap: wrap; }
.bubble .tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .55); font-size: 15px; font-weight: 900; }
.bubble .tag .ic { width: 16px; height: 16px; }

/* ---- home: 4 chunky tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 4px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1 / 1.08;
  border-radius: 24px; color: var(--tile-ink); text-decoration: none; font-weight: 900; font-size: 14px;
  box-shadow: 0 4px 0 rgba(13, 43, 38, .18); transition: transform .3s var(--spring), box-shadow .2s;
}
.tile:link, .tile:visited { color: var(--tile-ink); }
.tile .ic { width: 30px; height: 30px; stroke-width: 2.4; transition: transform .35s var(--spring); }
.tile:hover .ic { transform: rotate(-12deg) scale(1.12); }
.tile:active { transform: scale(.9) translateY(3px); box-shadow: 0 1px 0 rgba(13, 43, 38, .18); }
.tile.mint { background: var(--mint); } .tile.pop { background: var(--pop); } .tile.lime { background: var(--lime); } .tile.sea { background: var(--sea); }

/* ---- people ---- */
.contacts { display: flex; gap: 14px; overflow-x: auto; padding: 6px 4px 10px; margin: 0 -4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.contacts::-webkit-scrollbar { display: none; }
.contact { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; color: var(--ink); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; min-width: 66px; padding: 0; text-decoration: none; scroll-snap-align: start; }
.contact:link, .contact:visited { color: var(--ink); }
.contact > span:last-child { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact .avatar { transition: transform .3s var(--spring), box-shadow .2s; }
.contact:hover .avatar { transform: translateY(-3px) rotate(-4deg); }
.contact:active .avatar { transform: scale(.88); }
.contact[aria-pressed="true"] .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--mint); transform: scale(1.06); }
.contact .tick { position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; background: var(--mint); color: var(--tile-ink); display: none; place-items: center; border: 2px solid var(--bg); }
.contact[aria-pressed="true"] .tick { display: grid; animation: pop .4s var(--spring); }
.av-wrap { position: relative; }
.avatar {
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 900; font-size: 22px; color: var(--tile-ink); border: 2px solid rgba(13, 43, 38, .12);
}
.avatar.xl { width: 104px; height: 104px; font-size: 38px; } .avatar.lg { width: 84px; height: 84px; font-size: 30px; }
.avatar.sm { width: 46px; height: 46px; font-size: 17px; } .avatar.xs { width: 44px; height: 44px; font-size: 16px; }
.avatar.add { background: var(--surface); border: 2px dashed color-mix(in srgb, var(--ink) 30%, transparent); color: var(--ink); }
.avatar.ring-on { box-shadow: 0 0 0 4px var(--bg), 0 0 0 8px var(--lime); }
.avatar.sentic { background: var(--sea); color: var(--tile-ink); animation: fly-in .7s var(--spring) both; }
@keyframes fly-in { from { transform: translate(-30px, 30px) scale(.6) rotate(-20deg); opacity: 0; } }

/* ---- activity ---- */
ul.activity { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.activity li a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 14px; border-radius: 22px; background: var(--surface); border: 2px solid var(--line); transition: transform .25s var(--spring), border-color .2s; font-weight: 600; }
ul.activity li a:hover { border-color: var(--mint); transform: translateX(3px); }
ul.activity li a:active { transform: scale(.98); }
ul.activity .what { flex: 1; min-width: 0; }
ul.activity .what b { display: block; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ul.activity .what span { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ul.activity .what span .ic { width: 14px; height: 14px; }
ul.activity .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
ul.activity .amt { font-weight: 900; font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt.in { color: var(--ok); }
.empty .small { font-weight: 700; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 10px; color: var(--muted); text-align: center; background: var(--surface); border: 2px dashed var(--line); border-radius: var(--r); }

/* ---- status chips: colored pill + icon ---- */
.status, .pill {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; font-weight: 900; white-space: nowrap;
  padding: 3px 10px 3px 7px; font-size: 13px; background: var(--soft); color: var(--muted);
}
.pill { padding: 8px 16px 8px 12px; font-size: 16px; }
.status .ic { width: 14px; height: 14px; stroke-width: 2.6; } .pill .ic { width: 18px; height: 18px; stroke-width: 2.6; }
.status.awaiting, .pill.awaiting { color: var(--tile-ink); background: color-mix(in srgb, var(--lime) 70%, var(--surface)); }
.status.seen, .pill.seen { color: var(--tile-ink); background: var(--sea); }
.status.seen .ic, .pill.seen .ic { animation: spin 1s linear infinite; }
.status.paid, .pill.paid { color: var(--tile-ink); background: var(--mint); }
.status.review, .pill.review { color: var(--warn); background: color-mix(in srgb, #FFD166 40%, var(--surface)); }
.status.expired, .pill.expired, .status.cancelled, .pill.cancelled { color: var(--bad); background: color-mix(in srgb, var(--pop) 16%, var(--surface)); }

/* ---- forms ---- */
label.field { display: block; margin: 14px 0; }
label.field > span { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 900; color: var(--muted); margin-bottom: 8px; }
label.field > span .ic { width: 16px; height: 16px; }
input, select {
  width: 100%; font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 20px; padding: 14px 16px; min-height: 56px; transition: border-color .2s, box-shadow .2s;
}
select option { color: #0D2B26; background: #fff; }
input::placeholder { color: var(--muted); opacity: .7; }
input:focus, select:focus { border-color: var(--mint); box-shadow: 0 0 0 5px color-mix(in srgb, var(--mint) 25%, transparent); outline: none; }
input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 500; }
.notefield { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: 0 18px; margin: 14px 0; }
.notefield .ic { color: var(--muted); }
.notefield input { border: 0; background: transparent; padding: 14px 0; box-shadow: none; }
.check { display: flex; gap: 12px; align-items: center; min-height: 48px; font-weight: 800; cursor: pointer; }
.check input { width: 24px; height: 24px; min-height: 24px; accent-color: var(--mint); }

/* ---- amount: huge ---- */
.amount { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 18px 0 4px; }
.amount input {
  width: 2ch; min-width: 1.2ch; max-width: 100%; text-align: right; font-size: 84px; font-weight: 900; letter-spacing: -.04em;
  background: transparent; border: 0; padding: 0; min-height: 0; box-shadow: none; font-variant-numeric: tabular-nums; caret-color: var(--pop);
}
.amount input.bump { animation: bump .25s var(--spring); }
@keyframes bump { 50% { transform: scale(1.08); } }
.amount input:focus { box-shadow: none; }
.amount .ccy { font-size: 26px; font-weight: 900; color: var(--tile-ink); background: var(--lime); padding: 2px 12px; border-radius: 999px; transform: rotate(-4deg); }
.crypto { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--muted); min-height: 1.5em; font-size: 15px; font-weight: 700; margin: 4px 0; }
.crypto .ic { width: 16px; height: 16px; color: var(--link); }
.bigamt { white-space: nowrap; font-size: 64px; font-weight: 900; letter-spacing: -.04em; text-align: center; margin: 6px 0 0; line-height: 1.05; font-variant-numeric: tabular-nums; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 5px; border-radius: 999px; background: var(--surface); border: 2px solid var(--line); margin-bottom: 10px; }
.seg button { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-weight: 900; cursor: pointer; transition: background .25s, transform .25s var(--spring); }
.seg button[aria-pressed="true"] { background: var(--mint); color: var(--tile-ink); }
form.mode-pay .btn.primary { background: var(--pop); box-shadow: 0 5px 0 color-mix(in srgb, var(--pop) 55%, var(--tile-ink)); }
.seg button[data-m="pay"][aria-pressed="true"] { background: var(--pop); }
.splitprev .each { font-size: 30px; font-weight: 900; letter-spacing: -.02em; }
.splitprev .each .muted { font-size: 15px; }

/* ---- who / pay ---- */
.who { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 6px 0 4px; text-align: center; }
.who .title { font-size: 19px; font-weight: 700; color: var(--muted); }
.who .title b { color: var(--ink); font-weight: 900; }
.paycard { background: var(--surface); border: 2px solid var(--line); border-radius: 34px; padding: 22px 16px 20px; }
.paycard.is-paid { background: color-mix(in srgb, var(--mint) 14%, var(--surface)); border-color: color-mix(in srgb, var(--mint) 50%, transparent); }
.yay { display: inline-block; font-size: 30px; font-weight: 900; color: var(--ink); letter-spacing: -.02em; animation: pop .6s .25s var(--spring) both; }
.is-paid .bigamt { animation: pop .6s .35s var(--spring) both; }
.note { display: flex; justify-content: center; margin: 8px 0; }
.note span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: var(--soft); font-weight: 800; }
.note .ic { width: 15px; height: 15px; color: var(--muted); }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 76px; justify-content: center; border-radius: 22px; background: var(--surface); border: 2px solid var(--line); color: var(--ink); font: inherit; font-size: 14px; font-weight: 900; cursor: pointer; transition: transform .25s var(--spring); }
.tool:active { transform: scale(.92); }
.tool[aria-expanded="true"] { border-color: var(--mint); background: var(--soft); }
.mockbox { margin-top: 16px; border-radius: var(--r); padding: 14px; border: 2px dashed color-mix(in srgb, var(--ink) 20%, transparent); }
.mockbox .lbl { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 900; color: var(--muted); margin-bottom: 10px; }
.mockbox .lbl .ic { width: 15px; height: 15px; }
.mockbox .btn { min-height: 48px; font-size: 16px; }
.person { display: flex; align-items: center; gap: 12px; }
.person .amt { font-size: 18px; font-variant-numeric: tabular-nums; }
.getapp { margin-top: 24px; display: flex; gap: 12px; align-items: center; }

/* ---- QR ---- */
.qrcard { position: relative; margin: 16px auto; width: min(78vw, 290px); padding: 14px; border-radius: 30px; background: #FFFFFF; border: 3px solid var(--tile-ink); box-shadow: 6px 6px 0 var(--mint); transform: rotate(-1.5deg); transition: transform .4s var(--spring); }
.qrcard:hover { transform: rotate(1deg) scale(1.02); }
.qr svg, .qr img { display: block; width: 100%; height: auto; }
.qr img { image-rendering: pixelated; }
.qrcard .qrmark { position: absolute; width: 44px; height: 44px; left: 50%; top: 50%; margin: -22px 0 0 -22px; background: #fff; border-radius: 50%; padding: 6px; }
.qr-hint { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-weight: 800; font-size: 15px; }
.qr-hint .ic { width: 18px; height: 18px; color: var(--link); }
.linkbox { font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; color: var(--muted); background: var(--soft); padding: 10px 12px; border-radius: 14px; }

/* ---- payment-success moment: drop lands, ripples, splashes ---- */
.splash { position: relative; width: 150px; height: 150px; margin: 4px auto 6px; display: grid; place-items: center; }
.splash .drop {
  position: relative; width: 112px; height: 112px; border-radius: 50% 50% 50% 50%; display: grid; place-items: center; color: var(--tile-ink);
  background: radial-gradient(circle at 34% 28%, #fff 0 8%, transparent 9%), linear-gradient(140deg, var(--lime), var(--mint) 60%, var(--sea));
  border: 3px solid var(--tile-ink); box-shadow: 0 16px 34px color-mix(in srgb, var(--mint) 45%, transparent);
  animation: land .8s var(--spring) both;
}
.splash .drop .ic { width: 60px; height: 60px; stroke-width: 3.2; }
.splash .drop .ic path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .45s .55s var(--ease) forwards; }
.splash .ripple { position: absolute; inset: 10px; border-radius: 50%; border: 3px solid var(--mint); opacity: 0; animation: ripple 1.1s .4s ease-out; }
.splash .r2 { border-color: var(--lime); animation-delay: .6s; }
.splash i { position: absolute; left: 50%; top: 50%; width: var(--s); height: var(--s); margin: calc(var(--s) / -2); border-radius: 50% 50% 50% 0; background: var(--c); opacity: 0; transform: rotate(var(--r)) translateY(0); animation: splashout .9s .45s var(--ease) forwards; }
@keyframes land { 0% { transform: translateY(-120px) scale(.5, .7); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; opacity: 0; } 45% { transform: translateY(0) scale(1.25, .78); opacity: 1; } 70% { transform: scale(.92, 1.08); } 100% { transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ripple { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes splashout { 0% { opacity: 1; transform: rotate(var(--r)) translateY(0) scale(1); } 100% { opacity: 0; transform: rotate(var(--r)) translateY(calc(var(--d) * -1)) scale(.5); } }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti i { position: absolute; top: -14px; width: 12px; height: 12px; background: var(--c); animation: fall var(--t) var(--dl) cubic-bezier(.3, .6, .5, 1) forwards; }
.confetti i.dot { border-radius: 50%; }
.confetti i.dew { border-radius: 50% 50% 50% 0; width: 14px; height: 14px; }
@keyframes fall { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }

/* ---- split ring ---- */
.ringwrap { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--line); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; font-weight: 900; }
.ring.lg { width: 140px; height: 140px; } .ring.lg b { font-size: 28px; }
.splitcard { display: block; color: inherit; text-decoration: none; font-weight: 600; transition: transform .25s var(--spring); }
.splitcard:active { transform: scale(.98); }
.splitcard .t { font-weight: 900; font-size: 19px; }
.splitcard .faces { display: flex; margin-top: 8px; }
.splitcard .faces .avatar { width: 30px; height: 30px; font-size: 12px; border: 2px solid var(--surface); margin-left: -6px; position: relative; }
.splitcard .faces .avatar:first-child { margin-left: 0; }
.splitcard .faces .avatar.ok::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--mint); border: 2px solid var(--surface); }

/* ---- onboarding ---- */
.onb { display: flex; flex-direction: column; min-height: calc(100dvh - 30px); }
.onbtop { display: flex; align-items: center; justify-content: space-between; margin: 6px 92px 0 0; }
.onbtop .skip { width: auto; padding: 0 12px; }
.onb .btn.ghost { margin-top: 6px; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 10px -20px 0; flex: 1; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 18px 28px; }
.blob { position: relative; width: 190px; height: 190px; display: grid; place-items: center; color: var(--tile-ink); margin-bottom: 34px; border-radius: 42% 58% 60% 40% / 45% 45% 55% 55%; animation: morph 6s ease-in-out infinite; border: 3px solid var(--tile-ink); box-shadow: 8px 8px 0 var(--tile-ink); }
.blob.mint { background: var(--mint); } .blob.lime { background: var(--lime); } .blob.pop { background: var(--pop); }
.blob .ic { width: 88px; height: 88px; stroke-width: 2; }
.blob .b1, .blob .b2 { position: absolute; border-radius: 50%; border: 3px solid var(--tile-ink); background: var(--sea); }
.blob .b1 { width: 34px; height: 34px; right: -18px; top: 18px; animation: bob 3s ease-in-out infinite; }
.blob .b2 { width: 18px; height: 18px; left: -6px; bottom: 26px; background: var(--lime); animation: bob 2.4s .3s ease-in-out infinite; }
.blob.lime .b2 { background: var(--pop); }
@keyframes morph { 0%, 100% { border-radius: 42% 58% 60% 40% / 45% 45% 55% 55%; } 50% { border-radius: 58% 42% 40% 60% / 55% 50% 50% 45%; } }
.slide h1 { font-size: 38px; font-weight: 900; letter-spacing: -.035em; margin: 0 0 10px; line-height: 1.02; }
.slide p { font-size: 19px; color: var(--muted); margin: 0; font-weight: 700; }
.dots { display: flex; justify-content: center; gap: 0; margin: 8px 0 12px; }
.dots button { width: 24px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; display: grid; place-items: center; transition: width .35s var(--spring); }
.dots button::before { content: ""; width: 12px; height: 12px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 18%, transparent); transition: width .35s var(--spring), background .3s; }
.dots button[aria-current="true"] { width: 44px; }
.dots button[aria-current="true"]::before { width: 32px; background: var(--mint); }
.setup .hi { display: flex; justify-content: center; margin: 4px 0 0; }
.setup h1 { font-size: 34px; font-weight: 900; letter-spacing: -.035em; margin: 10px 0 4px; line-height: 1.05; }

/* ---- toast ---- */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(30px) scale(.9);
  opacity: 0; transition: .4s var(--spring); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  font-weight: 900; width: max-content; max-width: min(92vw, 420px); z-index: 40; pointer-events: none; box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px;
}
#toast .ic { color: var(--mint); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

details { margin-top: 14px; }
summary { cursor: pointer; color: var(--muted); min-height: 48px; display: flex; align-items: center; gap: 8px; font-weight: 800; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary .ic { transition: transform .25s var(--spring); width: 18px; height: 18px; }
details[open] summary .ic { transform: rotate(90deg); }
video.scan { width: 100%; border-radius: var(--r); background: #000; margin-top: 12px; }

.setrow { display: flex; align-items: center; gap: 12px; min-height: 64px; margin-top: 10px; }
.setrow .ic { color: var(--link); }
.setrow .lbl { flex: 1; font-weight: 900; }
.setrow .lbl small { display: block; font-weight: 700; color: var(--muted); font-size: 13px; }
.toggle { position: relative; width: 58px; height: 36px; border-radius: 99px; border: 2px solid var(--line); background: var(--soft); cursor: pointer; flex: none; transition: background .2s; }
.toggle::before { content: ""; position: absolute; inset: -6px -2px; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); transition: transform .35s var(--spring); }
.toggle[aria-checked="true"] { background: var(--mint); }
.toggle[aria-checked="true"]::after { transform: translateX(22px); background: var(--tile-ink); }
.about { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.about p { margin: 0; }
.about a { display: inline-flex; align-items: center; gap: 6px; }
.about .powered { font-size: 11px; color: var(--muted); letter-spacing: .02em; margin-top: 6px; }

footer.foot { margin-top: 36px; font-size: 13px; color: var(--muted); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; }
footer.foot .l { display: inline-flex; align-items: center; gap: 6px; }
footer.foot .ic { width: 15px; height: 15px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- forced dark (Samsung Internet default, WebView FORCE_DARK_ONLY): see detectForcedDark() in app.js.
   The browser darkens light/saturated fills and inverts dark text, so here every fill is dark and the
   brand colors are carried by text, icons and an SVG outline (.edge), which it leaves alone. ---- */
html.fd { --bg: var(--fd-bg); --surface: var(--fd-surface); --ink: var(--fd-ink); --muted: var(--fd-muted); --line: rgba(236, 255, 247, .14);
  --soft: var(--fd-fill); --link: var(--fd-mint); --ok: var(--fd-mint); --bad: var(--fd-pop); --tile-ink: var(--fd-ink); color-scheme: dark only; }
html.fd body::before { display: none; }
html.fd .setrow:has([data-act="theme"]) { display: none; }
html.fd .bubble { background: var(--fd-fill); background-image: none; color: var(--fd-ink); box-shadow: none; }
html.fd .bubble .dew { display: none; }
html.fd .bubble .num { color: var(--fd-lime); }
html.fd .bubble .lbl { color: var(--fd-mint); }
html.fd .bubble .tag { background: rgba(236, 255, 247, .08); }
html.fd .tile { background: var(--fd-fill) !important; box-shadow: none; }
html.fd .tile.mint, html.fd .tile.sea { color: var(--fd-mint); } html.fd .tile.pop { color: var(--fd-pop); } html.fd .tile.lime { color: var(--fd-lime); }
html.fd .btn.primary, html.fd form.mode-pay .btn.primary, html.fd .seg button[aria-pressed="true"] { background: var(--fd-fill); color: var(--fd-mint); box-shadow: none; }
html.fd .btn.secondary, html.fd .card, html.fd ul.activity li a, html.fd .paycard, html.fd .tool, html.fd input, html.fd select, html.fd .notefield, html.fd .seg, html.fd .iconbtn { background: var(--fd-surface); }
html.fd .testnet span:first-child { background: var(--fd-fill); color: var(--fd-lime); border-color: var(--fd-lime); box-shadow: none; }
html.fd .amount .ccy { background: var(--fd-fill); color: var(--fd-lime); }
html.fd .avatar { color: #0A1C18; }
html.fd .avatar.add { background: var(--fd-surface); color: var(--fd-ink); }
html.fd .avatar.ring-on { box-shadow: 0 0 0 4px var(--fd-bg), 0 0 0 7px var(--fd-lime); }
html.fd .status, html.fd .pill { background: var(--fd-fill) !important; }
html.fd .status.awaiting, html.fd .pill.awaiting { color: var(--fd-lime); } html.fd .status.seen, html.fd .pill.seen, html.fd .status.paid, html.fd .pill.paid { color: var(--fd-mint); }
html.fd .status.expired, html.fd .pill.expired, html.fd .status.cancelled, html.fd .pill.cancelled { color: var(--fd-pop); }
html.fd .splash .drop { background: var(--fd-fill); color: var(--fd-mint); border-color: var(--fd-mint); box-shadow: none; }
html.fd .paycard.is-paid { background: var(--fd-surface); border-color: var(--fd-mint); }
html.fd .qrcard { background: var(--fd-fill); border-color: var(--fd-mint); box-shadow: none; transform: none; }
html.fd .blob { background: var(--fd-fill) !important; color: var(--fd-mint); border-color: var(--fd-mint); box-shadow: none; }
html.fd .blob.lime { color: var(--fd-lime); } html.fd .blob.pop { color: var(--fd-pop); }
html.fd .blob .b1, html.fd .blob .b2 { background: var(--fd-fill) !important; border-color: var(--fd-lime); }
html.fd .dots button[aria-current="true"]::before { background: var(--fd-mint); }
html.fd .toggle[aria-checked="true"] { background: var(--fd-fill); }
html.fd #toast { background: var(--fd-fill); color: var(--fd-ink); }
.edge { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.edge rect { x: 1px; y: 1px; width: calc(100% - 2px); height: calc(100% - 2px); rx: 28px; fill: none; stroke: var(--fd-edge); stroke-width: 2px; }
.bubble .edge rect { rx: 32px; }
.tile .edge rect { rx: 24px; }
.tile.pop .edge rect { stroke: var(--fd-pop); } .tile.lime .edge rect { stroke: var(--fd-lime); }
.seg .edge rect { rx: 24px; }

/* ---- desktop ---- */
.deskhero { display: none; }
/* Tablets / small laptops: the app column floats on a soft card. */
@media (min-width: 720px) and (max-width: 979px), (min-width: 720px) and (max-height: 699px), (min-width: 720px) and (display-mode: standalone) {
  main { margin-top: 24px; margin-bottom: 40px; padding: 18px 28px 30px; border-radius: 40px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 2px solid var(--line); box-shadow: var(--shadow); }
  .onb { min-height: 720px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .splash .drop .ic path { stroke-dashoffset: 0; }
  .confetti, .splash i, .splash .ripple { display: none; }
}

/* Desktop browser: a small landing beside a phone mockup that runs the real app. The transform on
   .phone makes it the containing block for the fixed testnet sticker, toast and confetti. */
@media (min-width: 980px) and (min-height: 700px) and (display-mode: browser) {
  body { min-height: 100vh; }
  .stage { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 470px) auto; justify-content: center; align-items: center; gap: 64px; padding: 32px; }
  .deskhero { display: block; }
  .deskhero .brand .wm { width: 150px; } .deskhero .brand .mark { width: 64px; height: 64px; }
  .deskhero h1 { font-size: 46px; font-weight: 900; letter-spacing: -.035em; line-height: 1.05; margin: 22px 0 18px; }
  .deskhero ul { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; }
  .deskhero li { display: flex; gap: 12px; align-items: center; font-size: 18px; }
  .deskhero li .ic { width: 40px; height: 40px; padding: 8px; border-radius: 14px; background: var(--mint); color: var(--tile-ink); }
  .deskhero li:nth-child(2) .ic { background: var(--lime); } .deskhero li:nth-child(3) .ic { background: var(--sea); }
  .deskhero p { display: flex; gap: 6px; align-items: center; }
  .deskhero p a { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; }
  .openphone { display: flex; gap: 18px; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: 28px; padding: 14px 18px 14px 14px; margin-bottom: 18px; }
  .openphone .qrcard { width: 132px; margin: 0; padding: 8px; border-radius: 18px; border-width: 2px; box-shadow: 4px 4px 0 var(--mint); }
  .openphone .qrmark { display: none; }
  .openphone div:last-child { display: flex; flex-direction: column; gap: 4px; }
  .phone { position: relative; width: 414px; height: min(868px, calc(100vh - 64px)); border-radius: 56px; border: 12px solid var(--tile-ink); background: var(--bg); overflow: hidden; transform: translateZ(0); box-shadow: 0 30px 70px rgba(13, 43, 38, .25), 0 0 0 2px color-mix(in srgb, var(--tile-ink) 40%, transparent); }
  .phone main { height: 100%; overflow-y: auto; max-width: none; margin: 0; padding: 8px 20px 40px; scrollbar-width: thin; }
  .phone .onb { min-height: calc(min(868px, calc(100vh - 64px)) - 40px); }
  .phone .testnet { position: absolute; top: 14px; }
  .phone #toast { position: absolute; }
  .phone .confetti { position: absolute; }
  html.fd .phone { border-color: var(--fd-mint); }
}

/* ======================================================================
   v3: tokens, states and safety UI (colors still come from brand.js)
   ====================================================================== */
:root {
  --fs-xs: 12px; --fs-s: 14px; --fs-m: 17px; --fs-l: 20px; --fs-xl: 24px; --fs-2xl: 34px; --fs-3xl: 60px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --tap: 48px;
}
:focus:not(:focus-visible) { outline: none; }
h1:focus { outline: none; }

/* skeleton */
.skel { display: flex; flex-direction: column; align-items: center; gap: var(--s4); padding-top: var(--s3); }
.sk { display: block; border-radius: 18px; background: color-mix(in srgb, var(--ink) 7%, var(--surface)); position: relative; overflow: hidden; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.3s infinite; }
.sk-bar { width: 100%; height: 52px; } .sk-circle { width: 84px; height: 84px; border-radius: 50%; } .sk-line { height: 18px; }
.sk-big { width: 70%; height: 64px; } .sk-btn { width: 100%; height: 64px; border-radius: 999px; margin-top: var(--s4); }
.w60 { width: 60%; } .w40 { width: 40%; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* state panels: icon + color + word, never color alone */
.state-ic { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; flex: none; background: var(--soft); color: var(--link); }
.state-ic.warn { color: var(--warn); background: color-mix(in srgb, #FFD166 35%, var(--surface)); }
.state-ic.bad { color: var(--bad); background: color-mix(in srgb, var(--pop) 14%, var(--surface)); }
.state { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); margin: var(--s4) 0; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); }
.state b { font-size: var(--fs-l); font-weight: 900; }
.state p { margin: 2px 0 0; color: var(--muted); font-weight: 700; }
.state.review { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.state.expired, .state.cancelled { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.state-x { display: flex; flex-direction: column; align-items: center; gap: var(--s4); text-align: center; margin: 48px 0 32px; }
.state-x .state-ic { width: 88px; height: 88px; border-radius: 30px; }
.state-x .lead { font-size: var(--fs-l); font-weight: 800; max-width: 30ch; }
.paycard.st-expired .bigamt, .paycard.st-cancelled .bigamt { text-decoration: line-through; text-decoration-thickness: 4px; text-decoration-color: color-mix(in srgb, var(--bad) 55%, transparent); }

/* payment after close */
.late { margin: var(--s4) 0; padding: var(--s4); border-radius: var(--r); border: 2px solid var(--warn); background: color-mix(in srgb, #FFD166 22%, var(--surface)); }
.late-top { display: flex; align-items: center; gap: var(--s3); }
.late-top b { font-size: var(--fs-l); font-weight: 900; }
.late-top .state-ic { width: 44px; height: 44px; border-radius: 14px; background: transparent; }
.late p { margin: var(--s2) 0; font-weight: 700; }

/* key/value rows */
.kv { display: flex; align-items: center; gap: var(--s2); min-height: 52px; padding: 4px 4px 4px var(--s3); margin: var(--s2) 0; border-radius: 18px; background: var(--surface); border: 2px solid var(--line); font-weight: 800; }
.kv > span:first-child { color: var(--muted); font-size: var(--fs-s); display: inline-flex; align-items: center; gap: 6px; }
.kv > b, .kv > code { flex: 1; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv code { font: 700 14px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }
.kv.tx { max-width: 360px; margin: var(--s3) auto; }
.kv.exact { flex-wrap: wrap; } .kv.exact > b { white-space: nowrap; font-size: 16px; }

/* readable receiver address */
.addr { margin-top: var(--s4); padding: var(--s3) var(--s4) var(--s4); border-radius: var(--r); background: var(--surface); border: 2px solid var(--line); }
.addr-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.addr .lbl { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-s); font-weight: 900; color: var(--muted); }
.addr-v { margin: var(--s2) 0 var(--s1); font: 600 17px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--ink); }
.addr-v .g i { font-style: normal; color: var(--link); font-weight: 800; }
.addr-v .edge4 { font-weight: 900; background: color-mix(in srgb, var(--lime) 45%, var(--surface)); border-radius: 6px; padding: 0 3px; margin: 0 -3px; }
.addr-hint { display: flex; align-items: center; gap: 6px; margin: var(--s1) 0 0; font-size: var(--fs-s); color: var(--muted); font-weight: 700; }

/* copy buttons that confirm themselves */
.mini { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 48px; min-height: 44px; padding: 0 var(--s3); border-radius: 999px; border: 2px solid var(--line); background: var(--soft); color: var(--ink); font: inherit; font-size: var(--fs-s); font-weight: 900; cursor: pointer; transition: transform .25s var(--spring), background .2s; flex: none; }
.mini .ic { width: 18px; height: 18px; }
.mini:active { transform: scale(.92); }
.mini.done, .tool.done { color: var(--tile-ink); border-color: var(--mint); background: var(--mint); }
.mini.done .ic, .tool.done .ic { animation: pop .35s var(--spring); }
.tools.two { grid-template-columns: 1fr 1fr; }
.tool span { pointer-events: none; }

.chips { display: flex; justify-content: center; gap: var(--s2); flex-wrap: wrap; }
.exp { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px 8px 11px; border-radius: 999px; font-size: 15px; font-weight: 900; color: var(--muted); background: var(--soft); }

/* inline validation */
.amthint { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 22px; margin: 0; color: var(--bad); font-weight: 900; font-size: var(--fs-s); }
.amount input[aria-invalid="true"] { color: var(--bad); }
.ferr { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--bad); font-weight: 800; font-size: 13px; }
.ferr:empty { display: none; }
input[aria-invalid="true"] { border-color: var(--bad) !important; }

.mockbox .more { margin-top: var(--s2); }
.mockbox .more summary { justify-content: center; font-size: 15px; }
.mockbox .more .row .btn { font-size: 15px; }
.ic.spin { animation: spin 1.2s linear infinite; }

/* history */
h2 .more { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 4px; font-size: 15px; font-weight: 900; color: var(--link); text-decoration: none; text-transform: none; letter-spacing: 0; }
.seg.four { grid-template-columns: repeat(4, 1fr); }
.seg.four button { font-size: 15px; gap: 6px; padding: 0 4px; }
.seg.four button[aria-pressed="true"] { background: var(--mint); }
.seg .n { font-size: 12px; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.empty .btn { width: auto; padding: 0 var(--s5); min-height: var(--tap); font-size: 16px; margin-top: var(--s1); }

/* 44 px targets for small controls */
.dots button { width: 44px; height: 44px; }
.dots button span { display: none; }
.dots button[aria-current="true"] { width: 52px; }
.toggle { width: 62px; height: 44px; border: 0; background: none; }
.toggle::before { content: ""; position: absolute; inset: 4px 2px; border-radius: 99px; border: 2px solid var(--line); background: var(--soft); transition: background .2s; }
.toggle::after { top: 9px; left: 7px; }
.toggle[aria-checked="true"] { background: none; }
.toggle[aria-checked="true"]::before { background: var(--mint); }
.about a.small { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }

/* offline chip under the test-mode sticker */
.testnet { display: flex; flex-direction: row-reverse; align-items: center; gap: 8px; }
.testnet .offline { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; background: var(--surface); color: var(--ink); border: 2px solid var(--ink); }
.testnet .offline[hidden] { display: none; }

/* forced dark: new pieces keep dark fills and carry color in text and borders */
html.fd .late { background: var(--fd-fill); border-color: var(--fd-lime); }
html.fd .addr-v .edge4 { background: var(--fd-fill); box-shadow: inset 0 0 0 1px var(--fd-lime); color: var(--fd-lime); }
html.fd .addr-v .g i { color: var(--fd-mint); }
html.fd .mini.done, html.fd .tool.done { background: var(--fd-fill); color: var(--fd-mint); border-color: var(--fd-mint); }
html.fd .toggle[aria-checked="true"]::before { background: var(--fd-fill); border-color: var(--fd-mint); }
html.fd .state-ic.warn, html.fd .state-ic.bad, html.fd .exp, html.fd .mini, html.fd .sk { background: var(--fd-fill); }
html.fd .state-ic.warn { color: var(--fd-lime); } html.fd .state-ic.bad { color: var(--fd-pop); }
html.fd .sk::after { display: none; }
@media (prefers-reduced-motion: reduce) { .sk::after { display: none; } }
/* round 3: the crypto line wraps as one balanced block at 360 px, icon on the first line */
.crypto { align-items: flex-start; text-wrap: balance; } .crypto .ic { margin-top: 3px; }
@media (max-width: 370px) { .crypto { font-size: 14px; } }

/* ---- bottom sheet (in-app confirm) ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .2s; }
.sheet { position: relative; width: min(100%, 460px); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -18px 50px rgba(0, 0, 0, .35); transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.sheet-wrap.open .sheet-back { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin-bottom: 6px; }
.sheet h2 { margin: 4px 0 0; font-size: 22px; font-weight: 900; letter-spacing: -.01em; text-transform: none; color: inherit; display: block; }
.sheet p { margin: 0 0 8px; color: var(--muted); font-weight: 600; max-width: 32ch; }
.sheet .btn { width: 100%; }
.sheet-ic { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; }
.btn.danger { background: var(--bad); color: var(--bg); }
.btn.danger:focus-visible { outline-offset: 4px; }
html.fd .btn.danger { background: var(--fd-fill); color: var(--bad); border: 2px solid var(--bad); }
html.fd .sheet-back { background: rgba(0, 0, 0, .7); }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-back { transition: none; } }
