:root {
  /* Colors */
  --bg: #0d0e12;
  --panel: #131313;
  --panel-light: #1b1d23;
  --line: rgba(255, 255, 255, 0.05);
  --text: #ffffff;
  --muted: #98a1c0;
  --primary: #1cbf9f;
  --accent: #ff007a;
  --accent-hover: #e0006c;
  --success: #27c485;
  --warning: #f1b44c;
  --danger: #f46a6a;

  /* Spacing & Sizing */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --max-width: 1200px;

  /* Shadows */
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px var(--primary-glow);
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.skeleton {
  background: linear-gradient(90deg, var(--panel-light) 25%, #252830 50%, var(--panel-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
  display: inline-block;
  color: transparent !important;
}

.friendly-error {
  background: rgba(244, 106, 106, 0.1);
  color: var(--danger);
  padding: 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
  border: 1px solid rgba(244, 106, 106, 0.2);
  display: none;
}

.route-details-expandable {
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
}
.route-details-expandable:hover { background: rgba(255,255,255,0.03); }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Manrope", sans-serif;
  color: var(--text);
  background: 
    radial-gradient(circle at 0% 0%, rgba(28, 191, 159, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(28, 191, 159, 0.03) 0%, transparent 40%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; transition: 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }

.container { 
  width: min(var(--max-width), 92vw); 
  margin: 0 auto; 
}

/* --- Global Components --- */

.eyebrow {
  display: block;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.section { padding: 80px 0; }
.section-title { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; margin-bottom: 16px; line-height: 1.1; }
.section-desc { color: var(--muted); font-size: 1.15rem; max-width: 700px; margin-bottom: 40px; }

.hero-actions { display: flex; gap: 16px; margin-top: 32px; }

.premium-card {
  background: var(--panel);
  backdrop-filter: blur(25px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s, border-color 0.3s;
}
.premium-card:hover { border-color: rgba(28, 191, 159, 0.2); }

.metric-card {
  background: var(--panel-light);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}
.metric-card .value { font-size: 2rem; font-weight: 800; color: var(--primary); display: block; }
.metric-card .label { font-size: 0.9rem; color: var(--muted); font-weight: 600; }

.trust-row {
  display: flex;
  gap: 40px;
  opacity: 0.6;
  filter: grayscale(1);
  justify-content: center;
  align-items: center;
  margin-top: 40px;
  flex-wrap: wrap;
}

.cta-band {
  background: linear-gradient(90deg, rgba(28, 191, 159, 0.1), transparent);
  border-left: 4px solid var(--primary);
  padding: 24px;
  border-radius: var(--radius-sm);
  margin: 40px 0;
}

.badge {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.primary { background: var(--primary-glow); color: var(--primary); border-color: var(--primary); }

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 0;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: #18a98c;
  transform: scale(0.99);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid var(--line);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--muted);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* --- Header & Nav --- */

header {
  position: sticky; top: 0; 
  backdrop-filter: blur(25px);
  background: rgba(4, 6, 11, 0.85); 
  z-index: 1000;
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}

.brand { font-weight: 900; font-size: 1.5rem; letter-spacing: -1px; display: flex; align-items: center; gap: 8px; }
.brand span { color: var(--primary); }

.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-links a:hover, .nav-links a.active { color: #fff; }
.nav-links a.active { color: var(--primary); }

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

/* --- Swap Card (App) --- */

.swap-shell { max-width: 480px; margin: 40px auto; }

.swap-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.token-panel {
  background: var(--panel-light);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}
.token-panel:hover { border-color: rgba(255, 255, 255, 0.1); }

.token-panel label {
  font-size: 0.9rem; color: var(--muted); font-weight: 500;
  display: block; margin-bottom: 4px;
}

.token-row { display: flex; justify-content: space-between; align-items: center; }
.token-row input {
  border: 0; background: transparent; color: #fff;
  font-size: 2.2rem; font-weight: 500; width: 60%; outline: none;
  font-family: inherit;
}

.token-select-trigger {
  background: #2c2f36;
  padding: 4px 8px 4px 10px;
  border-radius: 16px;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 0.2s;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.token-select-trigger:hover { background: #3b3f49; }
.token-select-trigger img { width: 24px; height: 24px; border-radius: 50%; }
.token-select-trigger span { font-weight: 600; font-size: 1.1rem; }

.swap-divider {
  display: flex; justify-content: center; margin: -22px 0; position: relative; z-index: 10;
}
.swap-switch-btn {
  background: #1b1d23;
  border: 4px solid var(--panel);
  border-radius: 12px;
  color: var(--muted);
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: 0.2s;
}
.swap-switch-btn:hover {
  background: #2c2f36;
  color: #fff;
}

.balance-row {
  display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--muted); margin-top: 4px;
}
.max-btn {
  color: var(--primary); font-weight: 700; cursor: pointer; background: transparent; border: 0; padding: 0;
}

/* --- Quote Result --- */

.quote-details {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.quote-row { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 8px; }
.quote-row .label { color: var(--muted); }
.quote-row .value { font-weight: 600; }
.quote-row.highlight .value { color: var(--success); }

/* --- Modals --- */

.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; backdrop-filter: blur(10px);
}
.modal-overlay.active { display: flex; }

.modal-content {
  background: #131a2a;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  width: min(440px, 94vw);
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-soft);
}

.modal-header {
  padding: 24px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-body { overflow-y: auto; padding: 12px; }

.search-box {
  padding: 0 24px 16px;
}
.search-box input {
  width: 100%;
  background: var(--panel-light);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  outline: none;
}
.search-box input:focus { border-color: var(--primary); }

.token-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--radius-md); cursor: pointer; transition: 0.2s;
}
.token-item:hover { background: rgba(255, 255, 255, 0.05); }
.token-item img { width: 36px; height: 36px; border-radius: 50%; }
.token-item .name { font-weight: 700; display: block; }
.token-item .symbol { font-size: 0.8rem; color: var(--muted); }

/* --- i18n Selector --- */

.lang-selector { position: relative; }
.lang-trigger {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 100px;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 0.85rem;
}
.lang-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #1b263b; border: 1px solid var(--line);
  border-radius: 12px; padding: 8px; width: 140px;
  display: none; z-index: 100;
}
.lang-dropdown.active { display: block; }
.lang-option {
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.9rem;
}
.lang-option:hover { background: rgba(255,255,255,0.05); color: var(--primary); }

/* --- Blog Cards --- */

.blog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px;
}
.blog-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; transition: 0.3s;
}
.blog-card:hover { transform: translateY(-5px); border-color: var(--primary); }
.blog-card .content { padding: 24px; }
.blog-card .tag { color: var(--primary); font-weight: 800; font-size: 0.75rem; text-transform: uppercase; margin-bottom: 12px; display: block; }
.blog-card h3 { margin: 0 0 12px; line-height: 1.3; }
.blog-card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 20px; }
.blog-card .meta { font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }

/* --- Footer --- */

footer {
  padding: 60px 0 40px; border-top: 1px solid var(--line); margin-top: 80px;
}
.footer-top {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 40px; margin-bottom: 40px;
}
.footer-logo { max-width: 300px; }
.footer-logo p { color: var(--muted); margin-top: 12px; font-size: 0.95rem; }
.footer-links { display: flex; gap: 60px; }
.footer-col h4 { margin-bottom: 20px; font-weight: 800; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col ul li a { color: var(--muted); }
.footer-col ul li a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid var(--line); padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px;
}
.footer-bottom p { font-size: 0.85rem; color: var(--muted); }

/* --- Responsive --- */

@media (max-width: 768px) {
  .nav-links { display: none; }
  .section { padding: 60px 0; }
  .hero-actions { flex-direction: column; }
  .footer-links { gap: 30px; }
  .footer-top { flex-direction: column; }
  .swap-shell { margin: 20px auto; }
}

/* Docs Layout Refined */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 60px;
  padding: 40px 0;
}
.docs-sidebar { position: sticky; top: 120px; }
.docs-sidebar nav a {
  display: block; padding: 12px 16px; border-radius: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px;
}
.docs-sidebar nav a:hover { background: rgba(255,255,255,0.03); color: #fff; }
.docs-sidebar nav a.active { background: var(--primary-glow); color: var(--primary); }

.docs-body h1 { font-size: 3rem; font-weight: 900; margin-bottom: 24px; }
.docs-body h2 { font-size: 1.8rem; font-weight: 800; margin: 48px 0 20px; border-left: 4px solid var(--primary); padding-left: 20px; }
.docs-body p { color: var(--muted); font-size: 1.1rem; margin-bottom: 24px; }
.docs-body code { background: #000; padding: 4px 8px; border-radius: 6px; font-family: monospace; color: var(--primary); }
.docs-code-card {
  background: #000; padding: 24px; border-radius: 16px; border: 1px solid var(--line); font-family: monospace; font-size: 0.9rem; color: #a5d6ff; overflow-x: auto; margin: 24px 0;
}

/* Hide spinners */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

.percent-row-compact {
  display: flex;
  gap: 12px;
  align-items: center;
}
.pct-btn {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  opacity: 0.6;
  transition: 0.2s;
  padding: 2px 4px;
}
.pct-btn:hover {
  opacity: 1;
  background: rgba(28, 191, 159, 0.1);
  border-radius: 4px;
}
