/* A calm market app: plain ground, rounded cards, one accent (BNB yellow). Dark by default, light on request
   (theme.js sets data-theme). */
:root {
  --bg: #0d0d0c; --card: #161615; --soft: #1f1f1d; --line: #2a2a27; --text: #f2f2ee; --text2: #cfcfc9;
  --muted: #8a8a83; --accent: #f0b90b; --accent-hover: #f5c52e; --accent-soft: #2a2410; --accent-ink: #1a1400;
  --good: #19b277; --bad: #f0564a; --warn: #f0a030; --shadow: none; --message: #fff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f3f0; --card: #fff; --soft: #f5f5f2; --line: #e8e8e3; --text: #121211; --text2: #3a3a37;
  --muted: #7b7b75; --accent-soft: #fff4cc; --good: #0f9d63; --bad: #e04a3c; --warn: #b86e00; --message: #0b0b0a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .04);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { height: 100%; }
body { display: flex; flex-direction: column; min-height: 100%; margin: 0; background: var(--bg); color: var(--text);
       font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body:has(.messenger) { height: 100%; }  /* the messenger scrolls inside itself */
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 0.86em var(--mono); color: var(--muted); overflow-wrap: anywhere; }
small { display: block; color: var(--muted); font-size: 12px; }
h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.1; letter-spacing: -.03em; font-weight: 650; }
h1 em, h2 em { font-style: normal; color: var(--muted); }
h2 { margin: 0 0 10px; font-size: 24px; line-height: 1.15; letter-spacing: -.025em; font-weight: 650; }
h3 { margin: 0 0 6px; font-size: 16px; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 500; }
.eyebrow.below { margin: 20px 0 6px; }

/* header */
header.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent);
             backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.bar { display: flex; align-items: center; gap: 6px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 14px; color: var(--text); font-weight: 700;
         font-size: 18px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; }
#network { margin-right: 8px; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--warn);
           font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
#nav { display: flex; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 12px; color: var(--text2);
         font-weight: 500; }
#nav a:hover { background: var(--soft); text-decoration: none; }
#nav a.active { background: var(--accent-soft); color: var(--text); }
.grow { flex: 1; }
#token-chip { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px;
              color: var(--text); font-weight: 600; white-space: nowrap; }
#token-chip:hover { background: var(--soft); text-decoration: none; }
#token-chip span { color: var(--muted); font-weight: 500; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 12px;
               background: none; color: var(--text2); }
.icon-button:hover { background: var(--soft); text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
      stroke-linejoin: round; flex: none; }
svg.filled { fill: currentColor; stroke: none; }
#theme .sun, :root[data-theme="light"] #theme .moon { display: none; }
:root[data-theme="light"] #theme .sun { display: block; }
#connect { margin-left: 6px; }
#banner { padding: 10px 24px; background: var(--accent-soft); color: var(--warn); text-align: center; }
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 24px 64px; }
main:has(.messenger) { display: flex; min-height: 0; padding-top: 8px; padding-bottom: 20px; }

/* phone dock */
#dock { display: none; }

/* controls */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px;
                  padding: 0 18px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px;
                  font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
                  transition: background .15s, transform .15s; }
button:hover:not(:disabled), .button:hover { background: var(--accent-hover); text-decoration: none; }
button:active:not(:disabled), .button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost, .button.ghost { background: var(--soft); color: var(--text); }
button.ghost:hover:not(:disabled), .button.ghost:hover { background: var(--line); }
#connect { background: var(--soft); color: var(--text); }
#connect:hover { background: var(--line); }
button.link { height: auto; padding: 0; background: none; color: var(--accent); font-weight: 500; }
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }
button.icon-button:hover:not(:disabled) { background: var(--soft); }
input, textarea { width: 100%; padding: 11px 14px; background: var(--soft); color: inherit; border: 1px solid transparent;
                  border-radius: 12px; font: inherit; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }
label.check { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* tags */
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--soft); color: var(--muted);
       font-size: 11px; font-style: normal; font-weight: 500; white-space: nowrap; vertical-align: middle; }
.tag.warn { background: color-mix(in srgb, var(--warn) 14%, var(--card)); color: var(--warn); }
.tag.good { background: color-mix(in srgb, var(--good) 14%, var(--card)); color: var(--good); }
.tag.you { background: var(--accent-soft); color: var(--accent); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; background: var(--accent); color: var(--accent-ink);
         border-radius: 999px; font-size: 12px; font-style: normal; font-weight: 700; line-height: 20px;
         text-align: center; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--soft); }
.address { display: inline-flex; align-items: center; gap: 6px; }
.empty { margin: 0; padding: 22px 14px; color: var(--muted); }

/* the main page */
.hero { max-width: 920px; margin: 0 auto; padding: 56px 0 60px; text-align: center; }
.hero h1 { font-size: clamp(36px, 4.4vw, 54px); line-height: 1.02; letter-spacing: -.045em; }
.hero h1 em { display: block; }
.hero .sub { max-width: 520px; margin: 20px auto 28px; color: var(--text2); font-size: 18px; }
.hero .actions { justify-content: center; }
.hero .fine { margin-top: 18px; color: var(--muted); font-size: 13px; }
section.card { margin-bottom: 20px; padding: 28px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
                margin-bottom: 20px; }
.section-head p { margin: 0; color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { padding: 20px; background: var(--soft); border-radius: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.feature .icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 14px;
                 border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { padding: 22px; background: var(--soft); border-radius: 16px; }
.step .n { color: var(--muted); font: 12px var(--mono); }
.step h3 { margin: 26px 0 6px; font-size: 18px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.cta h2 { margin: 0; }
.cta p { margin: 4px 0 0; color: var(--muted); }

/* the token page */
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
         padding: 28px 0 24px; }
.phead h1 { font-size: clamp(34px, 4.5vw, 52px); letter-spacing: -.04em; }
.ca { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.ca-address { margin: 4px 0 0; color: var(--text); font: 600 clamp(14px, 2vw, 22px) var(--mono); overflow-wrap: anywhere; }
.holding { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 14px 16px;
           background: var(--soft); border-radius: 14px; }
.holding b { font-size: 17px; }

/* the messenger */
.messenger { flex: 1; display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 0; overflow: hidden; }
.side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.new-chat { display: flex; gap: 8px; padding: 14px; }
.new-chat input { height: 42px; font: 13px var(--mono); }
.chat-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.chat-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-rows: auto auto;
            column-gap: 10px; align-items: center; padding: 10px; border-radius: 14px; color: var(--text); }
.chat-row:hover { background: var(--soft); text-decoration: none; }
.chat-row.active { background: var(--accent-soft); }
.chat-row .avatar { grid-row: 1 / 3; }
.chat-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { color: var(--muted); font-size: 12px; }
.chat-preview { grid-column: 2; color: var(--text2); font-size: 13px; overflow: hidden; text-overflow: ellipsis;
                white-space: nowrap; }
.chat-preview.muted { font-style: italic; }
.chat-row .badge { grid-column: 3; grid-row: 2; }
.requests { justify-content: space-between; width: 100%; height: 36px; margin: 6px 0 2px; padding: 0 10px;
            background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.requests:hover:not(:disabled) { background: var(--soft); }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.placeholder { margin: auto; padding: 24px; max-width: 380px; text-align: center; }
.placeholder img { width: 64px; height: 64px; }
.placeholder p { margin: 10px 0 0; }
.placeholder .actions { justify-content: center; margin-top: 16px; }

/* one conversation */
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.back { display: none; color: var(--text); font-size: 26px; line-height: 1; }
.who { flex: 1; min-width: 0; }
.who-name { display: flex; align-items: center; gap: 8px; }
.who-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-name input { max-width: 300px; padding: 4px 10px; }
.who-address { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who-address code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-actions { display: flex; gap: 14px; }
.log { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 16px; overflow-y: auto; }
.log > :first-child { margin-top: auto; }
.day { align-self: center; margin: 8px 0 2px; padding: 2px 10px; background: var(--soft); border-radius: 999px;
       color: var(--muted); font-size: 12px; }
.earlier { align-self: center; height: 34px; font-size: 13px; font-weight: 500; }
.bubble { max-width: min(78%, 560px); padding: 8px 12px 6px; border-radius: 16px; background: var(--soft); }
.bubble p { margin: 0; color: var(--message); font-size: 15.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble.mine { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 5px; }
.bubble.locked p, .bubble.broken p { color: var(--muted); font-style: italic; }
.bubble.pending { opacity: .55; }
.meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; color: var(--muted); font-size: 11px; }
.meta a { color: inherit; }
.composer { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.composer textarea { resize: none; }
.composer-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.note { flex: 1; min-width: 160px; color: var(--good); font-size: 13px; }
.note.warn { color: var(--warn); }
.counter { color: var(--muted); font-size: 12px; }
.counter.bad { color: var(--bad); }

/* the messenger's gate (no wallet), settings */
.gate { max-width: 560px; margin: 8vh auto 0; padding: 40px 32px; text-align: center; }
.gate img { width: 72px; height: 72px; }
.gate h1 { margin: 16px 0 10px; }
.gate p { color: var(--text2); overflow-wrap: anywhere; }
.gate .actions { justify-content: center; margin-top: 22px; }
.settings { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.settings h1 { margin: 12px 0 0; }
.panel { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px; background: var(--card);
         border-radius: 20px; box-shadow: var(--shadow); }
.panel h2 { font-size: 18px; }
.panel h2, .panel p { margin: 0; }
.share { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hidden-row { display: flex; align-items: center; gap: 10px; }
.hidden-row .avatar { width: 24px; height: 24px; }
.hidden-row button { margin-left: auto; }

/* toasts, dialog */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: 380px;
          z-index: 40; pointer-events: none; }  /* clicks go through to what a toast covers */
.toast a { pointer-events: auto; }
.toast { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
         overflow-wrap: anywhere; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.toast.ok { border-color: var(--good); }
.toast.error { border-color: var(--bad); color: var(--bad); }
dialog { width: min(380px, calc(100vw - 32px)); padding: 22px; background: var(--card); color: var(--text); border: 0;
         border-radius: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(10, 10, 8, .45); backdrop-filter: blur(4px); }
dialog h2 { margin: 0 0 14px; font-size: 20px; }
#wallet-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.result { justify-content: flex-start; gap: 10px; width: 100%; padding: 0 12px; background: var(--soft);
          color: var(--text); font-weight: 500; text-align: left; }
.result:hover:not(:disabled) { background: var(--line); }
.result img, .result .avatar { flex: none; width: 22px; height: 22px; border-radius: 50%; }

/* docs */
.docs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start;
               margin-top: 12px; }
.docs-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; padding: 14px; }
.docs-nav a { padding: 7px 10px; border-radius: 10px; color: var(--text2); font-size: 14px; }
.docs-nav a:hover { background: var(--soft); text-decoration: none; }
.docs-nav a.active { background: var(--accent-soft); color: var(--text); }
.docs-group { margin: 12px 10px 4px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase;
              letter-spacing: .05em; }
.docs-group:first-child { margin-top: 0; }
.docs { min-width: 0; padding: 36px 40px; }
.docs h1 { font-size: 38px; }
.docs h2 { margin: 32px 0 10px; font-size: 20px; scroll-margin-top: 88px; }
.docs h2[data-group="For developers"] { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.docs pre { margin: 12px 0; padding: 14px 16px; overflow-x: auto; background: var(--soft); border-radius: 12px;
            color: var(--text2); font: 13px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.fn { margin: 12px 0; padding: 14px 16px; background: var(--soft); border-radius: 14px; }
.fn .sig { display: block; color: var(--text); font-size: 13px; }
.fn p { margin: 8px 0 0; font-size: 14px; }
.fn .reverts { color: var(--muted); }
.docs .lead { font-size: 17px; color: var(--text2); }
.docs p, .docs li { color: var(--text2); overflow-wrap: anywhere; }
.docs li { margin-bottom: 6px; }

@media (max-width: 900px) {
  .features, .steps { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  main { padding: 16px 16px 96px; }  /* room for the dock */
  .bar { height: 60px; }
  #nav, #token-chip { display: none; }
  #connect { height: 38px; padding: 0 12px; font-size: 14px; }
  #dock { position: fixed; bottom: 12px; left: 50%; z-index: 30; display: flex; gap: 2px; padding: 6px;
          transform: translateX(-50%); background: var(--card); border: 1px solid var(--line); border-radius: 20px;
          box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
  #dock a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 54px;
            padding: 7px 8px; border-radius: 14px; color: var(--muted); font-size: 11px; font-weight: 500; }
  #dock a:hover { text-decoration: none; }
  #dock a.active { background: var(--accent-soft); color: var(--text); }
  #dock .badge { position: absolute; top: 0; right: 4px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; }
  .hero { padding: 16px 0 28px; }
  .features, .steps { grid-template-columns: 1fr; }
  section.card { padding: 20px; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .docs-group { display: none; }
  .docs { padding: 24px 20px; }
  .docs h1 { font-size: 30px; }
  main:has(.messenger) { padding: 0 0 84px; }
  .messenger { grid-template-columns: 1fr; border-radius: 0; }
  .messenger .pane, .messenger.open .side { display: none; }
  .messenger.open .pane { display: flex; }
  .side { border-right: 0; }
  .back { display: block; }
  .who-name { flex-wrap: wrap; gap: 2px 8px; }
  .who-actions { flex-direction: column; gap: 2px; font-size: 13px; }
  .who-address .address { display: none; }
  .bubble { max-width: 88%; }
  .gate { margin-top: 2vh; padding: 28px 20px; }
}

@media (max-width: 420px) {
  #brand { display: none; }  /* logo only: the badge, theme toggle and connect button need the width */
}
