/* ── Page ── */
.live-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-12);
  width: 100%;
}

/* ── Notice ── */
.live-notice {
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--warn-100); border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5); font-size: var(--text-sm); color: var(--warn-400); line-height: var(--lh-snug);
}
.live-notice i { flex-shrink: 0; margin-top: 1px; }

/* ── Notifications CTA ── */
.live-notif-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin-bottom: var(--space-5);
  background: var(--brand-teal-10);
  border: 1px solid var(--border-teal);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--brand-teal);
}
.live-notif-cta svg { color: var(--brand-teal); flex-shrink: 0; }
.live-notif-cta-body { flex: 1; }
.live-notif-cta-btn {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand-teal);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.live-notif-cta-btn:hover { text-decoration: underline; }

/* ── Header ── */
.live-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap;
}
.live-title    { font-size: var(--text-2xl); font-weight: 700; letter-spacing: var(--tracking-tight); color: var(--fg-1); }
.live-subtitle { font-size: var(--text-sm); color: var(--fg-3); margin-top: var(--space-1); }

.live-stats { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.live-stat  {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--bg-1); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 6px var(--space-3);
}
.live-stat-label { font-size: var(--text-xs); color: var(--fg-4); text-transform: uppercase; letter-spacing: var(--tracking-caps); font-weight: 500; }
.live-stat-value { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 600; color: var(--fg-1); }
.live-status-dot  { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-4); flex-shrink: 0; }
.live-status-dot.connected    { background: var(--up-500); box-shadow: 0 0 6px rgba(34,197,94,.5); animation: live-pulse 2s ease-in-out infinite; }
.live-status-dot.reconnecting { background: var(--warn-500); }
@keyframes live-pulse { 0%,100%{opacity:1} 50%{opacity:.45} }
.live-status-text { font-size: var(--text-xs); color: var(--fg-3); font-family: var(--font-mono); }

/* ── Filters — mirrors /items exactly ── */
.live-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.live-search-wrap { position: relative; display: inline-flex; align-items: center; }
.live-search-wrap svg { position: absolute; left: 10px; color: var(--fg-4); pointer-events: none; width: 13px; height: 13px; flex-shrink: 0; }
.live-search-input {
  background: var(--bg-1); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full); color: var(--fg-1); font-family: var(--font-sans);
  font-size: 12px; padding: 4px 14px 4px 30px; outline: none; width: 200px;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.live-search-input:focus { border-color: var(--brand-teal); box-shadow: 0 0 0 2px var(--brand-teal-10); color: var(--fg-1); }
.live-search-input::placeholder { color: var(--fg-4); }

/* ── Empty state ── */
.live-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-3); padding: 80px var(--space-4); color: var(--fg-4); font-size: var(--text-sm);
}
.live-empty-state i { opacity: .35; }

/* ── Card grid ── */
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}
.live-no-results {
  display: none; grid-column: 1 / -1;
  padding: var(--space-8) var(--space-4); text-align: center;
  font-size: var(--text-sm); color: var(--fg-4);
}

/* ── Card ── */
.live-card {
  background: var(--bg-1); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column;
  transition: border-color var(--dur-base) var(--ease-out);
}
.live-card.hidden { display: none; }
.live-card.flash  { animation: card-flash 700ms var(--ease-out) forwards; }
@keyframes card-flash {
  0%  { border-color: var(--brand-teal); box-shadow: 0 0 0 1px var(--brand-teal-20); }
  100%{ border-color: var(--border-subtle); box-shadow: none; }
}

.live-card-inner {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); flex: 1;
}
.live-card-thumb {
  width: 48px; height: 48px; flex-shrink: 0;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.live-card-thumb img { width: 48px; height: 48px; object-fit: contain; }

.live-card-body { min-width: 0; flex: 1; }
.live-card-name {
  font-size: var(--text-sm); font-weight: 600; color: var(--fg-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.live-card-name a { color: inherit; }
.live-card-name a:hover { color: var(--brand-teal); text-decoration: none; }
.live-card-last {
  font-size: 10px; color: var(--fg-3); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px;
}
.live-last-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 8px; font-weight: 700;
  text-transform: uppercase; padding: 1px 4px; border-radius: var(--radius-xs); flex-shrink: 0;
}
.live-last-badge-rap    { background: var(--brand-teal-10); color: var(--brand-teal); }
.live-last-badge-exists { background: var(--info-100);       color: var(--info-500); }
.live-last-badge-new    { background: rgba(168,85,247,.10);  color: #a855f7; }
.live-last-delta { font-family: var(--font-mono); font-size: 10px; font-weight: 700; }
.live-last-delta-up   { color: var(--up-500); }
.live-last-delta-down { color: var(--down-500); }

.live-card-btn {
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: 2px; flex-shrink: 0; padding: 0 var(--space-3);
  border-left: 1px solid var(--border-subtle); min-width: 64px; align-self: stretch; cursor: pointer;
  background: none; border-top: none; border-right: none; border-bottom: none;
  transition: background var(--dur-fast) var(--ease-out);
}
.live-card-btn:hover { background: var(--bg-2); }

/* ── Exists rate ── */
.live-card-rate { font-size: 10px; margin-top: 3px; font-family: var(--font-mono); min-height: 13px; }
.live-card-rate-up   { color: var(--up-500); font-weight: 700; }
.live-card-rate-down { color: var(--down-500); font-weight: 700; }
.live-modal-rate { font-size: var(--text-xs); color: var(--fg-3); margin-top: 3px; font-family: var(--font-mono); }
.live-modal-rate-up   { color: var(--up-500); font-weight: 700; }
.live-modal-rate-down { color: var(--down-500); font-weight: 700; }
.live-card-btn-count { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 700; color: var(--fg-1); }
.live-card-btn-label { font-size: 10px; color: var(--fg-4); }

/* ── Modal ── */
.live-modal-overlay {
  position: fixed; inset: 0; background: rgba(7,13,25,.72);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: var(--space-4);
  opacity: 0; pointer-events: none;
  transition: opacity 180ms var(--ease-out);
}
.live-modal-overlay.open { opacity: 1; pointer-events: all; }

.live-modal {
  background: var(--bg-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-xl); display: flex; flex-direction: column;
  max-height: 85vh; overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 180ms var(--ease-out);
}
.live-modal-overlay.open .live-modal { transform: translateY(0) scale(1); }

.live-modal-header {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.live-modal-thumb {
  width: 56px; height: 56px; flex-shrink: 0;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.live-modal-thumb img { width: 56px; height: 56px; object-fit: contain; }
.live-modal-meta { min-width: 0; flex: 1; }
.live-modal-name { font-size: var(--text-lg); font-weight: 700; color: var(--fg-1); line-height: 1.2; }
.live-modal-name a { color: inherit; }
.live-modal-name a:hover { color: var(--brand-teal); text-decoration: none; }
.live-modal-count {
  display: inline-flex; align-items: center; gap: 4px; margin-top: var(--space-1);
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-3);
}
.live-modal-count-num { font-weight: 700; color: var(--fg-1); }
.live-modal-close {
  background: none; border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); width: 28px; height: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--fg-3);
  flex-shrink: 0; align-self: flex-start; margin-left: auto;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.live-modal-close:hover { color: var(--fg-1); border-color: var(--border-strong); background: var(--bg-2); }

.live-modal-filters {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0; flex-wrap: wrap;
}

.live-modal-log { overflow-y: auto; flex: 1; min-height: 280px; }
.live-modal-log::-webkit-scrollbar { width: 5px; }
.live-modal-log::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

.live-modal-empty {
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-8); color: var(--fg-4); font-size: var(--text-sm);
}

/* ── Log rows (used in modal) ── */
.live-log-row {
  display: grid;
  grid-template-columns: 56px 52px 1fr;
  align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.live-log-row:last-child { border-bottom: none; }
.live-log-row.hidden { display: none; }

.live-log-ts    { font-family: var(--font-mono); font-size: 10px; color: var(--fg-5); }
.live-log-badge {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 0; border-radius: var(--radius-xs); text-align: center;
}
.live-log-badge-rap    { background: var(--brand-teal-10); color: var(--brand-teal); }
.live-log-badge-exists { background: var(--info-100);       color: var(--info-500); }
.live-log-badge-new    { background: rgba(168,85,247,.10);  color: #a855f7; }

.live-log-vals { display: flex; align-items: center; gap: 5px; min-width: 0; }
.live-log-old  { font-family: var(--font-mono); font-size: 11px; color: var(--fg-4); }
.live-log-arr  { font-size: 10px; color: var(--fg-5); }
.live-log-new  { font-family: var(--font-mono); font-size: 11px; color: var(--fg-1); font-weight: 600; }
.live-log-delta {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: var(--radius-xs); margin-left: auto; flex-shrink: 0;
}
.live-log-delta-up   { color: var(--up-500);   background: var(--up-100); }
.live-log-delta-down { color: var(--down-500); background: var(--down-100); }

/* ── Number tooltip ── */
.num-tip { cursor: default; }
.num-tooltip {
  position: fixed;
  background: var(--bg-4); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); padding: 3px 8px;
  font-size: 11px; font-family: var(--font-mono); color: var(--fg-1);
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 150ms;
  z-index: 20000; box-shadow: var(--shadow-md);
  max-width: min(220px, calc(100vw - 16px));
  word-break: break-all; white-space: normal; text-align: center;
}
.num-tooltip.show { opacity: 1; }

/* ── Toast ── */
.live-toast {
  position: fixed; bottom: var(--space-5); right: var(--space-5);
  background: var(--bg-4); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; gap: var(--space-2);
  box-shadow: var(--shadow-lg); z-index: 9999;
  font-size: var(--text-sm); color: var(--fg-1); pointer-events: none;
  opacity: 0; transform: translateY(8px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.live-toast.show { opacity: 1; transform: translateY(0); }
.live-toast-dot   { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-teal); flex-shrink: 0; }
.live-toast-count { font-family: var(--font-mono); font-weight: 700; color: var(--brand-teal); }

/* ── Mobile ── */
@media (max-width: 600px) {
  .live-grid  { grid-template-columns: 1fr; }
  .live-toast { bottom: var(--space-4); right: var(--space-3); left: var(--space-3); justify-content: center; }
  .live-modal { max-height: 90vh; }
}
@media (max-width: 860px) {
  .live-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
