:root {
  --bg: #050505;
  --surface: #0c0c0c;
  --border: #1a1a1a;
  --border-hover: #2a2a2a;
  --text: #c8c8c8;
  --text-muted: #5a5a5a;
  --text-dim: #3a3a3a;
  --white: #f0f0f0;
  --accent: #b8ff57;
  --accent-dim: rgba(184, 255, 87, 0.08);
  --sol: #9945ff;
  --evm: #627eea;
  --mono: "IBM Plex Mono", "SF Mono", "Fira Code", monospace;
  --sans: "DM Sans", -apple-system, sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}

/* --- Header --- */

.header {
  margin-bottom: 2.5rem;
  animation: fadeUp 0.5s ease both;
  animation-delay: calc(var(--i) * 0.07s);
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.logo-mark {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.logo-mark:hover {
  opacity: 0.85;
}

.logo-divider {
  font-family: var(--mono);
  font-size: 1.5rem;
  color: var(--text-dim);
  font-weight: 400;
}

.logo-sub {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Cards --- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  animation: fadeUp 0.5s ease both;
  animation-delay: calc(var(--i) * 0.07s);
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-accent {
  border-top: 1px solid rgba(184, 255, 87, 0.15);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-header h2 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.badge.sol {
  color: var(--sol);
  border-color: rgba(153, 69, 255, 0.25);
  background: rgba(153, 69, 255, 0.06);
}

.badge.evm {
  color: var(--evm);
  border-color: rgba(98, 126, 234, 0.25);
  background: rgba(98, 126, 234, 0.06);
}

/* --- Eco Grid --- */

.eco-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0; /* cards have margin-bottom */
}

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

/* --- Fields --- */

.field, .override-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.field:last-child, .override-row:last-child {
  margin-bottom: 0;
}

label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
  width: 5.5rem;
}

.select-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.select-wrap::after {
  content: "\25BE";
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.7rem;
  pointer-events: none;
}

select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.45rem 1.6rem 0.45rem 0.6rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}

select:hover {
  border-color: var(--border-hover);
}

select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

/* --- Hints --- */

.hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

code {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
}

/* --- Override Items --- */

.override-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  animation: fadeUp 0.2s ease both;
}

.override-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  min-width: 0;
}

.badge.sm {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  flex-shrink: 0;
}

.override-action {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.override-arrow {
  color: var(--text-dim);
  font-size: 0.7rem;
}

.override-platform {
  color: var(--white);
  font-size: 0.82rem;
}

.remove-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.remove-btn:hover {
  color: #ff4444;
  border-color: rgba(255, 68, 68, 0.25);
}

.override-empty {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.5rem 0;
}

/* --- Add Override --- */

.add-override {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.add-override-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.add-override-row .select-wrap {
  flex: 1;
}

@media (max-width: 600px) {
  .container {
    padding: 1.5rem 1rem 1.5rem;
  }

  .header {
    margin-bottom: 1.5rem;
  }

  .card {
    padding: 1rem 1rem;
  }

  label {
    width: 4.5rem;
    font-size: 0.7rem;
  }

  .add-override-row {
    flex-wrap: wrap;
  }

  .add-override-row .select-wrap {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
  }

  .add-btn {
    flex: 0 0 2rem;
  }
}

.add-btn {
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.add-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 8px rgba(184, 255, 87, 0.2);
}

.add-btn.pending {
  border-color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

.add-btn:disabled {
  color: var(--text-dim);
  cursor: default;
}

select:disabled {
  color: var(--text-dim);
  cursor: default;
  opacity: 0.5;
}

/* --- Footer --- */

.footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(184, 255, 87, 0.15);
  animation: fadeUp 0.5s ease both;
  animation-delay: calc(var(--i) * 0.07s);
}

.footer-title {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.footer-table {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.footer-route {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-route code {
  font-size: 0.7rem;
  white-space: nowrap;
}

.dim { color: var(--text-dim); }
.accent { color: var(--accent); }

.footer-desc {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.footer-chains {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.footer-chains > span {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.2rem;
}

.chain-tag {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
}

/* --- Animations --- */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 255, 87, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(184, 255, 87, 0); }
}
