/* Black & orange theme — always dark, independent of the Telegram theme. */
:root {
  color-scheme: dark;
  --bg: #08080a;
  --card: #131316;
  --card-2: #1c1c21;
  --border: rgba(255, 255, 255, .06);
  --text: #f5f5f7;
  --hint: #8d8d96;
  --accent: #ff8a00;
  --accent-2: #ffb03a;
  --accent-text: #120a00;
  --gradient: linear-gradient(135deg, #ff7a00 0%, #ffa733 100%);
  --link: #ffa733;
  --header: #ff9d2e;
  --danger: #ff5f57;
  --ok: #34d17c;
  --warn: #ffb020;
  --line: rgba(255, 255, 255, .07);
  --soft: rgba(255, 138, 0, .12);
  --soft-2: rgba(255, 138, 0, .2);
  --glow: 0 6px 24px rgba(255, 122, 0, .28);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: var(--tg-viewport-stable-height, 100vh);
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255, 122, 0, .14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button, input { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
::selection { background: var(--soft-2); }

#app { max-width: 560px; margin: 0 auto; padding: 12px 12px calc(88px + var(--safe-bottom)); }

/* ── loading ── */
.splash { display: grid; place-items: center; min-height: 70vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--soft-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--card-2), #26262c, var(--card-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── header ── */
.hero { display: flex; align-items: center; gap: 12px; padding: 8px 4px 16px; }
.hero img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; background: var(--card-2); flex: none; box-shadow: 0 0 0 2px var(--soft-2); }
.hero h1 { font-size: 20px; margin: 0; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--accent-2); font-size: 12px; font-weight: 700; margin-top: 5px; border: 1px solid var(--soft-2); }
.hero .sub { color: var(--hint); font-size: 13px; }

/* ── banners ── */
.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; display: flex; gap: 8px; border: 1px solid var(--border); }
.banner.info { background: var(--soft); border-color: var(--soft-2); }
.banner.warn { background: rgba(255, 176, 32, .1); border-color: rgba(255, 176, 32, .25); }

/* ── cards ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; margin-bottom: 12px; }
.card h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--header); margin: 0 0 12px; font-weight: 800; display: flex; justify-content: space-between; align-items: center; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .k { color: var(--hint); }
.row .v { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.row .v.strong { font-weight: 800; color: var(--accent-2); }
.row .v .sub { color: var(--hint); font-size: 12px; font-weight: 400; }
.muted { color: var(--hint); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--hint); padding: 18px 8px; }
.err { color: var(--danger); font-size: 14px; }

/* ── buttons ── */
.btn { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 13px; padding: 14px 16px; font-weight: 800; background: var(--gradient); color: var(--accent-text); cursor: pointer; transition: opacity .15s, transform .1s, box-shadow .15s; box-shadow: var(--glow); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .35; cursor: default; transform: none; box-shadow: none; }
.btn.ghost { background: var(--soft); color: var(--accent-2); box-shadow: none; border: 1px solid var(--soft-2); font-weight: 700; }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; border-radius: 10px; box-shadow: none; }
.link-btn { background: none; border: 0; color: var(--link); padding: 0; cursor: pointer; font-size: 13px; font-weight: 600; }
.btns { display: flex; gap: 8px; margin-top: 12px; }
.btns > * { flex: 1; }

/* ── wallet ── */
.wallet-head { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--soft); border: 1px solid var(--soft-2); display: grid; place-items: center; font-size: 18px; flex: none; }
.wallet-head .addr { font-weight: 700; }
.copy { cursor: pointer; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.badge.ok { background: rgba(52, 209, 124, .14); color: var(--ok); }
.badge.warn { background: rgba(255, 176, 32, .15); color: var(--warn); }
.balances { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.balance { background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.balance .lbl { color: var(--hint); font-size: 12px; }
.balance .amt { font-weight: 800; font-size: 16px; margin-top: 2px; overflow-wrap: anywhere; }

/* ── eligibility ── */
.check { display: flex; gap: 10px; padding: 9px 0; }
.check + .check { border-top: 1px solid var(--line); }
.check .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; margin-top: 1px; }
.check.ok .ic { background: rgba(52, 209, 124, .16); color: var(--ok); }
.check.bad .ic { background: rgba(255, 95, 87, .15); color: var(--danger); }
.check .t { font-weight: 600; }
.check .d { color: var(--hint); font-size: 13px; }
.verdict { margin-top: 12px; padding: 11px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; }
.verdict.ok { background: rgba(52, 209, 124, .12); color: var(--ok); border: 1px solid rgba(52, 209, 124, .22); }
.verdict.bad { background: var(--card-2); color: var(--text); font-weight: 500; border: 1px solid var(--border); }

/* ── sell ── */
.amount-box { display: flex; align-items: center; gap: 8px; background: var(--card-2); border-radius: 13px; padding: 4px 14px; border: 1.5px solid var(--border); transition: border-color .15s, box-shadow .15s; }
.amount-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.amount-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 26px; font-weight: 800; padding: 9px 0; caret-color: var(--accent); }
.amount-box input::placeholder { color: #4a4a52; }
.amount-box .sym { color: var(--accent-2); font-weight: 800; }
.chips { display: flex; gap: 6px; margin: 10px 0 4px; }
.chip { flex: 1; border: 1px solid var(--soft-2); border-radius: 10px; padding: 8px 0; background: var(--soft); color: var(--accent-2); font-weight: 700; font-size: 13px; cursor: pointer; transition: background .15s; }
.chip:active { background: var(--soft-2); }
.quote { margin: 12px 0; min-height: 70px; }
.quote .receive { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; }
.quote .receive .big { font-size: 22px; font-weight: 800; color: var(--accent-2); }
.quote .err { padding: 8px 0; }

/* ── order tracker ── */
.steps { list-style: none; margin: 4px 0 0; padding: 0; }
.steps li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; color: var(--hint); }
.steps li .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #34343b; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.steps li.done { color: var(--text); }
.steps li.done .dot { background: var(--gradient); border-color: transparent; color: var(--accent-text); }
.steps li.now { color: var(--text); font-weight: 700; }
.steps li.now .dot { border-color: var(--accent); color: var(--accent-2); }

/* ── token / search ── */
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; border: 1.5px solid var(--border); outline: 0; background: var(--card-2); border-radius: 11px; padding: 11px 12px; caret-color: var(--accent); }
.search input:focus { border-color: var(--accent); }
.result { margin-top: 10px; padding: 10px 12px; border-radius: 11px; font-size: 14px; border: 1px solid var(--border); }
.result.ok { background: rgba(52, 209, 124, .1); border-color: rgba(52, 209, 124, .22); }
.result.bad { background: rgba(255, 95, 87, .09); border-color: rgba(255, 95, 87, .22); }

/* ── wallet balance ── */
.balance-hero { text-align: center; padding-bottom: 20px; background: radial-gradient(90% 120% at 50% 0%, rgba(255, 122, 0, .16), transparent 70%), var(--card); }
.balance-hero h2 { text-align: left; }
.big-amount { font-size: 32px; font-weight: 900; letter-spacing: -.02em; overflow-wrap: anywhere; line-height: 1.15; margin-top: 6px; }
.big-amount .unit { font-size: 16px; font-weight: 800; color: var(--accent-2); margin-left: 6px; }
.worth { display: inline-block; margin-top: 8px; padding: 5px 12px; border-radius: 999px; background: var(--soft); border: 1px solid var(--soft-2); color: var(--accent-2); font-weight: 800; font-size: 15px; }

/* ── order status labels ── */
.status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card-2); color: var(--hint); white-space: nowrap; }
.status.paid { background: rgba(52, 209, 124, .14); color: var(--ok); }
.status.active { background: var(--soft); color: var(--accent-2); }
.status.review { background: rgba(255, 176, 32, .15); color: var(--warn); }

/* ── bottom tabs ── */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 6px; padding: 8px 12px calc(8px + var(--safe-bottom)); background: rgba(12, 12, 14, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--border); z-index: 5; }
.tabs button { flex: 1; max-width: 180px; border: 0; background: none; padding: 7px 0; border-radius: 12px; color: var(--hint); font-size: 12px; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: color .15s, background .15s; }
.tabs button .i { font-size: 20px; line-height: 1; filter: grayscale(1) brightness(.85); transition: filter .15s; }
.tabs button[aria-current="page"] { color: var(--accent-2); background: var(--soft); }
.tabs button[aria-current="page"] .i { filter: none; }

/* ── sheet (dialog) ── */
.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: flex; align-items: flex-end; justify-content: center; z-index: 20; animation: fade .15s; }
.sheet .panel { width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--border); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 20px 16px calc(16px + var(--safe-bottom)); animation: up .2s ease-out; }
.sheet h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }
.sheet ol { padding-left: 20px; margin: 8px 0 16px; }
.sheet ol li { margin: 6px 0; }
.sheet ol li::marker { color: var(--accent); font-weight: 800; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }

/* ── toast ── */
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); background: #1f1f24; color: var(--text); padding: 11px 14px; border-radius: 12px; font-size: 14px; z-index: 30; border: 1px solid var(--border); border-left: 3px solid var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: fade .15s; }
.toast.error { border-left-color: var(--danger); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Must stay last: the `hidden` attribute always wins over component display rules (e.g. the sheet overlay). */
[hidden] { display: none !important; }
