:root {
  --bg: #07080a;
  --surface: rgba(17, 19, 23, .72);
  --surface-solid: #111317;
  --raised: rgba(255, 255, 255, .035);
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .18);
  --text: #f4f5f7;
  --muted: #a3a8b3;
  --dim: #7c838f;
  --accent: #c8ff4d;
  --accent-soft: rgba(200, 255, 77, .13);
  --accent-ink: #0c1002;
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, .12);
  --danger: #ff7a7a;
  --sell: #ff5c5c;
  --sell-soft: rgba(255, 92, 92, .12);
  --hex: 52px;
  --hex-shape: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sans: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(1200px 600px at 50% 38%, #10141a 0%, var(--bg) 70%);
  color: var(--text); font: 400 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
}
h1, h2, p, dl, dd { margin: 0; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(20px) saturate(130%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 24px 60px rgba(0, 0, 0, .45); }
input { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text); font: inherit; transition: border-color .2s; }
select { height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line); background: #15171b; color: var(--text); font: inherit; max-width: 150px; }
input::placeholder { color: var(--dim); }
input:focus { outline: none; border-color: var(--accent); }
button, .button { height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); font: 600 13px var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .2s, border-color .2s, color .2s; }
button:hover, .button:hover { background: rgba(255, 255, 255, .08); }
button:active, .button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; }
.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover, .button.primary:hover { background: #d6ff77; }

/* Top bar */
.top { position: relative; z-index: 3; height: 56px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: #090a0d; }
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.mark .core { fill: var(--accent); stroke: none; }
h1 { font: 800 16px var(--sans); letter-spacing: .24em; }
.live { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.live .num { color: var(--text); padding-left: 12px; border-left: 1px solid var(--line); }
.live .num:empty { display: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.dot.listening { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dot.error { background: var(--danger); }
.track { display: flex; gap: 8px; }
.track input { width: 260px; }
.list-count { align-self: center; color: var(--muted); font-size: 12px; }

/* The hive */
.stage { position: relative; z-index: 1; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.stage.dragging, .stage.dragging .cell { cursor: grabbing; }
#grid, .pan, .cells, .labels { position: absolute; inset: 0; }
#grid { width: 100%; height: 100%; mask-image: radial-gradient(ellipse at center, #000 30%, rgba(0, 0, 0, .4) 100%); }
.pan { will-change: transform; transform-origin: 0 0; }
.labels { pointer-events: none; }
/* A label never blocks the trader under it: only its two buttons take clicks. */
.tag .copy { pointer-events: auto; }
.tag-actions { display: flex; gap: 6px; margin-top: 5px; }
.tag .copy { height: 22px; padding: 0 9px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .35); background: rgba(0, 0, 0, .12); color: var(--accent-ink); font: 700 11px var(--sans); cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.tag .copy:hover { background: rgba(0, 0, 0, .28); }
.tag-close { pointer-events: auto; align-self: flex-start; flex: none; width: 22px; height: 22px; min-width: 0; margin: -2px -8px 0 2px; padding: 0; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: inherit; font: 700 17px/1 var(--sans); opacity: .65; cursor: pointer; }
.tag-close:hover { background: rgba(0, 0, 0, .22); opacity: 1; }
.cell { position: absolute; width: var(--hex); height: calc(var(--hex) * 1.1547); padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; transition: transform .22s var(--ease); }
.cell.arriving { animation: seat .5s var(--ease) backwards; }
.cell:hover, .cell.selected, .cell:focus-visible { transform: scale(1.32); z-index: 4; background: none; outline: none; }
@keyframes seat { from { opacity: 0; transform: scale(.5); } }
.rim { position: absolute; inset: 0; clip-path: var(--hex-shape); background: rgba(255, 255, 255, .26); transition: background .2s; }
.cell:hover .rim, .cell:focus-visible .rim { background: var(--text); }
.cell.selected .rim, .cell.hot .rim { background: var(--accent); }
.face { position: absolute; inset: 1.5px; clip-path: var(--hex-shape); background: var(--surface-solid); display: flex; align-items: center; justify-content: center; color: var(--muted); font: 600 12px var(--mono); }
.face img { width: 100%; height: 100%; object-fit: cover; }
.cell.waiting .face { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.cell.hot { z-index: 3; transform: scale(1.3); }
.cell.hot::before { content: ""; position: absolute; left: 50%; top: 50%; width: 100%; aspect-ratio: 1; margin: -50% 0 0 -50%; border-radius: 50%; border: 2px solid var(--accent); animation: halo 1.6s ease-out infinite; pointer-events: none; }
@keyframes halo { from { transform: scale(.75); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }
.tag, .tip, .hive-name { transform: translate(-50%, -100%) scale(calc(1 / var(--zoom, 1))); transform-origin: 50% 100%; }
.cell.lifted { opacity: .25; }
.cell.ghost { z-index: 7; pointer-events: none; transform: scale(calc(var(--zoom, 1) * 1.2)); animation: none; }
.hive-name { position: absolute; z-index: 4; display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border-radius: 9px; background: var(--surface-solid); border: 1px solid var(--line-strong); pointer-events: auto; white-space: nowrap; }
.hive-name .grip { color: var(--dim); cursor: grab; letter-spacing: -2px; padding-right: 2px; }
.hive-name input { height: 24px; padding: 0 2px; border: 0; background: none; font: 700 13px var(--sans); field-sizing: content; min-width: 4ch; }
.hive-name .num { color: var(--muted); font-size: 12px; }
.hive-name .remove { height: 22px; padding: 0 6px; border: 0; color: var(--muted); }
.tag { position: absolute; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); white-space: nowrap; box-shadow: 0 10px 30px rgba(0, 0, 0, .55); animation: tag-in .3s var(--ease) backwards, tag-out .6s ease-in calc(var(--stay) - .6s) forwards; }
.tag::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: var(--accent); transform: rotate(45deg); }
.tag img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; flex: none; }
.tag b { display: block; font: 800 13px/1.25 var(--sans); }
.tag span { display: block; font: 600 12px/1.25 var(--sans); }
@keyframes tag-in { from { opacity: 0; margin-top: 10px; } }
@keyframes tag-out { to { opacity: 0; margin-top: -6px; } }
.tip { position: absolute; z-index: 6; padding: 5px 10px; border-radius: 8px; background: var(--surface-solid); border: 1px solid var(--line-strong); font-size: 12px; white-space: nowrap; pointer-events: none; }
.tip b { font-weight: 600; }
.tip span { color: var(--muted); }

/* Headline over the hive */
.intro { position: absolute; z-index: 2; left: 32px; top: 28px; width: min(400px, 40vw); pointer-events: none; }
.intro::before { content: ""; position: absolute; z-index: -1; inset: -60px -110px -70px -60px; background: radial-gradient(closest-side, rgba(7, 8, 10, .94) 55%, rgba(7, 8, 10, 0)); }
.recentre { position: absolute; z-index: 4; right: 20px; bottom: 16px; background: var(--surface-solid); }
.hint-drag { position: absolute; z-index: 4; left: 20px; bottom: 14px; padding: 5px 10px; border-radius: 8px; background: rgba(9, 10, 13, .85); color: var(--muted); font-size: 12px; pointer-events: none; }
.for-touch { display: none; }
@media (pointer: coarse) { .for-mouse { display: none; } .for-touch { display: inline; } }
@media (max-width: 900px) and (pointer: fine) { .hint-drag { display: none; } }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font: 600 12px var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); }
.intro h2 { margin-top: 12px; font: 800 44px/1.02 var(--sans); letter-spacing: -.035em; }
.lede { margin-top: 12px; color: var(--muted); font-size: 15px; max-width: 34ch; }
.stats { margin-top: 24px; display: flex; gap: 28px; }
.stats dt { color: var(--dim); font-size: 12px; white-space: nowrap; }
.stats dd.num { margin-top: 2px; font-size: 28px; font-weight: 600; line-height: 1.15; }
.stats .note { color: var(--dim); font-size: 12px; white-space: nowrap; }
@media (max-width: 1100px), (max-height: 760px) { .intro h2 { font-size: 32px; } .lede { display: none; } .stats { margin-top: 16px; gap: 20px; } .stats dd.num { font-size: 22px; } }
/* Caller panel */
.detail { position: absolute; z-index: 5; width: 340px; padding: 18px; animation: pop .2s var(--ease) backwards; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.detail .close { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; padding: 0; justify-content: center; border-color: var(--line); color: var(--muted); font-size: 16px; }
.who { display: flex; align-items: center; gap: 12px; padding-right: 36px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: rgba(255, 255, 255, .06); flex: none; }
.name { font: 700 17px var(--sans); letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.why { margin-top: 12px; display: grid; gap: 4px; font-size: 13px; }
.why div::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.bio { margin-top: 12px; color: var(--muted); font-size: 13px; }
.tiles { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { padding: 10px 12px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); }
.tile b { display: block; font: 600 20px var(--mono); }
.tile span { color: var(--dim); font-size: 12px; }
.tile.flag b { color: var(--warn); }
.detail .foot { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.detail .wallet { color: var(--dim); font: 500 12px var(--mono); }

/* Live pings strip */
.dock { position: relative; z-index: 3; padding: 14px 24px 16px; border-top: 1px solid var(--line); background: #090a0d; }
.dock-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 12px; }
.dock h2 { font: 700 12px var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.limits { color: var(--dim); font-size: 12px; text-align: right; }
.pings { display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.ping { flex: none; width: 372px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--raised); transition: border-color .2s; }
.ping:hover { border-color: var(--line-strong); }
.ping.fresh { animation: arrive 2s var(--ease); }
@keyframes arrive { 0% { opacity: 0; transform: translateY(10px); border-color: var(--accent); background: var(--accent-soft); } 25% { opacity: 1; transform: none; border-color: var(--accent); background: var(--accent-soft); } }
.ping-top { display: flex; align-items: center; gap: 10px; }
.ping-top .avatar { width: 32px; height: 32px; }
.ping-who { flex: 1; min-width: 0; }
.ping-who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ping-who span { color: var(--dim); font-size: 12px; }
.badge { padding: 4px 9px; border-radius: 8px; font: 600 12px var(--sans); white-space: nowrap; background: rgba(255, 255, 255, .06); color: var(--muted); }
.badge.called { background: var(--accent-soft); color: var(--accent); }
.badge.waiting { background: var(--warn-soft); color: var(--warn); }
.coin { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.coin img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; background: rgba(255, 255, 255, .06); flex: none; }
.coin-name { flex: 1; min-width: 0; }
.coin-name b { display: block; font: 700 18px/1.2 var(--sans); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-name span { display: block; color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.facts span { display: block; color: var(--dim); font-size: 12px; }
.facts b { display: block; font: 600 13px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record { margin-top: 10px; min-height: 36px; color: var(--muted); font-size: 12px; }
.record b { color: var(--warn); font-weight: 600; }
.empty { color: var(--dim); padding: 28px 0; }

/* Messages */
.toast { position: fixed; z-index: 8; left: 50%; top: 68px; transform: translateX(-50%); max-width: min(680px, 92vw); padding: 9px 14px; border-radius: 10px; background: var(--surface-solid); border: 1px solid var(--warn); color: var(--text); font-size: 13px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.toast.bad { border-color: var(--danger); }
.error { color: var(--danger); font-size: 13px; }
.scrim { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(0, 0, 0, .6); }
.modal { width: min(480px, 92vw); padding: 24px; }
.modal h2 { font: 700 20px var(--sans); letter-spacing: -.01em; margin-bottom: 16px; }
.modal label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.modal .row { display: flex; gap: 8px; }
.modal input { flex: 1; min-width: 0; }
.hint { margin-top: 10px; color: var(--dim); font-size: 12px; }
.modal .error { margin-top: 10px; }

/* Sells: the same signals as a buy, in red. */
.cell.sold .rim { background: var(--sell); }
.cell.sold { z-index: 3; transform: scale(1.3); }
.cell.sold::before { content: ""; position: absolute; left: 50%; top: 50%; width: 100%; aspect-ratio: 1; margin: -50% 0 0 -50%; border-radius: 50%; border: 2px solid var(--sell); animation: halo 1.6s ease-out infinite; pointer-events: none; }
.tag.sell, .tag.sell::after { background: var(--sell); color: #1a0606; }
.tag.sell .copy { color: #1a0606; }
.ping.sold { border-color: rgba(255, 92, 92, .35); }
.badge.sold { background: var(--sell-soft); color: var(--sell); }

/* Copy trading */
.wallet-button.connected { border-color: var(--accent); color: var(--accent); }
.copy-soon:disabled, .copy-soon:disabled:hover { opacity: 1; cursor: default; color: var(--muted); border-color: var(--line); background: transparent; }
.copy-soon span { padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 700 10px var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.cell.copied::after { content: ""; position: absolute; right: 8%; top: 4%; width: 22%; aspect-ratio: 1; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); pointer-events: none; }
.copy-note { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.copy-grid { display: grid; grid-template-columns: 1fr 120px; gap: 10px 12px; align-items: center; }
.copy-grid label { margin: 0; }
.copy-buttons { margin-top: 16px; flex-wrap: wrap; }
.prompts { position: fixed; z-index: 8; right: 16px; bottom: 16px; display: grid; gap: 10px; width: min(340px, calc(100vw - 32px)); }
.prompt { padding: 14px; border-radius: 14px; border: 1px solid var(--accent); background: var(--surface-solid); box-shadow: 0 16px 50px rgba(0, 0, 0, .6); animation: pop .2s var(--ease) backwards; }
.prompt.sell { border-color: var(--sell); }
.prompt b { display: block; font: 700 14px/1.3 var(--sans); }
.prompt span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.prompt-status { margin-top: 8px; min-height: 18px; color: var(--text); font-size: 12px; }
.prompt-status a { color: var(--accent); }
.prompt-buttons { margin-top: 8px; display: flex; gap: 8px; }
.prompt.sell .primary { background: var(--sell); border-color: var(--sell); color: #1a0606; }

/* Phones. Kept after everything else so these win. */
@keyframes hint-out { to { opacity: 0; visibility: hidden; } }
@media (max-width: 720px) {
  /* Phones: the headline becomes one compact band across the top, so the hive has the rest. */
  html, body { height: auto; }
  body { display: block; overflow: visible; min-height: 100svh; }
  .top { padding: 0 14px; gap: 12px; position: sticky; top: 0; z-index: 7; }
  .stage { height: 62svh; min-height: min(360px, 62svh); }
  .live { font-size: 12px; min-width: 0; }
  .live #status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .live .num { display: none; }
  /* The add box drops to its own row under the name, full width. */
  .top { height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; row-gap: 8px; }
  .track { width: 100%; order: 3; }
  .wallet-button, .copy-soon { order: 4; width: 100%; justify-content: center; }
  .prompts { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .track input { flex: 1; width: auto; min-width: 0; }
  .intro { left: 14px; right: 14px; top: 10px; width: auto; }
  .intro::before { inset: -10px -14px -14px; background: linear-gradient(rgba(7, 8, 10, .92) 70%, rgba(7, 8, 10, 0)); }
  .eyebrow { display: none; }
  .intro h2 { margin-top: 0; font-size: 22px; line-height: 1.1; }
  .intro h2 br { display: none; }
  .stats { margin-top: 8px; gap: 6px 18px; flex-wrap: wrap; }
  .stats dt { font-size: 11px; }
  .stats dd.num { font-size: 17px; }
  .stats .note { display: none; }
  .hint-drag { left: 10px; bottom: 8px; font-size: 11px; animation: hint-out .6s ease-in 6s forwards; }
  .recentre { right: 10px; bottom: 8px; }
  .detail { width: min(340px, calc(100vw - 24px)); max-height: calc(100% - 24px); overflow-y: auto; }
  .detail .foot { flex-wrap: wrap; }
  .dock { padding: 10px 14px 12px; }
  .dock-head { display: block; margin-bottom: 8px; }
  .limits { margin-top: 4px; text-align: left; font-size: 11px; line-height: 1.35; }
  .pings { flex-direction: column; overflow: visible; gap: 10px; padding-bottom: 0; }
  .ping { width: 100%; padding: 12px 14px; }
  .coin { flex-wrap: wrap; }
  .coin-name { flex: 1 1 calc(100% - 46px); }
  .coin .button, .coin button { flex: 1; justify-content: center; }
  .facts b { font-size: 12px; }
  .record { min-height: 0; }
  .tag { white-space: normal; max-width: 70vw; }
  .pan { z-index: 3; }  /* buy labels sit above the headline band, never under it */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
