/* ============================================================
   Kai — Home screen motion prototype
   Tier A (CLOSED)     = 🔒  identical for every user → Lottie-able
   Tier B (PARAMETRIC) = 🔧  fixed choreography, injected values
   Tier C (DATA)       = ⚡  driven by live/per-user data → code only
   ============================================================ */

@import url('https://api.fontshare.com/v2/css?f[]=clash-display@400,500,600&display=swap');

/* ---------- tokens ---------- */
:root {
  --speed: 1;

  /* Calibrated 2026-10-08: the 0.5× pass read better than 1×, so choreography
     is scaled 1.8× and that is now the shipping tempo. Feedback (press, hover)
     is deliberately NOT scaled — a slow tap always feels broken. */
  --tscale: 1.8;

  --d-instant: calc(130ms * var(--speed));                    /* press — unscaled */
  --d-fast:    calc(190ms * var(--speed));                    /* hover, chips — unscaled */
  --d-base:    calc(260ms * var(--tscale) * var(--speed));
  --d-slow:    calc(440ms * var(--tscale) * var(--speed));
  --d-hero:    calc(900ms * var(--tscale) * var(--speed));
  --d-ambient: calc(20000ms * var(--speed));

  /* screen transition family */
  --t-lateral:    calc(520ms * var(--speed));
  --t-drill:      calc(560ms * var(--speed));
  --t-drill-back: calc(440ms * var(--speed));
  --t-flow:       calc(760ms * var(--speed));
  --t-sheet:      calc(480ms * var(--speed));
  --t-replace:    calc(320ms * var(--speed));

  --ease-settle: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-state:  cubic-bezier(0.65, 0, 0.35, 1);
  --ease-ios:    cubic-bezier(0.32, 0.72, 0, 1);
  --ease-draw:   cubic-bezier(0.33, 0.8, 0.4, 1);

  --ink:     #0E2129;
  --ink-2:   #091C2F;
  --slate:   #4D5E70;
  --slate-2: #5F7184;
  --slate-3: #8796A4;
  --mist:    #91A3B3;
  --green:   #33B881;
  --purple:  #5A4ECB;
  --teal:    #40656F;
  --btc:     #F7931A;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Clash Display', -apple-system, 'SF Pro Display', system-ui, sans-serif;
  background: #141b1e;
  color: #e8eef0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 40px;
  overflow-x: auto;
}

/* ============================================================
   PHONE SHELL
   ============================================================ */
.stage { position: sticky; top: 40px; height: fit-content; }

.phone {
  position: relative;
  width: 402px;
  height: 874px;
  border-radius: 48px;
  overflow: hidden;
  background: linear-gradient(180deg, #FFFFFF 0%, #C0D4D7 67.9%);
  box-shadow: 0 40px 100px rgba(0,0,0,.55), 0 0 0 10px #22292c, 0 0 0 11px #3a4448;
  isolation: isolate;
}

/* 🔒 ambient background drift — zero data, pure CSS */
.bg-ellipse {
  position: absolute;
  width: 540px; height: 905px;
  right: 58px; bottom: -535px;
  background: var(--teal);
  filter: blur(100px);
  transform: rotate(76.25deg);
  opacity: .4;
  will-change: transform, opacity;
  z-index: 0;
}
.playing .bg-ellipse {
  animation:
    ellipse-settle calc(1200ms * var(--tscale) * var(--speed)) var(--ease-settle) calc(60ms * var(--speed)) both,
    ellipse-drift var(--d-ambient) ease-in-out calc(1260ms * var(--speed)) infinite alternate;
}
@keyframes ellipse-settle {
  from { opacity: .4; transform: rotate(76.25deg) scale(1.15); }
  to   { opacity: 1;  transform: rotate(76.25deg) scale(1); }
}
@keyframes ellipse-drift {
  from { transform: rotate(76.25deg) scale(1)    translate(0, 0); }
  to   { transform: rotate(76.25deg) scale(1.04) translate(12px, -8px); }
}

/* ---------- header ---------- */
.header-mask {
  position: absolute; inset: 0 0 auto 0; height: 125px;
  background: linear-gradient(180deg, #F3F7F8 78.49%, rgba(243,247,248,0) 100%);
  z-index: 8; pointer-events: none;
  transition: backdrop-filter var(--d-base) linear;
}
.header-mask.scrolled { backdrop-filter: blur(12px); }
.header-mask::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 20px; height: 1px;
  background: rgba(14,33,41,.2); opacity: 0;
  transition: opacity var(--d-base) var(--ease-state);
}
.header-mask.scrolled::after { opacity: 1; }

.header { position: absolute; inset: 0 0 auto 0; height: 109px; z-index: 9; }
.playing .header { animation: fade-in calc(200ms * var(--speed)) linear both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.statusbar {
  height: 49px; display: flex; align-items: center;
  justify-content: space-between; padding: 14px 24px 0;
  font: 590 16.8px/20px -apple-system, 'SF Pro Text', system-ui;
  letter-spacing: -.42px; color: var(--ink);
}
.statusbar .icons { display: flex; align-items: center; gap: 6px; }
.topbar {
  height: 60px; display: flex; align-items: center;
  justify-content: space-between; padding: 10px 20px;
}
.logo { display: flex; align-items: center; gap: 6px; font-size: 19px; color: var(--ink-2); }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.bell {
  width: 40px; height: 40px; border-radius: 70px; background: #F6F9FA;
  border: .5px solid rgba(14,33,41,.5);
  display: grid; place-items: center;
}
.avatar {
  width: 40px; height: 40px; border-radius: 100px; border: 1px solid #fff;
  background: linear-gradient(174deg, #31738F -.4%, #0E2129 109.46%);
}

/* ---------- scroll area ---------- */
.scroll {
  position: absolute; left: 0; top: 109px; width: 402px; height: 665px;
  overflow-y: auto; overflow-x: hidden; z-index: 5;
  scrollbar-width: none; padding-bottom: 24px;
}
.scroll::-webkit-scrollbar { display: none; }

/* ============================================================
   STANDARD ENTRANCE — 🔧 choreography fixed, applies to any block
   ============================================================ */
.enter { opacity: 0; }
.playing .enter {
  animation: enter-block var(--d-slow) var(--ease-settle) both;
  animation-delay: calc(var(--at, 0ms) * var(--tscale) * var(--speed));
}
@keyframes enter-block {
  from { opacity: 0; transform: translateY(12px) scale(.985); filter: blur(3px); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    filter: blur(0); }
}

/* ============================================================
   HERO — balance
   ============================================================ */
.hero { padding: 5px 20px; text-align: center; position: relative; }
.greeting { font-size: 15px; line-height: 18px; color: var(--ink); }
.balance-label { font-size: 12px; line-height: 15px; color: var(--ink); margin-top: 8px; }

.balance {
  font-size: 60px; line-height: 120%; color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  margin-top: 4px; cursor: pointer; user-select: none;
  transition: filter var(--d-fast) var(--ease-state);
  white-space: nowrap;
}
.balance .cents { color: #8EA3AC; }

/* ============================================================
   ⚡ TIER C — SPLIT-FLAP REEL COUNTER
   A 10-face drum per digit. Digits roll into place left→right,
   so the number reads as "settling", never as a slot machine.
   ============================================================ */
/* ⚠ Clash Display ships NO tabular figures — "1" is 0.30em, "0" is 0.69em.
   Every cell is therefore locked to the widest digit. That is also exactly
   what a real split-flap board looks like, so the constraint and the
   aesthetic happen to agree. See ANIMATION-SPEC → "Clash Display". */
.reel {
  display: inline-block; vertical-align: top; position: relative;
  width: .69em; height: 1.2em;
  overflow: hidden;                 /* ← the window: only the front face shows */
  perspective: 14em; perspective-origin: 50% 50%;
}
.drum {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
}
.face {
  position: absolute; inset: 0;
  display: block; text-align: center; line-height: 1.2em;
  backface-visibility: hidden;
  /* 10 faces, 36° apart. radius = (height/2) / tan(18°) ≈ height × 1.539 */
  transform: rotateX(calc(var(--i) * -36deg)) translateZ(1.847em);
}
.sep {
  display: inline-block; vertical-align: top;
  height: 1.2em; line-height: 1.2em;    /* same box as .face — keeps baselines honest */
  opacity: 0;
}
.sep.shown { opacity: 1; }
.reel.cents, .sep.cents { color: #8EA3AC; }
.balance.hidden-value { filter: blur(10px); }
.playing .balance { animation: materialize calc(500ms * var(--tscale) * var(--speed)) var(--ease-settle) calc(200ms * var(--speed)) both; }
@keyframes materialize {
  from { opacity: 0; filter: blur(6px); }
  to   { opacity: 1; filter: blur(0); }
}

.delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; line-height: 110%; margin-top: 4px;
  color: var(--green);
}
.delta.neg { color: #E05B4B; }
.delta.neg .delta-arrow { transform: scaleY(-1); }
.delta-arrow path { stroke-dasharray: 26; stroke-dashoffset: 26; }
.playing .delta { animation: enter-block calc(300ms * var(--tscale) * var(--speed)) var(--ease-settle) calc(1220ms * var(--speed)) both; }
.playing .delta-arrow path { animation: draw-stroke calc(260ms * var(--tscale) * var(--speed)) var(--ease-draw) calc(1260ms * var(--speed)) forwards; }
@keyframes draw-stroke { to { stroke-dashoffset: 0; } }

/* ============================================================
   ALLOCATION BAR — ⚡ widths are data, choreography is fixed
   ============================================================ */
.alloc-wrap { padding: 8px 20px; }
.alloc-row { position: relative; height: 35px; display: flex; align-items: center; }
.alloc-bars { display: flex; gap: 2px; width: 224px; }
.alloc-seg { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alloc-pct { font-size: 9px; line-height: 110%; opacity: 0; white-space: nowrap; }
.alloc-name { font-size: 12px; line-height: 110%; opacity: 0; white-space: nowrap; }
/* ⚠ edge case: segments too narrow to hold a label drop it entirely */
.alloc-seg.no-label .alloc-pct,
.alloc-seg.no-label .alloc-name { display: none; }
.alloc-track {
  height: 4px; border-radius: 5px; transform: scaleX(0); transform-origin: left;
  transition:
    transform calc(650ms * var(--tscale) * var(--speed)) var(--ease-settle),
    opacity var(--d-fast) var(--ease-state);
}
.alloc-seg.grown .alloc-track { transform: scaleX(1); }
.alloc-seg.labelled .alloc-pct,
.alloc-seg.labelled .alloc-name { opacity: 1; transition: opacity var(--d-base) var(--ease-state); }
.alloc-row.focused .alloc-seg:not(.active) { opacity: .4; }
.alloc-row.focused .alloc-seg.active { transform: translateY(-1px); }
.alloc-seg { transition: opacity var(--d-fast) var(--ease-state), transform var(--d-fast) var(--ease-state); cursor: pointer; }

.period-chip {
  position: absolute; right: 0; display: flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 70px;
  background: rgba(255,255,255,.4); border: 1px solid rgba(255,255,255,.3);
  font-size: 10px; color: var(--ink); cursor: pointer;
  transition: transform var(--d-instant) var(--ease-state), background var(--d-fast) linear;
}
.period-chip:active { transform: scale(.94); background: rgba(255,255,255,.75); }

/* ============================================================
   ASSET CARDS
   ============================================================ */
.cards-col { padding: 0 20px; display: flex; flex-direction: column; gap: 8px; }

.asset-card {
  padding: 12px; border-radius: 10px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255,255,255,0) 0%, rgba(255,255,255,.5) 100%);
  box-shadow: inset 0 4px 4px rgba(255,255,255,.5);
  transition: box-shadow var(--d-base) var(--ease-state);
}
.asset-card.linked {
  box-shadow: inset 0 4px 4px rgba(255,255,255,.9), 0 0 0 1px rgba(255,255,255,.8);
}

.asset-top { position: relative; display: flex; justify-content: space-between; height: 70px; }
.asset-left { display: flex; flex-direction: column; gap: 6px; z-index: 1; }
.asset-badge { display: flex; align-items: center; gap: 6px; }
.badge-dot {
  width: 20px; height: 20px; border-radius: 100px;
  background: rgba(145,163,179,.2); display: grid; place-items: center;
}
.asset-name { font-size: 14px; line-height: 100%; color: var(--ink); }
.asset-value {
  font-size: 26px; line-height: 110%; color: var(--ink-2);
  font-variant-numeric: tabular-nums; position: relative;
  border-radius: 6px; padding: 0 3px; margin-left: -3px;
}
.asset-value .cents { color: #6E8490; }
.asset-delta { font-size: 12px; line-height: 110%; color: var(--green); }
.asset-delta.neg { color: #E05B4B; }

/* ⚡ crypto-only live tick — fiat NEVER gets this */
.asset-value.tick-up  { animation: tick-up   calc(600ms * var(--speed)) var(--ease-state); }
.asset-value.tick-down{ animation: tick-down calc(600ms * var(--speed)) var(--ease-state); }
@keyframes tick-up   { 0% { background: rgba(51,184,129,0); } 18% { background: rgba(51,184,129,.16); } 100% { background: rgba(51,184,129,0); } }
@keyframes tick-down { 0% { background: rgba(224,91,75,0); } 18% { background: rgba(224,91,75,.16); } 100% { background: rgba(224,91,75,0); } }
.digit-roll { display: inline-block; animation: digit-roll calc(260ms * var(--tscale) * var(--speed)) var(--ease-settle); }
@keyframes digit-roll {
  0%   { transform: translateY(0);    opacity: 1; }
  40%  { transform: translateY(-4px); opacity: 0; }
  60%  { transform: translateY(4px);  opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}

/* sparkline */
.spark { position: absolute; right: 0; top: 0; width: 196px; height: 70px; }
.spark svg { display: block; overflow: visible; }
.spark-fill { opacity: 0; }
.spark-line, .spark-bench { stroke-dashoffset: var(--len); }

/* action pills */
.asset-actions {
  position: absolute; right: 0; top: 0; display: flex; gap: 4px; z-index: 2;
}
.pill {
  width: 38px; height: 28px; border-radius: 70px;
  background: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.9);
  display: grid; place-items: center; cursor: pointer; opacity: 0;
  transition: transform var(--d-instant) var(--ease-state), background var(--d-fast) linear;
}
.pill:active { transform: scale(.94); background: rgba(255,255,255,1); }
.playing .pill {
  animation: enter-block calc(240ms * var(--tscale) * var(--speed)) var(--ease-settle) both;
  animation-delay: calc(var(--at, 0ms) * var(--tscale) * var(--speed));
}

/* sub rows */
.subrows { display: flex; gap: 4px; margin-top: 10px; }
.subrow {
  flex: 1; height: 33px; padding: 10px 14px; border-radius: 10px;
  background: rgba(255,255,255,.4); border: 1px solid rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--slate-2); cursor: pointer;
  transition: transform var(--d-fast) var(--ease-state), box-shadow var(--d-fast) var(--ease-state);
}
.subrow span:last-child { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.subrow:active { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(10,36,38,.18); }

/* ============================================================
   CARDS MODULE — deck fan
   ============================================================ */
.cards-module {
  margin: 8px 20px 0; height: 80px; border-radius: 10px; position: relative;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255,255,255,0) 0%, rgba(255,255,255,.5) 100%);
  box-shadow: inset 0 4px 4px rgba(255,255,255,.5);
  overflow: hidden;
}
.cards-info { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.cards-head { display: flex; align-items: center; gap: 16px; }
.cards-head b { font-weight: 400; font-size: 14px; color: var(--ink); }
.cards-head i { font-style: normal; font-size: 12px; color: var(--slate-2); }
.cards-total { font-size: 26px; line-height: 110%; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cards-sub { font-size: 12px; color: var(--slate-2); }

.deck { position: absolute; right: 12px; top: 0; width: 170px; height: 80px; }

/* two layers so the reveal and the idle wave never fight over `transform` */
.credit-card {                                   /* layer 1 — position + reveal */
  position: absolute; cursor: grab;
  transition: transform calc(700ms * var(--tscale) * var(--speed)) var(--ease-settle);
  transform: var(--collapsed);
  will-change: transform;
}
.deck.fanned .credit-card { transform: translate(0, 0) scale(1); }

.cc-face {                                       /* layer 2 — visuals + wave */
  position: absolute; inset: 0; border-radius: inherit;
}
/* 🔒 stadium wave — one pulse travelling back→front, then a long rest */
.deck.waving .cc-face {
  animation: card-wave calc(4200ms * var(--speed)) ease-in-out infinite;
  animation-delay: calc(var(--wave-delay) * var(--speed));
}
@keyframes card-wave {
  0%, 26%, 100% { transform: translateY(0) rotate(0deg); }
  13%           { transform: translateY(-3.5px) rotate(-.3deg); }
}
.credit-card .cc-row {
  position: absolute; left: 7px; right: 7px; top: 6px;
  display: flex; justify-content: space-between;
  font-size: 6px; line-height: 1; opacity: .92;
}

/* ============================================================
   KAI PULSE
   ============================================================ */
.kai {
  margin: 8px 20px 0; padding: 14px; border-radius: 10px; position: relative;
  display: flex; gap: 8px;
  background: linear-gradient(0deg, rgba(90,78,203,.5) -163%, rgba(90,78,203,0) 108%), rgba(255,255,255,.8);
  border: 1px solid rgba(90,78,203,.3);
  overflow: hidden;
}

/* 🔒 travelling border highlight */
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.kai::before {
  content: ''; position: absolute; inset: -1px; border-radius: 11px; padding: 1px;
  background: conic-gradient(from var(--angle),
    transparent 0%, rgba(90,78,203,.9) 10%, transparent 22%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; pointer-events: none;
}
.playing .kai::before {
  opacity: .5;
  animation: border-travel calc(6000ms * var(--speed)) linear infinite;
}
@keyframes border-travel { to { --angle: 360deg; } }

/* 🔒 one-time shimmer when the card first scrolls into view */
.kai::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg,
    transparent 38%, rgba(255,255,255,.28) 46%,
    rgba(255,255,255,.8) 50%, rgba(255,255,255,.28) 54%, transparent 62%);
  transform: translateX(-130%); opacity: 0;
}
.kai.shimmer::after {
  animation: kai-shimmer calc(1100ms * var(--tscale) * var(--speed)) cubic-bezier(.4, 0, .2, 1) forwards;
}
@keyframes kai-shimmer {
  0%   { transform: translateX(-130%); opacity: 0; }
  14%  { opacity: 1; }
  86%  { opacity: 1; }
  100% { transform: translateX(130%);  opacity: 0; }
}

/* 🔒 sparkle */
.sparkle { width: 18px; height: 18px; flex: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,.1)); }
.playing .sparkle {
  animation:
    sparkle-in calc(500ms * var(--tscale) * var(--speed)) var(--ease-settle) calc(520ms * var(--speed)) both,
    sparkle-idle calc(4000ms * var(--speed)) ease-in-out calc(1020ms * var(--speed)) infinite;
}
@keyframes sparkle-in {
  0%   { transform: scale(.7) rotate(0deg);   opacity: 0; }
  70%  { transform: scale(1.06) rotate(150deg); opacity: 1; }
  100% { transform: scale(1) rotate(180deg);  opacity: 1; }
}
@keyframes sparkle-idle {
  0%, 100% { transform: scale(1) rotate(180deg);    opacity: .85; }
  50%      { transform: scale(1.04) rotate(180deg); opacity: 1; }
}
.sparkle.spin-once { animation: sparkle-spin calc(600ms * var(--tscale) * var(--speed)) var(--ease-settle) !important; }
@keyframes sparkle-spin { from { transform: rotate(180deg); } to { transform: rotate(540deg); } }

.kai-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.kai-title { font-size: 14px; line-height: 120%; color: var(--purple); }
.kai-title b { font-weight: 400; opacity: .7; }
.kai-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.kai-list li {
  font-size: 12px; line-height: 120%; color: var(--purple);
  padding-left: 10px; position: relative; opacity: 0;
}
.kai-list li::before { content: '·'; position: absolute; left: 2px; }
.playing .kai-list li {
  animation: enter-block var(--d-slow) var(--ease-settle) both;
  animation-delay: calc(var(--at, 0ms) * var(--tscale) * var(--speed));
}
.kai-list em {
  font-style: normal; color: var(--purple);
  transition: color calc(400ms * var(--speed)) var(--ease-state);
}
.playing .kai-list em { animation: datapoint calc(500ms * var(--tscale) * var(--speed)) var(--ease-state) both; animation-delay: calc((var(--at, 0ms) + 200ms) * var(--tscale) * var(--speed)); }
@keyframes datapoint { from { color: #8F86DC; } to { color: #4536C4; } }
.kai-cta {
  align-self: flex-start; display: flex; align-items: center; gap: 5px;
  padding: 8px 10px; border-radius: 70px; font-size: 12px; color: var(--purple);
  background: rgba(90,78,203,.08); border: 1px solid rgba(90,78,203,.08);
  cursor: pointer; transition: transform var(--d-instant) var(--ease-state), background var(--d-fast) linear;
}
.kai-cta:active { transform: scale(.95); background: rgba(90,78,203,.16); }

/* ============================================================
   TRANSACTION LIST — group fade only, never per-row
   ============================================================ */
.tx-section { padding: 8px 20px 0; position: relative; }
.tx-label { font-size: 12px; color: var(--slate-2); margin-bottom: 6px; }
.tx-group { border-radius: 10px; background: rgba(255,255,255,.7); overflow: hidden; }
.playing .tx-group { animation: fade-in calc(300ms * var(--tscale) * var(--speed)) var(--ease-state) both; animation-delay: calc(var(--at, 0ms) * var(--speed)); }

.tx-head {
  height: 41px; padding: 14px 15px; display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.2); font-size: 12px; color: var(--slate);
}
.tx-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mist); }
.tx-dot.pending { background: var(--green); }
.playing .tx-dot.pending { animation: dot-pulse calc(3000ms * var(--speed)) ease-in-out infinite; }
@keyframes dot-pulse {
  0%, 100% { opacity: 1;  box-shadow: 0 0 0 0 rgba(51,184,129,.5); }
  50%      { opacity: .6; box-shadow: 0 0 0 5px rgba(51,184,129,0); }
}

.tx-row {
  height: 66px; padding: 15px; display: flex; align-items: center;
  justify-content: space-between; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.8);
  transition: background var(--d-fast) var(--ease-state);
}
.tx-row:last-child { border-bottom: 0; }
.tx-row:active { background: rgba(255,255,255,.55); }
.tx-row:active .chev { transform: translateX(2px); }
.tx-left { display: flex; align-items: center; gap: 8px; }
.tx-icon { width: 36px; height: 36px; border-radius: 100px; display: grid; place-items: center; flex: none; }
.tx-icon.btc { background: var(--btc); }
.tx-icon.eth { background: #627EEA; }
.tx-icon.neutral { background: rgba(145,163,179,.2); }
.tx-icon.warn { background: rgba(255,156,36,.2); }
.tx-t1 { font-size: 14px; line-height: 110%; color: var(--ink); }
.tx-t2 { font-size: 12px; line-height: 110%; color: var(--slate); margin-top: 5px; }
.tx-right { display: flex; align-items: center; gap: 4px; }
.tx-amt { text-align: right; }
.tx-amt .v { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.tx-amt .d { font-size: 12px; color: var(--green); margin-top: 5px; }
.tx-amt .d.neg { color: var(--slate); }
.chev { transition: transform var(--d-fast) var(--ease-state); }

/* ============================================================
   BOTTOM NAV + FAB
   ============================================================ */
.nav-wrap {
  position: absolute; left: 0; bottom: 0; width: 402px; height: 100px; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
}
.nav-inner { position: relative; width: 402px; height: 79px; }
.nav-pill {
  position: absolute; left: 22px; top: 5px; width: 288px; height: 69px;
  border-radius: 200px; display: flex; padding: 0 6px;
  background: linear-gradient(0deg, rgba(255,255,255,.52), rgba(255,255,255,.52)),
              linear-gradient(180deg, rgba(64,101,111,0) 0%, #40656F 100%);
  box-shadow: inset 0 4px 4px rgba(255,255,255,.25);
  backdrop-filter: blur(8px);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; cursor: pointer;
  color: var(--slate); font-size: 10px;
  transition: color var(--d-fast) var(--ease-state), transform var(--d-fast) var(--ease-state);
}
.nav-item svg { stroke-width: 1; transition: stroke-width var(--d-fast) var(--ease-state); }
.nav-item.active { color: var(--ink); transform: translateY(-2px) scale(1.02); font-size: 12px; font-weight: 500; }
.nav-item.active svg { stroke-width: 1.6; }

.fab {
  position: absolute; left: 313px; top: 6px; width: 67px; height: 67px;
  border-radius: 226px; display: grid; place-items: center; cursor: pointer;
  background: radial-gradient(68% 68% at 50% 50%, rgba(255,255,255,.416) 0%, rgba(255,255,255,.52) 100%),
              linear-gradient(180deg, rgba(64,101,111,0) 0%, #40656F 100%);
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: inset 0 6px 4px rgba(255,255,255,.5), inset 0 0 30px #FFFFFF;
  backdrop-filter: blur(8px);
  transition: transform var(--d-instant) var(--ease-state);
  z-index: 2;
}
.fab:active { transform: scale(.92); }
.fab svg { transition: transform calc(400ms * var(--speed)) var(--ease-ios); }
.fab.spun svg { transform: rotate(180deg); }

.home-indicator {
  width: 134px; height: 5px; border-radius: 100px; background: #9DB4C4; margin-top: 8px;
}

/* ---------- swap sheet (FAB morph target) ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; height: 420px; z-index: 20;
  border-radius: 24px 24px 0 0; padding: 20px;
  background: radial-gradient(68% 68% at 50% 0%, rgba(255,255,255,.5) 0%, rgba(255,255,255,.65) 100%),
              linear-gradient(180deg, rgba(64,101,111,.2) 0%, #40656F 100%);
  backdrop-filter: blur(14px);
  transform: translateY(100%); opacity: 0; pointer-events: none;
  transition:
    transform calc(450ms * var(--speed)) var(--ease-ios),
    opacity calc(220ms * var(--tscale) * var(--speed)) linear;
}
.sheet.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: rgba(14,33,41,.25); margin: 0 auto 18px; }
.sheet h3 { font-weight: 400; font-size: 18px; color: var(--ink); margin-bottom: 14px; }
.swap-rows { position: relative; display: flex; flex-direction: column; gap: 8px; }
.swap-row {
  height: 72px; border-radius: 12px; padding: 14px; background: rgba(255,255,255,.72);
  display: flex; align-items: center; justify-content: space-between;
  transition: transform calc(380ms * var(--speed)) var(--ease-ios);
}
.swap-row .lbl { font-size: 12px; color: var(--slate-2); }
.swap-row .val { font-size: 22px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.swap-flip {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; background: #fff; z-index: 2;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 2px 10px rgba(10,36,38,.2);
}
.swap-flip svg { transition: transform calc(380ms * var(--speed)) var(--ease-ios); }
.swap-flip.flipped svg { transform: rotate(180deg); }
.sheet-close {
  margin-top: 20px; width: 100%; height: 52px; border-radius: 26px; border: 0;
  background: var(--ink); color: #fff; font-family: inherit; font-size: 15px; cursor: pointer;
  transition: transform var(--d-instant) var(--ease-state);
}
.sheet-close:active { transform: scale(.97); }

/* ---------- pull to refresh ---------- */
.ptr {
  position: absolute; left: 50%; top: 118px; transform: translateX(-50%) scale(.6);
  z-index: 7; opacity: 0; transition: opacity var(--d-fast) linear, transform var(--d-fast) var(--ease-state);
}
.ptr.active { opacity: 1; transform: translateX(-50%) scale(1); }
.ptr.spinning svg { animation: ptr-spin calc(500ms * var(--tscale) * var(--speed)) var(--ease-settle); }
@keyframes ptr-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ============================================================
   TIER BADGES (overlay)
   ============================================================ */
.badge {
  position: absolute; z-index: 30; pointer-events: none;
  font-family: ui-monospace, 'SF Mono', monospace; font-size: 8px; letter-spacing: .4px;
  padding: 2px 5px; border-radius: 4px; white-space: nowrap;
  opacity: 0; transition: opacity var(--d-fast) linear;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.show-badges .badge { opacity: 1; }
.badge.a { background: #2B6CB0; color: #fff; }
.badge.b { background: #B7791F; color: #fff; }
.badge.c { background: #9B2C5D; color: #fff; }

/* ============================================================
   CONTROL PANEL
   ============================================================ */
.controls { width: 330px; flex: none; padding-bottom: 60px; }
.controls h1 { font-size: 20px; font-weight: 500; margin-bottom: 4px; }
.controls .sub { font-size: 12px; color: #8ea0a6; margin-bottom: 20px; line-height: 1.5; }

.panel {
  background: #1d2529; border: 1px solid #2c363b; border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
}
.panel h2 {
  font-size: 11px; font-weight: 500; letter-spacing: .8px; text-transform: uppercase;
  color: #7d9199; margin-bottom: 10px;
}
.row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.row:last-child { margin-bottom: 0; }
.row label { font-size: 12px; color: #b9c7cc; flex: 1; }

button.btn {
  font-family: inherit; font-size: 12px; padding: 7px 12px; border-radius: 7px;
  border: 1px solid #39454b; background: #262f34; color: #dbe6e9; cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s;
}
button.btn:hover { background: #2f3a40; border-color: #4a585f; }
button.btn:active { transform: scale(.96); }
button.btn.primary { background: var(--green); border-color: var(--green); color: #06251a; font-weight: 500; }
button.btn.primary:hover { background: #3fcb90; }
button.btn.on { background: #2B6CB0; border-color: #2B6CB0; color: #fff; }

.seg-group { display: flex; gap: 4px; }
.seg-group .btn { flex: 1; padding: 6px 4px; }

input[type=range] { flex: 1; accent-color: var(--green); }
input[type=number], input[type=text] {
  width: 110px; font-family: inherit; font-size: 12px; padding: 6px 8px;
  border-radius: 6px; border: 1px solid #39454b; background: #141b1e; color: #dbe6e9;
}
.val-tag { font-family: ui-monospace, monospace; font-size: 11px; color: #7d9199; min-width: 48px; text-align: right; }

.anim-list { display: flex; flex-direction: column; gap: 1px; }
.anim-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px;
  cursor: pointer; transition: background .12s;
}
.anim-item:hover { background: #262f34; }
.anim-item .tier {
  font-family: ui-monospace, monospace; font-size: 8px; padding: 2px 4px;
  border-radius: 3px; flex: none; width: 54px; text-align: center;
}
.tier.a { background: #2B6CB0; color: #fff; }
.tier.b { background: #B7791F; color: #fff; }
.tier.c { background: #9B2C5D; color: #fff; }
.anim-item .nm { font-size: 11.5px; color: #c6d3d8; flex: 1; }
.anim-item .ms { font-family: ui-monospace, monospace; font-size: 10px; color: #6b7d84; }

.legend { font-size: 11px; line-height: 1.6; color: #98a9af; }
.legend b { color: #dbe6e9; font-weight: 500; }
.legend .k { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }

@media (prefers-reduced-motion: reduce) {
  .reduce-auto .bg-ellipse,
  .reduce-auto .sparkle,
  .reduce-auto .kai::before,
  .reduce-auto .tx-dot.pending { animation: none !important; }
}

/* forced reduced-motion toggle */
.reduced .bg-ellipse,
.reduced .sparkle,
.reduced .kai::before,
.reduced .kai::after,
.reduced .tx-dot.pending,
.reduced .cc-face,
.reduced .digit-roll { animation: none !important; }
.reduced .drum { transition: none !important; }
.reduced .sep { opacity: 1 !important; }
.reduced .enter,
.reduced .pill,
.reduced .kai-list li,
.reduced .tx-group { animation-name: fade-in !important; animation-duration: calc(200ms * var(--speed)) !important; }
.reduced .balance { animation: fade-in calc(200ms * var(--speed)) linear both !important; }
.reduced .alloc-track { transition-duration: 1ms !important; }
.reduced .credit-card { transition-duration: 1ms !important; }
.reduced .spark-line, .reduced .spark-bench { stroke-dashoffset: 0 !important; }
.reduced .spark-fill { opacity: 1 !important; }
