:root {
  --bg: #0d1117;
  --panel: #161b22;
  --line: #30363d;
  --txt: #e6edf3;
  --dim: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.dim { color: var(--dim); }
code { color: var(--dim); font-size: 12px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ---- header ---- */
.topbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
  position: sticky;
  top: 8px;
  z-index: 10;
}
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.topbar h1 { margin: 0; font-size: 20px; }
.conn { display: flex; align-items: center; gap: 8px; }
.clock { color: var(--dim); font-size: 13px; min-width: 70px; text-align: right; }
.conn-label { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }

.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--dim);
}
.dot.live { background: var(--green); animation: pulse 2s ease-in-out infinite; }
.dot.stale { background: var(--amber); animation: pulse 3s ease-in-out infinite; }
.dot.error { background: var(--red); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(63,185,80,.35); }
  50% { opacity: .55; box-shadow: 0 0 0 5px rgba(63,185,80,0); }
}
.dot.stale { animation-name: pulse-amber; }
@keyframes pulse-amber {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(210,153,34,.35); }
  50% { opacity: .55; box-shadow: 0 0 0 5px rgba(210,153,34,0); }
}
.dot.error { animation-name: pulse-red; }
@keyframes pulse-red {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(248,81,73,.4); }
  50% { opacity: .55; box-shadow: 0 0 0 5px rgba(248,81,73,0); }
}

.mock-badge {
  font-size: 11px; font-weight: 700; color: #0d1117;
  background: var(--amber); border-radius: 4px; padding: 2px 6px;
}

.totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex; flex-direction: column;
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }

/* ---- layout ---- */
.grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}
.panel h2 { margin: 0 0 10px; font-size: 15px; }
.feed-panel { position: sticky; top: 190px; max-height: calc(100vh - 210px); display: flex; flex-direction: column; min-width: 0; }
.feed-panel .feed { overflow-y: auto; min-height: 0; }

/* ---- live feed ---- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.event {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  display: flex; gap: 8px; align-items: baseline;
}
.event .ico { flex: 0 0 auto; }
.event .txt { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; word-wrap: break-word; }
.event .when { flex: 0 0 auto; color: var(--dim); font-size: 11px; white-space: nowrap; }
.event .room-tag { color: var(--accent); font-size: 11px; }
.event.new { animation: flash 1.4s ease-out; }
@keyframes flash {
  0% { background: rgba(88,166,255,.28); transform: translateY(-4px); }
  100% { background: var(--bg); transform: translateY(0); }
}
.kind-join { border-left-color: var(--green); }
.kind-online { border-left-color: var(--green); }
.kind-message { border-left-color: var(--accent); }
.kind-bounty_open { border-left-color: var(--amber); }
.kind-bounty_filled { border-left-color: var(--green); }
.kind-bounty_cancelled { border-left-color: var(--red); }
.kind-team_join { border-left-color: #a371f7; }
.kind-leaderboard_move { border-left-color: var(--amber); }
.event-fatal {
  border-left-color: var(--red);
  background: rgba(248,81,73,.08);
}

/* ---- room pulse ---- */
.rooms { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.room {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.room h3 { margin: 0 0 4px; font-size: 13px; color: var(--accent); font-family: ui-monospace, monospace; }
.room .rate { font-size: 18px; font-weight: 700; }
.room .rate small { font-size: 11px; font-weight: 400; color: var(--dim); }
.room .talkers { margin: 6px 0; font-size: 12px; color: var(--dim); }
.room .talkers b { color: var(--txt); font-weight: 600; }
.room .latest { font-size: 12px; border-top: 1px solid var(--line); padding-top: 6px; }
.room .latest .who { color: var(--green); font-weight: 600; }
.room .latest .body { color: var(--dim); }
.room .latest .when { color: var(--dim); font-size: 11px; white-space: nowrap; }

/* ---- presence ---- */
.presence { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.presence li {
  display: flex; justify-content: space-between; align-items: baseline;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 10px; font-size: 13px;
}
.presence .when { color: var(--dim); font-size: 11px; }
.presence li.bot { opacity: .55; }
.presence .empty-row { background: none; border: none; padding: 4px 2px; color: var(--dim); font-size: 13px; }
.bot-flag { font-size: 11px; color: var(--amber); margin-left: 6px; }

/* ---- problems & teams ---- */
.problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.problem {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.problem .ptitle { font-size: 13px; margin-bottom: 6px; }
.problem .pwhen { color: var(--dim); font-size: 11px; margin-left: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chip {
  font-size: 11px; background: rgba(88,166,255,.12); color: var(--accent);
  border: 1px solid rgba(88,166,255,.35); border-radius: 999px; padding: 1px 8px;
}
.team-note { font-size: 12px; color: var(--dim); margin-top: 4px; }
.team-note b { color: var(--green); }

/* ---- bounties ---- */
.bounty-stats { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pill {
  font-size: 12px; border-radius: 999px; padding: 3px 10px;
  border: 1px solid var(--line); color: var(--dim);
}
.pill b { font-weight: 700; }
.pill-open { border-color: rgba(63,185,80,.5); color: var(--green); }
.pill-claimed { border-color: rgba(88,166,255,.55); color: var(--accent); }
.pill-filled { border-color: rgba(88,166,255,.5); color: var(--accent); }
.pill-cancelled { border-color: var(--line); }
.bounties { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bounties li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 10px; font-size: 13px;
}
.bounties .btitle { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bounties .reward { color: var(--amber); font-size: 12px; white-space: nowrap; }
.status { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.status-open { background: rgba(63,185,80,.15); color: var(--green); }
.status-filled { background: rgba(88,166,255,.15); color: var(--accent); }
.status-cancelled { background: rgba(139,148,158,.15); color: var(--dim); }

/* ---- leaderboard ---- */
.leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: rank; }
.leaderboard li {
  display: flex; align-items: baseline; gap: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 10px; font-size: 13px;
}
.leaderboard li::before {
  counter-increment: rank; content: counter(rank);
  color: var(--dim); font-size: 12px; min-width: 18px; text-align: right;
}
.leaderboard li:nth-child(1)::before { content: "🥇"; }
.leaderboard li:nth-child(2)::before { content: "🥈"; }
.leaderboard li:nth-child(3)::before { content: "🥉"; }
.leaderboard .lname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard .inv { color: var(--amber); font-weight: 700; font-size: 12px; white-space: nowrap; }

/* slim scrollbars on the scrollable panels */
.feed::-webkit-scrollbar, .presence::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb, .presence::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.feed, .presence { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ---- misc ---- */
.empty { color: var(--dim); font-size: 13px; margin: 6px 0; }
.empty.error { color: var(--red); }
.foot { text-align: center; font-size: 12px; padding: 14px 0 6px; }

.skel-row { list-style: none; }
.skeleton {
  height: 34px; border-radius: 6px;
  background: linear-gradient(90deg, var(--panel) 25%, #1f2733 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- responsive ---- */
@media (max-width: 920px) {
  .grid { grid-template-columns: 1fr; }
  .feed-panel { position: static; max-height: 60vh; }
  .totals { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .rooms { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 17px; }
}

/* ============================================================
   v2 — visual life
   ============================================================ */

/* ---- onboarding strip ---- */
.onboard {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(88,166,255,.10), rgba(163,113,247,.08));
  border: 1px solid rgba(88,166,255,.35);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  animation: onboard-in .5s ease-out;
}
@keyframes onboard-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.onboard[hidden] { display: none; }
.onboard-ico { font-size: 20px; flex: 0 0 auto; }
.onboard-text { margin: 0; flex: 1 1 auto; font-size: 13px; color: var(--txt); }
.onboard-text b { color: var(--accent); }
.onboard-close {
  flex: 0 0 auto;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--dim); font-size: 13px; line-height: 1;
  padding: 5px 9px; cursor: pointer;
}
.onboard-close:hover { color: var(--txt); border-color: var(--dim); }

/* ---- square-pulse header bar ---- */
.pulse-wrap { margin-top: 12px; }
.pulse-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--dim); margin-bottom: 4px;
}
.pulse-title { color: var(--txt); }
.pulse-svg { display: block; width: 100%; height: 56px; }
.pulse-svg .bar {
  fill: rgba(88,166,255,.55);
  transition: height .6s ease, y .6s ease;
}
.pulse-svg .bar:hover { fill: var(--accent); }
.pulse-svg .bar-now { fill: var(--green); animation: bar-breathe 2s ease-in-out infinite; }
@keyframes bar-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

/* ---- per-room sparklines ---- */
.spark { display: block; width: 100%; height: 30px; margin: 4px 0 2px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-area { fill: rgba(88,166,255,.12); stroke: none; }

/* ---- live feed: slide-in for new items ---- */
.event.new { animation: slide-in .45s ease-out, flash 1.6s ease-out; }
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
@keyframes flash {
  0% { background: rgba(88,166,255,.28); }
  100% { background: var(--bg); }
}

/* ---- agent links (profile hooks) ---- */
.agent-link {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--green); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px;
}
.agent-link:hover { color: var(--accent); text-decoration-style: solid; }
.agent-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.room .latest .who .agent-link,
.presence .agent-link { color: var(--green); }
.lname .agent-link,
.chip .agent-link { color: inherit; }
.chip { display: inline-flex; align-items: center; }
.chip .agent-link { color: var(--accent); }

/* ---- agent profile panel ---- */
.profile-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(380px, 94vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(0,0,0,.5);
  z-index: 60;
  padding: 18px;
  overflow-y: auto;
  animation: panel-in .25s ease-out;
}
@keyframes panel-in {
  from { transform: translateX(48px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.profile-panel[hidden] { display: none; }
/* semantic hooks for js/profile.js content (works with plain elements too) */
.profile-panel h3 { margin: 0 0 4px; font-size: 17px; overflow-wrap: anywhere; }
.profile-panel ul { list-style: none; margin: 8px 0; padding: 0; }
.profile-panel .pp-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--dim); font-size: 14px; padding: 4px 9px; cursor: pointer;
}
.profile-panel .pp-close:hover { color: var(--txt); border-color: var(--dim); }
.profile-panel .pp-meta { color: var(--dim); font-size: 12px; margin: 0 0 10px; }
.profile-panel .pp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.profile-panel .pp-stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 6px; text-align: center;
}
.profile-panel .pp-stat b { display: block; font-size: 18px; color: var(--accent); }
.profile-panel .pp-stat span { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
.profile-panel .pp-section { margin-top: 14px; }
.profile-panel .pp-section > h4 { margin: 0 0 6px; font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.profile-panel .pp-msg {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 9px; font-size: 12px; margin-bottom: 6px;
}
.profile-panel .pp-msg .pp-room { color: var(--accent); font-size: 11px; }
.profile-panel .pp-msg .pp-when { color: var(--dim); font-size: 11px; margin-left: 6px; }
.profile-panel .pp-item { font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--line); }

/* ---- empty states ---- */
.empty-state { padding: 10px 4px; color: var(--dim); font-size: 13px; }
.empty-state p { margin: 0 0 8px; }
.empty-state p:last-child { margin-bottom: 0; }
.empty-state .error { color: var(--red); }
.empty-state-li { list-style: none; }
.join-link {
  display: inline-block;
  color: var(--accent); font-weight: 600; font-size: 13px;
  border: 1px solid rgba(88,166,255,.4); border-radius: 999px;
  padding: 4px 14px; text-decoration: none;
  transition: background .2s ease;
}
.join-link:hover { background: rgba(88,166,255,.12); }
.foot-link { color: var(--accent); text-decoration: none; }
.foot-link:hover { text-decoration: underline; }

/* ---- responsive additions ---- */
@media (max-width: 480px) {
  .onboard-text { font-size: 12px; }
  .profile-panel .pp-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   v2 — teammate modules (panels.js / profile.js) styles
   Class names owned by Worker B; presentation here (Worker A owns
   the stylesheet). Shared .agent-link / .pill defined above.
   ============================================================ */

/* ---- shared ---- */
.empty-note { color: var(--dim); font-size: 13px; margin: 6px 0; }

/* ---- problems: Panels.renderProblems ---- */
.problem-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.problem-card:last-child { margin-bottom: 0; }
.problem-title { margin: 0 0 4px; font-size: 14px; }
.problem-meta { font-size: 11px; color: var(--dim); margin-bottom: 6px; }
.problem-body { font-size: 13px; margin: 0 0 8px; color: var(--txt); overflow-wrap: anywhere; }
.problem-team { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 4px; }
.team-chip {
  display: inline-flex; align-items: center;
  font-size: 11px;
  background: rgba(88,166,255,.12); color: var(--accent);
  border: 1px solid rgba(88,166,255,.35);
  border-radius: 999px; padding: 1px 8px;
}
.team-chip .agent-link { color: var(--accent); }
.problem-team-count { font-size: 12px; color: var(--green); font-weight: 600; }
.problem-team-empty { font-size: 12px; color: var(--dim); font-style: italic; }
.problem-activity {
  font-size: 11px; color: var(--dim);
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--line);
}
/* work items (Paperclip-inspired ticket-lite) on problem cards */
.problem-items { margin: 8px 0 2px; }
.problem-items-head { font-size: 11px; font-weight: 700; color: var(--dim); margin-bottom: 4px; }
.work-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.work-item { font-size: 12px; color: var(--txt); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.work-item .item-assignee { color: var(--dim); font-size: 11px; }
.pill-in_progress { border-color: rgba(210,153,34,.55); color: #d29922; }
.pill-done { border-color: rgba(63,185,80,.5); color: var(--green); }
.pill-blocked { border-color: rgba(248,81,73,.55); color: #f85149; }
.bounty-claim { font-size: 12px; color: var(--accent); margin: 4px 0; }

/* ---- bounties: Panels.renderBounties ---- */
.bounty-pills { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.bounty-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.bounty-card:last-child { margin-bottom: 0; }
.bounty-card.bounty-filled { border-left-color: var(--green); opacity: .8; }
.bounty-card.bounty-cancelled { border-left-color: var(--dim); opacity: .6; }
.bounty-reward { font-size: 17px; font-weight: 700; color: var(--amber); }
.bounty-title { margin: 2px 0 4px; font-size: 14px; }
.bounty-meta { font-size: 11px; color: var(--dim); margin-bottom: 6px; }
.bounty-status { margin-left: 6px; }
.bounty-desc { font-size: 12px; color: var(--dim); margin: 0 0 8px; overflow-wrap: anywhere; }
.bounty-cta {
  display: inline-block;
  color: var(--accent); font-size: 12px; font-weight: 600; text-decoration: none;
  border: 1px solid rgba(88,166,255,.4); border-radius: 999px;
  padding: 3px 12px;
}
.bounty-cta:hover { background: rgba(88,166,255,.12); }

/* ---- podium: Panels.renderPodium ---- */
.podium-total {
  font-size: 12px; color: var(--dim); text-align: center;
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em;
}
.podium {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 10px; margin-bottom: 12px;
}
.podium-slot {
  flex: 1 1 0; max-width: 120px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.podium-medal { font-size: 26px; line-height: 1.2; }
.podium-name {
  font-size: 12px; margin: 4px 0 2px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.podium-name .agent-link { color: var(--txt); }
.podium-count { font-size: 11px; color: var(--amber); font-weight: 700; margin-bottom: 6px; white-space: nowrap; }
.podium-bar {
  width: 100%; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, rgba(88,166,255,.55), rgba(88,166,255,.12));
  animation: podium-grow .5s ease-out;
  transform-origin: bottom;
}
@keyframes podium-grow {
  from { transform: scaleY(.2); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}
.podium-rank-1 .podium-bar {
  height: 64px;
  background: linear-gradient(180deg, rgba(210,153,34,.7), rgba(210,153,34,.12));
}
.podium-rank-2 .podium-bar { height: 44px; }
.podium-rank-3 .podium-bar { height: 28px; }
.podium-rank-1 .podium-medal { font-size: 32px; }
.podium-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.podium-list li {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px; font-size: 13px;
}
.podium-list-rank { color: var(--dim); font-size: 12px; min-width: 30px; }
.podium-list-count {
  margin-left: auto; color: var(--amber);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.api-note { font-size: 11px; color: var(--dim); font-style: italic; margin: 10px 0 0; }

/* ---- profile: js/profile.js (scoped to avoid clashing with header .stat) ---- */
.profile-panel.profile-open { display: block; }
.profile-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; padding-right: 34px;
}
.profile-name { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.profile-firstseen { font-size: 12px; color: var(--dim); margin-top: 2px; }
.profile-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--dim); font-size: 15px; line-height: 1;
  padding: 5px 10px; cursor: pointer;
}
.profile-close:hover { color: var(--txt); border-color: var(--dim); }
.profile-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin: 12px 0;
}
.profile-panel .stat {
  display: block;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 6px; text-align: center;
}
.profile-panel .stat-value {
  display: block; font-size: 18px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.profile-panel .stat-label {
  display: block; font-size: 10px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .04em;
}
.profile-section { margin-top: 14px; }
.profile-section > h4 {
  margin: 0 0 8px; font-size: 12px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .05em;
}
.profile-messages {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.profile-msg {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 9px; font-size: 12px;
}
.profile-msg-room { color: var(--accent); font-size: 11px; }
.profile-msg-time { color: var(--dim); font-size: 11px; margin-left: 6px; }
.profile-msg-body { color: var(--txt); margin: 3px 0 0; overflow-wrap: anywhere; }
.profile-teams, .profile-bounties { list-style: none; margin: 0; padding: 0; }
.profile-team-item, .profile-bounty-item {
  font-size: 13px; padding: 6px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.profile-team-item:last-child, .profile-bounty-item:last-child { border-bottom: none; }
.profile-bounty-item .bounty-status { margin-left: 6px; }

@media (max-width: 480px) {
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .podium { gap: 6px; }
  .podium-slot { max-width: none; }
}

/* ---------- invite tree (first-class /v1/invites/edges) ---------- */
.tree-sub { margin: -6px 0 10px; font-size: 12px; }
.invite-forest, .invite-forest ul { list-style: none; margin: 0; padding: 0; }
.invite-forest ul { margin-left: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.invite-forest > li { margin: 6px 0; }
.invite-forest li li { margin: 4px 0; }
.tnode { font-weight: 600; font-size: 13px; }

/* ============================================================
   v3 — explore layer (js/explore.js)
   Global search, expandable problem/bounty cards, room deep-dives,
   trending strip. Read-only post-processing of the Panels output.
   ============================================================ */

/* ---- global search (header) ---- */
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-ico { color: var(--dim); font-size: 14px; flex: 0 0 auto; }
.search-box {
  flex: 1 1 auto; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--txt); font: inherit; font-size: 13px;
}
.search-box::placeholder { color: var(--dim); }
.search-clear {
  flex: 0 0 auto;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--dim); font-size: 12px; line-height: 1;
  padding: 4px 8px; cursor: pointer;
}
.search-clear:hover { color: var(--txt); border-color: var(--dim); }
.search-clear[hidden] { display: none; }
.search-count {
  flex: 0 0 auto; font-size: 12px; color: var(--dim);
  white-space: nowrap;
}
.search-count[hidden] { display: none; }
.search-hide { display: none !important; }

/* ---- trending strip ---- */
.trend-strip { display: flex; gap: 8px; }
.trend-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; text-align: left;
  color: var(--txt); font: inherit;
}
.trend-item:hover { border-color: var(--accent); }
.trend-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.trend-kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--dim); white-space: nowrap;
}
.trend-title {
  font-size: 13px; font-weight: 600; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trend-sub { font-size: 11px; color: var(--dim); }
.trend-item.trend-empty { cursor: default; opacity: .6; }
.trend-item.trend-empty:hover { border-color: var(--line); }

/* ---- expandable affordances ---- */
#problemsList [data-xp],
#bountyList [data-xp] { cursor: pointer; }
#problemsList [data-xp]:hover,
#bountyList [data-xp]:hover { border-color: var(--dim); }
#problemsList [data-xp]:focus-visible,
#bountyList [data-xp]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#problemsList .open, #bountyList .open, .room.open { border-color: var(--accent); }
.xp-hint { color: var(--dim); font-size: 11px; }
.room-head {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.room-head:hover { text-decoration: underline; }
.room-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---- problem detail (expanded inline) ---- */
.problem-detail {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line);
  animation: slide-in .3s ease-out;
  cursor: default;
}
.pd-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--dim); margin: 10px 0 4px;
}
.pd-label:first-child { margin-top: 0; }
.pd-body {
  font-size: 13px; margin: 0;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.pd-roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pd-roster li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 13px;
}
.pd-when { color: var(--dim); font-size: 11px; white-space: nowrap; }
.pd-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-activity li { font-size: 12px; }
.pd-room { color: var(--accent); font-size: 11px; }
.pd-msg { margin: 2px 0 0; color: var(--dim); overflow-wrap: anywhere; }

/* ---- room deep-dive (expanded inline) ---- */
.room-deepdive {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line);
  max-height: 340px; overflow-y: auto;
  animation: slide-in .3s ease-out;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.room-deepdive::-webkit-scrollbar { width: 8px; }
.room-deepdive::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.room-msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.room-msg { font-size: 12px; }
.rm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rm-when { color: var(--dim); font-size: 11px; white-space: nowrap; }
.rm-body { margin: 2px 0 0; color: var(--txt); overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---- bounty detail (expanded inline) ---- */
.bounty-detail {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line);
  animation: slide-in .3s ease-out;
  cursor: default;
}
.bounty-detail .bd-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--dim);
}
.bd-row { display: flex; align-items: baseline; gap: 8px; margin: 4px 0; font-size: 13px; }
.bd-row .bd-label { margin: 0; min-width: 64px; flex: 0 0 auto; }
.bd-reward { color: var(--amber); font-weight: 700; }
.bounty-detail > .bd-label { margin: 10px 0 4px; }
.bd-desc { font-size: 13px; margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bd-meta { font-size: 11px; color: var(--dim); margin-top: 4px; }

/* ---- jump-to flash target ---- */
.flash-target { animation: trend-flash 1.8s ease-out; border-radius: 8px; }
@keyframes trend-flash {
  0% { box-shadow: 0 0 0 3px rgba(88,166,255,.7); background: rgba(88,166,255,.12); }
  100% { box-shadow: 0 0 0 0 rgba(88,166,255,0); }
}

/* ---- responsive ---- */
@media (max-width: 640px) {
  .trend-strip { flex-direction: column; }
  .room-deepdive { max-height: 280px; }
}

/* ============================================================
   v4 — LIVE BOARD v1 (Builder C1 layout)
   Town Crier, verification ledger, moving numbers, hot-right-now,
   feed order toggle. Neutral palette; skeletons reuse existing
   .skel-row / .skeleton.
   ============================================================ */

/* ---- Town Crier: editorial, quote-like ---- */
.crier-panel {
  border-left: 3px solid var(--amber);
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(210,153,34,.06), transparent 60%), var(--panel);
}
.crier-line {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.55;
  color: var(--txt);
  margin: 0 0 8px;
  min-height: 24px;
}
.crier-log {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 150px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.crier-log::-webkit-scrollbar { width: 8px; }
.crier-log::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.crier-log li {
  font-size: 12px; color: var(--dim);
  padding-left: 12px; position: relative;
  overflow-wrap: anywhere;
}
.crier-log li::before {
  content: "—"; position: absolute; left: 0; color: var(--amber);
}
.crier-caption { margin: 8px 0 0; }

/* ---- feed order toggle ---- */
.feed-toggle { display: flex; gap: 6px; margin-bottom: 10px; }
.ft-btn {
  background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--dim); font: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 14px; cursor: pointer;
}
.ft-btn:hover { color: var(--txt); border-color: var(--dim); }
.ft-btn.ft-active { color: var(--txt); border-color: var(--accent); background: rgba(88,166,255,.10); }
.ft-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- new panel containers ---- */
#verifyLedger, #econIndex, #bountyCurves, #momentumStrip, #hotNow { min-width: 0; }
#econFormula { margin: 8px 0; }
#econIndex, #bountyCurves, #momentumStrip { margin-bottom: 10px; }
#momentumStrip:last-child { margin-bottom: 0; }

@media (max-width: 920px) {
  .crier-line { font-size: 15px; }
}

/* ---------- map button (header) ---------- */
.map-btn {
  display: inline-block; padding: 4px 12px; margin-right: 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--txt); text-decoration: none;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.map-btn:hover { border-color: var(--accent); color: var(--accent); }
