:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #eef4f3;
  --text: #14211f;
  --muted: #71807d;
  --line: #dde6e3;
  --brand: #13a67d;
  --brand-dark: #087c5d;
  --danger: #c5424d;
  --warning: #a56700;
  --shadow: 0 12px 36px rgba(27, 55, 47, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 28px;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
.container { width: min(720px, calc(100% - 28px)); margin: 0 auto; }

.app-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(244, 247, 248, .92); backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(221, 230, 227, .8);
}
.header-inner { height: 64px; display: flex; align-items: center; justify-content: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--brand); }
.brand-mark svg { width: 20px; }
.page { padding: 30px 0 22px; }
.page-title { margin-bottom: 24px; }
.page-title .kicker { display: block; color: var(--brand-dark); font-size: .8rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.025em; }
h1 { margin-top: 7px; font-size: clamp(1.85rem, 7vw, 2.5rem); }
h2 { font-size: 1.22rem; }
h3 { font-size: 1rem; }
.page-title p { margin: 9px 0 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.section-card { padding: 20px; margin-bottom: 15px; }
.spaced-card { margin-top: 15px; }
.status-row { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; padding: 12px 13px; border-radius: 13px; background: var(--surface-2); }
.status-row .dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #abb8b5; }
.status-row.connected .dot { background: var(--brand); }
.status-row strong { display: block; font-size: .92rem; }
.status-row span { display: block; color: var(--muted); font-size: .78rem; word-break: break-all; }

.wallet-list { display: grid; gap: 10px; }
.wallet-button {
  width: 100%; min-height: 70px; display: flex; align-items: center; gap: 13px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: var(--surface);
  text-align: left; transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.wallet-button:hover { transform: translateY(-1px); border-color: #a8d8ca; background: #fbfefd; }
.wallet-icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; color: var(--brand-dark); background: #e8f7f2; font-weight: 900; }
.wallet-name { display: block; font-weight: 800; }
.wallet-meta { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; }
.chevron { margin-left: auto; color: #91a09c; font-size: 1.25rem; }

.button {
  min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 17px; border: 1px solid transparent; border-radius: 13px;
  color: white; background: var(--brand); font-weight: 800;
}
.button:hover { background: var(--brand-dark); }
.button.secondary { color: var(--text); background: var(--surface); border-color: var(--line); }
.button.secondary:hover { background: var(--surface-2); }
.button.danger { background: var(--danger); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button.full { width: 100%; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.balance-box { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fbfdfc; }
.balance-box span { color: var(--muted); font-size: .8rem; }
.balance-box strong { display: block; margin-top: 7px; font-size: clamp(1.35rem, 6vw, 2rem); letter-spacing: -.04em; }

.form { display: grid; gap: 16px; }
.field label { display: block; margin-bottom: 7px; font-size: .9rem; font-weight: 750; }
.field input { width: 100%; min-height: 50px; padding: 0 13px; outline: none; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: #fbfdfc; }
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(19,166,125,.1); }
.help-text { display: block; margin-top: 6px; color: var(--muted); font-size: .78rem; }
.check-row { display: flex; align-items: flex-start; gap: 9px; color: #52625e; font-size: .86rem; }
.check-row input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); }
.warning-box { margin-top: 15px; padding: 13px; border-radius: 13px; color: #76500e; background: #fff8e8; border: 1px solid #f1dfb5; font-size: .83rem; }
.result { display: none; margin-top: 15px; padding: 13px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface-2); word-break: break-word; }
.result.show { display: block; }
.result.success { color: #096d51; border-color: #b8dfd3; background: #effaf6; }
.result.error { color: #982d37; border-color: #efc5c9; background: #fff2f3; }
.result strong { display: block; margin-bottom: 3px; }
.contract { word-break: break-all; color: #465b55; font-size: .8rem; }

.help-stack { display: grid; gap: 10px; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
summary { padding: 17px; cursor: pointer; font-weight: 800; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; float: right; color: var(--brand); font-size: 1.2rem; }
details[open] summary::after { content: '−'; }
.detail-body { padding: 0 17px 17px; color: var(--muted); font-size: .9rem; }
.detail-body ol, .detail-body ul { margin: 8px 0 0; padding-left: 20px; }

.modal { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 18px; background: rgba(15,29,25,.55); backdrop-filter: blur(6px); }
.modal.open { display: grid; }
.modal-card { width: min(500px, 100%); padding: 22px; background: var(--surface); border-radius: 19px; box-shadow: 0 30px 80px rgba(0,0,0,.2); }
.modal-card p { color: var(--muted); }
.summary { display: grid; gap: 9px; margin: 17px 0; padding: 13px; border-radius: 13px; background: var(--surface-2); }
.summary div { display: grid; grid-template-columns: 82px 1fr; gap: 10px; }
.summary span { color: var(--muted); }
.summary strong { word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: calc(100% - 28px); padding: 11px 15px; border-radius: 12px; color: white; background: #20352f; opacity: 0; transform: translate(-50%, 15px); transition: .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .page { padding-top: 23px; }
  .balance-grid { grid-template-columns: 1fr; }
  .action-row .button { flex: 1; }
}
