:root {
  color-scheme: dark;
  --bg-0: #05070d;
  --bg-1: #0b1020;
  --bg-2: rgba(15, 25, 46, 0.75);
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-alt: rgba(32, 51, 67, 0.8);
  --border: rgba(148, 163, 184, 0.14);
  --accent: #34d399;
  --accent-strong: #10b981;
  --accent-muted: rgba(52, 211, 153, 0.2);
  --fg: #f1f5f9;
  --fg-muted: #94a3b8;
  --fg-soft: rgba(226, 232, 240, 0.65);
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.55);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--fg);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.background-gradient,
.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.background-gradient {
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.25) 0%, transparent 45%),
    radial-gradient(circle at 25% 10%, rgba(52, 211, 153, 0.18) 0%, transparent 40%),
    radial-gradient(circle at 65% 85%, rgba(14, 165, 233, 0.22) 0%, transparent 55%),
    linear-gradient(160deg, #04060b 0%, #0a111f 55%, #05070d 100%);
}

.background-grid {
  background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.5;
  z-index: -3;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  width: min(1440px, 96vw);
  margin: 0 auto;
  padding: 5rem 0 6rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.top-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1440px, 96vw);
  margin: 1.75rem auto 0;
  padding: 1rem 1.6rem;
  background: rgba(8, 13, 24, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.4);
  backdrop-filter: blur(12px);
  gap: 1.5rem;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(52, 211, 153, 0.1);
  border-radius: 50%;
}

.brand-icon svg {
  width: 26px;
  height: 26px;
}

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 1.4rem;
  font-size: 1rem;
  color: var(--fg-muted);
}

.top-nav a {
  position: relative;
  padding-bottom: 0.25rem;
  transition: color 0.2s ease;
}

.top-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.top-nav a:hover::after,
.top-nav a:focus-visible::after {
  transform: scaleX(1);
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #02130a;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 16px 30px rgba(20, 184, 166, 0.35);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 3.5rem;
  align-items: center;
  padding: 3.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% 40% 40% -40%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.14) 0%, transparent 60%);
  opacity: 0.75;
  pointer-events: none;
}

.hero-text {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.hero-badge {
  align-self: flex-start;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.1);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 3.6vw, 3.4rem);
  line-height: 1.05;
}

.subtitle {
  margin: 0;
  color: var(--fg-soft);
  font-size: 1.12rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04130c;
  font-weight: 600;
  box-shadow: 0 22px 44px rgba(16, 185, 129, 0.28);
}

.hero-secondary {
  padding: 0.95rem 1.8rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.hero-secondary:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.hero-preview {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.6rem;
}

.hero-card {
  padding: 1.8rem;
  background: rgba(23, 34, 55, 0.85);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.1);
}

.hero-card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--fg);
}

.hero-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.hero-card li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
  color: var(--fg-soft);
}

.hero-card .value {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent);
}

.hero-card.alt {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(14, 165, 233, 0.25);
}

.hero-card.alt .note {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--fg-soft);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: stretch;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2.4rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.market-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.market-controls {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-end;
}

.market-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 200px;
}

.market-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg-soft);
  margin: 0;
}

.market-field input {
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(10, 15, 25, 0.8);
  color: inherit;
  font-size: 1.05rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.market-header h2 {
  margin: 0;
}

.market-subtitle {
  margin: 0.25rem 0 0;
  color: var(--fg-soft);
  font-size: 1.05rem;
}

.market-toggle,
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  background: rgba(57, 72, 99, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.2);
  cursor: pointer;
  color: var(--fg-soft);
  font-size: 1rem;
  font-weight: 500;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.market-toggle:hover,
.toggle:hover {
  border-color: var(--accent);
  color: var(--fg);
}

.market-toggle input,
.toggle input {
  accent-color: var(--accent);
}

.market-title {
  margin: 1.1rem 0 0.6rem;
  font-size: 1.2rem;
}

.deal-table-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
}

.deal-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
  background: rgba(4, 6, 13, 0.5);
  font-size: 1.05rem;
}

.deal-table thead th {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-soft);
  font-weight: 600;
  background: rgba(15, 23, 42, 0.85);
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.deal-table td {
  padding: 1.05rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: middle;
}

.deal-table tbody tr:last-child td {
  border-bottom: none;
}

.deal-score {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-weight: 600;
}

.deal-score-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.deal-score-bar span {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #3b82f6);
}

.deal-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.deal-item strong {
  font-size: 1.15rem;
}

.deal-item span {
  color: var(--fg-soft);
  font-size: 0.95rem;
}

.deal-price {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 1.05rem;
}

.deal-price small {
  font-size: 0.9rem;
  color: var(--fg-soft);
}

.deal-arbitrage {
  font-weight: 600;
  color: #5eead4;
  font-size: 1.05rem;
}

.deal-arbitrage.negative {
  color: #f87171;
}

.deal-liquid {
  font-weight: 600;
  color: var(--fg);
  font-size: 1.05rem;
}

.deal-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.deal-hints span {
  background: rgba(15, 23, 42, 0.75);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  color: var(--fg-soft);
}

.deal-action {
  text-align: right;
  font-size: 1rem;
}

.deal-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.deal-inspect {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.deal-inspect:hover {
  background: var(--accent);
  color: #032418;
  transform: translateY(-1px);
}

.deal-listing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.55rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.deal-listing:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.deal-error {
  margin: 1rem 0 0;
  color: #f87171;
}

#deals-loading td,
#deals-empty td {
  text-align: center;
  color: var(--fg-soft);
}

button {
  font-family: inherit;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  color: #04130c;
  font-weight: 600;
  padding: 0.9rem 1.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(16, 185, 129, 0.35);
}

button.hero-secondary {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--fg);
  box-shadow: none;
}

button.hero-secondary:hover {
  box-shadow: none;
  border-color: var(--accent);
}

#status {
  margin-top: 1.1rem;
  min-height: 1.3rem;
  color: var(--fg-soft);
  font-size: 0.95rem;
}

.card#result h2 {
  margin-top: 0;
  margin-bottom: 1.1rem;
}

.summary {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 1.5rem;
  align-items: center;
}

.summary img {
  width: 100%;
  max-width: 220px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.85);
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.summary ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.summary strong {
  color: var(--fg-soft);
  font-weight: 500;
  margin-right: 0.4rem;
}

#stickers h3 {
  margin-bottom: 0.75rem;
}

#sticker-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

#sticker-list li {
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.65);
}

#raw-data {
  margin-top: 1.4rem;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

pre {
  max-height: 360px;
  overflow: auto;
  background: rgba(4, 7, 15, 0.85);
  padding: 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.85rem;
}

.info-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
  gap: 2rem;
  align-items: center;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(8, 145, 178, 0.18));
}

.info-card h2 {
  margin-top: 0;
}

.info-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.info-card li {
  color: var(--fg-soft);
  line-height: 1.5;
}

.info-highlight {
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius-sm);
  background: rgba(8, 47, 73, 0.65);
  border: 1px solid rgba(125, 211, 252, 0.25);
}

.info-highlight .eyebrow {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.18);
  color: #7dd3fc;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.info-highlight p {
  margin: 0.8rem 0 0;
  color: var(--fg);
  line-height: 1.55;
}

.page-footer {
  margin: auto auto 2.5rem;
  width: min(1180px, 92vw);
  padding: 1.5rem 1rem 0;
  color: var(--fg-soft);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.page-footer .smallprint {
  font-size: 0.8rem;
  opacity: 0.75;
}

@media (max-width: 1024px) {
  .top-bar {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-preview {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .info-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .top-bar {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
  }

  main {
    padding-top: 3rem;
  }

  .hero {
    padding: 2.2rem 1.7rem;
  }

  .market-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .market-field {
    flex: 1 1 160px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-secondary {
    width: 100%;
    text-align: center;
  }

  .deal-table {
    min-width: 100%;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .summary img {
    margin: 0 auto;
  }
}

@media (max-width: 520px) {
  .top-nav {
    display: none;
  }

  .cta {
    padding: 0.6rem 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  .market-toggle,
  .toggle {
    width: 100%;
    justify-content: center;
  }
}
