/* Demo shell: the phone frame on desktop, full bleed on a phone. */
.page { height: 100%; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 20px; }
.device {
  position: relative; flex: none; width: var(--device-w, 390px); height: min(844px, 100%); max-height: 100%;
  border-radius: 44px; overflow: hidden; display: flex; flex-direction: column; background: #000;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 30px 70px rgba(0, 0, 0, .22), 0 8px 20px rgba(0, 0, 0, .1);
}
.device .app { flex: 1; min-height: 0; --safe-bottom: 18px; }
.device::after {
  content: ""; position: absolute; left: 50%; bottom: 7px; width: 128px; height: 5px; margin-left: -64px; border-radius: 3px;
  background: var(--text); opacity: .85; z-index: 100; pointer-events: none;
}
.tg-header { position: relative; z-index: 2; flex: none; height: 54px; display: flex; align-items: center; justify-content: space-between; padding-inline: 16px; padding-top: 6px; background: var(--bg); color: var(--text); }
.tg-header-title { position: absolute; left: 90px; right: 90px; text-align: center; display: flex; flex-direction: column; font-size: 15px; line-height: 19px; font-weight: 600; }
.tg-header-title span { font-size: 12px; line-height: 15px; font-weight: 400; color: var(--hint); }
.tg-header-name { display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 600; }
.tg-header-name svg { flex: none; }
.tg-header-close { font-size: 16px; color: var(--link); }
.tg-header-more { display: flex; color: var(--link); }

.stage-panel { flex: none; width: 214px; display: flex; flex-direction: column; gap: 18px; color: var(--text); }
.stage-panel h1 { font: 700 22px/27px var(--font-display); letter-spacing: -.02em; }
.stage-panel h1 svg { display: block; width: 186px; height: auto; fill: currentColor; }
.stage-group { display: flex; flex-direction: column; gap: 7px; }
.stage-group > span { font-size: 13px; line-height: 17px; color: var(--hint); }
.stage-panel .seg-btn { font-size: 13px; }

@media (max-width: 760px) { .stage-panel { display: none; } }
@media (max-width: 520px) {
  .page { display: block; padding: 0; }
  .device { width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; }
  .device::after, .tg-header { display: none; }
  .device .app { --safe-bottom: max(var(--env-bottom), var(--tg-safe-area-inset-bottom, 0px)); }
}
.in-telegram .tg-header, .in-telegram .device::after { display: none; }

/* Tabs */
.tab-pane { position: absolute; inset: 0; opacity: 0; visibility: hidden; transform: scale(.992); transition: opacity .2s ease, transform .3s var(--ease-out), visibility 0s linear .2s; }
.tab-pane.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity .22s ease, transform .34s var(--ease-out); }

/* Markets */
.stack-tight { display: flex; flex-direction: column; gap: 10px; }
.list-in { animation: list-in .28s var(--ease-out) both; }
@keyframes list-in { from { opacity: 0; transform: translate3d(0, 6px, 0); } to { opacity: 1; transform: none; } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; text-align: center; color: var(--hint); font-size: 15px; line-height: 20px; }
.empty .icon { opacity: .6; }

/* Coin detail */
.detail-title { display: inline-flex; align-items: center; gap: 7px; }
.detail-price { font: 700 36px/44px var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.detail-meta { display: flex; align-items: center; gap: 8px; min-height: 24px; color: var(--hint); font-size: 14px; }
.detail-meta [data-data-status] { margin-left: auto; }
.detail-head { display: flex; flex-direction: column; gap: 2px; min-height: 70px; }
.detail-price-slot { flex: none; height: 44px; }
.detail-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 9; padding: 10px calc(var(--gutter) + var(--safe-right)) calc(max(10px, var(--safe-bottom)) + 4px) calc(var(--gutter) + var(--safe-left)); background: var(--glass-tint); -webkit-backdrop-filter: blur(22px) saturate(190%); backdrop-filter: blur(22px) saturate(190%); box-shadow: 0 -.5px 0 var(--sep); }
.screen.has-bar .screen-scroll { padding-bottom: calc(max(10px, var(--safe-bottom)) + 84px); }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; padding: 14px 16px; }
.stat-grid dt { font-size: 13px; line-height: 17px; color: var(--hint); }
.stat-grid dd { font-size: 16px; line-height: 21px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Trade */
.order-form { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.form-divider { height: .5px; background: var(--sep); margin-inline: -16px; }
.lev-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 17px; color: var(--hint); }
.lev-value { font-size: 20px; line-height: 25px; font-weight: 700; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary { display: flex; flex-direction: column; gap: 8px; }
.summary-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; line-height: 19px; color: var(--hint); }
.summary-row > b { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.receipt-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 2px; text-align: center; }
.receipt-hero .icon { color: var(--green); }
.receipt-hero b { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -.02em; }
.receipt-hero span { font-size: 14px; line-height: 19px; color: var(--hint); }
.receipt-pop { animation: receipt-pop .6s var(--spring) both; }
@keyframes receipt-pop { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }

/* Portfolio */
.action-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.alloc { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.alloc-bar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
.alloc-bar i { display: block; height: 100%; background: var(--c); min-width: 3px; }
.alloc-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-size: 13px; line-height: 18px; }
.alloc-legend span { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--hint); white-space: nowrap; }
.alloc-legend span i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.alloc-legend em { font-style: normal; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.alloc-legend b { margin-left: auto; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.asset-row { min-height: 60px; --sep-left: 68px; }
.asset-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.asset-right b { font-size: 15px; line-height: 21px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.asset-right > span:not(.change) { font-size: 13px; line-height: 17px; color: var(--hint); white-space: nowrap; }
.orders-stack { display: flex; flex-direction: column; gap: 10px; }

/* Profile */
.theme-row { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }

/* Kit */
.kit-panel { display: none; flex-direction: column; gap: 22px; }
.kit-panel.is-active { display: flex; animation: list-in .28s var(--ease-out) both; }
.kit-box { position: relative; border-radius: var(--r-group); padding: 14px; overflow: hidden; }
.kit-box--glass {
  background:
    radial-gradient(70% 90% at 15% 15%, #ffb36b, transparent 70%),
    radial-gradient(70% 90% at 85% 25%, #6aa9ff, transparent 70%),
    radial-gradient(90% 90% at 55% 100%, #b07bff, transparent 70%),
    #dfe3ea;
}
.kit-col { display: flex; flex-direction: column; gap: 10px; }
.kit-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 10px; }
.icon-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 12px; transition: transform .4s var(--spring); }
.icon-cell:active { transform: scale(.86); transition-duration: .1s; }
.icon-cell:focus-visible { outline-offset: -2px; }
.tile-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px; padding: 14px 16px; }
.tile-palette { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 14px 16px; justify-items: center; }
@container app (max-width: 350px) {
  .icon-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tile-palette { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .detail-price { font-size: 32px; }
  .action-disc { width: 48px; height: 48px; }
  #market-filter .seg-btn { font-size: 11.5px; }
}

@supports (overflow: clip) {
  .device { overflow: clip; }
  body { overflow: clip; }
}

/* Inside Telegram the app always fills the window, whatever its width. */
.in-telegram .page, .tg-launch .page { display: block; padding: 0; }
.in-telegram .device, .tg-launch .device { width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; }
.in-telegram .stage-panel, .tg-launch .stage-panel, .in-telegram #row-preset, .tg-launch #row-preset { display: none; }
.in-telegram .device .app, .tg-launch .device .app { --safe-bottom: max(var(--env-bottom), var(--tg-safe-area-inset-bottom, 0px)); }
