:root {
  --bg: #101418;
  --panel: #1c2126;
  --panel-edge: #2a3138;
  --text: #e0e6eb;
  --muted: #8a949e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

#layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: 1fr 36px;
  height: 100vh;
}

#canvas-container { grid-column: 1; grid-row: 1; position: relative; }
/* touch-action:none lets our own touch handlers own every gesture —
   otherwise the browser scrolls/zooms the page mid-pan. */
#three-canvas { width: 100%; height: 100%; display: block; touch-action: none; }

#sidebar {
  grid-column: 2; grid-row: 1;
  padding: 16px 20px;
  background: var(--panel);
  border-left: 1px solid var(--panel-edge);
  /* The panel itself never scrolls: it is a flex column sized to the
     viewport, and each feed (mind/conversations/actions) scrolls
     INTERNALLY inside its flexed share. overflow-y:auto stays only as
     a safety net for very short windows. */
  overflow-y: auto;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#sidebar h2, #sidebar .row { flex: 0 0 auto; }

#sidebar h2 {
  margin: 16px 0 6px 0;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}
#sidebar h2:first-child { margin-top: 0; }

#sidebar .row {
  margin: 4px 0;
  padding: 8px 0;
  border-top: 1px solid var(--panel-edge);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
#sidebar .row:first-of-type { border-top: none; }

#footer {
  grid-column: 1 / -1; grid-row: 2;
  background: var(--panel);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--panel-edge);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

#status::before {
  content: "● ";
  color: #4caf50;
  transition: text-shadow 0.15s ease;
}
#status.disconnected::before { color: #f44336; }
#status.connecting::before { color: #ffb300; }
#status.pulse::before {
  text-shadow: 0 0 8px #4caf50, 0 0 16px #4caf50;
}

#session-picker {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
#session-picker[hidden] { display: none; }
.picker-card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  padding: 24px 28px;
  border-radius: 8px;
  max-width: 640px;
  width: 90%;
}
.picker-card h2 { margin: 0 0 12px 0; font-size: 14px; }
#session-list { list-style: none; padding: 0; margin: 0; max-height: 60vh; overflow-y: auto; }
#session-list li {
  padding: 10px 12px;
  margin: 4px 0;
  cursor: pointer;
  border-radius: 4px;
  background: #232930;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  border: 1px solid transparent;
}
#session-list li:hover { background: #2c3239; border-color: #3d454d; }
#session-list li.empty { background: transparent; cursor: default; color: var(--muted); }

/* ─── viewer top-bar (dashboard link) ─────────────────────────────────── */
#viewer-topbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  gap: 12px;
  align-items: center;
}
#viewer-topbar a, #viewer-topbar .pill {
  background: rgba(28, 33, 38, 0.9);
  border: 1px solid var(--panel-edge);
  padding: 6px 12px;
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
#viewer-topbar a:hover { background: rgba(45, 53, 60, 0.9); }
#viewer-topbar .pill { color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* ─── inventory panel (in sidebar) ───────────────────────────────────── */
#inventory-summary {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  margin-bottom: 4px;
}
#inventory-list {
  list-style: none;
  margin: 4px 0 0 0;
  padding: 0;
  border-top: 1px solid var(--panel-edge);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}
#inventory-list li.empty {
  text-align: center;
  color: var(--muted);
  padding: 8px 0;
  font-style: italic;
}
#inventory-list .inv-entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid #232930;
}
#inventory-list .inv-name {
  color: var(--text);
}
#inventory-list .inv-count {
  color: var(--muted);
  font-size: 11px;
}

/* ─── conversation log (in sidebar) ────────────────────────────────────── */
#conversation-log {
  list-style: none;
  margin: 4px 0 0 0;
  padding: 0;
  flex: 1.35 1 80px;
  min-height: 48px;
  overflow-y: auto;
  border-top: 1px solid var(--panel-edge);
  font-size: 12.5px;
}
#conversation-log li.empty {
  text-align: center;
  color: var(--muted);
  display: block;
  padding: 16px 0;
  font-style: italic;
}
#conversation-log li.chat-entry {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 4px 10px;
  padding: 7px 0;
  border-bottom: 1px solid #232930;
  line-height: 1.4;
}
#conversation-log .chat-from {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  align-self: start;
  padding-top: 1px;
}
#conversation-log .chat-text {
  color: var(--text);
  word-break: break-word;
}
#conversation-log .chat-meta {
  grid-column: 2;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
#conversation-log li.new {
  animation: flash-in 0.6s ease-out;
}

/* ─── camera help (? button + popover) + follow controls ───────────────── */
.help-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--panel-edge);
  background: rgba(28, 33, 38, 0.92);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s ease;
}
.help-toggle:hover { background: rgba(48, 56, 64, 0.95); }
.help-toggle.is-open {
  background: rgba(255, 200, 80, 0.18);
  border-color: rgba(255, 200, 80, 0.55);
  color: #ffd380;
}
.help-panel {
  position: absolute;
  top: 52px;
  right: 12px;
  z-index: 5;
  background: rgba(20, 24, 28, 0.96);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 12px 14px;
  backdrop-filter: blur(6px);
  font-size: 12px;
  color: var(--text);
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.help-panel[hidden] { display: none; }
.settings-toggle { right: 52px; }
.settings-panel { right: 52px; min-width: 220px; }
.fullscreen-toggle { right: 92px; font-size: 14px; }
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.settings-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.settings-panel input[type="range"] { width: 100%; accent-color: #ffd380; }
.settings-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.help-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  padding: 4px 0;
  align-items: center;
}
.help-row span { color: var(--muted); }
.help-panel kbd {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px;
  background: rgba(60, 70, 80, 0.6);
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
}

.follow-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.follow-label {
  border-radius: 14px 0 0 14px;
  border-right: 0;
}
.follow-select {
  background: rgba(28, 33, 38, 0.9);
  color: var(--text);
  border: 1px solid var(--panel-edge);
  padding: 5px 8px;
  border-radius: 0;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  cursor: pointer;
  max-width: 180px;
}
.follow-stop {
  cursor: pointer;
  border-radius: 0 14px 14px 0;
  border-left: 0;
  color: #ff8b8b;
  background: rgba(74, 31, 36, 0.9);
}
.follow-stop:hover { background: rgba(95, 40, 46, 0.95); }

.find-mine {
  cursor: pointer;
  background: rgba(40, 60, 90, 0.9);
  color: #b8d4ff;
  border: 1px solid rgba(120, 160, 220, 0.4);
}
.find-mine:hover { background: rgba(60, 90, 130, 0.95); }

.goto-bank {
  cursor: pointer;
  background: rgba(70, 55, 20, 0.9);
  color: #ffd95e;
  border: 1px solid rgba(220, 180, 90, 0.45);
}
.goto-bank:hover { background: rgba(100, 80, 30, 0.95); }

.inv-toggle {
  cursor: pointer;
  background: rgba(60, 50, 30, 0.9);
  color: #f0d4a0;
  border: 1px solid rgba(180, 140, 80, 0.4);
}
.inv-toggle:hover { background: rgba(90, 75, 45, 0.95); }

/* Modal */
.inv-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.inv-modal[hidden] { display: none; }
.inv-modal-card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 18px 22px;
  width: min(420px, 92vw);
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.inv-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.inv-modal-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
  /* Long agent names must wrap inside the card, not run over it. */
  min-width: 0;
  overflow-wrap: anywhere;
  padding-right: 8px;
}
.inv-modal-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}
.inv-modal-close:hover { color: var(--text); }
.inv-modal-meta {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 12px;
  border-top: 1px solid var(--panel-edge);
  padding-top: 8px;
  text-align: right;
}
.inv-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  font-size: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.inv-modal-list li.inv-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 8px;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
}
.inv-thumb {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  border-radius: 4px;
}
.inv-thumb-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 32px;
}
.inv-tile-name {
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.inv-tile-count {
  position: absolute;
  top: 4px;
  right: 5px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
  color: #ffd380;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  padding: 1px 4px;
}
.inv-modal-list .inv-private,
.inv-modal-list .inv-empty { grid-column: 1 / -1; }
.inv-modal-list .inv-empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 24px 0;
  display: block;
  border-bottom: 0;
}
.inv-modal-list .inv-private {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 24px 0;
  display: block;
  border-bottom: 0;
}
.bank-modal-gold {
  font-size: 15px;
  font-weight: 600;
  color: #ffd380;
  padding: 6px 0 12px;
  border-bottom: 1px solid var(--panel-edge);
  margin-bottom: 10px;
}

.board-modal-card { width: min(460px, 92vw); }
.board-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.board-note {
  padding: 10px 12px;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}
.board-note-mine {
  border-color: rgba(255, 211, 128, 0.5);
  background: rgba(255, 211, 128, 0.08);
}
.board-note-new { box-shadow: 0 0 0 1px #6dc1ff inset; }
.board-note-new::before {
  content: '● NEW';
  display: block;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: #6dc1ff;
  margin-bottom: 4px;
}
.board-note-text {
  font-size: 13.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  margin-bottom: 6px;
}
.board-note-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.board-note-when { flex: 0 0 auto; }

/* Follow HUD: floating chip at bottom-center of the canvas while following */
.follow-hud {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(20, 24, 28, 0.92);
  border: 1px solid var(--panel-edge);
  border-radius: 18px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.follow-hud[hidden] { display: none; }
.follow-hud-name { font-weight: 600; }
.follow-hud-sep { color: var(--muted); }
.follow-hud-stat { display: inline-flex; align-items: center; gap: 4px; }
.follow-hud-stat .hud-icon.hp { color: #ff5e85; }
.follow-hud-stat .hud-icon.hg { font-size: 11px; }
.follow-hud-action {
  color: var(--muted);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── action history panel (in sidebar) ───────────────────────────────── */
#action-history {
  list-style: none;
  margin: 4px 0 0 0;
  padding: 0;
  flex: 1 1 60px;
  min-height: 48px;
  overflow-y: auto;
  border-top: 1px solid var(--panel-edge);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
}
#action-history li {
  padding: 8px 0;
  border-bottom: 1px solid #232930;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 6px 10px;
  align-items: baseline;
}
#action-history li.empty {
  text-align: center;
  color: var(--muted);
  display: block;
  padding: 16px 0;
  font-style: italic;
}
#action-history .tick {
  color: var(--muted);
  text-align: right;
  font-size: 10.5px;
  padding-top: 1px;
}
#action-history .body { line-height: 1.5; }
#action-history .tool {
  font-weight: 600;
  margin-right: 6px;
  text-transform: lowercase;
}
#action-history .tool.move,
#action-history .tool.turn { color: #6dc1ff; }
#action-history .tool.place_block { color: #6ce066; }
#action-history .tool.break_block { color: #ff8b6b; }
#action-history .tool.observe { color: #c8a8ff; }
#action-history .tool.read_memory,
#action-history .tool.write_memory { color: #ffd166; }
#action-history .tool.end_session { color: #ff6b9d; }
#action-history .params { color: var(--text); }
#action-history .status {
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #2a3138;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
}
#action-history .status.ok      { background: #1e3324; color: #79d18a; }
#action-history .status.blocked { background: #3a2f1a; color: #f0b95c; }
#action-history .status.error   { background: #3a2024; color: #ff6b6b; }
#action-history .meta {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 2px;
}
#action-history li.new {
  animation: flash-in 0.6s ease-out;
}
@keyframes flash-in {
  from { background: rgba(255, 200, 80, 0.15); }
  to   { background: transparent; }
}

/* ─── dashboard ──────────────────────────────────────────────────────── */
body.dashboard-body {
  height: auto;
  overflow: auto;
  padding: 24px;
}

#dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--panel-edge);
  padding-bottom: 16px;
}
#dashboard-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.2px;
}
#dashboard-header .subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}
.muted { color: var(--muted); }

.status-pill {
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.status-pill.ok::before  { content: "● "; color: #4caf50; }
.status-pill.err::before { content: "● "; color: #f44336; }
.status-pill.connecting::before { content: "● "; color: #ffb300; }

#dashboard section { margin-bottom: 28px; }
#dashboard h2 {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  margin: 0 0 12px 0;
}
#dashboard h2 .count {
  display: inline-block;
  margin-left: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 10px;
  color: var(--text);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.session-card {
  display: block;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 14px 16px;
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.session-card:hover {
  transform: translateY(-2px);
  border-color: #3d4750;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.session-card[data-status="live"] {
  border-color: #2a553a;
  box-shadow: 0 0 0 1px rgba(76, 175, 80, 0.2);
}
.session-card[data-status="live"] .status-dot {
  background: #4caf50;
  box-shadow: 0 0 8px #4caf50;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.card-row { display: flex; align-items: center; gap: 8px; }
.card-top { font-size: 11px; }
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #6a7884;
}
.card-status {
  font-size: 10.5px;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--muted);
}
.session-card[data-status="live"] .card-status { color: #4caf50; }
.card-time { margin-left: auto; font-size: 11px; }

.card-id {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
}
.card-id .label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 9.5px;
  width: 50px;
}
.card-id .mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--text);
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0 10px 0;
  border-top: 1px solid var(--panel-edge);
  border-bottom: 1px solid var(--panel-edge);
  padding: 10px 0;
}
.card-stats .stat { text-align: center; }
.card-stats .stat-num {
  font-size: 18px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.card-stats .stat-label {
  font-size: 9.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.card-last {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--text);
  flex-wrap: wrap;
}
.card-last .last-tool { font-weight: 600; }
.card-last .last-tool[data-tool="move"],
.card-last .last-tool[data-tool="turn"] { color: #6dc1ff; }
.card-last .last-tool[data-tool="place_block"] { color: #6ce066; }
.card-last .last-tool[data-tool="break_block"] { color: #ff8b6b; }
.card-last .last-tool[data-tool="observe"] { color: #c8a8ff; }
.card-last .last-tool[data-tool="read_memory"],
.card-last .last-tool[data-tool="write_memory"] { color: #ffd166; }

.card-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-cta {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  margin-left: auto;
}
.session-card:hover .card-cta { color: #6dc1ff; }

.btn-disconnect {
  background: transparent;
  border: 1px solid #5a3236;
  color: #ff8b8b;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn-disconnect:hover {
  background: #4a1f24;
  color: #ffb0b0;
  border-color: #7a3a40;
}
.btn-disconnect:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-claim {
  background: transparent;
  border: 1px solid #3a4750;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn-claim:hover { background: #232930; color: var(--text); }
.btn-claim.is-claimed {
  background: #1a3a25;
  color: #b0ffc0;
  border-color: #3a7a46;
}
.btn-claim.is-claimed:hover { background: #234a30; }

.card-inv .inv-detail.hidden {
  font-style: italic;
  opacity: 0.6;
}

.btn-readmit {
  background: transparent;
  border: 1px solid #2f5a36;
  color: #8be0a0;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn-readmit:hover {
  background: #1f4a28;
  color: #b0ffc0;
  border-color: #3a7a46;
}
.btn-readmit:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Phase 2: hunger bar on session cards. */
.card-hunger {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin-top: 6px;
}
.card-hunger .muted {
  flex: 0 0 48px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 9.5px;
}
.card-hunger .hunger-bar {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.card-hunger .hunger-fill {
  height: 100%;
  background: #5fd06b;
  transition: width 0.3s ease, background 0.3s ease;
}
.card-hunger .hunger-value {
  flex: 0 0 24px;
  text-align: right;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
/* Phase 2 Layer 2.5: HP bar (pink/orange/red), same layout as hunger. */
.card-hp {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin-top: 4px;
}
.card-hp .muted {
  flex: 0 0 48px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 9.5px;
}
.card-hp .hp-bar {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.card-hp .hp-fill {
  height: 100%;
  background: #ff5e85;
  transition: width 0.3s ease, background 0.3s ease;
}
.card-hp .hp-value {
  flex: 0 0 28px;
  text-align: right;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.card-inv {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.card-inv .muted {
  flex: 0 0 48px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 9.5px;
}
.card-inv .inv-value {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--text);
}
.card-inv .inv-detail {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px;
  flex: 1 0 100%;
  margin-left: 56px;
  color: var(--muted);
  word-break: break-word;
}

.session-card[data-state="critical"] {
  border-color: #6a2424;
  animation: critical-pulse 1.4s ease-in-out infinite;
}
@keyframes critical-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,90,90,0.2); }
  50% { box-shadow: 0 0 12px rgba(255,90,90,0.55); }
}

.empty-state {
  background: var(--panel);
  border: 1px dashed var(--panel-edge);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Onboarding card — shown when the user hasn't claimed any agents yet. */
.onboard-card {
  background: linear-gradient(135deg, rgba(255, 200, 80, 0.12), rgba(120, 160, 220, 0.10));
  border: 1px solid rgba(255, 200, 80, 0.35);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.5;
}
.onboard-card h2 { margin: 0 0 8px 0; font-size: 16px; color: #ffd380; }
.onboard-card p { margin: 0; font-size: 13.5px; }
.onboard-card b { color: #ffd380; }

/* Others-toggle button next to the section header */
.others-toggle {
  margin-left: 10px;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid var(--panel-edge);
  background: rgba(40, 50, 60, 0.6);
  color: var(--text);
  cursor: pointer;
  font-family: ui-monospace, Menlo, monospace;
}
.others-toggle:hover { background: rgba(60, 70, 80, 0.8); }

/* Compact one-line rows for unclaimed agents */
.others-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
}
.others-list[hidden] { display: none; }
.others-row {
  display: grid;
  grid-template-columns: 80px 1fr 70px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  font-size: 12.5px;
}
.others-id {
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 600;
  color: var(--text);
}
.others-meta {
  color: var(--muted);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px;
}
.others-claim {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  border: 1px solid rgba(120, 160, 220, 0.5);
  background: rgba(40, 60, 90, 0.6);
  color: #b8d4ff;
  cursor: pointer;
}
.others-claim:hover { background: rgba(60, 90, 130, 0.85); }

/* World card — pinned at the top of the dashboard above session cards. */
.world-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(135deg, #1f2730 0%, #2a3540 100%);
  border: 1px solid #3a4a5a;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 8px;
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.world-card:hover {
  transform: translateY(-2px);
  border-color: #5d7080;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.world-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.world-card-top { margin-bottom: 14px; }
.world-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #4caf50;
  box-shadow: 0 0 10px #4caf50;
  animation: live-pulse 1.6s ease-in-out infinite;
}
.world-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.world-tick {
  margin-left: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}
.world-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 0;
  margin-bottom: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.world-stats .stat { text-align: center; }
.world-stats .stat-num {
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.world-stats .stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}
.world-recent-message {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  flex-wrap: wrap;
}
.world-card-cta {
  margin-top: 10px;
  text-align: right;
  font-size: 12px;
  font-weight: 500;
  color: #6dc1ff;
}

/* ─── Plan panel (right sidebar) ─────────────────────────────────── */
.plan-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  flex: 0 1 auto;
  max-height: 20vh;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.18);
}
.plan-empty {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 6px 0;
}
.plan-goal {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1.4;
}
.plan-mark { flex: none; width: 14px; text-align: center; font-size: 11px; }
.plan-text { word-break: break-word; }
.plan-active {
  color: #ffe08a;
  font-weight: 600;
}
.plan-active .plan-mark { color: #ffd95e; }
.plan-todo { color: #c4cdd6; }
.plan-todo .plan-mark { color: var(--muted); }
.plan-done { color: var(--muted); text-decoration: line-through; }
.plan-done .plan-mark { color: #6ce066; }
.plan-blocked .plan-mark { color: #ff8b8b; }

/* ─── Mind feed (right sidebar) ──────────────────────────────────── */
.mind-feed {
  flex: 1.1 1 60px;
  min-height: 48px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 8px;
  background: rgba(0,0,0,0.18);
}
.mind-feed.collapsed { display: none; }
.mind-feed-empty,
.mind-feed-locked {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 8px 4px;
}
.mind-feed-entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border-left: 2px solid #6dc1ff;
  border-radius: 3px;
  cursor: default;
}
.mind-feed-entry:hover { background: rgba(255,255,255,0.07); }
.mind-feed-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mind-feed-text {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.35;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── Dashboard event ticker ──────────────────────────────────────── */
#ticker-section h2 { margin-bottom: 8px; }
.ticker-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
}
.ticker-list li {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  padding: 5px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  border-left: 2px solid var(--muted);
  cursor: pointer;
  transition: background 0.1s;
}
.ticker-list li:hover { background: rgba(255,255,255,0.08); }
.ticker-list li.empty {
  border-left-color: transparent;
  cursor: default;
  color: var(--muted);
  font-style: italic;
}
.ticker-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.ticker-text { color: var(--fg); }
.ticker-text .agent-mention { color: #6dc1ff; font-weight: 500; }
.ticker-text .agent-mention.unclaimed { color: var(--muted); font-weight: 400; }
.ticker-text .kind-death { color: #ff8585; }
.ticker-text .kind-trade { color: #5fd06b; }
.ticker-text .kind-craft { color: #ffd166; }

/* Nickname editor on session cards */
.card-nickname {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
}
.card-nickname input {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 3px 6px;
  color: var(--fg);
  font: inherit;
}
.card-nickname input:focus { outline: 1px solid #6dc1ff; border-color: #6dc1ff; }
.card-nickname button {
  background: rgba(109,193,255,0.15);
  border: 1px solid #6dc1ff;
  border-radius: 3px;
  padding: 3px 8px;
  color: #6dc1ff;
  cursor: pointer;
}


/* ─── Dashboard: gamified Minecraft-style home (2026-07) ────────────── */

.pixel-font {
  font-family: 'Press Start 2P', ui-monospace, Menlo, monospace;
}

body.dashboard-body {
  background:
    linear-gradient(rgba(10, 13, 17, 0.93), rgba(10, 13, 17, 0.93)),
    url('/viewer/assets/textures/stone.png');
  background-size: auto, 64px 64px;
}

/* Minecraft UI primitives: beveled panel + button */
.mc-panel {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid;
  border-color: #565f68 #14181c #14181c #565f68;
  box-shadow: 0 0 0 2px #000;
  border-radius: 0;
}
.mc-btn {
  display: inline-block;
  padding: 9px 14px 8px;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: #fff;
  text-decoration: none;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  cursor: pointer;
  background: #7d8085 linear-gradient(rgba(255,255,255,0.16), rgba(0,0,0,0.18));
  border: 2px solid #000;
  border-radius: 0;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.35),
    inset -2px -2px 0 rgba(0, 0, 0, 0.4);
}
.mc-btn[hidden] { display: none; }
.mc-btn:hover { filter: brightness(1.15); }
.mc-btn:active {
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, 0.4),
    inset -2px -2px 0 rgba(255, 255, 255, 0.2);
}
.mc-btn-green {
  background: #45a049 linear-gradient(rgba(255,255,255,0.18), rgba(0,0,0,0.2));
}
.mc-btn-red {
  background: #a34040 linear-gradient(rgba(255,255,255,0.14), rgba(0,0,0,0.2));
}
.mc-chip {
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.12),
              inset -2px -2px 0 rgba(0,0,0,0.4);
  padding: 8px 14px;
  text-align: center;
}

/* ─── Hero: game title screen ─── */
.dash-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 30px;
  border: 2px solid #000;
  box-shadow: 0 0 0 2px #2a3138, 0 10px 40px rgba(0, 0, 0, 0.5);
  background: linear-gradient(#2e6fd0 0%, #4aa6ff 55%, #9fd2ff 100%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 34px 34px 44px;
}
.hero-title h1 {
  margin: 0 0 12px 0;
  font-size: 30px;
  color: #ffffff;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #1c3a66, 6px 6px 0 rgba(0, 0, 0, 0.35);
}
.hero-tagline {
  color: #eaf4ff;
  font-size: 14px;
  margin-bottom: 12px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}
.hero-statusline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 22px;
}
.hero-say {
  font-style: italic;
  font-size: 12px;
  color: #fdf6d8;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-right {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.hero-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}
.hero-stat-label {
  font-size: 8px;
  color: #cfe6ff;
  margin-top: 6px;
  text-transform: uppercase;
}
.enter-world {
  font-size: 12px;
  padding: 16px 22px 14px;
}
/* Grass ground strip along the hero's bottom edge */
.hero-ground {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 28px;
  z-index: 1;
  background: url('/viewer/assets/textures/grass_block_side.png');
  background-size: 28px 28px;
  image-rendering: pixelated;
  border-top: 2px solid rgba(0, 0, 0, 0.35);
}
/* Blocky drifting clouds */
.px-cloud {
  position: absolute;
  z-index: 1;
  width: 56px; height: 16px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 2px;
  /* A puffy three-lobe pixel cloud (the old single offset rectangle
     read as a rendering glitch in the corner, not a cloud). */
  box-shadow:
    -22px 6px 0 -4px rgba(255, 255, 255, 0.55),
    24px 5px 0 -5px rgba(255, 255, 255, 0.5),
    2px -10px 0 -3px rgba(255, 255, 255, 0.6),
    -10px -7px 0 -5px rgba(255, 255, 255, 0.5);
  animation: cloud-drift 70s linear infinite;
}
/* Negative delays start each cloud mid-sky: at t=0 they used to sit
   half-clipped at the hero's edge, reading as a rendering glitch. */
.px-cloud.cloud-a { top: 26px; left: -100px; animation-delay: -22s; }
.px-cloud.cloud-b { top: 64px; left: -220px; transform: scale(1.5); animation-duration: 95s; animation-delay: -48s; opacity: 0.8; }
.px-cloud.cloud-c { top: 14px; left: -400px; transform: scale(0.8); animation-duration: 55s; animation-delay: -30s; opacity: 0.7; }
@keyframes cloud-drift {
  from { margin-left: 0; }
  to   { margin-left: 130vw; }
}

/* ─── Section headers ─── */
#dashboard h2 {
  font-size: 11px;
  color: #dfe7ee;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 #000;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
}
#dashboard h2 .count {
  font-family: inherit;
  font-size: 9px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid #3a424a;
  padding: 3px 7px;
  color: #ffd95e;
}

/* ─── Agent cards: character cards ─── */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.agent-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: filter .15s ease;
}
.agent-card[data-status="offline"] { filter: saturate(0.55) brightness(0.85); }
.agent-card[data-status="live"] {
  border-color: #58d05e #123d14 #123d14 #58d05e;
}
.agent-card[data-state="critical"] {
  border-color: #ff6a6a #4a0f0f #4a0f0f #ff6a6a;
  animation: critical-blink 1.2s steps(2) infinite;
}
@keyframes critical-blink {
  50% { box-shadow: 0 0 0 2px #000, 0 0 18px rgba(255, 70, 70, 0.5); }
}
.agent-card.just-claimed { animation: claimed-pulse 1.3s ease 2; }
@keyframes claimed-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #000; }
  50% { box-shadow: 0 0 0 2px #000, 0 0 0 6px rgba(255, 217, 94, 0.45); }
}
.agent-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.agent-avatar {
  width: 48px;
  height: 48px;
  flex: none;
  image-rendering: pixelated;
  border: 2px solid #000;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,0.25), 2px 2px 0 rgba(0,0,0,0.4);
}
.agent-headline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.agent-name {
  font-family: 'Press Start 2P', ui-monospace, monospace;
  font-size: 11px;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-card-id { font-size: 10px; color: var(--muted); }
.agent-card-id code { font-family: ui-monospace, Menlo, monospace; color: #9fb3c4; }
.agent-badge {
  margin-left: auto;
  flex: none;
  font-size: 8px;
  padding: 4px 7px 3px;
  border: 1px solid #000;
  color: #0d1a0e;
  background: #62d068;
  box-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}
.agent-badge[data-kind="offline"] { background: #757d85; color: #14181c; }
.agent-badge[data-kind="new"] { background: #ffd95e; color: #3d2f05; }
.agent-badge[data-kind="kicked"] { background: #d9534f; color: #2b0a09; }

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}
.stat-icons { display: flex; gap: 2px; }
.stat-icon { font-size: 13px; }
.stat-icon.heart { color: #ff3b3b; text-shadow: 1px 1px 0 #5c0000; }
.stat-icon.heart.empty { color: #262c33; text-shadow: 1px 1px 0 #000; }
.stat-icon.drumstick { font-size: 12px; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.6)); }
.stat-icon.drumstick.empty { filter: grayscale(1) brightness(0.35); }
.stat-num {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  margin-left: 2px;
}
.agent-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #c4cdd6;
  min-height: 16px;
}
.agent-deaths { color: #ff9d9d; }
.agent-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.agent-card-actions .mc-btn { font-size: 8px; padding: 8px 10px 7px; }
a.btn-watch.disabled {
  pointer-events: none;
  filter: grayscale(1) brightness(0.7);
}
.btn-untrack { margin-left: auto; }

.my-agents-empty {
  padding: 18px 20px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.my-agents-empty p { margin: 0 0 8px 0; }
.my-agents-empty code {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #3a424a;
  padding: 1px 5px;
  font-size: 12px;
  color: #ffd95e;
}

/* ─── Track command bar ─── */
.track-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.track-input {
  flex: 1;
  min-width: 280px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.6), 0 0 0 2px #2a3138;
  border-radius: 0;
  padding: 12px 14px;
  color: #e8f0d8;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}
.track-input::placeholder { color: #5d6a76; }
.track-input:focus { outline: none; box-shadow: inset 2px 2px 0 rgba(0,0,0,0.6), 0 0 0 2px #ffd95e; }
.track-btn { font-size: 9px; padding: 12px 16px 11px; }
.track-error {
  color: #ff8484;
  font-size: 12px;
  text-shadow: 1px 1px 0 #000;
}

/* ─── World chronicle (chat-log style) ─── */
#ticker-section .ticker-list {
  padding: 6px 0;
}
.ticker-list li { border-bottom: 0; }
.ticker-list .ticker-time {
  font-family: ui-monospace, Menlo, monospace;
  color: #6d7a86;
}
.ticker-list .ticker-text { color: #e6edd4; }
.ticker-list .agent-mention { color: #ffd95e; font-weight: 700; }
.ticker-list .agent-mention.unclaimed { color: #9fb3c4; font-weight: 400; }

/* ─── Everyone else ─── */
.others-toggle { font-size: 8px; padding: 6px 9px 5px; }
#others-section .others-list { padding: 4px 8px; }

/* Dashboard home navigation */
.hero-home-link { color: inherit; text-decoration: none; }
.hero-home-link:hover { text-shadow: 3px 3px 0 #1c3a66, 6px 6px 0 rgba(0,0,0,0.35), 0 0 14px rgba(255,255,255,0.4); }
.hero-home-btn { font-size: 8px; padding: 7px 10px 6px; }

/* Click-to-copy agent id on cards */
.agent-card-id .id-copy { cursor: pointer; }
.agent-card-id .id-copy:hover { color: #ffd95e; }

/* Sidebar: gamified headers + instinct/actor styling in history */
#sidebar h2 {
  font-family: 'Press Start 2P', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: #dfe7ee;
  text-shadow: 1px 1px 0 #000;
}
#action-history .actor {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  margin-right: 6px;
  opacity: 0.9;
}
#action-history li.instinct { opacity: 0.55; }
#action-history li.instinct .tool { font-style: italic; }

/* No sideways scrolling anywhere in the sidebar: long coordinates and
   ids wrap instead of pushing a horizontal scrollbar. */
#sidebar { overflow-x: hidden; }
#action-history { overflow-x: hidden; }
#action-history .body,
#action-history .meta,
#action-history .params { overflow-wrap: anywhere; }
#conversation-log, #mind-feed { overflow-x: hidden; overflow-wrap: anywhere; }

/* Slim, dark scrollbars to match the theme (instead of chunky white). */
#sidebar, #action-history, #conversation-log, #mind-feed, .inv-modal-list,
#others-list, .ticker-list {
  scrollbar-width: thin;
  scrollbar-color: #39424c transparent;
}
#action-history::-webkit-scrollbar,
#sidebar::-webkit-scrollbar,
#conversation-log::-webkit-scrollbar,
#mind-feed::-webkit-scrollbar { width: 6px; height: 0; }
#action-history::-webkit-scrollbar-thumb,
#sidebar::-webkit-scrollbar-thumb,
#conversation-log::-webkit-scrollbar-thumb,
#mind-feed::-webkit-scrollbar-thumb {
  background: #39424c;
  border-radius: 3px;
}
#action-history::-webkit-scrollbar-track,
#sidebar::-webkit-scrollbar-track { background: transparent; }

/* Owner alert toasts (death, critical HP/hunger) */
#toast-host {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  overflow-wrap: anywhere;
  background: rgba(10, 13, 17, 0.92);
  border: 2px solid #000;
  box-shadow: 0 0 0 2px #565f68, 0 6px 18px rgba(0,0,0,0.5);
  color: #fff;
  font-family: 'Press Start 2P', ui-monospace, monospace;
  font-size: 9px;
  line-height: 1.7;
  padding: 10px 16px;
  max-width: 560px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-death { box-shadow: 0 0 0 2px #a33; color: #ffb3b3; }
.toast-warn { box-shadow: 0 0 0 2px #b8912f; color: #ffd95e; }

/* ─── SIWE wallet section (dashboard) ─────────────────────────────── */
.wallet-panel { padding: 16px 18px; font-size: 14px; line-height: 1.5; }
.wallet-panel p { margin: 0 0 10px; }
.wallet-panel code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  word-break: break-all;
}
.wallet-panel code.copied { background: #2e6b2e; }
.wallet-panel .join-prompt {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.55;
}

/* Run modes: how the agent's mind gets its presence (cloud schedule,
   MCP, terminal). Accordions inside the wallet panel. */
.run-mode {
  margin: 10px 0;
  border: 1px solid #2a3138;
  border-radius: 6px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
}
.run-mode summary {
  cursor: pointer;
  font-weight: 600;
  color: #dfe7ee;
}
.run-mode summary:hover { color: #ffd95e; }
.run-mode[open] summary { margin-bottom: 10px; }
.run-mode-badge {
  font-size: 8px;
  color: #0d2b10;
  background: #6ce066;
  border: 1px solid #123d14;
  padding: 3px 6px 2px;
  margin-left: 8px;
  vertical-align: 2px;
}
.run-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cadence-select {
  background: #1c2126;
  color: #dfe7ee;
  border: 1px solid #2a3138;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
}
.run-steps {
  margin: 0 0 10px;
  padding-left: 22px;
  line-height: 1.6;
}
.run-steps > li { margin-bottom: 8px; }
.run-steps b { color: #ffd95e; }
.run-steps .run-mode-row { display: flex; }

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — mobile & tablet
   Defaults below hide touch-only affordances; the media queries turn on
   the phone/tablet layout. Desktop is unaffected.
   ═══════════════════════════════════════════════════════════════════════ */

.touch-only { display: none; }
.sidebar-toggle,
.sidebar-close { display: none; }

/* Show the gesture cheatsheet rows on any touch (coarse-pointer) device,
   regardless of width — a touch laptop or big tablet still needs them. */
@media (pointer: coarse) {
  .help-row.touch-only { display: flex; }
}

/* Never let a long code string or wide table blow out the page width. */
code, pre { max-width: 100%; overflow-wrap: anywhere; }

/* ─── Viewer (view mode): tablet & phone ─────────────────────────────── */
@media (max-width: 860px) {
  /* Canvas goes full-bleed; the sidebar becomes a bottom drawer. */
  #layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  #canvas-container { grid-column: 1; grid-row: 1; }
  #footer { grid-column: 1; grid-row: 2; }

  #sidebar {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    height: min(72vh, 560px);
    border-left: 0;
    border-top: 2px solid var(--panel-edge);
    border-radius: 16px 16px 0 0;
    transform: translateY(105%);
    transition: transform 0.28s ease;
    z-index: 25;
    box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.6);
    padding-top: 40px;                 /* room for the close button */
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  #layout.sidebar-open #sidebar { transform: translateY(0); }

  .sidebar-close {
    display: block;
    position: absolute;
    top: 8px; right: 12px;
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    z-index: 2;
  }
  .sidebar-close:hover { color: var(--text); }

  /* Floating "🧠 Mind" opener, above the footer. */
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    right: 12px;
    bottom: calc(44px + env(safe-area-inset-bottom, 0px));
    z-index: 24;
    padding: 10px 16px;
    border-radius: 22px;
    border: 1px solid var(--panel-edge);
    background: rgba(28, 33, 38, 0.95);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
  #layout.sidebar-open .sidebar-toggle { display: none; }

  /* Top-bar: one scrollable row instead of overflowing the screen.
     Leaves room at the right for the ⛶ ⚙ ? buttons. A right-edge fade
     hints there's more to scroll to instead of a hard, button-cutting
     clip — without it, a mid-label cut (e.g. "★ Fin…") reads as broken. */
  #viewer-topbar {
    top: 10px; left: 10px;
    max-width: calc(100vw - 130px);
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
  }
  #viewer-topbar::-webkit-scrollbar { display: none; }
  #viewer-topbar a, #viewer-topbar .pill {
    flex: none;
    white-space: nowrap;
    padding: 6px 9px;
    font-size: 11px;
  }
  .follow-select { max-width: 110px; }

  /* Footer: compact, wraps instead of overflowing. */
  #footer {
    gap: 10px 14px;
    padding: 6px 12px;
    font-size: 10px;
    min-height: 30px;
    flex-wrap: wrap;
    line-height: 1.5;
  }
}

/* ─── Dashboard / content pages: tablet & phone ──────────────────────── */
@media (max-width: 720px) {
  body.dashboard-body { padding: 14px; }

  #dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .header-actions { flex-wrap: wrap; }

  /* Hero: tighter, and the two halves stack cleanly. */
  .hero-inner { padding: 22px 18px 34px; gap: 16px; }
  .hero-title h1 { font-size: 23px; }
  .hero-right { width: 100%; justify-content: space-between; }
  .hero-say { max-width: 100%; }
  .hero-statusline { flex-wrap: wrap; }

  /* Single-column agent/card grids so nothing overflows a narrow screen. */
  .agent-grid,
  .card-grid { grid-template-columns: 1fr; }

  /* Run-mode accordions: keep the cadence row from overflowing. */
  .run-mode-row { flex-wrap: wrap; }
  .cadence-select { max-width: 100%; }

  /* Long ids (agent id, wallet address) get their own line instead of
     word-break: break-all splitting them mid-character right after
     inline label text like "Your agent: ". */
  #wallet-agent-id,
  #wallet-chip {
    display: block;
    margin: 6px 0;
    width: fit-content;
    max-width: 100%;
  }
}

/* ─── Landing page: phone ────────────────────────────────────────────── */
@media (max-width: 560px) {
  .landing-hero { padding: 40px 16px 64px; }
  main.landing { padding: 0 14px 48px; }
  .join-box { padding: 18px 16px; }
  .landing-cta .mc-btn { font-size: 10px; padding: 13px 16px 11px; }

  /* Give the hero stat chips breathing room when they wrap. */
  .landing-stats { gap: 10px; }

  /* Section headings use the chunky pixel font at the browser's default
     24px h2 size — fine for short titles, but a longer one like "Send
     your agent — 3 steps" wraps into a jagged 3-line stack on a narrow
     phone. Scale it down so it reads as one tidy line or two. */
  main.landing h2.pixel-font { font-size: 16px; line-height: 1.5; }
}

/* ─── My agent's life (dashboard panels) ─────────────────────────────── */
.life-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.life-panel {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}
.life-panel h3 {
  font-size: 11px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.6;
}
.life-panel h3 .muted { font-size: 9px; }
.life-panel-wide { grid-column: 1 / -1; }
.life-panel .empty-state { margin: 0; font-size: 13px; }

.inv-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.inv-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 13px;
}
.inv-qty { color: #ffd86a; font-weight: 700; }

#map-canvas {
  width: 100%;
  max-width: 240px;
  image-rendering: pixelated;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  align-self: center;
  background: #10141c;
}

.learned-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}
.learned-list li {
  display: flex;
  gap: 10px;
  font-size: 14.5px;
  line-height: 1.55;
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
}
.learned-time {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  padding-top: 2px;
  min-width: 60px;
}
.learned-text { overflow-wrap: anywhere; }

.friends-notify {
  margin-left: auto;
  font-size: 8px;
  padding: 6px 8px 5px;
  opacity: 0.75;
}
.friends-notify.on { opacity: 1; border-color: #58d05e; }
.friends-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.friend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  flex: 0 0 auto;
}
.friend-dot.online {
  background: #58d05e;
  box-shadow: 0 0 6px rgba(88, 208, 94, 0.8);
}
.friend-name { color: inherit; font-weight: 600; }
.friend-meta { color: rgba(255, 255, 255, 0.5); font-size: 12px; }
.friend-watch {
  margin-left: auto;
  color: #7ec4ff;
  font-size: 12px;
}

.dms-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 260px;
  overflow-y: auto;
}
.dm-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  padding: 6px 9px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
}
.dm-row.dm-received { background: rgba(94, 156, 255, 0.10); }
.dm-who { flex: 0 0 auto; font-weight: 600; }
.dm-text { overflow-wrap: anywhere; }
.dm-time {
  margin-left: auto;
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
}

.bank-gold {
  font-size: 15px;
  font-weight: 600;
  color: #ffd86a;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 320px;
  overflow-y: auto;
}
.activity-list li {
  display: flex;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
}
.activity-time {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11.5px;
  padding-top: 2px;
  min-width: 60px;
}
.activity-text { overflow-wrap: anywhere; }
.activity-more {
  margin-top: 10px;
  align-self: center;
  font-size: 10px;
}


/* ─── Minimap: the followed agent's discovered world ────────────────── */
#minimap {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: 176px;
  height: 176px;
  z-index: 12;
  pointer-events: none;
  image-rendering: pixelated;
  background: rgba(10, 13, 17, 0.78);
  border: 2px solid #000;
  box-shadow: 0 0 0 2px #565f68, 0 6px 18px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
}
@media (max-width: 860px) {
  #minimap { width: 128px; height: 128px; left: 10px; bottom: 10px; }
}


/* ─── Underground veil: camera is inside solid earth ────────────────── */
#underground-veil {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background:
    radial-gradient(ellipse at 50% 55%,
      rgba(62, 44, 28, 0.55) 0%,
      rgba(48, 33, 20, 0.82) 55%,
      rgba(34, 23, 14, 0.94) 100%);
}
#underground-veil.active { opacity: 1; }


/* ─── Landing: live world hero shot ─────────────────────────────────── */
.hero-world-shot {
  position: relative;
  display: block;
  max-width: 720px;
  margin: 22px auto 6px;
  border: 3px solid #0e1116;
  box-shadow: 0 0 0 3px #565f68, 0 14px 40px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  overflow: hidden;
  z-index: 2;
}
.hero-world-shot img {
  display: block;
  width: 100%;
  height: auto;
}
.hero-world-shot .hero-world-play {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(10, 13, 17, 0.88);
  color: #7bf085;
  font-size: 10px;
  padding: 10px 16px 8px;
  border: 2px solid #000;
  box-shadow: 0 0 0 2px #58d05e;
  white-space: nowrap;
  transition: transform 0.15s ease;
}
.hero-world-shot:hover .hero-world-play {
  transform: translateX(-50%) scale(1.06);
}

/* ─── Landing: the three run-ways as cards ──────────────────────────── */
.run-way-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.run-way {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 12px 14px;
}
.run-way-head {
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.run-way-badge {
  font-size: 7px;
  background: #123d14;
  color: #7bf085;
  border: 1px solid #58d05e;
  padding: 4px 6px 3px;
  border-radius: 3px;
}
.run-way p { margin: 0; font-size: 13.5px; line-height: 1.55; color: #c7d0d9; }
@media (max-width: 860px) {
  .run-way-grid { grid-template-columns: 1fr; }
}

/* ─── Mobile: stats stay 3-across; dashboard header wraps ───────────── */
@media (max-width: 560px) {
  .landing-stats { flex-wrap: nowrap; gap: 8px; }
  .landing-stats .hero-stat { flex: 1 1 0; min-width: 0; padding: 10px 6px; }
  .landing-stats .hero-stat-num { font-size: 20px; }
  .landing-stats .hero-stat-label { font-size: 6.5px; }
  .hero-world-shot { margin-top: 16px; }
  .hero-world-shot .hero-world-play { font-size: 8px; padding: 8px 10px 6px; }
}
@media (max-width: 860px) {
  /* The dashboard hero clipped its tagline, nav row and live-say line
     off the right edge on phones — wrap and ellipsize instead. */
  .dash-hero .hero-tagline { white-space: normal; }
  .dash-hero .hero-statusline { flex-wrap: wrap; row-gap: 8px; }
  .dash-hero .hero-say {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
