:root {
  --bg: #0B0E13; --panel: #11151D; --field: #171C27; --line: #1F2633;
  --text: #ECEFF5; --muted: #A7AFBF; --up: #22C55E; --down: #EF4444;
  --m-bg: #0D1016; --m-bar: #11151D; --in: #1A2030; --out: #3340B5; --accent: #6C7BFF; --accent-text: #A9B4FF; --online: #4ADE9B;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.screen { height: 100vh; }

/* ---------- decoy dashboard ---------- */
.dash-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.brand small { color: var(--muted); font-weight: 500; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #22C55E, #0EA5E9); }
.dash-clock { color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-main { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; padding: 16px 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.panel-title { color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.tickers { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tickers th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 4px; font-size: 12px; }
.tickers td { padding: 9px 4px; border-top: 1px solid var(--line); }
.tickers tr { cursor: pointer; }
.tickers tr.sel td { background: #161C28; }
.up { color: var(--up); } .down { color: var(--down); }
.big-price { font-size: 38px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sel-change { margin-bottom: 8px; font-variant-numeric: tabular-nums; }
#spark { width: 100%; height: 180px; display: block; margin: 8px 0 16px; }
.trade-row { display: flex; gap: 12px; }
.btn { border: 0; border-radius: 10px; padding: 12px 22px; font-weight: 700; background: var(--field); }
.btn.buy { background: var(--up); color: #04210f; flex: 1; user-select: none; }
.btn.sell { background: var(--down); color: #2a0606; flex: 1; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.primary { background: var(--accent); color: #fff; }
.paper-note { color: var(--muted); font-size: 12px; margin-top: 10px; }
@media (max-width: 760px) { .dash-main { grid-template-columns: 1fr; padding: 12px; } }

/* ---------- pair / pin ---------- */
#pair, #pin { display: flex; align-items: center; justify-content: center; background: var(--m-bg); }
.pair-card, .pin-card { background: var(--m-bar); border-radius: 16px; padding: 28px 32px; text-align: center; max-width: 440px; width: calc(100% - 32px); }
.pair-card ol { text-align: left; color: var(--muted); line-height: 1.9; padding-left: 20px; }
.pair-card b { color: var(--text); }
.qr { background: #fff; padding: 14px; border-radius: 12px; width: 268px; height: 268px; margin: 16px auto; }
.qr img, .qr canvas { width: 240px !important; height: 240px !important; }
.pin-card { max-width: 320px; }
#pin-title { font-size: 18px; font-weight: 600; margin-bottom: 18px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 10px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-text); }
.pin-dots i.on { background: var(--accent-text); }
#pin-msg { min-height: 20px; margin-bottom: 8px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; justify-content: center; margin: 8px 0 12px; }
.pin-pad button { height: 60px; border-radius: 50%; border: 0; background: var(--field); font-size: 22px; }
.pin-pad button:hover { background: #20283a; }

/* ---------- messenger ---------- */
#app { display: grid; grid-template-columns: 360px 1fr; background: var(--m-bg); }
.side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--m-bar); }
.side-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.me { font-weight: 700; font-size: 16px; }
.icon { background: none; border: 0; font-size: 17px; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.icon:hover { background: var(--field); }
.search { margin: 0 12px 8px; padding: 10px 14px; border-radius: 20px; border: 0; background: var(--field); color: var(--text); outline: none; }
.chat-list { overflow-y: auto; flex: 1; }
.row { display: flex; gap: 12px; padding: 10px 14px; cursor: pointer; align-items: center; }
.row:hover { background: #151a24; }
.row.active { background: #1a2131; }
.row .meta { flex: 1; min-width: 0; }
.row .top { display: flex; justify-content: space-between; gap: 8px; }
.row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .time { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.row .bottom { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; }
.row .prev { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.row .prev.typing { color: var(--online); }
.badge { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; flex-shrink: 0; }
.avatar { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; object-fit: cover; }

.conv { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.empty { margin: auto; text-align: center; color: var(--text); }
.empty-mark { font-size: 40px; margin-bottom: 8px; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--m-bar); border-bottom: 1px solid var(--line); }
.conv-head .avatar { width: 40px; height: 40px; }
.conv-head .title { flex: 1; min-width: 0; }
.conv-head .title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-head .sub { font-size: 12px; color: var(--muted); }
.conv-head .sub.on { color: var(--online); }
.msgs { flex: 1; overflow-y: auto; padding: 12px 6% 12px; display: flex; flex-direction: column; gap: 2px; }
.day { align-self: center; background: var(--field); color: var(--muted); font-size: 12px; padding: 4px 12px; border-radius: 8px; margin: 10px 0; }
.sys { align-self: center; color: var(--muted); font-size: 12px; background: #141925; padding: 4px 12px; border-radius: 8px; margin: 6px 0; text-align: center; }
.m { display: flex; flex-direction: column; max-width: 68%; position: relative; }
.m.mine { align-self: flex-end; align-items: flex-end; }
.m.theirs { align-self: flex-start; align-items: flex-start; }
.m.first { margin-top: 8px; }
.m.flash > .bubble, .m.flash > .sticker { box-shadow: 0 0 0 3px rgba(108,123,255,.55); }
.sender { font-size: 12.5px; font-weight: 600; margin: 0 4px 2px; }
.fwd { font-size: 11.5px; color: var(--muted); font-style: italic; margin: 0 4px 2px; }
.bubble { background: var(--in); padding: 7px 10px 5px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.mine .bubble { background: var(--out); }
.bubble a { color: #BFD3FF; }
.stamp { font-size: 11px; color: rgba(255,255,255,.65); float: right; margin: 6px 0 0 10px; font-variant-numeric: tabular-nums; }
.theirs .stamp { color: var(--muted); }
.bubble img.photo, .bubble video { display: block; max-width: 340px; max-height: 360px; border-radius: 10px; cursor: pointer; }
.bubble .cap { margin-top: 6px; }
.bubble audio { width: 260px; display: block; }
.sticker { position: relative; }
.sticker img { width: 140px; height: 140px; object-fit: contain; display: block; }
.sticker .emoji { font-size: 92px; line-height: 1; }
.sticker .snd { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.6); border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.sticker.has-sound { cursor: pointer; }
.quote { background: rgba(0,0,0,.2); border-left: 3px solid var(--accent-text); border-radius: 8px; padding: 4px 8px; margin-bottom: 5px; display: flex; gap: 8px; align-items: center; cursor: pointer; white-space: normal; }
.quote .qt { min-width: 0; }
.quote .qs { color: var(--accent-text); font-size: 12px; font-weight: 600; }
.quote .qx { font-size: 13px; color: rgba(255,255,255,.8); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.quote img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.reacts { background: var(--field); border: 2px solid var(--m-bg); border-radius: 12px; padding: 0 7px; font-size: 13px; margin-top: -6px; position: relative; z-index: 1; }
.actions { position: absolute; top: -14px; display: none; background: var(--field); border-radius: 18px; padding: 2px 4px; box-shadow: 0 2px 8px rgba(0,0,0,.4); z-index: 3; white-space: nowrap; }
.mine .actions { right: 4px; } .theirs .actions { left: 4px; }
.m:hover .actions { display: flex; }
.actions button { background: none; border: 0; padding: 4px 6px; border-radius: 12px; font-size: 14px; }
.actions button:hover { background: #222a3b; }
.tick { margin-left: 3px; }
.tick.read { color: #7dd3fc; }

.typing-line { color: var(--online); font-size: 12px; padding: 0 6% 4px; min-height: 18px; }
.reply-bar { display: flex; align-items: center; gap: 10px; background: var(--m-bar); padding: 8px 16px; border-top: 1px solid var(--line); }
.reply-bar .rb { flex: 1; border-left: 3px solid var(--accent); padding-left: 10px; min-width: 0; }
.reply-bar .rb b { color: var(--accent-text); font-size: 12px; }
.reply-bar .rb div { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar img { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 16px 14px; background: var(--m-bg); }
.composer textarea { flex: 1; resize: none; max-height: 140px; min-height: 42px; padding: 11px 16px; border-radius: 22px; border: 0; background: var(--field); color: var(--text); font: inherit; outline: none; }
.composer .icon { font-size: 20px; height: 42px; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 18px; flex-shrink: 0; }
.notmember { text-align: center; padding: 18px; color: var(--muted); background: var(--m-bar); }

.stickers { position: absolute; bottom: 72px; left: 16px; width: 420px; max-width: calc(100% - 32px); height: 360px; background: var(--m-bar); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.stickers .tabs { display: flex; gap: 4px; overflow-x: auto; padding: 6px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.stickers .tabs button { background: none; border: 0; border-radius: 8px; padding: 4px; min-width: 40px; height: 40px; }
.stickers .tabs button.on { background: rgba(108,123,255,.2); }
.stickers .tabs img { width: 30px; height: 30px; object-fit: contain; }
.stickers .grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; align-content: start; }
.stickers .grid button { background: var(--field); border: 0; border-radius: 10px; aspect-ratio: 1; padding: 4px; position: relative; }
.stickers .grid img { width: 100%; height: 100%; object-fit: contain; }
.stickers .grid .emoji { font-size: 44px; }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #222a3b; color: var(--text); padding: 10px 18px; border-radius: 10px; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 40; display: flex; align-items: center; justify-content: center; }
.sheet { background: var(--m-bar); border-radius: 14px; width: 460px; max-width: calc(100% - 32px); max-height: 80vh; display: flex; flex-direction: column; }
.sheet h3 { margin: 0; padding: 16px; border-bottom: 1px solid var(--line); font-size: 16px; }
.sheet .body { overflow-y: auto; flex: 1; }
.sheet .foot { padding: 12px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 16px; cursor: pointer; }
.pick:hover { background: #151a24; }
.pick .avatar { width: 40px; height: 40px; }
.pick .chk { margin-left: auto; font-size: 18px; color: var(--muted); }
.pick.on .chk { color: var(--accent-text); }
.light { max-width: 92vw; max-height: 86vh; }
.light-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.media-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 6px; }
.media-grid > * { aspect-ratio: 1; width: 100%; object-fit: cover; cursor: pointer; background: var(--field); border: 0; border-radius: 4px; }
.media-grid .vid { display: flex; align-items: center; justify-content: center; font-size: 28px; color: #fff; background: linear-gradient(135deg, #1E1B4B, #111827); }
@media (max-width: 760px) { #app { grid-template-columns: 1fr; } #app.in-chat .side { display: none; } #app:not(.in-chat) .conv { display: none; } .m { max-width: 86%; } }
