/* Components. Motion uses transform and opacity only. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: 400 17px/22px var(--font);
  letter-spacing: -.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input { font: inherit; letter-spacing: inherit; color: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }

:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.screen-scroll:focus-visible, .sheet:focus-visible { outline: none; }

.icon {
  width: 24px; height: 24px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: var(--icon-w, 1.75);
  stroke-linecap: round; stroke-linejoin: round;
}

.press { transition: transform .42s var(--spring), opacity .2s ease; }
.press:active { transform: scale(.96); transition-duration: .1s; }

/* App surfaces */
.app { position: relative; overflow: hidden; background: #000; isolation: isolate; container: app / inline-size; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.app-stage { position: absolute; inset: 0; background: var(--bg); overflow: hidden; transform-origin: 50% 0; }
.app-stage.is-receded { border-radius: 14px; will-change: transform; }
.toast-host { position: absolute; left: 0; right: 0; top: calc(var(--safe-top) + 58px); z-index: 60; display: flex; justify-content: center; pointer-events: none; padding-inline: 16px; }

/* Tab bar */
.tabbar {
  position: absolute; z-index: 20;
  left: calc(var(--gutter) + var(--safe-left)); right: calc(var(--gutter) + var(--safe-right));
  bottom: calc(max(8px, var(--safe-bottom)) + 2px);
  height: 62px; padding: 4px; border-radius: 31px;
  display: grid; grid-template-columns: repeat(var(--n), 1fr);
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(22px) saturate(190%);
  backdrop-filter: blur(22px) saturate(190%);
  box-shadow: var(--float-shadow), inset 0 .5px 0 var(--glass-edge), inset 0 0 0 .5px var(--glass-line);
  touch-action: pan-y;
  transition: transform .5s var(--ease-ios), opacity .3s ease;
}
.tabbar.is-hidden { transform: translate3d(0, 130%, 0); opacity: 0; }
.tabbar.tabbar--static { position: relative; left: auto; right: auto; bottom: auto; }
.tabbar-lens {
  position: absolute; left: 4px; top: 4px; bottom: 4px;
  width: calc((100% - 8px) / var(--n));
  border-radius: 27px; background: var(--lens);
  box-shadow: inset 0 .5px 0 var(--glass-edge);
  pointer-events: none;
}
.tabbar-item { position: relative; display: block; height: 100%; border-radius: 27px; min-width: 0; }
.tabbar-item:focus-visible { outline-offset: -3px; }
.tabbar-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; line-height: 13px; font-weight: 500; letter-spacing: -.005em;
  transition: opacity .22s ease, transform .42s var(--spring);
  pointer-events: none;
}
.tabbar-face > span { white-space: nowrap; }
.tabbar-off { color: var(--text); opacity: 1; }
.tabbar-on { color: var(--link); font-weight: 600; opacity: 0; transform: scale(.92); }
.tabbar-item.is-near .tabbar-off { opacity: 0; transform: scale(.92); }
.tabbar-item.is-near .tabbar-on { opacity: 1; transform: scale(1); }
.badge {
  position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4.5px; border-radius: 9px;
  background: var(--red-fill); color: #fff; font-size: 11px; line-height: 17px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Segmented control */
.seg {
  position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  height: 34px; padding: 2px; border-radius: 11px; background: var(--fill);
  touch-action: pan-y;
}
.seg--large { height: 46px; border-radius: 15px; padding: 3px; }
.seg--large .seg-btn { font-size: 16px; }
.seg--large .seg-thumb, .seg--large .seg-thumb-face { border-radius: 12px; }
.seg--large .seg-thumb { left: 3px; top: 3px; bottom: 3px; width: calc((100% - 6px) / var(--n)); }
.seg--small { height: 30px; border-radius: 10px; }
.seg--small .seg-btn { font-size: 13px; }
.seg--small .seg-thumb, .seg--small .seg-thumb-face { border-radius: 8px; }
.seg-thumb { position: absolute; left: 2px; top: 2px; bottom: 2px; width: calc((100% - 4px) / var(--n)); border-radius: 9px; pointer-events: none; }
.seg-thumb-face { position: absolute; inset: 0; border-radius: 9px; background: var(--thumb); box-shadow: var(--thumb-shadow); }
:root[data-theme="dark"] .seg-thumb-face { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-thumb-face { background: #636366; } }
.seg-tone { opacity: 0; transition: opacity .24s ease; box-shadow: none; }
.seg-tone.is-on { opacity: 1; }
:root .seg-tone[data-tone="buy"] { background: var(--green-fill); }
:root .seg-tone[data-tone="sell"] { background: var(--red-fill); }
.seg-btn { position: relative; min-width: 0; font-size: 14px; line-height: 18px; font-weight: 500; border-radius: 10px; touch-action: pan-y; }
.seg-btn:focus-visible { outline-offset: -1px; }
.seg-btn::after { content: ""; position: absolute; inset: -4px 0; }
.seg-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding-inline: 4px; white-space: nowrap; transition: opacity .2s ease; pointer-events: none; color: var(--text);
}
.seg-label-on { font-weight: 600; opacity: 0; }
.seg-on-tone { color: #fff; }
.seg-btn[aria-checked="true"] .seg-label { opacity: 0; }
.seg-btn[aria-checked="true"] .seg-label-on { opacity: 1; }

/* Switch */
.switch { position: relative; flex: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill-strong); overflow: visible; }
.switch-on { position: absolute; inset: 0; border-radius: 16px; background: var(--green-fill); opacity: 0; transition: opacity .22s ease; }
.switch-thumb {
  position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 14px;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .22), 0 0 1px rgba(0, 0, 0, .2);
  transition: transform .42s var(--spring); transform-origin: 50% 50%;
}
.switch[aria-checked="true"] .switch-on { opacity: 1; }
.switch[aria-checked="true"] .switch-thumb { transform: translate3d(20px, 0, 0); }
.switch:active .switch-thumb { transform: scale(1.14, .98); }
.switch[aria-checked="true"]:active .switch-thumb { transform: translate3d(20px, 0, 0) scale(1.14, .98); }

/* Screens and stack */
.stack { position: absolute; inset: 0; }
.screen { position: absolute; inset: 0; background: var(--bg); display: block; overflow: hidden; }
.screen[hidden] { display: none; }
.screen.is-moving { will-change: transform; box-shadow: -14px 0 34px rgba(0, 0, 0, .12); }
.screen-dim { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 12; }
.screen-edge { position: absolute; left: 0; top: calc(var(--safe-top) + var(--nav-h)); bottom: 0; width: 26px; z-index: 11; touch-action: pan-y; }
.screen-scroll {
  position: absolute; inset: 0; overflow: hidden auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding-top: calc(var(--safe-top) + var(--nav-h));
  padding-bottom: calc(max(8px, var(--safe-bottom)) + 92px);
  scrollbar-width: none;
}
.screen-scroll::-webkit-scrollbar { display: none; }
.screen.no-tabbar .screen-scroll { padding-bottom: calc(max(12px, var(--safe-bottom)) + 16px); }
/* Compact: the large title's line box is centred on the bar, so it lines up with the avatar. */
.screen--compact .screen-scroll { padding-top: calc(var(--safe-top) + 6px); }
.screen-body { display: flex; flex-direction: column; gap: 24px; }
.screen-pad { padding-inline: calc(var(--gutter) + var(--safe-left)) calc(var(--gutter) + var(--safe-right)); }

/* Top bar, buttons and large title: kit/header.css */

/* Section labels and groups */
.section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.section-title { font-size: 20px; line-height: 25px; font-weight: 600; letter-spacing: -.02em; padding-inline: calc(var(--gutter) + var(--safe-left)) calc(var(--gutter) + var(--safe-right)); }
.section-note { font-size: 13px; line-height: 18px; color: var(--hint); padding-inline: calc(var(--gutter) + 4px + var(--safe-left)) calc(var(--gutter) + var(--safe-right)); }
.group { margin-inline: calc(var(--gutter) + var(--safe-left)) calc(var(--gutter) + var(--safe-right)); border-radius: var(--r-group); background: var(--card); overflow: hidden; box-shadow: var(--card-shadow); }
[data-data-status] { display: inline-flex; align-items: center; gap: 6px; color: var(--hint); font-size: 13px; line-height: 18px; font-weight: 400; letter-spacing: -.005em; white-space: nowrap; }
[data-data-status]:empty { display: none; }
.data-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--green-fill); }
[data-state="down"] .data-dot { background: var(--hint); opacity: .7; }

/* Numbers wait for the first real prices in live mode, then fade in. */
.market-pending :is([data-price], [data-change], .spark, .balance-value, .balance-foot, .position-pnl, .stats dd, .pair-price, .asset-right, .alloc, .summary-row b, .order-sub) { opacity: 0; }
.market-reveal :is([data-price], [data-change], .spark, .balance-value, .balance-foot, .position-pnl, .stats dd, .pair-price, .asset-right, .alloc, .summary-row b, .order-sub) { animation: market-in .32s ease-out both; }
@keyframes market-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .market-reveal :is([data-price], [data-change], .spark, .balance-value, .balance-foot, .position-pnl, .stats dd, .pair-price, .asset-right, .alloc, .summary-row b, .order-sub) { animation: none; } }


/* Cell */
.cell {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 16px; text-align: left;
  background: transparent;
}
.cell + .cell::before { content: ""; position: absolute; top: 0; right: 0; left: var(--sep-left, 16px); height: .5px; background: var(--sep); }
.press-row { overflow: hidden; }
.press-row::after { content: ""; position: absolute; inset: 0; background: var(--text); opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.press-row:active::after { opacity: .06; transition-duration: .05s; }
.press-row:focus-visible { outline-offset: -3px; border-radius: 16px; }
.cell-tile { --sep-left: 57px; }
.cell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cell-title { font-size: 16px; line-height: 21px; }
.cell-sub { font-size: 13px; line-height: 17px; color: var(--hint); }
.cell-value { color: var(--hint); font-size: 16px; line-height: 21px; white-space: nowrap; }
.cell-chevron { color: var(--hint); opacity: .55; margin-right: -4px; }
.cell-check { color: var(--link); opacity: 0; transition: opacity .15s ease; }
.is-selected > .cell-check { opacity: 1; }

/* Search */
.search { display: flex; align-items: center; gap: 7px; height: 38px; padding-inline: 11px; border-radius: 12px; background: var(--fill); color: var(--hint); }
.search:focus-within { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font-size: 16px; height: 100%; padding: 0; user-select: text; -webkit-user-select: text; }
.search input::placeholder { color: var(--hint); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }

/* Buttons */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 50px; padding-inline: 20px; border-radius: 16px;
  background: var(--accent); color: var(--on-accent); font-size: 17px; line-height: 22px; font-weight: 600; white-space: nowrap;
}
.btn--buy { background: var(--green-fill); color: #fff; }
.btn--sell { background: var(--red-fill); color: #fff; }
.btn--tinted { background: var(--fill); color: var(--text); }
.btn--small { min-height: 38px; padding-inline: 14px; border-radius: 12px; font-size: 15px; }
.btn--wide { width: 100%; }
.btn-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 10px; }

.action { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text); min-width: 0; }
.action-disc { width: 52px; height: 52px; border-radius: 26px; background: var(--card); display: flex; align-items: center; justify-content: center; color: var(--link); box-shadow: var(--card-shadow); }

/* Sheet */
.sheet-root { position: absolute; inset: 0; z-index: 40; --sheet-top-gap: 44; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; }
.sheet {
  /* Attached to the screen edge: the home-indicator inset belongs to its padding, so no gap ever shows beneath it.
     The second shadow keeps the sheet's colour under it when a drag lifts it past the top. */
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; border-radius: 32px 32px 0 0; background: var(--card);
  box-shadow: var(--sheet-shadow), 0 200px 0 var(--card); overflow: hidden; will-change: transform;
}
.sheet-top { flex: none; touch-action: none; cursor: grab; }
.sheet.is-dragging .sheet-top { cursor: grabbing; }
.sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: 7px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 14px 10px 20px; }
.sheet-title { font-size: 20px; line-height: 25px; font-weight: 700; letter-spacing: -.02em; min-width: 0; }
.sheet-body {
  flex: 1; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 2px calc(16px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(16px + var(--safe-left)); display: flex; flex-direction: column; gap: 14px; scrollbar-width: none;
}
.sheet-body::-webkit-scrollbar { display: none; }
.sheet-body.is-locked { overflow: hidden; }
.sheet-body .group { margin-inline: 0; background: var(--fill); box-shadow: none; }
.sheet-list { margin-inline: -16px; }
/* Stays in view under a body that scrolls. */
.sheet-dock { flex: none; padding: 8px calc(16px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(16px + var(--safe-left)); box-shadow: 0 -.5px 0 var(--sep); background: var(--card); }

/* Toast */
.toast {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; max-width: 100%; padding: 8px 15px 8px 12px; border-radius: 20px;
  font-size: 14px; line-height: 19px; font-weight: 600; color: var(--text);
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(22px) saturate(190%);
  backdrop-filter: blur(22px) saturate(190%);
  box-shadow: var(--float-shadow), inset 0 .5px 0 var(--glass-edge);
  transform: translate3d(0, -18px, 0) scale(.86); opacity: 0;
  transition: transform .5s var(--spring), opacity .22s ease;
}
.toast.is-in { transform: none; opacity: 1; }
.toast--up .icon { color: var(--green); }
.toast--down .icon { color: var(--red); }
.toast--accent .icon { color: var(--link); }

/* Value slider */
.slider { display: flex; flex-direction: column; touch-action: pan-y; }
.slider.is-disabled { opacity: .4; pointer-events: none; }
.slider-control { position: relative; height: 36px; touch-action: pan-y; cursor: pointer; border-radius: 12px; }
.slider-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--fill-strong); overflow: hidden; }
.slider-fill { position: absolute; inset: 0; overflow: hidden; will-change: transform; }
.slider-fill-in { position: absolute; inset: 0; background: var(--accent); }
.slider--risk .slider-fill-in { background: linear-gradient(90deg, var(--green-fill) 0%, #e5b700 42%, var(--orange) 66%, var(--red-fill) 100%); }
.slider-tick { position: absolute; top: 1.5px; width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%; background: var(--hint); opacity: .75; }
.slider-tick.is-on { background: #fff; opacity: .95; }
.slider-thumb {
  position: absolute; left: 0; top: 50%; width: 28px; height: 28px; margin-top: -14px; pointer-events: none; will-change: transform;
}
.slider-thumb::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 4px 12px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .05);
  transition: transform .42s var(--spring);
}
.slider-control.is-pressed .slider-thumb::before { transform: scale(1.2); transition-duration: .22s; }
.slider-bubble {
  position: absolute; left: 50%; bottom: calc(100% + 11px); min-width: 44px; padding: 4px 10px; border-radius: 11px; text-align: center; white-space: nowrap;
  font-size: 13px; line-height: 17px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--text); color: var(--card);
  transform: translate3d(-50%, 6px, 0) scale(.8); transform-origin: 50% 100%; opacity: 0;
  transition: transform .34s var(--spring), opacity .14s ease;
}
.slider-control.is-active .slider-bubble { transform: translate3d(-50%, 0, 0); opacity: 1; }
.slider-control:focus-visible { outline-offset: 3px; }
.slider-stops { position: relative; height: 28px; }
.slider-stop {
  position: absolute; top: 0; transform: translate3d(-50%, 0, 0); height: 28px; min-width: 44px; padding-inline: 6px; border-radius: 9px;
  font-size: 13px; line-height: 28px; font-weight: 500; color: var(--hint); font-variant-numeric: tabular-nums; text-align: center;
  transition: opacity .2s ease;
}
.slider-stop:last-child { transform: translate3d(calc(-100% + 14px), 0, 0); text-align: right; padding-right: 0; }
.slider-stop.is-on { color: var(--text); font-weight: 600; }
.slider-stop:active { opacity: .5; }
.slider-stop::after { content: ""; position: absolute; inset: 0 -2px -10px; }

/* Carousel */
.carousel { position: relative; overflow: hidden; touch-action: pan-y; cursor: grab; container-type: inline-size; padding-block: 2px 6px; margin-block: -2px -6px; outline-offset: -2px; }
.carousel.is-dragging { cursor: grabbing; }
.carousel-track { display: flex; gap: 10px; width: max-content; padding-inline: 16px; will-change: transform; }
.carousel-track > * { flex: none; }
.carousel--cover { padding-block: 8px 30px; margin-block: -8px -30px; }
.carousel--cover .carousel-track { padding-inline: var(--gutter); }
.carousel--cover .carousel-track > * { width: calc(100cqw - 2 * var(--gutter)); will-change: transform, opacity; }
.item-wide { width: calc(100cqw - 44px); }
.dots { position: relative; align-self: center; display: flex; gap: 8px; height: 6px; margin-top: 2px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--fill-strong); }
.dots b { position: absolute; left: 0; top: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--text); transition: transform .42s var(--spring); }

/* Swipe to confirm */
.swipe { position: relative; height: 64px; border-radius: 32px; background: var(--fill); overflow: hidden; touch-action: pan-y; }
.swipe.is-disabled { opacity: .45; pointer-events: none; }
.swipe-fill { position: absolute; inset: 0; border-radius: 32px; overflow: hidden; will-change: transform; }
.swipe-fill-face { position: absolute; inset: 0; opacity: 0; transition: opacity .25s ease; }
.swipe-fill-face.is-on { opacity: 1; }
.swipe-fill-face[data-face="accent"] { background: var(--accent); }
.swipe-fill-face[data-face="buy"] { background: var(--green-fill); }
.swipe-fill-face[data-face="sell"] { background: var(--red-fill); }
.swipe-text { position: absolute; inset: 0; padding-inline: 64px 16px; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: 16px; line-height: 21px; font-weight: 600; text-align: center; }
.swipe-label { position: relative; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The sheen is a window sliding over a counter-moving copy of the label: two transforms, no repaint. */
.swipe-sheen { position: absolute; inset: 0; overflow: hidden; display: block; padding-inline: 64px 16px; }
.swipe-sheen-in { display: block; position: absolute; top: 0; bottom: 0; left: 0; width: 34%; overflow: hidden; animation: sheen-window 2.8s linear infinite; -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%, #000 60%, transparent); mask-image: linear-gradient(90deg, transparent, #000 40%, #000 60%, transparent); }
.swipe-sheen-text { position: absolute; top: 0; bottom: 0; left: 0; width: var(--swipe-w, 358px); display: flex; align-items: center; justify-content: center; padding-inline: 64px 16px; color: var(--text); white-space: nowrap; animation: sheen-copy 2.8s linear infinite; }
@keyframes sheen-window { from { transform: translate3d(calc(var(--swipe-w, 358px) * -.34), 0, 0); } to { transform: translate3d(var(--swipe-w, 358px), 0, 0); } }
@keyframes sheen-copy { from { transform: translate3d(calc(var(--swipe-w, 358px) * .34), 0, 0); } to { transform: translate3d(calc(var(--swipe-w, 358px) * -1), 0, 0); } }
.swipe-thumb {
  position: absolute; left: 4px; top: 4px; width: 56px; height: 56px; border-radius: 50%; background: #fff; color: #111;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 5px 14px rgba(0, 0, 0, .18); touch-action: pan-y; cursor: grab; will-change: transform;
}
.swipe-thumb::before { content: ""; position: absolute; inset: 0; border-radius: 50%; transition: transform .4s var(--spring); }
.swipe.is-pressed .swipe-thumb { cursor: grabbing; }
.swipe-thumb-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transition: opacity .2s ease, transform .45s var(--spring); }
.swipe-thumb-check { opacity: 0; transform: scale(.4); color: var(--green); }
.swipe[data-tone="sell"] .swipe-thumb-check { color: var(--red); }
.swipe[data-tone="accent"] .swipe-thumb-check { color: var(--accent); }
.swipe.is-confirmed .swipe-thumb-arrow { opacity: 0; transform: scale(.4); }
.swipe.is-confirmed .swipe-thumb-check { opacity: 1; transform: scale(1); }
.swipe.is-confirmed .swipe-text { opacity: 0 !important; }

/* Numeric roll */
.roll { display: inline-flex; white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: bottom; }
.roll-d { display: block; height: 1.2em; line-height: 1.2em; overflow: hidden; }
.roll-col { display: block; transition: transform .6s var(--ease-out); will-change: transform; }
.roll-col > span { display: block; height: 1.2em; line-height: 1.2em; }
.roll-c { display: block; height: 1.2em; line-height: 1.2em; white-space: pre; }
.roll-enter { animation: roll-in .36s var(--ease-out) both; }
@keyframes roll-in { from { opacity: 0; transform: translate3d(0, .35em, 0); } to { opacity: 1; transform: none; } }
/* A live price that just moved, see CK.priceTick. Only the digits that change get a layer, and only while they run. */
.is-ticking .roll-col { will-change: auto; }
.market-price b.roll .roll-d, .market-price b.roll .roll-c, .market-price b.roll .roll-col > span { height: 21px; line-height: 21px; }
.coin-card-price.roll .roll-d, .coin-card-price.roll .roll-c, .coin-card-price.roll .roll-col > span { height: 22px; line-height: 22px; }
.tick { position: relative; }
.tick::after { content: ""; position: absolute; inset: -1px -4px; border-radius: 5px; background: var(--green); opacity: 0; pointer-events: none; }
.tick-down::after { background: var(--red); }

/* Coin logo */
.coin { width: var(--coin-size, 40px); height: var(--coin-size, 40px); border-radius: 50%; flex: none; display: block; }
.coin--tile {
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .3);
}
.coin--tile b { font-size: calc(var(--coin-size, 40px) * .29); line-height: 1; font-weight: 700; letter-spacing: -.02em; }
.coin--neutral { background: var(--fill-strong); color: var(--hint); box-shadow: none; }
.coin--neutral b { font-weight: 600; letter-spacing: 0; }

.coin--logo { pointer-events: none; box-shadow: 0 0 0 .5px var(--coin-edge); }

/* App icon tile: 22.5 % corner radius */
.tile {
  position: relative; width: var(--tile-size); height: var(--tile-size); border-radius: 22.5%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; --icon-knock: var(--tile-base); background: linear-gradient(180deg, var(--tile-top), var(--tile-base));
  box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .28), inset 0 0 0 .5px rgba(0, 0, 0, .05);
}
@supports (corner-shape: superellipse(2)) { .tile { corner-shape: superellipse(1.6); border-radius: 26%; } }
.tile--blue { --tile-top: #3a9bff; --tile-base: #0a6cff; }
.tile--indigo { --tile-top: #7a7bff; --tile-base: #4b45e0; }
.tile--purple { --tile-top: #c56bf0; --tile-base: #9b37d6; }
.tile--pink { --tile-top: #ff5f8f; --tile-base: #f0245f; }
.tile--red { --tile-top: #ff6b5e; --tile-base: #ec2f26; }
.tile--orange { --tile-top: #ffb03a; --tile-base: #ff8a00; }
.tile--yellow { --tile-top: #ffd84a; --tile-base: #f5b301; }
.tile--green { --tile-top: #4fd97a; --tile-base: #1fb24e; }
.tile--teal { --tile-top: #48cfe0; --tile-base: #10a4c4; }
.tile--gray { --tile-top: #a4a4ad; --tile-base: #74747e; }
.tile--ink { --tile-top: #4c4c52; --tile-base: #1c1c1f; }

/* Sparkline. The chart lives in chart.css. */
.spark { position: relative; display: block; width: 100%; height: 100%; }
.spark.is-up { color: var(--green); }
.spark.is-down { color: var(--red); }
.spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.spark-dot { position: absolute; right: -2px; top: var(--end-y); width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: currentColor; }
@keyframes spark-pulse { from { transform: scale(1); opacity: .5; } 70%, to { transform: scale(3); opacity: 0; } }


/* Change pill */
.change { display: inline-flex; align-items: center; gap: 2px; height: 24px; padding-inline: 6px 8px; border-radius: 12px; font-size: 13px; line-height: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.change .icon { stroke-width: 3; }
.change.is-up { color: var(--green); background: var(--green-soft); }
.change.is-down { color: var(--red); background: var(--red-soft); }
.change--plain { background: none !important; padding: 0; height: 17px; }

.tag { display: inline-flex; align-items: center; height: 20px; padding-inline: 7px; border-radius: 7px; font-size: 12px; line-height: 16px; font-weight: 600; background: var(--fill); color: var(--hint); white-space: nowrap; }
.tag--up { color: var(--green); background: var(--green-soft); }
.tag--down { color: var(--red); background: var(--red-soft); }
.tagset { display: inline-flex; gap: 4px; }

/* Cards */
.card { display: block; border-radius: var(--r-card); background: var(--card); box-shadow: var(--card-shadow); text-align: left; }
.coin-card { width: 158px; padding: 14px; display: flex; flex-direction: column; }
.coin-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.coin-card-name { font-size: 13px; line-height: 17px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-card-price { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.coin-card .spark { height: 28px; margin-top: 8px; }

.balance {
  position: relative; display: flex; flex-direction: column; min-height: 164px; padding: 16px; border-radius: var(--r-card); color: #fff; overflow: hidden;
  background: linear-gradient(170deg, color-mix(in srgb, var(--tint) 90%, #fff), color-mix(in srgb, var(--tint) 92%, #000));
}
.balance-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.balance-label { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; line-height: 20px; font-weight: 500; opacity: .92; --icon-knock: var(--tint); min-width: 0; }
.balance-eye { position: relative; width: 36px; height: 36px; margin: -6px -8px -6px 0; border-radius: 18px; flex: none; }
.balance-eye::after { content: ""; position: absolute; inset: -4px; }
.balance-eye > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transition: opacity .2s ease; }
.balance-eye-b { opacity: 0; }
.balance-eye[aria-pressed="true"] .balance-eye-a { opacity: 0; }
.balance-eye[aria-pressed="true"] .balance-eye-b { opacity: 1; }
.balance-total { position: relative; margin-top: auto; padding-top: 18px; font: 700 34px/41px var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; min-height: 59px; }
.balance-value, .balance-mask { transition: opacity .24s ease, transform .4s var(--ease-out); }
.balance-mask { position: absolute; left: 0; bottom: 0; opacity: 0; transform: translate3d(0, 6px, 0); letter-spacing: .06em; }
.balance.is-hidden .balance-value { opacity: 0; transform: translate3d(0, -6px, 0); }
.balance.is-hidden .balance-mask { opacity: 1; transform: none; }
.balance-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; font-size: 14px; line-height: 19px; font-weight: 500; font-variant-numeric: tabular-nums; transition: opacity .24s ease; }
.balance-pnl { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; min-width: 0; }
.balance-pnl .icon { stroke-width: 2.6; }
.balance-pct { padding: 2px 8px; border-radius: 10px; background: rgba(255, 255, 255, .18); white-space: nowrap; }
.balance.is-hidden .balance-foot { opacity: 0; }

.position-card { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.position-head { display: flex; align-items: center; gap: 10px; }
.position-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.position-title b { font-size: 16px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.position-pnl { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.position-pnl b { font-size: 16px; line-height: 20px; font-weight: 600; }
.position-pnl span { font-size: 13px; line-height: 17px; font-weight: 500; }
.position-pnl.is-up { color: var(--green); }
.position-pnl.is-down { color: var(--red); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats > div { min-width: 0; }
.stats dt { font-size: 12px; line-height: 16px; color: var(--hint); white-space: nowrap; }
.stats dd { font-size: 14px; line-height: 19px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.risk { display: flex; align-items: center; gap: 10px; }
.risk-track { position: relative; flex: 1; height: 5px; border-radius: 3px; background: var(--fill-strong); overflow: hidden; }
.risk-track i { position: absolute; inset: 0; background: var(--accent); border-radius: 3px; }
.risk-label { font-size: 12px; line-height: 16px; color: var(--hint); font-variant-numeric: tabular-nums; white-space: nowrap; }

.order-card { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.ring { position: relative; flex: none; width: 44px; height: 44px; display: block; }
.ring svg { display: block; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--fill-strong); stroke-width: 3.5; }
.ring-fg { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; }
.ring.is-up { color: var(--green); }
.ring.is-down { color: var(--red); }
.ring > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.order-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.order-title { display: flex; align-items: center; gap: 6px; }
.order-title b { font-size: 16px; line-height: 21px; font-weight: 600; white-space: nowrap; }
.order-sub { font-size: 13px; line-height: 17px; color: var(--hint); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.market-row { min-height: 64px; --sep-left: 68px; }
.market-name { flex: 1 1 auto; min-width: 58px; display: flex; flex-direction: column; overflow: hidden; }
.market-name b { font-size: 16px; line-height: 21px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-name span { font-size: 13px; line-height: 17px; color: var(--hint); white-space: nowrap; }
.market-spark { flex: 0 0 58px; width: 58px; height: 28px; }
.market-price { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; min-width: 78px; }
.market-price b { font-size: 15px; line-height: 21px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }


/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 17px; color: var(--hint); }
.field-label b { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.field-box { display: flex; align-items: center; gap: 6px; height: 50px; padding-inline: 14px; border-radius: var(--r-field); background: var(--fill); }
.field-box:focus-within { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.field-box input { flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; background: none; outline: none; padding: 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text; }
.field-box input:disabled { color: var(--hint); -webkit-text-fill-color: var(--hint); opacity: 1; }
.field-unit { font-size: 15px; font-weight: 500; color: var(--hint); }

/* Narrow phones: 320 and 340 */
@container app (max-width: 350px) {
  .market-spark { display: none; }
  .seg-btn { font-size: 12.5px; }
  .seg--large .seg-btn { font-size: 16px; }
  .balance { padding-inline: 16px; }
  .balance-total { font-size: 29px; }
  .coin-card { width: 146px; }
  .tabbar { left: 6px; right: 6px; }
  .tabbar-face { font-size: 10px; }
  .cell { gap: 10px; }
  .cell-title, .cell-value { font-size: 15px; }
  .stats dd { font-size: 13px; }
  .stats dt { font-size: 11px; }
}

/* Reduced motion: state changes stay, travel goes */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .swipe-sheen { display: none; }
}

/* Clip instead of hidden: focus and scrollIntoView must never scroll the app shell itself. */
@supports (overflow: clip) {
  .app, .app-stage, .screen, .carousel { overflow: clip; }
}

/* Focus rings only for keyboard users, see kit/core.js. */
* { -webkit-tap-highlight-color: transparent; }
:root[data-input="pointer"] :focus-visible { outline: none !important; }

/* A docked control carries the inset itself, the body above it does not need it twice. */
.sheet-body:has(+ .sheet-dock) { padding-bottom: 14px; }
