:root {
  --bg: var(--tg-theme-bg-color, #f5f6f8);
  --card: var(--tg-theme-secondary-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #15171a);
  --hint: var(--tg-theme-hint-color, #7c828b);
  --accent: #e81835;
  --accent-2: #ff4d62;
  --line: color-mix(in srgb, var(--hint) 22%, transparent);
  --green: #20b486;
  --orange: #ff9c27;
  --red-soft: rgba(232, 24, 53, .10);
  --shadow: 0 12px 30px rgba(18, 24, 32, .08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; max-width: 640px; margin: 0 auto; padding: env(safe-area-inset-top) 0 calc(88px + env(safe-area-inset-bottom)); }
.topbar { height: 58px; padding: 8px 14px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(18px); }
.brand { flex: 1; display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 750; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 50%; }
.tron-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; color: white; background: linear-gradient(145deg, #fc2c47, #b9001d); transform: rotate(180deg); font-weight: 900; }
.icon-button { border: 0; background: var(--card); min-width: 38px; height: 38px; border-radius: 13px; font-size: 25px; line-height: 1; box-shadow: 0 4px 16px rgba(0,0,0,.05); cursor: pointer; }
.content { padding: 8px 14px 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.hero { padding: 26px 20px; text-align: center; overflow: hidden; position: relative; }
.hero::before { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(232,24,53,.08); right: -60px; top: -90px; }
.eyebrow { color: var(--hint); font-size: 14px; margin-bottom: 6px; }
.balance { font-size: clamp(44px, 13vw, 70px); font-weight: 350; letter-spacing: -2px; line-height: 1.15; }
.balance small { color: var(--hint); font-size: .55em; }
.primary-button { width: 100%; min-height: 54px; border: 0; border-radius: 18px; padding: 13px 18px; color: #fff; font-weight: 750; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 22px rgba(232,24,53,.25); cursor: pointer; }
.hero .primary-button { width: min(290px, 90%); margin-top: 24px; }
.secondary-button { min-height: 48px; border: 1px solid var(--line); border-radius: 16px; padding: 11px 16px; background: var(--card); font-weight: 700; cursor: pointer; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 24px 4px 12px; }
.section-title h2 { font-size: 20px; margin: 0; }
.section-title small { color: var(--hint); }
.empty { color: var(--hint); text-align: center; padding: 34px 12px; }
.order-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 15px 0; cursor: pointer; }
.order-row:last-child { border-bottom: 0; }
.pair-icon { width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, #55c6a2 0 50%, #f02142 50%); color: white; display: grid; place-items: center; font-weight: 850; }
.order-main b, .order-main small { display: block; }
.order-main small { color: var(--hint); margin-top: 4px; }
.amount-stack { text-align: right; }
.amount-stack b { display: block; color: var(--green); }
.amount-stack small { color: var(--hint); }
.badge { display: inline-flex; padding: 4px 8px; margin-left: 6px; border-radius: 8px; font-size: 12px; font-weight: 700; background: rgba(255,156,39,.14); color: var(--orange); }
.badge.DONE { background: rgba(32,180,134,.14); color: var(--green); }
.badge.EXPIRED, .badge.EMERGENCY { background: var(--red-soft); color: var(--accent); }
.form-card h1 { margin: 0 0 22px; font-size: 26px; }
.step-title { display:flex; align-items:center; gap:8px; margin:4px 0 22px; font-size:27px; }
.fee-pill { font-size:12px; padding:4px 8px; border-radius:7px; color:#17a87b; background:rgba(32,180,134,.12); font-weight:700; }
.amount-editor { text-align:center; padding:10px 0 18px; }
.network-pill { display:inline-flex; align-items:center; gap:5px; padding:6px 10px; border-radius:7px; color:#c31c32; background:rgba(232,24,53,.12); font-size:13px; }
.amount-display { margin:14px 0 2px; font-size:56px; font-weight:400; letter-spacing:-2px; min-height:70px; }
.amount-display span { color:var(--hint); }
.fiat-hint { color:var(--hint); min-height:20px; }
.field { margin-bottom: 18px; }
.field label { display: block; color: var(--hint); margin: 0 0 8px 3px; font-size: 14px; }
.input-wrap { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 5px 15px; background: var(--bg); border: 1.5px solid transparent; border-radius: 17px; }
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap input, .input-wrap select { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 18px; }
.currency { font-weight: 800; color: var(--accent); }
.switch-row { display: grid; grid-template-columns: 1fr 42px 1fr; align-items: stretch; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; margin-bottom: 18px; }
.coin-box { padding: 13px; }
.coin-box small, .coin-box b { display: block; }
.coin-box small { color: var(--hint); margin-bottom: 4px; }
.swap-arrows { display: grid; place-items: center; color: var(--hint); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.swap-toggle { width:38px; height:38px; border:1px solid var(--line); border-radius:50%; background:var(--card); color:var(--hint); font-size:18px; cursor:pointer; }
.currency-row { display:flex; align-items:center; justify-content:space-between; min-height:76px; padding:12px 16px; border-bottom:1px solid var(--line); }
.currency-row:last-child { border-bottom:0; }
.currency-info { display:flex; align-items:center; gap:12px; }
.currency-logo { width:42px; height:42px; border-radius:50%; display:grid; place-items:center; font-weight:850; color:#fff; }
.currency-logo.trx { background:#f31e3e; }
.currency-logo.usdt { background:#3fc39d; }
.currency-name small,.currency-name b { display:block; }
.currency-name small { color:var(--hint); margin-top:3px; }
.receive-estimate { color:var(--green); text-align:right; }
.keypad { display:grid; grid-template-columns:repeat(3,1fr) 1.25fr; gap:1px; margin:18px -18px -18px; background:var(--line); border-radius:20px; overflow:hidden; }
.keypad button { min-height:66px; border:0; background:color-mix(in srgb,var(--card) 95%,var(--bg)); font-size:27px; font-weight:650; cursor:pointer; }
.keypad .confirm-key { grid-column:4; grid-row:2 / span 3; color:#fff; background:var(--accent); font-size:19px; }
.keypad .zero-key { grid-column:2; }
.address-editor { width:100%; border:0; outline:0; background:var(--bg); border-radius:18px; min-height:118px; padding:22px 14px; text-align:center; color:var(--text); font-size:26px; font-weight:650; resize:none; }
.paste-button { display:block; margin:16px auto 38px; border:0; padding:10px 17px; border-radius:18px; background:var(--card); box-shadow:var(--shadow); cursor:pointer; }
.recent-title { font-size:18px; font-weight:750; margin:10px 2px; }
.recent-address { width:100%; border:0; border-top:1px solid var(--line); background:transparent; padding:16px 2px; text-align:left; cursor:pointer; }
.recent-address b,.recent-address small { display:block; word-break:break-all; }
.recent-address small { color:var(--hint); margin-top:7px; }
.sticky-action { position:sticky; bottom:0; padding-top:12px; background:linear-gradient(transparent,var(--bg) 25%); }
.provider-row { display:flex; justify-content:space-between; align-items:center; padding:15px 2px; }
.provider-tag { padding:5px 9px; border-radius:7px; color:#f28a22; background:rgba(255,156,39,.12); }
.qr-wrap { width:210px; height:210px; margin:0 auto 15px; display:grid; place-items:center; background:#fff; border-radius:18px; padding:12px; }
.qr-wrap svg { width:100%; height:100%; }
.large-payment { text-align:center; font-size:48px; margin:10px 0; font-weight:550; }
.large-payment span { color:var(--hint); font-size:.72em; }
.warning-box { padding:13px 15px; border-radius:12px; background:rgba(255,156,39,.18); color:#8a571b; margin:16px 0; font-size:13px; line-height:1.5; }
.detail-row { display:grid; grid-template-columns:115px 1fr auto; gap:10px; align-items:start; padding:12px 0; }
.detail-row > span:first-child { font-weight:700; }
.detail-row code { color:var(--hint); word-break:break-all; }
.app-footer { text-align:center; color:var(--hint); margin:24px 0 4px; }
.quote-box { background: var(--bg); border-radius: 17px; padding: 14px; margin-bottom: 16px; }
.quote-line { display: flex; justify-content: space-between; gap: 12px; margin: 7px 0; }
.quote-line span { color: var(--hint); }
.terms-check { display: flex; align-items: flex-start; gap: 10px; margin: 14px 2px 18px; font-size: 13px; color: var(--hint); }
.terms-check input { width: 18px; height: 18px; accent-color: var(--accent); }
a { color: var(--accent); text-decoration: none; }
.order-detail .status-hero { text-align: center; padding: 8px 0 20px; }
.status-ring { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; font-size: 30px; background: rgba(255,156,39,.13); color: var(--orange); }
.status-ring.DONE { background: rgba(32,180,134,.14); color: var(--green); }
.status-ring.EXPIRED, .status-ring.EMERGENCY { background: var(--red-soft); color: var(--accent); }
.payment-box { background: var(--bg); border-radius: 18px; padding: 15px; margin: 12px 0; }
.payment-box small { color: var(--hint); }
.payment-value { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-top: 7px; word-break: break-all; }
.copy-button { border: 0; flex: 0 0 auto; padding: 9px 12px; border-radius: 12px; background: var(--card); cursor: pointer; }
.countdown { text-align: center; color: var(--accent); font-weight: 700; margin: 12px 0; }
.profile { text-align: center; padding-top: 10px; }
.avatar { width: 82px; height: 82px; margin: 0 auto 12px; border-radius: 50%; background: linear-gradient(145deg, #f52243, #940017); color: #fff; display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.profile h1 { margin: 5px 0; }
.profile p { color: var(--hint); }
.settings-row { display: flex; justify-content: space-between; padding: 16px 2px; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(330px, calc(100% - 40px)); height: 64px; padding: 6px; display: grid; grid-template-columns: 1fr 1fr; background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 16px 38px rgba(0,0,0,.16); backdrop-filter: blur(16px); }
.nav-item { border: 0; border-radius: 19px; background: transparent; display: flex; gap: 8px; justify-content: center; align-items: center; cursor: pointer; }
.nav-item.active { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.loading-card { display: grid; place-items: center; min-height: 55vh; color: var(--hint); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 96px; transform: translateX(-50%); background: rgba(20,22,26,.92); color: #fff; padding: 11px 16px; border-radius: 14px; max-width: calc(100% - 40px); text-align: center; }
.error-card { text-align: center; padding: 36px 20px; }
.error-card h2 { color: var(--accent); }
.hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; } }
