* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #1a1a2e;
  --bg-panel: #16213e;
  --bg-card: #0f3460;
  --text: #e0e0e0;
  --text-dim: #8899aa;
  --accent: #5865f2;
  --green: #57f287;
  --gold: #fee75c;
  --red: #ed4245;
  --purple: #9b59b6;
  --magenta: #e91e63;
  --orange: #e67e22;
  --border: #2a2a4a;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-left h1 { font-size: 20px; font-weight: 700; }

.badge {
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.header-stats { display: flex; gap: 24px; }
.stat { text-align: center; }
.stat span { display: block; font-size: 22px; font-weight: 700; color: var(--accent); }
.stat small { color: var(--text-dim); font-size: 11px; text-transform: uppercase; }

main { padding: 16px 24px; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel h2 { font-size: 14px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; letter-spacing: 1px; }

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-header h2 { margin-bottom: 0; }

/* Nodes */
.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }

.node-card {
  background: var(--bg-card);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.node-card .node-header { display: flex; justify-content: space-between; align-items: center; }
.node-card .node-name { font-weight: 600; font-size: 14px; }
.node-card .node-tag { color: var(--text-dim); font-size: 12px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.warning { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.dot.offline { background: var(--red); }

.node-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-dim); }
.node-health { display: flex; gap: 10px; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.node-reconnecting { font-size: 11px; color: var(--gold); font-weight: 600; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.node-btn { background: var(--border); border: none; color: var(--text); padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 11px; }
.node-btn:hover { background: var(--accent); }

/* Feed controls */
.feed-controls { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.search-box {
  position: relative;
  width: 320px;
}
.search-box input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  padding-right: 50px;
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--text-dim); }
.search-count {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-dim);
}

.feed-item.search-hidden { display: none; }
.feed-item .search-highlight { background: var(--gold); color: #000; border-radius: 2px; padding: 0 2px; }

/* Filters */
.filters { display: flex; gap: 4px; }
.filter {
  background: var(--border);
  border: none;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.filter.active { background: var(--accent); color: #fff; }

/* Feed */
.feed {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feed.small { max-height: 200px; }

/* Feed Status Bar */
.feed-status {
  display: flex;
  justify-content: center;
  padding: 8px;
  margin-top: 8px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-dim);
}
.feed-status a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}
.feed-status a:hover { text-decoration: underline; }

.feed-item {
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }

.feed-item .time { color: var(--text-dim); font-size: 11px; flex-shrink: 0; }
.feed-item .type-badge {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}
.type-badge.username_change { background: var(--green); color: #000; }
.type-badge.vanity_change { background: var(--gold); color: #000; }
.type-badge.nitro_link { background: var(--purple); color: #fff; }
.type-badge.keyword_match { background: var(--orange); color: #fff; }
.type-badge.guild_deleted { background: var(--red); color: #fff; }
.type-badge.member_join { background: #2ecc71; color: #000; }
.type-badge.member_leave { background: #95a5a6; color: #000; }

/* Alert panel */
.alert-panel { border-color: var(--gold); }

.alert-item {
  padding: 10px 14px;
  background: rgba(254, 231, 92, 0.1);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  margin-bottom: 6px;
  animation: flash 0.5s ease;
  font-size: 14px;
}

@keyframes flash {
  0%, 50% { background: rgba(254, 231, 92, 0.3); }
  100% { background: rgba(254, 231, 92, 0.1); }
}

.alert-item .alert-title { font-weight: 700; color: var(--gold); }
.alert-item .alert-detail { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.claim-btn {
  margin-top: 8px;
  padding: 6px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}
.claim-btn:hover { background: #4752c4; transform: scale(1.02); }
.claim-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.claim-btn.claiming { background: var(--orange); animation: pulse 1s infinite; }
.claim-btn.claimed { background: var(--green); color: #000; cursor: default; }
.claim-btn.claim-failed { background: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Columns */
.columns { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

.side-panels { display: flex; flex-direction: column; gap: 16px; }
.side-panels .panel { margin-bottom: 0; }

/* Watchlist */
.watchlist-form {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.watchlist-form select,
.watchlist-form input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
}

.watchlist-form input[type="text"] { flex: 1; min-width: 100px; }
.watchlist-form label { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; }
.watchlist-form button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.wl-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 13px;
}

.wl-item .wl-value { font-weight: 600; }
.wl-item .wl-type { color: var(--text-dim); font-size: 11px; }
.wl-item .wl-remove {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 14px;
}

/* Pending Claims */
.pending-panel { border-color: var(--purple); }
.pending-panel h2 { display: flex; align-items: center; gap: 8px; }
.pending-count {
  background: var(--purple);
  color: #fff;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.quick-claim {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.quick-claim input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}
.quick-claim input:focus { border-color: var(--accent); }
.quick-claim input::placeholder { color: var(--text-dim); }
.quick-claim button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.quick-claim button:hover { opacity: 0.9; }
.quick-claim-status { font-size: 13px; color: var(--text-dim); min-height: 20px; }
.quick-claim-status.success { color: var(--green); }
.quick-claim-status.error { color: var(--red); }
.quick-claim-status a { color: var(--purple); text-decoration: underline; cursor: pointer; }

.pending-add {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.pending-add input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  outline: none;
}
.pending-add input:focus { border-color: var(--purple); }
.pending-add input::placeholder { color: var(--text-dim); }
.pending-add button {
  background: var(--purple);
  border: none;
  color: #fff;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.pending-add button:hover { opacity: 0.9; }

.pending-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border-left: 3px solid var(--purple);
  border-radius: 4px;
  margin-bottom: 6px;
  animation: fadeIn 0.3s ease;
}
.pending-item.claimed { border-left-color: var(--green); }
.pending-item.expired { border-left-color: var(--text-dim); opacity: 0.5; }

.pending-info { flex: 1; }
.pending-username { font-weight: 700; font-size: 15px; color: var(--text); }
.pending-meta { font-size: 11px; color: var(--text-dim); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.pending-meta .source-badge {
  text-transform: uppercase;
  font-weight: 600;
  font-size: 10px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--border);
}
.status-badge {
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
}
.status-badge.pending { background: var(--orange); color: #fff; }
.status-badge.claimed { background: var(--green); color: #000; }
.status-badge.expired { background: var(--text-dim); color: #000; }

.pending-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.pending-cancel {
  background: none;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}
.pending-cancel:hover { background: var(--red); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Latency color classes */
.latency-good { color: var(--green); }
.latency-warn { color: var(--gold); }
.latency-bad { color: var(--red); }

/* Rarity score badges */
.rarity-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}
.rarity-legendary { background: linear-gradient(135deg, #ff6b6b, #ffd93d); color: #000; }
.rarity-rare { background: var(--purple); color: #fff; }
.rarity-uncommon { background: var(--accent); color: #fff; }
.rarity-common { background: var(--border); color: var(--text); }
.rarity-basic { background: var(--bg); color: var(--text-dim); border: 1px solid var(--border); }

/* Mobile nav (hidden on desktop) */
.mobile-nav {
  display: none;
  overflow-x: auto;
  white-space: nowrap;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  gap: 6px;
}
.mobile-nav .nav-btn {
  background: var(--border);
  border: none;
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-block;
}
.mobile-nav .nav-btn.active { background: var(--accent); color: #fff; }

/* Responsive — Tablet */
@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  header { flex-direction: column; gap: 12px; }
  .header-stats { gap: 16px; }
  .search-box { width: 100%; }
  .feed-controls { align-items: stretch; }
}

/* Responsive — Mobile */
@media (max-width: 600px) {
  .mobile-nav { display: flex; }

  header { flex-direction: column; gap: 8px; padding: 12px 16px; }
  .header-left h1 { font-size: 16px; }
  .header-stats { gap: 12px; }
  .stat span { font-size: 18px; }

  main { padding: 8px 12px; }
  .panel { padding: 12px; margin-bottom: 10px; }

  .node-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .node-card { padding: 10px; }
  .node-btn { padding: 8px 14px; font-size: 12px; }

  .columns { grid-template-columns: 1fr; gap: 10px; }

  .feed { max-height: 400px; }
  .feed.small { max-height: 200px; }
  .feed-item { padding: 8px 10px; font-size: 12px; gap: 6px; }
  .feed-item .time { font-size: 10px; }

  .filters { overflow-x: auto; white-space: nowrap; padding-bottom: 4px; }
  .filter { padding: 6px 12px; font-size: 12px; }

  .search-box { width: 100%; }
  .search-box input { font-size: 14px; padding: 8px 12px; }

  .watchlist-form { flex-direction: column; }
  .watchlist-form select, .watchlist-form input[type="text"], .watchlist-form button { width: 100%; }

  .quick-claim { flex-direction: column; }
  .quick-claim input, .quick-claim button { width: 100%; }
  .pending-add { flex-direction: column; }
  .pending-add input, .pending-add button { width: 100%; }
  .pending-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .pending-meta { flex-wrap: wrap; gap: 6px; }

  .alert-item { padding: 10px; font-size: 13px; }
  .claim-btn { width: 100%; padding: 10px; font-size: 14px; }

  button, .filter, .node-btn, .wl-remove, .pending-cancel {
    min-height: 36px;
    touch-action: manipulation;
  }
}

/* Responsive — Small phones */
@media (max-width: 400px) {
  .node-grid { grid-template-columns: 1fr; }
  .header-stats { flex-wrap: wrap; justify-content: center; }
}
