:root {
  --bg: #0b0e14;
  --bg-2: #111622;
  --card: #151b2a;
  --card-2: #1b2234;
  --line: #262f45;
  --text: #e8ecf4;
  --muted: #8a94ab;
  --accent: #4f8cff;
  --accent-2: #7a5cff;
  --good: #2fd07f;
  --warn: #ffb84d;
  --bad: #ff5d6c;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2550 0%, transparent 60%), var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono, code { font-family: var(--mono); }
.muted { color: var(--muted); }

.demo-banner {
  background: #2a1f00; color: var(--warn); text-align: center;
  font-size: 13px; padding: 6px 16px; border-bottom: 1px solid #4a3800;
}

/* ---- top bar ---- */
.topbar {
  max-width: 1160px; margin: 0 auto; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.nav { display: flex; gap: 24px; color: var(--muted); font-size: 15px; }
.nav a:hover { color: var(--text); }

/* ---- hero ---- */
.hero {
  max-width: 1160px; margin: 0 auto; padding: 40px 20px 60px;
  display: grid; grid-template-columns: 1fr 460px; gap: 48px; align-items: start;
}
.hero-copy h1 { font-size: 48px; line-height: 1.1; margin: 20px 0 16px; letter-spacing: -0.02em; }
.lead { color: var(--muted); font-size: 18px; max-width: 520px; }
.badges { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.badges li { border: 1px solid var(--line); background: var(--bg-2); padding: 6px 12px; border-radius: 999px; font-size: 14px; color: var(--muted); }

/* ---- card / widget ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.step { display: flex; flex-direction: column; gap: 14px; }
.step-title { margin: 0; font-size: 20px; }

.rate-toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border-radius: 12px; padding: 4px; }
.rate-toggle button { padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; }
.rate-toggle button.active { background: var(--card-2); color: var(--text); box-shadow: 0 1px 0 var(--line) inset; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); }
.field input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; outline: none; font-size: 15px;
}
.field input:focus { border-color: var(--accent); }
.field input.invalid { border-color: var(--bad); }
.field input.valid { border-color: var(--good); }
.field-row { display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.field-row:focus-within { border-color: var(--accent); }
.field-row input { border: 0; border-radius: 0; font-size: 22px; font-weight: 600; padding: 14px 16px; background: transparent; min-width: 0; }
.coin-btn {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; min-width: 150px;
  border-left: 1px solid var(--line); background: var(--card-2); font-weight: 600;
}
.coin-btn:hover { background: #222a40; }
.coin-btn .net { font-size: 11px; font-weight: 500; color: var(--muted); display: block; line-height: 1; }
.coin-btn .caret { margin-left: auto; color: var(--muted); }

.coin-icon {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.swap-divider { display: flex; align-items: center; justify-content: space-between; margin: -4px 0; }
.rate-line { font-size: 13px; color: var(--muted); }
.flip {
  width: 36px; height: 36px; border-radius: 10px; background: var(--card-2);
  border: 1px solid var(--line); font-size: 18px; transition: transform .2s;
}
.flip:hover { transform: rotate(180deg); border-color: var(--accent); }
.approx { color: var(--muted); }

.quote-meta { font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.quote-meta div { display: flex; justify-content: space-between; }
.quote-meta strong { color: var(--text); font-weight: 500; }
.quote-meta .src.live { color: var(--good); }
.quote-meta .src.demo { color: var(--warn); }

.error { background: rgba(255,93,108,.1); border: 1px solid rgba(255,93,108,.35); color: #ff9aa4; padding: 10px 12px; border-radius: 10px; font-size: 14px; }

.primary {
  width: 100%; padding: 15px; border-radius: 12px; font-weight: 600; font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary.inline { width: auto; padding: 10px 20px; font-size: 15px; }
.primary.loading { opacity: .7; pointer-events: none; }
.ghost { padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--muted); }
.back { align-self: flex-start; color: var(--muted); font-size: 14px; }
.back:hover { color: var(--text); }

.summary { background: var(--bg-2); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
.summary .arrow { color: var(--muted); }
.summary .side { display: flex; align-items: center; gap: 8px; }
.hint { font-size: 12px; color: var(--muted); min-height: 16px; }
.hint.bad { color: var(--bad); }
.hint.good { color: var(--good); }
.refund summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 8px; }
.check { display: flex; gap: 10px; font-size: 13px; color: var(--muted); align-items: flex-start; }
.check input { margin-top: 3px; accent-color: var(--accent); }

/* ---- order ---- */
.order-head { display: flex; justify-content: space-between; align-items: center; }
.timer { font-family: var(--mono); font-size: 13px; background: var(--bg-2); padding: 4px 10px; border-radius: 8px; color: var(--warn); }
.timer.expired { color: var(--bad); }

.progress { list-style: none; padding: 0; margin: 4px 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; counter-reset: s; }
.progress li { font-size: 11px; color: var(--muted); text-align: center; position: relative; padding-top: 30px; }
.progress li::before {
  counter-increment: s; content: counter(s);
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line); font-size: 12px;
}
.progress li.done { color: var(--text); }
.progress li.done::before { content: "✓"; background: var(--good); border-color: var(--good); color: #04210f; }
.progress li.active { color: var(--text); font-weight: 600; }
.progress li.active::before { border-color: var(--accent); background: rgba(79,140,255,.2); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(79,140,255,.15); } }

.deposit { background: var(--bg-2); border-radius: 14px; padding: 16px; }
.deposit-ask { margin: 0 0 12px; }
.deposit-body { display: flex; gap: 16px; align-items: flex-start; }
.qr { background: #fff; padding: 8px; border-radius: 10px; flex-shrink: 0; width: 128px; height: 128px; }
.qr img, .qr canvas { width: 112px !important; height: 112px !important; }
.deposit-addr { min-width: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.copy-row { display: flex; gap: 8px; align-items: flex-start; }
.copy-row code { word-break: break-all; font-size: 13px; flex: 1; }
.warn { font-size: 12px; color: var(--warn); margin: 6px 0 0; }

.status-banner { border-radius: 12px; padding: 12px 14px; font-size: 14px; border: 1px solid; }
.status-banner strong { display: block; margin-bottom: 2px; }
.status-banner.warn { background: rgba(255,184,77,.08); border-color: rgba(255,184,77,.4); color: #ffd699; }
.status-banner.bad { background: rgba(255,93,108,.08); border-color: rgba(255,93,108,.4); color: #ffb0b8; }
.status-banner code { display: block; word-break: break-all; font-size: 12px; margin-top: 6px; color: var(--text); }
.notices { display: flex; flex-direction: column; gap: 8px; }
.notices:empty { display: none; }
.notice { background: var(--bg-2); border-radius: 12px; padding: 12px 14px; border-left: 3px solid var(--accent); font-size: 14px; }
.notice.warning { border-left-color: var(--warn); }
.notice.error { border-left-color: var(--bad); }
.notice .nt { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.notice .nt span { font-weight: 400; font-size: 12px; color: var(--muted); white-space: nowrap; }
.notice p { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; }

.done { text-align: center; background: var(--bg-2); border-radius: 14px; padding: 22px 16px; }
.done h3 { margin: 8px 0 4px; }
.done p { margin: 0 0 14px; color: var(--muted); }
.done-icon { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--good); color: #04210f; font-size: 26px; font-weight: 700; }
.tx { display: block; word-break: break-all; font-size: 12px; margin-top: 4px; }

.order-details { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.order-details dt { color: var(--muted); }
.order-details dd { margin: 0; text-align: right; word-break: break-all; }

.demo-controls { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 12px; }

/* ---- sections ---- */
.section { max-width: 1160px; margin: 0 auto; padding: 40px 20px; }
.section h2 { font-size: 30px; margin: 0 0 24px; }
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.steps-grid > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.steps-grid h3 { margin: 12px 0 6px; font-size: 17px; }
.steps-grid p { margin: 0; color: var(--muted); font-size: 14px; }
.num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--card-2); color: var(--accent); font-weight: 700; }
#faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px; }
#faq summary { cursor: pointer; font-weight: 600; }
#faq p { color: var(--muted); margin: 10px 0 0; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 16px; border-top: 1px solid var(--line); margin-top: 40px; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(5,8,14,.7); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 420px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-card.small { padding: 20px; gap: 12px; }
.modal-card.small h3 { margin: 0; }
.modal-card.small input { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-head { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.modal-head input { flex: 1; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; }
.coin-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.coin-list li { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; cursor: pointer; }
.coin-list li:hover, .coin-list li.current { background: var(--card-2); }
.coin-list .name { font-weight: 600; }
.coin-list .sub { font-size: 12px; color: var(--muted); }
.coin-list .tag { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.coin-list .empty { color: var(--muted); justify-content: center; cursor: default; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--card-2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 60; }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 16px; }
  .hero-copy h1 { font-size: 36px; }
  .steps-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .nav a:not([data-action]) { display: none; }
  .card { padding: 16px; }
  .coin-btn { min-width: 124px; }
  .deposit-body { flex-direction: column; align-items: center; }
  .steps-grid { grid-template-columns: 1fr; }
  .progress li { font-size: 10px; }
}
