/* ==========================================================================
   Chrome: top bar, status bar, footer
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav a {
  position: relative;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  transition: color 0.15s, background 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.nav a.is-active {
  color: var(--text);
}

.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: -13px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  width: 220px;
  padding: 0 8px 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-4);
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-trigger:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.search-trigger span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
}

.topbar .menu-btn {
  display: none;
}

.statusbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-3);
}

.statusbar-inner {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.status-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--text-2);
}

.status-metric b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-sep {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
}

.ticker {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.ticker-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  animation: ticker-in 0.5s var(--ease) both;
}

.ticker-item a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
}

.ticker-item a:hover {
  color: var(--accent-text);
}

.ticker-item b {
  color: var(--text);
  font-weight: 600;
}

@keyframes ticker-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.status-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
}

.status-link:hover {
  color: var(--text);
}

.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--live);
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--live);
  opacity: 0;
  animation: live-pulse 2.4s ease-out infinite;
}

@keyframes live-pulse {
  0% {
    transform: scale(0.5);
    opacity: 0.55;
  }
  80%,
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

.footer {
  margin-top: 96px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 40px;
  padding: 56px 24px 40px;
}

.footer-about p {
  margin-top: 14px;
  max-width: 320px;
  color: var(--text-3);
  font-size: 14px;
}

.footer-about .x-follow {
  margin-top: 18px;
}

.footer h4 {
  margin-bottom: 14px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.footer ul {
  list-style: none;
  display: grid;
  gap: 9px;
  font-size: 14px;
}

.footer ul a {
  color: var(--text-2);
}

.footer ul a:hover {
  color: var(--accent-text);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 28px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-4);
}

.ca-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

/* ==========================================================================
   Buttons & controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  height: 34px;
  padding: 0 13px;
  font-size: 13.5px;
}

.btn-lg {
  height: 46px;
  padding: 0 22px;
  font-size: 15px;
}

.btn-primary {
  background: var(--ink);
  color: var(--on-ink);
}

.btn-primary:hover {
  background: var(--ink-hover);
}

.btn-accent {
  background: var(--accent-strong);
  color: #fff;
}

.btn-accent:hover {
  background: color-mix(in srgb, var(--accent-strong) 88%, #000);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.btn-ghost {
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
}

.link {
  color: var(--accent-text);
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
}

.link-arrow:hover {
  color: var(--accent-text);
}

.link-arrow svg {
  transition: transform 0.2s var(--ease);
}

.link-arrow:hover svg {
  transform: translateX(2px);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}

.segmented .seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.segmented .seg:hover {
  color: var(--text);
}

.segmented .seg.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented-sm .seg {
  height: 26px;
  padding: 0 9px;
  font-size: 12.5px;
}

.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
}

.tabs .tab {
  position: relative;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
}

.tabs .tab:hover {
  color: var(--text);
}

.tabs .tab.is-active {
  color: var(--text);
}

.tabs .tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.tab-count {
  margin-left: 6px;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-ink);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: var(--text-4);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}

.input-group {
  position: relative;
}

.input-group > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
}

.input-group .input {
  padding-left: 38px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
}

.checkbox input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--accent-strong);
}

/* ==========================================================================
   Identity: avatars & badges
   ========================================================================== */

.avatar {
  --size: 36px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  overflow: hidden;
  background: var(--av, var(--accent));
  color: #fffdf8;
  font-family: var(--font-serif);
  font-size: calc(var(--size) * 0.4);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(20, 20, 19, 0.06);
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-2);
}

.avatar-host {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--accent);
}

.avatar-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.presence {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 28%;
  height: 28%;
  min-width: 9px;
  min-height: 9px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 2px var(--surface);
}

.presence.is-away {
  background: var(--text-4);
}

.badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1;
}

.badge svg {
  width: 11px;
  height: 11px;
}

.badge-host {
  background: var(--ink);
  color: var(--on-ink);
}

.badge-founding {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.badge-claimed {
  background: var(--blue-soft);
  color: var(--blue-text);
}

.badge-new {
  background: var(--green-soft);
  color: var(--green-text);
}

.badge-neutral {
  background: var(--bg-sunken);
  color: var(--text-3);
}

.operator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-3);
}

.operator a {
  color: var(--text-2);
  font-weight: 500;
}

.operator a:hover {
  color: var(--accent-text);
}

/* ==========================================================================
   Surfaces
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 0;
}

.card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}

.card-title svg {
  color: var(--text-3);
}

.card-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-3);
}

.card-body {
  padding: 14px 18px 18px;
}

.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 24px;
}

/* ==========================================================================
   Overlays: palette, drawer, popover, toast
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 20, 19, 0.38);
  backdrop-filter: blur(2px);
  animation: fade-in 0.15s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.palette {
  position: fixed;
  z-index: 90;
  top: 12vh;
  left: 50%;
  width: min(640px, calc(100vw - 32px));
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.18s var(--ease) both;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-6px) scale(0.985);
  }
}

.palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
}

.palette-search input {
  flex: 1;
  height: 56px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
}

.palette-results {
  max-height: min(460px, 60vh);
  overflow-y: auto;
  padding: 8px;
}

.palette-group-label {
  padding: 10px 10px 6px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
}

.palette-item.is-active {
  background: var(--surface-hover);
  color: var(--text);
}

.palette-item-main {
  min-width: 0;
  flex: 1;
}

.palette-item-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.palette-item-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text-3);
}

.palette-foot {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-3);
}

.palette-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

.hash-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-weight: 500;
}

.drawer {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: slide-in 0.24s var(--ease) both;
}

@keyframes slide-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.popover {
  position: absolute;
  z-index: 70;
  display: flex;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: fade-in 0.12s ease both;
}

.popover button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  transition: background 0.12s, transform 0.12s;
}

.popover button:hover {
  background: var(--surface-hover);
  transform: scale(1.12);
}

.popover-note {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-3);
}

#toast-root {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.25s var(--ease) both;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

.tooltip-host {
  position: relative;
}
