:root {
  --bg-dark: #0b0f19;
  --bg-card: #111827;
  --bg-card-hover: #1f2937;
  --border-color: #1f2937;
  --border-glow: #374151;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent-gold: #f59e0b;
  --accent-emerald: #10b981;
  --accent-danger: #ef4444;
  --accent-amber: #f97316;
  --accent-cyan: #06b6d4;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(245, 158, 11, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
}

input, select, textarea {
  min-width: 0;
  font-family: inherit;
}

.app-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 60px 20px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
  flex-shrink: 0;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 12px;
  border-radius: 20px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.lang-switcher {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-btn.active {
  background: #374151;
  color: #fff;
}

.lang-btn:hover:not(.active) {
  color: var(--text-main);
}

/* Top HUD Grid */
.hud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.hud-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.hud-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
}

.hud-card.critical {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, var(--bg-card) 100%);
}

.hud-card.warning {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 100%);
}

.hud-card.accent {
  border-color: rgba(6, 182, 212, 0.4);
}

.hud-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.hud-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  color: #fff;
  margin-bottom: 4px;
}

.hud-card.critical .hud-value {
  color: #f87171;
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

.hud-card.warning .hud-value {
  color: #fbbf24;
}

.hud-card.accent .hud-value {
  color: #38bdf8;
}

.hud-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.danger-tag {
  color: #fca5a5;
  font-weight: 600;
}

/* Discord Alert Mirror Section */
.discord-mirror-section {
  background: rgba(43, 45, 49, 0.35);
  border: 1px dashed rgba(249, 115, 22, 0.4);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 30px;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #f97316;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.discord-embed-card {
  background: #2b2d31;
  border-radius: 8px;
  display: flex;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.discord-embed-bar {
  width: 5px;
  background: #f97316;
  flex-shrink: 0;
}

.discord-embed-body {
  padding: 16px 18px;
  flex: 1;
}

.discord-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.discord-bot-badge {
  background: #5865f2;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.discord-time {
  font-size: 11px;
  color: #949ba4;
}

.discord-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.discord-desc {
  font-size: 13.5px;
  color: #dbdee1;
  margin-bottom: 14px;
  line-height: 1.6;
}

.account-pill {
  background: #1e1f22;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: #f2f3f5;
  font-size: 12px;
}

.btn-mini-copy {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  margin-left: 4px;
  vertical-align: middle;
}

.btn-mini-link {
  color: #00a8fc;
  font-size: 11.5px;
  text-decoration: none;
  margin-left: 6px;
}

.btn-mini-link:hover {
  text-decoration: underline;
}

.discord-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  background: rgba(30, 31, 34, 0.6);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.field-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #949ba4;
  margin-bottom: 3px;
}

.field-val {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
}

.field-val.highlight {
  color: #fca5a5;
}

.field-sub {
  font-size: 11px;
  color: #949ba4;
  font-weight: 400;
}

.profit-val {
  color: #34d399;
}

.discord-footer {
  font-size: 11px;
  color: #949ba4;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

/* Radar Controls & Header */
.radar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.radar-title-wrap h2 {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.radar-title-wrap p {
  font-size: 13px;
  color: var(--text-muted);
}

.radar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tabs-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn.active {
  background: #374151;
  color: #fff;
}

.tab-btn.danger-tab.active {
  background: #ef4444;
  color: #fff;
}

.search-box input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  width: 220px;
  transition: border-color 0.15s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.btn-refresh {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.btn-refresh:hover {
  opacity: 0.9;
}

.refresh-icon {
  font-size: 14px;
}

/* Refresh Progress Bar */
.refresh-indicator-bar {
  margin-bottom: 16px;
  position: relative;
  height: 4px;
  background: #1f2937;
  border-radius: 2px;
  overflow: hidden;
}

.refresh-progress {
  height: 100%;
  background: var(--accent-emerald);
  width: 100%;
  transition: width 1s linear;
}

.refresh-label {
  position: absolute;
  right: 0;
  top: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* Table Responsive */
.table-responsive {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow-x: auto;
  margin-bottom: 30px;
  margin-top: 24px;
}

.radar-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.radar-table th {
  background: #0f172a;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.radar-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.7);
  color: var(--text-main);
  white-space: nowrap;
  vertical-align: middle;
}

.radar-table tr:hover {
  background: var(--bg-card-hover);
}

.risk-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.risk-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.risk-badge.critical {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.risk-badge.danger {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.risk-badge.watch {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.risk-badge.healthy {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.health-meter {
  width: 60px;
  height: 6px;
  background: #374151;
  border-radius: 3px;
  overflow: hidden;
}

.health-meter-fill {
  height: 100%;
}

.health-meter-fill.critical { background: #ef4444; width: 95%; }
.health-meter-fill.danger { background: #f59e0b; width: 80%; }
.health-meter-fill.watch { background: #3b82f6; width: 50%; }
.health-meter-fill.healthy { background: #10b981; width: 20%; }

.account-col code {
  font-family: var(--font-mono);
  color: #e2e8f0;
}

.chain-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.chain-badge.arb {
  background: rgba(40, 160, 240, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(40, 160, 240, 0.3);
}

.chain-badge.base {
  background: rgba(0, 82, 255, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(0, 82, 255, 0.3);
}

.hf-val {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 14px;
}

.hf-val.critical { color: #f87171; text-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
.hf-val.danger { color: #fbbf24; }
.hf-val.watch { color: #93c5fd; }
.hf-val.healthy { color: #86efac; }

.val-mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

.profit-mono {
  font-family: var(--font-mono);
  font-weight: 800;
  color: #10b981;
}

.actions-cell {
  display: flex;
  gap: 8px;
}

.btn-table-action {
  background: #1f2937;
  border: 1px solid #374151;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-table-action:hover {
  background: #374151;
  border-color: var(--accent-gold);
}

/* Simulator Section */
.simulator-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 30px;
}

.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.sim-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sim-icon {
  font-size: 28px;
}

.sim-title h3 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.sim-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

.btn-preset {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preset:hover {
  background: rgba(245, 158, 11, 0.22);
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .sim-grid {
    grid-template-columns: 1fr;
  }
}

.sim-inputs-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(15, 23, 42, 0.6);
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-group input, .input-group select {
  width: 100%;
  background: #111827;
  border: 1px solid #374151;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-mono);
}

.input-group input:focus, .input-group select:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.input-disabled {
  background: #1a2234 !important;
  color: #64748b !important;
  cursor: not-allowed;
}

.sim-steps-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(15, 23, 42, 0.6);
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.step-num {
  width: 28px;
  height: 28px;
  background: #1f2937;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  border: 1px solid #374151;
}

.step-num.highlight {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #10b981;
}

.step-content {
  flex: 1;
}

.step-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.step-val {
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #e2e8f0;
  margin-bottom: 2px;
}

.step-val.profit {
  font-size: 18px;
  color: #10b981;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.step-note {
  font-size: 11.5px;
  color: var(--text-dim);
}

.result-step {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

/* Info Section */
.info-section {
  margin-bottom: 40px;
}

.info-section h3 {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px 20px;
}

.info-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: #f59e0b;
  margin-bottom: 8px;
}

.info-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Portal Backlink Wrap */
.portal-backlink-wrap {
  text-align: center;
  padding: 20px 0 10px 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

.portal-backlink {
  color: var(--accent-emerald);
  text-decoration: none;
  font-weight: 700;
  margin-right: 8px;
}

.portal-backlink:hover {
  text-decoration: underline;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #10b981;
  color: #000;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease;
  z-index: 9999;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .radar-header {
    flex-direction: column;
  }
  .radar-controls {
    width: 100%;
  }
  .tabs-group {
    width: 100%;
    overflow-x: auto;
  }
  .search-box {
    width: 100%;
  }
  .search-box input {
    width: 100%;
  }
}
