:root {
  --bg: #07090c; --panel: #0f1319; --panel2: #141a22; --line: #1c2129;
  --text: #e7eaee; --muted: #8b93a1; --red: #e12d32; --gold: #d7a928; --green: #20d984; --cyan: #22bceb;
  --xbt: #d7a928; --bch: #20d984; --btc: #f2a900; --xmr: #ff6600;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 Inter, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  padding-top: var(--safe-t); min-height: 100vh; -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain; }
#shell { max-width: 560px; margin: 0 auto; padding: 0 14px calc(84px + var(--safe-b)); }
a { color: var(--cyan); text-decoration: none; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); } .pos { color: var(--green); } .neg { color: var(--red); }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

/* header */
#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; background: linear-gradient(var(--bg) 80%, transparent); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.brand img { border-radius: 9px; }
.topbtns { display: flex; gap: 8px; align-items: center; }
.icon, .who { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; height: 38px; color: var(--text); cursor: pointer; }
.icon { width: 38px; display: grid; place-items: center; }
.who { padding: 0 12px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.spin svg { animation: spin .8s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }

/* banner */
#banner { border-radius: 12px; padding: 12px 14px; margin: 4px 0 12px; border: 1px solid var(--line); background: var(--panel); position: relative; }
#banner.info { border-color: rgba(34,188,235,.4); background: rgba(34,188,235,.08); }
#banner.maintenance { border-color: rgba(215,169,40,.5); background: rgba(215,169,40,.09); }
#banner.urgent { border-color: rgba(225,45,50,.55); background: rgba(225,45,50,.1); }
#banner b { display: block; margin-bottom: 2px; }
#banner button { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }

/* cards + layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 0 0 12px; }
.card h3 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.coinhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.coinhead img { width: 30px; height: 30px; border-radius: 50%; background: #000; }
.coinhead .n { font-weight: 700; font-size: 16px; } .coinhead .s { font-size: 12px; color: var(--muted); }
.coinhead .tag { margin-left: auto; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat .s { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.big { font-size: 30px !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 8px rgba(32,217,132,.6); } .dot.off { background: var(--red); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip.on { color: #06120c; border-color: transparent; }
.pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(139,147,161,.15); color: var(--muted); }
.pill.pplns { background: rgba(34,188,235,.15); color: var(--cyan); } .pill.solo { background: rgba(181,140,255,.16); color: #b58cff; }
/* small coin-logo icons next to an address, e.g. XBT+BTC on a shared bc1 address -- same images
   the coin cards use, just small and inline instead of spelled-out pill text. Full circles side
   by side, NOT overlapped: XBT and BTC are both gold/orange coins, so an overlapped avatar-stack
   crops off exactly the detail (XBT's green $ vs BTC's plain B) that tells them apart. */
.coinicons { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.coinicons img { width: 18px; height: 18px; border-radius: 50%; background: #000; border: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; } .row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 999px; }

/* buttons + forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; cursor: pointer;
  background: var(--red); color: #fff; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; } .btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
input[type=text], input[type=search] { width: 100%; font: inherit; color: var(--text); background: #0a0d12; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; }
input:focus { outline: 2px solid rgba(34,188,235,.5); border-color: transparent; }
.hero { text-align: center; padding: 26px 8px 10px; }
.hero img { width: 120px; height: 120px; border-radius: 26px; box-shadow: 0 0 40px rgba(225,45,50,.25); }
.hero h1 { margin: 16px 0 6px; font-size: 24px; } .hero p { margin: 0 0 16px; color: var(--muted); }
.err { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }
.loading, .empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; } .kv:first-of-type { border-top: 0; }
.copyrow { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.copyrow:first-of-type { border-top: 0; }
.copyrow .lbl { width: 84px; flex: none; font-size: 12px; color: var(--muted); }
.copyrow .val { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* bottom tabs */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: rgba(10,13,18,.94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
#tabs a { flex: 1; max-width: 112px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 12px; }
#tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#tabs a.on { color: var(--text); } #tabs a.on svg { stroke: var(--red); }

/* sheet (address switcher) */
#sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
#sheet[hidden] { display: none; }
#sheet .panel { width: 100%; max-width: 560px; background: var(--panel); border-radius: 22px 22px 0 0; border: 1px solid var(--line); padding: 16px 16px calc(20px + var(--safe-b)); max-height: 80vh; overflow: auto; }
#sheet h4 { margin: 0 0 10px; font-size: 16px; }
#toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: #1d2530; color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; border: 1px solid var(--line); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.tog:first-of-type { border-top: 0; }
.tog b { display: block; font-weight: 600; } .tog .note { display: block; margin-top: 1px; }
.tog input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 27px; border-radius: 999px; background: #2a323d; position: relative; cursor: pointer; transition: .15s; border: 0; }
.tog input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: .15s; }
.tog input:checked { background: var(--green); } .tog input:checked::after { left: 22px; }
@media (min-width: 700px) { #shell { padding-top: 12px; } }

/* miner chat */
.chat-card { padding-bottom: 12px; }
.chat-warn { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(215,169,40,.35); background: rgba(215,169,40,.07); font-size: 12px; }
.chat-log { height: calc(100dvh - 420px); min-height: 240px; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; padding: 6px 2px; margin: 0 -2px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.chat-empty { text-align: center; padding: 30px 0; }
.cm { padding: 6px 8px; margin: 2px 0; border-radius: 10px; }
.cm:hover { background: rgba(255,255,255,.03); }
.cm.me { background: rgba(34,188,235,.08); }
.cm.adm { background: rgba(215,169,40,.09); border: 1px solid rgba(215,169,40,.3); }
.ch { display: flex; align-items: baseline; gap: 8px; }
.cn { font-weight: 700; font-size: 13px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb2 { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 999px; background: rgba(215,169,40,.2); color: var(--gold); }
.ct { font-size: 11px; color: var(--muted); }
.cr { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 13px; padding: 2px 6px; cursor: pointer; opacity: .55; border-radius: 6px; }
.cr:hover, .cr:focus-visible { opacity: 1; color: var(--red); }
.cbody { font-size: 14.5px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; margin-top: 1px; }
.chat-who { margin: 8px 0 6px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; font: inherit; color: var(--text); background: #0a0d12; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: none; max-height: 110px; line-height: 1.35; }
.chat-form textarea:focus { outline: 2px solid rgba(34,188,235,.5); border-color: transparent; }
.chat-join { margin-top: 10px; display: grid; gap: 8px; }
.linkbtn { background: none; border: 0; color: var(--cyan); padding: 0; font: inherit; cursor: pointer; }
.err.okmsg { color: var(--green); }
.cr.on { opacity: .9; margin-left: 0; }
.cr.on + .cr.on { margin-left: 2px; }
.chat-staff { margin-top: 10px; }
.chat-who .cb2 { margin-left: 6px; }

/* chat v3: fill the screen, collapsible rules, replies */
.chat-card { display: flex; flex-direction: column; height: calc(100dvh - 150px - var(--safe-t) - var(--safe-b)); min-height: 360px; padding: 10px 12px; margin-bottom: 0; }
.chat-log { flex: 1 1 auto; height: auto; max-height: none; min-height: 0; margin: 6px -2px; }
.chat-rules { border: 1px solid rgba(215,169,40,.35); background: rgba(215,169,40,.07); border-radius: 10px; padding: 6px 10px; }
.chat-rules summary { cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.chat-rules .note { margin-top: 6px; font-size: 12px; }
.cacts { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.cacts .cr { margin-left: 0; }
.cr.rp { opacity: .8; font-size: 16px; }
.cq { margin: 3px 0 2px; padding: 3px 8px; border-left: 3px solid var(--cyan); background: rgba(255,255,255,.04); border-radius: 0 8px 8px 0; font-size: 12.5px; color: var(--muted); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq b { color: var(--text); }
.cq.gone { font-style: italic; cursor: default; }
.cm.tome { border: 1px solid rgba(34,188,235,.45); background: rgba(34,188,235,.09); }
.cm.flash { animation: cflash 1.4s ease-out; } @keyframes cflash { from { background: rgba(215,169,40,.4); } to { background: transparent; } }
.chat-replying { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; padding: 5px 8px; border-left: 3px solid var(--cyan); background: rgba(34,188,235,.08); border-radius: 0 8px 8px 0; font-size: 12.5px; }
.chat-replying[hidden] { display: none; }
.chat-replying span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-replying button { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; }

/* chat v4: the announcement banner steps aside on the Chat tab so the room gets the space */
.on-chat #banner { display: none !important; }
